diff --git a/.gitignore b/.gitignore index 04a977352..b741a2d44 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,11 @@ coverage node_modules dist storage +.idea npm-debug.log .eslintcache datasources.*.json print.*.json db.json junit.xml -.DS_Store \ No newline at end of file +.DS_Store diff --git a/.vscode/settings.json b/.vscode/settings.json index 54dc05c7f..05d23f3bb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,14 @@ -// Coloque su configuración en este archivo para sobrescribir la configuración predeterminada y de usuario. -{ - // Carácter predeterminado de final de línea. - "files.eol": "\n", - "editor.codeActionsOnSave": { - "source.fixAll.eslint": true - } -} \ No newline at end of file +// Coloque su configuración en este archivo para sobrescribir la configuración predeterminada y de usuario. +{ + // Carácter predeterminado de final de línea. + "files.eol": "\n", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + }, + "search.useIgnoreFiles": false, + "editor.defaultFormatter": "dbaeumer.vscode-eslint", + "eslint.format.enable": true, + "[javascript]": { + "editor.defaultFormatter": "dbaeumer.vscode-eslint" + } +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..25c1fc2fe --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,103 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [2314.01] - 2023-04-20 + +### Added +- + +### Changed +- + +### Fixed +- + +## [2312.01] - 2023-04-06 + +### Added +- (Monitor tickets) Muestra un icono al lado de la zona, si el ticket es frágil y se envía por agencia + +### Changed +- (Monitor tickets) Cuando se filtra por 'Pendiente' ya no muestra los estados de 'Previa' +- (Envíos -> Extra comunitarios) Se agrupan las entradas del mismo travel. Añadidos campos Referencia y Importe. +- (Envíos -> Índice) Cambiado el buscador superior por uno lateral + +## [2310.01] - 2023-03-23 + +### Added +- (Trabajadores -> Control de horario) Ahora se puede confirmar/no confirmar el registro horario de cada semana desde esta sección + +### Fixed +- (Clientes -> Listado extendido) Resuelto error al filtrar por clientes inactivos desde la columna "Activo" +- (General) Al pasar el ratón por encima del icono de "Borrar" en un campo, se hacía más grande afectando a la interfaz + +## [2308.01] - 2023-03-09 + +### Added +- (Proveedores -> Datos fiscales) Añadido checkbox 'Vies' +- (Client -> Descriptor) Nuevo icono $ con barrotes para los clientes con impago +- (Trabajador -> Datos Básicos) Añadido nuevo campo Taquilla +- (Trabajador -> PDA) Nueva sección + +### Changed +- (Ticket -> Borrar ticket) Restringido el borrado de tickets con abono + +## [2306.01] - 2023-02-23 + +### Added +- (Tickets -> Datos Básicos) Mensaje de confirmación al intentar generar tickets con negativos +- (Artículos) El visible y disponible se calcula a partir de un almacén diferente dependiendo de la sección en la que te encuentres. Se ha añadido un icono que informa sobre a partir de que almacén se esta calculando. + +### Changed +- (General -> Inicio) Ahora permite recuperar la contraseña tanto con el correo de recuperación como el usuario + +### Fixed +- (Monitor de tickets) Cuando ordenas por columna, ya no se queda deshabilitado el botón de 'Actualizar' +- (Zone -> Días de entrega) Al hacer click en un día, muestra correctamente las zonas +- (Artículos) El disponible en la vista previa se muestra correctamente + +## [2304.01] - 2023-02-09 + +### Added +- (Rutas) Al descargar varias facturas se comprime en un zip +- (Trabajadores -> Nuevo trabajador) Nueva sección +- (Tickets -> Adelantar tickets) Añadidos campos "líneas" y "litros" al ticket origen +- (Tickets -> Adelantar tickets) Nuevo icono muestra cuando las agencias de los tickets origen/destino son distintas + +### Changed +- (Entradas -> Compras) Cambiados los campos "Precio Grouping/Packing" por "PVP" y "Precio" por "Coste" +- (Artículos -> Últimas entradas) Cambiados los campos "P.P.U." y "P.P.P." por "PVP" +- (Rutas -> Sumario/Tickets) Actualizados campos de los tickets +- (Proveedores -> Crear/Editar) Permite añadir Proveedores con la misma razón social pero con países distintos +- (Tickets -> Adelantar tickets) Cambiados selectores de estado por checks "Pendiente origen/destino" +- (Tickets -> Adelantar tickets) Cambiado stock de destino a origen. + +### Fixed +- (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas. +- (Cliente -> Datos Fiscales) No se permite seleccionar 'Notificar vía e-mail' a los clientes sin e-mail +- (Tickets -> Datos básicos) Permite guardar la hora de envío +- (Tickets -> Añadir pago) Eliminado "null" en las referencias +- (Tickets -> Adelantar tickets) Permite ordenar por importe +- (Tickets -> Adelantar tickets) El filtrado por encajado muestra también los tickets sin tipo de encajado + +## [2302.01] - 2023-01-26 + +### Added +- (General -> Inicio) Permite recuperar la contraseña +- (Tickets -> Opciones) Subir albarán a Docuware +- (Tickets -> Opciones) Enviar correo con PDF de Docuware +- (Artículos -> Datos Básicos) Añadido campo Unidades/Caja + +### Changed +- (Reclamaciones -> Descriptor) Cambiado el campo Agencia por Zona +- (Tickets -> Líneas preparadas) Actualizada sección para que sea más visual + +### Fixed +- (General) Al utilizar el traductor de Google se descuadraban los iconos + +### Removed +- (Tickets -> Control clientes) Eliminada sección diff --git a/Dockerfile b/Dockerfile index 9caaa30a1..ee87cd0d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,32 +1,44 @@ -FROM debian:stretch-slim +FROM debian:bullseye-slim ENV TZ Europe/Madrid ARG DEBIAN_FRONTEND=noninteractive + +# NodeJs + RUN apt-get update \ && apt-get install -y --no-install-recommends \ curl \ ca-certificates \ gnupg2 \ - libfontconfig lftp \ - && apt-get -y install xvfb gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \ - libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \ - libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \ - libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \ - libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget \ - && curl -sL https://deb.nodesource.com/setup_12.x | bash - \ + graphicsmagick \ + && curl -fsSL https://deb.nodesource.com/setup_14.x | bash - \ + && apt-get install -y --no-install-recommends nodejs \ + && npm install -g npm@8.19.2 + +# Puppeteer + +RUN apt-get update \ && apt-get install -y --no-install-recommends \ - nodejs \ - && apt-get purge -y --auto-remove \ - gnupg2 \ + libfontconfig lftp xvfb gconf-service libasound2 libatk1.0-0 libc6 \ + libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 \ + libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 \ + libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 \ + libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 \ + libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \ + fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget \ && rm -rf /var/lib/apt/lists/* \ && npm -g install pm2 +# Salix + WORKDIR /salix + +COPY print/package.json print/package-lock.json print/ +RUN npm --prefix ./print install --omit=dev ./print + COPY package.json package-lock.json ./ COPY loopback/package.json loopback/ -COPY print/package.json print/ -RUN npm install --only=prod -RUN npm --prefix ./print install --only=prod ./print +RUN npm install --omit=dev COPY loopback loopback COPY back back diff --git a/Jenkinsfile b/Jenkinsfile index 4a1f9ba54..b1706d802 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,4 @@ #!/usr/bin/env groovy - pipeline { agent any options { diff --git a/back/methods/account/privileges.js b/back/methods/account/privileges.js new file mode 100644 index 000000000..5c5e7409d --- /dev/null +++ b/back/methods/account/privileges.js @@ -0,0 +1,78 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('privileges', { + description: 'Change role and hasGrant if user has privileges', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The user id', + http: {source: 'path'} + }, + { + arg: 'roleFk', + type: 'number', + description: 'The new role for user', + }, + { + arg: 'hasGrant', + type: 'boolean', + description: 'Whether to has grant' + } + ], + http: { + path: `/:id/privileges`, + verb: 'POST' + } + }); + + Self.privileges = async function(ctx, id, roleFk, hasGrant, options) { + if (!(hasGrant != null || roleFk)) return; + + const models = Self.app.models; + const userId = ctx.req.accessToken.userId; + + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const user = await models.Account.findById(userId, {fields: ['hasGrant']}, myOptions); + + const userToUpdate = await models.Account.findById(id, { + fields: ['id', 'name', 'hasGrant', 'roleFk', 'password'], + include: { + relation: 'role', + scope: { + fields: ['name'] + } + } + }, myOptions); + + if (!user.hasGrant) + throw new UserError(`You don't have grant privilege`); + + const hasRoleFromUser = await models.Account.hasRole(userId, userToUpdate.role().name, myOptions); + + if (!hasRoleFromUser) + throw new UserError(`You don't own the role and you can't assign it to another user`); + + if (hasGrant != null) + userToUpdate.hasGrant = hasGrant; + + if (roleFk) { + const role = await models.Role.findById(roleFk, {fields: ['name']}, myOptions); + const hasRole = await models.Account.hasRole(userId, role.name, myOptions); + + if (!hasRole) + throw new UserError(`You don't own the role and you can't assign it to another user`); + + userToUpdate.roleFk = roleFk; + } + + await userToUpdate.save(userToUpdate); + await models.UserAccount.sync(userToUpdate.name); + }; +}; diff --git a/back/methods/account/recover-password.js b/back/methods/account/recover-password.js new file mode 100644 index 000000000..787a45284 --- /dev/null +++ b/back/methods/account/recover-password.js @@ -0,0 +1,39 @@ +module.exports = Self => { + Self.remoteMethod('recoverPassword', { + description: 'Send email to the user', + accepts: [ + { + arg: 'user', + type: 'string', + description: 'The user name or email', + required: true + } + ], + http: { + path: `/recoverPassword`, + verb: 'POST' + } + }); + + Self.recoverPassword = async function(user) { + const models = Self.app.models; + + const usesEmail = user.indexOf('@') !== -1; + if (!usesEmail) { + const account = await models.Account.findOne({ + fields: ['email'], + where: {name: user} + }); + user = account.email; + } + + try { + await models.user.resetPassword({email: user, emailTemplate: 'recover-password'}); + } catch (err) { + if (err.code === 'EMAIL_NOT_FOUND') + return; + else + throw err; + } + }; +}; diff --git a/back/methods/account/specs/privileges.spec.js b/back/methods/account/specs/privileges.spec.js new file mode 100644 index 000000000..edfe0f03f --- /dev/null +++ b/back/methods/account/specs/privileges.spec.js @@ -0,0 +1,115 @@ +const models = require('vn-loopback/server/server').models; + +describe('account privileges()', () => { + const employeeId = 1; + const developerId = 9; + const sysadminId = 66; + const itBossId = 104; + const rootId = 100; + const clarkKent = 1103; + + it('should throw an error when user not has privileges', async() => { + const ctx = {req: {accessToken: {userId: developerId}}}; + const tx = await models.Account.beginTransaction({}); + + let error; + try { + const options = {transaction: tx}; + + await models.Account.privileges(ctx, employeeId, null, true, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toContain(`You don't have grant privilege`); + }); + + it('should throw an error when user has privileges but not has the role', async() => { + const ctx = {req: {accessToken: {userId: sysadminId}}}; + const tx = await models.Account.beginTransaction({}); + + let error; + try { + const options = {transaction: tx}; + + await models.Account.privileges(ctx, employeeId, rootId, null, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toContain(`You don't own the role and you can't assign it to another user`); + }); + + it('should throw an error when user has privileges but not has the role from user', async() => { + const ctx = {req: {accessToken: {userId: sysadminId}}}; + const tx = await models.Account.beginTransaction({}); + + let error; + try { + const options = {transaction: tx}; + + await models.Account.privileges(ctx, itBossId, developerId, null, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toContain(`You don't own the role and you can't assign it to another user`); + }); + + it('should change role', async() => { + const ctx = {req: {accessToken: {userId: sysadminId}}}; + const tx = await models.Account.beginTransaction({}); + + const options = {transaction: tx}; + const agency = await models.Role.findOne({ + where: { + name: 'agency' + } + }, options); + + let error; + let result; + try { + await models.Account.privileges(ctx, clarkKent, agency.id, null, options); + result = await models.Account.findById(clarkKent, null, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error).not.toBeDefined(); + expect(result.roleFk).toEqual(agency.id); + }); + + it('should change hasGrant', async() => { + const ctx = {req: {accessToken: {userId: sysadminId}}}; + const tx = await models.Account.beginTransaction({}); + + let error; + let result; + try { + const options = {transaction: tx}; + await models.Account.privileges(ctx, clarkKent, null, true, options); + result = await models.Account.findById(clarkKent, null, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error).not.toBeDefined(); + expect(result.hasGrant).toBeTruthy(); + }); +}); diff --git a/back/methods/account/specs/set-password.spec.js b/back/methods/account/specs/set-password.spec.js index c76fd52b8..fe71873de 100644 --- a/back/methods/account/specs/set-password.spec.js +++ b/back/methods/account/specs/set-password.spec.js @@ -1,6 +1,6 @@ const app = require('vn-loopback/server/server'); -describe('account changePassword()', () => { +describe('account setPassword()', () => { it('should throw an error when password does not meet requirements', async() => { let req = app.models.Account.setPassword(1, 'insecurePass'); diff --git a/back/methods/campaign/latest.js b/back/methods/campaign/latest.js index 20dda8a26..56ab81330 100644 --- a/back/methods/campaign/latest.js +++ b/back/methods/campaign/latest.js @@ -22,15 +22,19 @@ module.exports = Self => { Self.latest = async filter => { const conn = Self.dataSource.connector; - const minDate = new Date(); + const minDate = Date.vnNew(); minDate.setFullYear(minDate.getFullYear() - 1); const where = {dated: {gte: minDate}}; filter = mergeFilters(filter, {where}); const stmt = new ParameterizedSQL( - `SELECT * FROM campaign`); + `SELECT * FROM (`); + stmt.merge('SELECT * FROM campaign'); stmt.merge(conn.makeWhere(filter.where)); + stmt.merge('ORDER BY dated ASC'); + stmt.merge('LIMIT 10000000000000000000'); + stmt.merge(') sub'); stmt.merge('GROUP BY code'); stmt.merge(conn.makePagination(filter)); diff --git a/back/methods/campaign/spec/latest.spec.js b/back/methods/campaign/spec/latest.spec.js index a71849b59..59e4c1e7a 100644 --- a/back/methods/campaign/spec/latest.spec.js +++ b/back/methods/campaign/spec/latest.spec.js @@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server'); describe('campaign latest()', () => { it('should return the campaigns from the last year', async() => { - const now = new Date(); + const now = Date.vnNew(); const result = await app.models.Campaign.latest(); const randomIndex = Math.floor(Math.random() * result.length); const campaignDated = result[randomIndex].dated; @@ -12,7 +12,7 @@ describe('campaign latest()', () => { }); it('should return the campaigns from the current year', async() => { - const now = new Date(); + const now = Date.vnNew(); const currentYear = now.getFullYear(); const result = await app.models.Campaign.latest({ where: {dated: {like: `%${currentYear}%`}} diff --git a/back/methods/campaign/spec/upcoming.spec.js b/back/methods/campaign/spec/upcoming.spec.js index 14bffe3cf..2aec5117f 100644 --- a/back/methods/campaign/spec/upcoming.spec.js +++ b/back/methods/campaign/spec/upcoming.spec.js @@ -4,7 +4,7 @@ describe('campaign upcoming()', () => { it('should return the upcoming campaign but from the last year', async() => { const response = await app.models.Campaign.upcoming(); const campaignDated = response.dated; - const now = new Date(); + const now = Date.vnNew(); expect(campaignDated).toEqual(jasmine.any(Date)); expect(campaignDated).toBeLessThanOrEqual(now); diff --git a/back/methods/campaign/upcoming.js b/back/methods/campaign/upcoming.js index 2f1a5a377..c98fee6e5 100644 --- a/back/methods/campaign/upcoming.js +++ b/back/methods/campaign/upcoming.js @@ -14,7 +14,7 @@ module.exports = Self => { }); Self.upcoming = async() => { - const minDate = new Date(); + const minDate = Date.vnNew(); minDate.setFullYear(minDate.getFullYear() - 1); return Self.findOne({ diff --git a/back/methods/chat/getServiceAuth.js b/back/methods/chat/getServiceAuth.js index 827092109..ff14e76cb 100644 --- a/back/methods/chat/getServiceAuth.js +++ b/back/methods/chat/getServiceAuth.js @@ -21,7 +21,7 @@ module.exports = Self => { if (!this.login) return; - if (Date.now() > this.login.expires) + if (Date.vnNow() > this.login.expires) this.login = await requestToken(); return this.login; @@ -48,7 +48,7 @@ module.exports = Self => { userId: requestData.userId, token: requestData.authToken }, - expires: Date.now() + (1000 * 60 * tokenLifespan) + expires: Date.vnNow() + (1000 * 60 * tokenLifespan) }; } } diff --git a/back/methods/chat/notifyIssues.js b/back/methods/chat/notifyIssues.js index b0a42b7be..f618a6fb1 100644 --- a/back/methods/chat/notifyIssues.js +++ b/back/methods/chat/notifyIssues.js @@ -8,7 +8,7 @@ module.exports = Self => { }, http: { path: `/notifyIssues`, - verb: 'GET' + verb: 'POST' } }); @@ -32,7 +32,7 @@ module.exports = Self => { let message = $t(`There's a new urgent ticket:`); const ostUri = 'https://cau.verdnatura.es/scp/tickets.php?id='; tickets.forEach(ticket => { - message += `\r\n[ID: *${ticket.number}* - ${ticket.subject} (@${ticket.username})](${ostUri + ticket.id})`; + message += `\r\n[ID: ${ticket.number} - ${ticket.subject} @${ticket.username}](${ostUri + ticket.id})`; }); const department = await models.Department.findOne({ @@ -42,7 +42,5 @@ module.exports = Self => { if (channelName) return Self.send(ctx, `#${channelName}`, `@all ➔ ${message}`); - - return; }; }; diff --git a/back/methods/chat/send.js b/back/methods/chat/send.js index c5c8feead..79b20e307 100644 --- a/back/methods/chat/send.js +++ b/back/methods/chat/send.js @@ -30,16 +30,23 @@ module.exports = Self => { const recipient = to.replace('@', ''); if (sender.name != recipient) { - await models.Chat.create({ + const chat = await models.Chat.create({ senderFk: sender.id, recipient: to, - dated: new Date(), + dated: Date.vnNew(), checkUserStatus: 0, message: message, - status: 0, + status: 'sending', attempts: 0 }); + try { + await Self.sendMessage(chat.senderFk, chat.recipient, chat.message); + await Self.updateChat(chat, 'sent'); + } catch (error) { + await Self.updateChat(chat, 'error', error); + } + return true; } diff --git a/back/methods/chat/sendCheckingPresence.js b/back/methods/chat/sendCheckingPresence.js index 3bc022429..29232490a 100644 --- a/back/methods/chat/sendCheckingPresence.js +++ b/back/methods/chat/sendCheckingPresence.js @@ -24,18 +24,13 @@ module.exports = Self => { } }); - Self.sendCheckingPresence = async(ctx, recipientId, message, options) => { + Self.sendCheckingPresence = async(ctx, recipientId, message) => { if (!recipientId) return false; - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - const models = Self.app.models; const userId = ctx.req.accessToken.userId; - const sender = await models.Account.findById(userId); - const recipient = await models.Account.findById(recipientId, null, myOptions); + const sender = await models.Account.findById(userId, {fields: ['id']}); + const recipient = await models.Account.findById(recipientId, null); // Prevent sending messages to yourself if (recipientId == userId) return false; @@ -43,16 +38,26 @@ module.exports = Self => { if (!recipient) throw new Error(`Could not send message "${message}" to worker id ${recipientId} from user ${userId}`); - await models.Chat.create({ + if (process.env.NODE_ENV == 'test') + message = `[Test:Environment to user ${userId}] ` + message; + + const chat = await models.Chat.create({ senderFk: sender.id, recipient: `@${recipient.name}`, - dated: new Date(), + dated: Date.vnNew(), checkUserStatus: 1, message: message, - status: 0, + status: 'sending', attempts: 0 }); + try { + await Self.sendCheckingUserStatus(chat); + await Self.updateChat(chat, 'sent'); + } catch (error) { + await Self.updateChat(chat, 'error', error); + } + return true; }; }; diff --git a/back/methods/chat/sendQueued.js b/back/methods/chat/sendQueued.js index c34642c7e..ef1a417ab 100644 --- a/back/methods/chat/sendQueued.js +++ b/back/methods/chat/sendQueued.js @@ -3,7 +3,6 @@ module.exports = Self => { Self.remoteMethodCtx('sendQueued', { description: 'Send a RocketChat message', accessType: 'WRITE', - accepts: [], returns: { type: 'object', root: true @@ -16,14 +15,17 @@ module.exports = Self => { Self.sendQueued = async() => { const models = Self.app.models; - const maxAttempts = 3; - const sentStatus = 1; - const errorStatus = 2; const chats = await models.Chat.find({ where: { - status: {neq: sentStatus}, - attempts: {lt: maxAttempts} + status: { + nin: [ + 'sent', + 'sending' + ] + + }, + attempts: {lt: 3} } }); @@ -31,16 +33,16 @@ module.exports = Self => { if (chat.checkUserStatus) { try { await Self.sendCheckingUserStatus(chat); - await updateChat(chat, sentStatus); + await Self.updateChat(chat, 'sent'); } catch (error) { - await updateChat(chat, errorStatus); + await Self.updateChat(chat, 'error', error); } } else { try { await Self.sendMessage(chat.senderFk, chat.recipient, chat.message); - await updateChat(chat, sentStatus); + await Self.updateChat(chat, 'sent'); } catch (error) { - await updateChat(chat, errorStatus); + await Self.updateChat(chat, 'error', error); } } } @@ -75,7 +77,7 @@ module.exports = Self => { const channelName = department && department.chatName; if (channelName) - return Self.sendMessage(chat.senderFk, `#${channelName}`, `@${recipient.name} ➔ ${message}`); + return Self.sendMessage(chat.senderFk, `#${channelName}`, `@${recipient.name} ➔ ${chat.message}`); else return Self.sendMessage(chat.senderFk, `@${recipient.name}`, chat.message); } else @@ -127,14 +129,18 @@ module.exports = Self => { * * @param {object} chat - The chat * @param {string} status - The new status + * @param {string} error - The error + * @param {object} options - Query options * @return {Promise} - The request promise - */ - async function updateChat(chat, status) { + */ + + Self.updateChat = async(chat, status, error) => { return chat.updateAttributes({ status: status, - attempts: ++chat.attempts + attempts: ++chat.attempts, + error: error }); - } + }; /** * Returns the current user status on Rocketchat diff --git a/back/methods/chat/spec/notifyIssue.spec.js b/back/methods/chat/spec/notifyIssue.spec.js index e20d43142..1aab51793 100644 --- a/back/methods/chat/spec/notifyIssue.spec.js +++ b/back/methods/chat/spec/notifyIssue.spec.js @@ -27,7 +27,7 @@ describe('Chat notifyIssue()', () => { subject: 'Issue title'} ]); // eslint-disable-next-line max-len - const expectedMessage = `@all ➔ There's a new urgent ticket:\r\n[ID: *00001* - Issue title (@batman)](https://cau.verdnatura.es/scp/tickets.php?id=1)`; + const expectedMessage = `@all ➔ There's a new urgent ticket:\r\n[ID: 00001 - Issue title @batman](https://cau.verdnatura.es/scp/tickets.php?id=1)`; const department = await app.models.Department.findById(departmentId); let orgChatName = department.chatName; diff --git a/back/methods/chat/spec/sendQueued.spec.js b/back/methods/chat/spec/sendQueued.spec.js index bbf5a73c7..67cd47f4a 100644 --- a/back/methods/chat/spec/sendQueued.spec.js +++ b/back/methods/chat/spec/sendQueued.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; describe('Chat sendCheckingPresence()', () => { - const today = new Date(); + const today = Date.vnNew(); today.setHours(6, 0); const chatModel = models.Chat; @@ -10,7 +10,7 @@ describe('Chat sendCheckingPresence()', () => { const chat = { checkUserStatus: 1, - status: 0, + status: 'pending', attempts: 0 }; @@ -27,7 +27,7 @@ describe('Chat sendCheckingPresence()', () => { const chat = { checkUserStatus: 0, - status: 0, + status: 'pending', attempts: 0 }; diff --git a/back/methods/collection/previousLabel.js b/back/methods/collection/previousLabel.js new file mode 100644 index 000000000..e3dac1ab4 --- /dev/null +++ b/back/methods/collection/previousLabel.js @@ -0,0 +1,35 @@ +module.exports = Self => { + Self.remoteMethodCtx('previousLabel', { + description: 'Returns the previa label pdf', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The item 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/previousLabel', + verb: 'GET' + } + }); + + Self.previousLabel = (ctx, id) => Self.printReport(ctx, id, 'previa-label'); +}; diff --git a/back/methods/collection/setSaleQuantity.js b/back/methods/collection/setSaleQuantity.js index 644c44a60..4ac3d6d4b 100644 --- a/back/methods/collection/setSaleQuantity.js +++ b/back/methods/collection/setSaleQuantity.js @@ -24,13 +24,32 @@ module.exports = Self => { } }); - Self.setSaleQuantity = async(saleId, quantity) => { + Self.setSaleQuantity = async(saleId, quantity, options) => { const models = Self.app.models; + const myOptions = {}; + let tx; - const sale = await models.Sale.findById(saleId); - return await sale.updateAttributes({ - originalQuantity: sale.quantity, - quantity: quantity - }); + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const sale = await models.Sale.findById(saleId, null, myOptions); + const saleUpdated = await sale.updateAttributes({ + originalQuantity: sale.quantity, + quantity: quantity + }, myOptions); + + if (tx) await tx.commit(); + + return saleUpdated; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } }; }; diff --git a/back/methods/collection/spec/getCollection.spec.js b/back/methods/collection/spec/getCollection.spec.js index 5ea042f9d..e87efb4a0 100644 --- a/back/methods/collection/spec/getCollection.spec.js +++ b/back/methods/collection/spec/getCollection.spec.js @@ -2,10 +2,10 @@ const models = require('vn-loopback/server/server').models; describe('ticket getCollection()', () => { it('should return a list of collections', async() => { - let ctx = {req: {accessToken: {userId: 1106}}}; + let ctx = {req: {accessToken: {userId: 1107}}}; let response = await models.Collection.getCollection(ctx); expect(response.length).toBeGreaterThan(0); - expect(response[0].collectionFk).toEqual(1); + expect(response[0].collectionFk).toEqual(3); }); }); diff --git a/back/methods/collection/spec/setSaleQuantity.spec.js b/back/methods/collection/spec/setSaleQuantity.spec.js index 5d06a4383..acdf2ebb5 100644 --- a/back/methods/collection/spec/setSaleQuantity.spec.js +++ b/back/methods/collection/spec/setSaleQuantity.spec.js @@ -1,16 +1,42 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('setSaleQuantity()', () => { + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + it('should change quantity sale', async() => { - const saleId = 30; - const newQuantity = 10; + const tx = await models.Ticket.beginTransaction({}); - const originalSale = await models.Sale.findById(saleId); + try { + const options = {transaction: tx}; - await models.Collection.setSaleQuantity(saleId, newQuantity); - const updateSale = await models.Sale.findById(saleId); + const saleId = 30; + const newQuantity = 10; - expect(updateSale.originalQuantity).toEqual(originalSale.quantity); - expect(updateSale.quantity).toEqual(newQuantity); + const originalSale = await models.Sale.findById(saleId, null, options); + + await models.Collection.setSaleQuantity(saleId, newQuantity, options); + const updateSale = await models.Sale.findById(saleId, null, options); + + expect(updateSale.originalQuantity).toEqual(originalSale.quantity); + expect(updateSale.quantity).toEqual(newQuantity); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } }); }); diff --git a/back/methods/dms/deleteTrashFiles.js b/back/methods/dms/deleteTrashFiles.js index 9d16e9d81..239d654ef 100644 --- a/back/methods/dms/deleteTrashFiles.js +++ b/back/methods/dms/deleteTrashFiles.js @@ -1,3 +1,4 @@ +const UserError = require('vn-loopback/util/user-error'); const fs = require('fs-extra'); const path = require('path'); @@ -15,43 +16,53 @@ module.exports = Self => { } }); - Self.deleteTrashFiles = async(options) => { - const tx = await Self.beginTransaction({}); + Self.deleteTrashFiles = async options => { const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); - if (!myOptions.transaction) - myOptions.transaction = tx; + if (process.env.NODE_ENV == 'test') + throw new UserError(`Action not allowed on the test environment`); - try { - const models = Self.app.models; - const DmsContainer = models.DmsContainer; + const models = Self.app.models; + const DmsContainer = models.DmsContainer; - const trashDmsType = await models.DmsType.findOne({ - where: {code: 'trash'} - }, myOptions); + const trashDmsType = await models.DmsType.findOne({ + where: {code: 'trash'} + }, myOptions); - const dmsToDelete = await models.Dms.find({ - where: { - dmsTypeFk: trashDmsType.id - } - }, myOptions); + const date = Date.vnNew(); + date.setMonth(date.getMonth() - 4); - for (let dms of dmsToDelete) { - const pathHash = DmsContainer.getHash(dms.id); - const dmsContainer = await DmsContainer.container(pathHash); + const dmsToDelete = await models.Dms.find({ + where: { + and: [ + {dmsTypeFk: trashDmsType.id}, + {created: {lt: date}} + ] + } + }, myOptions); + + for (let dms of dmsToDelete) { + const pathHash = DmsContainer.getHash(dms.id); + const dmsContainer = await DmsContainer.container(pathHash); + try { const dstFile = path.join(dmsContainer.client.root, pathHash, dms.file); await fs.unlink(dstFile); - await dms.destroy(myOptions); + } catch (err) { + if (err.code != 'ENOENT' && dms.file) + throw err; } - if (tx) await tx.commit(); - } catch (e) { - if (tx) await tx.rollback(); - - throw e; + await dms.destroy(myOptions); + + const dstFolder = path.join(dmsContainer.client.root, pathHash); + try { + await fs.rmdir(dstFolder); + } catch (err) { + continue; + } } }; }; diff --git a/back/methods/docuware/checkFile.js b/back/methods/docuware/checkFile.js index c6712bb65..c0a4e8ef3 100644 --- a/back/methods/docuware/checkFile.js +++ b/back/methods/docuware/checkFile.js @@ -1,4 +1,4 @@ -const got = require('got'); +const axios = require('axios'); module.exports = Self => { Self.remoteMethodCtx('checkFile', { @@ -8,7 +8,7 @@ module.exports = Self => { { arg: 'id', type: 'number', - description: 'The id', + description: 'The id', http: {source: 'path'} }, { @@ -18,14 +18,14 @@ module.exports = Self => { description: 'The fileCabinet name' }, { - arg: 'dialog', - type: 'string', + arg: 'signed', + type: 'boolean', required: true, - description: 'The dialog name' + description: 'If pdf is necessary to be signed' } ], returns: { - type: 'boolean', + type: 'object', root: true }, http: { @@ -34,58 +34,51 @@ module.exports = Self => { } }); - Self.checkFile = async function(ctx, id, fileCabinet, dialog) { - const myUserId = ctx.req.accessToken.userId; - if (!myUserId) - return false; - + Self.checkFile = async function(ctx, id, fileCabinet, signed) { const models = Self.app.models; - const docuwareConfig = await models.DocuwareConfig.findOne(); + const action = 'find'; + const docuwareInfo = await models.Docuware.findOne({ where: { code: fileCabinet, - dialogName: dialog + action: action } }); - const docuwareUrl = docuwareConfig.url; - const cookie = docuwareConfig.token; - const fileCabinetName = docuwareInfo.fileCabinetName; - const find = docuwareInfo.find; - const options = { - 'headers': { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - 'Cookie': cookie - } - }; const searchFilter = { condition: [ { - DBName: find, + DBName: docuwareInfo.findById, + Value: [id] } + ], + sortOrder: [ + { + Field: 'FILENAME', + Direction: 'Desc' + } ] }; try { - // get fileCabinetId - const fileCabinetResponse = await got.get(`${docuwareUrl}/FileCabinets`, options); - const fileCabinetJson = JSON.parse(fileCabinetResponse.body).FileCabinet; - const fileCabinetId = fileCabinetJson.find(dialogs => dialogs.Name === fileCabinetName).Id; + const options = await Self.getOptions(); - // get dialog - const dialogResponse = await got.get(`${docuwareUrl}/FileCabinets/${fileCabinetId}/dialogs`, options); - const dialogJson = JSON.parse(dialogResponse.body).Dialog; - const dialogId = dialogJson.find(dialogs => dialogs.DisplayName === 'find').Id; + const fileCabinetId = await Self.getFileCabinet(fileCabinet); + const dialogId = await Self.getDialog(fileCabinet, action, fileCabinetId); - // get docuwareID - Object.assign(options, {'body': JSON.stringify(searchFilter)}); - const response = await got.post( - `${docuwareUrl}/FileCabinets/${fileCabinetId}/Query/DialogExpression?dialogId=${dialogId}`, options); - JSON.parse(response.body).Items[0].Id; + const response = await axios.post( + `${options.url}/FileCabinets/${fileCabinetId}/Query/DialogExpression?dialogId=${dialogId}`, + searchFilter, + options.headers + ); + const [documents] = response.data.Items; + if (!documents) return false; - return true; + const state = documents.Fields.find(field => field.FieldName == 'ESTADO'); + if (signed && state.Item != 'Firmado') return false; + + return {id: documents.Id}; } catch (error) { return false; } diff --git a/back/methods/docuware/core.js b/back/methods/docuware/core.js new file mode 100644 index 000000000..2053ddf85 --- /dev/null +++ b/back/methods/docuware/core.js @@ -0,0 +1,78 @@ +const axios = require('axios'); + +module.exports = Self => { + /** + * Returns the dialog id + * + * @param {string} code - The fileCabinet name + * @param {string} action - The fileCabinet name + * @param {string} fileCabinetId - Optional The fileCabinet name + * @return {number} - The fileCabinet id + */ + Self.getDialog = async(code, action, fileCabinetId) => { + const docuwareInfo = await Self.app.models.Docuware.findOne({ + where: { + code: code, + action: action + } + }); + if (!fileCabinetId) fileCabinetId = await Self.getFileCabinet(code); + + const options = await Self.getOptions(); + + if (!process.env.NODE_ENV) + return Math.round(); + + const response = await axios.get(`${options.url}/FileCabinets/${fileCabinetId}/dialogs`, options.headers); + const dialogs = response.data.Dialog; + const dialogId = dialogs.find(dialogs => dialogs.DisplayName === docuwareInfo.dialogName).Id; + + return dialogId; + }; + + /** + * Returns the fileCabinetId + * + * @param {string} code - The fileCabinet code + * @return {number} - The fileCabinet id + */ + Self.getFileCabinet = async code => { + const options = await Self.getOptions(); + const docuwareInfo = await Self.app.models.Docuware.findOne({ + where: { + code: code + } + }); + + if (!process.env.NODE_ENV) + return Math.round(); + + const fileCabinetResponse = await axios.get(`${options.url}/FileCabinets`, options.headers); + const fileCabinets = fileCabinetResponse.data.FileCabinet; + const fileCabinetId = fileCabinets.find(fileCabinet => fileCabinet.Name === docuwareInfo.fileCabinetName).Id; + + return fileCabinetId; + }; + + /** + * Returns basic headers + * + * @param {string} cookie - The docuware cookie + * @return {object} - The headers + */ + Self.getOptions = async() => { + const docuwareConfig = await Self.app.models.DocuwareConfig.findOne(); + const headers = { + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + 'Cookie': docuwareConfig.cookie + } + }; + + return { + url: docuwareConfig.url, + headers + }; + }; +}; diff --git a/back/methods/docuware/deliveryNoteEmail.js b/back/methods/docuware/deliveryNoteEmail.js new file mode 100644 index 000000000..1f9d7556f --- /dev/null +++ b/back/methods/docuware/deliveryNoteEmail.js @@ -0,0 +1,72 @@ +const {Email} = require('vn-print'); + +module.exports = Self => { + Self.remoteMethodCtx('deliveryNoteEmail', { + description: 'Sends the delivery note email with an docuware attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'string', + required: true, + description: 'The ticket id', + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'recipientId', + type: 'number', + description: 'The client id', + required: false + } + ], + 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/delivery-note-email', + verb: 'POST' + } + }); + + Self.deliveryNoteEmail = async(ctx, id) => { + const args = Object.assign({}, ctx.args); + const params = { + recipient: args.recipient, + lang: ctx.req.getLocale() + }; + + delete args.ctx; + for (const param in args) + params[param] = args[param]; + + const email = new Email('delivery-note', params); + + const docuwareFile = await Self.app.models.Docuware.download(ctx, id, 'deliveryNote'); + + return email.send({ + overrideAttachments: true, + attachments: [{ + filename: `${id}.pdf`, + content: docuwareFile[0] + }] + }); + }; +}; diff --git a/back/methods/docuware/download.js b/back/methods/docuware/download.js index 489a07e34..56d006ee7 100644 --- a/back/methods/docuware/download.js +++ b/back/methods/docuware/download.js @@ -1,5 +1,5 @@ /* eslint max-len: ["error", { "code": 180 }]*/ -const got = require('got'); +const axios = require('axios'); const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { @@ -10,19 +10,13 @@ module.exports = Self => { { arg: 'id', type: 'number', - description: 'The id', + description: 'The ticket id', http: {source: 'path'} }, { arg: 'fileCabinet', type: 'string', - description: 'The id', - http: {source: 'path'} - }, - { - arg: 'dialog', - type: 'string', - description: 'The id', + description: 'The file cabinet', http: {source: 'path'} } ], @@ -42,79 +36,26 @@ module.exports = Self => { } ], http: { - path: `/:id/download/:fileCabinet/:dialog`, + path: `/:id/download/:fileCabinet`, verb: 'GET' } }); - Self.download = async function(ctx, id, fileCabinet, dialog) { - const myUserId = ctx.req.accessToken.userId; - if (!myUserId) - throw new UserError(`You don't have enough privileges`); - + Self.download = async function(ctx, id, fileCabinet) { const models = Self.app.models; - const docuwareConfig = await models.DocuwareConfig.findOne(); - const docuwareInfo = await models.Docuware.findOne({ - where: { - code: fileCabinet, - dialogName: dialog - } - }); + const docuwareFile = await models.Docuware.checkFile(ctx, id, fileCabinet, true); + if (!docuwareFile) throw new UserError('The DOCUWARE PDF document does not exists'); - const docuwareUrl = docuwareConfig.url; - const cookie = docuwareConfig.token; - const fileCabinetName = docuwareInfo.fileCabinetName; - const find = docuwareInfo.find; - const options = { - 'headers': { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - 'Cookie': cookie - } - }; - const searchFilter = { - condition: [ - { - DBName: find, - Value: [id] - } - ] - }; + const fileCabinetId = await Self.getFileCabinet(fileCabinet); + const options = await Self.getOptions(); + options.headers.responseType = 'stream'; - try { - // get fileCabinetId - const fileCabinetResponse = await got.get(`${docuwareUrl}/FileCabinets`, options); - const fileCabinetJson = JSON.parse(fileCabinetResponse.body).FileCabinet; - const fileCabinetId = fileCabinetJson.find(dialogs => dialogs.Name === fileCabinetName).Id; + const fileName = `filename="${id}.pdf"`; + const contentType = 'application/pdf'; + const downloadUri = `${options.url}/FileCabinets/${fileCabinetId}/Documents/${docuwareFile.id}/FileDownload?targetFileType=Auto&keepAnnotations=false`; - // get dialog - const dialogResponse = await got.get(`${docuwareUrl}/FileCabinets/${fileCabinetId}/dialogs`, options); - const dialogJson = JSON.parse(dialogResponse.body).Dialog; - const dialogId = dialogJson.find(dialogs => dialogs.DisplayName === 'find').Id; + const stream = await axios.get(downloadUri, options.headers); - // get docuwareID - Object.assign(options, {'body': JSON.stringify(searchFilter)}); - const response = await got.post(`${docuwareUrl}/FileCabinets/${fileCabinetId}/Query/DialogExpression?dialogId=${dialogId}`, options); - const docuwareId = JSON.parse(response.body).Items[0].Id; - - // download & save file - const fileName = `filename="${id}.pdf"`; - const contentType = 'application/pdf'; - const downloadUri = `${docuwareUrl}/FileCabinets/${fileCabinetId}/Documents/${docuwareId}/FileDownload?targetFileType=Auto&keepAnnotations=false`; - const downloadOptions = { - 'headers': { - 'Cookie': cookie - } - }; - - const stream = got.stream(downloadUri, downloadOptions); - - return [stream, contentType, fileName]; - } catch (error) { - if (error.code === 'ENOENT') - throw new UserError('The DOCUWARE PDF document does not exists'); - - throw error; - } + return [stream.data, contentType, fileName]; }; }; diff --git a/back/methods/docuware/specs/checkFile.spec.js b/back/methods/docuware/specs/checkFile.spec.js index 0d0e4d71a..dd11951cc 100644 --- a/back/methods/docuware/specs/checkFile.spec.js +++ b/back/methods/docuware/specs/checkFile.spec.js @@ -1,5 +1,5 @@ const models = require('vn-loopback/server/server').models; -const got = require('got'); +const axios = require('axios'); describe('docuware download()', () => { const ticketId = 1; @@ -12,53 +12,71 @@ describe('docuware download()', () => { } }; - const fileCabinetName = 'deliveryClient'; - const dialogDisplayName = 'find'; - const dialogName = 'findTicket'; + const docuwareModel = models.Docuware; + const fileCabinetName = 'deliveryNote'; - const gotGetResponse = { - body: JSON.stringify( - { - FileCabinet: [ - {Id: 12, Name: fileCabinetName} - ], - Dialog: [ - {Id: 34, DisplayName: dialogDisplayName} - ] - }) - }; - - it('should return exist file in docuware', async() => { - const gotPostResponse = { - body: JSON.stringify( - { - Items: [ - {Id: 56} - ], - }) - }; - - spyOn(got, 'get').and.returnValue(new Promise(resolve => resolve(gotGetResponse))); - spyOn(got, 'post').and.returnValue(new Promise(resolve => resolve(gotPostResponse))); - - const result = await models.Docuware.checkFile(ctx, ticketId, fileCabinetName, dialogName); - - expect(result).toEqual(true); + beforeAll(() => { + spyOn(docuwareModel, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random())))); + spyOn(docuwareModel, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random())))); }); - it('should return not exist file in docuware', async() => { - const gotPostResponse = { - body: JSON.stringify( - { - Items: [], - }) + it('should return false if there are no documents', async() => { + const response = { + data: { + Items: [] + } }; + spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(response))); - spyOn(got, 'get').and.returnValue(new Promise(resolve => resolve(gotGetResponse))); - spyOn(got, 'post').and.returnValue(new Promise(resolve => resolve(gotPostResponse))); - - const result = await models.Docuware.checkFile(ctx, ticketId, fileCabinetName, dialogName); + const result = await models.Docuware.checkFile(ctx, ticketId, fileCabinetName, true); expect(result).toEqual(false); }); + + it('should return false if the document is unsigned', async() => { + const response = { + data: { + Items: [ + { + Id: 1, + Fields: [ + { + FieldName: 'ESTADO', + Item: 'Unsigned' + } + ] + } + ] + } + }; + spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(response))); + + const result = await models.Docuware.checkFile(ctx, ticketId, fileCabinetName, true); + + expect(result).toEqual(false); + }); + + it('should return the document data', async() => { + const docuwareId = 1; + const response = { + data: { + Items: [ + { + Id: docuwareId, + Fields: [ + { + FieldName: 'ESTADO', + Item: 'Firmado' + } + ] + } + ] + } + }; + spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(response))); + + const result = await models.Docuware.checkFile(ctx, ticketId, fileCabinetName, true); + + expect(result.id).toEqual(docuwareId); + }); }); diff --git a/back/methods/docuware/specs/download.spec.js b/back/methods/docuware/specs/download.spec.js index dc80c67d8..fcc1671a6 100644 --- a/back/methods/docuware/specs/download.spec.js +++ b/back/methods/docuware/specs/download.spec.js @@ -1,5 +1,5 @@ const models = require('vn-loopback/server/server').models; -const got = require('got'); +const axios = require('axios'); const stream = require('stream'); describe('docuware download()', () => { @@ -13,36 +13,33 @@ describe('docuware download()', () => { } }; - it('should return the downloaded file name', async() => { - const fileCabinetName = 'deliveryClient'; - const dialogDisplayName = 'find'; - const dialogName = 'findTicket'; - const gotGetResponse = { - body: JSON.stringify( - { - FileCabinet: [ - {Id: 12, Name: fileCabinetName} - ], - Dialog: [ - {Id: 34, DisplayName: dialogDisplayName} - ] - }) - }; + const docuwareModel = models.Docuware; + const fileCabinetName = 'deliveryNote'; - const gotPostResponse = { - body: JSON.stringify( - { - Items: [ - {Id: 56} - ], - }) - }; + beforeAll(() => { + spyOn(docuwareModel, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random())))); + spyOn(docuwareModel, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random())))); + }); - spyOn(got, 'get').and.returnValue(new Promise(resolve => resolve(gotGetResponse))); - spyOn(got, 'post').and.returnValue(new Promise(resolve => resolve(gotPostResponse))); - spyOn(got, 'stream').and.returnValue(new stream.PassThrough({objectMode: true})); + it('should return error if file not exist', async() => { + spyOn(docuwareModel, 'checkFile').and.returnValue(false); + spyOn(axios, 'get').and.returnValue(new stream.PassThrough({objectMode: true})); - const result = await models.Docuware.download(ctx, ticketId, fileCabinetName, dialogName); + let error; + try { + await models.Docuware.download(ctx, ticketId, fileCabinetName); + } catch (e) { + error = e.message; + } + + expect(error).toEqual('The DOCUWARE PDF document does not exists'); + }); + + it('should return the downloaded file if exist file ', async() => { + spyOn(docuwareModel, 'checkFile').and.returnValue({}); + spyOn(axios, 'get').and.returnValue(new stream.PassThrough({objectMode: true})); + + const result = await models.Docuware.download(ctx, ticketId, fileCabinetName); expect(result[1]).toEqual('application/pdf'); expect(result[2]).toEqual(`filename="${ticketId}.pdf"`); diff --git a/back/methods/docuware/specs/upload.spec.js b/back/methods/docuware/specs/upload.spec.js new file mode 100644 index 000000000..7ac873e95 --- /dev/null +++ b/back/methods/docuware/specs/upload.spec.js @@ -0,0 +1,37 @@ +const models = require('vn-loopback/server/server').models; + +describe('docuware upload()', () => { + const userId = 9; + const ticketId = 10; + const ctx = { + req: { + getLocale: () => { + return 'en'; + }, + accessToken: {userId: userId}, + headers: {origin: 'http://localhost:5000'}, + } + }; + + const docuwareModel = models.Docuware; + const ticketModel = models.Ticket; + const fileCabinetName = 'deliveryNote'; + + beforeAll(() => { + spyOn(docuwareModel, 'getFileCabinet').and.returnValue(new Promise(resolve => resolve(Math.random()))); + spyOn(docuwareModel, 'getDialog').and.returnValue(new Promise(resolve => resolve(Math.random()))); + }); + + it('should try upload file', async() => { + spyOn(ticketModel, 'deliveryNotePdf').and.returnValue(new Promise(resolve => resolve({}))); + + let error; + try { + await models.Docuware.upload(ctx, ticketId, fileCabinetName); + } catch (e) { + error = e.message; + } + + expect(error).toEqual('Action not allowed on the test environment'); + }); +}); diff --git a/back/methods/docuware/upload.js b/back/methods/docuware/upload.js new file mode 100644 index 000000000..ea9ee3622 --- /dev/null +++ b/back/methods/docuware/upload.js @@ -0,0 +1,141 @@ +const UserError = require('vn-loopback/util/user-error'); +const axios = require('axios'); + +module.exports = Self => { + Self.remoteMethodCtx('upload', { + description: 'Upload an docuware PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + description: 'The ticket id', + http: {source: 'path'} + }, + { + arg: 'fileCabinet', + type: 'string', + description: 'The file cabinet' + }, + { + arg: 'dialog', + type: 'string', + description: 'The dialog' + } + ], + returns: [], + http: { + path: `/:id/upload`, + verb: 'POST' + } + }); + + Self.upload = async function(ctx, id, fileCabinet) { + const models = Self.app.models; + const action = 'store'; + + const options = await Self.getOptions(); + const fileCabinetId = await Self.getFileCabinet(fileCabinet); + const dialogId = await Self.getDialog(fileCabinet, action, fileCabinetId); + + // get delivery note + const deliveryNote = await models.Ticket.deliveryNotePdf(ctx, { + id, + type: 'deliveryNote' + }); + + // get ticket data + const ticket = await models.Ticket.findById(id, { + include: [{ + relation: 'client', + scope: { + fields: ['id', 'socialName', 'fi'] + } + }] + }); + + // upload file + const templateJson = { + 'Fields': [ + { + 'FieldName': 'N__ALBAR_N', + 'ItemElementName': 'string', + 'Item': id, + }, + { + 'FieldName': 'CIF_PROVEEDOR', + 'ItemElementName': 'string', + 'Item': ticket.client().fi, + }, + { + 'FieldName': 'CODIGO_PROVEEDOR', + 'ItemElementName': 'string', + 'Item': ticket.client().id, + }, + { + 'FieldName': 'NOMBRE_PROVEEDOR', + 'ItemElementName': 'string', + 'Item': ticket.client().socialName, + }, + { + 'FieldName': 'FECHA_FACTURA', + 'ItemElementName': 'date', + 'Item': ticket.shipped, + }, + { + 'FieldName': 'TOTAL_FACTURA', + 'ItemElementName': 'Decimal', + 'Item': ticket.totalWithVat, + }, + { + 'FieldName': 'ESTADO', + 'ItemElementName': 'string', + 'Item': 'Pendiente procesar', + }, + { + 'FieldName': 'FIRMA_', + 'ItemElementName': 'string', + 'Item': 'Si', + }, + { + 'FieldName': 'FILTRO_TABLET', + 'ItemElementName': 'string', + 'Item': 'Tablet1', + } + ] + }; + + if (process.env.NODE_ENV != 'production') + throw new UserError('Action not allowed on the test environment'); + + // delete old + const docuwareFile = await models.Docuware.checkFile(ctx, id, fileCabinet, false); + if (docuwareFile) { + const deleteJson = { + 'Field': [{'FieldName': 'ESTADO', 'Item': 'Pendiente eliminar', 'ItemElementName': 'String'}] + }; + const deleteUri = `${options.url}/FileCabinets/${fileCabinetId}/Documents/${docuwareFile.id}/Fields`; + await axios.put(deleteUri, deleteJson, options.headers); + } + + const uploadUri = `${options.url}/FileCabinets/${fileCabinetId}/Documents?StoreDialogId=${dialogId}`; + const FormData = require('form-data'); + const data = new FormData(); + + data.append('document', JSON.stringify(templateJson), 'schema.json'); + data.append('file[]', deliveryNote[0], 'file.pdf'); + const uploadOptions = { + headers: { + 'Content-Type': 'multipart/form-data', + 'X-File-ModifiedDate': Date.vnNew(), + 'Cookie': options.headers.headers.Cookie, + ...data.getHeaders() + }, + }; + + return await axios.post(uploadUri, data, uploadOptions) + .catch(() => { + throw new UserError('Failed to upload file'); + }); + }; +}; diff --git a/back/methods/edi/updateData.js b/back/methods/edi/updateData.js index 121e96778..232695f4e 100644 --- a/back/methods/edi/updateData.js +++ b/back/methods/edi/updateData.js @@ -12,7 +12,7 @@ module.exports = Self => { }, http: { path: `/updateData`, - verb: 'GET' + verb: 'POST' } }); @@ -20,83 +20,93 @@ module.exports = Self => { const models = Self.app.models; // Get files checksum - const files = await Self.rawSql('SELECT name, checksum, keyValue FROM edi.fileConfig'); + const tx = await Self.beginTransaction({}); - const updatableFiles = []; - for (const file of files) { - const fileChecksum = await getChecksum(file); + try { + const options = {transaction: tx}; + const files = await Self.rawSql('SELECT name, checksum, keyValue FROM edi.fileConfig', null, options); - if (file.checksum != fileChecksum) { - updatableFiles.push({ - name: file.name, - checksum: fileChecksum - }); - } else - console.debug(`File already updated, skipping...`); - } + const updatableFiles = []; + for (const file of files) { + const fileChecksum = await getChecksum(file); - if (updatableFiles.length === 0) - return false; - - // Download files - const container = await models.TempContainer.container('edi'); - const tempPath = path.join(container.client.root, container.name); - - let remoteFile; - let tempDir; - let tempFile; - - const fileNames = updatableFiles.map(file => file.name); - - const tables = await Self.rawSql(` - SELECT fileName, toTable, file - FROM edi.tableConfig - WHERE file IN (?)`, [fileNames]); - - for (const table of tables) { - const fileName = table.file; - - console.debug(`Downloading file ${fileName}...`); - - remoteFile = `codes/${fileName}.ZIP`; - tempDir = `${tempPath}/${fileName}`; - tempFile = `${tempPath}/${fileName}.zip`; - - try { - await fs.readFile(tempFile); - } catch (error) { - if (error.code === 'ENOENT') { - const downloadOutput = await downloadFile(remoteFile, tempFile); - if (downloadOutput.error) - continue; - } + if (file.checksum != fileChecksum) { + updatableFiles.push({ + name: file.name, + checksum: fileChecksum + }); + } else + console.debug(`File already updated, skipping...`); } - console.debug(`Extracting file ${fileName}...`); - await extractFile(tempFile, tempDir); + if (updatableFiles.length === 0) + return false; - console.debug(`Updating table ${table.toTable}...`); - await dumpData(tempDir, table); - } + // Download files + const container = await models.TempContainer.container('edi'); + const tempPath = path.join(container.client.root, container.name); - // Update files checksum - for (const file of updatableFiles) { - await Self.rawSql(` - UPDATE edi.fileConfig - SET checksum = ? - WHERE name = ?`, - [file.checksum, file.name]); - } + let remoteFile; + let tempDir; + let tempFile; - // Clean files - try { - await fs.remove(tempPath); + const fileNames = updatableFiles.map(file => file.name); + + const tables = await Self.rawSql(` + SELECT fileName, toTable, file + FROM edi.tableConfig + WHERE file IN (?)`, [fileNames], options); + + for (const table of tables) { + const fileName = table.file; + + remoteFile = `codes/${fileName}.ZIP`; + tempDir = `${tempPath}/${fileName}`; + tempFile = `${tempPath}/${fileName}.zip`; + + try { + await fs.readFile(tempFile); + } catch (error) { + if (error.code === 'ENOENT') { + console.debug(`Downloading file ${fileName}...`); + const downloadOutput = await downloadFile(remoteFile, tempFile); + if (downloadOutput.error) + continue; + } + } + + await extractFile(fileName, tempFile, tempDir); + + console.debug(`Updating table ${table.toTable}...`); + await dumpData(tempDir, table, options); + } + + // Update files checksum + for (const file of updatableFiles) { + console.log(`Updating file ${file.name} checksum...`); + await Self.rawSql(` + UPDATE edi.fileConfig + SET checksum = ? + WHERE name = ?`, + [file.checksum, file.name], options); + } + + await tx.commit(); + + // Clean files + try { + console.debug(`Cleaning files...`); + await fs.remove(tempPath); + } catch (error) { + if (error.code !== 'ENOENT') + throw e; + } + + return true; } catch (error) { - if (error.code !== 'ENOENT') - throw e; + await tx.rollback(); + throw error; } - - return true; }; let ftpClient; @@ -126,9 +136,9 @@ module.exports = Self => { const response = await new Promise((resolve, reject) => { ftpClient.exec((err, response) => { - if (response.error) { + if (err || response.error) { console.debug(`Error downloading checksum file... ${response.error}`); - reject(err); + return reject(err); } resolve(response); @@ -159,9 +169,9 @@ module.exports = Self => { return new Promise((resolve, reject) => { ftpClient.exec((err, response) => { - if (response.error) { + if (err || response.error) { console.debug(`Error downloading file... ${response.error}`); - reject(err); + return reject(err); } resolve(response); @@ -169,11 +179,12 @@ module.exports = Self => { }); } - async function extractFile(tempFile, tempDir) { + async function extractFile(fileName, tempFile, tempDir) { const JSZip = require('jszip'); try { await fs.mkdir(tempDir); + console.debug(`Extracting file ${fileName}...`); } catch (error) { if (error.code !== 'EEXIST') throw e; @@ -196,41 +207,32 @@ module.exports = Self => { } } - async function dumpData(tempDir, table) { + async function dumpData(tempDir, table, options) { const toTable = table.toTable; const baseName = table.fileName; - const tx = await Self.beginTransaction({}); + console.log(`Emptying table ${toTable}...`); + const tableName = `edi.${toTable}`; + await Self.rawSql(`DELETE FROM ??`, [tableName]); - try { - const options = {transaction: tx}; + const dirFiles = await fs.readdir(tempDir); + const files = dirFiles.filter(file => file.startsWith(baseName)); - const tableName = `edi.${toTable}`; - await Self.rawSql(`DELETE FROM ??`, [tableName], options); + for (const file of files) { + console.log(`Dumping data from file ${file}...`); - const dirFiles = await fs.readdir(tempDir); - const files = dirFiles.filter(file => file.startsWith(baseName)); + const templatePath = path.join(__dirname, `./sql/${toTable}.sql`); + const sqlTemplate = await fs.readFile(templatePath, 'utf8'); + const filePath = path.join(tempDir, file); - for (const file of files) { - console.log(`Dumping data from file ${file}...`); - - const templatePath = path.join(__dirname, `./sql/${toTable}.sql`); - const sqlTemplate = await fs.readFile(templatePath, 'utf8'); - const filePath = path.join(tempDir, file); - - await Self.rawSql(sqlTemplate, [filePath], options); - await Self.rawSql(` + await Self.rawSql(sqlTemplate, [filePath], options); + await Self.rawSql(` UPDATE edi.tableConfig SET updated = ? WHERE fileName = ? - `, [new Date(), baseName], options); - } - - tx.commit(); - } catch (error) { - tx.rollback(); - throw error; + `, [Date.vnNew(), baseName], options); } + console.log(`Updated table ${toTable}\n`); } }; diff --git a/back/methods/image/download.js b/back/methods/image/download.js index bbfe8e41a..3a8bcf30e 100644 --- a/back/methods/image/download.js +++ b/back/methods/image/download.js @@ -74,10 +74,13 @@ module.exports = Self => { const container = await models.ImageContainer.getContainer(collection); const rootPath = container.client.root; const fileSrc = path.join(rootPath, collection, size); + + const ext = image.name.substring((image.name.length - 4)); + const fileName = ext !== '.png' ? `${image.name}.png` : image.name; const file = { - path: `${fileSrc}/${image.name}.png`, + path: `${fileSrc}/${fileName}`, contentType: 'image/png', - name: `${image.name}.png` + name: image.name }; if (!fs.existsSync(file.path)) return []; diff --git a/back/methods/image/upload.js b/back/methods/image/upload.js index 676a4b5fb..143da275e 100644 --- a/back/methods/image/upload.js +++ b/back/methods/image/upload.js @@ -1,6 +1,7 @@ const UserError = require('vn-loopback/util/user-error'); const fs = require('fs-extra'); const path = require('path'); +const uuid = require('uuid'); module.exports = Self => { Self.remoteMethodCtx('upload', { @@ -18,12 +19,6 @@ module.exports = Self => { type: 'string', description: 'The collection name', required: true - }, - { - arg: 'fileName', - type: 'string', - description: 'The file name', - required: true }], returns: { type: 'Object', @@ -56,10 +51,12 @@ module.exports = Self => { const [uploadedFile] = Object.values(uploaded.files).map(file => { return file[0]; }); + const file = await TempContainer.getFile(tempContainer.name, uploadedFile.name); srcFile = path.join(file.client.root, file.container, file.name); - await models.Image.registerImage(args.collection, srcFile, args.fileName, args.id); + const fileName = `${uuid.v4()}.png`; + await models.Image.registerImage(args.collection, srcFile, fileName, args.id); } catch (e) { if (fs.existsSync(srcFile)) await fs.unlink(srcFile); diff --git a/back/methods/notification/clean.js b/back/methods/notification/clean.js new file mode 100644 index 000000000..8ce32d389 --- /dev/null +++ b/back/methods/notification/clean.js @@ -0,0 +1,49 @@ +module.exports = Self => { + Self.remoteMethod('clean', { + description: 'clean notifications from queue', + accessType: 'WRITE', + returns: { + type: 'object', + root: true + }, + http: { + path: `/clean`, + verb: 'POST' + } + }); + + Self.clean = async options => { + const models = Self.app.models; + const status = ['sent', 'error']; + + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const config = await models.NotificationConfig.findOne({}, myOptions); + + if (!config.cleanDays) return; + + const cleanDate = Date.vnNew(); + cleanDate.setDate(cleanDate.getDate() - config.cleanDays); + + await models.NotificationQueue.destroyAll({ + where: {status: {inq: status}}, + created: {lt: cleanDate} + }, myOptions); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + + if (tx) await tx.commit(); + }; +}; diff --git a/back/methods/notification/send.js b/back/methods/notification/send.js new file mode 100644 index 000000000..b2748477d --- /dev/null +++ b/back/methods/notification/send.js @@ -0,0 +1,83 @@ +const {Email} = require('vn-print'); + +module.exports = Self => { + Self.remoteMethod('send', { + description: 'Send notifications from queue', + accessType: 'WRITE', + returns: { + type: 'object', + root: true + }, + http: { + path: `/send`, + verb: 'POST' + } + }); + + Self.send = async options => { + const models = Self.app.models; + const findStatus = 'pending'; + + const myOptions = {}; + if (typeof options == 'object') + Object.assign(myOptions, options); + + const notificationQueue = await models.NotificationQueue.find({ + where: {status: findStatus}, + include: [ + { + relation: 'notification', + scope: { + include: { + relation: 'subscription', + scope: { + include: { + relation: 'user', + scope: { + fields: ['name', 'lang'], + include: { + relation: 'emailUser' + } + } + } + } + } + } + + } + ] + }, myOptions); + + const statusSent = 'sent'; + const statusError = 'error'; + + for (const queue of notificationQueue) { + const queueName = queue.notification().name; + const queueParams = JSON.parse(queue.params); + + for (const notificationUser of queue.notification().subscription()) { + try { + const sendParams = { + recipient: notificationUser.user().emailUser().email, + lang: notificationUser.user().lang + }; + + if (notificationUser.userFk == queue.authorFk) { + await queue.updateAttribute('status', statusSent); + continue; + } + + const newParams = Object.assign({}, queueParams, sendParams); + const email = new Email(queueName, newParams); + + if (process.env.NODE_ENV != 'test') + await email.send(); + + await queue.updateAttribute('status', statusSent); + } catch (error) { + await queue.updateAttribute('status', statusError); + } + } + } + }; +}; diff --git a/back/methods/notification/specs/clean.spec.js b/back/methods/notification/specs/clean.spec.js new file mode 100644 index 000000000..857886a64 --- /dev/null +++ b/back/methods/notification/specs/clean.spec.js @@ -0,0 +1,42 @@ +const models = require('vn-loopback/server/server').models; + +describe('Notification Clean()', () => { + it('should delete old rows with error', async() => { + const userId = 9; + const status = 'error'; + const tx = await models.NotificationQueue.beginTransaction({}); + const options = {transaction: tx}; + + const notification = await models.Notification.findOne({}, options); + const notificationConfig = await models.NotificationConfig.findOne({}); + + const cleanDate = Date.vnNew(); + cleanDate.setDate(cleanDate.getDate() - (notificationConfig.cleanDays + 1)); + + let before; + let after; + + try { + const notificationDelete = await models.NotificationQueue.create({ + notificationFk: notification.name, + authorFk: userId, + status: status, + created: cleanDate + }, options); + + before = await models.NotificationQueue.findById(notificationDelete.id, null, options); + + await models.Notification.clean(options); + + after = await models.NotificationQueue.findById(notificationDelete.id, null, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + + expect(before.notificationFk).toEqual(notification.name); + expect(after).toBe(null); + }); +}); diff --git a/back/methods/notification/specs/send.spec.js b/back/methods/notification/specs/send.spec.js new file mode 100644 index 000000000..f0b186e06 --- /dev/null +++ b/back/methods/notification/specs/send.spec.js @@ -0,0 +1,33 @@ +const models = require('vn-loopback/server/server').models; + +describe('Notification Send()', () => { + it('should send notification', async() => { + const statusPending = 'pending'; + const tx = await models.NotificationQueue.beginTransaction({}); + const options = {transaction: tx}; + const filter = { + where: { + status: statusPending + } + }; + + let before; + let after; + + try { + before = await models.NotificationQueue.find(filter, options); + + await models.Notification.send(options); + + after = await models.NotificationQueue.find(filter, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + + expect(before.length).toEqual(3); + expect(after.length).toEqual(0); + }); +}); diff --git a/back/methods/osticket/closeTicket.js b/back/methods/osticket/closeTicket.js new file mode 100644 index 000000000..aa827bbbb --- /dev/null +++ b/back/methods/osticket/closeTicket.js @@ -0,0 +1,155 @@ +const jsdom = require('jsdom'); +const mysql = require('mysql'); +const FormData = require('form-data'); + +module.exports = Self => { + Self.remoteMethodCtx('closeTicket', { + description: 'Close tickets without response from the user', + accessType: 'READ', + returns: { + type: 'object', + root: true + }, + http: { + path: `/closeTicket`, + verb: 'POST' + } + }); + + Self.closeTicket = async ctx => { + const models = Self.app.models; + const config = await models.OsTicketConfig.findOne(); + const ostUri = `${config.host}/login.php`; + + if (!config.user || !config.password || !config.userDb || !config.passwordDb) + return false; + + const con = mysql.createConnection({ + host: config.hostDb, + user: config.userDb, + password: config.passwordDb, + port: config.portDb + }); + + const sql = `SELECT ot.ticket_id, ot.number + FROM osticket.ost_ticket ot + JOIN osticket.ost_ticket_status ots ON ots.id = ot.status_id + JOIN osticket.ost_thread ot2 ON ot2.object_id = ot.ticket_id AND ot2.object_type = 'T' + JOIN ( + SELECT sub2.thread_id, sub2.type, sub2.updated, sub2.created + FROM ( + SELECT ote.thread_id, ote.created, ote.updated, ote.type + FROM osticket.ost_thread_entry ote + WHERE ote.staff_id + ORDER BY ote.id DESC + LIMIT 10000000000000000000) sub2 + GROUP BY sub2.thread_id + ) sub ON sub.thread_id = ot2.id + WHERE ot.isanswered + AND ots.id IN (?) + AND sub.type = 'R' + AND IF(sub.updated > sub.created, sub.updated, sub.created) < DATE_SUB(CURDATE(), INTERVAL ? DAY);`; + + const ticketsId = []; + const statusIdToClose = config.oldStatus.split(','); + + con.connect(err => { + if (err) throw err; + con.query(sql, [statusIdToClose, config.day], + (err, results) => { + if (err) throw err; + for (const result of results) + ticketsId.push(result.ticket_id); + }); + }); + await getRequestToken(); + + async function getRequestToken() { + const response = await fetch(ostUri); + + const result = response.headers.get('set-cookie'); + const [firtHeader] = result.split(' '); + const cookie = firtHeader.substring(0, firtHeader.length - 1); + const body = await response.text(); + const dom = new jsdom.JSDOM(body); + const token = dom.window.document.querySelector('[name="__CSRFToken__"]').value; + + await login(token, cookie); + } + + async function login(token, cookie) { + const data = { + __CSRFToken__: token, + do: 'scplogin', + userid: config.user, + passwd: config.password, + ajax: 1 + }; + const params = { + method: 'POST', + body: new URLSearchParams(data), + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', + 'Cookie': cookie + } + }; + await fetch(ostUri, params); + + await close(token, cookie); + } + + async function close(token, cookie) { + for (const ticketId of ticketsId) { + try { + const lock = await getLockCode(token, cookie, ticketId); + if (!lock.code) { + let error = `Can't get lock code`; + if (lock.msg) error += `: ${lock.msg}`; + throw new Error(error); + } + let form = new FormData(); + form.append('__CSRFToken__', token); + form.append('id', ticketId); + form.append('a', config.responseType); + form.append('lockCode', lock.code); + form.append('from_email_id', config.fromEmailId); + form.append('reply-to', config.replyTo); + form.append('cannedResp', 0); + form.append('response', config.comment); + form.append('signature', 'none'); + form.append('reply_status_id', config.newStatusId); + + const ostUri = `${config.host}/tickets.php?id=${ticketId}`; + const params = { + method: 'POST', + body: form, + headers: { + 'Cookie': cookie + } + }; + await fetch(ostUri, params); + } catch (e) { + const err = new Error(`${ticketId} Ticket close failed: ${e.message}`); + err.stack += e.stack; + console.error(err); + } + } + } + + async function getLockCode(token, cookie, ticketId) { + const ostUri = `${config.host}/ajax.php/lock/ticket/${ticketId}`; + const params = { + method: 'POST', + headers: { + 'X-CSRFToken': token, + 'Cookie': cookie + } + }; + const response = await fetch(ostUri, params); + const body = await response.text(); + const json = JSON.parse(body); + + return json; + } + }; +}; diff --git a/back/methods/osticket/osTicketReportEmail.js b/back/methods/osticket/osTicketReportEmail.js new file mode 100644 index 000000000..ebb74c385 --- /dev/null +++ b/back/methods/osticket/osTicketReportEmail.js @@ -0,0 +1,29 @@ +const {Email} = require('vn-print'); + +module.exports = Self => { + Self.remoteMethodCtx('osTicketReportEmail', { + description: 'Sends the buyer waste email', + accessType: 'WRITE', + accepts: [], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/osticket-report-email', + verb: 'POST' + } + }); + + Self.osTicketReportEmail = async ctx => { + const models = Self.app.models; + const printConfig = await models.PrintConfig.findOne(); + + const email = new Email('osticket-report', { + recipient: printConfig.itRecipient, + lang: ctx.req.getLocale() + }); + + return email.send(); + }; +}; diff --git a/back/methods/starred-module/specs/getStarredModules.spec.js b/back/methods/starred-module/specs/getStarredModules.spec.js index b5d2f25c8..c962bc471 100644 --- a/back/methods/starred-module/specs/getStarredModules.spec.js +++ b/back/methods/starred-module/specs/getStarredModules.spec.js @@ -19,11 +19,11 @@ describe('getStarredModules()', () => { }); it(`should return the starred modules for a given user`, async() => { - const newStarred = await app.models.StarredModule.create({workerFk: 9, moduleFk: 'Clients', position: 1}); + const newStarred = await app.models.StarredModule.create({workerFk: 9, moduleFk: 'customer', position: 1}); const starredModules = await app.models.StarredModule.getStarredModules(ctx); expect(starredModules.length).toEqual(1); - expect(starredModules[0].moduleFk).toEqual('Clients'); + expect(starredModules[0].moduleFk).toEqual('customer'); // restores await app.models.StarredModule.destroyById(newStarred.id); diff --git a/back/methods/starred-module/specs/setPosition.spec.js b/back/methods/starred-module/specs/setPosition.spec.js index 6ac9cab16..5421bd62b 100644 --- a/back/methods/starred-module/specs/setPosition.spec.js +++ b/back/methods/starred-module/specs/setPosition.spec.js @@ -26,29 +26,29 @@ describe('setPosition()', () => { const filter = { where: { workerFk: ctx.req.accessToken.userId, - moduleFk: 'Orders' + moduleFk: 'order' } }; try { const options = {transaction: tx}; - await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'order', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options); let orders = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; let clients = await app.models.StarredModule.findOne(filter, options); expect(orders.position).toEqual(1); expect(clients.position).toEqual(2); - await app.models.StarredModule.setPosition(ctx, 'Clients', 'left', options); + await app.models.StarredModule.setPosition(ctx, 'customer', 'left', options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; clients = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Orders'; + filter.where.moduleFk = 'order'; orders = await app.models.StarredModule.findOne(filter, options); expect(clients.position).toEqual(1); @@ -67,29 +67,29 @@ describe('setPosition()', () => { const filter = { where: { workerFk: ctx.req.accessToken.userId, - moduleFk: 'Orders' + moduleFk: 'order' } }; try { const options = {transaction: tx}; - await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'order', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options); let orders = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; let clients = await app.models.StarredModule.findOne(filter, options); expect(orders.position).toEqual(1); expect(clients.position).toEqual(2); - await app.models.StarredModule.setPosition(ctx, 'Orders', 'right', options); + await app.models.StarredModule.setPosition(ctx, 'order', 'right', options); - filter.where.moduleFk = 'Orders'; + filter.where.moduleFk = 'order'; orders = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; clients = await app.models.StarredModule.findOne(filter, options); expect(orders.position).toEqual(2); @@ -108,35 +108,35 @@ describe('setPosition()', () => { const filter = { where: { workerFk: ctx.req.accessToken.userId, - moduleFk: 'Items' + moduleFk: 'item' } }; try { const options = {transaction: tx}; - await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Items', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Claims', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Zones', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'order', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'order', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'item', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'claim', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'order', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'zone', options); const items = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Claims'; + filter.where.moduleFk = 'claim'; const claims = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; let clients = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Orders'; + filter.where.moduleFk = 'order'; let orders = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Zones'; + filter.where.moduleFk = 'zone'; const zones = await app.models.StarredModule.findOne(filter, options); expect(items.position).toEqual(1); @@ -145,12 +145,12 @@ describe('setPosition()', () => { expect(orders.position).toEqual(4); expect(zones.position).toEqual(5); - await app.models.StarredModule.setPosition(ctx, 'Clients', 'right', options); + await app.models.StarredModule.setPosition(ctx, 'customer', 'right', options); - filter.where.moduleFk = 'Orders'; + filter.where.moduleFk = 'order'; orders = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; clients = await app.models.StarredModule.findOne(filter, options); expect(orders.position).toEqual(3); @@ -169,31 +169,31 @@ describe('setPosition()', () => { const filter = { where: { workerFk: ctx.req.accessToken.userId, - moduleFk: 'Items' + moduleFk: 'item' } }; try { const options = {transaction: tx}; - await app.models.StarredModule.toggleStarredModule(ctx, 'Items', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Claims', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Zones', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'item', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'claim', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'order', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'zone', options); const items = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; let clients = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Claims'; + filter.where.moduleFk = 'claim'; const claims = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Orders'; + filter.where.moduleFk = 'order'; let orders = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Zones'; + filter.where.moduleFk = 'zone'; const zones = await app.models.StarredModule.findOne(filter, options); expect(items.position).toEqual(1); @@ -202,13 +202,13 @@ describe('setPosition()', () => { expect(orders.position).toEqual(4); expect(zones.position).toEqual(5); - await app.models.StarredModule.toggleStarredModule(ctx, 'Claims', options); - await app.models.StarredModule.setPosition(ctx, 'Clients', 'right', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'claim', options); + await app.models.StarredModule.setPosition(ctx, 'customer', 'right', options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; clients = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Orders'; + filter.where.moduleFk = 'order'; orders = await app.models.StarredModule.findOne(filter, options); expect(orders.position).toEqual(2); diff --git a/back/methods/starred-module/specs/toggleStarredModule.spec.js b/back/methods/starred-module/specs/toggleStarredModule.spec.js index 1aed4f54a..1195834e7 100644 --- a/back/methods/starred-module/specs/toggleStarredModule.spec.js +++ b/back/methods/starred-module/specs/toggleStarredModule.spec.js @@ -21,15 +21,15 @@ describe('toggleStarredModule()', () => { }); it('should create a new starred module and then remove it by calling the method again with same args', async() => { - const starredModule = await app.models.StarredModule.toggleStarredModule(ctx, 'Orders'); + const starredModule = await app.models.StarredModule.toggleStarredModule(ctx, 'order'); let starredModules = await app.models.StarredModule.getStarredModules(ctx); expect(starredModules.length).toEqual(1); - expect(starredModule.moduleFk).toEqual('Orders'); + expect(starredModule.moduleFk).toEqual('order'); expect(starredModule.workerFk).toEqual(activeCtx.accessToken.userId); expect(starredModule.position).toEqual(starredModules.length); - await app.models.StarredModule.toggleStarredModule(ctx, 'Orders'); + await app.models.StarredModule.toggleStarredModule(ctx, 'order'); starredModules = await app.models.StarredModule.getStarredModules(ctx); expect(starredModules.length).toEqual(0); diff --git a/back/model-config.json b/back/model-config.json index 343210383..29676e979 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -77,6 +77,21 @@ "Module": { "dataSource": "vn" }, + "Notification": { + "dataSource": "vn" + }, + "NotificationAcl": { + "dataSource": "vn" + }, + "NotificationConfig": { + "dataSource": "vn" + }, + "NotificationQueue": { + "dataSource": "vn" + }, + "NotificationSubscription": { + "dataSource": "vn" + }, "Province": { "dataSource": "vn" }, @@ -101,6 +116,9 @@ "Town": { "dataSource": "vn" }, + "Url": { + "dataSource": "vn" + }, "UserConfig": { "dataSource": "vn" }, @@ -116,8 +134,14 @@ "OsTicket": { "dataSource": "osticket" }, + "OsTicketConfig": { + "dataSource": "vn" + }, "Edi": { "dataSource": "vn" + }, + "PrintConfig": { + "dataSource": "vn" } } diff --git a/back/models/account.js b/back/models/account.js index ba703c68d..6d71a4e52 100644 --- a/back/models/account.js +++ b/back/models/account.js @@ -1,4 +1,7 @@ +/* eslint max-len: ["error", { "code": 150 }]*/ const md5 = require('md5'); +const LoopBackContext = require('loopback-context'); +const {Email} = require('vn-print'); module.exports = Self => { require('../methods/account/login')(Self); @@ -6,7 +9,9 @@ module.exports = Self => { require('../methods/account/acl')(Self); require('../methods/account/change-password')(Self); require('../methods/account/set-password')(Self); + require('../methods/account/recover-password')(Self); require('../methods/account/validate-token')(Self); + require('../methods/account/privileges')(Self); // Validations @@ -26,17 +31,62 @@ module.exports = Self => { ctx.data.password = md5(ctx.data.password); }); + Self.afterRemote('prototype.patchAttributes', async(ctx, instance) => { + if (!ctx.args || !ctx.args.data.email) return; + const models = Self.app.models; + + const loopBackContext = LoopBackContext.getCurrentContext(); + const httpCtx = {req: loopBackContext.active}; + const httpRequest = httpCtx.req.http.req; + const headers = httpRequest.headers; + const origin = headers.origin; + const url = origin.split(':'); + + const userId = ctx.instance.id; + const user = await models.user.findById(userId); + + class Mailer { + async send(verifyOptions, cb) { + const params = { + url: verifyOptions.verifyHref, + recipient: verifyOptions.to, + lang: ctx.req.getLocale() + }; + + const email = new Email('email-verify', params); + email.send(); + + cb(null, verifyOptions.to); + } + } + + const options = { + type: 'email', + to: instance.email, + from: {}, + redirect: `${origin}/#!/account/${instance.id}/basic-data?emailConfirmed`, + template: false, + mailer: new Mailer, + host: url[1].split('/')[2], + port: url[2], + protocol: url[0], + user: Self + }; + + await user.verify(options); + }); + Self.remoteMethod('getCurrentUserData', { description: 'Gets the current user data', accepts: [ { arg: 'ctx', - type: 'Object', + type: 'object', http: {source: 'context'} } ], returns: { - type: 'Object', + type: 'object', root: true }, http: { @@ -57,7 +107,7 @@ module.exports = Self => { * * @param {Integer} userId The user id * @param {String} name The role name - * @param {Object} options Options + * @param {object} options Options * @return {Boolean} %true if user has the role, %false otherwise */ Self.hasRole = async function(userId, name, options) { @@ -69,19 +119,19 @@ module.exports = Self => { * Get all user roles. * * @param {Integer} userId The user id - * @param {Object} options Options - * @return {Object} User role list + * @param {object} options Options + * @return {object} User role list */ Self.getRoles = async(userId, options) => { let result = await Self.rawSql( `SELECT r.name FROM account.user u JOIN account.roleRole rr ON rr.role = u.role - JOIN account.role r ON r.id = rr.inheritsFrom + JOIN account.role r ON r.id = rr.inheritsFrom WHERE u.id = ?`, [userId], options); let roles = []; - for (role of result) + for (const role of result) roles.push(role.name); return roles; diff --git a/back/models/account.json b/back/models/account.json index 5f0b05f9b..5e35c711a 100644 --- a/back/models/account.json +++ b/back/models/account.json @@ -40,6 +40,9 @@ "email": { "type": "string" }, + "emailVerified": { + "type": "boolean" + }, "created": { "type": "date" }, @@ -48,6 +51,9 @@ }, "image": { "type": "string" + }, + "hasGrant": { + "type": "boolean" } }, "relations": { @@ -85,20 +91,34 @@ "principalType": "ROLE", "principalId": "$everyone", "permission": "ALLOW" - }, + }, + { + "property": "recoverPassword", + "accessType": "EXECUTE", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }, { - "property": "logout", + "property": "logout", "accessType": "EXECUTE", "principalType": "ROLE", "principalId": "$authenticated", "permission": "ALLOW" }, { - "property": "validateToken", + "property": "validateToken", "accessType": "EXECUTE", "principalType": "ROLE", "principalId": "$authenticated", "permission": "ALLOW" + }, + { + "property": "privileges", + "accessType": "*", + "principalType": "ROLE", + "principalId": "$authenticated", + "permission": "ALLOW" } ] } diff --git a/back/models/chat.js b/back/models/chat.js index 95a1e2c29..a18edbd3f 100644 --- a/back/models/chat.js +++ b/back/models/chat.js @@ -4,4 +4,23 @@ module.exports = Self => { require('../methods/chat/sendCheckingPresence')(Self); require('../methods/chat/notifyIssues')(Self); require('../methods/chat/sendQueued')(Self); + + Self.observe('before save', async function(ctx) { + if (!ctx.isNewInstance) return; + + let {message} = ctx.instance; + if (!message) return; + + const parts = message.match(/(?<=\[)[a-zA-Z0-9_\-+!@#$%^&*()={};':"\\|,.<>/?\s]*(?=])/g); + if (!parts) return; + + const replacedParts = parts.map(part => { + return part.replace(/[!$%^&*()={};':"\\,.<>/?]/g, ''); + }); + + for (const [index, part] of parts.entries()) + message = message.replace(part, replacedParts[index]); + + ctx.instance.message = message; + }); }; diff --git a/back/models/chat.json b/back/models/chat.json index 8fc3a6304..0d6328544 100644 --- a/back/models/chat.json +++ b/back/models/chat.json @@ -32,6 +32,9 @@ }, "attempts": { "type": "number" + }, + "error": { + "type": "string" } }, "acls": [{ diff --git a/back/models/collection.js b/back/models/collection.js index 436414f62..a41742ee7 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -3,4 +3,5 @@ module.exports = Self => { require('../methods/collection/newCollection')(Self); require('../methods/collection/getSectors')(Self); require('../methods/collection/setSaleQuantity')(Self); + require('../methods/collection/previousLabel')(Self); }; diff --git a/back/models/company.json b/back/models/company.json index a36b43b69..f16c5762f 100644 --- a/back/models/company.json +++ b/back/models/company.json @@ -20,10 +20,9 @@ "type": "date" } }, - "scope": { "where" :{ "expired": null } } -} \ No newline at end of file +} diff --git a/back/models/delivery.json b/back/models/delivery.json index 65a0eef1b..c66c31b45 100644 --- a/back/models/delivery.json +++ b/back/models/delivery.json @@ -9,17 +9,29 @@ "properties": { "id": { "id": true, - "type": "number", - "forceId": false + "type": "number" }, - "date": { + "created": { "type": "date" }, - "m3":{ + "longitude":{ "type": "number" }, - "warehouseFk":{ + "latitude":{ + "type": "number" + }, + "dated":{ + "type": "date" + }, + "ticketFk":{ "type": "number" } - } + }, + "relations": { + "ticket": { + "type": "belongsTo", + "model": "Ticket", + "foreignKey": "ticketFk" + } + } } diff --git a/back/models/docuware-config.json b/back/models/docuware-config.json index 8ca76d8ba..9d06c4874 100644 --- a/back/models/docuware-config.json +++ b/back/models/docuware-config.json @@ -16,7 +16,7 @@ "url": { "type": "string" }, - "token": { + "cookie": { "type": "string" } }, @@ -29,4 +29,4 @@ "permission": "ALLOW" } ] -} \ No newline at end of file +} diff --git a/back/models/docuware.js b/back/models/docuware.js index 8fd8065ed..b983f7bb4 100644 --- a/back/models/docuware.js +++ b/back/models/docuware.js @@ -1,4 +1,7 @@ module.exports = Self => { require('../methods/docuware/download')(Self); + require('../methods/docuware/upload')(Self); require('../methods/docuware/checkFile')(Self); + require('../methods/docuware/deliveryNoteEmail')(Self); + require('../methods/docuware/core')(Self); }; diff --git a/back/models/docuware.json b/back/models/docuware.json index fb2ed919e..dec20eede 100644 --- a/back/models/docuware.json +++ b/back/models/docuware.json @@ -19,20 +19,14 @@ "fileCabinetName": { "type": "string" }, + "action": { + "type": "string" + }, "dialogName": { "type": "string" }, - "find": { + "findById": { "type": "string" } - }, - "acls": [ - { - "property": "*", - "accessType": "*", - "principalType": "ROLE", - "principalId": "$everyone", - "permission": "ALLOW" - } - ] -} \ No newline at end of file + } +} diff --git a/back/models/image.js b/back/models/image.js index d736e924f..3d3b03879 100644 --- a/back/models/image.js +++ b/back/models/image.js @@ -77,16 +77,15 @@ module.exports = Self => { const newImage = await Self.upsertWithWhere(data, { name: fileName, collectionFk: collectionName, - updated: (new Date).getTime() + updated: Date.vnNow() }, myOptions); // Resizes and saves the image const container = await models.ImageContainer.container(collectionName); const rootPath = container.client.root; const collectionDir = path.join(rootPath, collectionName); - const file = `${fileName}.png`; const dstDir = path.join(collectionDir, 'full'); - const dstFile = path.join(dstDir, file); + const dstFile = path.join(dstDir, fileName); const buffer = readChunk.sync(srcFilePath, 0, 12); const type = imageType(buffer); @@ -102,7 +101,8 @@ module.exports = Self => { width: bmpData.width, height: bmpData.height, channels: 4 - } + }, + failOn: 'none' }; } @@ -120,7 +120,7 @@ module.exports = Self => { const sizes = collection.sizes(); for (let size of sizes) { const dstDir = path.join(collectionDir, `${size.width}x${size.height}`); - const dstFile = path.join(dstDir, file); + const dstFile = path.join(dstDir, fileName); const resizeOpts = { withoutEnlargement: true, fit: size.crop ? 'cover' : 'inside' diff --git a/back/models/notification.js b/back/models/notification.js new file mode 100644 index 000000000..65e82e3c7 --- /dev/null +++ b/back/models/notification.js @@ -0,0 +1,4 @@ +module.exports = Self => { + require('../methods/notification/send')(Self); + require('../methods/notification/clean')(Self); +}; diff --git a/back/models/notification.json b/back/models/notification.json new file mode 100644 index 000000000..56f66bf1d --- /dev/null +++ b/back/models/notification.json @@ -0,0 +1,30 @@ +{ + "name": "Notification", + "base": "VnModel", + "options": { + "mysql": { + "table": "util.notification" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string", + "required": true + }, + "description": { + "type": "string" + } + }, + "relations": { + "subscription": { + "type": "hasMany", + "model": "NotificationSubscription", + "foreignKey": "notificationFk" + } + } +} \ No newline at end of file diff --git a/back/models/notificationAcl.json b/back/models/notificationAcl.json new file mode 100644 index 000000000..a20187961 --- /dev/null +++ b/back/models/notificationAcl.json @@ -0,0 +1,31 @@ +{ + "name": "NotificationAcl", + "base": "VnModel", + "options": { + "mysql": { + "table": "util.notificationAcl" + } + }, + "properties":{ + "notificationFk": { + "id": true, + "type": "number" + }, + "roleFk":{ + "id": true, + "type": "number" + } + }, + "relations": { + "notification": { + "type": "belongsTo", + "model": "Notification", + "foreignKey": "notificationFk" + }, + "role": { + "type": "belongsTo", + "model": "Role", + "foreignKey": "roleFk" + } + } +} \ No newline at end of file diff --git a/modules/worker/back/models/sector.json b/back/models/notificationConfig.json similarity index 56% rename from modules/worker/back/models/sector.json rename to back/models/notificationConfig.json index 8bd5e773f..b00ed3675 100644 --- a/modules/worker/back/models/sector.json +++ b/back/models/notificationConfig.json @@ -1,20 +1,19 @@ { - "name": "Sector", + "name": "NotificationConfig", "base": "VnModel", "options": { "mysql": { - "table": "sector" + "table": "util.notificationConfig" } }, - "properties": { + "properties": { "id": { "type": "number", "id": true, "description": "Identifier" }, - "description": { - "type": "string", - "required": true + "cleanDays": { + "type": "number" } } } \ No newline at end of file diff --git a/back/models/notificationQueue.json b/back/models/notificationQueue.json new file mode 100644 index 000000000..9790ea595 --- /dev/null +++ b/back/models/notificationQueue.json @@ -0,0 +1,38 @@ +{ + "name": "NotificationQueue", + "base": "VnModel", + "options": { + "mysql": { + "table": "util.notificationQueue" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "params": { + "type": "string" + }, + "status": { + "type": "string" + }, + "created": { + "type": "date" + } + }, + "relations": { + "notification": { + "type": "belongsTo", + "model": "Notification", + "foreignKey": "notificationFk", + "primaryKey": "name" + }, + "author": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "authorFk" + } + } +} \ No newline at end of file diff --git a/back/models/notificationSubscription.js b/back/models/notificationSubscription.js new file mode 100644 index 000000000..f1b2811fa --- /dev/null +++ b/back/models/notificationSubscription.js @@ -0,0 +1,62 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.observe('before save', async function(ctx) { + const models = Self.app.models; + const userId = ctx.options.accessToken.userId; + const user = await ctx.instance.userFk; + const modifiedUser = await getUserToModify(null, user, models); + + if (userId != modifiedUser.id && userId != modifiedUser.bossFk) + throw new UserError('You dont have permission to modify this user'); + }); + + Self.remoteMethod('deleteNotification', { + description: 'Deletes a notification subscription', + accepts: [ + { + arg: 'ctx', + type: 'object', + http: {source: 'context'} + }, + { + arg: 'notificationId', + type: 'number', + required: true + }, + ], + returns: { + type: 'object', + root: true + }, + http: { + verb: 'POST', + path: '/deleteNotification' + } + }); + + Self.deleteNotification = async function(ctx, notificationId) { + const models = Self.app.models; + const user = ctx.req.accessToken.userId; + const modifiedUser = await getUserToModify(notificationId, null, models); + + if (user != modifiedUser.id && user != modifiedUser.bossFk) + throw new UserError('You dont have permission to modify this user'); + + await models.NotificationSubscription.destroyById(notificationId); + }; + + async function getUserToModify(notificationId, userFk, models) { + let userToModify = userFk; + if (notificationId) { + const subscription = await models.NotificationSubscription.findById(notificationId); + userToModify = subscription.userFk; + } + return await models.Worker.findOne({ + fields: ['id', 'bossFk'], + where: { + id: userToModify + } + }); + } +}; diff --git a/back/models/notificationSubscription.json b/back/models/notificationSubscription.json new file mode 100644 index 000000000..a640e0917 --- /dev/null +++ b/back/models/notificationSubscription.json @@ -0,0 +1,36 @@ +{ + "name": "NotificationSubscription", + "base": "VnModel", + "options": { + "mysql": { + "table": "util.notificationSubscription" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Primary key" + }, + "notificationFk": { + "type": "number", + "description": "Foreign key to Notification" + }, + "userFk": { + "type": "number", + "description": "Foreign key to Account" + } + }, + "relations": { + "notification": { + "type": "belongsTo", + "model": "Notification", + "foreignKey": "notificationFk" + }, + "user": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "userFk" + } + } +} \ No newline at end of file diff --git a/back/models/osticket-config.json b/back/models/osticket-config.json new file mode 100644 index 000000000..5a863e7bc --- /dev/null +++ b/back/models/osticket-config.json @@ -0,0 +1,58 @@ +{ + "name": "OsTicketConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "osTicketConfig" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "host": { + "type": "string" + }, + "user": { + "type": "string" + }, + "password": { + "type": "string" + }, + "oldStatus": { + "type": "string" + }, + "newStatusId": { + "type": "number" + }, + "day": { + "type": "number" + }, + "comment": { + "type": "string" + }, + "hostDb": { + "type": "string" + }, + "userDb": { + "type": "string" + }, + "passwordDb": { + "type": "string" + }, + "portDb": { + "type": "number" + }, + "responseType": { + "type": "string" + }, + "fromEmailId": { + "type": "number" + }, + "replyTo": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/back/models/osticket.js b/back/models/osticket.js new file mode 100644 index 000000000..50e429160 --- /dev/null +++ b/back/models/osticket.js @@ -0,0 +1,4 @@ +module.exports = Self => { + require('../methods/osticket/osTicketReportEmail')(Self); + require('../methods/osticket/closeTicket')(Self); +}; diff --git a/back/models/osticket.json b/back/models/osticket.json index 0c673d004..6ba80b30e 100644 --- a/back/models/osticket.json +++ b/back/models/osticket.json @@ -1,12 +1,5 @@ { "name": "OsTicket", - "base": "VnModel", - "acls": [{ - "property": "validations", - "accessType": "EXECUTE", - "principalType": "ROLE", - "principalId": "$everyone", - "permission": "ALLOW" - }] + "base": "VnModel" } \ No newline at end of file diff --git a/back/models/print-config.json b/back/models/print-config.json new file mode 100644 index 000000000..badb57083 --- /dev/null +++ b/back/models/print-config.json @@ -0,0 +1,29 @@ +{ + "name": "PrintConfig", + "description": "Print config", + "base": "VnModel", + "options": { + "mysql": { + "table": "salix.printConfig" + } + }, + "properties": { + "id": { + "id": true, + "type": "number", + "description": "Identifier" + }, + "itRecipient": { + "type": "string" + }, + "incidencesEmail": { + "type": "string" + } + }, + "acls": [{ + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }] +} \ No newline at end of file diff --git a/back/models/specs/account.spec.js b/back/models/specs/account.spec.js index c52bc4378..f31c81b75 100644 --- a/back/models/specs/account.spec.js +++ b/back/models/specs/account.spec.js @@ -1,14 +1,14 @@ -const app = require('vn-loopback/server/server'); +const models = require('vn-loopback/server/server').models; describe('loopback model Account', () => { it('should return true if the user has the given role', async() => { - let result = await app.models.Account.hasRole(1, 'employee'); + let result = await models.Account.hasRole(1, 'employee'); expect(result).toBeTruthy(); }); it('should return false if the user doesnt have the given role', async() => { - let result = await app.models.Account.hasRole(1, 'administrator'); + let result = await models.Account.hasRole(1, 'administrator'); expect(result).toBeFalsy(); }); diff --git a/back/models/specs/notificationSubscription.spec.js b/back/models/specs/notificationSubscription.spec.js new file mode 100644 index 000000000..c7f37abed --- /dev/null +++ b/back/models/specs/notificationSubscription.spec.js @@ -0,0 +1,74 @@ +const models = require('vn-loopback/server/server').models; + +describe('loopback model NotificationSubscription', () => { + it('Should fail to delete a notification if the user is not editing itself or a subordinate', async() => { + const tx = await models.NotificationSubscription.beginTransaction({}); + + try { + const options = {transaction: tx}; + const user = 9; + const notificationSubscriptionId = 2; + const ctx = {req: {accessToken: {userId: user}}}; + const notification = await models.NotificationSubscription.findById(notificationSubscriptionId); + + let error; + + try { + await models.NotificationSubscription.deleteNotification(ctx, notification.id, options); + } catch (e) { + error = e; + } + + expect(error.message).toContain('You dont have permission to modify this user'); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('Should delete a notification if the user is editing itself', async() => { + const tx = await models.NotificationSubscription.beginTransaction({}); + + try { + const options = {transaction: tx}; + const user = 9; + const notificationSubscriptionId = 4; + const ctx = {req: {accessToken: {userId: user}}}; + const notification = await models.NotificationSubscription.findById(notificationSubscriptionId); + + await models.NotificationSubscription.deleteNotification(ctx, notification.id, options); + + const deletedNotification = await models.NotificationSubscription.findById(notificationSubscriptionId); + + expect(deletedNotification).toBeNull(); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('Should delete a notification if the user is editing a subordinate', async() => { + const tx = await models.NotificationSubscription.beginTransaction({}); + + try { + const options = {transaction: tx}; + const user = 9; + const notificationSubscriptionId = 5; + const ctx = {req: {accessToken: {userId: user}}}; + const notification = await models.NotificationSubscription.findById(notificationSubscriptionId); + + await models.NotificationSubscription.deleteNotification(ctx, notification.id, options); + + const deletedNotification = await models.NotificationSubscription.findById(notificationSubscriptionId); + + expect(deletedNotification).toBeNull(); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); + diff --git a/back/models/specs/user.spec.js b/back/models/specs/user.spec.js new file mode 100644 index 000000000..124afdc0c --- /dev/null +++ b/back/models/specs/user.spec.js @@ -0,0 +1,32 @@ +const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); + +describe('account recoverPassword()', () => { + const userId = 1107; + + const activeCtx = { + accessToken: {userId: userId}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + + beforeEach(() => { + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + + it('should send email with token', async() => { + const userId = 1107; + const user = await models.Account.findById(userId); + + await models.Account.recoverPassword(user.email); + + const result = await models.AccessToken.findOne({where: {userId: userId}}); + + expect(result).toBeDefined(); + }); +}); diff --git a/back/models/url.json b/back/models/url.json new file mode 100644 index 000000000..8610ff28b --- /dev/null +++ b/back/models/url.json @@ -0,0 +1,25 @@ +{ + "name": "Url", + "base": "VnModel", + "options": { + "mysql": { + "table": "salix.url" + } + }, + "properties": { + "appName": { + "type": "string", + "required": true, + "id": 1 + }, + "environment": { + "type": "string", + "required": true, + "id": 2 + }, + "url": { + "type": "string", + "required": true + } + } +} diff --git a/back/models/user.js b/back/models/user.js new file mode 100644 index 000000000..b24d702b3 --- /dev/null +++ b/back/models/user.js @@ -0,0 +1,27 @@ +const LoopBackContext = require('loopback-context'); +const {Email} = require('vn-print'); + +module.exports = function(Self) { + Self.on('resetPasswordRequest', async function(info) { + const loopBackContext = LoopBackContext.getCurrentContext(); + const httpCtx = {req: loopBackContext.active}; + const httpRequest = httpCtx.req.http.req; + const headers = httpRequest.headers; + const origin = headers.origin; + + const user = await Self.app.models.Account.findById(info.user.id); + const params = { + recipient: info.email, + lang: user.lang, + url: `${origin}/#!/reset-password?access_token=${info.accessToken.id}` + }; + + const options = Object.assign({}, info.options); + for (const param in options) + params[param] = options[param]; + + const email = new Email(options.emailTemplate, params); + + return email.send(); + }); +}; diff --git a/back/models/warehouse.json b/back/models/warehouse.json index eb86e2114..dcbf7f2d2 100644 --- a/back/models/warehouse.json +++ b/back/models/warehouse.json @@ -24,9 +24,6 @@ }, "isManaged":{ "type": "boolean" - }, - "hasStowaway":{ - "type": "boolean" } }, "acls": [ diff --git a/back/nodemonConfig.json b/back/nodemonConfig.json index a1c9ca84f..5138bc30e 100644 --- a/back/nodemonConfig.json +++ b/back/nodemonConfig.json @@ -18,6 +18,7 @@ "modules/supplier/front/**/*", "modules/ticket/front/**/*", "modules/travel/front/**/*", + "modules/shelving/front/**/*", "modules/worker/front/**/*", "modules/zone/front/**/*" ] diff --git a/back/tests.js b/back/tests.js index 809906177..8f7cfd3d4 100644 --- a/back/tests.js +++ b/back/tests.js @@ -7,13 +7,18 @@ process.on('warning', warning => { console.log(warning.stack); }); +process.on('exit', async function() { + if (container) await container.rm(); +}); + +let container; async function test() { let isCI = false; if (process.argv[2] === 'ci') isCI = true; - const container = new Docker(); + container = new Docker(); await container.run(isCI); dataSources = JSON.parse(JSON.stringify(dataSources)); @@ -25,7 +30,10 @@ async function test() { const bootOptions = {dataSources}; const app = require('vn-loopback/server/server'); - app.boot(bootOptions); + await new Promise((resolve, reject) => { + app.boot(bootOptions, + err => err ? reject(err) : resolve()); + }); const Jasmine = require('jasmine'); const jasmine = new Jasmine(); @@ -46,6 +54,7 @@ async function test() { jasmine.addReporter(new JunitReporter.JUnitXmlReporter()); jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; + jasmine.exitOnCompletion = true; } const backSpecs = [ @@ -60,11 +69,10 @@ async function test() { helpers: [], }); - jasmine.exitOnCompletion = false; await jasmine.execute(); if (app) await app.disconnect(); if (container) await container.rm(); - console.log('app disconnected & container removed'); + console.log('App disconnected & container removed'); } test(); diff --git a/db/.archive/224701/00-ACL.sql b/db/.archive/224701/00-ACL.sql new file mode 100644 index 000000000..2cce197b2 --- /dev/null +++ b/db/.archive/224701/00-ACL.sql @@ -0,0 +1,49 @@ +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES + ('ClientConsumptionQueue', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Ticket', 'deliveryNotePdf', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Ticket', 'deliveryNoteEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Ticket', 'deliveryNoteCsvPdf', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Ticket', 'deliveryNoteCsvEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'campaignMetricsPdf', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'campaignMetricsEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'clientWelcomeHtml', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'clientWelcomeEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'creditRequestPdf', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'creditRequestHtml', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'creditRequestEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'printerSetupHtml', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'printerSetupEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'sepaCoreEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'letterDebtorPdf', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'letterDebtorStHtml', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'letterDebtorStEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'letterDebtorNdHtml', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'letterDebtorNdEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'clientDebtStatementPdf', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'clientDebtStatementHtml', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'clientDebtStatementEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'incotermsAuthorizationPdf', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'incotermsAuthorizationHtml', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'incotermsAuthorizationEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'consumptionSendQueued', 'WRITE', 'ALLOW', 'ROLE', 'system'), + ('InvoiceOut', 'invoiceEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('InvoiceOut', 'exportationPdf', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('InvoiceOut', 'sendQueued', 'WRITE', 'ALLOW', 'ROLE', 'system'), + ('Ticket', 'invoiceCsvPdf', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Ticket', 'invoiceCsvEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Supplier', 'campaignMetricsPdf', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Supplier', 'campaignMetricsEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Travel', 'extraCommunityPdf', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Travel', 'extraCommunityEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Entry', 'entryOrderPdf', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('OsTicket', 'osTicketReportEmail', 'WRITE', 'ALLOW', 'ROLE', 'system'), + ('Item', 'buyerWasteEmail', 'WRITE', 'ALLOW', 'ROLE', 'system'), + ('Claim', 'claimPickupPdf', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Claim', 'claimPickupEmail', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'), + ('Item', 'labelPdf', 'READ', 'ALLOW', 'ROLE', 'employee'); + +INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId) + VALUES ('Sector','*','READ','ALLOW','ROLE','employee'); +INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId) + VALUES ('Sector','*','WRITE','ALLOW','ROLE','employee'); diff --git a/db/changes/10440-fallas/00-aclSupplierAgencyTerms.sql b/db/.archive/224701/00-acl_receiptPdf.sql similarity index 60% rename from db/changes/10440-fallas/00-aclSupplierAgencyTerms.sql rename to db/.archive/224701/00-acl_receiptPdf.sql index fa57c1d64..42f84b87d 100644 --- a/db/changes/10440-fallas/00-aclSupplierAgencyTerms.sql +++ b/db/.archive/224701/00-acl_receiptPdf.sql @@ -1,3 +1,3 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES - ('SupplierAgencyTerm', '*', '*', 'ALLOW', 'ROLE', 'administrative'); + ('Receipt', 'receiptPdf', '*', 'ALLOW', 'ROLE', 'salesAssistant'); diff --git a/db/.archive/224701/00-clientConsumptionQueue.sql b/db/.archive/224701/00-clientConsumptionQueue.sql new file mode 100644 index 000000000..2734d32cc --- /dev/null +++ b/db/.archive/224701/00-clientConsumptionQueue.sql @@ -0,0 +1,9 @@ +create table `vn`.`clientConsumptionQueue` +( + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + params json not null, + queued datetime default current_timestamp() not null, + printed datetime null, + status varchar(50) default '' null +) + comment 'Queue for client consumption PDF mailing'; diff --git a/db/.archive/224701/00-invoiceOutQueue.sql b/db/.archive/224701/00-invoiceOutQueue.sql new file mode 100644 index 000000000..52ed4a113 --- /dev/null +++ b/db/.archive/224701/00-invoiceOutQueue.sql @@ -0,0 +1 @@ +rename table `vn`.`invoiceOut_queue` to `vn`.`invoiceOutQueue`; diff --git a/db/.archive/224701/00-itemConfig.sql b/db/.archive/224701/00-itemConfig.sql new file mode 100644 index 000000000..b148aa094 --- /dev/null +++ b/db/.archive/224701/00-itemConfig.sql @@ -0,0 +1,5 @@ +ALTER TABLE `vn`.`itemConfig` + ADD id int null PRIMARY KEY first; + +ALTER TABLE `vn`.`itemConfig` + ADD wasteRecipients VARCHAR(50) NOT NULL comment 'Weekly waste report schedule recipients'; diff --git a/db/.archive/224701/00-printConfig.sql b/db/.archive/224701/00-printConfig.sql new file mode 100644 index 000000000..c5af09ac9 --- /dev/null +++ b/db/.archive/224701/00-printConfig.sql @@ -0,0 +1,10 @@ +create table `salix`.`printConfig` +( + id int auto_increment, + itRecipient varchar(50) null comment 'IT recipients for report mailing', + incidencesEmail varchar(50) null comment 'CAU destinatary email', + constraint printConfig_pk + primary key (id) +) + comment 'Print service config'; + diff --git a/db/.archive/224701/00-sale_afterUpdate.sql b/db/.archive/224701/00-sale_afterUpdate.sql new file mode 100644 index 000000000..407fb52c9 --- /dev/null +++ b/db/.archive/224701/00-sale_afterUpdate.sql @@ -0,0 +1,100 @@ +DROP TRIGGER IF EXISTS vn.sale_afterUpdate; +USE vn; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` 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', 'salesTeamBoss') + 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 ; diff --git a/db/.archive/224701/00-sample.sql b/db/.archive/224701/00-sample.sql new file mode 100644 index 000000000..f84cd723e --- /dev/null +++ b/db/.archive/224701/00-sample.sql @@ -0,0 +1,6 @@ +alter table `vn`.`sample` + add model VARCHAR(25) null comment 'Model name in plural'; + +UPDATE vn.sample t + SET t.model = 'Clients' + WHERE t.id IN(12, 13, 14, 15, 16, 18, 19, 20); \ No newline at end of file diff --git a/db/.archive/224701/00-user_hasGrant.sql b/db/.archive/224701/00-user_hasGrant.sql new file mode 100644 index 000000000..60d1273d8 --- /dev/null +++ b/db/.archive/224701/00-user_hasGrant.sql @@ -0,0 +1 @@ +ALTER TABLE `account`.`user` ADD hasGrant TINYINT(1) NOT NULL; diff --git a/db/.archive/224702/00-ACL_workerDisableExcluded.sql b/db/.archive/224702/00-ACL_workerDisableExcluded.sql new file mode 100644 index 000000000..2fd9e8b12 --- /dev/null +++ b/db/.archive/224702/00-ACL_workerDisableExcluded.sql @@ -0,0 +1,2 @@ +INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalId) + VALUES ('WorkerDisableExcluded','*','*','ALLOW','hr'); \ No newline at end of file diff --git a/db/changes/10440-fallas/00-aclEducationLevel.sql b/db/.archive/224702/00-aclBusiness.sql similarity index 61% rename from db/changes/10440-fallas/00-aclEducationLevel.sql rename to db/.archive/224702/00-aclBusiness.sql index 26bf9d16f..8ea2c6d83 100644 --- a/db/changes/10440-fallas/00-aclEducationLevel.sql +++ b/db/.archive/224702/00-aclBusiness.sql @@ -1,2 +1,3 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) - VALUES('EducationLevel', '*', '*', 'ALLOW', 'ROLE', 'employee'); + VALUES + ('Business', '*', '*', 'ALLOW', 'ROLE', 'hr'); \ No newline at end of file diff --git a/db/.archive/224702/00-aclUsesMana.sql b/db/.archive/224702/00-aclUsesMana.sql new file mode 100644 index 000000000..5bb7178dd --- /dev/null +++ b/db/.archive/224702/00-aclUsesMana.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Sale', 'usesMana', '*', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/db/.archive/224702/00-defaultPayDem_sameAs_production.sql b/db/.archive/224702/00-defaultPayDem_sameAs_production.sql new file mode 100644 index 000000000..294247338 --- /dev/null +++ b/db/.archive/224702/00-defaultPayDem_sameAs_production.sql @@ -0,0 +1,2 @@ +INSERT INTO `vn`.`payDem` (id,payDem) + VALUES (7,'0'); diff --git a/db/.archive/224702/00-invoiceInPdf.sql b/db/.archive/224702/00-invoiceInPdf.sql new file mode 100644 index 000000000..bce256c05 --- /dev/null +++ b/db/.archive/224702/00-invoiceInPdf.sql @@ -0,0 +1,4 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('InvoiceIn', 'invoiceInPdf', 'READ', 'ALLOW', 'ROLE', 'administrative'), + ('InvoiceIn', 'invoiceInEmail', 'WRITE', 'ALLOW', 'ROLE', 'administrative'); diff --git a/db/changes/10430-ash/00-aclAgencyTerm.sql b/db/.archive/224702/00-newSupplier_ACL.sql similarity index 51% rename from db/changes/10430-ash/00-aclAgencyTerm.sql rename to db/.archive/224702/00-newSupplier_ACL.sql index c43965ed0..c88f3de3f 100644 --- a/db/changes/10430-ash/00-aclAgencyTerm.sql +++ b/db/.archive/224702/00-newSupplier_ACL.sql @@ -1,2 +1,2 @@ INSERT INTO `salix`.`ACL` (model,property,accessType,principalId) - VALUES ('AgencyTerm','*','*','administrative'); + VALUES ('Supplier','newSupplier','WRITE','administrative'); diff --git a/db/.archive/224702/00-notificationProc.sql b/db/.archive/224702/00-notificationProc.sql new file mode 100644 index 000000000..2cf11b4f1 --- /dev/null +++ b/db/.archive/224702/00-notificationProc.sql @@ -0,0 +1,23 @@ +DROP FUNCTION IF EXISTS `util`.`notification_send`; +DELIMITER $$ +CREATE DEFINER=`root`@`localhost` FUNCTION `util`.`notification_send`(vNotificationName VARCHAR(255), vParams TEXT, vAuthorFk INT) + RETURNS INT + MODIFIES SQL DATA +BEGIN +/** + * Sends a notification. + * + * @param vNotificationName The notification name + * @param vParams The notification parameters formatted as JSON + * @param vAuthorFk The notification author or %NULL if there is no author + * @return The notification id + */ + + INSERT INTO notificationQueue + SET notificationFk = vNotificationName, + params = vParams, + authorFk = vAuthorFk; + + RETURN LAST_INSERT_ID(); +END$$ +DELIMITER ; diff --git a/db/.archive/224702/00-notificationTables.sql b/db/.archive/224702/00-notificationTables.sql new file mode 100644 index 000000000..2db7d9874 --- /dev/null +++ b/db/.archive/224702/00-notificationTables.sql @@ -0,0 +1,63 @@ +USE util; + +CREATE TABLE notification( + id INT PRIMARY KEY, + `name` VARCHAR(255) UNIQUE, + `description` VARCHAR(255) +); + +CREATE TABLE notificationAcl( + notificationFk INT, + roleFk INT(10) unsigned, + PRIMARY KEY(notificationFk, roleFk) +); + +ALTER TABLE `util`.`notificationAcl` ADD CONSTRAINT `notificationAcl_ibfk_1` FOREIGN KEY (`notificationFk`) REFERENCES `util`.`notification` (`id`) + ON DELETE CASCADE + ON UPDATE CASCADE; + +ALTER TABLE `util`.`notificationAcl` ADD CONSTRAINT `notificationAcl_ibfk_2` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role`(`id`) + ON DELETE RESTRICT + ON UPDATE CASCADE; + +CREATE TABLE notificationSubscription( + notificationFk INT, + userFk INT(10) unsigned, + PRIMARY KEY(notificationFk, userFk) +); + +ALTER TABLE `util`.`notificationSubscription` ADD CONSTRAINT `notificationSubscription_ibfk_1` FOREIGN KEY (`notificationFk`) REFERENCES `util`.`notification` (`id`) + ON DELETE CASCADE + ON UPDATE CASCADE; + +ALTER TABLE `util`.`notificationSubscription` ADD CONSTRAINT `notificationSubscription_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user`(`id`) + ON DELETE CASCADE + ON UPDATE CASCADE; + +CREATE TABLE notificationQueue( + id INT PRIMARY KEY AUTO_INCREMENT, + notificationFk VARCHAR(255), + params JSON, + authorFk INT(10) unsigned NULL, + `status` ENUM('pending', 'sent', 'error') NOT NULL DEFAULT 'pending', + created DATETIME DEFAULT CURRENT_TIMESTAMP, + INDEX(notificationFk), + INDEX(authorFk), + INDEX(status) +); + +ALTER TABLE `util`.`notificationQueue` ADD CONSTRAINT `nnotificationQueue_ibfk_1` FOREIGN KEY (`notificationFk`) REFERENCES `util`.`notification` (`name`) + ON DELETE CASCADE + ON UPDATE CASCADE; + +ALTER TABLE `util`.`notificationQueue` ADD CONSTRAINT `notificationQueue_ibfk_2` FOREIGN KEY (`authorFk`) REFERENCES `account`.`user`(`id`) + ON DELETE CASCADE + ON UPDATE CASCADE; + +CREATE TABLE notificationConfig( + id INT PRIMARY KEY AUTO_INCREMENT, + cleanDays MEDIUMINT +); + +INSERT INTO notificationConfig + SET cleanDays = 90; diff --git a/db/.archive/224702/00-payMethodFk_Allow_Null.sql b/db/.archive/224702/00-payMethodFk_Allow_Null.sql new file mode 100644 index 000000000..6d9931d3c --- /dev/null +++ b/db/.archive/224702/00-payMethodFk_Allow_Null.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`supplier` MODIFY COLUMN payMethodFk tinyint(3) unsigned NULL; \ No newline at end of file diff --git a/db/.archive/224702/00-supplierActivityFk_Allow_Null.sql b/db/.archive/224702/00-supplierActivityFk_Allow_Null.sql new file mode 100644 index 000000000..62aac0556 --- /dev/null +++ b/db/.archive/224702/00-supplierActivityFk_Allow_Null.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`supplier` MODIFY COLUMN supplierActivityFk varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL; \ No newline at end of file diff --git a/db/.archive/224702/00-ticket_closeByTicket.sql b/db/.archive/224702/00-ticket_closeByTicket.sql new file mode 100644 index 000000000..f378b1146 --- /dev/null +++ b/db/.archive/224702/00-ticket_closeByTicket.sql @@ -0,0 +1,35 @@ +drop procedure `vn`.`ticket_closeByTicket`; + +DELIMITER $$ +$$ +create + definer = `root`@`localhost` procedure `vn`.`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 ticket t + JOIN agencyMode am ON am.id = t.agencyModeFk + LEFT JOIN ticketState ts ON ts.ticketFk = t.id + JOIN alertLevel al ON al.id = ts.alertLevel + WHERE al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered') + AND t.id = vTicketFk + AND t.refFk IS NULL + GROUP BY t.id); + + CALL ticket_close(); + + DROP TEMPORARY TABLE tmp.ticket_close; +END$$ +DELIMITER ; + + diff --git a/db/.archive/224702/00-zipConfig.sql b/db/.archive/224702/00-zipConfig.sql new file mode 100644 index 000000000..134ce7770 --- /dev/null +++ b/db/.archive/224702/00-zipConfig.sql @@ -0,0 +1,9 @@ +CREATE TABLE `vn`.`zipConfig` ( + `id` double(10,2) NOT NULL, + `maxSize` int(11) DEFAULT NULL COMMENT 'in MegaBytes', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('ZipConfig', '*', '*', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/db/.archive/224801/00-ACL.sql b/db/.archive/224801/00-ACL.sql new file mode 100644 index 000000000..0b726538c --- /dev/null +++ b/db/.archive/224801/00-ACL.sql @@ -0,0 +1,5 @@ +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) +VALUES + ('ClaimRma', '*', 'READ', 'ALLOW', 'ROLE', 'claimManager'), + ('ClaimRma', '*', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'); + diff --git a/db/.archive/224801/00-claim.sql b/db/.archive/224801/00-claim.sql new file mode 100644 index 000000000..0b9879878 --- /dev/null +++ b/db/.archive/224801/00-claim.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`claim` ADD rma varchar(100) NULL ; \ No newline at end of file diff --git a/db/.archive/224801/00-claimRma.sql b/db/.archive/224801/00-claimRma.sql new file mode 100644 index 000000000..91e1ebaba --- /dev/null +++ b/db/.archive/224801/00-claimRma.sql @@ -0,0 +1,7 @@ +CREATE TABLE `vn`.`claimRma` ( + id INT UNSIGNED auto_increment NOT NULL PRIMARY KEY, + code varchar(100) NOT NULL, + created timestamp DEFAULT current_timestamp() NOT NULL, + workerFk INTEGER UNSIGNED NOT NULL +) +ENGINE=InnoDB; diff --git a/db/.archive/224901/00-aclNotification.sql b/db/.archive/224901/00-aclNotification.sql new file mode 100644 index 000000000..51d6b2471 --- /dev/null +++ b/db/.archive/224901/00-aclNotification.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Notification', '*', 'WRITE', 'ALLOW', 'ROLE', 'developer'); diff --git a/db/.archive/224901/00-packingSiteConfig.sql b/db/.archive/224901/00-packingSiteConfig.sql new file mode 100644 index 000000000..945b5a54c --- /dev/null +++ b/db/.archive/224901/00-packingSiteConfig.sql @@ -0,0 +1,12 @@ +CREATE TABLE `vn`.`packingSiteConfig` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `shinobiUrl` varchar(255) NOT NULL, + `shinobiToken` varchar(255) NOT NULL, + `shinobiGroupKey` varchar(255) NOT NULL, + `avgBoxingTime` INT(3) NULL, + PRIMARY KEY (`id`) + ); + +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Boxing', '*', '*', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/.archive/224901/00-packingSiteUpdate.sql b/db/.archive/224901/00-packingSiteUpdate.sql new file mode 100644 index 000000000..14313fd52 --- /dev/null +++ b/db/.archive/224901/00-packingSiteUpdate.sql @@ -0,0 +1,56 @@ +ALTER TABLE `vn`.`packingSite` ADD monitorId varchar(255) NULL; + +UPDATE `vn`.`packingSite` + SET monitorId = 'VbiUcajdaT' + WHERE code = 'h1'; +UPDATE `vn`.`packingSite` + SET monitorId = 'qKMPn9aaVe' + WHERE code = 'h2'; +UPDATE `vn`.`packingSite` + SET monitorId = '3CtdIAGPAv' + WHERE code = 'h3'; +UPDATE `vn`.`packingSite` + SET monitorId = 'Xme2hiqz1f' + WHERE code = 'h4'; +UPDATE `vn`.`packingSite` + SET monitorId = 'aulxefgfJU' + WHERE code = 'h5'; +UPDATE `vn`.`packingSite` + SET monitorId = '6Ou0D1bhBw' + WHERE code = 'h6'; +UPDATE `vn`.`packingSite` + SET monitorId = 'eVUvnE6pNw' + WHERE code = 'h7'; +UPDATE `vn`.`packingSite` + SET monitorId = '0wsmSvqmrs' + WHERE code = 'h8'; +UPDATE `vn`.`packingSite` + SET monitorId = 'r2l2RyyF4I' + WHERE code = 'h9'; +UPDATE `vn`.`packingSite` + SET monitorId = 'EdjHLIiDVD' + WHERE code = 'h10'; +UPDATE `vn`.`packingSite` + SET monitorId = 'czC45kmwqI' + WHERE code = 'h11'; +UPDATE `vn`.`packingSite` + SET monitorId = 'PNsmxPaCwQ' + WHERE code = 'h12'; +UPDATE `vn`.`packingSite` + SET monitorId = 'agVssO0FDC' + WHERE code = 'h13'; +UPDATE `vn`.`packingSite` + SET monitorId = 'f2SPNENHPo' + WHERE code = 'h14'; +UPDATE `vn`.`packingSite` + SET monitorId = '6UR7gUZxks' + WHERE code = 'h15'; +UPDATE `vn`.`packingSite` + SET monitorId = 'bOB0f8WZ2V' + WHERE code = 'h16'; +UPDATE `vn`.`packingSite` + SET monitorId = 'MIR1nXaL0n' + WHERE code = 'h17'; +UPDATE `vn`.`packingSite` + SET monitorId = '0Oj9SgGTXR' + WHERE code = 'h18'; diff --git a/db/.archive/224901/00-salix_url.sql b/db/.archive/224901/00-salix_url.sql new file mode 100644 index 000000000..ea5c3b606 --- /dev/null +++ b/db/.archive/224901/00-salix_url.sql @@ -0,0 +1,33 @@ +CREATE TABLE `salix`.`url` ( + `appName` varchar(100) NOT NULL, + `environment` varchar(100) NOT NULL, + `url` varchar(255) NOT NULL, + PRIMARY KEY (`appName`,`environment`) +); + +INSERT INTO `salix`.`url` (`appName`, `environment`, `url`) + VALUES + ('salix', 'production', 'https://salix.verdnatura.es/#!/'); +INSERT INTO `salix`.`url` (`appName`, `environment`, `url`) + VALUES + ('salix', 'test', 'https://test-salix.verdnatura.es/#!/'); +INSERT INTO `salix`.`url` (`appName`, `environment`, `url`) + VALUES + ('salix', 'dev', 'http://localhost:5000/#!/'); +INSERT INTO `salix`.`url` (`appName`, `environment`, `url`) + VALUES + ('lilium', 'production', 'https://lilium.verdnatura.es/#/'); +INSERT INTO `salix`.`url` (`appName`, `environment`, `url`) + VALUES + ('lilium', 'test', 'https://test-lilium.verdnatura.es/#/'); +INSERT INTO `salix`.`url` (`appName`, `environment`, `url`) + VALUES + ('lilium', 'dev', 'http://localhost:8080/#/'); + +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Url', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); + +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Url', '*', 'WRITE', 'ALLOW', 'ROLE', 'it'); diff --git a/db/.archive/224902/00-aclUserPassword.sql b/db/.archive/224902/00-aclUserPassword.sql new file mode 100644 index 000000000..b92b54c28 --- /dev/null +++ b/db/.archive/224902/00-aclUserPassword.sql @@ -0,0 +1,2 @@ +DELETE FROM `salix`.`ACL` + WHERE model = 'UserPassword'; diff --git a/db/.archive/224902/00-deletePickupContact.sql b/db/.archive/224902/00-deletePickupContact.sql new file mode 100644 index 000000000..6bfa662c5 --- /dev/null +++ b/db/.archive/224902/00-deletePickupContact.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`claimConfig` DROP COLUMN `pickupContact`; diff --git a/db/.archive/224902/00-itemShelvingACL.sql b/db/.archive/224902/00-itemShelvingACL.sql new file mode 100644 index 000000000..fc32fe1ed --- /dev/null +++ b/db/.archive/224902/00-itemShelvingACL.sql @@ -0,0 +1,4 @@ +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) +VALUES + ('ItemShelving', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('ItemShelving', '*', 'WRITE', 'ALLOW', 'ROLE', 'production'); \ No newline at end of file diff --git a/db/changes/10411-january/00-acl.sql b/db/.archive/224902/00-itemShelvingPlacementSupplyStockACL.sql similarity index 50% rename from db/changes/10411-january/00-acl.sql rename to db/.archive/224902/00-itemShelvingPlacementSupplyStockACL.sql index fad50d15d..25eac8d51 100644 --- a/db/changes/10411-january/00-acl.sql +++ b/db/.archive/224902/00-itemShelvingPlacementSupplyStockACL.sql @@ -1,2 +1,4 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) - VALUES('InvoiceInDueDay', '*', '*', 'ALLOW', 'ROLE', 'administrative'); \ No newline at end of file +VALUES + ('ItemShelvingPlacementSupplyStock', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); + diff --git a/db/.archive/224902/00-workerTimeControlMail.sql b/db/.archive/224902/00-workerTimeControlMail.sql new file mode 100644 index 000000000..e3d169a83 --- /dev/null +++ b/db/.archive/224902/00-workerTimeControlMail.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`workerTimeControlMail` CHANGE emailResponse reason text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL; \ No newline at end of file diff --git a/db/.archive/224902/00-zone_getPostalCode.sql b/db/.archive/224902/00-zone_getPostalCode.sql new file mode 100644 index 000000000..58a281cb2 --- /dev/null +++ b/db/.archive/224902/00-zone_getPostalCode.sql @@ -0,0 +1,54 @@ +DROP PROCEDURE IF EXISTS `vn`.`zone_getPostalCode`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getPostalCode`(vSelf INT) +BEGIN +/** + * Devuelve los códigos postales incluidos en una zona + */ + DECLARE vGeoFk INT DEFAULT NULL; + + 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 zoneNodesPk (zoneFk, geoFk), + INDEX(geoFk)) + ENGINE = MEMORY; + + CALL zone_getLeaves2(vSelf, NULL , NULL); + + UPDATE tmp.zoneNodes zn + SET isChecked = 0 + WHERE parentFk IS NULL; + + myLoop: LOOP + SET vGeoFk = NULL; + SELECT geoFk INTO vGeoFk + FROM tmp.zoneNodes zn + WHERE NOT isChecked + LIMIT 1; + + CALL zone_getLeaves2(vSelf, vGeoFk, NULL); + UPDATE tmp.zoneNodes + SET isChecked = TRUE + WHERE geoFk = vGeoFk; + + IF vGeoFk IS NULL THEN + LEAVE myLoop; + END IF; + END LOOP; + + DELETE FROM tmp.zoneNodes + WHERE sons > 0; + + SELECT zn.geoFk, zn.name + FROM tmp.zoneNodes zn + JOIN zone z ON z.id = zn.zoneFk; +END$$ +DELIMITER ; diff --git a/db/changes/10460-mother/04-acl.sql b/db/.archive/224903/00-ACL_notification_InvoiceE.sql similarity index 57% rename from db/changes/10460-mother/04-acl.sql rename to db/.archive/224903/00-ACL_notification_InvoiceE.sql index c1dc4f6ed..660efc41e 100644 --- a/db/changes/10460-mother/04-acl.sql +++ b/db/.archive/224903/00-ACL_notification_InvoiceE.sql @@ -1,2 +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 + VALUES ('NotificationQueue','*','*','ALLOW','ROLE','employee'); diff --git a/db/changes/10451-april/00-aclSupplierActivity.sql b/db/.archive/224903/00-aclInvoiceOut.sql similarity index 53% rename from db/changes/10451-april/00-aclSupplierActivity.sql rename to db/.archive/224903/00-aclInvoiceOut.sql index bf73a1506..7715045b5 100644 --- a/db/changes/10451-april/00-aclSupplierActivity.sql +++ b/db/.archive/224903/00-aclInvoiceOut.sql @@ -1,5 +1,7 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) -VALUES('SupplierActivity', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); + VALUES + ('InvoiceOut', 'clientsToInvoice', 'WRITE', 'ALLOW', 'ROLE', 'invoicing'); INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) -VALUES('SupplierActivity', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative'); + VALUES + ('InvoiceOut', 'invoiceClient', 'WRITE', 'ALLOW', 'ROLE', 'invoicing'); \ No newline at end of file diff --git a/db/.archive/224903/00-alter_expedition_itemFk.sql b/db/.archive/224903/00-alter_expedition_itemFk.sql new file mode 100644 index 000000000..d2849481b --- /dev/null +++ b/db/.archive/224903/00-alter_expedition_itemFk.sql @@ -0,0 +1 @@ +Alter table `vn`.`expedition` RENAME COLUMN itemFk TO itemFk__; \ No newline at end of file diff --git a/db/.archive/224903/00-clientHasInvoiceElectronic.sql b/db/.archive/224903/00-clientHasInvoiceElectronic.sql new file mode 100644 index 000000000..21f68c9ca --- /dev/null +++ b/db/.archive/224903/00-clientHasInvoiceElectronic.sql @@ -0,0 +1,8 @@ +ALTER TABLE + `vn`.`client` +ADD + COLUMN `hasElectronicInvoice` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'Registro de facturas mediante FACe' +AFTER + `hasInvoiceSimplified`; + +-- sería más correcto hasElectronicInvoice pero ya existe un campo hasInvoiceSimplified \ No newline at end of file diff --git a/db/.archive/224903/00-collection_missingTrash.sql b/db/.archive/224903/00-collection_missingTrash.sql new file mode 100644 index 000000000..d4467c699 --- /dev/null +++ b/db/.archive/224903/00-collection_missingTrash.sql @@ -0,0 +1 @@ +DROP PROCEDURE IF EXISTS `vn`.`collection_missingTrash`; diff --git a/db/.archive/224903/00-deleteInvoiceOutQueue.sql b/db/.archive/224903/00-deleteInvoiceOutQueue.sql new file mode 100644 index 000000000..87a3059a0 --- /dev/null +++ b/db/.archive/224903/00-deleteInvoiceOutQueue.sql @@ -0,0 +1 @@ +DROP TABLE `vn`.`invoiceOutQueue`; \ No newline at end of file diff --git a/db/.archive/224903/00-editTrackedACL.sql b/db/.archive/224903/00-editTrackedACL.sql new file mode 100644 index 000000000..e768fb7c7 --- /dev/null +++ b/db/.archive/224903/00-editTrackedACL.sql @@ -0,0 +1,4 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Sale', 'editTracked', 'WRITE', 'ALLOW', 'ROLE', 'production'), + ('Sale', 'editFloramondo', 'WRITE', 'ALLOW', 'ROLE', 'salesAssistant'); diff --git a/db/.archive/224903/00-greuge.sql b/db/.archive/224903/00-greuge.sql new file mode 100644 index 000000000..ec4bf3146 --- /dev/null +++ b/db/.archive/224903/00-greuge.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`greuge` CHANGE `userFK` `userFk` int(10) unsigned DEFAULT NULL NULL; \ No newline at end of file diff --git a/db/.archive/224903/00-isCompensationACL.sql b/db/.archive/224903/00-isCompensationACL.sql new file mode 100644 index 000000000..ac01758b0 --- /dev/null +++ b/db/.archive/224903/00-isCompensationACL.sql @@ -0,0 +1,4 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Receipt', 'balanceCompensationEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Receipt', 'balanceCompensationPdf', 'READ', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/.archive/224903/00-osTicketConfig.sql b/db/.archive/224903/00-osTicketConfig.sql new file mode 100644 index 000000000..10a58b6c8 --- /dev/null +++ b/db/.archive/224903/00-osTicketConfig.sql @@ -0,0 +1,8 @@ +ALTER TABLE `vn`.`osTicketConfig` DROP COLUMN `action`; +ALTER TABLE `vn`.`osTicketConfig` ADD responseType varchar(100) NULL; +ALTER TABLE `vn`.`osTicketConfig` ADD fromEmailId INT NULL; +ALTER TABLE `vn`.`osTicketConfig` ADD replyTo varchar(100) NULL; + +UPDATE `vn`.`osTicketConfig` + SET responseType='reply', fromEmailId=5, replyTo='all' +WHERE id=0; \ No newline at end of file diff --git a/db/.archive/224903/00-ticket_canMerge.sql b/db/.archive/224903/00-ticket_canMerge.sql new file mode 100644 index 000000000..843237b64 --- /dev/null +++ b/db/.archive/224903/00-ticket_canMerge.sql @@ -0,0 +1,14 @@ +DROP PROCEDURE IF EXISTS `vn`.`ticket_canMerge`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canMerge`(vDated DATE, vScopeDays INT, vLitersMax INT, vLinesMax INT, vWarehouseFk INT) +BEGIN + CALL vn.ticket_canbePostponed(vDated,TIMESTAMPADD(DAY, vScopeDays, vDated),vLitersMax,vLinesMax,vWarehouseFk); +END $$ +DELIMITER ; + +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) +VALUES + ('Ticket', 'getTicketsFuture', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Ticket', 'merge', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/.archive/224903/00-ticket_canbePostponed.sql b/db/.archive/224903/00-ticket_canbePostponed.sql new file mode 100644 index 000000000..c691fa4bd --- /dev/null +++ b/db/.archive/224903/00-ticket_canbePostponed.sql @@ -0,0 +1,79 @@ +DROP PROCEDURE IF EXISTS `vn`.`ticket_canbePostponed`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vLitersMax INT, vLinesMax INT, vWarehouseFk INT) +BEGIN +/** + * Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro + * + * @param vOriginDated Fecha en cuestión + * @param vFutureDated Fecha 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 + */ + DROP TEMPORARY TABLE IF EXISTS tmp.filter; + CREATE TEMPORARY TABLE tmp.filter + (INDEX (id)) + SELECT sv.ticketFk id, + 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, + t.landed originETD, + sub2.landed destETD, + sub2.iptd tfIpt, + sub2.state tfState, + t.clientFk, + t.warehouseFk, + ts.alertLevel, + t.shipped, + sub2.shipped tfShipped, + t.workerFk, + st.code code, + sub2.code tfCode + 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.landed, + t.shipped, + st.name state, + st.code code, + 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 vFutureDated + AND util.dayend(vFutureDated) + 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 vOriginDated AND util.dayend(vOriginDated) + AND t.warehouseFk = vWarehouseFk + AND al.code = 'FREE' + AND tp.ticketFk IS NULL + GROUP BY sv.ticketFk + HAVING liters <= IFNULL(vLitersMax, 9999) AND `lines` <= IFNULL(vLinesMax, 9999) AND ticketFuture; +END$$ +DELIMITER ; + diff --git a/db/.archive/224903/00-timeBusiness_calculate.sql b/db/.archive/224903/00-timeBusiness_calculate.sql new file mode 100644 index 000000000..ea13c4a8a --- /dev/null +++ b/db/.archive/224903/00-timeBusiness_calculate.sql @@ -0,0 +1,88 @@ +DROP PROCEDURE IF EXISTS `vn`.`timeBusiness_calculate`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`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 + (INDEX (departmentFk)) + 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, + name type, + permissionRate, + hoursWeek, + discountRate, + isAllowedToWork + FROM(SELECT t.dated, + b.id businessFk, + w.userFk, + b.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, + at2.name, + at2.permissionRate, + at2.discountRate, + cl.hours_week hoursWeek, + at2.isAllowedToWork + FROM time t + LEFT JOIN business b ON t.dated BETWEEN b.started AND IFNULL(b.ended, vDatedTo) + LEFT JOIN worker w ON w.id = b.workerFk + JOIN tmp.`user` u ON u.userFK = w.userFK + LEFT JOIN workCenter wc ON wc.id = b.workcenterFK + LEFT JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = b.calendarTypeFk + LEFT JOIN postgresql.journey j ON j.business_id = b.id AND j.day_id = WEEKDAY(t.dated) + 1 + LEFT JOIN postgresql.calendar_employee ce ON ce.businessFk = b.id AND ce.date = t.dated + LEFT JOIN absenceType at2 ON at2.id = ce.calendar_state_id + WHERE t.dated BETWEEN vDatedFrom AND vDatedTo + GROUP BY w.userFk, t.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 calendarHolidays ch ON ch.dated = t.dated + JOIN business b ON b.id = t.businessFk + AND b.workcenterFk = 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 ; diff --git a/db/.archive/224903/01-updateClientHasInvoiceElectronic.sql b/db/.archive/224903/01-updateClientHasInvoiceElectronic.sql new file mode 100644 index 000000000..af1c8ca9a --- /dev/null +++ b/db/.archive/224903/01-updateClientHasInvoiceElectronic.sql @@ -0,0 +1,6 @@ +UPDATE + `vn`.`client` +SET + hasElectronicInvoice = TRUE +WHERE + businessTypeFk = 'officialOrganism'; \ No newline at end of file diff --git a/db/.archive/225001/00-aclMdbApp.sql b/db/.archive/225001/00-aclMdbApp.sql new file mode 100644 index 000000000..b5b60546c --- /dev/null +++ b/db/.archive/225001/00-aclMdbApp.sql @@ -0,0 +1,4 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('MdbApp', 'lock', 'WRITE', 'ALLOW', 'ROLE', 'developer'), + ('MdbApp', 'unlock', 'WRITE', 'ALLOW', 'ROLE', 'developer'); diff --git a/db/.archive/225001/00-updateCollection.sql b/db/.archive/225001/00-updateCollection.sql new file mode 100644 index 000000000..6d4ec4307 --- /dev/null +++ b/db/.archive/225001/00-updateCollection.sql @@ -0,0 +1,3 @@ +UPDATE `vn`.`collection` + SET sectorFk=1 + WHERE id=1; diff --git a/db/.archive/225201/00-ACL_saveSign.sql b/db/.archive/225201/00-ACL_saveSign.sql new file mode 100644 index 000000000..16f9931c4 --- /dev/null +++ b/db/.archive/225201/00-ACL_saveSign.sql @@ -0,0 +1 @@ +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`) VALUES ('Dms','saveSign','*','ALLOW','employee'); diff --git a/db/.archive/225201/00-accountingMovements_add.sql b/db/.archive/225201/00-accountingMovements_add.sql new file mode 100644 index 000000000..12dc176bc --- /dev/null +++ b/db/.archive/225201/00-accountingMovements_add.sql @@ -0,0 +1,438 @@ +DROP PROCEDURE IF EXISTS `sage`.`accountingMovements_add`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `sage`.`accountingMovements_add`(vYear INT, vCompanyFk INT) +BEGIN +/** + * Traslada la info de contabilidad generada en base a vn.XDiario a la tabla sage.movConta para poder ejecutar posteriormente el proceso de importación de datos de SQL Server + * Solo traladará los asientos marcados con el campo vn.XDiario.enlazadoSage = FALSE + * @vYear Año contable del que se quiere trasladar la información + * @vCompanyFk Empresa de la que se quiere trasladar datos + */ + DECLARE vDatedFrom DATETIME; + DECLARE vDatedTo DATETIME; + DECLARE vDuaTransactionFk INT; + DECLARE vTaxImportFk INT; + DECLARE vTaxImportReducedFk INT; + DECLARE vTaxImportSuperReducedFk INT; + DECLARE vTransactionExportFk INT; + DECLARE vTransactionExportTaxFreeFk INT; + DECLARE vSerialDua VARCHAR(1) DEFAULT 'D'; + DECLARE vInvoiceTypeInformativeCode VARCHAR(1); + DECLARE vCountryCanariasCode, vCountryCeutaMelillaCode VARCHAR(2) ; + DECLARE vBookEntries TEXT; + + SELECT SiglaNacion INTO vCountryCanariasCode + FROM Naciones + WHERE Nacion ='ISLAS CANARIAS'; + + SELECT SiglaNacion INTO vCountryCeutaMelillaCode + FROM Naciones + WHERE Nacion ='CEUTA Y MELILLA'; + + SELECT CodigoTransaccion INTO vDuaTransactionFk + FROM TiposTransacciones + WHERE Transaccion = 'Import. bienes y serv. corrientes pdte. liquidar'; + + SELECT CodigoIva INTO vTaxImportFk + FROM TiposIva + WHERE Iva = 'IVA 21% importaciones'; + + SELECT CodigoIva INTO vTaxImportReducedFk + FROM TiposIva + WHERE Iva = 'IVA 10% importaciones'; + + SELECT CodigoIva INTO vTaxImportSuperReducedFk + FROM TiposIva + WHERE Iva = 'H.P. IVA Soportado Impor 4%'; + + SELECT CodigoTransaccion INTO vTransactionExportFk + FROM TiposTransacciones + WHERE Transaccion = 'Exportaciones definitivas'; + + SELECT CodigoTransaccion INTO vTransactionExportTaxFreeFk + FROM TiposTransacciones + WHERE Transaccion = 'Envíos definitivos a Canarias, Ceuta y Melilla'; + + SELECT codeSage INTO vInvoiceTypeInformativeCode + FROM invoiceType WHERE code ='informative'; + + SELECT CAST(CONCAT(vYear, '-01-01') AS DATETIME), util.dayEnd(CAST(CONCAT(vYear, '-12-31') AS DATE)) + INTO vDatedFrom, vDatedTo; + + TRUNCATE movContaIVA; + + DELETE FROM movConta + WHERE enlazadoSage = FALSE + AND Asiento <> 1 ; + + CALL clientSupplier_add(vCompanyFk); + CALL pgc_add(vCompanyFk); + CALL invoiceOut_manager(vYear, vCompanyFk); + CALL invoiceIn_manager(vYear, vCompanyFk); + + INSERT INTO movConta(TipoEntrada, + Ejercicio, + CodigoEmpresa, + Asiento, + CargoAbono, + CodigoCuenta, + Contrapartida, + FechaAsiento, + Comentario, + ImporteAsiento, + NumeroPeriodo, + FechaGrabacion, + CodigoDivisa, + ImporteCambio, + ImporteDivisa, + FactorCambio, + IdProcesoIME, + TipoCarteraIME, + TipoAnaliticaIME, + StatusTraspasadoIME, + TipoImportacionIME, + Metalico347, + BaseIva1, + PorBaseCorrectora1, + PorIva1, + CuotaIva1, + PorRecargoEquivalencia1, + RecargoEquivalencia1, + CodigoTransaccion1, + BaseIva2, + PorBaseCorrectora2, + PorIva2, + CuotaIva2, + PorRecargoEquivalencia2, + RecargoEquivalencia2, + CodigoTransaccion2, + BaseIva3, + PorBaseCorrectora3, + PorIva3, + CuotaIva3, + PorRecargoEquivalencia3, + RecargoEquivalencia3, + CodigoTransaccion3, + BaseIva4, + PorBaseCorrectora4, + PorIva4, + CuotaIva4, + PorRecargoEquivalencia4, + RecargoEquivalencia4, + CodigoTransaccion4, + Año, + Serie, + Factura, + SuFacturaNo, + FechaFactura, + ImporteFactura, + TipoFactura, + CodigoCuentaFactura, + CifDni, + Nombre, + CodigoRetencion, + BaseRetencion, + PorRetencion, + ImporteRetencion, + SiglaNacion, + EjercicioFactura, + FechaOperacion, + Exclusion347, + MantenerAsiento, + ClaveOperacionFactura_, + TipoRectificativa, + FechaFacturaOriginal, + BaseImponibleOriginal, + CuotaIvaOriginal, + ClaseAbonoRectificativas, + RecargoEquivalenciaOriginal, + LibreA1, + CodigoIva1, + CodigoIva2, + CodigoIva3, + CodigoIva4, + IvaDeducible1, + IvaDeducible2, + IvaDeducible3, + IvaDeducible4, + Intracomunitaria + ) + SELECT 'EN' TipoEntrada, + YEAR(x.FECHA) Ejercicio, + company_getCode(vCompanyFk) AS CodigoEmpresa, + x.ASIEN Asiento, + IF(EURODEBE <> 0 OR (EURODEBE = 0 AND EUROHABER IS NULL), 'D', 'H') CargoAbono, + x.SUBCTA CodigoCuenta, + x.CONTRA Contrapartida, + x.FECHA FechaAsiento, + x.CONCEPTO Comentario, + IF(x.EURODEBE, x.EURODEBE, x.EUROHABER) ImporteAsiento, + MONTH(x.FECHA) NumeroPeriodo, + IF(sub2.FECREGCON IS NULL, sub2.FECHA_EX, sub2.FECREGCON) FechaGrabacion, + IF(x.CAMBIO, IFNULL(mci.CodigoDivisa, sub3.code), '') CodigoDivisa, + x.CAMBIO ImporteCambio, + IFNULL(x.DEBEME, x.HABERME) ImporteDivisa, + IF(x.CAMBIO, TRUE, FALSE) FactorCambio, + NULL IdProcesoIME, + 0 TipoCarteraIME, + 0 TipoAnaliticaIME, + 0 StatusTraspasadoIME, + 0 TipoImportacionIME, + x.METAL Metalico347, + mci.BaseIva1, + mci.PorBaseCorrectora1, + mci.PorIva1, + mci.CuotaIva1, + mci.PorRecargoEquivalencia1, + mci.RecargoEquivalencia1, + mci.CodigoTransaccion1, + mci.BaseIva2, + mci.PorBaseCorrectora2, + mci.PorIva2, + mci.CuotaIva2, + mci.PorRecargoEquivalencia2, + mci.RecargoEquivalencia2, + mci.CodigoTransaccion2, + mci.BaseIva3, + mci.PorBaseCorrectora3, + mci.PorIva3, + mci.CuotaIva3, + mci.PorRecargoEquivalencia3, + mci.RecargoEquivalencia3, + mci.CodigoTransaccion3, + mci.BaseIva4, + mci.PorBaseCorrectora4, + mci.PorIva4, + mci.CuotaIva4, + mci.PorRecargoEquivalencia4, + mci.RecargoEquivalencia4, + mci.CodigoTransaccion4, + mci.Año, + mci.Serie, + mci.Factura, + mci.SuFacturaNo, + mci.FechaFactura, + mci.ImporteFactura, + mci.TipoFactura, + mci.CodigoCuentaFactura, + mci.CifDni, + mci.Nombre, + mci.CodigoRetencion, + mci.BaseRetencion, + mci.PorRetencion, + mci.ImporteRetencion, + mci.SiglaNacion, + mci.EjercicioFactura, + mci.FechaOperacion, + mci.Exclusion347, + TRUE, + mci.ClaveOperacionFactura, + mci.TipoRectificativa, + mci.FechaFacturaOriginal, + mci.BaseImponibleOriginal, + mci.CuotaIvaOriginal, + mci.ClaseAbonoRectificativas, + mci.RecargoEquivalenciaOriginal, + mci.LibreA1, + mci.CodigoIva1, + mci.CodigoIva2, + mci.CodigoIva3, + mci.CodigoIva4, + mci.IvaDeducible1, + mci.IvaDeducible2, + mci.IvaDeducible3, + mci.IvaDeducible4, + mci.Intracomunitaria + FROM vn.XDiario x + LEFT JOIN movContaIVA mci ON mci.id = x.id + LEFT JOIN (SELECT * + FROM (SELECT DISTINCT ASIEN, FECREGCON, FECHA_EX + FROM vn.XDiario + WHERE enlazadoSage = FALSE + ORDER BY ASIEN, FECREGCON DESC, FECHA_EX DESC + LIMIT 10000000000000000000 + ) sub GROUP BY ASIEN + )sub2 ON sub2.ASIEN = x.ASIEN + LEFT JOIN ( SELECT DISTINCT(account),cu.code + FROM vn.bank b + JOIN vn.currency cu ON cu.id = b.currencyFk + WHERE cu.code <> 'EUR' -- no se informa cuando la divisa en EUR + )sub3 ON sub3.account = x.SUBCTA + WHERE x.enlazadoSage = FALSE + AND x.empresa_id = vCompanyFk + AND x.FECHA BETWEEN vDatedFrom AND vDatedTo; + +-- Metálicos + UPDATE movConta m + JOIN (SELECT Asiento, + c.socialName name, + c.fi, + n.SiglaNacion, + m.CodigoCuenta, + m.Contrapartida + FROM movConta m + LEFT JOIN vn.client c ON c.id = IF(m.CargoAbono = 'H', + CAST(SUBSTRING(m.CodigoCuenta, 3, LENGTH(m.CodigoCuenta)) AS UNSIGNED), + CAST(SUBSTRING(m.Contrapartida, 3, LENGTH(m.Contrapartida)) AS UNSIGNED)) + LEFT JOIN Naciones n ON n.countryFk = c.countryFk + WHERE m.Metalico347 = TRUE + AND m.enlazadoSage = FALSE + )sub ON m.Asiento = sub.Asiento + SET m.Metalico347 = TRUE, + m.TipoFactura = vInvoiceTypeInformativeCode, + m.CifDni = sub.fi, + m.Nombre = sub.name, + m.SiglaNacion = sub.SiglaNacion + WHERE m.enlazadoSage = FALSE; + + UPDATE movConta m + SET m.Metalico347 = FALSE, + m.TipoFactura = '' + WHERE m.CargoAbono = 'D' + AND m.enlazadoSage = FALSE; + +-- Elimina cuentas de cliente/proveedor que no se utilizarán en la importación + DELETE cp + FROM clientesProveedores cp + LEFT JOIN movConta mc ON mc.codigoCuenta = cp.codigoCuenta + AND mc.enlazadoSage = FALSE + WHERE mc.codigoCuenta IS NULL; + +-- Elimina cuentas contables que no se utilizarán en la importación + DELETE pc + FROM planCuentasPGC pc + LEFT JOIN movConta mc ON mc.codigoCuenta = pc.codigoCuenta + AND mc.enlazadoSage = FALSE + WHERE mc.codigoCuenta IS NULL; + +-- DUAS + UPDATE movConta mci + JOIN vn.XDiario x ON x.ASIEN = mci.Asiento + JOIN TiposIva ti ON ti.CodigoIva = x.IVA + JOIN vn.pgcMaster pm ON pm.code = mci.CodigoCuenta COLLATE utf8mb3_unicode_ci + SET mci.BaseIva1 = x.BASEEURO, + mci.PorIva1 = x.IVA, + mci.CuotaIva1 = CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)), + mci.CodigoTransaccion1 = vDuaTransactionFk, + mci.CodigoIva1 = vTaxImportReducedFk, + mci.IvaDeducible1 = TRUE, + mci.FechaFacturaOriginal = x.FECHA_EX, + mci.SuFacturaNo = x.FACTURAEX, + mci.FechaOperacion = x.FECHA_OP, + mci.ImporteFactura = mci.ImporteFactura + x.BASEEURO + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) + WHERE pm.description = 'HP Iva pendiente' + AND mci.enlazadoSage = FALSE + AND x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci + AND ti.Iva = 'I.V.A. 10% Nacional'; + + UPDATE movConta mci + JOIN vn.XDiario x ON x.ASIEN = mci.Asiento + JOIN TiposIva ti ON ti.CodigoIva = x.IVA + JOIN vn.pgcMaster pm ON pm.code = mci.CodigoCuenta COLLATE utf8mb3_unicode_ci + SET mci.BaseIva2 = x.BASEEURO , + mci.PorIva2 = x.IVA, + mci.CuotaIva2 = CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10,2)), + mci.CodigoTransaccion2 = vDuaTransactionFk , + mci.CodigoIva2 = vTaxImportFk, + mci.IvaDeducible2 = TRUE, + mci.ImporteFactura = mci.ImporteFactura + x.BASEEURO + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) + WHERE pm.description = 'HP Iva pendiente' + AND mci.enlazadoSage = FALSE + AND x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci + AND ti.Iva = 'I.V.A. 21%'; + + UPDATE movConta mci + JOIN vn.XDiario x ON x.ASIEN = mci.Asiento + JOIN TiposIva ti ON ti.CodigoIva = x.IVA + JOIN vn.pgcMaster pm ON pm.code = mci.CodigoCuenta COLLATE utf8mb3_unicode_ci + SET mci.BaseIva3 = x.BASEEURO , + mci.PorIva3 = x.IVA, + mci.CuotaIva3 = CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10,2)), + mci.CodigoTransaccion3 = vDuaTransactionFk , + mci.CodigoIva3 = vTaxImportSuperReducedFk, + mci.IvaDeducible3 = TRUE, + mci.ImporteFactura = mci.ImporteFactura + x.BASEEURO + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) + WHERE pm.description = 'HP Iva pendiente' + AND mci.enlazadoSage = FALSE + AND x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci + AND ti.Iva = 'I.V.A. 4%'; + +-- Rectificativas + UPDATE movConta mci + JOIN (SELECT x.ASIEN, x.FECHA_RT, x.SERIE_RT, x.FACTU_RT + FROM movConta mci + JOIN vn.XDiario x ON x.ASIEN = mci.Asiento + WHERE mci.TipoRectificativa > 0 + AND mci.enlazadoSage = FALSE + AND x.FACTU_RT IS NOT NULL + GROUP BY x.ASIEN + ) sub ON sub.ASIEN = mci.Asiento + SET mci.EjercicioFacturaOriginal = YEAR(sub.FECHA_RT), + mci.SerieFacturaOriginal = sub.SERIE_RT, + mci.NumeroFacturaOriginal = sub.FACTU_RT + WHERE mci.TipoRectificativa > 0 AND + mci.enlazadoSage = FALSE ; + +-- Exportaciones Andorras y Canarias cambia TT (la cuenta es compartida) + UPDATE movConta mci + SET CodigoTransaccion1 = vTransactionExportTaxFreeFk, + CodigoTransaccion2 = IF(CodigoTransaccion2 = 0, 0, vTransactionExportTaxFreeFk), + CodigoTransaccion3 = IF(CodigoTransaccion3 = 0, 0, vTransactionExportTaxFreeFk), + CodigoTransaccion4 = IF(CodigoTransaccion4 = 0, 0, vTransactionExportTaxFreeFk) + WHERE enlazadoSage = FALSE + AND (CodigoTransaccion1 = vTransactionExportFk + OR CodigoTransaccion2 = vTransactionExportFk + OR CodigoTransaccion3 = vTransactionExportFk + OR CodigoTransaccion4 = vTransactionExportFk) + AND SiglaNacion IN (vCountryCanariasCode COLLATE utf8mb3_unicode_ci, vCountryCeutaMelillaCode COLLATE utf8mb3_unicode_ci); + + UPDATE movConta mc + SET CodigoDivisa = 'USD', + FactorCambio = TRUE, + ImporteCambio = ABS( CAST( IF( ImporteDivisa <> 0 AND ImporteCambio = 0, ImporteAsiento / ImporteDivisa, ImporteCambio) AS DECIMAL( 10, 2))) + WHERE enlazadoSage = FALSE + AND (ImporteCambio <> 0 OR ImporteDivisa <> 0 OR FactorCambio); + + UPDATE movConta mc + SET importeDivisa= -importeDivisa + WHERE enlazadoSage = FALSE + AND importeDivisa > 0 + AND ImporteAsiento < 0; + + -- Comprobación que los importes e ivas sean correctos, avisa vía CAU + SELECT GROUP_CONCAT(Asiento ORDER BY Asiento ASC SEPARATOR ',') INTO vBookEntries + FROM(SELECT sub.Asiento + FROM (SELECT mc.Asiento, SUM(mc.ImporteAsiento) amount + FROM movConta mc + WHERE mc.enlazadoSage = FALSE + GROUP BY mc.Asiento)sub + JOIN (SELECT x.ASIEN, SUM(IFNULL(x.EURODEBE,0) + IFNULL(x.EUROHABER,0)) amount + FROM vn.XDiario x + WHERE x.enlazadoSage = FALSE + GROUP BY ASIEN)sub2 ON sub2.ASIEN = sub.Asiento + WHERE sub.amount <> sub2.amount + UNION ALL + SELECT sub.Asiento + FROM (SELECT Asiento, SUM(BaseIva1 + BaseIva2 + BaseIva3 + BaseIva4) amountTaxableBase + FROM movConta + WHERE TipoFactura <> 'I' + AND enlazadoSage = FALSE + GROUP BY Asiento) sub + JOIN (SELECT ASIEN, SUM(BASEEURO) amountTaxableBase + FROM (SELECT ASIEN, SUM(BASEEURO) BASEEURO + FROM vn.XDiario + WHERE FACTURA + AND auxiliar <> '*' + AND enlazadoSage = FALSE + GROUP BY FACTURA, ASIEN)sub3 + GROUP BY ASIEN) sub2 ON sub2.ASIEN = sub.Asiento + WHERE sub.amountTaxableBase<>sub2.amountTaxableBase + AND sub.amountTaxableBase/2 <> sub2.amountTaxableBase) sub; + + IF vBookEntries IS NOT NULL THEN + SELECT util.notification_send ("book-entries-imported-incorrectly", CONCAT('{"bookEntries":"', vBookEntries,'"}'), null); + END IF; +END$$ +DELIMITER ; diff --git a/db/.archive/225201/00-aclTicketLog.sql b/db/.archive/225201/00-aclTicketLog.sql new file mode 100644 index 000000000..edba17ab4 --- /dev/null +++ b/db/.archive/225201/00-aclTicketLog.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('TicketLog', 'getChanges', 'READ', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/.archive/225201/00-entryDeleteRef.sql b/db/.archive/225201/00-entryDeleteRef.sql new file mode 100644 index 000000000..7e47eae63 --- /dev/null +++ b/db/.archive/225201/00-entryDeleteRef.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`entry` DROP COLUMN `ref`; diff --git a/db/.archive/225201/00-invoiceInConfig.sql b/db/.archive/225201/00-invoiceInConfig.sql new file mode 100644 index 000000000..a27b59440 --- /dev/null +++ b/db/.archive/225201/00-invoiceInConfig.sql @@ -0,0 +1,12 @@ +CREATE TABLE `vn`.`invoiceInConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `retentionRate` int(3) NOT NULL, + `retentionName` varchar(25) NOT NULL, + `sageWithholdingFk` smallint(6) NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `invoiceInConfig_sageWithholdingFk` FOREIGN KEY (`sageWithholdingFk`) REFERENCES `sage`.`TiposRetencion`(`CodigoRetencion`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + +INSERT INTO `vn`.`invoiceInConfig` (`id`, `retentionRate`, `retentionName`, `sageWithholdingFk`) + VALUES + (1, -2, 'Retención 2%', 2); diff --git a/db/.archive/225201/00-invoiceOut_new.sql b/db/.archive/225201/00-invoiceOut_new.sql new file mode 100644 index 000000000..10a42d40d --- /dev/null +++ b/db/.archive/225201/00-invoiceOut_new.sql @@ -0,0 +1,225 @@ +DROP PROCEDURE IF EXISTS `vn`.`invoiceOut_new`; +DELIMITER $$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`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 sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN supplier su ON su.id = t.companyFk + JOIN client c ON c.id = t.clientFk + LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = su.countryFk + WHERE YEAR(t.shipped) < 2001 + OR c.isTaxDataChecked = FALSE + OR t.isDeleted + OR c.hasToInvoice = FALSE + OR itc.id IS NULL; + + 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 ticketState ts ON ti.id = ts.ticket + JOIN state s + WHERE IFNULL(ts.alertLevel,0) < 3 and s.`code` = 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.myUser_getId(), 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.invoiceOut io ON io.`ref` = t.refFk + JOIN vn.invoiceOutSerial ios ON ios.code = io.serial + WHERE t.refFk = vNewRef + LIMIT 1; + + 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 invoiceInDueDay_calculate(vNewInvoiceInId); + + INSERT INTO invoiceInIntrastat ( + invoiceInFk, + intrastatFk, + amount, + stems, + countryFk, + net) + SELECT + vNewInvoiceInId invoiceInFk, + i.intrastatFk, + CAST(SUM((s.quantity * s.price * (100 - s.discount) / 100 )) AS DECIMAL(10,2)) subtotal, + CAST(SUM(IFNULL(i.stems, 1) * s.quantity) AS DECIMAL(10,2)) stems, + su.countryFk, + CAST(SUM(IFNULL(i.stems, 1) + * s.quantity + * IF(ic.grams, ic.grams, i.weightByPiece) / 1000) AS DECIMAL(10,2)) netKg + FROM sale s + JOIN ticket t ON s.ticketFk = t.id + JOIN supplier su ON su.id = t.companyFk + JOIN item i ON i.id = s.itemFk + JOIN vn.itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk + JOIN intrastat ir ON ir.id = i.intrastatFk + WHERE t.refFk = vNewRef; + + 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 ; diff --git a/db/.archive/225201/00-mdbApp.sql b/db/.archive/225201/00-mdbApp.sql new file mode 100644 index 000000000..3202e3f08 --- /dev/null +++ b/db/.archive/225201/00-mdbApp.sql @@ -0,0 +1,11 @@ +CREATE TABLE `vn`.`mdbApp` ( + `app` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL, + `baselineBranchFk` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + `locked` datetime DEFAULT NULL, + PRIMARY KEY (`app`), + KEY `mdbApp_FK` (`userFk`), + KEY `mdbApp_FK_1` (`baselineBranchFk`), + CONSTRAINT `mdbApp_FK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `mdbApp_FK_1` FOREIGN KEY (`baselineBranchFk`) REFERENCES `mdbBranch` (`name`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci diff --git a/db/.archive/225201/00-notification_send.sql b/db/.archive/225201/00-notification_send.sql new file mode 100644 index 000000000..a422cebac --- /dev/null +++ b/db/.archive/225201/00-notification_send.sql @@ -0,0 +1,24 @@ +DROP FUNCTION IF EXISTS `util`.`notification_send`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` FUNCTION `util`.`notification_send`(vNotificationName VARCHAR(255), vParams TEXT, vAuthorFk INT) RETURNS int(11) + MODIFIES SQL DATA +BEGIN +/** + * Sends a notification. + * + * @param vNotificationName The notification name + * @param vParams The notification parameters formatted as JSON + * @param vAuthorFk The notification author or %NULL if there is no author + * @return The notification id + */ + + INSERT INTO notificationQueue + SET notificationFk = vNotificationName, + params = vParams, + authorFk = vAuthorFk; + + RETURN LAST_INSERT_ID(); +END$$ +DELIMITER ; diff --git a/db/.archive/225201/00-supplier_beforeUpdate.sql b/db/.archive/225201/00-supplier_beforeUpdate.sql new file mode 100644 index 000000000..08af8666b --- /dev/null +++ b/db/.archive/225201/00-supplier_beforeUpdate.sql @@ -0,0 +1,46 @@ +DROP TRIGGER IF EXISTS `vn`.`supplier_beforeUpdate`; +USE `vn`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplier_beforeUpdate` + BEFORE UPDATE ON `supplier` + FOR EACH ROW +BEGIN + DECLARE vHasChange BOOL; + DECLARE vPayMethodChanged BOOL; + DECLARE vPayMethodHasVerified BOOL; + DECLARE vParams JSON; + DECLARE vOldPayMethodName VARCHAR(20); + DECLARE vNewPayMethodName VARCHAR(20); + + SELECT hasVerified INTO vPayMethodHasVerified + FROM payMethod + WHERE id = NEW.payMethodFk; + + SET vPayMethodChanged = NOT(NEW.payMethodFk <=> OLD.payMethodFk); + + IF vPayMethodChanged THEN + SELECT name INTO vOldPayMethodName + FROM payMethod + WHERE id = OLD.payMethodFk; + SELECT name INTO vNewPayMethodName + FROM payMethod + WHERE id = NEW.payMethodFk; + + SET vParams = JSON_OBJECT( + 'name', NEW.name, + 'oldPayMethod', vOldPayMethodName, + 'newPayMethod', vNewPayMethodName + ); + SELECT util.notification_send('supplier-pay-method-update', vParams, NULL) INTO @id; + END IF; + + SET vHasChange = NOT(NEW.payDemFk <=> OLD.payDemFk AND NEW.payDay <=> OLD.payDay) OR vPayMethodChanged; + + IF vHasChange AND vPayMethodHasVerified THEN + SET NEW.isPayMethodChecked = FALSE; + END IF; + +END$$ +DELIMITER ; diff --git a/db/.archive/225201/00-ticketSms.sql b/db/.archive/225201/00-ticketSms.sql new file mode 100644 index 000000000..f454f99b1 --- /dev/null +++ b/db/.archive/225201/00-ticketSms.sql @@ -0,0 +1,8 @@ +CREATE TABLE `vn`.`ticketSms` ( + `smsFk` mediumint(8) unsigned NOT NULL, + `ticketFk` int(11) DEFAULT NULL, + PRIMARY KEY (`smsFk`), + KEY `ticketSms_FK_1` (`ticketFk`), + CONSTRAINT `ticketSms_FK` FOREIGN KEY (`smsFk`) REFERENCES `sms` (`id`) ON UPDATE CASCADE, + CONSTRAINT `ticketSms_FK_1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci diff --git a/db/.archive/225201/00-ticket_canAdvance.sql b/db/.archive/225201/00-ticket_canAdvance.sql new file mode 100644 index 000000000..acc4dcc4a --- /dev/null +++ b/db/.archive/225201/00-ticket_canAdvance.sql @@ -0,0 +1,104 @@ +DROP PROCEDURE IF EXISTS `vn`.`ticket_canAdvance`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT) +BEGIN +/** + * Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar. + * + * @param vDateFuture Fecha de los tickets que se quieren adelantar. + * @param vDateToAdvance Fecha a cuando se quiere adelantar. + * @param vWarehouseFk Almacén + */ + + DECLARE vDateInventory DATE; + + SELECT inventoried INTO vDateInventory FROM vn.config; + + 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 < vDateFuture + AND warehouseFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM vn.itemEntryIn + WHERE landed >= vDateInventory + AND landed < vDateFuture + AND isVirtualStock = FALSE + AND warehouseInFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM vn.itemEntryOut + WHERE shipped >= vDateInventory + AND shipped < vDateFuture + AND warehouseOutFk = vWarehouseFk + ) t + GROUP BY itemFk HAVING amount != 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.filter; + CREATE TEMPORARY TABLE tmp.filter + (INDEX (id)) + SELECT s.ticketFk futureId, + t2.ticketFk id, + sum((s.quantity <= IFNULL(st.amount,0))) hasStock, + count(DISTINCT s.id) saleCount, + t2.state, + t2.stateCode, + st.name futureState, + st.code futureStateCode, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt, + t2.ipt, + t.workerFk, + CAST(sum(litros) AS DECIMAL(10,0)) liters, + CAST(count(*) AS DECIMAL(10,0)) `lines`, + t2.shipped, + t.shipped futureShipped, + t2.totalWithVat, + t.totalWithVat futureTotalWithVat + FROM vn.ticket t + JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.state st ON st.id = ts.stateFk + JOIN vn.saleVolume sv ON t.id = sv.ticketFk + JOIN (SELECT + t2.id ticketFk, + t2.addressFk, + st.name state, + st.code stateCode, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt, + t2.shipped, + t2.totalWithVat + 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 + LEFT JOIN vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + 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 vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + LEFT JOIN tmp.stock st ON st.itemFk = s.itemFk + WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture) + AND t.warehouseFk = vWarehouseFk + GROUP BY t.id; + + DROP TEMPORARY TABLE tmp.stock; +END$$ +DELIMITER ; + +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) +VALUES + ('Ticket', 'getTicketsAdvance', 'READ', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/.archive/225201/00-ticket_canbePostponed.sql b/db/.archive/225201/00-ticket_canbePostponed.sql new file mode 100644 index 000000000..572824b4b --- /dev/null +++ b/db/.archive/225201/00-ticket_canbePostponed.sql @@ -0,0 +1,73 @@ +DROP PROCEDURE IF EXISTS `vn`.`ticket_canbePostponed`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vWarehouseFk INT) +BEGIN +/** + * Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro + * + * @param vOriginDated Fecha en cuestión + * @param vFutureDated Fecha en el futuro a sondear + * @param vWarehouseFk Identificador de vn.warehouse + */ + DROP TEMPORARY TABLE IF EXISTS tmp.filter; + CREATE TEMPORARY TABLE tmp.filter + (INDEX (id)) + SELECT sv.ticketFk id, + sub2.id futureId, + 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.iptd futureIpt, + sub2.state futureState, + t.clientFk, + t.warehouseFk, + ts.alertLevel, + t.shipped, + sub2.shipped futureShipped, + t.workerFk, + st.code stateCode, + sub2.code futureStateCode + 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, + st.code code, + 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 vFutureDated + AND util.dayend(vFutureDated) + 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 vOriginDated AND util.dayend(vOriginDated) + AND t.warehouseFk = vWarehouseFk + AND al.code = 'FREE' + AND tp.ticketFk IS NULL + GROUP BY sv.ticketFk + HAVING futureId; +END$$ +DELIMITER ; diff --git a/db/.archive/225201/00-ticket_split_merge.sql b/db/.archive/225201/00-ticket_split_merge.sql new file mode 100644 index 000000000..a1a6579e6 --- /dev/null +++ b/db/.archive/225201/00-ticket_split_merge.sql @@ -0,0 +1,2 @@ +DROP PROCEDURE IF EXISTS `ticket_split`; +DROP PROCEDURE IF EXISTS `ticket_merge`; diff --git a/db/.archive/225201/00-utilNotification.sql b/db/.archive/225201/00-utilNotification.sql new file mode 100644 index 000000000..74f0de5e2 --- /dev/null +++ b/db/.archive/225201/00-utilNotification.sql @@ -0,0 +1,4 @@ +INSERT INTO `util`.`notification` (id, name, description) VALUES(3, 'book-entries-imported-incorrectly', 'accounting entries exported incorrectly'); +INSERT INTO `util`.`notificationAcl` (notificationFk, roleFk) VALUES(3, 5); +INSERT IGNORE INTO `util`.`notificationSubscription` (notificationFk, userFk) VALUES(3, 19663); + diff --git a/db/.archive/225201/01-create_stateI18n.sql b/db/.archive/225201/01-create_stateI18n.sql new file mode 100644 index 000000000..799360b1e --- /dev/null +++ b/db/.archive/225201/01-create_stateI18n.sql @@ -0,0 +1,7 @@ +CREATE TABLE `vn`.`stateI18n` ( + `stateFk` tinyint(3) unsigned NOT NULL, + `lang` char(2) NOT NULL, + `name` varchar(255) NOT NULL, + PRIMARY KEY (`stateFk`, `lang`), + CONSTRAINT `stateI18n_state_id` FOREIGN KEY (`stateFk`) REFERENCES `vn`.`state` (`id`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8; diff --git a/db/.archive/225201/01-modules.sql b/db/.archive/225201/01-modules.sql new file mode 100644 index 000000000..243d2d016 --- /dev/null +++ b/db/.archive/225201/01-modules.sql @@ -0,0 +1,60 @@ +UPDATE salix.module t +SET t.code = 'supplier' +WHERE t.code LIKE 'Suppliers' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'travel' +WHERE t.code LIKE 'Travels' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'ticket' +WHERE t.code LIKE 'Tickets' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'zone' +WHERE t.code LIKE 'Zones' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'monitor' +WHERE t.code LIKE 'Monitors' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'entry' +WHERE t.code LIKE 'Entries' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'invoiceIn' +WHERE t.code LIKE 'Invoices in' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'customer' +WHERE t.code LIKE 'Clients' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'route' +WHERE t.code LIKE 'Routes' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'item' +WHERE t.code LIKE 'Items' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'claim' +WHERE t.code LIKE 'Claims' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'account' +WHERE t.code LIKE 'Users' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'invoiceOut' +WHERE t.code LIKE 'Invoices out' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'order' +WHERE t.code LIKE 'Orders' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'worker' +WHERE t.code LIKE 'Workers' ESCAPE '#'; + diff --git a/db/.archive/225201/02-insert_stateI18n.sql b/db/.archive/225201/02-insert_stateI18n.sql new file mode 100644 index 000000000..7df36d662 --- /dev/null +++ b/db/.archive/225201/02-insert_stateI18n.sql @@ -0,0 +1,73 @@ +INSERT INTO + `vn`.`stateI18n` (`stateFk`, `lang`, `name`) +VALUES + (1, 'en', 'Fix'), + (1, 'es', 'Arreglar'), + (2, 'en', 'Free'), + (2, 'es', 'Libre'), + (3, 'en', 'OK'), + (3, 'es', 'OK'), + (4, 'en', 'Printed'), + (4, 'es', 'Impreso'), + (5, 'en', 'Preparation'), + (5, 'es', 'Preparación'), + (6, 'en', 'In Review'), + (6, 'es', 'En Revisión'), + (7, 'en', 'Unfinished'), + (7, 'es', 'Sin Acabar'), + (8, 'en', 'Reviewed'), + (8, 'es', 'Revisado'), + (9, 'en', 'Fitting'), + (9, 'es', 'Encajando'), + (10, 'en', 'Fitted'), + (10, 'es', 'Encajado'), + (11, 'en', 'Billed'), + (11, 'es', 'Facturado'), + (12, 'en', 'Blocked'), + (12, 'es', 'Bloqueado'), + (13, 'en', 'In Delivery'), + (13, 'es', 'En Reparto'), + (14, 'en', 'Prepared'), + (14, 'es', 'Preparado'), + (15, 'en', 'Pending Collection'), + (15, 'es', 'Pendiente de Recogida'), + (16, 'en', 'Delivered'), + (16, 'es', 'Entregado'), + (20, 'en', 'Assigned'), + (20, 'es', 'Asignado'), + (21, 'en', 'Returned'), + (21, 'es', 'Retornado'), + (22, 'en', 'Pending to extend'), + (22, 'es', 'Pendiente ampliar'), + (23, 'en', 'URGENT'), + (23, 'es', 'URGENTE'), + (24, 'en', 'Chained'), + (24, 'es', 'Encadenado'), + (25, 'en', 'Shipping'), + (25, 'es', 'Embarcando'), + (26, 'en', 'Preparation'), + (26, 'es', 'Preparación previa'), + (27, 'en', 'Assisted preparation'), + (27, 'es', 'Preparación asistida'), + (28, 'en', 'Preparation OK'), + (28, 'es', 'Previa OK'), + (29, 'en', 'Preparation Printed'), + (29, 'es', 'Previa Impreso'), + (30, 'en', 'Shipped'), + (30, 'es', 'Embarcado'), + (31, 'en', 'Stowaway printed'), + (31, 'es', 'Polizón Impreso'), + (32, 'en', 'Stowaway OK'), + (32, 'es', 'Polizón OK'), + (33, 'en', 'Auto_Printed'), + (33, 'es', 'Auto_Impreso'), + (34, 'en', 'Pending payment'), + (34, 'es', 'Pendiente de pago'), + (35, 'en', 'Half-Embedded'), + (35, 'es', 'Semi-Encajado'), + (36, 'en', 'Preparation Reviewing'), + (36, 'es', 'Previa Revisando'), + (37, 'en', 'Preparation Reviewed'), + (37, 'es', 'Previa Revisado'), + (38, 'en', 'Preparation Chamber'), + (38, 'es', 'Preparación Cámara'); \ No newline at end of file diff --git a/db/.archive/225201/02-starredModule.sql b/db/.archive/225201/02-starredModule.sql new file mode 100644 index 000000000..3ca67fce4 --- /dev/null +++ b/db/.archive/225201/02-starredModule.sql @@ -0,0 +1,16 @@ +UPDATE `vn`.starredModule SET moduleFk = 'customer' WHERE moduleFk = 'Clients'; +UPDATE `vn`.starredModule SET moduleFk = 'ticket' WHERE moduleFk = 'Tickets'; +UPDATE `vn`.starredModule SET moduleFk = 'route' WHERE moduleFk = 'Routes'; +UPDATE `vn`.starredModule SET moduleFk = 'zone' WHERE moduleFk = 'Zones'; +UPDATE `vn`.starredModule SET moduleFk = 'order' WHERE moduleFk = 'Orders'; +UPDATE `vn`.starredModule SET moduleFk = 'claim' WHERE moduleFk = 'Claims'; +UPDATE `vn`.starredModule SET moduleFk = 'item' WHERE moduleFk = 'Items'; +UPDATE `vn`.starredModule SET moduleFk = 'worker' WHERE moduleFk = 'Workers'; +UPDATE `vn`.starredModule SET moduleFk = 'entry' WHERE moduleFk = 'Entries'; +UPDATE `vn`.starredModule SET moduleFk = 'invoiceOut' WHERE moduleFk = 'Invoices out'; +UPDATE `vn`.starredModule SET moduleFk = 'invoiceIn' WHERE moduleFk = 'Invoices in'; +UPDATE `vn`.starredModule SET moduleFk = 'monitor' WHERE moduleFk = 'Monitors'; +UPDATE `vn`.starredModule SET moduleFk = 'user' WHERE moduleFk = 'Users'; +UPDATE `vn`.starredModule SET moduleFk = 'supplier' WHERE moduleFk = 'Suppliers'; +UPDATE `vn`.starredModule SET moduleFk = 'travel' WHERE moduleFk = 'Travels'; +UPDATE `vn`.starredModule SET moduleFk = 'shelving' WHERE moduleFk = 'Shelvings'; \ No newline at end of file diff --git a/db/.archive/225202/00-mdbApp.sql b/db/.archive/225202/00-mdbApp.sql new file mode 100644 index 000000000..50c595d71 --- /dev/null +++ b/db/.archive/225202/00-mdbApp.sql @@ -0,0 +1,28 @@ +ALTER TABLE `vn`.`mdbApp` DROP PRIMARY KEY; +ALTER TABLE `vn`.`mdbApp` ADD CONSTRAINT mdbApp_PK PRIMARY KEY (app,baselineBranchFk); + +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('com','master'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('enc','master'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('ent','master'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('eti','master'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('lab','master'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('tpv','master'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('com','dev'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('enc','dev'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('ent','dev'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('eti','dev'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('lab','dev'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('tpv','dev'); + diff --git a/db/.archive/225203/00-mdbApp.sql b/db/.archive/225203/00-mdbApp.sql new file mode 100644 index 000000000..32a21eb6b --- /dev/null +++ b/db/.archive/225203/00-mdbApp.sql @@ -0,0 +1,5 @@ +UPDATE `vn`.`osTicketConfig` +SET oldStatus='1,6' +WHERE id=0; + + diff --git a/db/.archive/230201/00-ACL_ItemShelvingSale.sql b/db/.archive/230201/00-ACL_ItemShelvingSale.sql new file mode 100644 index 000000000..38b65f89a --- /dev/null +++ b/db/.archive/230201/00-ACL_ItemShelvingSale.sql @@ -0,0 +1,2 @@ +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`) + VALUES ('ItemShelvingSale','*','*','ALLOW','employee'); diff --git a/db/.archive/230201/00-SupplierUniqueKey.sql b/db/.archive/230201/00-SupplierUniqueKey.sql new file mode 100644 index 000000000..9c0d4a192 --- /dev/null +++ b/db/.archive/230201/00-SupplierUniqueKey.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`supplier` ADD UNIQUE (name, countryFk); diff --git a/db/.archive/230201/00-autoincrement_VnReport_VnPrinter.sql b/db/.archive/230201/00-autoincrement_VnReport_VnPrinter.sql new file mode 100644 index 000000000..a28bf6e90 --- /dev/null +++ b/db/.archive/230201/00-autoincrement_VnReport_VnPrinter.sql @@ -0,0 +1,4 @@ +SET FOREIGN_KEY_CHECKS = 0; +ALTER TABLE `vn`.`report` MODIFY COLUMN id tinyint(3) unsigned NOT NULL AUTO_INCREMENT; +ALTER TABLE `vn`.`printer` MODIFY COLUMN id tinyint(3) unsigned NOT NULL AUTO_INCREMENT; +SET FOREIGN_KEY_CHECKS = 1; diff --git a/db/.archive/230201/00-borradoLogicoIPT.sql b/db/.archive/230201/00-borradoLogicoIPT.sql new file mode 100644 index 000000000..ae7ecf0ca --- /dev/null +++ b/db/.archive/230201/00-borradoLogicoIPT.sql @@ -0,0 +1,3 @@ +ALTER TABLE `vn`.`itemPackingType` ADD isActive BOOLEAN NOT NULL; +UPDATE `vn`.`itemPackingType` SET isActive = 0 WHERE code IN ('P', 'F'); +UPDATE `vn`.`itemPackingType` SET isActive = 1 WHERE code IN ('V', 'H'); diff --git a/db/.archive/230201/00-docuwareStore.sql b/db/.archive/230201/00-docuwareStore.sql new file mode 100644 index 000000000..b20c2554f --- /dev/null +++ b/db/.archive/230201/00-docuwareStore.sql @@ -0,0 +1,23 @@ +CREATE OR REPLACE TABLE `vn`.`docuware` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL, + `fileCabinetName` varchar(50) COLLATE utf8mb3_unicode_ci NOT NULL, + `action` varchar(255) COLLATE utf8mb3_unicode_ci NOT NULL, + `dialogName` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL, + `findById` varchar(50) COLLATE utf8mb3_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + +INSERT INTO `vn`.`docuware` (`code`, `fileCabinetName`, `action`, `dialogName`, `findById`) + VALUES + ('deliveryNote', 'Albaranes cliente', 'find', 'find', 'N__ALBAR_N'), + ('deliveryNote', 'Albaranes cliente', 'store', 'Archivar', 'N__ALBAR_N'); + +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`) + VALUES + ('Docuware','checkFile','READ','ALLOW','employee'), + ('Docuware','download','READ','ALLOW','salesPerson'), + ('Docuware','upload','WRITE','ALLOW','productionAssi'), + ('Docuware','deliveryNoteEmail','WRITE','ALLOW','salesPerson'); + +ALTER TABLE `vn`.`docuwareConfig` CHANGE token cookie varchar(1000) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL; diff --git a/db/changes/10460-mother/03-clean.sql b/db/.archive/230201/00-kkearSaleChecked.sql similarity index 70% rename from db/changes/10460-mother/03-clean.sql rename to db/.archive/230201/00-kkearSaleChecked.sql index 13951394f..3ea107da5 100644 --- a/db/changes/10460-mother/03-clean.sql +++ b/db/.archive/230201/00-kkearSaleChecked.sql @@ -1,4 +1,6 @@ -DROP PROCEDURE IF EXISTS vn.clean; +DELETE FROM `salix`.`ACL` WHERE model="SaleChecked"; +DROP TABLE IF EXISTS `vn`.`saleChecked`; +DROP PROCEDURE IF EXISTS `vn`.`clean`; DELIMITER $$ $$ @@ -10,14 +12,14 @@ BEGIN DECLARE v18Month DATE; DECLARE v26Month DATE; DECLARE v3Month DATE; - DECLARE vTrashId varchar(15); + 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()); + SET vDateShort = util.VN_CURDATE() - INTERVAL 2 MONTH; + SET vOneYearAgo = util.VN_CURDATE() - INTERVAL 1 YEAR; + SET vFourYearsAgo = util.VN_CURDATE() - INTERVAL 4 YEAR; + SET v18Month = util.VN_CURDATE() - INTERVAL 18 MONTH; + SET v26Month = util.VN_CURDATE() - INTERVAL 26 MONTH; + SET v3Month = util.VN_CURDATE() - INTERVAL 3 MONTH; DELETE FROM ticketParking WHERE created < vDateShort; DELETE FROM routesMonitor WHERE dated < vDateShort; @@ -26,39 +28,38 @@ BEGIN 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 itemShelving WHERE created < util.VN_CURDATE() AND visible = 0; + DELETE FROM ticketDown WHERE created < TIMESTAMPADD(DAY,-1,util.VN_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 FROM ticketTracking WHERE created < v18Month; + DELETE tobs FROM ticketObservation tobs + JOIN ticket t ON tobs.ticketFk = t.id WHERE t.shipped < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); 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 + 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 + 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; - + DELETE FROM vn.itemCleanLog WHERE created < util.VN_NOW() - INTERVAL 1 YEAR; + DELETE FROM printQueue WHERE statusCode = 'printed' AND created < vDateShort; -- Equipos duplicados - DELETE w.* + DELETE w.* FROM workerTeam w JOIN (SELECT id, team, workerFk, COUNT(*) - 1 as duplicated FROM workerTeam @@ -66,13 +67,13 @@ BEGIN HAVING duplicated ) d ON d.team = w.team AND d.workerFk = w.workerFk AND d.id != w.id; - DELETE sc + 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 + DELETE c FROM vn.claim c JOIN vn.claimState cs ON cs.id = c.claimStateFk WHERE cs.description = "Anulado" AND @@ -88,9 +89,9 @@ BEGIN 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; + WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL; - SELECT dt.id into vTrashId + SELECT dt.id INTO vTrashId FROM vn.dmsType dt WHERE dt.code = 'trash'; @@ -98,20 +99,20 @@ BEGIN JOIN vn.dms d ON d.id = th.dmsFk SET d.dmsTypeFk = vTrashId; - DELETE th + 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; - + WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_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()); - + JOIN dmsType dt ON dt.id = d.dmsTypeFk + SET d.dmsTypeFk = vTrashId + WHERE created < TIMESTAMPADD(MONTH, -dt.monthToDelete, util.VN_CURDATE()); + -- borrar entradas sin compras DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; CREATE TEMPORARY TABLE tmp.entryToDelete @@ -119,33 +120,33 @@ BEGIN 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; + WHERE e.dated < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND b.entryFK IS NULL; DELETE e FROM vn.entry e - JOIN tmp.entryToDelete tmp ON tmp.id = e.id; - + 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()); + WHERE created < TIMESTAMPADD(YEAR,-4,util.VN_CURDATE()); UPDATE tmp.routeToDelete tmp JOIN vn.dms d ON d.id = tmp.gestdocFk SET d.dmsTypeFk = vTrashId; - DELETE r + 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()); + SELECT * + FROM vn.dua + WHERE operated < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); UPDATE tmp.duaToDelete tm JOIN vn.dms d ON d.id = tm.gestdocFk @@ -155,10 +156,7 @@ BEGIN 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); + DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); -- Borra los registros de collection y ticketcollection DELETE FROM vn.collection WHERE created < vDateShort; @@ -169,7 +167,7 @@ BEGIN DELETE FROM travelLog WHERE creationDate < v3Month; - CALL shelving_clean; + CALL shelving_clean; END$$ DELIMITER ; diff --git a/db/.archive/230201/00-priceFixed_getRate2.sql b/db/.archive/230201/00-priceFixed_getRate2.sql new file mode 100644 index 000000000..cf36efb57 --- /dev/null +++ b/db/.archive/230201/00-priceFixed_getRate2.sql @@ -0,0 +1,23 @@ +DROP FUNCTION IF EXISTS `vn`.`priceFixed_getRate2`; + +DELIMITER $$ +$$ +CREATE FUNCTION `vn`.`priceFixed_getRate2`(vFixedPriceFk INT, vRate3 DOUBLE) +RETURNS DOUBLE +BEGIN + + DECLARE vWarehouse INT; + DECLARE vRate2 DOUBLE; + + SELECT round(vRate3 * (1 + ((r.rate2 - r.rate3)/100)), 2) INTO vRate2 + FROM vn.rate r + JOIN vn.priceFixed p ON p.id = vFixedPriceFk + WHERE r.dated <= p.started + AND r.warehouseFk = p.warehouseFk + ORDER BY r.dated DESC + LIMIT 1; + + RETURN vRate2; + +END$$ +DELIMITER ; diff --git a/db/.archive/230201/00-triggersXDiario.sql b/db/.archive/230201/00-triggersXDiario.sql new file mode 100644 index 000000000..5cf0b6253 --- /dev/null +++ b/db/.archive/230201/00-triggersXDiario.sql @@ -0,0 +1,73 @@ +DROP TRIGGER IF EXISTS vn.XDiario_beforeUpdate; +USE vn; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`XDiario_beforeUpdate` + BEFORE UPDATE ON `XDiario` + FOR EACH ROW +BEGIN + IF NOT NEW.SUBCTA <=> OLD.SUBCTA THEN + IF NEW.SUBCTA <=> '' THEN + SET NEW.SUBCTA = NULL; + END IF; + IF NEW.SUBCTA IS NOT NULL AND NOT LENGTH(NEW.SUBCTA) <=> 10 THEN + CALL util.throw('INVALID_STRING_LENGTH'); + END IF; + END IF; + IF NOT NEW.CONTRA <=> OLD.CONTRA THEN + IF NEW.CONTRA <=> '' THEN + SET NEW.CONTRA = NULL; + END IF; + IF NEW.CONTRA IS NOT NULL AND NOT LENGTH(NEW.CONTRA) <=> 10 THEN + CALL util.throw('INVALID_STRING_LENGTH'); + END IF; + END IF; + IF NOT NEW.FECHA <=> OLD.FECHA THEN + CALL XDiario_checkDate(NEW.FECHA); + END IF; + IF NOT NEW.FECHA_EX <=> OLD.FECHA_EX THEN + CALL XDiario_checkDate(NEW.FECHA_EX); + END IF; + IF NOT NEW.FECHA_OP <=> OLD.FECHA_OP THEN + CALL XDiario_checkDate(NEW.FECHA_OP); + END IF; + IF NOT NEW.FECHA_RT <=> OLD.FECHA_RT THEN + CALL XDiario_checkDate(NEW.FECHA_RT); + END IF; + IF NOT NEW.FECREGCON <=> OLD.FECREGCON THEN + CALL XDiario_checkDate(NEW.FECREGCON); + END IF; +END$$ +DELIMITER ; + + +DROP TRIGGER IF EXISTS vn.XDiario_beforeInsert; +USE vn; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`XDiario_beforeInsert` + BEFORE INSERT ON `XDiario` + FOR EACH ROW +BEGIN + IF NEW.SUBCTA <=> '' THEN + SET NEW.SUBCTA = NULL; + END IF; + IF NEW.SUBCTA IS NOT NULL AND NOT LENGTH(NEW.SUBCTA) <=> 10 THEN + CALL util.throw('INVALID_STRING_LENGTH'); + END IF; + IF NEW.CONTRA <=> '' THEN + SET NEW.CONTRA = NULL; + END IF; + IF NEW.CONTRA IS NOT NULL AND NOT LENGTH(NEW.CONTRA) <=> 10 THEN + CALL util.throw('INVALID_STRING_LENGTH'); + END IF; + CALL XDiario_checkDate(NEW.FECHA); + CALL XDiario_checkDate(NEW.FECHA_EX); + CALL XDiario_checkDate(NEW.FECHA_OP); + CALL XDiario_checkDate(NEW.FECHA_RT); + CALL XDiario_checkDate(NEW.FECREGCON); +END$$ +DELIMITER ; + diff --git a/db/.archive/230201/00-validPriorities_ItemConfig.sql b/db/.archive/230201/00-validPriorities_ItemConfig.sql new file mode 100644 index 000000000..0b32d5de8 --- /dev/null +++ b/db/.archive/230201/00-validPriorities_ItemConfig.sql @@ -0,0 +1,5 @@ +ALTER TABLE `vn`.`itemConfig` ADD defaultTag INT DEFAULT 56 NOT NULL; +ALTER TABLE `vn`.`itemConfig` ADD CONSTRAINT itemConfig_FK FOREIGN KEY (defaultTag) REFERENCES vn.tag(id); +ALTER TABLE `vn`.`itemConfig` ADD validPriorities varchar(50) DEFAULT '[1,2,3]' NOT NULL; +ALTER TABLE `vn`.`itemConfig` ADD defaultPriority INT DEFAULT 2 NOT NULL; +ALTER TABLE `vn`.`item` MODIFY COLUMN relevancy tinyint(1) DEFAULT 0 NOT NULL COMMENT 'La web ordena de forma descendiente por este campo para mostrar los artículos'; diff --git a/db/.archive/230201/00-workerTimeControlConfig.sql b/db/.archive/230201/00-workerTimeControlConfig.sql new file mode 100644 index 000000000..c04acd936 --- /dev/null +++ b/db/.archive/230201/00-workerTimeControlConfig.sql @@ -0,0 +1,6 @@ +ALTER TABLE `vn`.`workerTimeControlConfig` ADD teleworkingStart INT NULL COMMENT 'Hora comienzo jornada de los teletrabajdores expresada en segundos'; +ALTER TABLE `vn`.`workerTimeControlConfig` ADD teleworkingStartBreakTime INT NULL COMMENT 'Hora comienzo descanso de los teletrabjadores expresada en segundos'; + +UPDATE `vn`.`workerTimeControlConfig` + SET `teleworkingStart`=28800, `teleworkingStartBreakTime`=32400 +WHERE `id`=1; diff --git a/db/Dockerfile b/db/Dockerfile index c7be72a23..cb3aa741c 100644 --- a/db/Dockerfile +++ b/db/Dockerfile @@ -1,4 +1,4 @@ -FROM mariadb:10.4.13 +FROM mariadb:10.7.3 ENV MYSQL_ROOT_PASSWORD root ENV TZ Europe/Madrid diff --git a/db/changes/10411-january/00-booking.sql b/db/changes/10411-january/00-booking.sql deleted file mode 100644 index b89234139..000000000 --- a/db/changes/10411-january/00-booking.sql +++ /dev/null @@ -1,248 +0,0 @@ -DROP PROCEDURE IF EXISTS vn.invoiceInBookingMain; - -DELIMITER $$ -$$ -CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`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 ; diff --git a/db/changes/10411-january/00-companyGroup.sql b/db/changes/10411-january/00-companyGroup.sql deleted file mode 100644 index 2c5477e63..000000000 --- a/db/changes/10411-january/00-companyGroup.sql +++ /dev/null @@ -1,12 +0,0 @@ -UPDATE `vn`.`companyGroup` - SET `code`='verdnatura' - WHERE `id`=1; -UPDATE `vn`.`companyGroup` - SET `code`='ornamental' - WHERE `id`=2; -UPDATE `vn`.`companyGroup` - SET `code`='other' - WHERE `id`=3; -UPDATE `vn`.`companyGroup` - SET `code`='provisional' - WHERE `id`=4; diff --git a/db/changes/10411-january/00-saleVolume.sql b/db/changes/10411-january/00-saleVolume.sql deleted file mode 100644 index e8a5e3433..000000000 --- a/db/changes/10411-january/00-saleVolume.sql +++ /dev/null @@ -1,38 +0,0 @@ -USE vn; -DELIMITER $$ -$$ -CREATE OR REPLACE -ALGORITHM = UNDEFINED VIEW `vn`.`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; -$$ -DELIMITER ; diff --git a/db/changes/10411-january/00-workerLabour.sql b/db/changes/10411-january/00-workerLabour.sql deleted file mode 100644 index 8630eee22..000000000 --- a/db/changes/10411-january/00-workerLabour.sql +++ /dev/null @@ -1,25 +0,0 @@ -ALTER TABLE `postgresql`.`business` ADD payedHolidays INT NULL; -ALTER TABLE `postgresql`.`business` CHANGE payedHolidays payedHolidays INT NULL AFTER reasonEndFk; - -CREATE OR REPLACE -ALGORITHM = UNDEFINED VIEW `vn`.`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 \ No newline at end of file diff --git a/db/changes/10420-valentines/00-ImportTicketAcl.sql b/db/changes/10420-valentines/00-ImportTicketAcl.sql deleted file mode 100644 index df61fd5b8..000000000 --- a/db/changes/10420-valentines/00-ImportTicketAcl.sql +++ /dev/null @@ -1,2 +0,0 @@ -DELETE FROM `salix`.`ACL` -WHERE model = 'ClaimEnd' AND property = 'importTicketSales'; diff --git a/db/changes/10420-valentines/00-aclCollection.sql b/db/changes/10420-valentines/00-aclCollection.sql deleted file mode 100644 index 57774ba29..000000000 --- a/db/changes/10420-valentines/00-aclCollection.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO `salix`.`ACL` -(model, property, accessType, permission, principalType, principalId) -VALUES('Collection', 'setSaleQuantity', '*', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/db/changes/10420-valentines/00-aclDocuware.sql b/db/changes/10420-valentines/00-aclDocuware.sql deleted file mode 100644 index c2d47d4ea..000000000 --- a/db/changes/10420-valentines/00-aclDocuware.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO `salix`.`ACL` -(model, property, accessType, permission, principalType, principalId) -VALUES('Docuware', '*', '*', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/db/changes/10420-valentines/00-defaultViewConfig.sql b/db/changes/10420-valentines/00-defaultViewConfig.sql deleted file mode 100644 index e0d75e9d4..000000000 --- a/db/changes/10420-valentines/00-defaultViewConfig.sql +++ /dev/null @@ -1,3 +0,0 @@ -UPDATE `salix`.`defaultViewConfig` - SET `columns`='{"intrastat":false,"stemMultiplier":false,"landed":false,"producer":false}' - WHERE tableCode ='itemsIndex'; diff --git a/db/changes/10420-valentines/00-docuware.sql b/db/changes/10420-valentines/00-docuware.sql deleted file mode 100644 index 7cabd135f..000000000 --- a/db/changes/10420-valentines/00-docuware.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE `vn`.`docuware` ( - `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, - `code` varchar(50) NULL, - `fileCabinetName` varchar(50) NULL, - `dialogName` varchar(255) DEFAULT NULL, - `find` varchar(50) DEFAULT NULL -); - -INSERT INTO `vn`.`docuware` (`code`, `fileCabinetName`, `dialogName` , `find`) - VALUES - ('deliveryClient', 'Albaranes cliente', 'findTicket', 'N__ALBAR_N'); \ No newline at end of file diff --git a/db/changes/10420-valentines/00-docuwareConfig.sql b/db/changes/10420-valentines/00-docuwareConfig.sql deleted file mode 100644 index 1ba19af6d..000000000 --- a/db/changes/10420-valentines/00-docuwareConfig.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE `vn`.`docuwareConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, - `url` varchar(75) NULL, - `token` varchar(1000) DEFAULT NULL -); - -INSERT INTO `vn`.`docuwareConfig` (`url`) - VALUES - ('https://verdnatura.docuware.cloud/docuware/platform'); \ No newline at end of file diff --git a/db/changes/10420-valentines/00-state.sql b/db/changes/10420-valentines/00-state.sql deleted file mode 100644 index 590be6964..000000000 --- a/db/changes/10420-valentines/00-state.sql +++ /dev/null @@ -1,26 +0,0 @@ -ALTER TABLE `vn`.`state` ADD classColor varchar(12) NULL; - -UPDATE `vn`.`state` s - SET s.classColor = 'warning' - WHERE s.alertLevel = 1; - -UPDATE `vn`.`state` s - SET s.classColor = 'alert' - WHERE s.alertLevel = 0; - -UPDATE `vn`.`state` s - SET s.classColor = 'success' - WHERE s.code LIKE 'OK'; - -UPDATE `vn`.`state` s - SET s.classColor = 'notice' - WHERE s.code LIKE 'FREE'; - -UPDATE `vn`.`state` s - SET s.classColor = 'success' - WHERE s.order >= 4 - AND (s.alertLevel = 0 OR s.alertLevel = 1); - -UPDATE `vn`.`state` s - SET s.classColor = 'warning' - WHERE s.code IN ('PREVIOUS_PREPARATION', 'PREPARED', 'ON_PREPARATION', 'ON_CHECKING', 'CHECKED'); diff --git a/db/changes/10420-valentines/00-ticket_getMovable.sql b/db/changes/10420-valentines/00-ticket_getMovable.sql deleted file mode 100644 index eb5c722c4..000000000 --- a/db/changes/10420-valentines/00-ticket_getMovable.sql +++ /dev/null @@ -1,46 +0,0 @@ -DROP PROCEDURE IF EXISTS `vn`.`ticket_getMovable`; - -DELIMITER $$ -$$ -CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`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 ; diff --git a/db/changes/10430-ash/00-aclClaimLog.sql b/db/changes/10430-ash/00-aclClaimLog.sql deleted file mode 100644 index cad88a6ab..000000000 --- a/db/changes/10430-ash/00-aclClaimLog.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) - VALUES - ('ClaimLog', '*', 'READ', 'ALLOW', 'ROLE', 'claimManager'); diff --git a/db/changes/10430-ash/00-deliveryBoss.sql b/db/changes/10430-ash/00-deliveryBoss.sql deleted file mode 100644 index ac07bfa31..000000000 --- a/db/changes/10430-ash/00-deliveryBoss.sql +++ /dev/null @@ -1 +0,0 @@ -UPDATE `account`.`user` SET `role` = 57 WHERE id IN (2294, 4365, 7294); \ No newline at end of file diff --git a/db/changes/10440-fallas/00-ACL.sql b/db/changes/10440-fallas/00-ACL.sql deleted file mode 100644 index 051a851f7..000000000 --- a/db/changes/10440-fallas/00-ACL.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) -VALUES ('Edi', 'updateData', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/10440-fallas/00-aclAgency.sql b/db/changes/10440-fallas/00-aclAgency.sql deleted file mode 100644 index 9e5bb6382..000000000 --- a/db/changes/10440-fallas/00-aclAgency.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) - VALUES(304, 'Agency', '*', '*', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/10440-fallas/00-aclIntrastat.sql b/db/changes/10440-fallas/00-aclIntrastat.sql deleted file mode 100644 index 16410814d..000000000 --- a/db/changes/10440-fallas/00-aclIntrastat.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO `salix`.`ACL` -(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) -VALUES('InvoiceInIntrastat', '*', '*', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/db/changes/10440-fallas/00-agencyTermConfig.sql b/db/changes/10440-fallas/00-agencyTermConfig.sql deleted file mode 100644 index 9822b160b..000000000 --- a/db/changes/10440-fallas/00-agencyTermConfig.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE `vn`.`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; - -INSERT INTO `vn`.`agencyTermConfig` -(`expenceFk`, `vatAccountSupported`, `vatPercentage`, `transaction`) -VALUES('6240000000', '4721000015', 21.0000000000, 'Adquisiciones intracomunitarias de servicios'); \ No newline at end of file diff --git a/db/changes/10440-fallas/00-claimConfig.sql b/db/changes/10440-fallas/00-claimConfig.sql deleted file mode 100644 index 905dea484..000000000 --- a/db/changes/10440-fallas/00-claimConfig.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE `vn`.`claimConfig` ( - `id` int(11) NOT NULL, - `pickupContact` varchar(250), - PRIMARY KEY (`id`) -); - -INSERT INTO vn.claimConfig (id, pickupContact) - VALUES(1, 'Email: cmorenoa@logista.com Telf: 961594250 Extensión: 206'); \ No newline at end of file diff --git a/db/changes/10440-fallas/00-claimState.sql b/db/changes/10440-fallas/00-claimState.sql deleted file mode 100644 index 329a9b977..000000000 --- a/db/changes/10440-fallas/00-claimState.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE `vn`.`claimState` ADD `hasToNotify` TINYINT DEFAULT 0 NULL; -UPDATE `vn`.`claimState` SET `hasToNotify` = 1 WHERE `code` IN ('canceled', 'incomplete'); \ No newline at end of file diff --git a/db/changes/10440-fallas/00-claim_packages.sql b/db/changes/10440-fallas/00-claim_packages.sql deleted file mode 100644 index 3d82eb7b6..000000000 --- a/db/changes/10440-fallas/00-claim_packages.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `vn`.`claim` ADD packages smallint(10) unsigned DEFAULT 0 NULL COMMENT 'packages received by the client'; diff --git a/db/changes/10440-fallas/00-component.sql b/db/changes/10440-fallas/00-component.sql deleted file mode 100644 index 8d2dd6517..000000000 --- a/db/changes/10440-fallas/00-component.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO `vn`.`component` (`name`,`typeFk`,`classRate`,`isRenewable`,`code`,`isRequired`) - VALUES ('maná reclamacion',7,4,0,'manaClaim',0); \ No newline at end of file diff --git a/db/changes/10440-fallas/00-country.sql b/db/changes/10440-fallas/00-country.sql deleted file mode 100644 index 6cc4ce1f9..000000000 --- a/db/changes/10440-fallas/00-country.sql +++ /dev/null @@ -1,90 +0,0 @@ -ALTER TABLE `vn`.`country` ADD `a3Code` INT NULL COMMENT 'Código país para a3'; - -UPDATE `vn`.`country` c -JOIN `vn2008`.`payroll_pais` `p` ON `p`.`pais` = `c`.`country` -SET `c`.`a3Code` = `p`.`codpais`; - -UPDATE `vn`.`country` -SET `a3Code` = 710 -WHERE `country` = 'Sud-Africa'; -- ÁFRICA DEL SUR - -UPDATE `vn`.`country` -SET `a3Code` = 643 -WHERE `country` = 'Rusia'; -- FEDERACIÓN DE RUSIA - -UPDATE `vn`.`country` -SET `a3Code` = 28 -WHERE `country` = 'Antigua'; -- ANTIGUA Y BARBUDA - -UPDATE `vn`.`country` -SET `a3Code` = 840 -WHERE `country` = 'USA'; -- ESTADOS UNIDOS - -UPDATE `vn`.`country` -SET `a3Code` = 404 -WHERE `country` = 'Kenya'; -- KENIA - -UPDATE `vn`.`country` -SET `a3Code` = 498 -WHERE `country` = 'Moldavia'; -- REPÚBLICA DE MOLDAVIA - -UPDATE `vn`.`country` -SET `a3Code` = 826 -WHERE `country` = 'Gran Bretaña'; -- REINO UNIDO - -UPDATE `vn`.`country` -SET `a3Code` = 484 -WHERE `country` = 'Mexico'; -- MÉJICO - -UPDATE `vn`.`country` -SET `a3Code` = 716 -WHERE `country` = 'Zimbawe'; -- ZINBABWE - -UPDATE `vn`.`country` -SET `a3Code` = 203 -WHERE `country` = 'Chequia'; -- REPÚBLICA CHECA - -UPDATE `vn`.`country` -SET `a3Code` = 764 -WHERE `country` = 'Thailandia'; -- TAILANDIA - -UPDATE `vn`.`country` -SET `a3Code` = 276 -WHERE `country` = 'Alemania'; -- REPÚBLICA FEDERAL DE ALEMANIA - -UPDATE `vn`.`country` -SET `a3Code` = 112 -WHERE `country` = 'Bielorrusia'; -- BELARUS - -UPDATE `vn`.`country` -SET `a3Code` = 528 -WHERE `country` = 'Holanda'; -- PAÍSES BAJOS - -UPDATE `vn`.`country` -SET `a3Code` = 410 -WHERE `country` = 'Corea del Sur'; -- COREA (REPÚBLICA) - -UPDATE `vn`.`country` -SET `a3Code` = 724 -WHERE `country` = 'España exento'; -- ESPAÑA - --- Borrar registro USA de country: -UPDATE `vn`.`supplier` `s` - SET `s`.`countryFk` = 62 - WHERE `s`.`countryFk` = 12; - -UPDATE `vn`.`bankEntity` - SET `countryFk` = 62 - WHERE `countryFk` = 12; - -DELETE FROM `vn`.`country` - WHERE `id`= 12; - -UPDATE `vn2008`.`payroll_pais` -SET `pais`='COREA NORTE (REPÚBLICA DEM. POPULAR)' -WHERE `codpais`=408; -UPDATE `vn2008`.`payroll_pais` -SET `pais`='COREA SUR (REPÚBLICA) ' -WHERE `codpais`=410; - -RENAME TABLE `vn2008`.`payroll_pais` TO `vn2008`.`payroll_pais__`; \ No newline at end of file diff --git a/db/changes/10440-fallas/00-invoiceInIntrastat.sql b/db/changes/10440-fallas/00-invoiceInIntrastat.sql deleted file mode 100644 index 8f65fac29..000000000 --- a/db/changes/10440-fallas/00-invoiceInIntrastat.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) - VALUES ('InvoiceInIntrastat','*','*','ALLOW','ROLE','employee'); \ No newline at end of file diff --git a/db/changes/10440-fallas/00-manaCustomerUpdate.sql b/db/changes/10440-fallas/00-manaCustomerUpdate.sql deleted file mode 100644 index 80838bca2..000000000 --- a/db/changes/10440-fallas/00-manaCustomerUpdate.sql +++ /dev/null @@ -1,106 +0,0 @@ -DROP PROCEDURE IF EXISTS `bs`.`manaCustomerUpdate`; - -DELIMITER $$ -$$ -CREATE DEFINER=`root`@`localhost` PROCEDURE `bs`.`manaCustomerUpdate`() -BEGIN - DECLARE vToDated DATE; - DECLARE vFromDated DATE; - DECLARE vForDeleteDated DATE; - DECLARE vManaId INT; - DECLARE vManaAutoId INT; - DECLARE vClaimManaId INT; - DECLARE vManaBankId INT; - DECLARE vManaGreugeTypeId INT; - - SELECT id INTO vManaId - FROM `component` WHERE code = 'mana'; - - SELECT id INTO vManaAutoId - FROM `component` WHERE code = 'autoMana'; - - SELECT id INTO vClaimManaId - FROM `component` WHERE code = 'manaClaim'; - - SELECT id INTO vManaBankId - FROM `bank` WHERE code = 'mana'; - - SELECT id INTO vManaGreugeTypeId - FROM `greugeType` WHERE code = 'mana'; - - SELECT IFNULL(max(dated), '2016-01-01') - INTO vFromDated - FROM bs.manaCustomer; - - DELETE - FROM bs.manaCustomer - WHERE dated = vFromDated; - - SELECT IFNULL(max(dated), '2016-01-01') - INTO vFromDated - FROM bs.manaCustomer; - - WHILE timestampadd(DAY,30,vFromDated) < CURDATE() DO - - SELECT - timestampadd(DAY,30,vFromDated), - timestampadd(DAY,-90,vFromDated) - INTO - vToDated, - vForDeleteDated; - - DELETE FROM bs.manaCustomer - WHERE dated <= vForDeleteDated; - - - INSERT INTO bs.manaCustomer(Id_Cliente, 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, 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 - AND Fechacobro > vFromDated - AND Fechacobro <= vToDated - - UNION ALL - - SELECT g.Id_Cliente, g.Importe - FROM vn2008.Greuges g - WHERE Greuges_type_id = vManaGreugeTypeId - AND Fecha > vFromDated - AND Fecha <= vToDated - - UNION ALL - - SELECT Id_Cliente, mana - FROM bs.manaCustomer - WHERE dated = vFromDated - ) sub - - GROUP BY Id_Cliente - HAVING Id_Cliente; - - SET vFromDated = vToDated; - - END WHILE; - -END$$ -DELIMITER ; diff --git a/db/changes/10440-fallas/00-manaSpellersRequery.sql b/db/changes/10440-fallas/00-manaSpellersRequery.sql deleted file mode 100644 index 9c1a10c6a..000000000 --- a/db/changes/10440-fallas/00-manaSpellersRequery.sql +++ /dev/null @@ -1,75 +0,0 @@ -DROP PROCEDURE IF EXISTS `vn`.`manaSpellersRequery`; - -DELIMITER $$ -$$ -CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`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 ; diff --git a/db/changes/10440-fallas/00-supplierAgencyTerm.sql b/db/changes/10440-fallas/00-supplierAgencyTerm.sql deleted file mode 100644 index f8539f607..000000000 --- a/db/changes/10440-fallas/00-supplierAgencyTerm.sql +++ /dev/null @@ -1,48 +0,0 @@ -ALTER TABLE `vn`.`agencyTerm` ADD `supplierFk` INT NULL; -ALTER TABLE `vn`.`agencyTerm` CHANGE `supplierFk` `supplierFk` INT NULL AFTER `agencyFk`; - -UPDATE `vn`.`agencyTerm` `at` - JOIN `vn`.`agency` `a` ON `a`.`id` = `at`.`agencyFk` -SET `at`.`supplierFk` = `a`.`supplierFk`; - -ALTER TABLE `vn`.`agencyTerm` ADD CONSTRAINT `agencyTerm_FK` FOREIGN KEY (`agencyFk`) REFERENCES `vn`.`agency`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; -ALTER TABLE `vn`.`agencyTerm` ADD CONSTRAINT `agencyTerm_FK_1` FOREIGN KEY (`supplierFk`) REFERENCES `vn`.`supplier`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; - -RENAME TABLE `vn`.`agencyTerm` TO `vn`.`supplierAgencyTerm`; - -CREATE OR REPLACE -ALGORITHM = UNDEFINED -DEFINER=`root`@`localhost` -VIEW `vn`.`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 - `vn`.`supplierAgencyTerm` `sat`; - -ALTER TABLE `vn`.`agency` DROP FOREIGN KEY `agency_ibfk_4`; -ALTER TABLE `vn`.`agency` CHANGE `supplierFk` `supplierFk__` int(11) DEFAULT NULL NULL; - -CREATE OR REPLACE -ALGORITHM = UNDEFINED -DEFINER=`root`@`localhost` -VIEW `vn2008`.`agency` AS -SELECT - `a`.`id` AS `agency_id`, - `a`.`name` AS `name`, - `a`.`warehouseFk` AS `warehouse_id`, - `a`.`isVolumetric` AS `por_volumen`, - `a`.`bankFk` AS `Id_Banco`, - `a`.`warehouseAliasFk` AS `warehouse_alias_id`, - `a`.`isOwn` AS `propios`, - `a`.`labelZone` AS `zone_label`, - `a`.`workCenterFk` AS `workCenterFk`, - `a`.`supplierFk__` AS `supplierFk__` -FROM - `vn`.`agency` `a`; \ No newline at end of file diff --git a/db/changes/10440-fallas/00-ticketRefund.sql b/db/changes/10440-fallas/00-ticketRefund.sql deleted file mode 100644 index 66de21e91..000000000 --- a/db/changes/10440-fallas/00-ticketRefund.sql +++ /dev/null @@ -1,149 +0,0 @@ -DROP PROCEDURE IF EXISTS `vn`.`ticket_doRefund`; - -DELIMITER $$ -$$ -CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`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 ; - -CREATE TABLE `vn`.`ticketRefund` ( - `id` INT auto_increment NULL, - `refundTicketFk` INT NOT NULL, - `originalTicketFk` INT NOT NULL, - CONSTRAINT `ticketRefund_PK` PRIMARY KEY (id) -) -ENGINE=InnoDB -DEFAULT CHARSET=utf8 -COLLATE=utf8_unicode_ci; - -ALTER TABLE `vn`.`ticketRefund` ADD CONSTRAINT `ticketRefund_FK` FOREIGN KEY (`refundTicketFk`) REFERENCES `vn`.`ticket`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; -ALTER TABLE `vn`.`ticketRefund` ADD CONSTRAINT `ticketRefund_FK_1` FOREIGN KEY (`originalTicketFk`) REFERENCES `vn`.`ticket`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; - -DELIMITER $$ -$$ -CREATE DEFINER=`root`@`localhost` 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 ; - -DELIMITER $$ -$$ -CREATE DEFINER=`root`@`localhost` 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 ; diff --git a/db/changes/10440-fallas/00-travelThermograph.sql b/db/changes/10440-fallas/00-travelThermograph.sql deleted file mode 100644 index f76f070a0..000000000 --- a/db/changes/10440-fallas/00-travelThermograph.sql +++ /dev/null @@ -1,16 +0,0 @@ -DROP TRIGGER `vn`.`travelThermograph_beforeInsert`; - -ALTER TABLE `vn`.`travelThermograph` CHANGE `temperature` `temperature__` enum('COOL','WARM','DRY') CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL NULL; - -CREATE OR REPLACE -ALGORITHM = UNDEFINED VIEW `vn2008`.`travel_thermograph` AS -select - `tt`.`thermographFk` AS `thermograph_id`, - `tt`.`created` AS `odbc_date`, - `tt`.`warehouseFk` AS `warehouse_id`, - `tt`.`travelFk` AS `travel_id`, - `tt`.`temperatureFk` AS `temperature`, - `tt`.`result` AS `result`, - `tt`.`dmsFk` AS `gestdoc_id` -from - `vn`.`travelThermograph` `tt`; \ No newline at end of file diff --git a/db/changes/10440-fallas/00-worker.sql b/db/changes/10440-fallas/00-worker.sql deleted file mode 100644 index 0e0def841..000000000 --- a/db/changes/10440-fallas/00-worker.sql +++ /dev/null @@ -1,51 +0,0 @@ - -ALTER TABLE `vn`.`worker` MODIFY COLUMN `maritalStatus__` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL; -UPDATE `vn`.`worker` `w` - SET `w`.`maritalStatus__` = NULL; - -UPDATE `vn`.`worker` `w` - JOIN `vn`.`person` `p` ON `p`.`workerFk` = `w`.`id` - JOIN `postgresql`.`profile` `pr` ON `pr`.`person_id` = `p`.`id` - JOIN `vn2008`.`profile_labour_payroll` `pl` ON `pl`.`profile_id` = `pr`.`profile_id` - SET `w`.`maritalStatus__` = `pl`.`estadocivil`; - -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; - -INSERT INTO `vn`.`country` (`country`, `CEE`, `code`, `politicalCountryFk`, `isUeeMember`, `a3Code`) - VALUES - ('Argentina',2,'AR',80,0,32), - ('Cuba',2,'CU',81,0,192), - ('Guinea Ecuatorial',2,'GQ',82,0,226), - ('Guinea',2,'GN',83,0,324), - ('Honduras',2,'HN',84,0,340), - ('Mali',2,'ML',85,0,466), - ('Nicaragua',2,'NI',86,0,558), - ('Pakistán',2,'PK',87,0,586), - ('Paraguay',2,'PY',88,0,600), - ('Senegal',2,'SN',89,0,686), - ('Uruguay',2,'UY',90,0,858), - ('Venezuela',2,'VE',91,0,862), - ('Bulgaria',2,'BG',92,1,100), - ('Georgia',2,'GE',93,0,268); - -UPDATE `vn`.`worker` `w` - JOIN `vn`.`person` `p` ON `p`.`workerFk` = `w`.`id` - JOIN `postgresql`.`profile` `pr` ON `pr`.`person_id` = `p`.`id` - JOIN `vn2008`.`profile_labour_payroll` `pl` ON `pl`.`profile_id` = `pr`.`profile_id` - JOIN `vn`.`country` `co` ON `co`.`a3Code` = `pl`.`codpais` - SET `w`.`originCountryFk` = `co`.`id`; - -UPDATE `vn`.`worker` `w` - JOIN `vn`.`person` `p` ON `p`.`workerFk` = `w`.`id` - JOIN `postgresql`.`profile` `pr` ON `pr`.`person_id` = `p`.`id` - JOIN `vn2008`.`profile_labour_payroll` pl ON `pl`.`profile_id` = `pr`.`profile_id` - SET `w`.`SSN` = CONCAT(`pl`.`NSSProvincia`, `pl`.`NssNumero`, `pl`.`NssDC`); - -RENAME TABLE `vn2008`.`profile_labour_payroll` TO `vn2008`.`profile_labour_payroll__`; diff --git a/db/changes/10440-fallas/00-workerBusinessType.sql b/db/changes/10440-fallas/00-workerBusinessType.sql deleted file mode 100644 index 489caa6c9..000000000 --- a/db/changes/10440-fallas/00-workerBusinessType.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE `postgresql`.`business_labour_payroll` DROP FOREIGN KEY `business_labour_payroll_cod_contrato`; -ALTER TABLE `vn`.`workerBusinessType` MODIFY COLUMN `id` int(11) NOT NULL; -ALTER TABLE `postgresql`.`business_labour_payroll` ADD CONSTRAINT `business_labour_payroll_FK` FOREIGN KEY (cod_contrato) REFERENCES `vn`.`workerBusinessType`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/db/changes/10450-april/00-timeControl_getError.sql b/db/changes/10450-april/00-timeControl_getError.sql deleted file mode 100644 index 0caf8ab62..000000000 --- a/db/changes/10450-april/00-timeControl_getError.sql +++ /dev/null @@ -1,73 +0,0 @@ -DROP PROCEDURE IF EXISTS vn.timeControl_getError; - -DELIMITER $$ -$$ -CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`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 ; diff --git a/db/changes/10451-april/00-account_user.sql b/db/changes/10451-april/00-account_user.sql deleted file mode 100644 index 2988c310e..000000000 --- a/db/changes/10451-april/00-account_user.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `vn`.`userConfig` ADD darkMode tinyint(1) DEFAULT 1 NOT NULL COMMENT 'Salix interface dark mode'; \ No newline at end of file diff --git a/db/changes/10451-april/00-aclExpeditionState.sql b/db/changes/10451-april/00-aclExpeditionState.sql deleted file mode 100644 index d26117bbf..000000000 --- a/db/changes/10451-april/00-aclExpeditionState.sql +++ /dev/null @@ -1,2 +0,0 @@ -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/changes/10451-april/00-aclExpense.sql b/db/changes/10451-april/00-aclExpense.sql deleted file mode 100644 index 55ca8c389..000000000 --- a/db/changes/10451-april/00-aclExpense.sql +++ /dev/null @@ -1,5 +0,0 @@ -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/db/changes/10451-april/00-aclSaleRefund.sql b/db/changes/10451-april/00-aclSaleRefund.sql deleted file mode 100644 index 79baba63d..000000000 --- a/db/changes/10451-april/00-aclSaleRefund.sql +++ /dev/null @@ -1,6 +0,0 @@ -UPDATE `salix`.`ACL` - SET `property`='refund' -WHERE `model`='Sale' AND `property`='payBack'; - -INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) -VALUES('Sale', 'refundAll', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/10460-mother/00-clientConfig.sql b/db/changes/10460-mother/00-clientConfig.sql deleted file mode 100644 index cd67a5797..000000000 --- a/db/changes/10460-mother/00-clientConfig.sql +++ /dev/null @@ -1,5 +0,0 @@ -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/changes/10460-mother/00-dmsForeignKey.sql b/db/changes/10460-mother/00-dmsForeignKey.sql deleted file mode 100644 index 6a4736fdd..000000000 --- a/db/changes/10460-mother/00-dmsForeignKey.sql +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index 649ffbc71..000000000 --- a/db/changes/10460-mother/01-dmsType.sql +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index d4525440b..000000000 --- a/db/changes/10460-mother/02-dmsTrigger.sql +++ /dev/null @@ -1,18 +0,0 @@ - -DELIMITER $$ -$$ -CREATE TRIGGER `vn`.`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/10461-mother/00-ClientUnpaid.sql b/db/changes/10461-mother/00-ClientUnpaid.sql deleted file mode 100644 index 16deedace..000000000 --- a/db/changes/10461-mother/00-ClientUnpaid.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE `vn`.`clientUnpaid` ( - `clientFk` int(11) NOT NULL, - `dated` date NOT NULL, - `amount` double DEFAULT 0, - PRIMARY KEY (`clientFk`), - CONSTRAINT `clientUnpaid_clientFk` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON UPDATE CASCADE -); - -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) - VALUES('ClientUnpaid', '*', '*', 'ALLOW', 'ROLE', 'administrative'); diff --git a/db/changes/10461-mother/00-invoiceOut_queue.sql b/db/changes/10461-mother/00-invoiceOut_queue.sql deleted file mode 100644 index 2b9f45e0f..000000000 --- a/db/changes/10461-mother/00-invoiceOut_queue.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE `vn`.`invoiceOut_queue` ( - `invoiceFk` int(10) unsigned not null, - `queued` datetime default now() not null, - `printed` datetime null, - `status` VARCHAR(50) DEFAULT '' NULL, - CONSTRAINT `invoiceOut_queue_pk` PRIMARY KEY (`invoiceFk`), - CONSTRAINT `invoiceOut_queue_invoiceOut_id_fk` FOREIGN KEY (`invoiceFk`) REFERENCES `vn`.`invoiceOut` (`id`) ON UPDATE CASCADE ON DELETE CASCADE -) comment 'Queue for PDF invoicing'; diff --git a/db/changes/10470-family/00-accountingType.sql b/db/changes/10470-family/00-accountingType.sql deleted file mode 100644 index f3c092a34..000000000 --- a/db/changes/10470-family/00-accountingType.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE `vn`.`accountingType` ADD daysInFuture INT NULL; -ALTER TABLE `vn`.`accountingType` MODIFY COLUMN daysInFuture int(11) DEFAULT 0 NULL; \ No newline at end of file diff --git a/db/changes/10470-family/00-aclItemType.sql b/db/changes/10470-family/00-aclItemType.sql deleted file mode 100644 index 836a69dfd..000000000 --- a/db/changes/10470-family/00-aclItemType.sql +++ /dev/null @@ -1,4 +0,0 @@ -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) - VALUES - ('ItemType', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - ('ItemType', '*', 'WRITE', 'ALLOW', 'ROLE', 'buyer'); \ No newline at end of file diff --git a/db/changes/10470-family/00-aclMdb.sql b/db/changes/10470-family/00-aclMdb.sql deleted file mode 100644 index c57f60eb3..000000000 --- a/db/changes/10470-family/00-aclMdb.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE `vn`.`mdbBranch` ( - `name` VARCHAR(255), - PRIMARY KEY(`name`) -); - -CREATE TABLE `vn`.`mdbVersion` ( - `app` VARCHAR(255) NOT NULL, - `branchFk` VARCHAR(255) NOT NULL, - `version` INT, - CONSTRAINT `mdbVersion_branchFk` FOREIGN KEY (`branchFk`) REFERENCES `vn`.`mdbBranch` (`name`) ON DELETE CASCADE ON UPDATE CASCADE -); - -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) - VALUES('MdbVersion', '*', '*', 'ALLOW', 'ROLE', 'developer'); diff --git a/db/changes/10470-family/00-chat.sql b/db/changes/10470-family/00-chat.sql deleted file mode 100644 index d4a8f068a..000000000 --- a/db/changes/10470-family/00-chat.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE `vn`.`chat` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `senderFk` int(10) unsigned DEFAULT NULL, - `recipient` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `dated` date DEFAULT NULL, - `checkUserStatus` tinyint(1) DEFAULT NULL, - `message` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, - `status` tinyint(1) DEFAULT NULL, - `attempts` int(1) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `chat_FK` (`senderFk`), - CONSTRAINT `chat_FK` FOREIGN KEY (`senderFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; \ No newline at end of file diff --git a/db/changes/10470-family/00-creditInsurance.sql b/db/changes/10470-family/00-creditInsurance.sql deleted file mode 100644 index 9d4db470b..000000000 --- a/db/changes/10470-family/00-creditInsurance.sql +++ /dev/null @@ -1,8 +0,0 @@ -ALTER TABLE `vn`.`creditInsurance` ADD creditClassificationFk int(11) NULL; - -UPDATE `vn`.`creditInsurance` AS `destiny` - SET `destiny`.`creditClassificationFk`= (SELECT creditClassification FROM `vn`.`creditInsurance` AS `origin` WHERE `origin`.id = `destiny`.id); - -ALTER TABLE `vn`.`creditInsurance` - ADD CONSTRAINT `creditInsurance_creditClassificationFk` FOREIGN KEY (`creditClassificationFk`) - REFERENCES `vn`.`creditClassification` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; \ No newline at end of file diff --git a/db/changes/10470-family/00-defaultViewConfig.sql b/db/changes/10470-family/00-defaultViewConfig.sql deleted file mode 100644 index d423599b1..000000000 --- a/db/changes/10470-family/00-defaultViewConfig.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO `salix`.`defaultViewConfig` (tableCode, columns) -VALUES ('clientsDetail', '{"id":true,"phone":true,"city":true,"socialName":true,"salesPersonFk":true,"email":true,"name":false,"fi":false,"credit":false,"creditInsurance":false,"mobile":false,"street":false,"countryFk":false,"provinceFk":false,"postcode":false,"created":false,"businessTypeFk":false,"payMethodFk":false,"sageTaxTypeFk":false,"sageTransactionTypeFk":false,"isActive":false,"isVies":false,"isTaxDataChecked":false,"isEqualizated":false,"isFreezed":false,"hasToInvoice":false,"hasToInvoiceByAddress":false,"isToBeMailed":false,"hasLcr":false,"hasCoreVnl":false,"hasSepaVnl":false}'); - diff --git a/db/changes/10470-family/00-ticket_doRefund.sql b/db/changes/10470-family/00-ticket_doRefund.sql deleted file mode 100644 index f4ecf29d7..000000000 --- a/db/changes/10470-family/00-ticket_doRefund.sql +++ /dev/null @@ -1,127 +0,0 @@ -DROP PROCEDURE IF EXISTS `vn`.`ticket_doRefund`; - -DELIMITER $$ -$$ -CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_doRefund`(OUT vNewTicket INT) -BEGIN -/** - * Crea un ticket de abono a partir de tmp.sale y/o tmp.ticketService - * - * @return vNewTicket - */ - DECLARE vDone BIT DEFAULT 0; - DECLARE vClientFk 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 vDescription VARCHAR(50); - DECLARE vTaxClassFk INT; - DECLARE vTicketServiceTypeFk INT; - DECLARE vOriginTicket INT; - - DECLARE cSales CURSOR FOR - SELECT s.id, s.itemFk, - s.quantity, s.concept, s.price, s.discount - FROM tmp.sale s; - - DECLARE cTicketServices CURSOR FOR - SELECT ts.description, - ts.quantity, ts.price, ts.taxClassFk, ts.ticketServiceTypeFk - FROM tmp.ticketService ts; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - SELECT sub.ticketFk INTO vOriginTicket - FROM ( - SELECT s.ticketFk - FROM tmp.sale s - UNION ALL - SELECT ts.ticketFk - FROM tmp.ticketService ts - ) sub - LIMIT 1; - - SELECT id INTO vRefundAgencyMode - FROM agencyMode WHERE `name` = 'ABONO'; - - SELECT clientFk, warehouseFk, companyFk, addressFk - INTO vClientFk, 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 - vClientFk, - CURDATE(), - vAddress, - vRefundAgencyMode, - a.nickname, - vWarehouse, - vCompany, - CURDATE(), - vZoneFk - FROM address a - WHERE a.id = vAddress; - - SET vNewTicket = LAST_INSERT_ID(); - - SET vDone := FALSE; - OPEN cSales; - FETCH cSales 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 cSales INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount; - - END WHILE; - CLOSE cSales; - - SET vDone := FALSE; - OPEN cTicketServices; - FETCH cTicketServices INTO vDescription, vQuantity, vPrice, vTaxClassFk, vTicketServiceTypeFk; - - WHILE NOT vDone DO - - INSERT INTO vn.ticketService(description, quantity, price, taxClassFk, ticketFk, ticketServiceTypeFk) - VALUES(vDescription, vQuantity, vPrice, vTaxClassFk, vNewTicket, vTicketServiceTypeFk); - - FETCH cTicketServices INTO vDescription, vQuantity, vPrice, vTaxClassFk, vTicketServiceTypeFk; - - END WHILE; - CLOSE cTicketServices; - - INSERT INTO vn.ticketRefund(refundTicketFk, originalTicketFk) - VALUES(vNewTicket, vOriginTicket); -END$$ -DELIMITER ; diff --git a/db/changes/10470-family/01-creditInsuranceTriggers.sql b/db/changes/10470-family/01-creditInsuranceTriggers.sql deleted file mode 100644 index 53ba3ba11..000000000 --- a/db/changes/10470-family/01-creditInsuranceTriggers.sql +++ /dev/null @@ -1,11 +0,0 @@ -DELIMITER $$ -$$ -CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`creditInsurance_beforeInsert` - BEFORE INSERT ON `creditInsurance` - FOR EACH ROW -BEGIN - IF NEW.creditClassificationFk THEN - SET NEW.creditClassification = NEW.creditClassificationFk; - END IF; -END$$ -DELIMITER ; \ No newline at end of file diff --git a/db/changes/10470-family/01-tableConfig.sql b/db/changes/10470-family/01-tableConfig.sql deleted file mode 100644 index 685981d90..000000000 --- a/db/changes/10470-family/01-tableConfig.sql +++ /dev/null @@ -1 +0,0 @@ -RENAME TABLE `edi`.`fileConfig` to `edi`.`tableConfig`; \ No newline at end of file diff --git a/db/changes/10470-family/02-fileConfig.sql b/db/changes/10470-family/02-fileConfig.sql deleted file mode 100644 index 3109a4616..000000000 --- a/db/changes/10470-family/02-fileConfig.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE `edi`.`fileConfig` -( - name varchar(25) NOT NULL, - checksum text NULL, - keyValue tinyint(1) default true NOT NULL, - constraint fileConfig_pk - primary key (name) -); - -create unique index fileConfig_name_uindex - on `edi`.`fileConfig` (name); - - -INSERT INTO `edi`.`fileConfig` (name, checksum, keyValue) -VALUES ('FEC010104', null, 0); - -INSERT INTO `edi`.`fileConfig` (name, checksum, keyValue) -VALUES ('VBN020101', null, 1); - -INSERT INTO `edi`.`fileConfig` (name, checksum, keyValue) -VALUES ('florecompc2', null, 1); - diff --git a/db/changes/10480-june/00-ACL.sql b/db/changes/10480-june/00-ACL.sql deleted file mode 100644 index 3236ff1fd..000000000 --- a/db/changes/10480-june/00-ACL.sql +++ /dev/null @@ -1,4 +0,0 @@ -INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId) - VALUES - ('Client','setPassword','WRITE','ALLOW','ROLE','salesPerson'), - ('Client','updateUser','WRITE','ALLOW','ROLE','salesPerson'); diff --git a/db/changes/230202/00-itemConfig.sql b/db/changes/230202/00-itemConfig.sql new file mode 100644 index 000000000..0b32d5de8 --- /dev/null +++ b/db/changes/230202/00-itemConfig.sql @@ -0,0 +1,5 @@ +ALTER TABLE `vn`.`itemConfig` ADD defaultTag INT DEFAULT 56 NOT NULL; +ALTER TABLE `vn`.`itemConfig` ADD CONSTRAINT itemConfig_FK FOREIGN KEY (defaultTag) REFERENCES vn.tag(id); +ALTER TABLE `vn`.`itemConfig` ADD validPriorities varchar(50) DEFAULT '[1,2,3]' NOT NULL; +ALTER TABLE `vn`.`itemConfig` ADD defaultPriority INT DEFAULT 2 NOT NULL; +ALTER TABLE `vn`.`item` MODIFY COLUMN relevancy tinyint(1) DEFAULT 0 NOT NULL COMMENT 'La web ordena de forma descendiente por este campo para mostrar los artículos'; diff --git a/db/changes/230401/00-ACL_tag_update.sql b/db/changes/230401/00-ACL_tag_update.sql new file mode 100644 index 000000000..3c103e990 --- /dev/null +++ b/db/changes/230401/00-ACL_tag_update.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Tag', 'onSubmit', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/230401/00-createWorker.sql b/db/changes/230401/00-createWorker.sql new file mode 100644 index 000000000..7ca2c41ee --- /dev/null +++ b/db/changes/230401/00-createWorker.sql @@ -0,0 +1,24 @@ +UPDATE `salix`.`ACL` +SET accessType='READ' +WHERE model='Worker' + AND property='*' + AND accessType='*' + AND permission='ALLOW' + AND principalType='ROLE' + AND principalId='employee'; + + +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Worker', 'updateAttributes', 'WRITE', 'ALLOW', 'ROLE', 'hr'), + ('Worker', 'createAbsence', '*', 'ALLOW', 'ROLE', 'employee'), + ('Worker', 'updateAbsence', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('Worker', 'deleteAbsence', '*', 'ALLOW', 'ROLE', 'employee'), + ('Worker', 'new', 'WRITE', 'ALLOW', 'ROLE', 'hr'), + ('Role', '*', 'READ', 'ALLOW', 'ROLE', 'hr'); + +ALTER TABLE `vn`.`workerConfig` ADD roleFk int(10) unsigned NOT NULL COMMENT 'Rol por defecto al dar de alta un trabajador nuevo'; +UPDATE `vn`.`workerConfig` + SET roleFk = 1 + WHERE id = 1; + diff --git a/db/changes/230401/00-ticket_canAdvance.sql b/db/changes/230401/00-ticket_canAdvance.sql new file mode 100644 index 000000000..fd9d451bf --- /dev/null +++ b/db/changes/230401/00-ticket_canAdvance.sql @@ -0,0 +1,110 @@ +DROP PROCEDURE IF EXISTS vn.ticket_canAdvance; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT) +BEGIN +/** + * Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar. + * + * @param vDateFuture Fecha de los tickets que se quieren adelantar. + * @param vDateToAdvance Fecha a cuando se quiere adelantar. + * @param vWarehouseFk Almacén + */ + + DECLARE vDateInventory DATE; + + SELECT inventoried INTO vDateInventory FROM vn.config; + + 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 < vDateFuture + AND warehouseFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM vn.itemEntryIn + WHERE landed >= vDateInventory + AND landed < vDateFuture + AND isVirtualStock = FALSE + AND warehouseInFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM vn.itemEntryOut + WHERE shipped >= vDateInventory + AND shipped < vDateFuture + AND warehouseOutFk = vWarehouseFk + ) t + GROUP BY itemFk HAVING amount != 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.filter; + CREATE TEMPORARY TABLE tmp.filter + (INDEX (id)) + SELECT s.ticketFk futureId, + t2.ticketFk id, + count(DISTINCT s.id) saleCount, + t2.state, + t2.isNotValidated, + st.name futureState, + st.isNotValidated futureIsNotValidated, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt, + t2.ipt, + t.workerFk, + CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters, + CAST(COUNT(*) AS DECIMAL(10,0)) `futureLines`, + t2.shipped, + t.shipped futureShipped, + t2.totalWithVat, + t.totalWithVat futureTotalWithVat, + t2.agency, + am.name futureAgency, + t2.lines, + t2.liters, + SUM((s.quantity <= IFNULL(st.amount,0))) hasStock + FROM vn.ticket t + JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.state st ON st.id = ts.stateFk + JOIN vn.saleVolume sv ON t.id = sv.ticketFk + JOIN (SELECT + t2.id ticketFk, + t2.addressFk, + st.isNotValidated, + st.name state, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt, + t2.shipped, + t2.totalWithVat, + am.name agency, + CAST(SUM(litros) AS DECIMAL(10,0)) liters, + CAST(COUNT(*) AS DECIMAL(10,0)) `lines` + FROM vn.ticket t2 + JOIN vn.saleVolume sv ON t2.id = sv.ticketFk + 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 + JOIN vn.agencyMode am ON t2.agencyModeFk = am.id + LEFT JOIN vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + 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 + JOIN vn.agencyMode am ON t.agencyModeFk = am.id + LEFT JOIN vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + LEFT JOIN tmp.stock st ON st.itemFk = s.itemFk + WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture) + AND t.warehouseFk = vWarehouseFk + GROUP BY t.id; + + DROP TEMPORARY TABLE tmp.stock; +END$$ +DELIMITER ; diff --git a/db/changes/230401/00-updateIsToBeMailed.sql b/db/changes/230401/00-updateIsToBeMailed.sql new file mode 100644 index 000000000..1bb177f57 --- /dev/null +++ b/db/changes/230401/00-updateIsToBeMailed.sql @@ -0,0 +1,6 @@ +UPDATE `vn`.`client` + SET isToBeMailed = FALSE + WHERE + mailAddress is NULL + AND email is NULL + AND isToBeMailed = TRUE; diff --git a/db/changes/230403/00-clienteCompensado.sql b/db/changes/230403/00-clienteCompensado.sql new file mode 100644 index 000000000..ff1982b93 --- /dev/null +++ b/db/changes/230403/00-clienteCompensado.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Client', 'getClientOrSupplierReference', 'READ', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/230404/00-ticket_canAdvance.sql b/db/changes/230404/00-ticket_canAdvance.sql new file mode 100644 index 000000000..d7386e9d1 --- /dev/null +++ b/db/changes/230404/00-ticket_canAdvance.sql @@ -0,0 +1,127 @@ +DROP PROCEDURE IF EXISTS `vn`.`ticket_canAdvance`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT) +BEGIN +/** + * Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar. + * + * @param vDateFuture Fecha de los tickets que se quieren adelantar. + * @param vDateToAdvance Fecha a cuando se quiere adelantar. + * @param vWarehouseFk Almacén + */ + + DECLARE vDateInventory DATE; + + SELECT inventoried INTO vDateInventory FROM config; + + 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 itemTicketOut + WHERE shipped >= vDateInventory + AND shipped < vDateFuture + AND warehouseFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM itemEntryIn + WHERE landed >= vDateInventory + AND landed < vDateFuture + AND isVirtualStock = FALSE + AND warehouseInFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM itemEntryOut + WHERE shipped >= vDateInventory + AND shipped < vDateFuture + AND warehouseOutFk = vWarehouseFk + ) t + GROUP BY itemFk HAVING amount != 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.filter; + CREATE TEMPORARY TABLE tmp.filter + (INDEX (id)) + + SELECT + origin.ticketFk futureId, + dest.ticketFk id, + dest.state, + origin.futureState, + origin.futureIpt, + dest.ipt, + origin.workerFk, + origin.futureLiters, + origin.futureLines, + dest.shipped, + origin.shipped futureShipped, + dest.totalWithVat, + origin.totalWithVat futureTotalWithVat, + dest.agency, + origin.futureAgency, + dest.lines, + dest.liters, + origin.futureLines - origin.hasStock AS notMovableLines, + (origin.futureLines = origin.hasStock) AS isFullMovable + FROM ( + SELECT + s.ticketFk, + t.workerFk, + t.shipped, + t.totalWithVat, + st.name futureState, + t.addressFk, + am.name futureAgency, + count(s.id) futureLines, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt, + CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters, + SUM((s.quantity <= IFNULL(st.amount,0))) hasStock + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN saleVolume sv ON sv.saleFk = s.id + JOIN item i ON i.id = s.itemFk + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN state st ON st.id = ts.stateFk + JOIN agencyMode am ON t.agencyModeFk = am.id + LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + LEFT JOIN tmp.stock st ON st.itemFk = i.id + WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture) + AND t.warehouseFk = vWarehouseFk + GROUP BY t.id + ) origin + JOIN ( + SELECT + t.id ticketFk, + t.addressFk, + st.name state, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt, + t.shipped, + t.totalWithVat, + am.name agency, + CAST(SUM(litros) AS DECIMAL(10,0)) liters, + CAST(COUNT(*) AS DECIMAL(10,0)) `lines` + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN saleVolume sv ON sv.saleFk = s.id + JOIN item i ON i.id = s.itemFk + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN state st ON st.id = ts.stateFk + JOIN agencyMode am ON t.agencyModeFk = am.id + LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + WHERE t.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance) + AND t.warehouseFk = vWarehouseFk + AND st.order <= 5 + GROUP BY t.id + ) dest ON dest.addressFk = origin.addressFk + WHERE origin.hasStock != 0; + + DROP TEMPORARY TABLE tmp.stock; +END$$ +DELIMITER ; diff --git a/db/changes/230601/00-acl_claim.sql b/db/changes/230601/00-acl_claim.sql new file mode 100644 index 000000000..4e680eb4f --- /dev/null +++ b/db/changes/230601/00-acl_claim.sql @@ -0,0 +1,6 @@ +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES('ClaimBeginning', 'isEditable', 'READ', 'ALLOW', 'ROLE', 'employee'); + +DELETE FROM `salix`.`ACL` + WHERE model='Claim' AND property='isEditable'; + diff --git a/db/changes/230601/00-acl_notifications.sql b/db/changes/230601/00-acl_notifications.sql new file mode 100644 index 000000000..ab40b16a5 --- /dev/null +++ b/db/changes/230601/00-acl_notifications.sql @@ -0,0 +1,4 @@ +INSERT INTO `salix`.`ACL` (model,property,accessType,principalId) + VALUES + ('NotificationSubscription','*','*','employee'), + ('NotificationAcl','*','READ','employee'); diff --git a/db/changes/230601/00-itemConfig_warehouseFk.sql b/db/changes/230601/00-itemConfig_warehouseFk.sql new file mode 100644 index 000000000..c860986d6 --- /dev/null +++ b/db/changes/230601/00-itemConfig_warehouseFk.sql @@ -0,0 +1,4 @@ +ALTER TABLE `vn`.`itemConfig` ADD warehouseFk smallint(6) unsigned NULL; +UPDATE `vn`.`itemConfig` + SET warehouseFk=60 +WHERE id=0; diff --git a/db/changes/230601/00-uniqueKeyNotificationSubscription.sql b/db/changes/230601/00-uniqueKeyNotificationSubscription.sql new file mode 100644 index 000000000..623ecf770 --- /dev/null +++ b/db/changes/230601/00-uniqueKeyNotificationSubscription.sql @@ -0,0 +1,4 @@ +ALTER TABLE + `util`.`notificationSubscription` +ADD + CONSTRAINT `notificationSubscription_UN` UNIQUE KEY (`notificationFk`, `userFk`); \ No newline at end of file diff --git a/db/changes/230601/01-alter_notSubs.sql b/db/changes/230601/01-alter_notSubs.sql new file mode 100644 index 000000000..07ea7c2bf --- /dev/null +++ b/db/changes/230601/01-alter_notSubs.sql @@ -0,0 +1,7 @@ +ALTER TABLE `util`.`notificationSubscription` +ADD `id` int(11) auto_increment NULL, +DROP PRIMARY KEY, +ADD CONSTRAINT PRIMARY KEY (`id`); + +ALTER TABLE `util`.`notificationSubscription` +ADD KEY `notificationSubscription_ibfk_1` (`notificationFk`); diff --git a/db/changes/230801/00-acl_itemConfig.sql b/db/changes/230801/00-acl_itemConfig.sql new file mode 100644 index 000000000..8c35022b4 --- /dev/null +++ b/db/changes/230801/00-acl_itemConfig.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('ItemConfig', '*', '*', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/230801/00-supplierIsVies.sql b/db/changes/230801/00-supplierIsVies.sql new file mode 100644 index 000000000..5861e7615 --- /dev/null +++ b/db/changes/230801/00-supplierIsVies.sql @@ -0,0 +1,16 @@ +ALTER TABLE `vn`.`supplier` ADD `isVies` tinyint(4) DEFAULT 0 NOT NULL; + +UPDATE `vn`.`supplier` s + JOIN vn.country c ON c.id = s.countryFk + SET s.nif = MID(s.nif, 3, LENGTH(s.nif)-1), s.isVies = TRUE +WHERE s.nif <> TRIM(IF(c.code = LEFT(s.nif, 2), MID(s.nif, 3, LENGTH(s.nif)-1), s.nif)); + +INSERT IGNORE INTO `vn`.`chat` +(senderFk, recipient, checkUserStatus, message, status, attempts) +VALUES(19263, '#informatica-cau', 0, ' +``` +UPDATE `vn`.`supplier` s + JOIN vn.country c ON c.id = s.countryFk + SET s.nif = MID(s.nif, 3, LENGTH(s.nif)-1), s.isVies = TRUE +WHERE s.nif <> TRIM(IF(c.code = LEFT(s.nif, 2), MID(s.nif, 3, LENGTH(s.nif)-1), s.nif)); +```', 0, 0); diff --git a/db/changes/230801/00-workerLocker.sql b/db/changes/230801/00-workerLocker.sql new file mode 100644 index 000000000..0a72cca1e --- /dev/null +++ b/db/changes/230801/00-workerLocker.sql @@ -0,0 +1,15 @@ +ALTER TABLE `vn`.`worker` ADD locker INT UNSIGNED NULL UNIQUE; +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('DeviceProduction', '*', '*', 'ALLOW', 'ROLE', 'hr'), + ('DeviceProductionModels', '*', '*', 'ALLOW', 'ROLE', 'hr'), + ('DeviceProductionState', '*', '*', 'ALLOW', 'ROLE', 'hr'), + ('DeviceProductionUser', '*', '*', 'ALLOW', 'ROLE', 'hr'), + ('DeviceProduction', '*', '*', 'ALLOW', 'ROLE', 'productionAssi'), + ('DeviceProductionModels', '*', '*', 'ALLOW', 'ROLE', 'productionAssi'), + ('DeviceProductionState', '*', '*', 'ALLOW', 'ROLE', 'productionAssi'), + ('DeviceProductionUser', '*', '*', 'ALLOW', 'ROLE', 'productionAssi'), + ('Worker', 'deallocatePDA', '*', 'ALLOW', 'ROLE', 'hr'), + ('Worker', 'allocatePDA', '*', 'ALLOW', 'ROLE', 'hr'), + ('Worker', 'deallocatePDA', '*', 'ALLOW', 'ROLE', 'productionAssi'), + ('Worker', 'allocatePDA', '*', 'ALLOW', 'ROLE', 'productionAssi'); diff --git a/db/changes/230801/01-sage_supplierAdd.sql b/db/changes/230801/01-sage_supplierAdd.sql new file mode 100644 index 000000000..66cb0aff1 --- /dev/null +++ b/db/changes/230801/01-sage_supplierAdd.sql @@ -0,0 +1,127 @@ +DROP PROCEDURE IF EXISTS `sage`.`clientSupplier_add`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `sage`.`clientSupplier_add`(vCompanyFk INT) +BEGIN +/** + * Prepara los datos de clientes y proveedores para exportarlos a Sage + * @vCompanyFk Empresa dela que se quiere trasladar datos + */ + DECLARE vCountryCeutaMelillaFk INT; + DECLARE vCountryCanariasCode, vCountryCeutaMelillaCode VARCHAR(2); + + SELECT SiglaNacion INTO vCountryCanariasCode + FROM Naciones + WHERE Nacion ='ISLAS CANARIAS'; + + SELECT CodigoNacion, SiglaNacion INTO vCountryCeutaMelillaFk, vCountryCeutaMelillaCode + FROM Naciones + WHERE Nacion ='CEUTA Y MELILLA'; + + TRUNCATE TABLE clientesProveedores; + + INSERT INTO clientesProveedores + (CodigoEmpresa, + ClienteOProveedor, + CodigoClienteProveedor, + RazonSocial, + Nombre, + Domicilio, + CodigoCuenta, + CifDni, + CifEuropeo, + CodigoPostal, + Municipio, + CodigoProvincia, + Provincia, + CodigoNacion, + SiglaNacion, + PersonaFisicaJuridica, + TipoDocumentoPersona, + CodigoIva, + Nacion, + Telefono, + Telefono2, + CodigoTransaccion, + CodigoRetencion, + Email1, + iban) + SELECT + company_getCode(vCompanyFk), + 'C', + c.id, + c.socialName, + c.socialName, + IFNULL(c.street, ''), + c.accountingAccount, + TRIM(IF(c.isVies, CONCAT(cu.code,c.fi), c.fi)), + IF(n.NacionCEE,TRIM(IF(cu.code = LEFT(c.fi, 2), c.fi, CONCAT(cu.code,c.fi))) , ''), + IFNULL(c.postcode, ''), + IFNULL(c.city, ''), + IFNULL(pr.CodigoProvincia, ''), + IFNULL(p.name, ''), + IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci, IF(@isCeutaMelilla := IF(pr.Provincia IN ('CEUTA', 'MELILLA'), TRUE, FALSE), vCountryCeutaMelillaFk, IF (@isCanarias, vCountryCanariasCode, n.CodigoNacion)), n.CodigoNacion), + IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci, IF(@isCeutaMelilla, vCountryCeutaMelillaCode, IF (@isCanarias, vCountryCanariasCode, n.SiglaNacion)), n.SiglaNacion), + IF((c.fi REGEXP '^([[:blank:]]|[[:digit:]])'), 'J','F'), + IF(cu.code IN('ES','EX'), + 1, + IF((cu.isUeeMember AND c.isVies), 2, 4)), + IFNULL(c.taxTypeSageFk,0), + IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci, + IF(@isCeutaMelilla, 'CEUTA Y MELILLA', IF (@isCanarias, 'ISLAS CANARIAS', n.Nacion)), + n.Nacion), + IFNULL(c.phone, ''), + IFNULL(c.mobile, ''), + IFNULL(c.transactionTypeSageFk, 0), + '0', + IFNULL(SUBSTR(c.email, 1, LOCATE(',', CONCAT(c.email, ','))-1), ''), + IFNULL(c.iban, '') + FROM vn.`client` c + JOIN clientLastTwoMonths clm ON clm.clientFk = c.id + LEFT JOIN vn.country cu ON cu.id = c.countryFk + LEFT JOIN Naciones n ON n.countryFk = cu.id + LEFT JOIN vn.province p ON p.id = c.provinceFk + LEFT JOIN Provincias pr ON pr.provinceFk = p.id + WHERE c.isRelevant + AND clm.companyFk = vCompanyFk + UNION ALL + SELECT company_getCode(vCompanyFk), + 'P', + s.id, + s.name, + s.name, + IFNULL(s.street, ''), + s.account, + TRIM(IF(s.isVies, CONCAT(co.code,s.nif), s.nif)), + IF(n.NacionCEE, TRIM(CONCAT(co.code, IF(co.code = LEFT(s.nif, 2), MID(s.nif, 3, LENGTH(s.nif) - 1), s.nif))), ''), + IFNULL(s.postCode,''), + IFNULL(s.city, ''), + IFNULL(pr.CodigoProvincia, ''), + IFNULL(p.name, ''), + n.CodigoNacion, + n.SiglaNacion COLLATE utf8mb3_unicode_ci, + IF((s.nif REGEXP '^([[:blank:]]|[[:digit:]])'),'J','F'), + IF(co.country IN ('España', 'España exento'), 1,IF(co.isUeeMember = 1, 2, 4)), + IFNULL(s.taxTypeSageFk, 0), + n.Nacion, + IFNULL(sc.phone, ''), + IFNULL(sc.mobile, ''), + IFNULL(s.transactionTypeSageFk, 0), + IFNULL(s.withholdingSageFk, '0'), + IFNULL(SUBSTR(sc.email, 1, (COALESCE(NULLIF(LOCATE(',', sc.email), 0), 99) - 1)), ''), + IFNULL(iban, '') + FROM vn.supplier s + JOIN supplierLastThreeMonths pl ON pl.supplierFk = s.id + LEFT JOIN vn.country co ON co.id = s.countryFk + LEFT JOIN Naciones n ON n.countryFk = co.id + LEFT JOIN vn.province p ON p.id = s.provinceFk + LEFT JOIN Provincias pr ON pr.provinceFk = p.id + LEFT JOIN vn.supplierContact sc ON sc.supplierFk = s.id + LEFT JOIN vn.supplierAccount sa ON sa.supplierFk = s.id + WHERE pl.companyFk = vCompanyFk AND + s.isActive AND + s.nif <> '' + GROUP BY pl.supplierFk, pl.companyFk; +END$$ +DELIMITER ; diff --git a/db/changes/231001/00-delivery.sql b/db/changes/231001/00-delivery.sql new file mode 100644 index 000000000..3a9269183 --- /dev/null +++ b/db/changes/231001/00-delivery.sql @@ -0,0 +1,74 @@ +DROP TABLE `vn`.`dmsRecover`; + +ALTER TABLE `vn`.`delivery` DROP FOREIGN KEY delivery_FK; +ALTER TABLE `vn`.`delivery` DROP COLUMN addressFk; +ALTER TABLE `vn`.`delivery` ADD ticketFk INT NOT NULL; +ALTER TABLE `vn`.`delivery` ADD CONSTRAINT delivery_ticketFk_FK FOREIGN KEY (`ticketFk`) REFERENCES `vn`.`ticket`(`id`); + +DELETE FROM `salix`.`ACL` WHERE `property` = 'saveSign'; +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`) + VALUES + ('Ticket','saveSign','WRITE','ALLOW','employee'); + +DROP PROCEDURE IF EXISTS vn.route_getTickets; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`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 Id, + t.clientFk Client, + a.id Address, + t.packages Packages, + a.street AddressName, + a.postalCode PostalCode, + a.city City, + sub2.itemPackingTypeFk PackingType, + c.phone ClientPhone, + c.mobile ClientMobile, + a.phone AddressPhone, + a.mobile AddressMobile, + d.longitude Longitude, + d.latitude Latitude, + wm.mediaValue SalePersonPhone, + tob.Note Note, + t.isSigned Signed + FROM ticket t + JOIN client c ON t.clientFk = c.id + JOIN address a ON t.addressFk = a.id + LEFT JOIN delivery d ON t.id = d.ticketFk + LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk + LEFT JOIN + (SELECT tob.description 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 + (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 ; diff --git a/db/changes/231001/00-invoiceOut.sql b/db/changes/231001/00-invoiceOut.sql new file mode 100644 index 000000000..4404c8f4a --- /dev/null +++ b/db/changes/231001/00-invoiceOut.sql @@ -0,0 +1,6 @@ +ALTER TABLE vn.invoiceOutSerial + ADD `type` ENUM('global', 'quick') DEFAULT NULL NULL; + + UPDATE vn.invoiceOutSerial + SET type = 'global' + WHERE code IN ('A','V'); \ No newline at end of file diff --git a/db/changes/231001/00-invoiceOut_getWeight.sql b/db/changes/231001/00-invoiceOut_getWeight.sql new file mode 100644 index 000000000..3f34b6fb7 --- /dev/null +++ b/db/changes/231001/00-invoiceOut_getWeight.sql @@ -0,0 +1,32 @@ +DROP FUNCTION IF EXISTS `vn`.`invoiceOut_getWeight`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` FUNCTION `vn`.`invoiceOut_getWeight`( + vInvoiceRef VARCHAR(15) +)RETURNS decimal(10,2) + READS SQL DATA +BEGIN +/** + * Calcula el peso de una factura emitida + * + * @param vInvoiceRef referencia de la factura + * @return vTotalWeight peso de la factura + */ + DECLARE vTotalWeight DECIMAL(10,2); + + SELECT SUM(CAST(IFNULL(i.stems, 1) + * s.quantity + * IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000 AS DECIMAL(10,2))) + INTO vTotalWeight + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN itemCost ic ON ic.itemFk = i.id + AND ic.warehouseFk = t.warehouseFk + WHERE t.refFk = vInvoiceRef + AND i.intrastatFk; + + RETURN vTotalWeight; +END$$ +DELIMITER ; diff --git a/db/changes/231001/00-report.sql b/db/changes/231001/00-report.sql new file mode 100644 index 000000000..0bc7c8da4 --- /dev/null +++ b/db/changes/231001/00-report.sql @@ -0,0 +1,6 @@ +UPDATE `vn`.`report` + SET `method`='InvoiceOuts/{refFk}/invoice-out-pdf' +WHERE name='invoice'; + +ALTER TABLE `vn`.`printQueue` MODIFY COLUMN printerFk tinyint(3) unsigned DEFAULT 82 NOT NULL; + diff --git a/db/changes/231001/01-invoiceOut_getMaxIssued.sql b/db/changes/231001/01-invoiceOut_getMaxIssued.sql new file mode 100644 index 000000000..e120b949d --- /dev/null +++ b/db/changes/231001/01-invoiceOut_getMaxIssued.sql @@ -0,0 +1,34 @@ +DROP FUNCTION IF EXISTS `vn`.`invoiceOut_getMaxIssued`; + +DELIMITER $$ +$$ +CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`invoiceOut_getMaxIssued`( + vSerial VARCHAR(2), + vCompanyFk INT, + vYear INT +) RETURNS DATE + READS SQL DATA +BEGIN +/** + * Retorna la fecha a partir de la cual es válido emitir una factura + * + * @param vSerial Serie de facturación + * @param vCompanyFk Empresa factura emitida + * @param vYear Año contable + * @return vInvoiceOutIssued fecha factura válida + */ + DECLARE vInvoiceOutIssued DATE; + DECLARE vFirstDayOfYear DATE; + + SET vFirstDayOfYear := MAKEDATE(vYear, 1); + + SELECT IFNULL(MAX(io.issued), vFirstDayOfYear) INTO vInvoiceOutIssued + FROM invoiceOut io + WHERE io.serial = vSerial + AND io.companyFk = vCompanyFk + AND io.issued BETWEEN vFirstDayOfYear + AND util.lastDayOfYear(vFirstDayOfYear); + + RETURN vInvoiceOutIssued; +END$$ +DELIMITER ; \ No newline at end of file diff --git a/db/changes/231001/02-invoiceOut_new.sql b/db/changes/231001/02-invoiceOut_new.sql new file mode 100644 index 000000000..0fd91ef58 --- /dev/null +++ b/db/changes/231001/02-invoiceOut_new.sql @@ -0,0 +1,258 @@ +DROP PROCEDURE IF EXISTS `vn`.`invoiceOut_new`; + +DELIMITER $$ +$$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOut_new`( + vSerial VARCHAR(255), + vInvoiceDate DATE, + 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 vIsAnySaleToInvoice BOOL; + DECLARE vIsAnyServiceToInvoice BOOL; + DECLARE vNewRef VARCHAR(255); + DECLARE vWorker INT DEFAULT account.myUser_getId(); + DECLARE vCompanyFk INT; + DECLARE vInterCompanyFk INT; + DECLARE vClientFk 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 vNewInvoiceInFk INT; + DECLARE vIsInterCompany BOOL DEFAULT FALSE; + DECLARE vIsCEESerial BOOL DEFAULT FALSE; + DECLARE vIsCorrectInvoiceDate BOOL; + DECLARE vMaxShipped DATE; + + SET vInvoiceDate = IFNULL(vInvoiceDate, util.CURDATE()); + + SELECT t.clientFk, + t.companyFk, + MAX(DATE(t.shipped)), + DATE(vInvoiceDate) >= invoiceOut_getMaxIssued( + vSerial, + t.companyFk, + YEAR(vInvoiceDate)) + INTO vClientFk, + vCompanyFk, + vMaxShipped, + vIsCorrectInvoiceDate + FROM ticketToInvoice tt + JOIN ticket t ON t.id = tt.id; + + IF(vMaxShipped > vInvoiceDate) THEN + CALL util.throw("Invoice date can't be less than max date"); + END IF; + + IF NOT vIsCorrectInvoiceDate THEN + CALL util.throw('Exists an invoice with a previous date'); + END IF; + + -- 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 sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN supplier su ON su.id = t.companyFk + JOIN client c ON c.id = t.clientFk + LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = su.countryFk + WHERE (YEAR(t.shipped) < 2001 AND t.isDeleted) + OR c.isTaxDataChecked = FALSE + OR t.isDeleted + OR c.hasToInvoice = FALSE + OR itc.id IS NULL; + + SELECT SUM(s.quantity * s.price * (100 - s.discount)/100) <> 0 + INTO vIsAnySaleToInvoice + FROM ticketToInvoice t + JOIN sale s ON s.ticketFk = t.id; + + SELECT COUNT(*) > 0 INTO vIsAnyServiceToInvoice + FROM ticketToInvoice t + 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, + vClientFk, + getDueDate(vInvoiceDate, dueDay), + vCompanyFk, + IF(vSerial = vCorrectingSerial, + vCplusCorrectingInvoiceTypeFk, + IF(vSerial = vSimplifiedSerial, + vCplusSimplifiedInvoiceTypeFk, + vCplusStandardInvoiceTypeFk)) + FROM client + WHERE id = vClientFk; + + 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 ticketState ts ON ti.id = ts.ticket + JOIN state s + WHERE IFNULL(ts.alertLevel,0) < 3 and s.`code` = getAlert3State(ti.id); + + INSERT INTO ticketTracking(stateFk,ticketFk,workerFk) + SELECT * FROM tmp.updateInter; + + INSERT INTO ticketLog (action, userFk, originFk, description) + SELECT 'UPDATE', account.myUser_getId(), ti.id, CONCAT('Crea factura ', vNewRef) + FROM ticketToInvoice ti; + + CALL invoiceExpenceMake(vNewInvoiceId); + CALL invoiceTaxMake(vNewInvoiceId,vTaxArea); + + UPDATE invoiceOut io + JOIN ( + SELECT SUM(amount) total + FROM invoiceOutExpence + WHERE invoiceOutFk = vNewInvoiceId + ) base + JOIN ( + SELECT SUM(vat) total + FROM invoiceOutTax + WHERE invoiceOutFk = vNewInvoiceId + ) vat + SET io.amount = base.total + vat.total + WHERE io.id = vNewInvoiceId; + + DROP TEMPORARY TABLE tmp.updateInter; + + SELECT COUNT(*), id + INTO vIsInterCompany, vInterCompanyFk + FROM company + WHERE clientFk = vClientFk; + + IF (vIsInterCompany) THEN + + INSERT INTO invoiceIn(supplierFk, supplierRef, issued, companyFk) + SELECT vCompanyFk, vNewRef, vInvoiceDate, vInterCompanyFk; + + SET vNewInvoiceInFk = 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 invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) + SELECT vNewInvoiceInFk, + @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 invoiceOutTaxConfig i ON i.taxClassCodeFk = tst.code + WHERE i.isService + HAVING taxableBase + ) sub; + + INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) + SELECT vNewInvoiceInFk, + SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral, + @vTaxableBaseServices, 0) taxableBase, + i.expenceFk, + i.taxTypeSageFk , + i.transactionTypeSageFk + FROM tmp.ticketTax tt + JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tt.code + WHERE !i.isService + GROUP BY tt.pgcFk + HAVING taxableBase + ORDER BY tt.priority; + + CALL invoiceInDueDay_calculate(vNewInvoiceInFk); + + SELECT COUNT(*) INTO vIsCEESerial + FROM invoiceOutSerial + WHERE code = vSerial; + + IF vIsCEESerial THEN + + INSERT INTO invoiceInIntrastat ( + invoiceInFk, + intrastatFk, + amount, + stems, + countryFk, + net) + SELECT + vNewInvoiceInFk, + i.intrastatFk, + SUM(CAST((s.quantity * s.price * (100 - s.discount) / 100 ) AS DECIMAL(10, 2))), + SUM(CAST(IFNULL(i.stems, 1) * s.quantity AS DECIMAL(10, 2))), + su.countryFk, + CAST(SUM(IFNULL(i.stems, 1) + * s.quantity + * IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000) AS DECIMAL(10, 2)) + FROM sale s + JOIN ticket t ON s.ticketFk = t.id + JOIN supplier su ON su.id = t.companyFk + JOIN item i ON i.id = s.itemFk + LEFT JOIN itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk + WHERE t.refFk = vNewRef + GROUP BY i.intrastatFk; + + END IF; + 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 ; \ No newline at end of file diff --git a/db/changes/231001/03-ticketPackaging_add.sql b/db/changes/231001/03-ticketPackaging_add.sql new file mode 100644 index 000000000..a7cf1d1d3 --- /dev/null +++ b/db/changes/231001/03-ticketPackaging_add.sql @@ -0,0 +1,141 @@ +DROP PROCEDURE IF EXISTS `vn`.`ticketPackaging_add`; + +DELIMITER $$ +$$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketPackaging_add`( + vClientFk INT, + vDated DATE, + vCompanyFk INT, + vWithoutPeriodGrace BOOLEAN) +BEGIN +/** + * Genera nuevos tickets de embalajes para los clientes no han los han retornado + * y actualiza los valores para la tabla ticketPackaging + * + * @param vClientFk Cliente en caso de NULL todos los clientes + * @param vDated Fecha hasta la cual se revisan los embalajes + * @param vCompanyFk Empresa de la cual se comprobaran sus clientes + * @param vWithoutPeriodGrace si no se aplica el periodo de gracia de un mes + */ + DECLARE vNewTicket INT; + DECLARE vDateStart DATE; + DECLARE vDateEnd DATE; + DECLARE vGraceDate DATE DEFAULT vDated; + DECLARE vWarehouseInventory INT; + DECLARE vComponentCost INT; + DECLARE vDone INT DEFAULT FALSE; + DECLARE vClientId INT; + + DECLARE vCursor CURSOR FOR + SELECT DISTINCT clientFk + FROM ( + SELECT clientFk, SUM(quantity) totalQuantity + FROM tmp.packagingToInvoice + GROUP BY itemFk, clientFk + HAVING totalQuantity > 0)sub; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + SELECT id INTO vWarehouseInventory + FROM warehouse + WHERE `code`= 'inv'; + + SELECT id INTO vComponentCost + FROM component + WHERE `code`= 'purchaseValue'; + + SELECT packagingInvoicingDated INTO vDateStart + FROM ticketConfig; + + IF vWarehouseInventory IS NULL THEN + CALL util.throw('Warehouse inventory not set'); + END IF; + + IF vComponentCost IS NULL THEN + CALL util.throw('Component cost not set'); + END IF; + + SET vDateEnd = vDated + INTERVAL 1 DAY; + + IF NOT vWithoutPeriodGrace THEN + SET vGraceDate = vGraceDate -INTERVAL 1 MONTH; + END IF; + + DROP TEMPORARY TABLE IF EXISTS tmp.packagingToInvoice; + CREATE TEMPORARY TABLE tmp.packagingToInvoice + (INDEX (clientFk)) + ENGINE = MEMORY + SELECT p.itemFk, + tp.packagingFk, + tp.quantity, + tp.ticketFk, + p.price, + t.clientFk + FROM ticketPackaging tp + JOIN packaging p ON p.id = tp.packagingFk + JOIN ticket t ON t.id = tp.ticketFk + JOIN client c ON c.id = t.clientFk + WHERE c.isActive + AND (vClientFk IS NULL OR t.clientFk = vClientFk) + AND t.shipped BETWEEN vDateStart AND vDateEnd + AND (tp.quantity < 0 OR (tp.quantity > 0 AND t.shipped < vGraceDate)) + AND tp.quantity + AND p.itemFk; + + OPEN vCursor; + l: LOOP + + FETCH vCursor INTO vClientId; + + IF vDone THEN + LEAVE l; + END IF; + + START TRANSACTION; + + CALL ticket_add( + vClientId, + vDateEnd, + vWarehouseInventory, + vCompanyFk, + NULL, + NULL, + NULL, + vDateEnd, + account.myUser_getId(), + TRUE, + vNewTicket); + + INSERT INTO ticketPackaging(ticketFk, packagingFk, quantity, pvp) + SELECT vNewTicket, packagingFk, - SUM(quantity) totalQuantity, price + FROM tmp.packagingToInvoice + WHERE clientFk = vClientId + GROUP BY packagingFk + HAVING IF(vWithoutPeriodGrace, totalQuantity <> 0, totalQuantity < 0); + + INSERT INTO sale(ticketFk, itemFk, concept, quantity, price) + SELECT vNewTicket, pti.itemFk, i.name, SUM(pti.quantity) totalQuantity, pti.price + FROM tmp.packagingToInvoice pti + JOIN item i ON i.id = pti.itemFk + WHERE pti.clientFk = vClientId + GROUP BY pti.itemFk + HAVING IF(vWithoutPeriodGrace, totalQuantity <> 0, totalQuantity > 0); + + INSERT INTO saleComponent(saleFk, componentFk, value) + SELECT id, vComponentCost, price + FROM sale + WHERE ticketFk = vNewTicket; + + COMMIT; + END LOOP; + CLOSE vCursor; + + DROP TEMPORARY TABLE tmp.packagingToInvoice; +END$$ +DELIMITER ; \ No newline at end of file diff --git a/db/changes/231201/00-ACL.sql b/db/changes/231201/00-ACL.sql new file mode 100644 index 000000000..47a818977 --- /dev/null +++ b/db/changes/231201/00-ACL.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) +VALUES ('Operator', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Operator', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/231201/00-chatRefactor.sql b/db/changes/231201/00-chatRefactor.sql new file mode 100644 index 000000000..66d1bf3bf --- /dev/null +++ b/db/changes/231201/00-chatRefactor.sql @@ -0,0 +1,16 @@ +ALTER TABLE `vn`.`chat` ADD statusNew enum('pending','sent','error','sending') DEFAULT 'pending' NOT NULL; + +UPDATE `vn`.`chat` + SET statusNew = 'pending' +WHERE status = 0; + +UPDATE `vn`.`chat` + SET statusNew = 'sent' +WHERE status = 1; + +UPDATE `vn`.`chat` + SET statusNew = 'error' +WHERE status = 2; + +ALTER TABLE `vn`.`chat` CHANGE status status__ tinyint(1) DEFAULT NULL NULL; +ALTER TABLE `vn`.`chat` CHANGE statusNew status enum('pending','sent','error','sending') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'pending' NOT NULL; diff --git a/db/changes/231201/00-invoiceInSerial.sql b/db/changes/231201/00-invoiceInSerial.sql new file mode 100644 index 000000000..de476027c --- /dev/null +++ b/db/changes/231201/00-invoiceInSerial.sql @@ -0,0 +1,4 @@ +ALTER TABLE `vn`.`invoiceInConfig` ADD daysAgo INT UNSIGNED DEFAULT 45 COMMENT 'Días en el pasado para mostrar facturas en invoiceIn series en salix'; +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('InvoiceIn', 'getSerial', 'READ', 'ALLOW', 'ROLE', 'administrative'); diff --git a/db/changes/231201/00-itemType_isFragile.sql b/db/changes/231201/00-itemType_isFragile.sql new file mode 100644 index 000000000..ecc1bfbb2 --- /dev/null +++ b/db/changes/231201/00-itemType_isFragile.sql @@ -0,0 +1,14 @@ +ALTER TABLE `vn`.`itemType` ADD isFragile tinyint(1) NULL; +ALTER TABLE `vn`.`itemType` MODIFY COLUMN isFragile tinyint(1) DEFAULT 0 NOT NULL; + +UPDATE `vn`.`itemType` + SET isFragile = 1 +WHERE code IN ('ZKA', 'ZKE'); + +UPDATE `vn`.`itemType` + SET isFragile = 1 +WHERE id IN (SELECT it.id + FROM `vn`.`itemCategory` ic + JOIN `vn`.`itemType` it ON it.categoryFk = ic.id + WHERE ic.code = 'plant'); + diff --git a/db/changes/231201/00-operator.sql b/db/changes/231201/00-operator.sql new file mode 100644 index 000000000..9b7815b41 --- /dev/null +++ b/db/changes/231201/00-operator.sql @@ -0,0 +1,159 @@ +ALTER TABLE `vn`.`operator` ADD sectorFk int(11) NULL; +ALTER TABLE `vn`.`operator` ADD labelerFk tinyint(3) unsigned NULL; +ALTER TABLE `vn`.`operator` ADD CONSTRAINT operator_FK_5 FOREIGN KEY (labelerFk) REFERENCES `vn`.`printer`(id) ON DELETE CASCADE ON UPDATE CASCADE; + +UPDATE `vn`.`operator` o +JOIN (SELECT id, sectorFk, labelerFk + FROM `vn`.`worker`) sub ON sub.id = o.workerFk + SET o.sectorFk = sub.sectorFk, + o.labelerFk = sub.labelerFk; + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_printSticker`( + vSelf INT, + vLabelCount INT +) +BEGIN +/** + * Prints a yellow label from a collection or a ticket + * + * @param vSelf collection or ticket + * @param vLabelCount number of times the collection has been printed + */ + DECLARE vPrintArgs JSON DEFAULT JSON_OBJECT('collectionOrTicketFk', vSelf); + + IF vLabelCount IS NULL THEN + INSERT INTO ticketTrolley + SELECT ticketFk, 1 + FROM ticketCollection + WHERE collectionFk = vSelf + ON DUPLICATE KEY UPDATE labelCount = labelCount + 1; + ELSE + SET vPrintArgs = JSON_MERGE_PATCH(vPrintArgs, JSON_OBJECT('labelCount', vLabelCount)); + END IF; + + CALL report_print( + 'LabelCollection', + (SELECT o.labelerFk FROM operator o WHERE o.workerFk = account.myUser_getId()), + account.myUser_getId(), + vPrintArgs, + 'high' + ); +END$$ +DELIMITER ; + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionPallet_printLabel`(vSelf INT) +BEGIN +/** + * Calls the report_print procedure and passes it + * the necessary parameters for printing. + * + * @param vSelf expeditioPallet id. + */ + DECLARE vPrinterFk INT; + DECLARE vUserFk INT DEFAULT account.myUser_getId(); + + SELECT o.labelerFk INTO vPrinterFk + FROM operator o + WHERE o.workerFk = vUserFk; + + CALL vn.report_print( + 'LabelPalletExpedition', + vPrinterFk, + account.myUser_getId(), + JSON_OBJECT('palletFk', vSelf, 'userFk', vUserFk), + 'high' + ); + + UPDATE vn.expeditionPallet + SET isPrint = TRUE + WHERE id = vSelf; +END$$ +DELIMITER ; + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_getAlternatives`(vShelvingFk VARCHAR(10)) +BEGIN +/** + * Devuelve un listado de posibles ubicaciones alternativas a ubicar los item de la matricula + * del carro que se le ha pasado. + * + * @param vShelvingFk matricula del carro + */ + SELECT is2.id,is2.shelvingFk , p.code, is2.itemFk , is2.visible, p.pickingOrder + FROM itemShelving is2 + JOIN shelving sh ON sh.code = is2.shelvingFk + JOIN parking p ON p.id = sh.parkingFk + JOIN sector s ON s.id = p.sectorFk + LEFT JOIN operator o ON o.sectorFk = s.id + LEFT JOIN worker w ON w.sectorFk = s.id AND w.id = account.myUser_getId() + JOIN warehouse wh ON wh.id = s.warehouseFk + JOIN itemShelving is3 ON is3.itemFk = is2.itemFk AND is3.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci + WHERE is2.shelvingFk <> vShelvingFk COLLATE utf8_unicode_ci + GROUP BY is2.id + ORDER BY p.pickingOrder DESC; +END$$ +DELIMITER ; + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`operator_beforeInsert` + BEFORE INSERT ON `operator` + FOR EACH ROW +BEGIN + CALL vn.printer_checkSector(NEW.labelerFk, NEW.sectorFk); +END$$ +DELIMITER ; + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`operator_beforeUpdate` + BEFORE UPDATE ON `operator` + FOR EACH ROW +BEGIN + IF NOT (NEW.labelerFk <=> OLD.labelerFk AND NEW.sectorFk <=> OLD.sectorFk) THEN + CALL vn.printer_checkSector(NEW.labelerFk, NEW.sectorFk); + END IF; +END$$ +DELIMITER ; + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`worker_beforeUpdate` + BEFORE UPDATE ON `worker` + FOR EACH ROW +BEGIN + IF NOT (NEW.labelerFk <=> OLD.labelerFk AND NEW.sectorFk <=> OLD.sectorFk) THEN + CALL vn.printer_checkSector(NEW.labelerFk, NEW.sectorFk); + + INSERT IGNORE INTO vn.operator (workerFk) + VALUES (NEW.id); + + UPDATE operator + SET labelerFk = NEW.labelerFk, + sectorFk = NEW.sectorFk + WHERE workerFk = NEW.id; + END IF; +END$$ +DELIMITER ; + +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn`.`operatorWorkerCode` +AS SELECT `o`.`workerFk` AS `workerFk`, + concat(`w`.`firstName`, ' ', `w`.`lastName`) AS `fullName`, + `w`.`code` AS `code`, + `o`.`numberOfWagons` AS `numberOfWagons` +FROM ( + ( + `vn`.`worker` `w` + JOIN `vn`.`operator` `o` ON(`o`.`workerFk` = `w`.`id`) + ) + JOIN `vn`.`sector` `s` ON(`o`.`sectorFk` = `s`.`id`) + ) +WHERE `o`.`sectorFk` IS NOT NULL + AND `s`.`code` IN ( + 'H2', + 'H2', + 'PEQUES_H', + 'ALTILLO COMP', + 'ALTILLO ARTI' + ) \ No newline at end of file diff --git a/db/changes/231201/00-supplierAccount_deleteTriggers.sql b/db/changes/231201/00-supplierAccount_deleteTriggers.sql new file mode 100644 index 000000000..d7f9f734a --- /dev/null +++ b/db/changes/231201/00-supplierAccount_deleteTriggers.sql @@ -0,0 +1,3 @@ +DROP TRIGGER `vn`.`supplierAccount_afterInsert`; +DROP TRIGGER `vn`.`supplierAccount_afterUpdate`; +DROP TRIGGER `vn`.`supplierAccount_afterDelete`; diff --git a/db/changes/231201/00-ticket_getWarnings.sql b/db/changes/231201/00-ticket_getWarnings.sql new file mode 100644 index 000000000..5253b58ab --- /dev/null +++ b/db/changes/231201/00-ticket_getWarnings.sql @@ -0,0 +1,47 @@ +DROP PROCEDURE IF EXISTS `vn`.`ticket_getWarnings`; + +DELIMITER $$ +$$ +CREATE PROCEDURE `vn`.`ticket_getWarnings`() +BEGIN +/** + * Calcula las adventencias para un conjunto de tickets. + * Agrupados por ticket + * + * @table tmp.sale_getWarnings(ticketFk) Identificadores de los tickets a calcular + * @return tmp.ticket_warnings + */ + DROP TEMPORARY TABLE IF EXISTS tmp.sale_warnings; + CREATE TEMPORARY TABLE tmp.sale_warnings ( + ticketFk INT(11), + saleFk INT(11), + isFragile INTEGER(1) DEFAULT 0, + PRIMARY KEY (ticketFk, saleFk) + ) ENGINE = MEMORY; + + -- Frágil + INSERT INTO tmp.sale_warnings(ticketFk, saleFk, isFragile) + SELECT tt.ticketFk, s.id, TRUE + FROM tmp.sale_getWarnings tt + LEFT JOIN sale s ON s.ticketFk = tt.ticketFk + LEFT JOIN item i ON i.id = s.itemFk + LEFT JOIN itemType it ON it.id = i.typeFk + LEFT JOIN agencyMode am ON am.id = tt.agencyModeFk + LEFT JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk + WHERE dm.code IN ('AGENCY') + AND it.isFragile; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket_warnings; + CREATE TEMPORARY TABLE tmp.ticket_warnings + (PRIMARY KEY (ticketFk)) + ENGINE = MEMORY + SELECT + sw.ticketFk, + MAX(sw.isFragile) AS isFragile + FROM tmp.sale_warnings sw + GROUP BY sw.ticketFk; + + DROP TEMPORARY TABLE + tmp.sale_warnings; +END$$ +DELIMITER ; diff --git a/db/changes/231201/00-wagon.sql b/db/changes/231201/00-wagon.sql new file mode 100644 index 000000000..3e4d225d7 --- /dev/null +++ b/db/changes/231201/00-wagon.sql @@ -0,0 +1,72 @@ +CREATE TABLE `vn`.`wagonType` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(30) NOT NULL UNIQUE, + `divisible` tinyint(1) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3; + +CREATE TABLE `vn`.`wagonTypeColor` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(30) NOT NULL UNIQUE, + `rgb` varchar(30) NOT NULL UNIQUE, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3; + +CREATE TABLE `vn`.`wagonTypeTray` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `typeFk` int(11) unsigned, + `height` int(11) unsigned NOT NULL, + `colorFk` int(11) unsigned, + PRIMARY KEY (`id`), + UNIQUE KEY (`typeFk`,`height`), + CONSTRAINT `wagonTypeTray_type` FOREIGN KEY (`typeFk`) REFERENCES `wagonType` (`id`) ON UPDATE CASCADE, + CONSTRAINT `wagonTypeTray_color` FOREIGN KEY (`colorFk`) REFERENCES `wagonTypeColor` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3; + +CREATE TABLE `vn`.`wagonConfig` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `width` int(11) unsigned DEFAULT 1350, + `height` int(11) unsigned DEFAULT 1900, + `maxWagonHeight` int(11) unsigned DEFAULT 200, + `minHeightBetweenTrays` int(11) unsigned DEFAULT 50, + `maxTrays` int(11) unsigned DEFAULT 6, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3; + +CREATE TABLE `vn`.`collectionWagon` ( + `collectionFk` int(11) NOT NULL, + `wagonFk` int(11) NOT NULL, + `position` int(11) unsigned, + PRIMARY KEY (`collectionFk`,`position`), + UNIQUE KEY `collectionWagon_unique` (`collectionFk`,`wagonFk`), + CONSTRAINT `collectionWagon_collection` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON UPDATE CASCADE, + CONSTRAINT `collectionWagon_wagon` FOREIGN KEY (`wagonFk`) REFERENCES `wagon` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; + +CREATE TABLE `vn`.`collectionWagonTicket` ( + `ticketFk` int(11) NOT NULL, + `wagonFk` int(11) NOT NULL, + `trayFk` int(11) unsigned NOT NULL, + `side` SET('L', 'R') NULL, + PRIMARY KEY (`ticketFk`), + CONSTRAINT `collectionWagonTicket_ticket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE, + CONSTRAINT `collectionWagonTicket_wagon` FOREIGN KEY (`wagonFk`) REFERENCES `wagon` (`id`) ON UPDATE CASCADE, + CONSTRAINT `collectionWagonTicket_tray` FOREIGN KEY (`trayFk`) REFERENCES `wagonTypeTray` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; + +ALTER TABLE `vn`.`wagon` ADD `typeFk` int(11) unsigned NOT NULL; +ALTER TABLE `vn`.`wagon` ADD `label` int(11) unsigned NOT NULL; +ALTER TABLE `vn`.`wagon` ADD CONSTRAINT `wagon_type` FOREIGN KEY (`typeFk`) REFERENCES `wagonType` (`id`) ON UPDATE CASCADE; + +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('WagonType', '*', '*', 'ALLOW', 'ROLE', 'productionAssi'), + ('WagonTypeColor', '*', '*', 'ALLOW', 'ROLE', 'productionAssi'), + ('WagonTypeTray', '*', '*', 'ALLOW', 'ROLE', 'productionAssi'), + ('WagonConfig', '*', '*', 'ALLOW', 'ROLE', 'productionAssi'), + ('CollectionWagon', '*', '*', 'ALLOW', 'ROLE', 'productionAssi'), + ('CollectionWagonTicket', '*', '*', 'ALLOW', 'ROLE', 'productionAssi'), + ('Wagon', '*', '*', 'ALLOW', 'ROLE', 'productionAssi'), + ('WagonType', 'createWagonType', '*', 'ALLOW', 'ROLE', 'productionAssi'), + ('WagonType', 'deleteWagonType', '*', 'ALLOW', 'ROLE', 'productionAssi'), + ('WagonType', 'editWagonType', '*', 'ALLOW', 'ROLE', 'productionAssi'); diff --git a/front/salix/services/index.js b/db/changes/231401/.gitkeep similarity index 100% rename from front/salix/services/index.js rename to db/changes/231401/.gitkeep diff --git a/db/docker.js b/db/docker.js index 34026f85f..05217d659 100644 --- a/db/docker.js +++ b/db/docker.js @@ -19,8 +19,9 @@ module.exports = class Docker { * to avoid a bug with OverlayFS driver on MacOS. * * @param {Boolean} ci continuous integration environment argument + * @param {String} networkName Name of the container network */ - async run(ci) { + async run(ci, networkName = 'jenkins') { let d = new Date(); let pad = v => v < 10 ? '0' + v : v; let stamp = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`; @@ -42,8 +43,12 @@ module.exports = class Docker { let runChown = process.platform != 'linux'; + let network = ''; + if (ci) network = `--network="${networkName}"`; + log('Starting container...'); - const container = await this.execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`); + const container = await this.execP( + `docker run ${network} --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`); this.id = container.stdout.trim(); try { @@ -51,10 +56,11 @@ module.exports = class Docker { let inspect = await this.execP(`docker inspect -f "{{json .NetworkSettings}}" ${this.id}`); let netSettings = JSON.parse(inspect.stdout); - if (ci) - this.dbConf.host = netSettings.Gateway; - - this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort']; + if (ci) { + this.dbConf.host = netSettings.Networks[networkName].IPAddress; + this.dbConf.port = 3306; + } else + this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort']; } await this.wait(); diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql index 464933607..39388e140 100644 --- a/db/dump/dumpedFixtures.sql +++ b/db/dump/dumpedFixtures.sql @@ -1,15 +1,15 @@ USE `util`; --- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.18-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: util +-- Host: db-proxy.verdnatura.es Database: util -- ------------------------------------------------------ --- Server version 5.6.25-4-log +-- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; +/*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; @@ -22,7 +22,7 @@ USE `util`; LOCK TABLES `config` WRITE; /*!40000 ALTER TABLE `config` DISABLE KEYS */; -INSERT INTO `config` VALUES (1,'10450',0,'production',NULL); +INSERT INTO `config` VALUES (1,'230404',0,'production',NULL); /*!40000 ALTER TABLE `config` ENABLE KEYS */; UNLOCK TABLES; @@ -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','10129','7ebb66d5a9e47920e2c5ebfdf373bdf9d1bd6221','2022-05-03 13:46:59','10131'); +INSERT INTO `version` VALUES ('salix','10230','53f69ae8e526a4a5d827c237a5b076d38507b392','2020-11-09 11:06:43',NULL),('vn-database','10481','0b4092f49d8b8b4f50623246cbbcad53ed0eb057','2023-02-20 08:46:42','10481'); /*!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','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); +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','10097','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',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','10103','00-awbVolume.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10104','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10105','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL),('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL),('vn-database','10113','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',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','10119','00-AfegirFKPart1.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10119','01-AfegirFkPart2.sql','jenkins@10.0.2.69','2022-05-05 10:22:25',NULL,NULL),('vn-database','10125','00-firstScript.sql','jenkins@10.0.2.68','2022-05-18 18:44:30',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),('vn-database','10132','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:22:25',NULL,NULL),('vn-database','10133','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 14:32:30',NULL,NULL),('vn-database','10134','00-firstScript.sql','jenkins@10.0.2.69','2022-05-06 07:45:25',NULL,NULL),('vn-database','10135','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 08:46:17',NULL,NULL),('vn-database','10136','00-workerTimeControl.sql','jenkins@10.0.2.69','2022-05-09 13:51:12',NULL,NULL),('vn-database','10138','00-firstScript.sql','jenkins@10.0.2.69','2022-05-10 13:58:05',NULL,NULL),('vn-database','10139','00-firstScript.sql','jenkins@10.0.2.68','2022-05-16 14:32:37',NULL,NULL),('vn-database','10139','01-secondScript.sql','jenkins@10.0.2.68','2022-05-17 12:16:13',NULL,NULL),('vn-database','10141','00-firstScript.sql','jenkins@10.0.2.70','2022-05-12 08:27:31',NULL,NULL),('vn-database','10142','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL),('vn-database','10143','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL),('vn-database','10144','00-AfegirFKPArt1.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10144','00-firstScript.sql','jenkins@10.0.2.68','2022-05-13 09:44:25',NULL,NULL),('vn-database','10147','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10149','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10150','00-firstScript.sql','jenkins@10.0.2.68','2022-05-17 09:57:16',NULL,NULL),('vn-database','10152','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10153','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10154','00-compressionKk.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10157','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:35',NULL,NULL),('vn-database','10158','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:21',NULL,NULL),('vn-database','10160','00-firstScript.sql','jenkins@10.0.2.69','2022-06-30 09:30:50',NULL,NULL),('vn-database','10163','00-firstScript.sql','jenkins@10.0.2.68','2022-05-23 08:17:14',NULL,NULL),('vn-database','10164','00-borrarSectorsDesus.sql','jenkins@10.0.2.68','2022-06-02 12:47:21',NULL,NULL),('vn-database','10165','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10166','00-firstScript.sql','jenkins@10.0.2.68','2022-05-24 16:11:21',NULL,NULL),('vn-database','10167','00-renameVnActiveContrat.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10168','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10169','00-createTableBankEntityConfig.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10169','02-addNotNullToBankEntityBic.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10171','00-volumeConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 14:11:11',NULL,NULL),('vn-database','10171','01-itemWeight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 16:01:34',NULL,NULL),('vn-database','10171','02-agencymode.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 16:01:34',NULL,NULL),('vn-database','10172','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10174','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 08:46:17',NULL,NULL),('vn-database','10175','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10177','00-crearTablaSpecialLabels.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10178','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10179','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10183','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10184','00-firstScript.sql','jenkins@10.0.2.68','2022-06-03 08:05:34',NULL,NULL),('vn-database','10185','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 09:07:45',NULL,NULL),('vn-database','10186','00-desactivar_trigger.sql','jenkins@10.0.2.68','2022-06-07 09:31:23',NULL,NULL),('vn-database','10186','01-alter_Table_buy.sql','jenkins@10.0.2.68','2022-06-07 09:34:47',NULL,NULL),('vn-database','10186','02-alter_table_entryConfig.sql','jenkins@10.0.2.68','2022-06-07 09:34:47',NULL,NULL),('vn-database','10186','04-regularizar_Sticker_Inventario.sql','jenkins@10.0.2.68','2022-06-07 09:34:51',NULL,NULL),('vn-database','10186','09-reactivar_trigger.sql','jenkins@10.0.2.68','2022-06-07 09:34:51',NULL,NULL),('vn-database','10187','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 12:37:31',NULL,NULL),('vn-database','10188','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 14:03:36',NULL,NULL),('vn-database','10189','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10191','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10194','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10195','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10200','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10201','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10202','00-Remove_FK_to_ediGenus.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10203','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:01',NULL,NULL),('vn-database','10204','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:01',NULL,NULL),('vn-database','10205','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:21',NULL,NULL),('vn-database','10207','00-Alter_table_entry.sql','jenkins@10.0.2.69','2022-06-16 07:22:50',NULL,NULL),('vn-database','10207','01-Update_invoiceAmount.sql','jenkins@10.0.2.69','2022-06-16 07:23:00',NULL,NULL),('vn-database','10208','00-firstScript.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10209','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 08:47:40',NULL,NULL),('vn-database','10210','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 17:39:17',1046,'Base de datos no seleccionada'),('vn-database','10211','01-firstScript.sql','jenkins@10.0.2.69','2022-06-17 07:11:27',NULL,NULL),('vn-database','10215','00-renameIsInventory.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10216','00-firstScript.sql','jenkins@10.0.2.69','2022-06-23 11:15:28',NULL,NULL),('vn-database','10216','01-batchIndex.sql','jenkins@10.0.2.70','2022-06-27 18:10:55',NULL,NULL),('vn-database','10219','00-AddCollectionFkOnPackingSite.sql','jenkins@10.0.2.70','2022-06-29 09:23:42',NULL,NULL),('vn-database','10219','01-AddFkToCollectionFk.sql','jenkins@10.0.2.70','2022-06-29 09:23:43',NULL,NULL),('vn-database','10220','00-createPersonalProtectionEquipment.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10222','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:12:40',NULL,NULL),('vn-database','10223','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:52',NULL,NULL),('vn-database','10224','00-cosetes.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-21 12:03:45',NULL,NULL),('vn-database','10229','00-firstScript.sql','jenkins@10.0.2.69','2022-07-01 11:59:34',NULL,NULL),('vn-database','10231','01-tablaEktConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:25:39',NULL,NULL),('vn-database','10233','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10235','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10236','00-firstScript.sql','jenkins@10.0.2.69','2022-07-05 12:11:40',NULL,NULL),('vn-database','10237','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10238','00-worker_mobileExtension.sql','jenkins@10.0.2.69','2022-07-14 09:14:09',NULL,NULL),('vn-database','10239','00-firstScript.sql','jenkins@10.0.2.69','2022-07-07 21:51:58',NULL,NULL),('vn-database','10241','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-29 08:14:01',NULL,NULL),('vn-database','10242','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:14:32',NULL,NULL),('vn-database','10243','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:14:32',NULL,NULL),('vn-database','10245','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:34:51',NULL,NULL),('vn-database','10247','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:34:51',NULL,NULL),('vn-database','10248','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-20 17:27:51',NULL,NULL),('vn-database','10250','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:36:40',NULL,NULL),('vn-database','10253','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:36:57',NULL,NULL),('vn-database','10254','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10256','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10258','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:48',NULL,NULL),('vn-database','10259','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-02 08:54:56',NULL,NULL),('vn-database','10261','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-22 08:42:20',NULL,NULL),('vn-database','10262','00-createTablepackagingWithFreight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','01-alterTablePackagingConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','02-insertsInicials.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','03-createTablepackingWithoutFreight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10263','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10265','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10267','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10267','01-fixMerge.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10275','00-improvedGeneralLog.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-01 09:55:56',NULL,NULL),('vn-database','10277','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:32',NULL,NULL),('vn-database','10278','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-01 17:51:41',NULL,NULL),('vn-database','10279','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10281','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10282','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10283','00-alterTable.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10284','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-04 16:59:08',NULL,NULL),('vn-database','10285','00-firstScript.sql','jenkins@swarm-worker3.static.verdnatura.es','2022-08-05 09:19:33',NULL,NULL),('vn-database','10287','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:35:24',NULL,NULL),('vn-database','10288','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:35:24',NULL,NULL),('vn-database','10289','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:36',NULL,NULL),('vn-database','10291','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-10 14:19:34',NULL,NULL),('vn-database','10293','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:32',NULL,NULL),('vn-database','10297','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-16 12:43:36',NULL,NULL),('vn-database','10298','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-13 21:04:13',NULL,NULL),('vn-database','10299','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','00-productionConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','01-drop.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','02-collection.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','00-CreateTableEntryType.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','01-insertDataEntryType.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','02-alterTableEntry.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:22',NULL,NULL),('vn-database','10303','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:23',NULL,NULL),('vn-database','10304','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:23:48',NULL,NULL),('vn-database','10304','01-altertableticket.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:23:51',NULL,NULL),('vn-database','10305','00-ektAssign.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:24:52',NULL,NULL),('vn-database','10306','00-deliveryInformation.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:25:25',NULL,NULL),('vn-database','10307','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:25:26',NULL,NULL),('vn-database','10308','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:26:43',NULL,NULL),('vn-database','10309','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-06 11:37:54',NULL,NULL),('vn-database','10310','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:33',NULL,NULL),('vn-database','10311','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-06 11:37:55',NULL,NULL),('vn-database','10312','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:33',NULL,NULL),('vn-database','10313','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:27:21',NULL,NULL),('vn-database','10314','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-20 12:37:19',NULL,NULL),('vn-database','10315','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10317','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10318','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10319','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-20 12:37:41',NULL,NULL),('vn-database','10320','00-operator.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:37',NULL,NULL),('vn-database','10320','01-collection.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:37',NULL,NULL),('vn-database','10320','02-productionConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10321','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 11:11:12',NULL,NULL),('vn-database','10322','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-09 09:19:05',NULL,NULL),('vn-database','10326','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10328','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10329','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10330','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10332','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10334','00-collectionHotbed.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10334','01-saleGroupDetail.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10335','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10336','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10337','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10339','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-19 09:41:19',NULL,NULL),('vn-database','10340','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10341','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10342','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10343','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:35:30',NULL,NULL),('vn-database','10345','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:16',NULL,NULL),('vn-database','10347','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10347','01-addVirtualField.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10349','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10350','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-30 10:11:56',NULL,NULL),('vn-database','10352','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:16',NULL,NULL),('vn-database','10353','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10354','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10356','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10356','01-orderConfigFk.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10356','02-orderConfigDrop.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10357','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10359','00-improvedGeneralLog_collate.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:39',NULL,NULL),('vn-database','10360','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:39',NULL,NULL),('vn-database','10361','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 11:16:07',NULL,NULL),('vn-database','10362','00-dropUdfs.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-10 11:01:15',NULL,NULL),('vn-database','10363','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10365','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-13 19:30:46',NULL,NULL),('vn-database','10368','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10369','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-14 13:38:06',NULL,NULL),('vn-database','10370','00-deleteForeignKey.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:41',NULL,NULL),('vn-database','10370','01-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:47',NULL,NULL),('vn-database','10370','02-deleteTable.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:49',NULL,NULL),('vn-database','10370','03-accion.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:49',NULL,NULL),('vn-database','10370','04-inter.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:53',NULL,NULL),('vn-database','10371','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10372','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:48',NULL,NULL),('vn-database','10373','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-19 08:31:58',NULL,NULL),('vn-database','10378','00-rename_routeUserPercentage.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10382','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10383','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:53',NULL,NULL),('vn-database','10385','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:54',NULL,NULL),('vn-database','10386','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:54',NULL,NULL),('vn-database','10387','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-16 14:05:33',NULL,NULL),('vn-database','10388','00-resizeUtilVerionLogCode.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10388','01-resizeUtilVersionCode.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10390','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:16',NULL,NULL),('vn-database','10391','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10394','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:24',NULL,NULL),('vn-database','10395','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10396','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 15:36:38',NULL,NULL),('vn-database','10397','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10399','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10400','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10402','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-21 14:11:31',NULL,NULL),('vn-database','10404','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10405','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:58:22',NULL,NULL),('vn-database','10407','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:49',NULL,NULL),('vn-database','10408','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10409','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:49',NULL,NULL),('vn-database','10412','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-30 12:45:44',NULL,NULL),('vn-database','10413','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:24',NULL,NULL),('vn-database','10416','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:24',NULL,NULL),('vn-database','10420','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:25',NULL,NULL),('vn-database','10421','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:26',NULL,NULL),('vn-database','10428','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10433','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10434','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10435','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-13 07:30:10',NULL,NULL),('vn-database','10436','00-createFkWorker.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:58:59',NULL,NULL),('vn-database','10436','01-addStateToWorkerProductivity.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:00',NULL,NULL),('vn-database','10436','02-DeprecateVnSaleTrackingState.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:00',NULL,NULL),('vn-database','10436','03-DeprecateColumnVnSaleTrackingActionFk.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10436','04-DropSchemaVnControl.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10436','05-RemoveFkWorkerProductivity.sql','jenkins@db-proxy2.static.verdnatura.es','2023-02-17 14:51:19',NULL,NULL),('vn-database','10444','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10445','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10448','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10450','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-27 08:28:04',NULL,NULL),('vn-database','10451','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-06 08:08:32',NULL,NULL),('vn-database','10452','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10453','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 14:04:37',NULL,NULL),('vn-database','10454','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10455','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10456','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:00:30',NULL,NULL),('vn-database','10457','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:00:33',NULL,NULL),('vn-database','10460','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10461','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10463','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-03 12:59:26',NULL,NULL),('vn-database','10468','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10469','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10480','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-17 15:09:26',NULL,NULL),('vn-database','10481','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-17 16:37:22',NULL,NULL); /*!40000 ALTER TABLE `versionLog` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -54,18 +54,18 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 15:58:27 +-- Dump completed on 2023-02-20 14:45:51 USE `account`; --- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.18-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: account +-- Host: db-proxy.verdnatura.es Database: account -- ------------------------------------------------------ --- Server version 5.6.25-4-log +-- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; +/*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; @@ -78,7 +78,7 @@ USE `account`; LOCK TABLES `role` WRITE; /*!40000 ALTER TABLE `role` DISABLE KEYS */; -INSERT INTO `role` VALUES (1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2017-11-29 10:06:31'),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35'),(13,'teamBoss','Jefe de equipo/departamento',1,'2017-05-19 07:04:58','2021-06-30 13:29:30'),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10'),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27'),(20,'manager','Departamento de gerencia',1,'2017-06-01 14:57:02','2017-06-01 14:57:51'),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52'),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12'),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36'),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27'),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20'),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34'),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53'),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42'),(36,'replenisher','Trabajadores de camara',1,'2018-02-16 14:07:10','2019-04-12 05:38:08'),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53'),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09'),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41'),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12'),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26'),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59'),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16'),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12'),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23'),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18'),(48,'coolerBoss','Jefe del departamento de cámara',1,'2018-02-23 13:12:01','2018-02-23 13:12:01'),(49,'production','Empleado de producción',1,'2018-02-26 15:28:23','2021-02-12 09:42:35'),(50,'productionBoss','Jefe de producción',1,'2018-02-26 15:34:12','2018-02-26 15:34:12'),(51,'marketing','Departamento de marketing',1,'2018-03-01 07:28:39','2018-03-01 07:28:39'),(52,'marketingBoss','Jefe del departamento de marketing',1,'2018-03-01 07:28:57','2018-03-01 07:28:57'),(53,'insurance','Gestor de seguros de cambio',0,'2018-03-05 07:44:35','2019-02-01 13:47:57'),(54,'itemPicker','Sacador en cámara',1,'2018-03-05 12:08:17','2018-03-05 12:08:17'),(55,'itemPickerBoss','Jefe de sacadores',1,'2018-03-05 12:08:31','2018-03-05 12:08:31'),(56,'delivery','Personal de reparto',1,'2018-05-30 06:07:02','2018-05-30 06:07:02'),(57,'deliveryBoss','Jefe de personal de reparto',1,'2018-05-30 06:07:19','2018-05-30 06:07:19'),(58,'packager','Departamento encajadores',1,'2019-01-21 12:43:45','2019-01-21 12:43:45'),(59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 12:44:10','2019-01-21 12:44:10'),(60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 13:29:01','2019-01-29 13:29:01'),(61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 06:44:07','2019-07-01 06:44:07'),(62,'noLogin','Role without login access to MySQL',0,'2019-07-01 06:50:19','2019-07-02 13:42:05'),(64,'balanceSheet','Consulta de Balance',0,'2019-07-16 12:12:08','2019-07-16 12:12:08'),(65,'officeBoss','Jefe de filial',1,'2019-08-02 06:54:26','2019-08-02 06:54:26'),(66,'sysadmin','Administrador de sistema',1,'2019-08-08 06:58:56','2019-08-08 06:58:56'),(67,'adminOfficer','categoria profesional oficial de administración',1,'2020-01-03 08:09:23','2020-01-03 08:09:23'),(69,'coolerAssist','Empleado cámara con permiso compras',1,'2020-02-05 12:36:09','2020-02-05 12:36:09'),(70,'trainee','Alumno de prácticas',1,'2020-03-04 11:00:25','2020-03-04 11:00:25'),(71,'checker','Rol de revisor con privilegios de itemPicker',1,'2020-10-02 10:50:07','2020-10-02 10:50:07'),(72,'claimManager','Personal de reclamaciones',1,'2020-10-13 10:01:32','2020-10-26 07:29:46'),(73,'financial','Departamento de finanzas',1,'2020-11-16 09:30:27','2020-11-16 09:30:27'),(74,'userPhotos','Privilegios para subir fotos de usuario',1,'2021-02-03 10:24:27','2021-02-03 10:24:27'),(75,'catalogPhotos','Privilegios para subir fotos del catálogo',1,'2021-02-03 10:24:27','2021-02-03 10:24:27'),(76,'chat','Rol para utilizar el rocket chat',1,'2020-11-27 13:06:50','2020-12-17 07:49:41'),(100,'root','Rol con todos los privilegios',0,'2018-04-23 14:33:36','2020-11-12 06:50:07'),(101,'buyerBoss','Jefe del departamento de compras',1,'2021-06-16 09:53:17','2021-06-16 09:53:17'),(102,'preservedBoss','Responsable preservado',1,'2021-09-14 13:45:37','2021-09-14 13:45:37'),(103,'it','Departamento de informática',1,'2021-11-11 09:48:22','2021-11-11 09:48:22'),(104,'itBoss','Jefe de departamento de informática',1,'2021-11-11 09:48:49','2021-11-11 09:48:49'),(105,'grant','Adjudicar roles a usuarios',1,'2021-11-11 12:41:09','2021-11-11 12:41:09'),(106,'ext','Usuarios externos de la Base de datos',1,'2021-11-23 14:51:16','2021-11-23 14:51:16'),(107,'productionPlus','Creado para pepe por orden de Juanvi',1,'2022-02-08 06:47:10','2022-02-08 06:47:10'); +INSERT INTO `role` VALUES (1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2017-11-29 10:06:31'),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35'),(13,'teamBoss','Jefe de equipo/departamento',1,'2017-05-19 07:04:58','2021-06-30 13:29:30'),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10'),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27'),(20,'manager','Gerencia',1,'2017-06-01 14:57:02','2022-07-29 07:36:15'),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52'),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12'),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36'),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27'),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20'),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34'),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53'),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42'),(36,'replenisher','Trabajadores de camara',1,'2018-02-16 14:07:10','2019-04-12 05:38:08'),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53'),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09'),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41'),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12'),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26'),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59'),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16'),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12'),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23'),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18'),(48,'coolerBoss','Jefe del departamento de cámara',1,'2018-02-23 13:12:01','2018-02-23 13:12:01'),(49,'production','Empleado de producción',1,'2018-02-26 15:28:23','2021-02-12 09:42:35'),(50,'productionBoss','Jefe de producción',1,'2018-02-26 15:34:12','2018-02-26 15:34:12'),(51,'marketing','Departamento de marketing',1,'2018-03-01 07:28:39','2018-03-01 07:28:39'),(52,'marketingBoss','Jefe del departamento de marketing',1,'2018-03-01 07:28:57','2018-03-01 07:28:57'),(53,'insurance','Gestor de seguros de cambio',0,'2018-03-05 07:44:35','2019-02-01 13:47:57'),(54,'itemPicker','Sacador en cámara',1,'2018-03-05 12:08:17','2018-03-05 12:08:17'),(55,'itemPickerBoss','Jefe de sacadores',1,'2018-03-05 12:08:31','2018-03-05 12:08:31'),(56,'delivery','Personal de reparto',1,'2018-05-30 06:07:02','2018-05-30 06:07:02'),(57,'deliveryBoss','Jefe de personal de reparto',1,'2018-05-30 06:07:19','2018-05-30 06:07:19'),(58,'packager','Departamento encajadores',1,'2019-01-21 12:43:45','2019-01-21 12:43:45'),(59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 12:44:10','2019-01-21 12:44:10'),(60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 13:29:01','2019-01-29 13:29:01'),(61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 06:44:07','2019-07-01 06:44:07'),(62,'noLogin','Role without login access to MySQL',0,'2019-07-01 06:50:19','2019-07-02 13:42:05'),(64,'balanceSheet','Consulta de Balance',0,'2019-07-16 12:12:08','2019-07-16 12:12:08'),(65,'officeBoss','Jefe de filial',1,'2019-08-02 06:54:26','2019-08-02 06:54:26'),(66,'sysadmin','Administrador de sistema',1,'2019-08-08 06:58:56','2019-08-08 06:58:56'),(67,'adminOfficer','categoria profesional oficial de administración',1,'2020-01-03 08:09:23','2020-01-03 08:09:23'),(69,'coolerAssist','Empleado cámara con permiso compras',1,'2020-02-05 12:36:09','2020-02-05 12:36:09'),(70,'trainee','Alumno de prácticas',1,'2020-03-04 11:00:25','2020-03-04 11:00:25'),(71,'checker','Rol de revisor con privilegios de itemPicker',1,'2020-10-02 10:50:07','2020-10-02 10:50:07'),(72,'claimManager','Personal de reclamaciones',1,'2020-10-13 10:01:32','2020-10-26 07:29:46'),(73,'financial','Departamento de finanzas',1,'2020-11-16 09:30:27','2020-11-16 09:30:27'),(74,'userPhotos','Privilegios para subir fotos de usuario',1,'2021-02-03 10:24:27','2021-02-03 10:24:27'),(75,'catalogPhotos','Privilegios para subir fotos del catálogo',1,'2021-02-03 10:24:27','2021-02-03 10:24:27'),(76,'chat','Rol para utilizar el rocket chat',1,'2020-11-27 13:06:50','2020-12-17 07:49:41'),(100,'root','Rol con todos los privilegios',0,'2018-04-23 14:33:36','2020-11-12 06:50:07'),(101,'buyerBoss','Jefe del departamento de compras',1,'2021-06-16 09:53:17','2021-06-16 09:53:17'),(102,'preservedBoss','Responsable preservado',1,'2021-09-14 13:45:37','2021-09-14 13:45:37'),(103,'it','Departamento de informática',1,'2021-11-11 09:48:22','2021-11-11 09:48:22'),(104,'itBoss','Jefe de departamento de informática',1,'2021-11-11 09:48:49','2021-11-11 09:48:49'),(105,'grant','Adjudicar roles a usuarios',1,'2021-11-11 12:41:09','2021-11-11 12:41:09'),(106,'ext','Usuarios externos de la Base de datos',1,'2021-11-23 14:51:16','2021-11-23 14:51:16'),(107,'productionPlus','Creado para pepe por orden de Juanvi',1,'2022-02-08 06:47:10','2022-02-08 06:47:10'),(108,'system','System user',1,'2022-05-16 08:09:51','2022-05-16 08:09:51'),(109,'salesTeamBoss','Jefe de equipo de comerciales',1,'2022-06-14 13:45:56','2022-06-14 13:45:56'),(110,'palletizer','Paletizadores',1,'2022-12-02 12:56:22','2022-12-02 12:56:30'),(111,'entryEditor','Entry editor',1,'2023-01-13 11:21:55','2023-01-13 11:21:55'),(112,'maintenance','Personal de mantenimiento',1,'2023-01-19 06:23:35','2023-01-19 06:23:35'),(114,'maintenanceBos','Jefe de mantenimiento',1,'2023-01-19 06:31:16','2023-01-19 06:31:16'); /*!40000 ALTER TABLE `role` ENABLE KEYS */; UNLOCK TABLES; @@ -88,7 +88,7 @@ UNLOCK TABLES; LOCK TABLES `roleInherit` WRITE; /*!40000 ALTER TABLE `roleInherit` DISABLE KEYS */; -INSERT INTO `roleInherit` VALUES (1,1,2),(2,1,3),(3,1,70),(4,2,11),(5,3,11),(6,5,1),(7,5,21),(8,5,33),(124,5,76),(167,9,103),(10,11,6),(11,13,1),(12,15,35),(143,15,49),(150,15,56),(114,15,76),(14,16,13),(15,16,15),(127,16,76),(16,17,20),(17,17,37),(18,17,39),(19,17,64),(145,17,67),(136,17,76),(20,18,1),(132,18,76),(21,19,21),(242,20,9),(22,20,13),(23,20,16),(24,20,65),(134,20,76),(25,21,13),(26,21,18),(27,21,53),(241,21,72),(131,21,76),(28,22,13),(29,22,21),(30,30,5),(31,30,20),(32,30,22),(33,30,53),(34,30,64),(118,30,76),(35,31,1),(36,32,1),(37,34,1),(38,34,13),(39,34,33),(40,35,1),(142,35,75),(129,35,76),(41,36,44),(42,36,47),(43,37,1),(139,37,74),(125,37,76),(146,38,13),(44,38,37),(45,38,64),(126,38,76),(46,39,5),(47,39,21),(48,39,57),(115,39,76),(49,40,1),(50,40,49),(51,41,13),(52,41,35),(53,41,40),(135,41,76),(54,42,35),(55,42,49),(128,42,76),(56,43,13),(57,43,42),(58,44,1),(59,45,13),(60,45,44),(61,47,1),(62,48,13),(153,48,35),(63,48,47),(64,49,36),(65,49,58),(66,50,13),(67,50,21),(68,50,35),(69,50,49),(70,50,57),(71,50,59),(133,50,76),(72,51,1),(140,51,74),(141,51,75),(73,52,13),(74,52,19),(75,52,35),(76,52,51),(137,52,76),(77,53,1),(78,54,1),(79,55,13),(80,55,54),(81,56,1),(82,57,13),(245,57,33),(83,57,56),(138,57,76),(84,58,1),(85,59,13),(109,59,50),(87,60,5),(89,60,50),(90,60,57),(130,60,76),(91,61,13),(92,61,36),(93,65,19),(94,65,35),(95,65,50),(117,65,76),(168,66,9),(237,66,103),(97,67,5),(98,67,37),(99,69,35),(152,69,47),(101,70,11),(102,71,1),(103,71,58),(104,72,13),(105,72,18),(106,73,5),(108,73,19),(107,73,64),(148,101,13),(147,101,35),(154,102,1),(173,103,1),(194,103,2),(181,103,3),(179,103,5),(201,103,6),(176,103,11),(231,103,13),(212,103,15),(213,103,16),(178,103,17),(230,103,18),(229,103,19),(238,103,20),(228,103,21),(232,103,22),(199,103,30),(200,103,31),(197,103,32),(207,103,33),(182,103,34),(186,103,35),(225,103,36),(204,103,37),(205,103,38),(177,103,39),(202,103,40),(203,103,41),(183,103,42),(184,103,43),(174,103,44),(175,103,45),(191,103,47),(193,103,48),(222,103,49),(224,103,50),(215,103,51),(216,103,52),(206,103,53),(210,103,54),(211,103,55),(195,103,56),(196,103,57),(219,103,58),(220,103,59),(223,103,60),(226,103,61),(185,103,64),(218,103,65),(180,103,67),(192,103,69),(233,103,70),(189,103,71),(190,103,72),(198,103,73),(234,103,74),(188,103,75),(172,103,76),(187,103,101),(221,103,102),(171,104,9),(170,104,66),(169,104,100),(166,104,103),(239,106,11),(240,107,60); +INSERT INTO `roleInherit` VALUES (1,1,2),(2,1,3),(3,1,70),(4,2,11),(5,3,11),(6,5,1),(7,5,21),(8,5,33),(124,5,76),(261,5,111),(167,9,103),(10,11,6),(11,13,1),(12,15,35),(143,15,49),(150,15,56),(114,15,76),(14,16,13),(15,16,15),(127,16,76),(16,17,20),(17,17,37),(18,17,39),(19,17,64),(145,17,67),(136,17,76),(20,18,1),(132,18,76),(21,19,21),(242,20,9),(22,20,13),(23,20,16),(24,20,65),(134,20,76),(25,21,13),(26,21,18),(27,21,53),(241,21,72),(131,21,76),(28,22,13),(29,22,21),(30,30,5),(31,30,20),(32,30,22),(33,30,53),(34,30,64),(118,30,76),(35,31,1),(36,32,1),(37,34,1),(38,34,13),(39,34,33),(40,35,1),(142,35,75),(129,35,76),(260,35,111),(41,36,44),(42,36,47),(43,37,1),(139,37,74),(125,37,76),(146,38,13),(44,38,37),(45,38,64),(126,38,76),(46,39,5),(47,39,21),(48,39,57),(115,39,76),(49,40,1),(50,40,49),(51,41,13),(52,41,35),(53,41,40),(135,41,76),(54,42,35),(55,42,49),(128,42,76),(56,43,13),(57,43,42),(258,43,111),(58,44,1),(59,45,13),(60,45,44),(61,47,1),(257,47,111),(62,48,13),(153,48,35),(63,48,47),(253,48,49),(256,48,69),(64,49,36),(65,49,58),(66,50,13),(67,50,21),(68,50,35),(69,50,49),(70,50,57),(71,50,59),(133,50,76),(72,51,1),(251,51,21),(264,51,35),(140,51,74),(141,51,75),(73,52,13),(74,52,19),(76,52,51),(137,52,76),(77,53,1),(78,54,1),(79,55,13),(80,55,54),(81,56,1),(82,57,13),(245,57,33),(83,57,56),(138,57,76),(84,58,1),(85,59,13),(109,59,50),(87,60,5),(89,60,50),(90,60,57),(130,60,76),(91,61,13),(92,61,36),(93,65,19),(94,65,35),(95,65,50),(117,65,76),(168,66,9),(237,66,103),(97,67,5),(98,67,37),(99,69,35),(152,69,47),(101,70,11),(102,71,1),(103,71,58),(105,72,18),(265,72,49),(259,72,111),(106,73,5),(108,73,19),(107,73,64),(148,101,13),(266,101,18),(147,101,35),(154,102,1),(248,102,13),(246,102,35),(173,103,1),(194,103,2),(181,103,3),(179,103,5),(201,103,6),(176,103,11),(231,103,13),(212,103,15),(213,103,16),(178,103,17),(230,103,18),(229,103,19),(238,103,20),(228,103,21),(232,103,22),(199,103,30),(200,103,31),(197,103,32),(207,103,33),(182,103,34),(186,103,35),(225,103,36),(204,103,37),(205,103,38),(177,103,39),(202,103,40),(203,103,41),(183,103,42),(184,103,43),(174,103,44),(175,103,45),(191,103,47),(193,103,48),(222,103,49),(224,103,50),(215,103,51),(216,103,52),(206,103,53),(210,103,54),(211,103,55),(195,103,56),(196,103,57),(219,103,58),(220,103,59),(223,103,60),(226,103,61),(185,103,64),(218,103,65),(180,103,67),(192,103,69),(233,103,70),(189,103,71),(190,103,72),(198,103,73),(234,103,74),(188,103,75),(172,103,76),(187,103,101),(221,103,102),(171,104,9),(170,104,66),(169,104,100),(166,104,103),(239,106,11),(240,107,60),(247,108,1),(250,109,13),(249,109,18),(254,110,1),(255,110,76),(262,112,1),(263,114,112); /*!40000 ALTER TABLE `roleInherit` ENABLE KEYS */; UNLOCK TABLES; @@ -98,7 +98,7 @@ UNLOCK TABLES; LOCK TABLES `roleRole` WRITE; /*!40000 ALTER TABLE `roleRole` DISABLE KEYS */; -INSERT INTO `roleRole` VALUES (85547,1,1),(85548,1,2),(85549,1,3),(85552,1,6),(85551,1,11),(85550,1,70),(85465,2,2),(85467,2,6),(85466,2,11),(85350,3,3),(85352,3,6),(85351,3,11),(85320,5,1),(85327,5,2),(85326,5,3),(85319,5,5),(85332,5,6),(85331,5,11),(85324,5,13),(85328,5,18),(85321,5,21),(85322,5,33),(85329,5,53),(85325,5,70),(85330,5,72),(85323,5,76),(85649,6,6),(85488,9,1),(85489,9,2),(85490,9,3),(85491,9,5),(85492,9,6),(85486,9,9),(85493,9,11),(85494,9,13),(85495,9,15),(85496,9,16),(85497,9,17),(85498,9,18),(85499,9,19),(85500,9,20),(85501,9,21),(85502,9,22),(85503,9,30),(85504,9,31),(85505,9,32),(85506,9,33),(85507,9,34),(85508,9,35),(85509,9,36),(85510,9,37),(85511,9,38),(85512,9,39),(85513,9,40),(85514,9,41),(85515,9,42),(85516,9,43),(85517,9,44),(85518,9,45),(85519,9,47),(85520,9,48),(85521,9,49),(85522,9,50),(85523,9,51),(85524,9,52),(85525,9,53),(85526,9,54),(85527,9,55),(85528,9,56),(85529,9,57),(85530,9,58),(85531,9,59),(85532,9,60),(85533,9,61),(85534,9,64),(85535,9,65),(85536,9,67),(85537,9,69),(85538,9,70),(85539,9,71),(85540,9,72),(85541,9,73),(85542,9,74),(85543,9,75),(85544,9,76),(85545,9,101),(85546,9,102),(85487,9,103),(85240,11,6),(85239,11,11),(86312,13,1),(86313,13,2),(86314,13,3),(86317,13,6),(86316,13,11),(86311,13,13),(86315,13,70),(85861,15,1),(85865,15,2),(85864,15,3),(85868,15,6),(85867,15,11),(85853,15,15),(85854,15,35),(85859,15,36),(85862,15,44),(85866,15,47),(85855,15,49),(85856,15,56),(85858,15,58),(85863,15,70),(85860,15,75),(85857,15,76),(85875,16,1),(85880,16,2),(85879,16,3),(85886,16,6),(85885,16,11),(85870,16,13),(85871,16,15),(85869,16,16),(85874,16,35),(85881,16,36),(85884,16,44),(85883,16,47),(85873,16,49),(85876,16,56),(85882,16,58),(85878,16,70),(85877,16,75),(85872,16,76),(85266,17,1),(85277,17,2),(85276,17,3),(85271,17,5),(85299,17,6),(85270,17,9),(85298,17,11),(85269,17,13),(85281,17,15),(85268,17,16),(85258,17,17),(85283,17,18),(85280,17,19),(85259,17,20),(85272,17,21),(85297,17,22),(85296,17,30),(85295,17,31),(85294,17,32),(85274,17,33),(85293,17,34),(85279,17,35),(85292,17,36),(85260,17,37),(85291,17,38),(85261,17,39),(85290,17,40),(85289,17,41),(85288,17,42),(85287,17,43),(85300,17,44),(85301,17,45),(85302,17,47),(85303,17,48),(85304,17,49),(85278,17,50),(85305,17,51),(85306,17,52),(85284,17,53),(85307,17,54),(85308,17,55),(85286,17,56),(85273,17,57),(85309,17,58),(85310,17,59),(85311,17,60),(85312,17,61),(85262,17,64),(85267,17,65),(85263,17,67),(85313,17,69),(85275,17,70),(85314,17,71),(85285,17,72),(85315,17,73),(85265,17,74),(85316,17,75),(85264,17,76),(85317,17,101),(85318,17,102),(85282,17,103),(86242,18,1),(86245,18,2),(86244,18,3),(86248,18,6),(86247,18,11),(86241,18,18),(86246,18,70),(86243,18,76),(86235,19,1),(86238,19,2),(86237,19,3),(86240,19,6),(86239,19,11),(86230,19,13),(86231,19,18),(86228,19,19),(86229,19,21),(86232,19,53),(86236,19,70),(86233,19,72),(86234,19,76),(85896,20,1),(85904,20,2),(85903,20,3),(85902,20,5),(85901,20,6),(85888,20,9),(85900,20,11),(85889,20,13),(85895,20,15),(85890,20,16),(85899,20,17),(85905,20,18),(85894,20,19),(85887,20,20),(85906,20,21),(85907,20,22),(85908,20,30),(85909,20,31),(85910,20,32),(85911,20,33),(85912,20,34),(85893,20,35),(85913,20,36),(85914,20,37),(85915,20,38),(85916,20,39),(85917,20,40),(85918,20,41),(85919,20,42),(85920,20,43),(85921,20,44),(85922,20,45),(85923,20,47),(85924,20,48),(85925,20,49),(85898,20,50),(85926,20,51),(85927,20,52),(85928,20,53),(85929,20,54),(85930,20,55),(85931,20,56),(85932,20,57),(85933,20,58),(85934,20,59),(85935,20,60),(85936,20,61),(85937,20,64),(85891,20,65),(85938,20,67),(85939,20,69),(85940,20,70),(85941,20,71),(85942,20,72),(85943,20,73),(85944,20,74),(85945,20,75),(85892,20,76),(85946,20,101),(85947,20,102),(85897,20,103),(86222,21,1),(86225,21,2),(86224,21,3),(86227,21,6),(86226,21,11),(86217,21,13),(86218,21,18),(86216,21,21),(86219,21,53),(86223,21,70),(86220,21,72),(86221,21,76),(86322,22,1),(86328,22,2),(86327,22,3),(86330,22,6),(86329,22,11),(86319,22,13),(86321,22,18),(86320,22,21),(86318,22,22),(86323,22,53),(86326,22,70),(86324,22,72),(86325,22,76),(85592,30,1),(85600,30,2),(85599,30,3),(85581,30,5),(85612,30,6),(85589,30,9),(85613,30,11),(85588,30,13),(85594,30,15),(85587,30,16),(85611,30,17),(85597,30,18),(85601,30,19),(85582,30,20),(85591,30,21),(85583,30,22),(85580,30,30),(85610,30,31),(85609,30,32),(85590,30,33),(85608,30,34),(85602,30,35),(85607,30,36),(85606,30,37),(85605,30,38),(85604,30,39),(85614,30,40),(85615,30,41),(85616,30,42),(85617,30,43),(85618,30,44),(85619,30,45),(85620,30,47),(85621,30,48),(85622,30,49),(85603,30,50),(85623,30,51),(85624,30,52),(85584,30,53),(85625,30,54),(85626,30,55),(85627,30,56),(85628,30,57),(85629,30,58),(85630,30,59),(85631,30,60),(85632,30,61),(85585,30,64),(85593,30,65),(85633,30,67),(85634,30,69),(85598,30,70),(85635,30,71),(85596,30,72),(85636,30,73),(85637,30,74),(85638,30,75),(85586,30,76),(85639,30,101),(85640,30,102),(85595,30,103),(85642,31,1),(85643,31,2),(85644,31,3),(85647,31,6),(85646,31,11),(85641,31,31),(85645,31,70),(85554,32,1),(85555,32,2),(85556,32,3),(85559,32,6),(85558,32,11),(85553,32,32),(85557,32,70),(85707,33,33),(85354,34,1),(85359,34,2),(85358,34,3),(85361,34,6),(85360,34,11),(85355,34,13),(85356,34,33),(85353,34,34),(85357,34,70),(85396,35,1),(85401,35,2),(85400,35,3),(85403,35,6),(85402,35,11),(85395,35,35),(85399,35,70),(85397,35,75),(85398,35,76),(86131,36,1),(86133,36,2),(86132,36,3),(86136,36,6),(86135,36,11),(86128,36,36),(86129,36,44),(86130,36,47),(86134,36,70),(85680,37,1),(85685,37,2),(85684,37,3),(85687,37,6),(85686,37,11),(85679,37,37),(85683,37,70),(85681,37,74),(85682,37,76),(85694,38,1),(85697,38,2),(85696,38,3),(85699,38,6),(85698,38,11),(85689,38,13),(85690,38,37),(85688,38,38),(85691,38,64),(85695,38,70),(85693,38,74),(85692,38,76),(85249,39,1),(85255,39,2),(85254,39,3),(85242,39,5),(85257,39,6),(85256,39,11),(85247,39,13),(85246,39,18),(85243,39,21),(85248,39,33),(85241,39,39),(85250,39,53),(85252,39,56),(85244,39,57),(85253,39,70),(85251,39,72),(85245,39,76),(85651,40,1),(85654,40,2),(85653,40,3),(85661,40,6),(85660,40,11),(85656,40,36),(85650,40,40),(85659,40,44),(85658,40,47),(85652,40,49),(85657,40,58),(85655,40,70),(85669,41,1),(85673,41,2),(85672,41,3),(85678,41,6),(85677,41,11),(85663,41,13),(85664,41,35),(85670,41,36),(85665,41,40),(85662,41,41),(85676,41,44),(85675,41,47),(85667,41,49),(85674,41,58),(85671,41,70),(85668,41,75),(85666,41,76),(85368,42,1),(85373,42,2),(85372,42,3),(85376,42,6),(85375,42,11),(85363,42,35),(85366,42,36),(85362,42,42),(85370,42,44),(85374,42,47),(85364,42,49),(85369,42,58),(85371,42,70),(85367,42,75),(85365,42,76),(85381,43,1),(85387,43,2),(85386,43,3),(85393,43,6),(85392,43,11),(85378,43,13),(85380,43,35),(85388,43,36),(85379,43,42),(85377,43,43),(85391,43,44),(85390,43,47),(85382,43,49),(85389,43,58),(85385,43,70),(85384,43,75),(85383,43,76),(85224,44,1),(85225,44,2),(85226,44,3),(85229,44,6),(85228,44,11),(85223,44,44),(85227,44,70),(85233,45,1),(85235,45,2),(85234,45,3),(85238,45,6),(85237,45,11),(85231,45,13),(85232,45,44),(85230,45,45),(85236,45,70),(85436,47,1),(85437,47,2),(85438,47,3),(85441,47,6),(85440,47,11),(85435,47,47),(85439,47,70),(85459,48,1),(85462,48,2),(85461,48,3),(85464,48,6),(85463,48,11),(85454,48,13),(85455,48,35),(85456,48,47),(85453,48,48),(85460,48,70),(85458,48,75),(85457,48,76),(86045,49,1),(86048,49,2),(86047,49,3),(86050,49,6),(86049,49,11),(86041,49,36),(86044,49,44),(86043,49,47),(86040,49,49),(86042,49,58),(86046,49,70),(86091,50,1),(86098,50,2),(86097,50,3),(86100,50,6),(86099,50,11),(86078,50,13),(86090,50,18),(86079,50,21),(86092,50,33),(86080,50,35),(86086,50,36),(86095,50,44),(86094,50,47),(86081,50,49),(86077,50,50),(86089,50,53),(86093,50,56),(86082,50,57),(86085,50,58),(86083,50,59),(86096,50,70),(86088,50,72),(86087,50,75),(86084,50,76),(85949,51,1),(85954,51,2),(85953,51,3),(85956,51,6),(85955,51,11),(85948,51,51),(85952,51,70),(85950,51,74),(85951,51,75),(85966,52,1),(85971,52,2),(85970,52,3),(85974,52,6),(85973,52,11),(85958,52,13),(85968,52,18),(85959,52,19),(85965,52,21),(85960,52,35),(85961,52,51),(85957,52,52),(85967,52,53),(85969,52,70),(85972,52,72),(85963,52,74),(85964,52,75),(85962,52,76),(85701,53,1),(85702,53,2),(85703,53,3),(85706,53,6),(85705,53,11),(85700,53,53),(85704,53,70),(85838,54,1),(85839,54,2),(85840,54,3),(85843,54,6),(85842,54,11),(85837,54,54),(85841,54,70),(85847,55,1),(85849,55,2),(85848,55,3),(85852,55,6),(85851,55,11),(85845,55,13),(85846,55,54),(85844,55,55),(85850,55,70),(85469,56,1),(85470,56,2),(85471,56,3),(85474,56,6),(85473,56,11),(85468,56,56),(85472,56,70),(85480,57,1),(85483,57,2),(85482,57,3),(85485,57,6),(85484,57,11),(85476,57,13),(85477,57,33),(85478,57,56),(85475,57,57),(85481,57,70),(85479,57,76),(86003,58,1),(86004,58,2),(86005,58,3),(86008,58,6),(86007,58,11),(86002,58,58),(86006,58,70),(86013,59,1),(86023,59,2),(86022,59,3),(86032,59,6),(86031,59,11),(86010,59,13),(86020,59,18),(86012,59,21),(86027,59,33),(86014,59,35),(86025,59,36),(86030,59,44),(86029,59,47),(86015,59,49),(86011,59,50),(86019,59,53),(86028,59,56),(86016,59,57),(86026,59,58),(86009,59,59),(86021,59,70),(86018,59,72),(86024,59,75),(86017,59,76),(86059,60,1),(86071,60,2),(86070,60,3),(86052,60,5),(86076,60,6),(86075,60,11),(86056,60,13),(86068,60,18),(86058,60,21),(86057,60,33),(86060,60,35),(86064,60,36),(86074,60,44),(86073,60,47),(86061,60,49),(86053,60,50),(86067,60,53),(86063,60,56),(86054,60,57),(86072,60,58),(86062,60,59),(86051,60,60),(86069,60,70),(86066,60,72),(86065,60,75),(86055,60,76),(86141,61,1),(86145,61,2),(86144,61,3),(86147,61,6),(86146,61,11),(86138,61,13),(86139,61,36),(86140,61,44),(86142,61,47),(86137,61,61),(86143,61,70),(85975,62,62),(85394,64,64),(85983,65,1),(85991,65,2),(85990,65,3),(86001,65,6),(86000,65,11),(85981,65,13),(85994,65,18),(85977,65,19),(85984,65,21),(85996,65,33),(85978,65,35),(85988,65,36),(85999,65,44),(85998,65,47),(85985,65,49),(85979,65,50),(85993,65,53),(85997,65,56),(85986,65,57),(85995,65,58),(85987,65,59),(85976,65,65),(85989,65,70),(85992,65,72),(85982,65,75),(85980,65,76),(86253,66,1),(86252,66,2),(86254,66,3),(86255,66,5),(86256,66,6),(86250,66,9),(86257,66,11),(86258,66,13),(86259,66,15),(86260,66,16),(86261,66,17),(86262,66,18),(86263,66,19),(86264,66,20),(86265,66,21),(86266,66,22),(86267,66,30),(86268,66,31),(86269,66,32),(86270,66,33),(86271,66,34),(86272,66,35),(86273,66,36),(86274,66,37),(86275,66,38),(86276,66,39),(86277,66,40),(86278,66,41),(86279,66,42),(86280,66,43),(86281,66,44),(86282,66,45),(86283,66,47),(86284,66,48),(86285,66,49),(86286,66,50),(86287,66,51),(86288,66,52),(86289,66,53),(86290,66,54),(86291,66,55),(86292,66,56),(86293,66,57),(86294,66,58),(86295,66,59),(86296,66,60),(86297,66,61),(86298,66,64),(86299,66,65),(86249,66,66),(86300,66,67),(86301,66,69),(86302,66,70),(86303,66,71),(86304,66,72),(86305,66,73),(86306,66,74),(86307,66,75),(86308,66,76),(86309,66,101),(86310,66,102),(86251,66,103),(85337,67,1),(85345,67,2),(85344,67,3),(85334,67,5),(85349,67,6),(85348,67,11),(85342,67,13),(85341,67,18),(85336,67,21),(85338,67,33),(85335,67,37),(85346,67,53),(85333,67,67),(85343,67,70),(85347,67,72),(85340,67,74),(85339,67,76),(85446,69,1),(85450,69,2),(85449,69,3),(85452,69,6),(85451,69,11),(85443,69,35),(85444,69,47),(85442,69,69),(85448,69,70),(85445,69,75),(85447,69,76),(86333,70,6),(86332,70,11),(86331,70,70),(85418,71,1),(85421,71,2),(85420,71,3),(85424,71,6),(85423,71,11),(85419,71,58),(85422,71,70),(85417,71,71),(85429,72,1),(85431,72,2),(85430,72,3),(85434,72,6),(85433,72,11),(85426,72,13),(85427,72,18),(85432,72,70),(85425,72,72),(85428,72,76),(85569,73,1),(85574,73,2),(85573,73,3),(85564,73,5),(85579,73,6),(85578,73,11),(85571,73,13),(85575,73,18),(85565,73,19),(85568,73,21),(85567,73,33),(85576,73,53),(85566,73,64),(85572,73,70),(85577,73,72),(85563,73,73),(85570,73,76),(86334,74,74),(85415,75,75),(85416,76,76),(86174,100,1),(86170,100,2),(86156,100,3),(86154,100,5),(86181,100,6),(86173,100,9),(86151,100,11),(86212,100,13),(86192,100,15),(86193,100,16),(86153,100,17),(86210,100,18),(86209,100,19),(86194,100,20),(86208,100,21),(86213,100,22),(86178,100,30),(86179,100,31),(86175,100,32),(86187,100,33),(86157,100,34),(86161,100,35),(86206,100,36),(86184,100,37),(86185,100,38),(86152,100,39),(86182,100,40),(86183,100,41),(86158,100,42),(86159,100,43),(86149,100,44),(86150,100,45),(86167,100,47),(86169,100,48),(86202,100,49),(86204,100,50),(86195,100,51),(86196,100,52),(86186,100,53),(86190,100,54),(86191,100,55),(86171,100,56),(86172,100,57),(86199,100,58),(86200,100,59),(86203,100,60),(86207,100,61),(86197,100,62),(86160,100,64),(86198,100,65),(86211,100,66),(86155,100,67),(86168,100,69),(86214,100,70),(86165,100,71),(86166,100,72),(86177,100,73),(86215,100,74),(86163,100,75),(86164,100,76),(86148,100,100),(86162,100,101),(86201,100,102),(86188,100,103),(86189,100,104),(86180,100,105),(86176,100,106),(86205,100,107),(85408,101,1),(85412,101,2),(85411,101,3),(85414,101,6),(85413,101,11),(85405,101,13),(85406,101,35),(85410,101,70),(85407,101,75),(85409,101,76),(85404,101,101),(86034,102,1),(86035,102,2),(86036,102,3),(86039,102,6),(86038,102,11),(86037,102,70),(86033,102,102),(85709,103,1),(85710,103,2),(85711,103,3),(85712,103,5),(85713,103,6),(85768,103,9),(85714,103,11),(85715,103,13),(85716,103,15),(85717,103,16),(85718,103,17),(85719,103,18),(85720,103,19),(85721,103,20),(85722,103,21),(85723,103,22),(85724,103,30),(85725,103,31),(85726,103,32),(85727,103,33),(85728,103,34),(85729,103,35),(85730,103,36),(85731,103,37),(85732,103,38),(85733,103,39),(85734,103,40),(85735,103,41),(85736,103,42),(85737,103,43),(85738,103,44),(85739,103,45),(85740,103,47),(85741,103,48),(85742,103,49),(85743,103,50),(85744,103,51),(85745,103,52),(85746,103,53),(85747,103,54),(85748,103,55),(85749,103,56),(85750,103,57),(85751,103,58),(85752,103,59),(85753,103,60),(85754,103,61),(85755,103,64),(85756,103,65),(85757,103,67),(85758,103,69),(85759,103,70),(85760,103,71),(85761,103,72),(85762,103,73),(85763,103,74),(85764,103,75),(85765,103,76),(85766,103,101),(85767,103,102),(85708,103,103),(85777,104,1),(85776,104,2),(85775,104,3),(85774,104,5),(85778,104,6),(85770,104,9),(85779,104,11),(85780,104,13),(85781,104,15),(85782,104,16),(85783,104,17),(85784,104,18),(85785,104,19),(85786,104,20),(85787,104,21),(85788,104,22),(85789,104,30),(85790,104,31),(85791,104,32),(85792,104,33),(85793,104,34),(85794,104,35),(85795,104,36),(85796,104,37),(85797,104,38),(85798,104,39),(85799,104,40),(85800,104,41),(85801,104,42),(85802,104,43),(85803,104,44),(85804,104,45),(85805,104,47),(85806,104,48),(85807,104,49),(85808,104,50),(85809,104,51),(85810,104,52),(85811,104,53),(85812,104,54),(85813,104,55),(85814,104,56),(85815,104,57),(85816,104,58),(85817,104,59),(85818,104,60),(85819,104,61),(85835,104,62),(85820,104,64),(85821,104,65),(85771,104,66),(85822,104,67),(85823,104,69),(85824,104,70),(85825,104,71),(85826,104,72),(85827,104,73),(85828,104,74),(85829,104,75),(85830,104,76),(85772,104,100),(85831,104,101),(85832,104,102),(85773,104,103),(85769,104,104),(85834,104,105),(85833,104,106),(85836,104,107),(85648,105,105),(85562,106,6),(85561,106,11),(85560,106,106),(86110,107,1),(86122,107,2),(86121,107,3),(86103,107,5),(86127,107,6),(86126,107,11),(86107,107,13),(86119,107,18),(86109,107,21),(86108,107,33),(86111,107,35),(86115,107,36),(86125,107,44),(86124,107,47),(86112,107,49),(86104,107,50),(86118,107,53),(86114,107,56),(86105,107,57),(86123,107,58),(86113,107,59),(86102,107,60),(86120,107,70),(86117,107,72),(86116,107,75),(86106,107,76),(86101,107,107); +INSERT INTO `roleRole` VALUES (135896,1,1),(135897,1,2),(135898,1,3),(135901,1,6),(135900,1,11),(135899,1,70),(135813,2,2),(135815,2,6),(135814,2,11),(135680,3,3),(135682,3,6),(135681,3,11),(135638,5,1),(135647,5,2),(135646,5,3),(135637,5,5),(135654,5,6),(135651,5,11),(135644,5,13),(135643,5,18),(135639,5,21),(135640,5,33),(135653,5,36),(135656,5,44),(135655,5,47),(135650,5,49),(135648,5,53),(135652,5,58),(135645,5,70),(135649,5,72),(135641,5,76),(135642,5,111),(136006,6,6),(135836,9,1),(135837,9,2),(135838,9,3),(135839,9,5),(135840,9,6),(135834,9,9),(135841,9,11),(135842,9,13),(135843,9,15),(135844,9,16),(135845,9,17),(135846,9,18),(135847,9,19),(135848,9,20),(135849,9,21),(135850,9,22),(135851,9,30),(135852,9,31),(135853,9,32),(135854,9,33),(135855,9,34),(135856,9,35),(135857,9,36),(135858,9,37),(135859,9,38),(135860,9,39),(135861,9,40),(135862,9,41),(135863,9,42),(135864,9,43),(135865,9,44),(135866,9,45),(135867,9,47),(135868,9,48),(135869,9,49),(135870,9,50),(135871,9,51),(135872,9,52),(135873,9,53),(135874,9,54),(135875,9,55),(135876,9,56),(135877,9,57),(135878,9,58),(135879,9,59),(135880,9,60),(135881,9,61),(135882,9,64),(135883,9,65),(135884,9,67),(135885,9,69),(135886,9,70),(135887,9,71),(135888,9,72),(135889,9,73),(135890,9,74),(135891,9,75),(135892,9,76),(135893,9,101),(135894,9,102),(135835,9,103),(135895,9,111),(135551,11,6),(135550,11,11),(136772,13,1),(136773,13,2),(136774,13,3),(136777,13,6),(136776,13,11),(136771,13,13),(136775,13,70),(136227,15,1),(136233,15,2),(136232,15,3),(136235,15,6),(136234,15,11),(136219,15,15),(136220,15,35),(136224,15,36),(136230,15,44),(136229,15,47),(136221,15,49),(136222,15,56),(136228,15,58),(136231,15,70),(136226,15,75),(136223,15,76),(136225,15,111),(136242,16,1),(136247,16,2),(136246,16,3),(136254,16,6),(136253,16,11),(136237,16,13),(136238,16,15),(136236,16,16),(136241,16,35),(136249,16,36),(136252,16,44),(136251,16,47),(136240,16,49),(136243,16,56),(136250,16,58),(136245,16,70),(136244,16,75),(136239,16,76),(136248,16,111),(135583,17,1),(135594,17,2),(135593,17,3),(135588,17,5),(135618,17,6),(135587,17,9),(135617,17,11),(135586,17,13),(135598,17,15),(135585,17,16),(135575,17,17),(135601,17,18),(135597,17,19),(135576,17,20),(135589,17,21),(135616,17,22),(135615,17,30),(135614,17,31),(135613,17,32),(135591,17,33),(135612,17,34),(135596,17,35),(135611,17,36),(135577,17,37),(135610,17,38),(135578,17,39),(135609,17,40),(135608,17,41),(135607,17,42),(135606,17,43),(135605,17,44),(135619,17,45),(135620,17,47),(135621,17,48),(135622,17,49),(135595,17,50),(135623,17,51),(135624,17,52),(135602,17,53),(135625,17,54),(135626,17,55),(135604,17,56),(135590,17,57),(135627,17,58),(135628,17,59),(135629,17,60),(135630,17,61),(135579,17,64),(135584,17,65),(135580,17,67),(135631,17,69),(135592,17,70),(135632,17,71),(135603,17,72),(135633,17,73),(135582,17,74),(135634,17,75),(135581,17,76),(135635,17,101),(135636,17,102),(135599,17,103),(135600,17,111),(136684,18,1),(136687,18,2),(136686,18,3),(136690,18,6),(136689,18,11),(136683,18,18),(136688,18,70),(136685,18,76),(136673,19,1),(136678,19,2),(136677,19,3),(136682,19,6),(136681,19,11),(136666,19,13),(136667,19,18),(136664,19,19),(136665,19,21),(136675,19,36),(136680,19,44),(136679,19,47),(136672,19,49),(136668,19,53),(136674,19,58),(136676,19,70),(136669,19,72),(136670,19,76),(136671,19,111),(136279,20,1),(136287,20,2),(136286,20,3),(136285,20,5),(136284,20,6),(136271,20,9),(136283,20,11),(136272,20,13),(136278,20,15),(136273,20,16),(136282,20,17),(136288,20,18),(136277,20,19),(136270,20,20),(136289,20,21),(136290,20,22),(136291,20,30),(136292,20,31),(136293,20,32),(136294,20,33),(136295,20,34),(136276,20,35),(136296,20,36),(136297,20,37),(136298,20,38),(136299,20,39),(136300,20,40),(136301,20,41),(136302,20,42),(136303,20,43),(136304,20,44),(136305,20,45),(136306,20,47),(136307,20,48),(136308,20,49),(136281,20,50),(136309,20,51),(136310,20,52),(136311,20,53),(136312,20,54),(136313,20,55),(136314,20,56),(136315,20,57),(136316,20,58),(136317,20,59),(136318,20,60),(136319,20,61),(136320,20,64),(136274,20,65),(136321,20,67),(136322,20,69),(136323,20,70),(136324,20,71),(136325,20,72),(136326,20,73),(136327,20,74),(136328,20,75),(136275,20,76),(136329,20,101),(136330,20,102),(136280,20,103),(136331,20,111),(136654,21,1),(136659,21,2),(136658,21,3),(136663,21,6),(136662,21,11),(136647,21,13),(136648,21,18),(136646,21,21),(136656,21,36),(136661,21,44),(136660,21,47),(136653,21,49),(136649,21,53),(136655,21,58),(136657,21,70),(136650,21,72),(136651,21,76),(136652,21,111),(136782,22,1),(136790,22,2),(136789,22,3),(136796,22,6),(136793,22,11),(136779,22,13),(136781,22,18),(136780,22,21),(136778,22,22),(136792,22,36),(136795,22,44),(136794,22,47),(136787,22,49),(136783,22,53),(136791,22,58),(136788,22,70),(136784,22,72),(136785,22,76),(136786,22,111),(135948,30,1),(135958,30,2),(135957,30,3),(135937,30,5),(135968,30,6),(135944,30,9),(135970,30,11),(135943,30,13),(135952,30,15),(135949,30,16),(135967,30,17),(135955,30,18),(135951,30,19),(135938,30,20),(135947,30,21),(135939,30,22),(135936,30,30),(135966,30,31),(135965,30,32),(135946,30,33),(135964,30,34),(135959,30,35),(135963,30,36),(135962,30,37),(135961,30,38),(135971,30,39),(135972,30,40),(135973,30,41),(135974,30,42),(135975,30,43),(135976,30,44),(135977,30,45),(135978,30,47),(135979,30,48),(135969,30,49),(135960,30,50),(135980,30,51),(135981,30,52),(135940,30,53),(135982,30,54),(135983,30,55),(135984,30,56),(135985,30,57),(135986,30,58),(135987,30,59),(135988,30,60),(135989,30,61),(135941,30,64),(135950,30,65),(135990,30,67),(135991,30,69),(135956,30,70),(135992,30,71),(135954,30,72),(135993,30,73),(135994,30,74),(135995,30,75),(135942,30,76),(135996,30,101),(135997,30,102),(135953,30,103),(135945,30,111),(135999,31,1),(136000,31,2),(136001,31,3),(136004,31,6),(136003,31,11),(135998,31,31),(136002,31,70),(135904,32,1),(135905,32,2),(135906,32,3),(135909,32,6),(135908,32,11),(135903,32,32),(135907,32,70),(136066,33,33),(135684,34,1),(135689,34,2),(135688,34,3),(135691,34,6),(135690,34,11),(135685,34,13),(135686,34,33),(135683,34,34),(135687,34,70),(135728,35,1),(135734,35,2),(135733,35,3),(135736,35,6),(135735,35,11),(135727,35,35),(135732,35,70),(135729,35,75),(135730,35,76),(135731,35,111),(136554,36,1),(136556,36,2),(136555,36,3),(136559,36,6),(136558,36,11),(136550,36,36),(136551,36,44),(136552,36,47),(136557,36,70),(136553,36,111),(136039,37,1),(136044,37,2),(136043,37,3),(136046,37,6),(136045,37,11),(136038,37,37),(136042,37,70),(136040,37,74),(136041,37,76),(136053,38,1),(136056,38,2),(136055,38,3),(136058,38,6),(136057,38,11),(136048,38,13),(136049,38,37),(136047,38,38),(136050,38,64),(136054,38,70),(136052,38,74),(136051,38,76),(135560,39,1),(135568,39,2),(135567,39,3),(135553,39,5),(135574,39,6),(135571,39,11),(135557,39,13),(135561,39,18),(135554,39,21),(135559,39,33),(135570,39,36),(135552,39,39),(135573,39,44),(135572,39,47),(135565,39,49),(135562,39,53),(135564,39,56),(135555,39,57),(135569,39,58),(135566,39,70),(135563,39,72),(135556,39,76),(135558,39,111),(136008,40,1),(136011,40,2),(136010,40,3),(136019,40,6),(136017,40,11),(136013,40,36),(136007,40,40),(136016,40,44),(136015,40,47),(136009,40,49),(136014,40,58),(136012,40,70),(136018,40,111),(136028,41,1),(136032,41,2),(136031,41,3),(136037,41,6),(136036,41,11),(136021,41,13),(136022,41,35),(136029,41,36),(136023,41,40),(136020,41,41),(136035,41,44),(136034,41,47),(136025,41,49),(136033,41,58),(136030,41,70),(136027,41,75),(136024,41,76),(136026,41,111),(135698,42,1),(135705,42,2),(135704,42,3),(135707,42,6),(135706,42,11),(135693,42,35),(135699,42,36),(135692,42,42),(135702,42,44),(135701,42,47),(135694,42,49),(135700,42,58),(135703,42,70),(135697,42,75),(135695,42,76),(135696,42,111),(135714,43,1),(135719,43,2),(135718,43,3),(135725,43,6),(135724,43,11),(135709,43,13),(135713,43,35),(135720,43,36),(135710,43,42),(135708,43,43),(135723,43,44),(135722,43,47),(135712,43,49),(135721,43,58),(135717,43,70),(135716,43,75),(135715,43,76),(135711,43,111),(135535,44,1),(135536,44,2),(135537,44,3),(135540,44,6),(135539,44,11),(135534,44,44),(135538,44,70),(135544,45,1),(135546,45,2),(135545,45,3),(135549,45,6),(135548,45,11),(135542,45,13),(135543,45,44),(135541,45,45),(135547,45,70),(135776,47,1),(135779,47,2),(135778,47,3),(135782,47,6),(135781,47,11),(135775,47,47),(135780,47,70),(135777,47,111),(135805,48,1),(135810,48,2),(135809,48,3),(135812,48,6),(135811,48,11),(135796,48,13),(135797,48,35),(135801,48,36),(135807,48,44),(135798,48,47),(135795,48,48),(135799,48,49),(135806,48,58),(135800,48,69),(135808,48,70),(135804,48,75),(135803,48,76),(135802,48,111),(136463,49,1),(136465,49,2),(136464,49,3),(136469,49,6),(136468,49,11),(136459,49,36),(136462,49,44),(136461,49,47),(136458,49,49),(136460,49,58),(136467,49,70),(136466,49,111),(136511,50,1),(136519,50,2),(136518,50,3),(136521,50,6),(136520,50,11),(136498,50,13),(136510,50,18),(136499,50,21),(136513,50,33),(136500,50,35),(136505,50,36),(136516,50,44),(136515,50,47),(136501,50,49),(136497,50,50),(136509,50,53),(136514,50,56),(136502,50,57),(136512,50,58),(136503,50,59),(136517,50,70),(136508,50,72),(136507,50,75),(136504,50,76),(136506,50,111),(136333,51,1),(136342,51,2),(136341,51,3),(136351,51,6),(136348,51,11),(136339,51,13),(136338,51,18),(136334,51,21),(136335,51,35),(136350,51,36),(136353,51,44),(136352,51,47),(136347,51,49),(136332,51,51),(136343,51,53),(136349,51,58),(136340,51,70),(136344,51,72),(136336,51,74),(136337,51,75),(136345,51,76),(136346,51,111),(136362,52,1),(136368,52,2),(136367,52,3),(136375,52,6),(136372,52,11),(136355,52,13),(136365,52,18),(136356,52,19),(136361,52,21),(136360,52,35),(136374,52,36),(136377,52,44),(136376,52,47),(136371,52,49),(136357,52,51),(136354,52,52),(136364,52,53),(136373,52,58),(136366,52,70),(136369,52,72),(136359,52,74),(136363,52,75),(136358,52,76),(136370,52,111),(136060,53,1),(136061,53,2),(136062,53,3),(136065,53,6),(136064,53,11),(136059,53,53),(136063,53,70),(136204,54,1),(136205,54,2),(136206,54,3),(136209,54,6),(136208,54,11),(136203,54,54),(136207,54,70),(136213,55,1),(136215,55,2),(136214,55,3),(136218,55,6),(136217,55,11),(136211,55,13),(136212,55,54),(136210,55,55),(136216,55,70),(135817,56,1),(135818,56,2),(135819,56,3),(135822,56,6),(135821,56,11),(135816,56,56),(135820,56,70),(135828,57,1),(135831,57,2),(135830,57,3),(135833,57,6),(135832,57,11),(135824,57,13),(135825,57,33),(135826,57,56),(135823,57,57),(135829,57,70),(135827,57,76),(136407,58,1),(136408,58,2),(136409,58,3),(136412,58,6),(136411,58,11),(136406,58,58),(136410,58,70),(136417,59,1),(136427,59,2),(136426,59,3),(136437,59,6),(136436,59,11),(136414,59,13),(136424,59,18),(136416,59,21),(136432,59,33),(136418,59,35),(136430,59,36),(136435,59,44),(136434,59,47),(136419,59,49),(136415,59,50),(136423,59,53),(136433,59,56),(136420,59,57),(136431,59,58),(136413,59,59),(136425,59,70),(136422,59,72),(136428,59,75),(136421,59,76),(136429,59,111),(136478,60,1),(136492,60,2),(136491,60,3),(136471,60,5),(136496,60,6),(136495,60,11),(136479,60,13),(136489,60,18),(136477,60,21),(136476,60,33),(136480,60,35),(136485,60,36),(136494,60,44),(136493,60,47),(136481,60,49),(136472,60,50),(136488,60,53),(136483,60,56),(136473,60,57),(136484,60,58),(136482,60,59),(136470,60,60),(136490,60,70),(136487,60,72),(136486,60,75),(136474,60,76),(136475,60,111),(136564,61,1),(136568,61,2),(136567,61,3),(136571,61,6),(136570,61,11),(136561,61,13),(136562,61,36),(136563,61,44),(136565,61,47),(136560,61,61),(136566,61,70),(136569,61,111),(136378,62,62),(135726,64,64),(136386,65,1),(136396,65,2),(136395,65,3),(136405,65,6),(136404,65,11),(136388,65,13),(136399,65,18),(136380,65,19),(136387,65,21),(136400,65,33),(136381,65,35),(136393,65,36),(136403,65,44),(136402,65,47),(136389,65,49),(136382,65,50),(136398,65,53),(136401,65,56),(136390,65,57),(136392,65,58),(136391,65,59),(136379,65,65),(136394,65,70),(136397,65,72),(136385,65,75),(136383,65,76),(136384,65,111),(136705,66,1),(136704,66,2),(136706,66,3),(136707,66,5),(136708,66,6),(136702,66,9),(136709,66,11),(136710,66,13),(136711,66,15),(136712,66,16),(136713,66,17),(136714,66,18),(136715,66,19),(136716,66,20),(136717,66,21),(136718,66,22),(136719,66,30),(136720,66,31),(136721,66,32),(136722,66,33),(136723,66,34),(136724,66,35),(136725,66,36),(136726,66,37),(136727,66,38),(136728,66,39),(136729,66,40),(136730,66,41),(136731,66,42),(136732,66,43),(136733,66,44),(136734,66,45),(136735,66,47),(136736,66,48),(136737,66,49),(136738,66,50),(136739,66,51),(136740,66,52),(136741,66,53),(136742,66,54),(136743,66,55),(136744,66,56),(136745,66,57),(136746,66,58),(136747,66,59),(136748,66,60),(136749,66,61),(136750,66,64),(136751,66,65),(136701,66,66),(136752,66,67),(136753,66,69),(136754,66,70),(136755,66,71),(136756,66,72),(136757,66,73),(136758,66,74),(136759,66,75),(136760,66,76),(136761,66,101),(136762,66,102),(136703,66,103),(136763,66,111),(135661,67,1),(135671,67,2),(135670,67,3),(135658,67,5),(135677,67,6),(135674,67,11),(135668,67,13),(135667,67,18),(135660,67,21),(135662,67,33),(135676,67,36),(135659,67,37),(135679,67,44),(135678,67,47),(135673,67,49),(135666,67,53),(135675,67,58),(135657,67,67),(135669,67,70),(135672,67,72),(135665,67,74),(135663,67,76),(135664,67,111),(135787,69,1),(135792,69,2),(135791,69,3),(135794,69,6),(135793,69,11),(135784,69,35),(135785,69,47),(135783,69,69),(135790,69,70),(135786,69,75),(135788,69,76),(135789,69,111),(136799,70,6),(136798,70,11),(136797,70,70),(135753,71,1),(135756,71,2),(135755,71,3),(135759,71,6),(135758,71,11),(135754,71,58),(135757,71,70),(135752,71,71),(135766,72,1),(135771,72,2),(135770,72,3),(135774,72,6),(135773,72,11),(135761,72,18),(135764,72,36),(135768,72,44),(135772,72,47),(135762,72,49),(135767,72,58),(135769,72,70),(135760,72,72),(135765,72,76),(135763,72,111),(135919,73,1),(135926,73,2),(135925,73,3),(135914,73,5),(135933,73,6),(135930,73,11),(135923,73,13),(135922,73,18),(135915,73,19),(135918,73,21),(135917,73,33),(135932,73,36),(135935,73,44),(135934,73,47),(135929,73,49),(135927,73,53),(135931,73,58),(135916,73,64),(135924,73,70),(135928,73,72),(135913,73,73),(135920,73,76),(135921,73,111),(136800,74,74),(135750,75,75),(135751,76,76),(136598,100,1),(136594,100,2),(136580,100,3),(136578,100,5),(136606,100,6),(136597,100,9),(136575,100,11),(136642,100,13),(136617,100,15),(136618,100,16),(136577,100,17),(136638,100,18),(136637,100,19),(136621,100,20),(136636,100,21),(136643,100,22),(136603,100,30),(136604,100,31),(136600,100,32),(136612,100,33),(136581,100,34),(136585,100,35),(136634,100,36),(136609,100,37),(136610,100,38),(136576,100,39),(136607,100,40),(136608,100,41),(136582,100,42),(136583,100,43),(136573,100,44),(136574,100,45),(136591,100,47),(136593,100,48),(136630,100,49),(136632,100,50),(136622,100,51),(136623,100,52),(136611,100,53),(136615,100,54),(136616,100,55),(136595,100,56),(136596,100,57),(136626,100,58),(136627,100,59),(136631,100,60),(136635,100,61),(136624,100,62),(136584,100,64),(136625,100,65),(136640,100,66),(136579,100,67),(136592,100,69),(136644,100,70),(136589,100,71),(136590,100,72),(136602,100,73),(136645,100,74),(136587,100,75),(136588,100,76),(136572,100,100),(136586,100,101),(136629,100,102),(136613,100,103),(136614,100,104),(136605,100,105),(136601,100,106),(136633,100,107),(136641,100,108),(136639,100,109),(136628,100,110),(136599,100,111),(136619,100,112),(136620,100,114),(135743,101,1),(135747,101,2),(135746,101,3),(135749,101,6),(135748,101,11),(135738,101,13),(135739,101,18),(135740,101,35),(135745,101,70),(135741,101,75),(135742,101,76),(135737,101,101),(135744,101,111),(136447,102,1),(136452,102,2),(136451,102,3),(136457,102,6),(136456,102,11),(136448,102,13),(136449,102,35),(136450,102,70),(136453,102,75),(136454,102,76),(136446,102,102),(136455,102,111),(136068,103,1),(136069,103,2),(136070,103,3),(136071,103,5),(136072,103,6),(136127,103,9),(136073,103,11),(136074,103,13),(136075,103,15),(136076,103,16),(136077,103,17),(136078,103,18),(136079,103,19),(136080,103,20),(136081,103,21),(136082,103,22),(136083,103,30),(136084,103,31),(136085,103,32),(136086,103,33),(136087,103,34),(136088,103,35),(136089,103,36),(136090,103,37),(136091,103,38),(136092,103,39),(136093,103,40),(136094,103,41),(136095,103,42),(136096,103,43),(136097,103,44),(136098,103,45),(136099,103,47),(136100,103,48),(136101,103,49),(136102,103,50),(136103,103,51),(136104,103,52),(136105,103,53),(136106,103,54),(136107,103,55),(136108,103,56),(136109,103,57),(136110,103,58),(136111,103,59),(136112,103,60),(136113,103,61),(136114,103,64),(136115,103,65),(136116,103,67),(136117,103,69),(136118,103,70),(136119,103,71),(136120,103,72),(136121,103,73),(136122,103,74),(136123,103,75),(136124,103,76),(136125,103,101),(136126,103,102),(136067,103,103),(136128,103,111),(136137,104,1),(136136,104,2),(136135,104,3),(136134,104,5),(136138,104,6),(136130,104,9),(136139,104,11),(136140,104,13),(136141,104,15),(136142,104,16),(136143,104,17),(136144,104,18),(136145,104,19),(136146,104,20),(136147,104,21),(136148,104,22),(136149,104,30),(136150,104,31),(136151,104,32),(136152,104,33),(136153,104,34),(136154,104,35),(136155,104,36),(136156,104,37),(136157,104,38),(136158,104,39),(136159,104,40),(136160,104,41),(136161,104,42),(136162,104,43),(136163,104,44),(136164,104,45),(136165,104,47),(136166,104,48),(136167,104,49),(136168,104,50),(136169,104,51),(136170,104,52),(136171,104,53),(136172,104,54),(136173,104,55),(136174,104,56),(136175,104,57),(136176,104,58),(136177,104,59),(136178,104,60),(136179,104,61),(136198,104,62),(136180,104,64),(136181,104,65),(136131,104,66),(136182,104,67),(136183,104,69),(136184,104,70),(136185,104,71),(136186,104,72),(136187,104,73),(136188,104,74),(136189,104,75),(136190,104,76),(136132,104,100),(136191,104,101),(136192,104,102),(136133,104,103),(136129,104,104),(136195,104,105),(136194,104,106),(136200,104,107),(136202,104,108),(136201,104,109),(136199,104,110),(136193,104,111),(136196,104,112),(136197,104,114),(136005,105,105),(135912,106,6),(135911,106,11),(135910,106,106),(136531,107,1),(136545,107,2),(136544,107,3),(136524,107,5),(136549,107,6),(136548,107,11),(136532,107,13),(136542,107,18),(136530,107,21),(136529,107,33),(136533,107,35),(136538,107,36),(136547,107,44),(136546,107,47),(136534,107,49),(136525,107,50),(136541,107,53),(136536,107,56),(136526,107,57),(136537,107,58),(136535,107,59),(136523,107,60),(136543,107,70),(136540,107,72),(136539,107,75),(136527,107,76),(136522,107,107),(136528,107,111),(136765,108,1),(136766,108,2),(136767,108,3),(136770,108,6),(136769,108,11),(136768,108,70),(136764,108,108),(136695,109,1),(136697,109,2),(136696,109,3),(136700,109,6),(136699,109,11),(136692,109,13),(136693,109,18),(136698,109,70),(136694,109,76),(136691,109,109),(136439,110,1),(136442,110,2),(136441,110,3),(136445,110,6),(136444,110,11),(136443,110,70),(136440,110,76),(136438,110,110),(135902,111,111),(136256,112,1),(136257,112,2),(136258,112,3),(136261,112,6),(136260,112,11),(136259,112,70),(136255,112,112),(136264,114,1),(136265,114,2),(136266,114,3),(136269,114,6),(136268,114,11),(136267,114,70),(136263,114,112),(136262,114,114); /*!40000 ALTER TABLE `roleRole` ENABLE KEYS */; UNLOCK TABLES; @@ -108,7 +108,7 @@ UNLOCK TABLES; LOCK TABLES `userPassword` WRITE; /*!40000 ALTER TABLE `userPassword` DISABLE KEYS */; -INSERT INTO `userPassword` VALUES (1,7,1,0,1,1); +INSERT INTO `userPassword` VALUES (1,7,1,0,2,1); /*!40000 ALTER TABLE `userPassword` ENABLE KEYS */; UNLOCK TABLES; @@ -140,18 +140,18 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 15:58:27 +-- Dump completed on 2023-02-20 14:45:52 USE `salix`; --- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.18-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: salix +-- Host: db-proxy.verdnatura.es Database: salix -- ------------------------------------------------------ --- Server version 5.6.25-4-log +-- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; +/*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; @@ -164,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'),(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'); +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'),(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','*','READ','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','refund','WRITE','ALLOW','ROLE','invoicing'),(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'),(309,'Zone','getZoneClosing','*','ALLOW','ROLE','employee'),(310,'ExpeditionState','*','READ','ALLOW','ROLE','employee'),(311,'Expense','*','READ','ALLOW','ROLE','employee'),(312,'Expense','*','WRITE','ALLOW','ROLE','administrative'),(314,'SupplierActivity','*','READ','ALLOW','ROLE','employee'),(315,'SupplierActivity','*','WRITE','ALLOW','ROLE','administrative'),(316,'Dms','deleteTrashFiles','WRITE','ALLOW','ROLE','employee'),(317,'ClientUnpaid','*','*','ALLOW','ROLE','administrative'),(318,'MdbVersion','*','*','ALLOW','ROLE','developer'),(319,'ItemType','*','READ','ALLOW','ROLE','employee'),(320,'ItemType','*','WRITE','ALLOW','ROLE','buyer'),(321,'InvoiceOut','refund','WRITE','ALLOW','ROLE','invoicing'),(322,'InvoiceOut','refund','WRITE','ALLOW','ROLE','salesAssistant'),(323,'InvoiceOut','refund','WRITE','ALLOW','ROLE','claimManager'),(324,'Ticket','refund','WRITE','ALLOW','ROLE','invoicing'),(325,'Ticket','refund','WRITE','ALLOW','ROLE','salesAssistant'),(326,'Ticket','refund','WRITE','ALLOW','ROLE','claimManager'),(327,'Sale','refund','WRITE','ALLOW','ROLE','salesAssistant'),(328,'Sale','refund','WRITE','ALLOW','ROLE','claimManager'),(329,'TicketRefund','*','WRITE','ALLOW','ROLE','invoicing'),(330,'ClaimObservation','*','WRITE','ALLOW','ROLE','salesPerson'),(331,'ClaimObservation','*','READ','ALLOW','ROLE','salesPerson'),(332,'Client','setPassword','WRITE','ALLOW','ROLE','salesPerson'),(333,'Client','updateUser','WRITE','ALLOW','ROLE','salesPerson'),(334,'ShelvingLog','*','READ','ALLOW','ROLE','employee'),(335,'ZoneExclusionGeo','*','READ','ALLOW','ROLE','employee'),(336,'ZoneExclusionGeo','*','WRITE','ALLOW','ROLE','deliveryBoss'),(337,'Parking','*','*','ALLOW','ROLE','employee'),(338,'Shelving','*','*','ALLOW','ROLE','employee'),(339,'OsTicket','*','*','ALLOW','ROLE','employee'),(340,'OsTicketConfig','*','*','ALLOW','ROLE','it'),(341,'ClientConsumptionQueue','*','WRITE','ALLOW','ROLE','employee'),(342,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','employee'),(343,'Ticket','deliveryNoteEmail','WRITE','ALLOW','ROLE','employee'),(344,'Ticket','deliveryNoteCsvPdf','READ','ALLOW','ROLE','employee'),(345,'Ticket','deliveryNoteCsvEmail','WRITE','ALLOW','ROLE','employee'),(346,'Client','campaignMetricsPdf','READ','ALLOW','ROLE','employee'),(347,'Client','campaignMetricsEmail','WRITE','ALLOW','ROLE','employee'),(348,'Client','clientWelcomeHtml','READ','ALLOW','ROLE','employee'),(349,'Client','clientWelcomeEmail','WRITE','ALLOW','ROLE','employee'),(350,'Client','creditRequestPdf','READ','ALLOW','ROLE','employee'),(351,'Client','creditRequestHtml','READ','ALLOW','ROLE','employee'),(352,'Client','creditRequestEmail','WRITE','ALLOW','ROLE','employee'),(353,'Client','printerSetupHtml','READ','ALLOW','ROLE','employee'),(354,'Client','printerSetupEmail','WRITE','ALLOW','ROLE','employee'),(355,'Client','sepaCoreEmail','WRITE','ALLOW','ROLE','employee'),(356,'Client','letterDebtorPdf','READ','ALLOW','ROLE','employee'),(357,'Client','letterDebtorStHtml','READ','ALLOW','ROLE','employee'),(358,'Client','letterDebtorStEmail','WRITE','ALLOW','ROLE','employee'),(359,'Client','letterDebtorNdHtml','READ','ALLOW','ROLE','employee'),(360,'Client','letterDebtorNdEmail','WRITE','ALLOW','ROLE','employee'),(361,'Client','clientDebtStatementPdf','READ','ALLOW','ROLE','employee'),(362,'Client','clientDebtStatementHtml','READ','ALLOW','ROLE','employee'),(363,'Client','clientDebtStatementEmail','WRITE','ALLOW','ROLE','employee'),(364,'Client','incotermsAuthorizationPdf','READ','ALLOW','ROLE','employee'),(365,'Client','incotermsAuthorizationHtml','READ','ALLOW','ROLE','employee'),(366,'Client','incotermsAuthorizationEmail','WRITE','ALLOW','ROLE','employee'),(367,'Client','consumptionSendQueued','WRITE','ALLOW','ROLE','system'),(368,'InvoiceOut','invoiceEmail','WRITE','ALLOW','ROLE','employee'),(369,'InvoiceOut','exportationPdf','READ','ALLOW','ROLE','employee'),(370,'InvoiceOut','sendQueued','WRITE','ALLOW','ROLE','system'),(371,'Ticket','invoiceCsvPdf','READ','ALLOW','ROLE','employee'),(372,'Ticket','invoiceCsvEmail','WRITE','ALLOW','ROLE','employee'),(373,'Supplier','campaignMetricsPdf','READ','ALLOW','ROLE','employee'),(374,'Supplier','campaignMetricsEmail','WRITE','ALLOW','ROLE','employee'),(375,'Travel','extraCommunityPdf','READ','ALLOW','ROLE','employee'),(376,'Travel','extraCommunityEmail','WRITE','ALLOW','ROLE','employee'),(377,'Entry','entryOrderPdf','READ','ALLOW','ROLE','employee'),(378,'OsTicket','osTicketReportEmail','WRITE','ALLOW','ROLE','system'),(379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system'),(380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee'),(381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager'),(382,'Item','labelPdf','READ','ALLOW','ROLE','employee'),(383,'Sector','*','READ','ALLOW','ROLE','employee'),(384,'Sector','*','WRITE','ALLOW','ROLE','employee'),(385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee'),(386,'Route','driverRouteEmail','WRITE','ALLOW','ROLE','employee'),(387,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','customer'),(388,'Supplier','newSupplier','WRITE','ALLOW','ROLE','administrative'),(389,'ClaimRma','*','READ','ALLOW','ROLE','claimManager'),(390,'ClaimRma','*','WRITE','ALLOW','ROLE','claimManager'),(391,'Notification','*','WRITE','ALLOW','ROLE','system'),(392,'Boxing','*','*','ALLOW','ROLE','employee'),(393,'Url','*','READ','ALLOW','ROLE','employee'),(394,'Url','*','WRITE','ALLOW','ROLE','it'),(395,'ItemShelving','*','READ','ALLOW','ROLE','employee'),(396,'ItemShelving','*','WRITE','ALLOW','ROLE','production'),(397,'ItemShelvingPlacementSupplyStock','*','READ','ALLOW','ROLE','employee'),(398,'NotificationQueue','*','*','ALLOW','ROLE','employee'),(399,'InvoiceOut','clientsToInvoice','WRITE','ALLOW','ROLE','invoicing'),(400,'InvoiceOut','invoiceClient','WRITE','ALLOW','ROLE','invoicing'),(401,'Sale','editTracked','WRITE','ALLOW','ROLE','production'),(402,'Sale','editFloramondo','WRITE','ALLOW','ROLE','salesAssistant'),(403,'Receipt','balanceCompensationEmail','WRITE','ALLOW','ROLE','employee'),(404,'Receipt','balanceCompensationPdf','READ','ALLOW','ROLE','employee'),(405,'Ticket','getTicketsFuture','READ','ALLOW','ROLE','employee'),(406,'Ticket','merge','WRITE','ALLOW','ROLE','employee'),(407,'Sale','editFloramondo','WRITE','ALLOW','ROLE','logistic'),(408,'ZipConfig','*','*','ALLOW','ROLE','employee'),(409,'Item','*','WRITE','ALLOW','ROLE','administrative'),(410,'Sale','editCloned','WRITE','ALLOW','ROLE','buyer'),(411,'Sale','editCloned','WRITE','ALLOW','ROLE','salesAssistant'),(414,'MdbVersion','*','READ','ALLOW','ROLE','$everyone'),(415,'Dms','saveSign','*','ALLOW','ROLE','employee'),(416,'TicketLog','getChanges','READ','ALLOW','ROLE','employee'),(417,'Ticket','getTicketsAdvance','READ','ALLOW','ROLE','employee'),(418,'EntryLog','*','READ','ALLOW','ROLE','administrative'),(419,'Sale','editTracked','WRITE','ALLOW','ROLE','buyer'),(420,'MdbBranch','*','READ','ALLOW','ROLE','$everyone'),(421,'ItemShelvingSale','*','*','ALLOW','ROLE','employee'),(422,'Docuware','checkFile','READ','ALLOW','ROLE','employee'),(423,'Docuware','download','READ','ALLOW','ROLE','salesPerson'),(424,'Docuware','upload','WRITE','ALLOW','ROLE','productionAssi'),(425,'Docuware','deliveryNoteEmail','WRITE','ALLOW','ROLE','salesPerson'),(426,'TpvTransaction','confirm','WRITE','ALLOW','ROLE','$everyone'),(427,'TpvTransaction','start','WRITE','ALLOW','ROLE','$authenticated'),(428,'TpvTransaction','end','WRITE','ALLOW','ROLE','$authenticated'),(429,'ItemConfig','*','READ','ALLOW','ROLE','employee'),(431,'Tag','onSubmit','WRITE','ALLOW','ROLE','employee'),(432,'Worker','updateAttributes','WRITE','ALLOW','ROLE','hr'),(433,'Worker','createAbsence','*','ALLOW','ROLE','employee'),(434,'Worker','updateAbsence','WRITE','ALLOW','ROLE','employee'),(435,'Worker','deleteAbsence','*','ALLOW','ROLE','employee'),(436,'Worker','new','WRITE','ALLOW','ROLE','hr'),(437,'Role','*','READ','ALLOW','ROLE','hr'),(438,'Client','getClientOrSupplierReference','READ','ALLOW','ROLE','employee'); /*!40000 ALTER TABLE `ACL` ENABLE KEYS */; UNLOCK TABLES; @@ -184,7 +184,7 @@ UNLOCK TABLES; LOCK TABLES `module` WRITE; /*!40000 ALTER TABLE `module` DISABLE KEYS */; -INSERT INTO `module` VALUES ('Claims'),('Clients'),('Entries'),('Invoices in'),('Invoices out'),('Items'),('Monitors'),('Orders'),('Routes'),('Suppliers'),('Tickets'),('Travels'),('Users'),('Workers'),('Zones'); +INSERT INTO `module` VALUES ('account'),('claim'),('customer'),('entry'),('invoiceIn'),('invoiceOut'),('item'),('monitor'),('order'),('route'),('shelving'),('supplier'),('ticket'),('travel'),('worker'),('zone'); /*!40000 ALTER TABLE `module` ENABLE KEYS */; UNLOCK TABLES; @@ -194,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,\"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}'); +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}'),('clientsDetail','{\"id\":true,\"phone\":true,\"city\":true,\"socialName\":true,\"salesPersonFk\":true,\"email\":true,\"name\":false,\"fi\":false,\"credit\":false,\"creditInsurance\":false,\"mobile\":false,\"street\":false,\"countryFk\":false,\"provinceFk\":false,\"postcode\":false,\"created\":false,\"businessTypeFk\":false,\"payMethodFk\":false,\"sageTaxTypeFk\":false,\"sageTransactionTypeFk\":false,\"isActive\":false,\"isVies\":false,\"isTaxDataChecked\":false,\"isEqualizated\":false,\"isFreezed\":false,\"hasToInvoice\":false,\"hasToInvoiceByAddress\":false,\"isToBeMailed\":false,\"hasLcr\":false,\"hasCoreVnl\":false,\"hasSepaVnl\":false}'); /*!40000 ALTER TABLE `defaultViewConfig` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -206,24 +206,34 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 15:58:28 +-- Dump completed on 2023-02-20 14:45:53 USE `vn`; --- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.18-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: vn +-- Host: db-proxy.verdnatura.es Database: vn -- ------------------------------------------------------ --- Server version 5.6.25-4-log +-- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; +/*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!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 `agencyTermConfig` +-- + +LOCK TABLES `agencyTermConfig` WRITE; +/*!40000 ALTER TABLE `agencyTermConfig` DISABLE KEYS */; +INSERT INTO `agencyTermConfig` VALUES ('6240000000','4721000015',21.0000000000,'Adquisiciones intracomunitarias de servicios'); +/*!40000 ALTER TABLE `agencyTermConfig` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Dumping data for table `alertLevel` -- @@ -250,7 +260,7 @@ UNLOCK TABLES; LOCK TABLES `businessType` WRITE; /*!40000 ALTER TABLE `businessType` DISABLE KEYS */; -INSERT INTO `businessType` VALUES ('decoration','Decoración'),('events','Eventos'),('florist','Floristería'),('gardenCentre','Vivero'),('gardening','Jardinería'),('mortuary','Funeraria'),('officialOrganism','Organismo oficial'),('others','Otros'),('restoration','Restauración'),('wholesaler','Mayorista'); +INSERT INTO `businessType` VALUES ('decoration','Decoración'),('events','Eventos'),('florist','Floristería'),('gardenCentre','Vivero'),('gardening','Jardinería'),('individual','Particular'),('mortuary','Funeraria'),('officialOrganism','Organismo oficial'),('others','Otros'),('otherSector','Profesional de otro sector'),('restoration','Restauración'),('trainingCentre','Centro de formación'),('wholesaler','Mayorista'); /*!40000 ALTER TABLE `businessType` ENABLE KEYS */; UNLOCK TABLES; @@ -320,7 +330,7 @@ UNLOCK TABLES; LOCK TABLES `claimResponsible` WRITE; /*!40000 ALTER TABLE `claimResponsible` DISABLE KEYS */; -INSERT INTO `claimResponsible` VALUES (1,'Compradores',0),(2,'Proveedor',0),(3,'Entradores',0),(4,'Camareros',0),(6,'Sacadores',0),(7,'Revisadores',0),(8,'Calidad general',0),(9,'Encajadores',0),(11,'Comerciales',1),(12,'Clientes',1),(13,'Administración',0),(14,'Agencia',0),(15,'Repartidores',0),(16,'Informatica',0),(17,'Transp.origen',0),(18,'Confeccion',0),(19,'OTROS',0),(21,'Gerencia',0),(22,'Paletizadores',0),(23,'Preparación Previa',0),(24,'Almacén PCA',0),(25,'Huelga',0); +INSERT INTO `claimResponsible` VALUES (1,'Compradores',0),(2,'Proveedor',0),(3,'Entradores',0),(4,'Camareros',0),(6,'Sacadores',0),(7,'Revisadores',0),(8,'Calidad general',0),(9,'Encajadores',0),(10,'Clima',0),(11,'Comerciales',1),(12,'Clientes',1),(13,'Administración',0),(14,'Agencia',0),(15,'Repartidores',0),(16,'Informatica',0),(17,'Transp.origen',0),(18,'Confeccion',0),(19,'OTROS',0),(21,'Gerencia',0),(22,'Paletizadores',0),(23,'Preparación Previa',0),(24,'Almacén PCA',0),(25,'Huelga',0); /*!40000 ALTER TABLE `claimResponsible` ENABLE KEYS */; UNLOCK TABLES; @@ -330,7 +340,7 @@ UNLOCK TABLES; LOCK TABLES `claimReason` WRITE; /*!40000 ALTER TABLE `claimReason` DISABLE KEYS */; -INSERT INTO `claimReason` VALUES (1,'Prisas',0),(2,'Novato',0),(3,'Exceso de confianza',0),(4,'Exceso de celo',0),(5,'Indiferencia',0),(6,'Extraviado o Hurto',0),(7,'Incompetencia',0),(8,'Ubicación erronea',0),(9,'Dat.Inctos/Pak.conf',0),(10,'Datos duplicados',0),(11,'Fallo stock',0),(12,'Innovación',0),(13,'Distracción',1),(15,'Portes indebidos',0),(16,'Baja calidad',0),(17,'Defectuoso',0),(19,'Endiñado',0),(20,'Calor',0),(21,'Frio',0),(22,'Cambiado',0),(24,'Cansancio',1),(25,'Mal etiquetado',1),(26,'Cantidad malentendido',0),(30,'No revisado',1),(34,'Error fotografia',0),(40,'Fallo Personal VN',0),(41,'Fallo Personal Cliente',0),(42,'Otros',0),(43,'Precio alto',0),(44,'Abuso de confianza',0),(45,'Retraso Agencia',0),(46,'Delicado',0),(47,'Seco',0),(48,'Retraso Reparto',0),(49,'Mal Embalado',0),(50,'Tumbado',0),(51,'Enfermo/Plaga',0); +INSERT INTO `claimReason` VALUES (1,'Prisas',0),(2,'Novato',0),(3,'Exceso de confianza',0),(4,'Exceso de celo',0),(5,'Indiferencia',0),(6,'Extraviado o Hurto',0),(7,'Incompetencia',0),(8,'Ubicación erronea',0),(9,'Dat.Inctos/Pak.conf',0),(10,'Datos duplicados',0),(11,'Fallo stock',0),(12,'Innovación',0),(13,'Distracción',1),(15,'Portes indebidos',0),(16,'Baja calidad',0),(17,'Defectuoso',0),(19,'Endiñado',0),(20,'Calor',0),(21,'Frio',0),(22,'Cambiado',0),(24,'Cansancio',1),(25,'Mal etiquetado',1),(26,'Cantidad malentendido',0),(30,'No revisado',1),(34,'Error fotografia',0),(40,'Fallo Personal VN',0),(41,'Fallo Personal Cliente',0),(42,'Otros',0),(43,'Precio alto',0),(44,'Abuso de confianza',0),(45,'Retraso Agencia',0),(46,'Delicado',0),(47,'Seco',0),(48,'Retraso Reparto',0),(49,'Mal Embalado',0),(50,'Tumbado',0),(51,'Enfermo/Plaga',0),(52,'Mala gestión comercial',0),(53,'Mala gestión comprador',0),(54,'A2',0); /*!40000 ALTER TABLE `claimReason` ENABLE KEYS */; UNLOCK TABLES; @@ -340,7 +350,7 @@ UNLOCK TABLES; LOCK TABLES `claimRedelivery` WRITE; /*!40000 ALTER TABLE `claimRedelivery` DISABLE KEYS */; -INSERT INTO `claimRedelivery` VALUES (1,'Cliente'),(2,'No dev./No especif.'),(3,'Reparto'),(4,'Agencia'); +INSERT INTO `claimRedelivery` VALUES (1,'Cliente'),(2,'No dev./No especif.'),(3,'Reparto'),(4,'Agencia'),(5,'Tour'),(6,'Fuera Peninsula'); /*!40000 ALTER TABLE `claimRedelivery` ENABLE KEYS */; UNLOCK TABLES; @@ -360,7 +370,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),(45,'maná reclamacion',7,4,NULL,0,'manaClaim',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',4,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',4,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),(46,'recargo a particular',2,NULL,0.25,0,'individual',0),(47,'promocion Italia',4,NULL,NULL,1,'italianOffer',0),(48,'fusión de lineas',4,NULL,NULL,1,'lineFusion',0); /*!40000 ALTER TABLE `component` ENABLE KEYS */; UNLOCK TABLES; @@ -370,7 +380,7 @@ UNLOCK TABLES; LOCK TABLES `componentType` WRITE; /*!40000 ALTER TABLE `componentType` DISABLE KEYS */; -INSERT INTO `componentType` VALUES (1,'coste',1,0,'COST'),(2,'com ventas',1,1,NULL),(3,'com compras',1,1,NULL),(4,'empresa',1,1,'MARGIN'),(5,'cliente',0,0,NULL),(6,'agencia',0,0,'FREIGHT'),(7,'cartera_comercial',0,0,NULL),(8,'cartera_producto',0,1,NULL),(9,'maniobra',1,0,NULL),(10,'cartera_comprador',0,1,NULL),(11,'errores',0,1,NULL),(12,'otros',0,1,NULL); +INSERT INTO `componentType` VALUES (1,'coste',1,0,'COST'),(2,'com ventas',1,1,NULL),(3,'com compras',1,1,NULL),(4,'empresa',1,1,'MARGIN'),(5,'cliente',0,0,NULL),(6,'agencia',0,0,'FREIGHT'),(7,'cartera_comercial',0,0,'MANA'),(8,'cartera_producto',0,1,NULL),(9,'maniobra',1,0,NULL),(10,'cartera_comprador',0,1,NULL),(11,'errores',0,1,NULL),(12,'otros',0,1,NULL); /*!40000 ALTER TABLE `componentType` ENABLE KEYS */; UNLOCK TABLES; @@ -390,17 +400,27 @@ 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,'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); +INSERT INTO `department` VALUES (1,NULL,'VERDNATURA',1,98,763,0,0,0,0,29,NULL,'/',NULL,0,NULL,0,0,0,0,NULL),(22,NULL,'COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL),(31,'IT','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL),(34,NULL,'CONTABILIDAD',6,7,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(35,NULL,'FINANZAS',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL),(36,NULL,'LABORAL',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(37,'PROD','PRODUCCION',12,27,NULL,72,1,1,1,7,1,'/1/',NULL,0,NULL,0,1,1,1,NULL),(38,NULL,'SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(39,NULL,'ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(41,NULL,'ADMINISTRACION',28,29,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(43,'VT','VENTAS',30,51,NULL,0,0,0,1,10,1,'/1/',NULL,1,'',1,0,0,0,NULL),(44,NULL,'GERENCIA',52,53,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(45,NULL,'LOGISTICA',54,55,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(46,NULL,'REPARTO',56,57,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL),(48,NULL,'ALMACENAJE',58,59,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(49,NULL,'PROPIEDAD',60,61,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(52,NULL,'CARGA AEREA',62,63,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(53,NULL,'MARKETING Y COMUNICACIÓN',64,65,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(54,NULL,'ORNAMENTALES',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(55,NULL,'TALLER NATURAL',68,71,14548,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,1,1,0,1118),(56,NULL,'TALLER ARTIFICIAL',69,70,8470,72,0,0,2,0,55,'/1/55/',NULL,0,NULL,0,1,1,0,1927),(58,'CMP','CAMPOS',72,75,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(59,NULL,'MANTENIMIENTO',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(60,NULL,'RECLAMACIONES',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(61,NULL,'VNH',80,81,NULL,73,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(66,NULL,'VERDNAMADRID',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(68,NULL,'COMPLEMENTOS',19,20,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL),(69,NULL,'VERDNABARNA',84,85,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(80,NULL,'EQUIPO J VALLES',31,32,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(86,NULL,'LIMPIEZA',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(89,NULL,'COORDINACION',88,89,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(90,NULL,'TRAILER',90,91,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(91,NULL,'ARTIFICIAL',21,22,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(92,NULL,'EQUIPO SILVERIO',33,34,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(93,NULL,'CONFECCION',92,93,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0,NULL),(94,NULL,'EQUIPO J BROCAL',35,36,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(95,NULL,'EQUIPO C ZAMBRANO',37,38,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(96,NULL,'EQUIPO C LOPEZ',39,40,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(115,NULL,'EQUIPO CLAUDI',41,42,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(123,NULL,'EQUIPO ELENA BASCUÑANA',43,44,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(124,NULL,'CONTROL INTERNO',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL),(125,NULL,'EQUIPO MIRIAM MAR',45,46,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL),(126,NULL,'PRESERVADO',96,97,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0,NULL),(128,NULL,'PALETIZADO',23,24,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(130,NULL,'REVISION',25,26,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(131,NULL,'INVERNADERO',73,74,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,0,0,0,NULL),(132,NULL,'EQUIPO DC',47,48,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL),(133,NULL,'EQUIPO FRANCIA',49,50,1731,72,0,0,2,0,43,'/1/43/','fra_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL); /*!40000 ALTER TABLE `department` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Dumping data for table `docuware` +-- + +LOCK TABLES `docuware` WRITE; +/*!40000 ALTER TABLE `docuware` DISABLE KEYS */; +INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N'),(2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N'); +/*!40000 ALTER TABLE `docuware` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Dumping data for table `itemPackingType` -- LOCK TABLES `itemPackingType` WRITE; /*!40000 ALTER TABLE `itemPackingType` DISABLE KEYS */; -INSERT INTO `itemPackingType` VALUES ('F','Fruta y Verdura'),('H','Horizontal'),('P','Pienso'),('V','Vertical'); +INSERT INTO `itemPackingType` VALUES ('F','Fruta y Verdura',0),('H','Horizontal',1),('P','Pienso',0),('V','Vertical',1); /*!40000 ALTER TABLE `itemPackingType` ENABLE KEYS */; UNLOCK TABLES; @@ -420,7 +440,7 @@ UNLOCK TABLES; LOCK TABLES `sample` WRITE; /*!40000 ALTER TABLE `sample` DISABLE KEYS */; -INSERT INTO `sample` VALUES (1,'Carta_1','Aviso inicial por saldo deudor',0,0,1,0),(2,'Carta_2','Reiteracion de aviso por saldo deudor',0,0,1,0),(3,'Cred_Up','Notificación de aumento de crédito',0,0,1,0),(4,'Cred_down','Notificación de reducción de crédito',0,0,1,0),(5,'Pet_CC','Petición de datos bancarios B2B',0,0,1,0),(6,'SolCredito','Solicitud de crédito',0,0,1,0),(7,'LeyPago','Ley de pagos',0,0,1,0),(8,'Pet_CC_Core','Petición de datos bancarios CORE',0,0,1,0),(9,'nueva_alta','Documento de nueva alta de cliente',0,0,1,0),(10,'client_welcome','Email de bienvenida para nuevo cliente',0,0,1,0),(11,'setup_printer','Email de instalación de impresora',0,0,1,0),(12,'client-welcome','Bienvenida como nuevo cliente',1,0,1,0),(13,'printer-setup','Instalación y configuración de impresora de coronas',1,0,1,0),(14,'sepa-core','Solicitud de domiciliación bancaria',1,1,0,0),(15,'letter-debtor-st','Aviso inicial por saldo deudor',1,1,1,0),(16,'letter-debtor-nd','Aviso reiterado por saldo deudor',1,1,1,0),(17,'client-lcr','Email de solicitud de datos bancarios LCR',0,1,1,0),(18,'client-debt-statement','Extracto del cliente',1,0,1,1),(19,'credit-request','Solicitud de crédito',1,1,1,0); +INSERT INTO `sample` VALUES (1,'Carta_1','Aviso inicial por saldo deudor',0,0,1,0,NULL),(2,'Carta_2','Reiteracion de aviso por saldo deudor',0,0,1,0,NULL),(3,'Cred_Up','Notificación de aumento de crédito',0,0,1,0,NULL),(4,'Cred_down','Notificación de reducción de crédito',0,0,1,0,NULL),(5,'Pet_CC','Petición de datos bancarios B2B',0,0,1,0,NULL),(6,'SolCredito','Solicitud de crédito',0,0,1,0,NULL),(7,'LeyPago','Ley de pagos',0,0,1,0,NULL),(8,'Pet_CC_Core','Petición de datos bancarios CORE',0,0,1,0,NULL),(9,'nueva_alta','Documento de nueva alta de cliente',0,0,1,0,NULL),(10,'client_welcome','Email de bienvenida para nuevo cliente',0,0,1,0,NULL),(11,'setup_printer','Email de instalación de impresora',0,0,1,0,NULL),(12,'client-welcome','Bienvenida como nuevo cliente',1,0,1,0,'Clients'),(13,'printer-setup','Instalación y configuración de impresora de coronas',1,0,1,0,'Clients'),(14,'sepa-core','Solicitud de domiciliación bancaria',1,1,0,0,'Clients'),(15,'letter-debtor-st','Aviso inicial por saldo deudor',1,1,1,0,'Clients'),(16,'letter-debtor-nd','Aviso reiterado por saldo deudor',1,1,1,0,'Clients'),(17,'client-lcr','Email de solicitud de datos bancarios LCR',0,1,1,0,NULL),(18,'client-debt-statement','Extracto del cliente',1,0,1,1,'Clients'),(19,'credit-request','Solicitud de crédito',1,1,1,0,'Clients'),(20,'incoterms-authorization','Autorización de incoterms',1,1,1,0,'Clients'); /*!40000 ALTER TABLE `sample` ENABLE KEYS */; UNLOCK TABLES; @@ -430,7 +450,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,'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'); +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,0,0,0,0,0,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,14,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,1,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,0,'OK PREVIOUS',3,28,1,0,1,1,1,1,3,0,'warning'),(29,'Previa Impreso',4,0,'PRINTED PREVIOUS',2,29,1,0,1,0,0,1,2,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,2,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,'Previa Revisando',3,0,'PREVIOUS_CONTROL',2,37,1,0,0,4,0,1,2,0,'warning'),(37,'Previa Revisado',3,0,'PREVIOUS_CONTROLLED',2,29,1,0,1,0,0,1,2,0,'warning'),(38,'Prep Cámara',6,1,'COOLER_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning'); /*!40000 ALTER TABLE `state` ENABLE KEYS */; UNLOCK TABLES; @@ -450,7 +470,7 @@ UNLOCK TABLES; LOCK TABLES `time` WRITE; /*!40000 ALTER TABLE `time` DISABLE KEYS */; -INSERT INTO `time` VALUES ('2007-12-31',200801,12,2007,31,1,200712,2008),('2008-01-01',200801,1,2008,1,1,200801,2008),('2008-01-02',200801,1,2008,2,1,200801,2008),('2008-01-03',200801,1,2008,3,1,200801,2008),('2008-01-04',200801,1,2008,4,1,200801,2008),('2008-01-05',200801,1,2008,5,1,200801,2008),('2008-01-06',200802,1,2008,6,2,200801,2008),('2008-01-07',200802,1,2008,7,2,200801,2008),('2008-01-08',200802,1,2008,8,2,200801,2008),('2008-01-09',200802,1,2008,9,2,200801,2008),('2008-01-10',200802,1,2008,10,2,200801,2008),('2008-01-11',200802,1,2008,11,2,200801,2008),('2008-01-12',200802,1,2008,12,2,200801,2008),('2008-01-13',200803,1,2008,13,3,200801,2008),('2008-01-14',200803,1,2008,14,3,200801,2008),('2008-01-15',200803,1,2008,15,3,200801,2008),('2008-01-16',200803,1,2008,16,3,200801,2008),('2008-01-17',200803,1,2008,17,3,200801,2008),('2008-01-18',200803,1,2008,18,3,200801,2008),('2008-01-19',200803,1,2008,19,3,200801,2008),('2008-01-20',200804,1,2008,20,4,200801,2008),('2008-01-21',200804,1,2008,21,4,200801,2008),('2008-01-22',200804,1,2008,22,4,200801,2008),('2008-01-23',200804,1,2008,23,4,200801,2008),('2008-01-24',200804,1,2008,24,4,200801,2008),('2008-01-25',200804,1,2008,25,4,200801,2008),('2008-01-26',200804,1,2008,26,4,200801,2008),('2008-01-27',200805,1,2008,27,5,200801,2008),('2008-01-28',200805,1,2008,28,5,200801,2008),('2008-01-29',200805,1,2008,29,5,200801,2008),('2008-01-30',200805,1,2008,30,5,200801,2008),('2008-01-31',200805,1,2008,31,5,200801,2008),('2008-02-01',200805,2,2008,1,5,200802,2008),('2008-02-02',200805,2,2008,2,5,200802,2008),('2008-02-03',200806,2,2008,3,6,200802,2008),('2008-02-04',200806,2,2008,4,6,200802,2008),('2008-02-05',200806,2,2008,5,6,200802,2008),('2008-02-06',200806,2,2008,6,6,200802,2008),('2008-02-07',200806,2,2008,7,6,200802,2008),('2008-02-08',200806,2,2008,8,6,200802,2008),('2008-02-09',200806,2,2008,9,6,200802,2008),('2008-02-10',200807,2,2008,10,7,200802,2008),('2008-02-11',200807,2,2008,11,7,200802,2008),('2008-02-12',200807,2,2008,12,7,200802,2008),('2008-02-13',200807,2,2008,13,7,200802,2008),('2008-02-14',200807,2,2008,14,7,200802,2008),('2008-02-15',200807,2,2008,15,7,200802,2008),('2008-02-16',200807,2,2008,16,7,200802,2008),('2008-02-17',200808,2,2008,17,8,200802,2008),('2008-02-18',200808,2,2008,18,8,200802,2008),('2008-02-19',200808,2,2008,19,8,200802,2008),('2008-02-20',200808,2,2008,20,8,200802,2008),('2008-02-21',200808,2,2008,21,8,200802,2008),('2008-02-22',200808,2,2008,22,8,200802,2008),('2008-02-23',200808,2,2008,23,8,200802,2008),('2008-02-24',200809,2,2008,24,9,200802,2008),('2008-02-25',200809,2,2008,25,9,200802,2008),('2008-02-26',200809,2,2008,26,9,200802,2008),('2008-02-27',200809,2,2008,27,9,200802,2008),('2008-02-28',200809,2,2008,28,9,200802,2008),('2008-02-29',200809,2,2008,29,9,200802,2008),('2008-03-01',200809,3,2008,1,9,200803,2008),('2008-03-02',200810,3,2008,2,10,200803,2008),('2008-03-03',200810,3,2008,3,10,200803,2008),('2008-03-04',200810,3,2008,4,10,200803,2008),('2008-03-05',200810,3,2008,5,10,200803,2008),('2008-03-06',200810,3,2008,6,10,200803,2008),('2008-03-07',200810,3,2008,7,10,200803,2008),('2008-03-08',200810,3,2008,8,10,200803,2008),('2008-03-09',200811,3,2008,9,11,200803,2008),('2008-03-10',200811,3,2008,10,11,200803,2008),('2008-03-11',200811,3,2008,11,11,200803,2008),('2008-03-12',200811,3,2008,12,11,200803,2008),('2008-03-13',200811,3,2008,13,11,200803,2008),('2008-03-14',200811,3,2008,14,11,200803,2008),('2008-03-15',200811,3,2008,15,11,200803,2008),('2008-03-16',200812,3,2008,16,12,200803,2008),('2008-03-17',200812,3,2008,17,12,200803,2008),('2008-03-18',200812,3,2008,18,12,200803,2008),('2008-03-19',200812,3,2008,19,12,200803,2008),('2008-03-20',200812,3,2008,20,12,200803,2008),('2008-03-21',200812,3,2008,21,12,200803,2008),('2008-03-22',200812,3,2008,22,12,200803,2008),('2008-03-23',200813,3,2008,23,13,200803,2008),('2008-03-24',200813,3,2008,24,13,200803,2008),('2008-03-25',200813,3,2008,25,13,200803,2008),('2008-03-26',200813,3,2008,26,13,200803,2008),('2008-03-27',200813,3,2008,27,13,200803,2008),('2008-03-28',200813,3,2008,28,13,200803,2008),('2008-03-29',200813,3,2008,29,13,200803,2008),('2008-03-30',200814,3,2008,30,14,200803,2008),('2008-03-31',200814,3,2008,31,14,200803,2008),('2008-04-01',200814,4,2008,1,14,200804,2008),('2008-04-02',200814,4,2008,2,14,200804,2008),('2008-04-03',200814,4,2008,3,14,200804,2008),('2008-04-04',200814,4,2008,4,14,200804,2008),('2008-04-05',200814,4,2008,5,14,200804,2008),('2008-04-06',200815,4,2008,6,15,200804,2008),('2008-04-07',200815,4,2008,7,15,200804,2008),('2008-04-08',200815,4,2008,8,15,200804,2008),('2008-04-09',200815,4,2008,9,15,200804,2008),('2008-04-10',200815,4,2008,10,15,200804,2008),('2008-04-11',200815,4,2008,11,15,200804,2008),('2008-04-12',200815,4,2008,12,15,200804,2008),('2008-04-13',200816,4,2008,13,16,200804,2008),('2008-04-14',200816,4,2008,14,16,200804,2008),('2008-04-15',200816,4,2008,15,16,200804,2008),('2008-04-16',200816,4,2008,16,16,200804,2008),('2008-04-17',200816,4,2008,17,16,200804,2008),('2008-04-18',200816,4,2008,18,16,200804,2008),('2008-04-19',200816,4,2008,19,16,200804,2008),('2008-04-20',200817,4,2008,20,17,200804,2008),('2008-04-21',200817,4,2008,21,17,200804,2008),('2008-04-22',200817,4,2008,22,17,200804,2008),('2008-04-23',200817,4,2008,23,17,200804,2008),('2008-04-24',200817,4,2008,24,17,200804,2008),('2008-04-25',200817,4,2008,25,17,200804,2008),('2008-04-26',200817,4,2008,26,17,200804,2008),('2008-04-27',200818,4,2008,27,18,200804,2008),('2008-04-28',200818,4,2008,28,18,200804,2008),('2008-04-29',200818,4,2008,29,18,200804,2008),('2008-04-30',200818,4,2008,30,18,200804,2008),('2008-05-01',200818,5,2008,1,18,200805,2008),('2008-05-02',200818,5,2008,2,18,200805,2008),('2008-05-03',200818,5,2008,3,18,200805,2008),('2008-05-04',200819,5,2008,4,19,200805,2008),('2008-05-05',200819,5,2008,5,19,200805,2008),('2008-05-06',200819,5,2008,6,19,200805,2008),('2008-05-07',200819,5,2008,7,19,200805,2008),('2008-05-08',200819,5,2008,8,19,200805,2008),('2008-05-09',200819,5,2008,9,19,200805,2008),('2008-05-10',200819,5,2008,10,19,200805,2008),('2008-05-11',200820,5,2008,11,20,200805,2008),('2008-05-12',200820,5,2008,12,20,200805,2008),('2008-05-13',200820,5,2008,13,20,200805,2008),('2008-05-14',200820,5,2008,14,20,200805,2008),('2008-05-15',200820,5,2008,15,20,200805,2008),('2008-05-16',200820,5,2008,16,20,200805,2008),('2008-05-17',200820,5,2008,17,20,200805,2008),('2008-05-18',200821,5,2008,18,21,200805,2008),('2008-05-19',200821,5,2008,19,21,200805,2008),('2008-05-20',200821,5,2008,20,21,200805,2008),('2008-05-21',200821,5,2008,21,21,200805,2008),('2008-05-22',200821,5,2008,22,21,200805,2008),('2008-05-23',200821,5,2008,23,21,200805,2008),('2008-05-24',200821,5,2008,24,21,200805,2008),('2008-05-25',200822,5,2008,25,22,200805,2008),('2008-05-26',200822,5,2008,26,22,200805,2008),('2008-05-27',200822,5,2008,27,22,200805,2008),('2008-05-28',200822,5,2008,28,22,200805,2008),('2008-05-29',200822,5,2008,29,22,200805,2008),('2008-05-30',200822,5,2008,30,22,200805,2008),('2008-05-31',200822,5,2008,31,22,200805,2008),('2008-06-01',200823,6,2008,1,23,200806,2008),('2008-06-02',200823,6,2008,2,23,200806,2008),('2008-06-03',200823,6,2008,3,23,200806,2008),('2008-06-04',200823,6,2008,4,23,200806,2008),('2008-06-05',200823,6,2008,5,23,200806,2008),('2008-06-06',200823,6,2008,6,23,200806,2008),('2008-06-07',200823,6,2008,7,23,200806,2008),('2008-06-08',200824,6,2008,8,24,200806,2008),('2008-06-09',200824,6,2008,9,24,200806,2008),('2008-06-10',200824,6,2008,10,24,200806,2008),('2008-06-11',200824,6,2008,11,24,200806,2008),('2008-06-12',200824,6,2008,12,24,200806,2008),('2008-06-13',200824,6,2008,13,24,200806,2008),('2008-06-14',200824,6,2008,14,24,200806,2008),('2008-06-15',200825,6,2008,15,25,200806,2008),('2008-06-16',200825,6,2008,16,25,200806,2008),('2008-06-17',200825,6,2008,17,25,200806,2008),('2008-06-18',200825,6,2008,18,25,200806,2008),('2008-06-19',200825,6,2008,19,25,200806,2008),('2008-06-20',200825,6,2008,20,25,200806,2008),('2008-06-21',200825,6,2008,21,25,200806,2008),('2008-06-22',200826,6,2008,22,26,200806,2008),('2008-06-23',200826,6,2008,23,26,200806,2008),('2008-06-24',200826,6,2008,24,26,200806,2008),('2008-06-25',200826,6,2008,25,26,200806,2008),('2008-06-26',200826,6,2008,26,26,200806,2008),('2008-06-27',200826,6,2008,27,26,200806,2008),('2008-06-28',200826,6,2008,28,26,200806,2008),('2008-06-29',200827,6,2008,29,27,200806,2008),('2008-06-30',200827,6,2008,30,27,200806,2008),('2008-07-01',200827,7,2008,1,27,200807,2008),('2008-07-02',200827,7,2008,2,27,200807,2008),('2008-07-03',200827,7,2008,3,27,200807,2008),('2008-07-04',200827,7,2008,4,27,200807,2008),('2008-07-05',200827,7,2008,5,27,200807,2008),('2008-07-06',200828,7,2008,6,28,200807,2008),('2008-07-07',200828,7,2008,7,28,200807,2008),('2008-07-08',200828,7,2008,8,28,200807,2008),('2008-07-09',200828,7,2008,9,28,200807,2008),('2008-07-10',200828,7,2008,10,28,200807,2008),('2008-07-11',200828,7,2008,11,28,200807,2008),('2008-07-12',200828,7,2008,12,28,200807,2008),('2008-07-13',200829,7,2008,13,29,200807,2008),('2008-07-14',200829,7,2008,14,29,200807,2008),('2008-07-15',200829,7,2008,15,29,200807,2008),('2008-07-16',200829,7,2008,16,29,200807,2008),('2008-07-17',200829,7,2008,17,29,200807,2008),('2008-07-18',200829,7,2008,18,29,200807,2008),('2008-07-19',200829,7,2008,19,29,200807,2008),('2008-07-20',200830,7,2008,20,30,200807,2008),('2008-07-21',200830,7,2008,21,30,200807,2008),('2008-07-22',200830,7,2008,22,30,200807,2008),('2008-07-23',200830,7,2008,23,30,200807,2008),('2008-07-24',200830,7,2008,24,30,200807,2008),('2008-07-25',200830,7,2008,25,30,200807,2008),('2008-07-26',200830,7,2008,26,30,200807,2008),('2008-07-27',200831,7,2008,27,31,200807,2008),('2008-07-28',200831,7,2008,28,31,200807,2008),('2008-07-29',200831,7,2008,29,31,200807,2008),('2008-07-30',200831,7,2008,30,31,200807,2008),('2008-07-31',200831,7,2008,31,31,200807,2008),('2008-08-01',200831,8,2008,1,31,200808,2008),('2008-08-02',200831,8,2008,2,31,200808,2008),('2008-08-03',200832,8,2008,3,32,200808,2008),('2008-08-04',200832,8,2008,4,32,200808,2008),('2008-08-05',200832,8,2008,5,32,200808,2008),('2008-08-06',200832,8,2008,6,32,200808,2008),('2008-08-07',200832,8,2008,7,32,200808,2008),('2008-08-08',200832,8,2008,8,32,200808,2008),('2008-08-09',200832,8,2008,9,32,200808,2008),('2008-08-10',200833,8,2008,10,33,200808,2008),('2008-08-11',200833,8,2008,11,33,200808,2008),('2008-08-12',200833,8,2008,12,33,200808,2008),('2008-08-13',200833,8,2008,13,33,200808,2008),('2008-08-14',200833,8,2008,14,33,200808,2008),('2008-08-15',200833,8,2008,15,33,200808,2008),('2008-08-16',200833,8,2008,16,33,200808,2008),('2008-08-17',200834,8,2008,17,34,200808,2008),('2008-08-18',200834,8,2008,18,34,200808,2008),('2008-08-19',200834,8,2008,19,34,200808,2008),('2008-08-20',200834,8,2008,20,34,200808,2008),('2008-08-21',200834,8,2008,21,34,200808,2008),('2008-08-22',200834,8,2008,22,34,200808,2008),('2008-08-23',200834,8,2008,23,34,200808,2008),('2008-08-24',200835,8,2008,24,35,200808,2008),('2008-08-25',200835,8,2008,25,35,200808,2008),('2008-08-26',200835,8,2008,26,35,200808,2008),('2008-08-27',200835,8,2008,27,35,200808,2008),('2008-08-28',200835,8,2008,28,35,200808,2008),('2008-08-29',200835,8,2008,29,35,200808,2008),('2008-08-30',200835,8,2008,30,35,200808,2008),('2008-08-31',200836,8,2008,31,36,200808,2008),('2008-09-01',200836,9,2008,1,36,200809,2008),('2008-09-02',200836,9,2008,2,36,200809,2008),('2008-09-03',200836,9,2008,3,36,200809,2008),('2008-09-04',200836,9,2008,4,36,200809,2008),('2008-09-05',200836,9,2008,5,36,200809,2008),('2008-09-06',200836,9,2008,6,36,200809,2008),('2008-09-07',200837,9,2008,7,37,200809,2008),('2008-09-08',200837,9,2008,8,37,200809,2008),('2008-09-09',200837,9,2008,9,37,200809,2008),('2008-09-10',200837,9,2008,10,37,200809,2008),('2008-09-11',200837,9,2008,11,37,200809,2008),('2008-09-12',200837,9,2008,12,37,200809,2008),('2008-09-13',200837,9,2008,13,37,200809,2008),('2008-09-14',200838,9,2008,14,38,200809,2008),('2008-09-15',200838,9,2008,15,38,200809,2008),('2008-09-16',200838,9,2008,16,38,200809,2008),('2008-09-17',200838,9,2008,17,38,200809,2008),('2008-09-18',200838,9,2008,18,38,200809,2008),('2008-09-19',200838,9,2008,19,38,200809,2008),('2008-09-20',200838,9,2008,20,38,200809,2008),('2008-09-21',200839,9,2008,21,39,200809,2008),('2008-09-22',200839,9,2008,22,39,200809,2008),('2008-09-23',200839,9,2008,23,39,200809,2008),('2008-09-24',200839,9,2008,24,39,200809,2008),('2008-09-25',200839,9,2008,25,39,200809,2008),('2008-09-26',200839,9,2008,26,39,200809,2008),('2008-09-27',200839,9,2008,27,39,200809,2008),('2008-09-28',200840,9,2008,28,40,200809,2008),('2008-09-29',200840,9,2008,29,40,200809,2008),('2008-09-30',200840,9,2008,30,40,200809,2008),('2008-10-01',200840,10,2008,1,40,200810,2008),('2008-10-02',200840,10,2008,2,40,200810,2008),('2008-10-03',200840,10,2008,3,40,200810,2008),('2008-10-04',200840,10,2008,4,40,200810,2008),('2008-10-05',200841,10,2008,5,41,200810,2008),('2008-10-06',200841,10,2008,6,41,200810,2008),('2008-10-07',200841,10,2008,7,41,200810,2008),('2008-10-08',200841,10,2008,8,41,200810,2008),('2008-10-09',200841,10,2008,9,41,200810,2008),('2008-10-10',200841,10,2008,10,41,200810,2008),('2008-10-11',200841,10,2008,11,41,200810,2008),('2008-10-12',200842,10,2008,12,42,200810,2008),('2008-10-13',200842,10,2008,13,42,200810,2008),('2008-10-14',200842,10,2008,14,42,200810,2008),('2008-10-15',200842,10,2008,15,42,200810,2008),('2008-10-16',200842,10,2008,16,42,200810,2008),('2008-10-17',200842,10,2008,17,42,200810,2008),('2008-10-18',200842,10,2008,18,42,200810,2008),('2008-10-19',200843,10,2008,19,43,200810,2008),('2008-10-20',200843,10,2008,20,43,200810,2008),('2008-10-21',200843,10,2008,21,43,200810,2008),('2008-10-22',200843,10,2008,22,43,200810,2008),('2008-10-23',200843,10,2008,23,43,200810,2008),('2008-10-24',200843,10,2008,24,43,200810,2008),('2008-10-25',200843,10,2008,25,43,200810,2008),('2008-10-26',200844,10,2008,26,44,200810,2008),('2008-10-27',200844,10,2008,27,44,200810,2008),('2008-10-28',200844,10,2008,28,44,200810,2008),('2008-10-29',200844,10,2008,29,44,200810,2008),('2008-10-30',200844,10,2008,30,44,200810,2008),('2008-10-31',200844,10,2008,31,44,200810,2008),('2008-11-01',200844,11,2008,1,44,200811,2008),('2008-11-02',200845,11,2008,2,45,200811,2008),('2008-11-03',200845,11,2008,3,45,200811,2008),('2008-11-04',200845,11,2008,4,45,200811,2008),('2008-11-05',200845,11,2008,5,45,200811,2008),('2008-11-06',200845,11,2008,6,45,200811,2008),('2008-11-07',200845,11,2008,7,45,200811,2008),('2008-11-08',200845,11,2008,8,45,200811,2008),('2008-11-09',200846,11,2008,9,46,200811,2008),('2008-11-10',200846,11,2008,10,46,200811,2008),('2008-11-11',200846,11,2008,11,46,200811,2008),('2008-11-12',200846,11,2008,12,46,200811,2008),('2008-11-13',200846,11,2008,13,46,200811,2008),('2008-11-14',200846,11,2008,14,46,200811,2008),('2008-11-15',200846,11,2008,15,46,200811,2008),('2008-11-16',200847,11,2008,16,47,200811,2008),('2008-11-17',200847,11,2008,17,47,200811,2008),('2008-11-18',200847,11,2008,18,47,200811,2008),('2008-11-19',200847,11,2008,19,47,200811,2008),('2008-11-20',200847,11,2008,20,47,200811,2008),('2008-11-21',200847,11,2008,21,47,200811,2008),('2008-11-22',200847,11,2008,22,47,200811,2008),('2008-11-23',200848,11,2008,23,48,200811,2008),('2008-11-24',200848,11,2008,24,48,200811,2008),('2008-11-25',200848,11,2008,25,48,200811,2008),('2008-11-26',200848,11,2008,26,48,200811,2008),('2008-11-27',200848,11,2008,27,48,200811,2008),('2008-11-28',200848,11,2008,28,48,200811,2008),('2008-11-29',200848,11,2008,29,48,200811,2008),('2008-11-30',200849,11,2008,30,49,200811,2008),('2008-12-01',200849,12,2008,1,49,200812,2009),('2008-12-02',200849,12,2008,2,49,200812,2009),('2008-12-03',200849,12,2008,3,49,200812,2009),('2008-12-04',200849,12,2008,4,49,200812,2009),('2008-12-05',200849,12,2008,5,49,200812,2009),('2008-12-06',200849,12,2008,6,49,200812,2009),('2008-12-07',200850,12,2008,7,50,200812,2009),('2008-12-08',200850,12,2008,8,50,200812,2009),('2008-12-09',200850,12,2008,9,50,200812,2009),('2008-12-10',200850,12,2008,10,50,200812,2009),('2008-12-11',200850,12,2008,11,50,200812,2009),('2008-12-12',200850,12,2008,12,50,200812,2009),('2008-12-13',200850,12,2008,13,50,200812,2009),('2008-12-14',200851,12,2008,14,51,200812,2009),('2008-12-15',200851,12,2008,15,51,200812,2009),('2008-12-16',200851,12,2008,16,51,200812,2009),('2008-12-17',200851,12,2008,17,51,200812,2009),('2008-12-18',200851,12,2008,18,51,200812,2009),('2008-12-19',200851,12,2008,19,51,200812,2009),('2008-12-20',200851,12,2008,20,51,200812,2009),('2008-12-21',200852,12,2008,21,52,200812,2009),('2008-12-22',200852,12,2008,22,52,200812,2009),('2008-12-23',200852,12,2008,23,52,200812,2009),('2008-12-24',200852,12,2008,24,52,200812,2009),('2008-12-25',200852,12,2008,25,52,200812,2009),('2008-12-26',200852,12,2008,26,52,200812,2009),('2008-12-27',200852,12,2008,27,52,200812,2009),('2008-12-28',200853,12,2008,28,53,200812,2009),('2008-12-29',200901,12,2008,29,53,200812,2009),('2008-12-30',200901,12,2008,30,53,200812,2009),('2008-12-31',200901,12,2008,31,53,200812,2009),('2009-01-01',200901,1,2009,1,53,200901,2009),('2009-01-02',200901,1,2009,2,53,200901,2009),('2009-01-03',200901,1,2009,3,53,200901,2009),('2009-01-04',200902,1,2009,4,1,200901,2009),('2009-01-05',200902,1,2009,5,1,200901,2009),('2009-01-06',200902,1,2009,6,1,200901,2009),('2009-01-07',200902,1,2009,7,1,200901,2009),('2009-01-08',200902,1,2009,8,1,200901,2009),('2009-01-09',200902,1,2009,9,1,200901,2009),('2009-01-10',200902,1,2009,10,1,200901,2009),('2009-01-11',200903,1,2009,11,2,200901,2009),('2009-01-12',200903,1,2009,12,2,200901,2009),('2009-01-13',200903,1,2009,13,2,200901,2009),('2009-01-14',200903,1,2009,14,2,200901,2009),('2009-01-15',200903,1,2009,15,2,200901,2009),('2009-01-16',200903,1,2009,16,2,200901,2009),('2009-01-17',200903,1,2009,17,2,200901,2009),('2009-01-18',200904,1,2009,18,3,200901,2009),('2009-01-19',200904,1,2009,19,3,200901,2009),('2009-01-20',200904,1,2009,20,3,200901,2009),('2009-01-21',200904,1,2009,21,3,200901,2009),('2009-01-22',200904,1,2009,22,3,200901,2009),('2009-01-23',200904,1,2009,23,3,200901,2009),('2009-01-24',200904,1,2009,24,3,200901,2009),('2009-01-25',200905,1,2009,25,4,200901,2009),('2009-01-26',200905,1,2009,26,4,200901,2009),('2009-01-27',200905,1,2009,27,4,200901,2009),('2009-01-28',200905,1,2009,28,4,200901,2009),('2009-01-29',200905,1,2009,29,4,200901,2009),('2009-01-30',200905,1,2009,30,4,200901,2009),('2009-01-31',200905,1,2009,31,4,200901,2009),('2009-02-01',200906,2,2009,1,5,200902,2009),('2009-02-02',200906,2,2009,2,5,200902,2009),('2009-02-03',200906,2,2009,3,5,200902,2009),('2009-02-04',200906,2,2009,4,5,200902,2009),('2009-02-05',200906,2,2009,5,5,200902,2009),('2009-02-06',200906,2,2009,6,5,200902,2009),('2009-02-07',200906,2,2009,7,5,200902,2009),('2009-02-08',200907,2,2009,8,6,200902,2009),('2009-02-09',200907,2,2009,9,6,200902,2009),('2009-02-10',200907,2,2009,10,6,200902,2009),('2009-02-11',200907,2,2009,11,6,200902,2009),('2009-02-12',200907,2,2009,12,6,200902,2009),('2009-02-13',200907,2,2009,13,6,200902,2009),('2009-02-14',200907,2,2009,14,6,200902,2009),('2009-02-15',200908,2,2009,15,7,200902,2009),('2009-02-16',200908,2,2009,16,7,200902,2009),('2009-02-17',200908,2,2009,17,7,200902,2009),('2009-02-18',200908,2,2009,18,7,200902,2009),('2009-02-19',200908,2,2009,19,7,200902,2009),('2009-02-20',200908,2,2009,20,7,200902,2009),('2009-02-21',200908,2,2009,21,7,200902,2009),('2009-02-22',200909,2,2009,22,8,200902,2009),('2009-02-23',200909,2,2009,23,8,200902,2009),('2009-02-24',200909,2,2009,24,8,200902,2009),('2009-02-25',200909,2,2009,25,8,200902,2009),('2009-02-26',200909,2,2009,26,8,200902,2009),('2009-02-27',200909,2,2009,27,8,200902,2009),('2009-02-28',200909,2,2009,28,8,200902,2009),('2009-03-01',200910,3,2009,1,9,200903,2009),('2009-03-02',200910,3,2009,2,9,200903,2009),('2009-03-03',200910,3,2009,3,9,200903,2009),('2009-03-04',200910,3,2009,4,9,200903,2009),('2009-03-05',200910,3,2009,5,9,200903,2009),('2009-03-06',200910,3,2009,6,9,200903,2009),('2009-03-07',200910,3,2009,7,9,200903,2009),('2009-03-08',200911,3,2009,8,10,200903,2009),('2009-03-09',200911,3,2009,9,10,200903,2009),('2009-03-10',200911,3,2009,10,10,200903,2009),('2009-03-11',200911,3,2009,11,10,200903,2009),('2009-03-12',200911,3,2009,12,10,200903,2009),('2009-03-13',200911,3,2009,13,10,200903,2009),('2009-03-14',200911,3,2009,14,10,200903,2009),('2009-03-15',200912,3,2009,15,11,200903,2009),('2009-03-16',200912,3,2009,16,11,200903,2009),('2009-03-17',200912,3,2009,17,11,200903,2009),('2009-03-18',200912,3,2009,18,11,200903,2009),('2009-03-19',200912,3,2009,19,11,200903,2009),('2009-03-20',200912,3,2009,20,11,200903,2009),('2009-03-21',200912,3,2009,21,11,200903,2009),('2009-03-22',200913,3,2009,22,12,200903,2009),('2009-03-23',200913,3,2009,23,12,200903,2009),('2009-03-24',200913,3,2009,24,12,200903,2009),('2009-03-25',200913,3,2009,25,12,200903,2009),('2009-03-26',200913,3,2009,26,12,200903,2009),('2009-03-27',200913,3,2009,27,12,200903,2009),('2009-03-28',200913,3,2009,28,12,200903,2009),('2009-03-29',200914,3,2009,29,13,200903,2009),('2009-03-30',200914,3,2009,30,13,200903,2009),('2009-03-31',200914,3,2009,31,13,200903,2009),('2009-04-01',200914,4,2009,1,13,200904,2009),('2009-04-02',200914,4,2009,2,13,200904,2009),('2009-04-03',200914,4,2009,3,13,200904,2009),('2009-04-04',200914,4,2009,4,13,200904,2009),('2009-04-05',200915,4,2009,5,14,200904,2009),('2009-04-06',200915,4,2009,6,14,200904,2009),('2009-04-07',200915,4,2009,7,14,200904,2009),('2009-04-08',200915,4,2009,8,14,200904,2009),('2009-04-09',200915,4,2009,9,14,200904,2009),('2009-04-10',200915,4,2009,10,14,200904,2009),('2009-04-11',200915,4,2009,11,14,200904,2009),('2009-04-12',200916,4,2009,12,15,200904,2009),('2009-04-13',200916,4,2009,13,15,200904,2009),('2009-04-14',200916,4,2009,14,15,200904,2009),('2009-04-15',200916,4,2009,15,15,200904,2009),('2009-04-16',200916,4,2009,16,15,200904,2009),('2009-04-17',200916,4,2009,17,15,200904,2009),('2009-04-18',200916,4,2009,18,15,200904,2009),('2009-04-19',200917,4,2009,19,16,200904,2009),('2009-04-20',200917,4,2009,20,16,200904,2009),('2009-04-21',200917,4,2009,21,16,200904,2009),('2009-04-22',200917,4,2009,22,16,200904,2009),('2009-04-23',200917,4,2009,23,16,200904,2009),('2009-04-24',200917,4,2009,24,16,200904,2009),('2009-04-25',200917,4,2009,25,16,200904,2009),('2009-04-26',200918,4,2009,26,17,200904,2009),('2009-04-27',200918,4,2009,27,17,200904,2009),('2009-04-28',200918,4,2009,28,17,200904,2009),('2009-04-29',200918,4,2009,29,17,200904,2009),('2009-04-30',200918,4,2009,30,17,200904,2009),('2009-05-01',200918,5,2009,1,17,200905,2009),('2009-05-02',200918,5,2009,2,17,200905,2009),('2009-05-03',200919,5,2009,3,18,200905,2009),('2009-05-04',200919,5,2009,4,18,200905,2009),('2009-05-05',200919,5,2009,5,18,200905,2009),('2009-05-06',200919,5,2009,6,18,200905,2009),('2009-05-07',200919,5,2009,7,18,200905,2009),('2009-05-08',200919,5,2009,8,18,200905,2009),('2009-05-09',200919,5,2009,9,18,200905,2009),('2009-05-10',200920,5,2009,10,19,200905,2009),('2009-05-11',200920,5,2009,11,19,200905,2009),('2009-05-12',200920,5,2009,12,19,200905,2009),('2009-05-13',200920,5,2009,13,19,200905,2009),('2009-05-14',200920,5,2009,14,19,200905,2009),('2009-05-15',200920,5,2009,15,19,200905,2009),('2009-05-16',200920,5,2009,16,19,200905,2009),('2009-05-17',200921,5,2009,17,20,200905,2009),('2009-05-18',200921,5,2009,18,20,200905,2009),('2009-05-19',200921,5,2009,19,20,200905,2009),('2009-05-20',200921,5,2009,20,20,200905,2009),('2009-05-21',200921,5,2009,21,20,200905,2009),('2009-05-22',200921,5,2009,22,20,200905,2009),('2009-05-23',200921,5,2009,23,20,200905,2009),('2009-05-24',200922,5,2009,24,21,200905,2009),('2009-05-25',200922,5,2009,25,21,200905,2009),('2009-05-26',200922,5,2009,26,21,200905,2009),('2009-05-27',200922,5,2009,27,21,200905,2009),('2009-05-28',200922,5,2009,28,21,200905,2009),('2009-05-29',200922,5,2009,29,21,200905,2009),('2009-05-30',200922,5,2009,30,21,200905,2009),('2009-05-31',200923,5,2009,31,22,200905,2009),('2009-06-01',200923,6,2009,1,22,200906,2009),('2009-06-02',200923,6,2009,2,22,200906,2009),('2009-06-03',200923,6,2009,3,22,200906,2009),('2009-06-04',200923,6,2009,4,22,200906,2009),('2009-06-05',200923,6,2009,5,22,200906,2009),('2009-06-06',200923,6,2009,6,22,200906,2009),('2009-06-07',200924,6,2009,7,23,200906,2009),('2009-06-08',200924,6,2009,8,23,200906,2009),('2009-06-09',200924,6,2009,9,23,200906,2009),('2009-06-10',200924,6,2009,10,23,200906,2009),('2009-06-11',200924,6,2009,11,23,200906,2009),('2009-06-12',200924,6,2009,12,23,200906,2009),('2009-06-13',200924,6,2009,13,23,200906,2009),('2009-06-14',200925,6,2009,14,24,200906,2009),('2009-06-15',200925,6,2009,15,24,200906,2009),('2009-06-16',200925,6,2009,16,24,200906,2009),('2009-06-17',200925,6,2009,17,24,200906,2009),('2009-06-18',200925,6,2009,18,24,200906,2009),('2009-06-19',200925,6,2009,19,24,200906,2009),('2009-06-20',200925,6,2009,20,24,200906,2009),('2009-06-21',200926,6,2009,21,25,200906,2009),('2009-06-22',200926,6,2009,22,25,200906,2009),('2009-06-23',200926,6,2009,23,25,200906,2009),('2009-06-24',200926,6,2009,24,25,200906,2009),('2009-06-25',200926,6,2009,25,25,200906,2009),('2009-06-26',200926,6,2009,26,25,200906,2009),('2009-06-27',200926,6,2009,27,25,200906,2009),('2009-06-28',200927,6,2009,28,26,200906,2009),('2009-06-29',200927,6,2009,29,26,200906,2009),('2009-06-30',200927,6,2009,30,26,200906,2009),('2009-07-01',200927,7,2009,1,26,200907,2009),('2009-07-02',200927,7,2009,2,26,200907,2009),('2009-07-03',200927,7,2009,3,26,200907,2009),('2009-07-04',200927,7,2009,4,26,200907,2009),('2009-07-05',200928,7,2009,5,27,200907,2009),('2009-07-06',200928,7,2009,6,27,200907,2009),('2009-07-07',200928,7,2009,7,27,200907,2009),('2009-07-08',200928,7,2009,8,27,200907,2009),('2009-07-09',200928,7,2009,9,27,200907,2009),('2009-07-10',200928,7,2009,10,27,200907,2009),('2009-07-11',200928,7,2009,11,27,200907,2009),('2009-07-12',200929,7,2009,12,28,200907,2009),('2009-07-13',200929,7,2009,13,28,200907,2009),('2009-07-14',200929,7,2009,14,28,200907,2009),('2009-07-15',200929,7,2009,15,28,200907,2009),('2009-07-16',200929,7,2009,16,28,200907,2009),('2009-07-17',200929,7,2009,17,28,200907,2009),('2009-07-18',200929,7,2009,18,28,200907,2009),('2009-07-19',200930,7,2009,19,29,200907,2009),('2009-07-20',200930,7,2009,20,29,200907,2009),('2009-07-21',200930,7,2009,21,29,200907,2009),('2009-07-22',200930,7,2009,22,29,200907,2009),('2009-07-23',200930,7,2009,23,29,200907,2009),('2009-07-24',200930,7,2009,24,29,200907,2009),('2009-07-25',200930,7,2009,25,29,200907,2009),('2009-07-26',200931,7,2009,26,30,200907,2009),('2009-07-27',200931,7,2009,27,30,200907,2009),('2009-07-28',200931,7,2009,28,30,200907,2009),('2009-07-29',200931,7,2009,29,30,200907,2009),('2009-07-30',200931,7,2009,30,30,200907,2009),('2009-07-31',200931,7,2009,31,30,200907,2009),('2009-08-01',200931,8,2009,1,30,200908,2009),('2009-08-02',200932,8,2009,2,31,200908,2009),('2009-08-03',200932,8,2009,3,31,200908,2009),('2009-08-04',200932,8,2009,4,31,200908,2009),('2009-08-05',200932,8,2009,5,31,200908,2009),('2009-08-06',200932,8,2009,6,31,200908,2009),('2009-08-07',200932,8,2009,7,31,200908,2009),('2009-08-08',200932,8,2009,8,31,200908,2009),('2009-08-09',200933,8,2009,9,32,200908,2009),('2009-08-10',200933,8,2009,10,32,200908,2009),('2009-08-11',200933,8,2009,11,32,200908,2009),('2009-08-12',200933,8,2009,12,32,200908,2009),('2009-08-13',200933,8,2009,13,32,200908,2009),('2009-08-14',200933,8,2009,14,32,200908,2009),('2009-08-15',200933,8,2009,15,32,200908,2009),('2009-08-16',200934,8,2009,16,33,200908,2009),('2009-08-17',200934,8,2009,17,33,200908,2009),('2009-08-18',200934,8,2009,18,33,200908,2009),('2009-08-19',200934,8,2009,19,33,200908,2009),('2009-08-20',200934,8,2009,20,33,200908,2009),('2009-08-21',200934,8,2009,21,33,200908,2009),('2009-08-22',200934,8,2009,22,33,200908,2009),('2009-08-23',200935,8,2009,23,34,200908,2009),('2009-08-24',200935,8,2009,24,34,200908,2009),('2009-08-25',200935,8,2009,25,34,200908,2009),('2009-08-26',200935,8,2009,26,34,200908,2009),('2009-08-27',200935,8,2009,27,34,200908,2009),('2009-08-28',200935,8,2009,28,34,200908,2009),('2009-08-29',200935,8,2009,29,34,200908,2009),('2009-08-30',200936,8,2009,30,35,200908,2009),('2009-08-31',200936,8,2009,31,35,200908,2009),('2009-09-01',200936,9,2009,1,35,200909,2009),('2009-09-02',200936,9,2009,2,35,200909,2009),('2009-09-03',200936,9,2009,3,35,200909,2009),('2009-09-04',200936,9,2009,4,35,200909,2009),('2009-09-05',200936,9,2009,5,35,200909,2009),('2009-09-06',200937,9,2009,6,36,200909,2009),('2009-09-07',200937,9,2009,7,36,200909,2009),('2009-09-08',200937,9,2009,8,36,200909,2009),('2009-09-09',200937,9,2009,9,36,200909,2009),('2009-09-10',200937,9,2009,10,36,200909,2009),('2009-09-11',200937,9,2009,11,36,200909,2009),('2009-09-12',200937,9,2009,12,36,200909,2009),('2009-09-13',200938,9,2009,13,37,200909,2009),('2009-09-14',200938,9,2009,14,37,200909,2009),('2009-09-15',200938,9,2009,15,37,200909,2009),('2009-09-16',200938,9,2009,16,37,200909,2009),('2009-09-17',200938,9,2009,17,37,200909,2009),('2009-09-18',200938,9,2009,18,37,200909,2009),('2009-09-19',200938,9,2009,19,37,200909,2009),('2009-09-20',200939,9,2009,20,38,200909,2009),('2009-09-21',200939,9,2009,21,38,200909,2009),('2009-09-22',200939,9,2009,22,38,200909,2009),('2009-09-23',200939,9,2009,23,38,200909,2009),('2009-09-24',200939,9,2009,24,38,200909,2009),('2009-09-25',200939,9,2009,25,38,200909,2009),('2009-09-26',200939,9,2009,26,38,200909,2009),('2009-09-27',200940,9,2009,27,39,200909,2009),('2009-09-28',200940,9,2009,28,39,200909,2009),('2009-09-29',200940,9,2009,29,39,200909,2009),('2009-09-30',200940,9,2009,30,39,200909,2009),('2009-10-01',200940,10,2009,1,39,200910,2009),('2009-10-02',200940,10,2009,2,39,200910,2009),('2009-10-03',200940,10,2009,3,39,200910,2009),('2009-10-04',200941,10,2009,4,40,200910,2009),('2009-10-05',200941,10,2009,5,40,200910,2009),('2009-10-06',200941,10,2009,6,40,200910,2009),('2009-10-07',200941,10,2009,7,40,200910,2009),('2009-10-08',200941,10,2009,8,40,200910,2009),('2009-10-09',200941,10,2009,9,40,200910,2009),('2009-10-10',200941,10,2009,10,40,200910,2009),('2009-10-11',200942,10,2009,11,41,200910,2009),('2009-10-12',200942,10,2009,12,41,200910,2009),('2009-10-13',200942,10,2009,13,41,200910,2009),('2009-10-14',200942,10,2009,14,41,200910,2009),('2009-10-15',200942,10,2009,15,41,200910,2009),('2009-10-16',200942,10,2009,16,41,200910,2009),('2009-10-17',200942,10,2009,17,41,200910,2009),('2009-10-18',200943,10,2009,18,42,200910,2009),('2009-10-19',200943,10,2009,19,42,200910,2009),('2009-10-20',200943,10,2009,20,42,200910,2009),('2009-10-21',200943,10,2009,21,42,200910,2009),('2009-10-22',200943,10,2009,22,42,200910,2009),('2009-10-23',200943,10,2009,23,42,200910,2009),('2009-10-24',200943,10,2009,24,42,200910,2009),('2009-10-25',200944,10,2009,25,43,200910,2009),('2009-10-26',200944,10,2009,26,43,200910,2009),('2009-10-27',200944,10,2009,27,43,200910,2009),('2009-10-28',200944,10,2009,28,43,200910,2009),('2009-10-29',200944,10,2009,29,43,200910,2009),('2009-10-30',200944,10,2009,30,43,200910,2009),('2009-10-31',200944,10,2009,31,43,200910,2009),('2009-11-01',200945,11,2009,1,44,200911,2009),('2009-11-02',200945,11,2009,2,44,200911,2009),('2009-11-03',200945,11,2009,3,44,200911,2009),('2009-11-04',200945,11,2009,4,44,200911,2009),('2009-11-05',200945,11,2009,5,44,200911,2009),('2009-11-06',200945,11,2009,6,44,200911,2009),('2009-11-07',200945,11,2009,7,44,200911,2009),('2009-11-08',200946,11,2009,8,45,200911,2009),('2009-11-09',200946,11,2009,9,45,200911,2009),('2009-11-10',200946,11,2009,10,45,200911,2009),('2009-11-11',200946,11,2009,11,45,200911,2009),('2009-11-12',200946,11,2009,12,45,200911,2009),('2009-11-13',200946,11,2009,13,45,200911,2009),('2009-11-14',200946,11,2009,14,45,200911,2009),('2009-11-15',200947,11,2009,15,46,200911,2009),('2009-11-16',200947,11,2009,16,46,200911,2009),('2009-11-17',200947,11,2009,17,46,200911,2009),('2009-11-18',200947,11,2009,18,46,200911,2009),('2009-11-19',200947,11,2009,19,46,200911,2009),('2009-11-20',200947,11,2009,20,46,200911,2009),('2009-11-21',200947,11,2009,21,46,200911,2009),('2009-11-22',200948,11,2009,22,47,200911,2009),('2009-11-23',200948,11,2009,23,47,200911,2009),('2009-11-24',200948,11,2009,24,47,200911,2009),('2009-11-25',200948,11,2009,25,47,200911,2009),('2009-11-26',200948,11,2009,26,47,200911,2009),('2009-11-27',200948,11,2009,27,47,200911,2009),('2009-11-28',200948,11,2009,28,47,200911,2009),('2009-11-29',200949,11,2009,29,48,200911,2009),('2009-11-30',200949,11,2009,30,48,200911,2009),('2009-12-01',200949,12,2009,1,48,200912,2010),('2009-12-02',200949,12,2009,2,48,200912,2010),('2009-12-03',200949,12,2009,3,48,200912,2010),('2009-12-04',200949,12,2009,4,48,200912,2010),('2009-12-05',200949,12,2009,5,48,200912,2010),('2009-12-06',200950,12,2009,6,49,200912,2010),('2009-12-07',200950,12,2009,7,49,200912,2010),('2009-12-08',200950,12,2009,8,49,200912,2010),('2009-12-09',200950,12,2009,9,49,200912,2010),('2009-12-10',200950,12,2009,10,49,200912,2010),('2009-12-11',200950,12,2009,11,49,200912,2010),('2009-12-12',200950,12,2009,12,49,200912,2010),('2009-12-13',200951,12,2009,13,50,200912,2010),('2009-12-14',200951,12,2009,14,50,200912,2010),('2009-12-15',200951,12,2009,15,50,200912,2010),('2009-12-16',200951,12,2009,16,50,200912,2010),('2009-12-17',200951,12,2009,17,50,200912,2010),('2009-12-18',200951,12,2009,18,50,200912,2010),('2009-12-19',200951,12,2009,19,50,200912,2010),('2009-12-20',200952,12,2009,20,51,200912,2010),('2009-12-21',200952,12,2009,21,51,200912,2010),('2009-12-22',200952,12,2009,22,51,200912,2010),('2009-12-23',200952,12,2009,23,51,200912,2010),('2009-12-24',200952,12,2009,24,51,200912,2010),('2009-12-25',200952,12,2009,25,51,200912,2010),('2009-12-26',200952,12,2009,26,51,200912,2010),('2009-12-27',200953,12,2009,27,52,200912,2010),('2009-12-28',200952,12,2009,28,52,200912,2010),('2009-12-29',200952,12,2009,29,52,200912,2010),('2009-12-30',200952,12,2009,30,52,200912,2010),('2009-12-31',200952,12,2009,31,52,200912,2010),('2010-01-01',201001,1,2010,1,52,201001,2010),('2010-01-02',201001,1,2010,2,52,201001,2010),('2010-01-03',201002,1,2010,3,1,201001,2010),('2010-01-04',201001,1,2010,4,1,201001,2010),('2010-01-05',201001,1,2010,5,1,201001,2010),('2010-01-06',201001,1,2010,6,1,201001,2010),('2010-01-07',201001,1,2010,7,1,201001,2010),('2010-01-08',201001,1,2010,8,1,201001,2010),('2010-01-09',201001,1,2010,9,1,201001,2010),('2010-01-10',201002,1,2010,10,2,201001,2010),('2010-01-11',201002,1,2010,11,2,201001,2010),('2010-01-12',201002,1,2010,12,2,201001,2010),('2010-01-13',201002,1,2010,13,2,201001,2010),('2010-01-14',201002,1,2010,14,2,201001,2010),('2010-01-15',201002,1,2010,15,2,201001,2010),('2010-01-16',201002,1,2010,16,2,201001,2010),('2010-01-17',201003,1,2010,17,3,201001,2010),('2010-01-18',201003,1,2010,18,3,201001,2010),('2010-01-19',201003,1,2010,19,3,201001,2010),('2010-01-20',201003,1,2010,20,3,201001,2010),('2010-01-21',201003,1,2010,21,3,201001,2010),('2010-01-22',201003,1,2010,22,3,201001,2010),('2010-01-23',201003,1,2010,23,3,201001,2010),('2010-01-24',201004,1,2010,24,4,201001,2010),('2010-01-25',201004,1,2010,25,4,201001,2010),('2010-01-26',201004,1,2010,26,4,201001,2010),('2010-01-27',201004,1,2010,27,4,201001,2010),('2010-01-28',201004,1,2010,28,4,201001,2010),('2010-01-29',201004,1,2010,29,4,201001,2010),('2010-01-30',201004,1,2010,30,4,201001,2010),('2010-01-31',201005,1,2010,31,5,201001,2010),('2010-02-01',201005,2,2010,1,5,201002,2010),('2010-02-02',201005,2,2010,2,5,201002,2010),('2010-02-03',201005,2,2010,3,5,201002,2010),('2010-02-04',201005,2,2010,4,5,201002,2010),('2010-02-05',201005,2,2010,5,5,201002,2010),('2010-02-06',201005,2,2010,6,5,201002,2010),('2010-02-07',201006,2,2010,7,6,201002,2010),('2010-02-08',201006,2,2010,8,6,201002,2010),('2010-02-09',201006,2,2010,9,6,201002,2010),('2010-02-10',201006,2,2010,10,6,201002,2010),('2010-02-11',201006,2,2010,11,6,201002,2010),('2010-02-12',201006,2,2010,12,6,201002,2010),('2010-02-13',201006,2,2010,13,6,201002,2010),('2010-02-14',201007,2,2010,14,7,201002,2010),('2010-02-15',201007,2,2010,15,7,201002,2010),('2010-02-16',201007,2,2010,16,7,201002,2010),('2010-02-17',201007,2,2010,17,7,201002,2010),('2010-02-18',201007,2,2010,18,7,201002,2010),('2010-02-19',201007,2,2010,19,7,201002,2010),('2010-02-20',201007,2,2010,20,7,201002,2010),('2010-02-21',201008,2,2010,21,8,201002,2010),('2010-02-22',201008,2,2010,22,8,201002,2010),('2010-02-23',201008,2,2010,23,8,201002,2010),('2010-02-24',201008,2,2010,24,8,201002,2010),('2010-02-25',201008,2,2010,25,8,201002,2010),('2010-02-26',201008,2,2010,26,8,201002,2010),('2010-02-27',201008,2,2010,27,8,201002,2010),('2010-02-28',201009,2,2010,28,9,201002,2010),('2010-03-01',201009,3,2010,1,9,201003,2010),('2010-03-02',201009,3,2010,2,9,201003,2010),('2010-03-03',201009,3,2010,3,9,201003,2010),('2010-03-04',201009,3,2010,4,9,201003,2010),('2010-03-05',201009,3,2010,5,9,201003,2010),('2010-03-06',201009,3,2010,6,9,201003,2010),('2010-03-07',201010,3,2010,7,10,201003,2010),('2010-03-08',201010,3,2010,8,10,201003,2010),('2010-03-09',201010,3,2010,9,10,201003,2010),('2010-03-10',201010,3,2010,10,10,201003,2010),('2010-03-11',201010,3,2010,11,10,201003,2010),('2010-03-12',201010,3,2010,12,10,201003,2010),('2010-03-13',201010,3,2010,13,10,201003,2010),('2010-03-14',201011,3,2010,14,11,201003,2010),('2010-03-15',201011,3,2010,15,11,201003,2010),('2010-03-16',201011,3,2010,16,11,201003,2010),('2010-03-17',201011,3,2010,17,11,201003,2010),('2010-03-18',201011,3,2010,18,11,201003,2010),('2010-03-19',201011,3,2010,19,11,201003,2010),('2010-03-20',201011,3,2010,20,11,201003,2010),('2010-03-21',201012,3,2010,21,12,201003,2010),('2010-03-22',201012,3,2010,22,12,201003,2010),('2010-03-23',201012,3,2010,23,12,201003,2010),('2010-03-24',201012,3,2010,24,12,201003,2010),('2010-03-25',201012,3,2010,25,12,201003,2010),('2010-03-26',201012,3,2010,26,12,201003,2010),('2010-03-27',201012,3,2010,27,12,201003,2010),('2010-03-28',201013,3,2010,28,13,201003,2010),('2010-03-29',201013,3,2010,29,13,201003,2010),('2010-03-30',201013,3,2010,30,13,201003,2010),('2010-03-31',201013,3,2010,31,13,201003,2010),('2010-04-01',201013,4,2010,1,13,201004,2010),('2010-04-02',201013,4,2010,2,13,201004,2010),('2010-04-03',201013,4,2010,3,13,201004,2010),('2010-04-04',201014,4,2010,4,14,201004,2010),('2010-04-05',201014,4,2010,5,14,201004,2010),('2010-04-06',201014,4,2010,6,14,201004,2010),('2010-04-07',201014,4,2010,7,14,201004,2010),('2010-04-08',201014,4,2010,8,14,201004,2010),('2010-04-09',201014,4,2010,9,14,201004,2010),('2010-04-10',201014,4,2010,10,14,201004,2010),('2010-04-11',201015,4,2010,11,15,201004,2010),('2010-04-12',201015,4,2010,12,15,201004,2010),('2010-04-13',201015,4,2010,13,15,201004,2010),('2010-04-14',201015,4,2010,14,15,201004,2010),('2010-04-15',201015,4,2010,15,15,201004,2010),('2010-04-16',201015,4,2010,16,15,201004,2010),('2010-04-17',201015,4,2010,17,15,201004,2010),('2010-04-18',201016,4,2010,18,16,201004,2010),('2010-04-19',201016,4,2010,19,16,201004,2010),('2010-04-20',201016,4,2010,20,16,201004,2010),('2010-04-21',201016,4,2010,21,16,201004,2010),('2010-04-22',201016,4,2010,22,16,201004,2010),('2010-04-23',201016,4,2010,23,16,201004,2010),('2010-04-24',201016,4,2010,24,16,201004,2010),('2010-04-25',201017,4,2010,25,17,201004,2010),('2010-04-26',201017,4,2010,26,17,201004,2010),('2010-04-27',201017,4,2010,27,17,201004,2010),('2010-04-28',201017,4,2010,28,17,201004,2010),('2010-04-29',201017,4,2010,29,17,201004,2010),('2010-04-30',201017,4,2010,30,17,201004,2010),('2010-05-01',201017,5,2010,1,17,201005,2010),('2010-05-02',201018,5,2010,2,18,201005,2010),('2010-05-03',201018,5,2010,3,18,201005,2010),('2010-05-04',201018,5,2010,4,18,201005,2010),('2010-05-05',201018,5,2010,5,18,201005,2010),('2010-05-06',201018,5,2010,6,18,201005,2010),('2010-05-07',201018,5,2010,7,18,201005,2010),('2010-05-08',201018,5,2010,8,18,201005,2010),('2010-05-09',201019,5,2010,9,19,201005,2010),('2010-05-10',201019,5,2010,10,19,201005,2010),('2010-05-11',201019,5,2010,11,19,201005,2010),('2010-05-12',201019,5,2010,12,19,201005,2010),('2010-05-13',201019,5,2010,13,19,201005,2010),('2010-05-14',201019,5,2010,14,19,201005,2010),('2010-05-15',201019,5,2010,15,19,201005,2010),('2010-05-16',201020,5,2010,16,20,201005,2010),('2010-05-17',201020,5,2010,17,20,201005,2010),('2010-05-18',201020,5,2010,18,20,201005,2010),('2010-05-19',201020,5,2010,19,20,201005,2010),('2010-05-20',201020,5,2010,20,20,201005,2010),('2010-05-21',201020,5,2010,21,20,201005,2010),('2010-05-22',201020,5,2010,22,20,201005,2010),('2010-05-23',201021,5,2010,23,21,201005,2010),('2010-05-24',201021,5,2010,24,21,201005,2010),('2010-05-25',201021,5,2010,25,21,201005,2010),('2010-05-26',201021,5,2010,26,21,201005,2010),('2010-05-27',201021,5,2010,27,21,201005,2010),('2010-05-28',201021,5,2010,28,21,201005,2010),('2010-05-29',201021,5,2010,29,21,201005,2010),('2010-05-30',201022,5,2010,30,22,201005,2010),('2010-05-31',201022,5,2010,31,22,201005,2010),('2010-06-01',201022,6,2010,1,22,201006,2010),('2010-06-02',201022,6,2010,2,22,201006,2010),('2010-06-03',201022,6,2010,3,22,201006,2010),('2010-06-04',201022,6,2010,4,22,201006,2010),('2010-06-05',201022,6,2010,5,22,201006,2010),('2010-06-06',201023,6,2010,6,23,201006,2010),('2010-06-07',201023,6,2010,7,23,201006,2010),('2010-06-08',201023,6,2010,8,23,201006,2010),('2010-06-09',201023,6,2010,9,23,201006,2010),('2010-06-10',201023,6,2010,10,23,201006,2010),('2010-06-11',201023,6,2010,11,23,201006,2010),('2010-06-12',201023,6,2010,12,23,201006,2010),('2010-06-13',201024,6,2010,13,24,201006,2010),('2010-06-14',201024,6,2010,14,24,201006,2010),('2010-06-15',201024,6,2010,15,24,201006,2010),('2010-06-16',201024,6,2010,16,24,201006,2010),('2010-06-17',201024,6,2010,17,24,201006,2010),('2010-06-18',201024,6,2010,18,24,201006,2010),('2010-06-19',201024,6,2010,19,24,201006,2010),('2010-06-20',201025,6,2010,20,25,201006,2010),('2010-06-21',201025,6,2010,21,25,201006,2010),('2010-06-22',201025,6,2010,22,25,201006,2010),('2010-06-23',201025,6,2010,23,25,201006,2010),('2010-06-24',201025,6,2010,24,25,201006,2010),('2010-06-25',201025,6,2010,25,25,201006,2010),('2010-06-26',201025,6,2010,26,25,201006,2010),('2010-06-27',201026,6,2010,27,26,201006,2010),('2010-06-28',201026,6,2010,28,26,201006,2010),('2010-06-29',201026,6,2010,29,26,201006,2010),('2010-06-30',201026,6,2010,30,26,201006,2010),('2010-07-01',201026,7,2010,1,26,201007,2010),('2010-07-02',201026,7,2010,2,26,201007,2010),('2010-07-03',201026,7,2010,3,26,201007,2010),('2010-07-04',201027,7,2010,4,27,201007,2010),('2010-07-05',201027,7,2010,5,27,201007,2010),('2010-07-06',201027,7,2010,6,27,201007,2010),('2010-07-07',201027,7,2010,7,27,201007,2010),('2010-07-08',201027,7,2010,8,27,201007,2010),('2010-07-09',201027,7,2010,9,27,201007,2010),('2010-07-10',201027,7,2010,10,27,201007,2010),('2010-07-11',201028,7,2010,11,28,201007,2010),('2010-07-12',201028,7,2010,12,28,201007,2010),('2010-07-13',201028,7,2010,13,28,201007,2010),('2010-07-14',201028,7,2010,14,28,201007,2010),('2010-07-15',201028,7,2010,15,28,201007,2010),('2010-07-16',201028,7,2010,16,28,201007,2010),('2010-07-17',201028,7,2010,17,28,201007,2010),('2010-07-18',201029,7,2010,18,29,201007,2010),('2010-07-19',201029,7,2010,19,29,201007,2010),('2010-07-20',201029,7,2010,20,29,201007,2010),('2010-07-21',201029,7,2010,21,29,201007,2010),('2010-07-22',201029,7,2010,22,29,201007,2010),('2010-07-23',201029,7,2010,23,29,201007,2010),('2010-07-24',201029,7,2010,24,29,201007,2010),('2010-07-25',201030,7,2010,25,30,201007,2010),('2010-07-26',201030,7,2010,26,30,201007,2010),('2010-07-27',201030,7,2010,27,30,201007,2010),('2010-07-28',201030,7,2010,28,30,201007,2010),('2010-07-29',201030,7,2010,29,30,201007,2010),('2010-07-30',201030,7,2010,30,30,201007,2010),('2010-07-31',201030,7,2010,31,30,201007,2010),('2010-08-01',201031,8,2010,1,31,201008,2010),('2010-08-02',201031,8,2010,2,31,201008,2010),('2010-08-03',201031,8,2010,3,31,201008,2010),('2010-08-04',201031,8,2010,4,31,201008,2010),('2010-08-05',201031,8,2010,5,31,201008,2010),('2010-08-06',201031,8,2010,6,31,201008,2010),('2010-08-07',201031,8,2010,7,31,201008,2010),('2010-08-08',201032,8,2010,8,32,201008,2010),('2010-08-09',201032,8,2010,9,32,201008,2010),('2010-08-10',201032,8,2010,10,32,201008,2010),('2010-08-11',201032,8,2010,11,32,201008,2010),('2010-08-12',201032,8,2010,12,32,201008,2010),('2010-08-13',201032,8,2010,13,32,201008,2010),('2010-08-14',201032,8,2010,14,32,201008,2010),('2010-08-15',201033,8,2010,15,33,201008,2010),('2010-08-16',201033,8,2010,16,33,201008,2010),('2010-08-17',201033,8,2010,17,33,201008,2010),('2010-08-18',201033,8,2010,18,33,201008,2010),('2010-08-19',201033,8,2010,19,33,201008,2010),('2010-08-20',201033,8,2010,20,33,201008,2010),('2010-08-21',201033,8,2010,21,33,201008,2010),('2010-08-22',201034,8,2010,22,34,201008,2010),('2010-08-23',201034,8,2010,23,34,201008,2010),('2010-08-24',201034,8,2010,24,34,201008,2010),('2010-08-25',201034,8,2010,25,34,201008,2010),('2010-08-26',201034,8,2010,26,34,201008,2010),('2010-08-27',201034,8,2010,27,34,201008,2010),('2010-08-28',201034,8,2010,28,34,201008,2010),('2010-08-29',201035,8,2010,29,35,201008,2010),('2010-08-30',201035,8,2010,30,35,201008,2010),('2010-08-31',201035,8,2010,31,35,201008,2010),('2010-09-01',201035,9,2010,1,35,201009,2010),('2010-09-02',201035,9,2010,2,35,201009,2010),('2010-09-03',201035,9,2010,3,35,201009,2010),('2010-09-04',201035,9,2010,4,35,201009,2010),('2010-09-05',201036,9,2010,5,36,201009,2010),('2010-09-06',201036,9,2010,6,36,201009,2010),('2010-09-07',201036,9,2010,7,36,201009,2010),('2010-09-08',201036,9,2010,8,36,201009,2010),('2010-09-09',201036,9,2010,9,36,201009,2010),('2010-09-10',201036,9,2010,10,36,201009,2010),('2010-09-11',201036,9,2010,11,36,201009,2010),('2010-09-12',201037,9,2010,12,37,201009,2010),('2010-09-13',201037,9,2010,13,37,201009,2010),('2010-09-14',201037,9,2010,14,37,201009,2010),('2010-09-15',201037,9,2010,15,37,201009,2010),('2010-09-16',201037,9,2010,16,37,201009,2010),('2010-09-17',201037,9,2010,17,37,201009,2010),('2010-09-18',201037,9,2010,18,37,201009,2010),('2010-09-19',201038,9,2010,19,38,201009,2010),('2010-09-20',201038,9,2010,20,38,201009,2010),('2010-09-21',201038,9,2010,21,38,201009,2010),('2010-09-22',201038,9,2010,22,38,201009,2010),('2010-09-23',201038,9,2010,23,38,201009,2010),('2010-09-24',201038,9,2010,24,38,201009,2010),('2010-09-25',201038,9,2010,25,38,201009,2010),('2010-09-26',201039,9,2010,26,39,201009,2010),('2010-09-27',201039,9,2010,27,39,201009,2010),('2010-09-28',201039,9,2010,28,39,201009,2010),('2010-09-29',201039,9,2010,29,39,201009,2010),('2010-09-30',201039,9,2010,30,39,201009,2010),('2010-10-01',201039,10,2010,1,39,201010,2010),('2010-10-02',201039,10,2010,2,39,201010,2010),('2010-10-03',201040,10,2010,3,40,201010,2010),('2010-10-04',201040,10,2010,4,40,201010,2010),('2010-10-05',201040,10,2010,5,40,201010,2010),('2010-10-06',201040,10,2010,6,40,201010,2010),('2010-10-07',201040,10,2010,7,40,201010,2010),('2010-10-08',201040,10,2010,8,40,201010,2010),('2010-10-09',201040,10,2010,9,40,201010,2010),('2010-10-10',201041,10,2010,10,41,201010,2010),('2010-10-11',201041,10,2010,11,41,201010,2010),('2010-10-12',201041,10,2010,12,41,201010,2010),('2010-10-13',201041,10,2010,13,41,201010,2010),('2010-10-14',201041,10,2010,14,41,201010,2010),('2010-10-15',201041,10,2010,15,41,201010,2010),('2010-10-16',201041,10,2010,16,41,201010,2010),('2010-10-17',201042,10,2010,17,42,201010,2010),('2010-10-18',201042,10,2010,18,42,201010,2010),('2010-10-19',201042,10,2010,19,42,201010,2010),('2010-10-20',201042,10,2010,20,42,201010,2010),('2010-10-21',201042,10,2010,21,42,201010,2010),('2010-10-22',201042,10,2010,22,42,201010,2010),('2010-10-23',201042,10,2010,23,42,201010,2010),('2010-10-24',201043,10,2010,24,43,201010,2010),('2010-10-25',201043,10,2010,25,43,201010,2010),('2010-10-26',201043,10,2010,26,43,201010,2010),('2010-10-27',201043,10,2010,27,43,201010,2010),('2010-10-28',201043,10,2010,28,43,201010,2010),('2010-10-29',201043,10,2010,29,43,201010,2010),('2010-10-30',201043,10,2010,30,43,201010,2010),('2010-10-31',201044,10,2010,31,44,201010,2010),('2010-11-01',201044,11,2010,1,44,201011,2010),('2010-11-02',201044,11,2010,2,44,201011,2010),('2010-11-03',201044,11,2010,3,44,201011,2010),('2010-11-04',201044,11,2010,4,44,201011,2010),('2010-11-05',201044,11,2010,5,44,201011,2010),('2010-11-06',201044,11,2010,6,44,201011,2010),('2010-11-07',201045,11,2010,7,45,201011,2010),('2010-11-08',201045,11,2010,8,45,201011,2010),('2010-11-09',201045,11,2010,9,45,201011,2010),('2010-11-10',201045,11,2010,10,45,201011,2010),('2010-11-11',201045,11,2010,11,45,201011,2010),('2010-11-12',201045,11,2010,12,45,201011,2010),('2010-11-13',201045,11,2010,13,45,201011,2010),('2010-11-14',201046,11,2010,14,46,201011,2010),('2010-11-15',201046,11,2010,15,46,201011,2010),('2010-11-16',201046,11,2010,16,46,201011,2010),('2010-11-17',201046,11,2010,17,46,201011,2010),('2010-11-18',201046,11,2010,18,46,201011,2010),('2010-11-19',201046,11,2010,19,46,201011,2010),('2010-11-20',201046,11,2010,20,46,201011,2010),('2010-11-21',201047,11,2010,21,47,201011,2010),('2010-11-22',201047,11,2010,22,47,201011,2010),('2010-11-23',201047,11,2010,23,47,201011,2010),('2010-11-24',201047,11,2010,24,47,201011,2010),('2010-11-25',201047,11,2010,25,47,201011,2010),('2010-11-26',201047,11,2010,26,47,201011,2010),('2010-11-27',201047,11,2010,27,47,201011,2010),('2010-11-28',201048,11,2010,28,48,201011,2010),('2010-11-29',201048,11,2010,29,48,201011,2010),('2010-11-30',201048,11,2010,30,48,201011,2010),('2010-12-01',201048,12,2010,1,48,201012,2011),('2010-12-02',201048,12,2010,2,48,201012,2011),('2010-12-03',201048,12,2010,3,48,201012,2011),('2010-12-04',201048,12,2010,4,48,201012,2011),('2010-12-05',201049,12,2010,5,49,201012,2011),('2010-12-06',201049,12,2010,6,49,201012,2011),('2010-12-07',201049,12,2010,7,49,201012,2011),('2010-12-08',201049,12,2010,8,49,201012,2011),('2010-12-09',201049,12,2010,9,49,201012,2011),('2010-12-10',201049,12,2010,10,49,201012,2011),('2010-12-11',201049,12,2010,11,49,201012,2011),('2010-12-12',201050,12,2010,12,50,201012,2011),('2010-12-13',201050,12,2010,13,50,201012,2011),('2010-12-14',201050,12,2010,14,50,201012,2011),('2010-12-15',201050,12,2010,15,50,201012,2011),('2010-12-16',201050,12,2010,16,50,201012,2011),('2010-12-17',201050,12,2010,17,50,201012,2011),('2010-12-18',201050,12,2010,18,50,201012,2011),('2010-12-19',201051,12,2010,19,51,201012,2011),('2010-12-20',201051,12,2010,20,51,201012,2011),('2010-12-21',201051,12,2010,21,51,201012,2011),('2010-12-22',201051,12,2010,22,51,201012,2011),('2010-12-23',201051,12,2010,23,51,201012,2011),('2010-12-24',201051,12,2010,24,51,201012,2011),('2010-12-25',201051,12,2010,25,51,201012,2011),('2010-12-26',201052,12,2010,26,52,201012,2011),('2010-12-27',201052,12,2010,27,52,201012,2011),('2010-12-28',201052,12,2010,28,52,201012,2011),('2010-12-29',201052,12,2010,29,52,201012,2011),('2010-12-30',201052,12,2010,30,52,201012,2011),('2010-12-31',201052,12,2010,31,52,201012,2011),('2011-01-01',201052,1,2011,1,52,201101,2011),('2011-01-02',201053,1,2011,2,1,201101,2011),('2011-01-03',201101,1,2011,3,1,201101,2011),('2011-01-04',201101,1,2011,4,1,201101,2011),('2011-01-05',201101,1,2011,5,1,201101,2011),('2011-01-06',201101,1,2011,6,1,201101,2011),('2011-01-07',201101,1,2011,7,1,201101,2011),('2011-01-08',201101,1,2011,8,1,201101,2011),('2011-01-09',201102,1,2011,9,2,201101,2011),('2011-01-10',201102,1,2011,10,2,201101,2011),('2011-01-11',201102,1,2011,11,2,201101,2011),('2011-01-12',201102,1,2011,12,2,201101,2011),('2011-01-13',201102,1,2011,13,2,201101,2011),('2011-01-14',201102,1,2011,14,2,201101,2011),('2011-01-15',201102,1,2011,15,2,201101,2011),('2011-01-16',201103,1,2011,16,3,201101,2011),('2011-01-17',201103,1,2011,17,3,201101,2011),('2011-01-18',201103,1,2011,18,3,201101,2011),('2011-01-19',201103,1,2011,19,3,201101,2011),('2011-01-20',201103,1,2011,20,3,201101,2011),('2011-01-21',201103,1,2011,21,3,201101,2011),('2011-01-22',201103,1,2011,22,3,201101,2011),('2011-01-23',201104,1,2011,23,4,201101,2011),('2011-01-24',201104,1,2011,24,4,201101,2011),('2011-01-25',201104,1,2011,25,4,201101,2011),('2011-01-26',201104,1,2011,26,4,201101,2011),('2011-01-27',201104,1,2011,27,4,201101,2011),('2011-01-28',201104,1,2011,28,4,201101,2011),('2011-01-29',201104,1,2011,29,4,201101,2011),('2011-01-30',201105,1,2011,30,5,201101,2011),('2011-01-31',201105,1,2011,31,5,201101,2011),('2011-02-01',201105,2,2011,1,5,201102,2011),('2011-02-02',201105,2,2011,2,5,201102,2011),('2011-02-03',201105,2,2011,3,5,201102,2011),('2011-02-04',201105,2,2011,4,5,201102,2011),('2011-02-05',201105,2,2011,5,5,201102,2011),('2011-02-06',201106,2,2011,6,6,201102,2011),('2011-02-07',201106,2,2011,7,6,201102,2011),('2011-02-08',201106,2,2011,8,6,201102,2011),('2011-02-09',201106,2,2011,9,6,201102,2011),('2011-02-10',201106,2,2011,10,6,201102,2011),('2011-02-11',201106,2,2011,11,6,201102,2011),('2011-02-12',201106,2,2011,12,6,201102,2011),('2011-02-13',201107,2,2011,13,7,201102,2011),('2011-02-14',201107,2,2011,14,7,201102,2011),('2011-02-15',201107,2,2011,15,7,201102,2011),('2011-02-16',201107,2,2011,16,7,201102,2011),('2011-02-17',201107,2,2011,17,7,201102,2011),('2011-02-18',201107,2,2011,18,7,201102,2011),('2011-02-19',201107,2,2011,19,7,201102,2011),('2011-02-20',201108,2,2011,20,8,201102,2011),('2011-02-21',201108,2,2011,21,8,201102,2011),('2011-02-22',201108,2,2011,22,8,201102,2011),('2011-02-23',201108,2,2011,23,8,201102,2011),('2011-02-24',201108,2,2011,24,8,201102,2011),('2011-02-25',201108,2,2011,25,8,201102,2011),('2011-02-26',201108,2,2011,26,8,201102,2011),('2011-02-27',201109,2,2011,27,9,201102,2011),('2011-02-28',201109,2,2011,28,9,201102,2011),('2011-03-01',201109,3,2011,1,9,201103,2011),('2011-03-02',201109,3,2011,2,9,201103,2011),('2011-03-03',201109,3,2011,3,9,201103,2011),('2011-03-04',201109,3,2011,4,9,201103,2011),('2011-03-05',201109,3,2011,5,9,201103,2011),('2011-03-06',201110,3,2011,6,10,201103,2011),('2011-03-07',201110,3,2011,7,10,201103,2011),('2011-03-08',201110,3,2011,8,10,201103,2011),('2011-03-09',201110,3,2011,9,10,201103,2011),('2011-03-10',201110,3,2011,10,10,201103,2011),('2011-03-11',201110,3,2011,11,10,201103,2011),('2011-03-12',201110,3,2011,12,10,201103,2011),('2011-03-13',201111,3,2011,13,11,201103,2011),('2011-03-14',201111,3,2011,14,11,201103,2011),('2011-03-15',201111,3,2011,15,11,201103,2011),('2011-03-16',201111,3,2011,16,11,201103,2011),('2011-03-17',201111,3,2011,17,11,201103,2011),('2011-03-18',201111,3,2011,18,11,201103,2011),('2011-03-19',201111,3,2011,19,11,201103,2011),('2011-03-20',201112,3,2011,20,12,201103,2011),('2011-03-21',201112,3,2011,21,12,201103,2011),('2011-03-22',201112,3,2011,22,12,201103,2011),('2011-03-23',201112,3,2011,23,12,201103,2011),('2011-03-24',201112,3,2011,24,12,201103,2011),('2011-03-25',201112,3,2011,25,12,201103,2011),('2011-03-26',201112,3,2011,26,12,201103,2011),('2011-03-27',201113,3,2011,27,13,201103,2011),('2011-03-28',201113,3,2011,28,13,201103,2011),('2011-03-29',201113,3,2011,29,13,201103,2011),('2011-03-30',201113,3,2011,30,13,201103,2011),('2011-03-31',201113,3,2011,31,13,201103,2011),('2011-04-01',201113,4,2011,1,13,201104,2011),('2011-04-02',201113,4,2011,2,13,201104,2011),('2011-04-03',201114,4,2011,3,14,201104,2011),('2011-04-04',201114,4,2011,4,14,201104,2011),('2011-04-05',201114,4,2011,5,14,201104,2011),('2011-04-06',201114,4,2011,6,14,201104,2011),('2011-04-07',201114,4,2011,7,14,201104,2011),('2011-04-08',201114,4,2011,8,14,201104,2011),('2011-04-09',201114,4,2011,9,14,201104,2011),('2011-04-10',201115,4,2011,10,15,201104,2011),('2011-04-11',201115,4,2011,11,15,201104,2011),('2011-04-12',201115,4,2011,12,15,201104,2011),('2011-04-13',201115,4,2011,13,15,201104,2011),('2011-04-14',201115,4,2011,14,15,201104,2011),('2011-04-15',201115,4,2011,15,15,201104,2011),('2011-04-16',201115,4,2011,16,15,201104,2011),('2011-04-17',201116,4,2011,17,16,201104,2011),('2011-04-18',201116,4,2011,18,16,201104,2011),('2011-04-19',201116,4,2011,19,16,201104,2011),('2011-04-20',201116,4,2011,20,16,201104,2011),('2011-04-21',201116,4,2011,21,16,201104,2011),('2011-04-22',201116,4,2011,22,16,201104,2011),('2011-04-23',201116,4,2011,23,16,201104,2011),('2011-04-24',201117,4,2011,24,17,201104,2011),('2011-04-25',201117,4,2011,25,17,201104,2011),('2011-04-26',201117,4,2011,26,17,201104,2011),('2011-04-27',201117,4,2011,27,17,201104,2011),('2011-04-28',201117,4,2011,28,17,201104,2011),('2011-04-29',201117,4,2011,29,17,201104,2011),('2011-04-30',201117,4,2011,30,17,201104,2011),('2011-05-01',201118,5,2011,1,18,201105,2011),('2011-05-02',201118,5,2011,2,18,201105,2011),('2011-05-03',201118,5,2011,3,18,201105,2011),('2011-05-04',201118,5,2011,4,18,201105,2011),('2011-05-05',201118,5,2011,5,18,201105,2011),('2011-05-06',201118,5,2011,6,18,201105,2011),('2011-05-07',201118,5,2011,7,18,201105,2011),('2011-05-08',201119,5,2011,8,19,201105,2011),('2011-05-09',201119,5,2011,9,19,201105,2011),('2011-05-10',201119,5,2011,10,19,201105,2011),('2011-05-11',201119,5,2011,11,19,201105,2011),('2011-05-12',201119,5,2011,12,19,201105,2011),('2011-05-13',201119,5,2011,13,19,201105,2011),('2011-05-14',201119,5,2011,14,19,201105,2011),('2011-05-15',201120,5,2011,15,20,201105,2011),('2011-05-16',201120,5,2011,16,20,201105,2011),('2011-05-17',201120,5,2011,17,20,201105,2011),('2011-05-18',201120,5,2011,18,20,201105,2011),('2011-05-19',201120,5,2011,19,20,201105,2011),('2011-05-20',201120,5,2011,20,20,201105,2011),('2011-05-21',201120,5,2011,21,20,201105,2011),('2011-05-22',201121,5,2011,22,21,201105,2011),('2011-05-23',201121,5,2011,23,21,201105,2011),('2011-05-24',201121,5,2011,24,21,201105,2011),('2011-05-25',201121,5,2011,25,21,201105,2011),('2011-05-26',201121,5,2011,26,21,201105,2011),('2011-05-27',201121,5,2011,27,21,201105,2011),('2011-05-28',201121,5,2011,28,21,201105,2011),('2011-05-29',201122,5,2011,29,22,201105,2011),('2011-05-30',201122,5,2011,30,22,201105,2011),('2011-05-31',201122,5,2011,31,22,201105,2011),('2011-06-01',201122,6,2011,1,22,201106,2011),('2011-06-02',201122,6,2011,2,22,201106,2011),('2011-06-03',201122,6,2011,3,22,201106,2011),('2011-06-04',201122,6,2011,4,22,201106,2011),('2011-06-05',201123,6,2011,5,23,201106,2011),('2011-06-06',201123,6,2011,6,23,201106,2011),('2011-06-07',201123,6,2011,7,23,201106,2011),('2011-06-08',201123,6,2011,8,23,201106,2011),('2011-06-09',201123,6,2011,9,23,201106,2011),('2011-06-10',201123,6,2011,10,23,201106,2011),('2011-06-11',201123,6,2011,11,23,201106,2011),('2011-06-12',201124,6,2011,12,24,201106,2011),('2011-06-13',201124,6,2011,13,24,201106,2011),('2011-06-14',201124,6,2011,14,24,201106,2011),('2011-06-15',201124,6,2011,15,24,201106,2011),('2011-06-16',201124,6,2011,16,24,201106,2011),('2011-06-17',201124,6,2011,17,24,201106,2011),('2011-06-18',201124,6,2011,18,24,201106,2011),('2011-06-19',201125,6,2011,19,25,201106,2011),('2011-06-20',201125,6,2011,20,25,201106,2011),('2011-06-21',201125,6,2011,21,25,201106,2011),('2011-06-22',201125,6,2011,22,25,201106,2011),('2011-06-23',201125,6,2011,23,25,201106,2011),('2011-06-24',201125,6,2011,24,25,201106,2011),('2011-06-25',201125,6,2011,25,25,201106,2011),('2011-06-26',201126,6,2011,26,26,201106,2011),('2011-06-27',201126,6,2011,27,26,201106,2011),('2011-06-28',201126,6,2011,28,26,201106,2011),('2011-06-29',201126,6,2011,29,26,201106,2011),('2011-06-30',201126,6,2011,30,26,201106,2011),('2011-07-01',201126,7,2011,1,26,201107,2011),('2011-07-02',201126,7,2011,2,26,201107,2011),('2011-07-03',201127,7,2011,3,27,201107,2011),('2011-07-04',201127,7,2011,4,27,201107,2011),('2011-07-05',201127,7,2011,5,27,201107,2011),('2011-07-06',201127,7,2011,6,27,201107,2011),('2011-07-07',201127,7,2011,7,27,201107,2011),('2011-07-08',201127,7,2011,8,27,201107,2011),('2011-07-09',201127,7,2011,9,27,201107,2011),('2011-07-10',201128,7,2011,10,28,201107,2011),('2011-07-11',201128,7,2011,11,28,201107,2011),('2011-07-12',201128,7,2011,12,28,201107,2011),('2011-07-13',201128,7,2011,13,28,201107,2011),('2011-07-14',201128,7,2011,14,28,201107,2011),('2011-07-15',201128,7,2011,15,28,201107,2011),('2011-07-16',201128,7,2011,16,28,201107,2011),('2011-07-17',201129,7,2011,17,29,201107,2011),('2011-07-18',201129,7,2011,18,29,201107,2011),('2011-07-19',201129,7,2011,19,29,201107,2011),('2011-07-20',201129,7,2011,20,29,201107,2011),('2011-07-21',201129,7,2011,21,29,201107,2011),('2011-07-22',201129,7,2011,22,29,201107,2011),('2011-07-23',201129,7,2011,23,29,201107,2011),('2011-07-24',201130,7,2011,24,30,201107,2011),('2011-07-25',201130,7,2011,25,30,201107,2011),('2011-07-26',201130,7,2011,26,30,201107,2011),('2011-07-27',201130,7,2011,27,30,201107,2011),('2011-07-28',201130,7,2011,28,30,201107,2011),('2011-07-29',201130,7,2011,29,30,201107,2011),('2011-07-30',201130,7,2011,30,30,201107,2011),('2011-07-31',201131,7,2011,31,31,201107,2011),('2011-08-01',201131,8,2011,1,31,201108,2011),('2011-08-02',201131,8,2011,2,31,201108,2011),('2011-08-03',201131,8,2011,3,31,201108,2011),('2011-08-04',201131,8,2011,4,31,201108,2011),('2011-08-05',201131,8,2011,5,31,201108,2011),('2011-08-06',201131,8,2011,6,31,201108,2011),('2011-08-07',201132,8,2011,7,32,201108,2011),('2011-08-08',201132,8,2011,8,32,201108,2011),('2011-08-09',201132,8,2011,9,32,201108,2011),('2011-08-10',201132,8,2011,10,32,201108,2011),('2011-08-11',201132,8,2011,11,32,201108,2011),('2011-08-12',201132,8,2011,12,32,201108,2011),('2011-08-13',201132,8,2011,13,32,201108,2011),('2011-08-14',201133,8,2011,14,33,201108,2011),('2011-08-15',201133,8,2011,15,33,201108,2011),('2011-08-16',201133,8,2011,16,33,201108,2011),('2011-08-17',201133,8,2011,17,33,201108,2011),('2011-08-18',201133,8,2011,18,33,201108,2011),('2011-08-19',201133,8,2011,19,33,201108,2011),('2011-08-20',201133,8,2011,20,33,201108,2011),('2011-08-21',201134,8,2011,21,34,201108,2011),('2011-08-22',201134,8,2011,22,34,201108,2011),('2011-08-23',201134,8,2011,23,34,201108,2011),('2011-08-24',201134,8,2011,24,34,201108,2011),('2011-08-25',201134,8,2011,25,34,201108,2011),('2011-08-26',201134,8,2011,26,34,201108,2011),('2011-08-27',201134,8,2011,27,34,201108,2011),('2011-08-28',201135,8,2011,28,35,201108,2011),('2011-08-29',201135,8,2011,29,35,201108,2011),('2011-08-30',201135,8,2011,30,35,201108,2011),('2011-08-31',201135,8,2011,31,35,201108,2011),('2011-09-01',201135,9,2011,1,35,201109,2011),('2011-09-02',201135,9,2011,2,35,201109,2011),('2011-09-03',201135,9,2011,3,35,201109,2011),('2011-09-04',201136,9,2011,4,36,201109,2011),('2011-09-05',201136,9,2011,5,36,201109,2011),('2011-09-06',201136,9,2011,6,36,201109,2011),('2011-09-07',201136,9,2011,7,36,201109,2011),('2011-09-08',201136,9,2011,8,36,201109,2011),('2011-09-09',201136,9,2011,9,36,201109,2011),('2011-09-10',201136,9,2011,10,36,201109,2011),('2011-09-11',201137,9,2011,11,37,201109,2011),('2011-09-12',201137,9,2011,12,37,201109,2011),('2011-09-13',201137,9,2011,13,37,201109,2011),('2011-09-14',201137,9,2011,14,37,201109,2011),('2011-09-15',201137,9,2011,15,37,201109,2011),('2011-09-16',201137,9,2011,16,37,201109,2011),('2011-09-17',201137,9,2011,17,37,201109,2011),('2011-09-18',201138,9,2011,18,38,201109,2011),('2011-09-19',201138,9,2011,19,38,201109,2011),('2011-09-20',201138,9,2011,20,38,201109,2011),('2011-09-21',201138,9,2011,21,38,201109,2011),('2011-09-22',201138,9,2011,22,38,201109,2011),('2011-09-23',201138,9,2011,23,38,201109,2011),('2011-09-24',201138,9,2011,24,38,201109,2011),('2011-09-25',201139,9,2011,25,39,201109,2011),('2011-09-26',201139,9,2011,26,39,201109,2011),('2011-09-27',201139,9,2011,27,39,201109,2011),('2011-09-28',201139,9,2011,28,39,201109,2011),('2011-09-29',201139,9,2011,29,39,201109,2011),('2011-09-30',201139,9,2011,30,39,201109,2011),('2011-10-01',201139,10,2011,1,39,201110,2011),('2011-10-02',201140,10,2011,2,40,201110,2011),('2011-10-03',201140,10,2011,3,40,201110,2011),('2011-10-04',201140,10,2011,4,40,201110,2011),('2011-10-05',201140,10,2011,5,40,201110,2011),('2011-10-06',201140,10,2011,6,40,201110,2011),('2011-10-07',201140,10,2011,7,40,201110,2011),('2011-10-08',201140,10,2011,8,40,201110,2011),('2011-10-09',201141,10,2011,9,41,201110,2011),('2011-10-10',201141,10,2011,10,41,201110,2011),('2011-10-11',201141,10,2011,11,41,201110,2011),('2011-10-12',201141,10,2011,12,41,201110,2011),('2011-10-13',201141,10,2011,13,41,201110,2011),('2011-10-14',201141,10,2011,14,41,201110,2011),('2011-10-15',201141,10,2011,15,41,201110,2011),('2011-10-16',201142,10,2011,16,42,201110,2011),('2011-10-17',201142,10,2011,17,42,201110,2011),('2011-10-18',201142,10,2011,18,42,201110,2011),('2011-10-19',201142,10,2011,19,42,201110,2011),('2011-10-20',201142,10,2011,20,42,201110,2011),('2011-10-21',201142,10,2011,21,42,201110,2011),('2011-10-22',201142,10,2011,22,42,201110,2011),('2011-10-23',201143,10,2011,23,43,201110,2011),('2011-10-24',201143,10,2011,24,43,201110,2011),('2011-10-25',201143,10,2011,25,43,201110,2011),('2011-10-26',201143,10,2011,26,43,201110,2011),('2011-10-27',201143,10,2011,27,43,201110,2011),('2011-10-28',201143,10,2011,28,43,201110,2011),('2011-10-29',201143,10,2011,29,43,201110,2011),('2011-10-30',201144,10,2011,30,44,201110,2011),('2011-10-31',201144,10,2011,31,44,201110,2011),('2011-11-01',201144,11,2011,1,44,201111,2011),('2011-11-02',201144,11,2011,2,44,201111,2011),('2011-11-03',201144,11,2011,3,44,201111,2011),('2011-11-04',201144,11,2011,4,44,201111,2011),('2011-11-05',201144,11,2011,5,44,201111,2011),('2011-11-06',201145,11,2011,6,45,201111,2011),('2011-11-07',201145,11,2011,7,45,201111,2011),('2011-11-08',201145,11,2011,8,45,201111,2011),('2011-11-09',201145,11,2011,9,45,201111,2011),('2011-11-10',201145,11,2011,10,45,201111,2011),('2011-11-11',201145,11,2011,11,45,201111,2011),('2011-11-12',201145,11,2011,12,45,201111,2011),('2011-11-13',201146,11,2011,13,46,201111,2011),('2011-11-14',201146,11,2011,14,46,201111,2011),('2011-11-15',201146,11,2011,15,46,201111,2011),('2011-11-16',201146,11,2011,16,46,201111,2011),('2011-11-17',201146,11,2011,17,46,201111,2011),('2011-11-18',201146,11,2011,18,46,201111,2011),('2011-11-19',201146,11,2011,19,46,201111,2011),('2011-11-20',201147,11,2011,20,47,201111,2011),('2011-11-21',201147,11,2011,21,47,201111,2011),('2011-11-22',201147,11,2011,22,47,201111,2011),('2011-11-23',201147,11,2011,23,47,201111,2011),('2011-11-24',201147,11,2011,24,47,201111,2011),('2011-11-25',201147,11,2011,25,47,201111,2011),('2011-11-26',201147,11,2011,26,47,201111,2011),('2011-11-27',201148,11,2011,27,48,201111,2011),('2011-11-28',201148,11,2011,28,48,201111,2011),('2011-11-29',201148,11,2011,29,48,201111,2011),('2011-11-30',201148,11,2011,30,48,201111,2011),('2011-12-01',201148,12,2011,1,48,201112,2012),('2011-12-02',201148,12,2011,2,48,201112,2012),('2011-12-03',201148,12,2011,3,48,201112,2012),('2011-12-04',201149,12,2011,4,49,201112,2012),('2011-12-05',201149,12,2011,5,49,201112,2012),('2011-12-06',201149,12,2011,6,49,201112,2012),('2011-12-07',201149,12,2011,7,49,201112,2012),('2011-12-08',201149,12,2011,8,49,201112,2012),('2011-12-09',201149,12,2011,9,49,201112,2012),('2011-12-10',201149,12,2011,10,49,201112,2012),('2011-12-11',201150,12,2011,11,50,201112,2012),('2011-12-12',201150,12,2011,12,50,201112,2012),('2011-12-13',201150,12,2011,13,50,201112,2012),('2011-12-14',201150,12,2011,14,50,201112,2012),('2011-12-15',201150,12,2011,15,50,201112,2012),('2011-12-16',201150,12,2011,16,50,201112,2012),('2011-12-17',201150,12,2011,17,50,201112,2012),('2011-12-18',201151,12,2011,18,51,201112,2012),('2011-12-19',201151,12,2011,19,51,201112,2012),('2011-12-20',201151,12,2011,20,51,201112,2012),('2011-12-21',201151,12,2011,21,51,201112,2012),('2011-12-22',201151,12,2011,22,51,201112,2012),('2011-12-23',201151,12,2011,23,51,201112,2012),('2011-12-24',201151,12,2011,24,51,201112,2012),('2011-12-25',201152,12,2011,25,52,201112,2012),('2011-12-26',201152,12,2011,26,52,201112,2012),('2011-12-27',201152,12,2011,27,52,201112,2012),('2011-12-28',201152,12,2011,28,52,201112,2012),('2011-12-29',201152,12,2011,29,52,201112,2012),('2011-12-30',201152,12,2011,30,52,201112,2012),('2011-12-31',201152,12,2011,31,52,201112,2012),('2012-01-01',201153,1,2012,1,1,201201,2012),('2012-01-02',201201,1,2012,2,1,201201,2012),('2012-01-03',201201,1,2012,3,1,201201,2012),('2012-01-04',201201,1,2012,4,1,201201,2012),('2012-01-05',201201,1,2012,5,1,201201,2012),('2012-01-06',201201,1,2012,6,1,201201,2012),('2012-01-07',201201,1,2012,7,1,201201,2012),('2012-01-08',201202,1,2012,8,2,201201,2012),('2012-01-09',201202,1,2012,9,2,201201,2012),('2012-01-10',201202,1,2012,10,2,201201,2012),('2012-01-11',201202,1,2012,11,2,201201,2012),('2012-01-12',201202,1,2012,12,2,201201,2012),('2012-01-13',201202,1,2012,13,2,201201,2012),('2012-01-14',201202,1,2012,14,2,201201,2012),('2012-01-15',201203,1,2012,15,3,201201,2012),('2012-01-16',201203,1,2012,16,3,201201,2012),('2012-01-17',201203,1,2012,17,3,201201,2012),('2012-01-18',201203,1,2012,18,3,201201,2012),('2012-01-19',201203,1,2012,19,3,201201,2012),('2012-01-20',201203,1,2012,20,3,201201,2012),('2012-01-21',201203,1,2012,21,3,201201,2012),('2012-01-22',201204,1,2012,22,4,201201,2012),('2012-01-23',201204,1,2012,23,4,201201,2012),('2012-01-24',201204,1,2012,24,4,201201,2012),('2012-01-25',201204,1,2012,25,4,201201,2012),('2012-01-26',201204,1,2012,26,4,201201,2012),('2012-01-27',201204,1,2012,27,4,201201,2012),('2012-01-28',201204,1,2012,28,4,201201,2012),('2012-01-29',201205,1,2012,29,5,201201,2012),('2012-01-30',201205,1,2012,30,5,201201,2012),('2012-01-31',201205,1,2012,31,5,201201,2012),('2012-02-01',201205,2,2012,1,5,201202,2012),('2012-02-02',201205,2,2012,2,5,201202,2012),('2012-02-03',201205,2,2012,3,5,201202,2012),('2012-02-04',201205,2,2012,4,5,201202,2012),('2012-02-05',201206,2,2012,5,6,201202,2012),('2012-02-06',201206,2,2012,6,6,201202,2012),('2012-02-07',201206,2,2012,7,6,201202,2012),('2012-02-08',201206,2,2012,8,6,201202,2012),('2012-02-09',201206,2,2012,9,6,201202,2012),('2012-02-10',201206,2,2012,10,6,201202,2012),('2012-02-11',201206,2,2012,11,6,201202,2012),('2012-02-12',201207,2,2012,12,7,201202,2012),('2012-02-13',201207,2,2012,13,7,201202,2012),('2012-02-14',201207,2,2012,14,7,201202,2012),('2012-02-15',201207,2,2012,15,7,201202,2012),('2012-02-16',201207,2,2012,16,7,201202,2012),('2012-02-17',201207,2,2012,17,7,201202,2012),('2012-02-18',201207,2,2012,18,7,201202,2012),('2012-02-19',201208,2,2012,19,8,201202,2012),('2012-02-20',201208,2,2012,20,8,201202,2012),('2012-02-21',201208,2,2012,21,8,201202,2012),('2012-02-22',201208,2,2012,22,8,201202,2012),('2012-02-23',201208,2,2012,23,8,201202,2012),('2012-02-24',201208,2,2012,24,8,201202,2012),('2012-02-25',201208,2,2012,25,8,201202,2012),('2012-02-26',201209,2,2012,26,9,201202,2012),('2012-02-27',201209,2,2012,27,9,201202,2012),('2012-02-28',201209,2,2012,28,9,201202,2012),('2012-02-29',201209,2,2012,29,9,201202,2012),('2012-03-01',201209,3,2012,1,9,201203,2012),('2012-03-02',201209,3,2012,2,9,201203,2012),('2012-03-03',201209,3,2012,3,9,201203,2012),('2012-03-04',201210,3,2012,4,10,201203,2012),('2012-03-05',201210,3,2012,5,10,201203,2012),('2012-03-06',201210,3,2012,6,10,201203,2012),('2012-03-07',201210,3,2012,7,10,201203,2012),('2012-03-08',201210,3,2012,8,10,201203,2012),('2012-03-09',201210,3,2012,9,10,201203,2012),('2012-03-10',201210,3,2012,10,10,201203,2012),('2012-03-11',201211,3,2012,11,11,201203,2012),('2012-03-12',201211,3,2012,12,11,201203,2012),('2012-03-13',201211,3,2012,13,11,201203,2012),('2012-03-14',201211,3,2012,14,11,201203,2012),('2012-03-15',201211,3,2012,15,11,201203,2012),('2012-03-16',201211,3,2012,16,11,201203,2012),('2012-03-17',201211,3,2012,17,11,201203,2012),('2012-03-18',201212,3,2012,18,12,201203,2012),('2012-03-19',201212,3,2012,19,12,201203,2012),('2012-03-20',201212,3,2012,20,12,201203,2012),('2012-03-21',201212,3,2012,21,12,201203,2012),('2012-03-22',201212,3,2012,22,12,201203,2012),('2012-03-23',201212,3,2012,23,12,201203,2012),('2012-03-24',201212,3,2012,24,12,201203,2012),('2012-03-25',201213,3,2012,25,13,201203,2012),('2012-03-26',201213,3,2012,26,13,201203,2012),('2012-03-27',201213,3,2012,27,13,201203,2012),('2012-03-28',201213,3,2012,28,13,201203,2012),('2012-03-29',201213,3,2012,29,13,201203,2012),('2012-03-30',201213,3,2012,30,13,201203,2012),('2012-03-31',201213,3,2012,31,13,201203,2012),('2012-04-01',201214,4,2012,1,14,201204,2012),('2012-04-02',201214,4,2012,2,14,201204,2012),('2012-04-03',201214,4,2012,3,14,201204,2012),('2012-04-04',201214,4,2012,4,14,201204,2012),('2012-04-05',201214,4,2012,5,14,201204,2012),('2012-04-06',201214,4,2012,6,14,201204,2012),('2012-04-07',201214,4,2012,7,14,201204,2012),('2012-04-08',201215,4,2012,8,15,201204,2012),('2012-04-09',201215,4,2012,9,15,201204,2012),('2012-04-10',201215,4,2012,10,15,201204,2012),('2012-04-11',201215,4,2012,11,15,201204,2012),('2012-04-12',201215,4,2012,12,15,201204,2012),('2012-04-13',201215,4,2012,13,15,201204,2012),('2012-04-14',201215,4,2012,14,15,201204,2012),('2012-04-15',201216,4,2012,15,16,201204,2012),('2012-04-16',201216,4,2012,16,16,201204,2012),('2012-04-17',201216,4,2012,17,16,201204,2012),('2012-04-18',201216,4,2012,18,16,201204,2012),('2012-04-19',201216,4,2012,19,16,201204,2012),('2012-04-20',201216,4,2012,20,16,201204,2012),('2012-04-21',201216,4,2012,21,16,201204,2012),('2012-04-22',201217,4,2012,22,17,201204,2012),('2012-04-23',201217,4,2012,23,17,201204,2012),('2012-04-24',201217,4,2012,24,17,201204,2012),('2012-04-25',201217,4,2012,25,17,201204,2012),('2012-04-26',201217,4,2012,26,17,201204,2012),('2012-04-27',201217,4,2012,27,17,201204,2012),('2012-04-28',201217,4,2012,28,17,201204,2012),('2012-04-29',201218,4,2012,29,18,201204,2012),('2012-04-30',201218,4,2012,30,18,201204,2012),('2012-05-01',201218,5,2012,1,18,201205,2012),('2012-05-02',201218,5,2012,2,18,201205,2012),('2012-05-03',201218,5,2012,3,18,201205,2012),('2012-05-04',201218,5,2012,4,18,201205,2012),('2012-05-05',201218,5,2012,5,18,201205,2012),('2012-05-06',201219,5,2012,6,19,201205,2012),('2012-05-07',201219,5,2012,7,19,201205,2012),('2012-05-08',201219,5,2012,8,19,201205,2012),('2012-05-09',201219,5,2012,9,19,201205,2012),('2012-05-10',201219,5,2012,10,19,201205,2012),('2012-05-11',201219,5,2012,11,19,201205,2012),('2012-05-12',201219,5,2012,12,19,201205,2012),('2012-05-13',201220,5,2012,13,20,201205,2012),('2012-05-14',201220,5,2012,14,20,201205,2012),('2012-05-15',201220,5,2012,15,20,201205,2012),('2012-05-16',201220,5,2012,16,20,201205,2012),('2012-05-17',201220,5,2012,17,20,201205,2012),('2012-05-18',201220,5,2012,18,20,201205,2012),('2012-05-19',201220,5,2012,19,20,201205,2012),('2012-05-20',201221,5,2012,20,21,201205,2012),('2012-05-21',201221,5,2012,21,21,201205,2012),('2012-05-22',201221,5,2012,22,21,201205,2012),('2012-05-23',201221,5,2012,23,21,201205,2012),('2012-05-24',201221,5,2012,24,21,201205,2012),('2012-05-25',201221,5,2012,25,21,201205,2012),('2012-05-26',201221,5,2012,26,21,201205,2012),('2012-05-27',201222,5,2012,27,22,201205,2012),('2012-05-28',201222,5,2012,28,22,201205,2012),('2012-05-29',201222,5,2012,29,22,201205,2012),('2012-05-30',201222,5,2012,30,22,201205,2012),('2012-05-31',201222,5,2012,31,22,201205,2012),('2012-06-01',201222,6,2012,1,22,201206,2012),('2012-06-02',201222,6,2012,2,22,201206,2012),('2012-06-03',201223,6,2012,3,23,201206,2012),('2012-06-04',201223,6,2012,4,23,201206,2012),('2012-06-05',201223,6,2012,5,23,201206,2012),('2012-06-06',201223,6,2012,6,23,201206,2012),('2012-06-07',201223,6,2012,7,23,201206,2012),('2012-06-08',201223,6,2012,8,23,201206,2012),('2012-06-09',201223,6,2012,9,23,201206,2012),('2012-06-10',201224,6,2012,10,24,201206,2012),('2012-06-11',201224,6,2012,11,24,201206,2012),('2012-06-12',201224,6,2012,12,24,201206,2012),('2012-06-13',201224,6,2012,13,24,201206,2012),('2012-06-14',201224,6,2012,14,24,201206,2012),('2012-06-15',201224,6,2012,15,24,201206,2012),('2012-06-16',201224,6,2012,16,24,201206,2012),('2012-06-17',201225,6,2012,17,25,201206,2012),('2012-06-18',201225,6,2012,18,25,201206,2012),('2012-06-19',201225,6,2012,19,25,201206,2012),('2012-06-20',201225,6,2012,20,25,201206,2012),('2012-06-21',201225,6,2012,21,25,201206,2012),('2012-06-22',201225,6,2012,22,25,201206,2012),('2012-06-23',201225,6,2012,23,25,201206,2012),('2012-06-24',201226,6,2012,24,26,201206,2012),('2012-06-25',201226,6,2012,25,26,201206,2012),('2012-06-26',201226,6,2012,26,26,201206,2012),('2012-06-27',201226,6,2012,27,26,201206,2012),('2012-06-28',201226,6,2012,28,26,201206,2012),('2012-06-29',201226,6,2012,29,26,201206,2012),('2012-06-30',201226,6,2012,30,26,201206,2012),('2012-07-01',201227,7,2012,1,27,201207,2012),('2012-07-02',201227,7,2012,2,27,201207,2012),('2012-07-03',201227,7,2012,3,27,201207,2012),('2012-07-04',201227,7,2012,4,27,201207,2012),('2012-07-05',201227,7,2012,5,27,201207,2012),('2012-07-06',201227,7,2012,6,27,201207,2012),('2012-07-07',201227,7,2012,7,27,201207,2012),('2012-07-08',201228,7,2012,8,28,201207,2012),('2012-07-09',201228,7,2012,9,28,201207,2012),('2012-07-10',201228,7,2012,10,28,201207,2012),('2012-07-11',201228,7,2012,11,28,201207,2012),('2012-07-12',201228,7,2012,12,28,201207,2012),('2012-07-13',201228,7,2012,13,28,201207,2012),('2012-07-14',201228,7,2012,14,28,201207,2012),('2012-07-15',201229,7,2012,15,29,201207,2012),('2012-07-16',201229,7,2012,16,29,201207,2012),('2012-07-17',201229,7,2012,17,29,201207,2012),('2012-07-18',201229,7,2012,18,29,201207,2012),('2012-07-19',201229,7,2012,19,29,201207,2012),('2012-07-20',201229,7,2012,20,29,201207,2012),('2012-07-21',201229,7,2012,21,29,201207,2012),('2012-07-22',201230,7,2012,22,30,201207,2012),('2012-07-23',201230,7,2012,23,30,201207,2012),('2012-07-24',201230,7,2012,24,30,201207,2012),('2012-07-25',201230,7,2012,25,30,201207,2012),('2012-07-26',201230,7,2012,26,30,201207,2012),('2012-07-27',201230,7,2012,27,30,201207,2012),('2012-07-28',201230,7,2012,28,30,201207,2012),('2012-07-29',201231,7,2012,29,31,201207,2012),('2012-07-30',201231,7,2012,30,31,201207,2012),('2012-07-31',201231,7,2012,31,31,201207,2012),('2012-08-01',201231,8,2012,1,31,201208,2012),('2012-08-02',201231,8,2012,2,31,201208,2012),('2012-08-03',201231,8,2012,3,31,201208,2012),('2012-08-04',201231,8,2012,4,31,201208,2012),('2012-08-05',201232,8,2012,5,32,201208,2012),('2012-08-06',201232,8,2012,6,32,201208,2012),('2012-08-07',201232,8,2012,7,32,201208,2012),('2012-08-08',201232,8,2012,8,32,201208,2012),('2012-08-09',201232,8,2012,9,32,201208,2012),('2012-08-10',201232,8,2012,10,32,201208,2012),('2012-08-11',201232,8,2012,11,32,201208,2012),('2012-08-12',201233,8,2012,12,33,201208,2012),('2012-08-13',201233,8,2012,13,33,201208,2012),('2012-08-14',201233,8,2012,14,33,201208,2012),('2012-08-15',201233,8,2012,15,33,201208,2012),('2012-08-16',201233,8,2012,16,33,201208,2012),('2012-08-17',201233,8,2012,17,33,201208,2012),('2012-08-18',201233,8,2012,18,33,201208,2012),('2012-08-19',201234,8,2012,19,34,201208,2012),('2012-08-20',201234,8,2012,20,34,201208,2012),('2012-08-21',201234,8,2012,21,34,201208,2012),('2012-08-22',201234,8,2012,22,34,201208,2012),('2012-08-23',201234,8,2012,23,34,201208,2012),('2012-08-24',201234,8,2012,24,34,201208,2012),('2012-08-25',201234,8,2012,25,34,201208,2012),('2012-08-26',201235,8,2012,26,35,201208,2012),('2012-08-27',201235,8,2012,27,35,201208,2012),('2012-08-28',201235,8,2012,28,35,201208,2012),('2012-08-29',201235,8,2012,29,35,201208,2012),('2012-08-30',201235,8,2012,30,35,201208,2012),('2012-08-31',201235,8,2012,31,35,201208,2012),('2012-09-01',201235,9,2012,1,35,201209,2012),('2012-09-02',201236,9,2012,2,36,201209,2012),('2012-09-03',201236,9,2012,3,36,201209,2012),('2012-09-04',201236,9,2012,4,36,201209,2012),('2012-09-05',201236,9,2012,5,36,201209,2012),('2012-09-06',201236,9,2012,6,36,201209,2012),('2012-09-07',201236,9,2012,7,36,201209,2012),('2012-09-08',201236,9,2012,8,36,201209,2012),('2012-09-09',201237,9,2012,9,37,201209,2012),('2012-09-10',201237,9,2012,10,37,201209,2012),('2012-09-11',201237,9,2012,11,37,201209,2012),('2012-09-12',201237,9,2012,12,37,201209,2012),('2012-09-13',201237,9,2012,13,37,201209,2012),('2012-09-14',201237,9,2012,14,37,201209,2012),('2012-09-15',201237,9,2012,15,37,201209,2012),('2012-09-16',201238,9,2012,16,38,201209,2012),('2012-09-17',201238,9,2012,17,38,201209,2012),('2012-09-18',201238,9,2012,18,38,201209,2012),('2012-09-19',201238,9,2012,19,38,201209,2012),('2012-09-20',201238,9,2012,20,38,201209,2012),('2012-09-21',201238,9,2012,21,38,201209,2012),('2012-09-22',201238,9,2012,22,38,201209,2012),('2012-09-23',201239,9,2012,23,39,201209,2012),('2012-09-24',201239,9,2012,24,39,201209,2012),('2012-09-25',201239,9,2012,25,39,201209,2012),('2012-09-26',201239,9,2012,26,39,201209,2012),('2012-09-27',201239,9,2012,27,39,201209,2012),('2012-09-28',201239,9,2012,28,39,201209,2012),('2012-09-29',201239,9,2012,29,39,201209,2012),('2012-09-30',201240,9,2012,30,40,201209,2012),('2012-10-01',201240,10,2012,1,40,201210,2012),('2012-10-02',201240,10,2012,2,40,201210,2012),('2012-10-03',201240,10,2012,3,40,201210,2012),('2012-10-04',201240,10,2012,4,40,201210,2012),('2012-10-05',201240,10,2012,5,40,201210,2012),('2012-10-06',201240,10,2012,6,40,201210,2012),('2012-10-07',201241,10,2012,7,41,201210,2012),('2012-10-08',201241,10,2012,8,41,201210,2012),('2012-10-09',201241,10,2012,9,41,201210,2012),('2012-10-10',201241,10,2012,10,41,201210,2012),('2012-10-11',201241,10,2012,11,41,201210,2012),('2012-10-12',201241,10,2012,12,41,201210,2012),('2012-10-13',201241,10,2012,13,41,201210,2012),('2012-10-14',201242,10,2012,14,42,201210,2012),('2012-10-15',201242,10,2012,15,42,201210,2012),('2012-10-16',201242,10,2012,16,42,201210,2012),('2012-10-17',201242,10,2012,17,42,201210,2012),('2012-10-18',201242,10,2012,18,42,201210,2012),('2012-10-19',201242,10,2012,19,42,201210,2012),('2012-10-20',201242,10,2012,20,42,201210,2012),('2012-10-21',201243,10,2012,21,43,201210,2012),('2012-10-22',201243,10,2012,22,43,201210,2012),('2012-10-23',201243,10,2012,23,43,201210,2012),('2012-10-24',201243,10,2012,24,43,201210,2012),('2012-10-25',201243,10,2012,25,43,201210,2012),('2012-10-26',201243,10,2012,26,43,201210,2012),('2012-10-27',201243,10,2012,27,43,201210,2012),('2012-10-28',201244,10,2012,28,44,201210,2012),('2012-10-29',201244,10,2012,29,44,201210,2012),('2012-10-30',201244,10,2012,30,44,201210,2012),('2012-10-31',201244,10,2012,31,44,201210,2012),('2012-11-01',201244,11,2012,1,44,201211,2012),('2012-11-02',201244,11,2012,2,44,201211,2012),('2012-11-03',201244,11,2012,3,44,201211,2012),('2012-11-04',201245,11,2012,4,45,201211,2012),('2012-11-05',201245,11,2012,5,45,201211,2012),('2012-11-06',201245,11,2012,6,45,201211,2012),('2012-11-07',201245,11,2012,7,45,201211,2012),('2012-11-08',201245,11,2012,8,45,201211,2012),('2012-11-09',201245,11,2012,9,45,201211,2012),('2012-11-10',201245,11,2012,10,45,201211,2012),('2012-11-11',201246,11,2012,11,46,201211,2012),('2012-11-12',201246,11,2012,12,46,201211,2012),('2012-11-13',201246,11,2012,13,46,201211,2012),('2012-11-14',201246,11,2012,14,46,201211,2012),('2012-11-15',201246,11,2012,15,46,201211,2012),('2012-11-16',201246,11,2012,16,46,201211,2012),('2012-11-17',201246,11,2012,17,46,201211,2012),('2012-11-18',201247,11,2012,18,47,201211,2012),('2012-11-19',201247,11,2012,19,47,201211,2012),('2012-11-20',201247,11,2012,20,47,201211,2012),('2012-11-21',201247,11,2012,21,47,201211,2012),('2012-11-22',201247,11,2012,22,47,201211,2012),('2012-11-23',201247,11,2012,23,47,201211,2012),('2012-11-24',201247,11,2012,24,47,201211,2012),('2012-11-25',201248,11,2012,25,48,201211,2012),('2012-11-26',201248,11,2012,26,48,201211,2012),('2012-11-27',201248,11,2012,27,48,201211,2012),('2012-11-28',201248,11,2012,28,48,201211,2012),('2012-11-29',201248,11,2012,29,48,201211,2012),('2012-11-30',201248,11,2012,30,48,201211,2012),('2012-12-01',201248,12,2012,1,48,201212,2013),('2012-12-02',201249,12,2012,2,49,201212,2013),('2012-12-03',201249,12,2012,3,49,201212,2013),('2012-12-04',201249,12,2012,4,49,201212,2013),('2012-12-05',201249,12,2012,5,49,201212,2013),('2012-12-06',201249,12,2012,6,49,201212,2013),('2012-12-07',201249,12,2012,7,49,201212,2013),('2012-12-08',201249,12,2012,8,49,201212,2013),('2012-12-09',201250,12,2012,9,50,201212,2013),('2012-12-10',201250,12,2012,10,50,201212,2013),('2012-12-11',201250,12,2012,11,50,201212,2013),('2012-12-12',201250,12,2012,12,50,201212,2013),('2012-12-13',201250,12,2012,13,50,201212,2013),('2012-12-14',201250,12,2012,14,50,201212,2013),('2012-12-15',201250,12,2012,15,50,201212,2013),('2012-12-16',201251,12,2012,16,51,201212,2013),('2012-12-17',201251,12,2012,17,51,201212,2013),('2012-12-18',201251,12,2012,18,51,201212,2013),('2012-12-19',201251,12,2012,19,51,201212,2013),('2012-12-20',201251,12,2012,20,51,201212,2013),('2012-12-21',201251,12,2012,21,51,201212,2013),('2012-12-22',201251,12,2012,22,51,201212,2013),('2012-12-23',201252,12,2012,23,52,201212,2013),('2012-12-24',201252,12,2012,24,52,201212,2013),('2012-12-25',201252,12,2012,25,52,201212,2013),('2012-12-26',201252,12,2012,26,52,201212,2013),('2012-12-27',201252,12,2012,27,52,201212,2013),('2012-12-28',201252,12,2012,28,52,201212,2013),('2012-12-29',201252,12,2012,29,52,201212,2013),('2012-12-30',201301,12,2012,30,1,201212,2013),('2012-12-31',201301,12,2012,31,1,201212,2013),('2013-01-01',201301,1,2013,1,1,201301,2013),('2013-01-02',201301,1,2013,2,1,201301,2013),('2013-01-03',201301,1,2013,3,1,201301,2013),('2013-01-04',201301,1,2013,4,1,201301,2013),('2013-01-05',201301,1,2013,5,1,201301,2013),('2013-01-06',201302,1,2013,6,2,201301,2013),('2013-01-07',201302,1,2013,7,2,201301,2013),('2013-01-08',201302,1,2013,8,2,201301,2013),('2013-01-09',201302,1,2013,9,2,201301,2013),('2013-01-10',201302,1,2013,10,2,201301,2013),('2013-01-11',201302,1,2013,11,2,201301,2013),('2013-01-12',201302,1,2013,12,2,201301,2013),('2013-01-13',201303,1,2013,13,3,201301,2013),('2013-01-14',201303,1,2013,14,3,201301,2013),('2013-01-15',201303,1,2013,15,3,201301,2013),('2013-01-16',201303,1,2013,16,3,201301,2013),('2013-01-17',201303,1,2013,17,3,201301,2013),('2013-01-18',201303,1,2013,18,3,201301,2013),('2013-01-19',201303,1,2013,19,3,201301,2013),('2013-01-20',201304,1,2013,20,4,201301,2013),('2013-01-21',201304,1,2013,21,4,201301,2013),('2013-01-22',201304,1,2013,22,4,201301,2013),('2013-01-23',201304,1,2013,23,4,201301,2013),('2013-01-24',201304,1,2013,24,4,201301,2013),('2013-01-25',201304,1,2013,25,4,201301,2013),('2013-01-26',201304,1,2013,26,4,201301,2013),('2013-01-27',201305,1,2013,27,5,201301,2013),('2013-01-28',201305,1,2013,28,5,201301,2013),('2013-01-29',201305,1,2013,29,5,201301,2013),('2013-01-30',201305,1,2013,30,5,201301,2013),('2013-01-31',201305,1,2013,31,5,201301,2013),('2013-02-01',201305,2,2013,1,5,201302,2013),('2013-02-02',201305,2,2013,2,5,201302,2013),('2013-02-03',201306,2,2013,3,6,201302,2013),('2013-02-04',201306,2,2013,4,6,201302,2013),('2013-02-05',201306,2,2013,5,6,201302,2013),('2013-02-06',201306,2,2013,6,6,201302,2013),('2013-02-07',201306,2,2013,7,6,201302,2013),('2013-02-08',201306,2,2013,8,6,201302,2013),('2013-02-09',201306,2,2013,9,6,201302,2013),('2013-02-10',201307,2,2013,10,7,201302,2013),('2013-02-11',201307,2,2013,11,7,201302,2013),('2013-02-12',201307,2,2013,12,7,201302,2013),('2013-02-13',201307,2,2013,13,7,201302,2013),('2013-02-14',201307,2,2013,14,7,201302,2013),('2013-02-15',201307,2,2013,15,7,201302,2013),('2013-02-16',201307,2,2013,16,7,201302,2013),('2013-02-17',201308,2,2013,17,8,201302,2013),('2013-02-18',201308,2,2013,18,8,201302,2013),('2013-02-19',201308,2,2013,19,8,201302,2013),('2013-02-20',201308,2,2013,20,8,201302,2013),('2013-02-21',201308,2,2013,21,8,201302,2013),('2013-02-22',201308,2,2013,22,8,201302,2013),('2013-02-23',201308,2,2013,23,8,201302,2013),('2013-02-24',201309,2,2013,24,9,201302,2013),('2013-02-25',201309,2,2013,25,9,201302,2013),('2013-02-26',201309,2,2013,26,9,201302,2013),('2013-02-27',201309,2,2013,27,9,201302,2013),('2013-02-28',201309,2,2013,28,9,201302,2013),('2013-03-01',201309,3,2013,1,9,201303,2013),('2013-03-02',201309,3,2013,2,9,201303,2013),('2013-03-03',201310,3,2013,3,10,201303,2013),('2013-03-04',201310,3,2013,4,10,201303,2013),('2013-03-05',201310,3,2013,5,10,201303,2013),('2013-03-06',201310,3,2013,6,10,201303,2013),('2013-03-07',201310,3,2013,7,10,201303,2013),('2013-03-08',201310,3,2013,8,10,201303,2013),('2013-03-09',201310,3,2013,9,10,201303,2013),('2013-03-10',201311,3,2013,10,11,201303,2013),('2013-03-11',201311,3,2013,11,11,201303,2013),('2013-03-12',201311,3,2013,12,11,201303,2013),('2013-03-13',201311,3,2013,13,11,201303,2013),('2013-03-14',201311,3,2013,14,11,201303,2013),('2013-03-15',201311,3,2013,15,11,201303,2013),('2013-03-16',201311,3,2013,16,11,201303,2013),('2013-03-17',201312,3,2013,17,12,201303,2013),('2013-03-18',201312,3,2013,18,12,201303,2013),('2013-03-19',201312,3,2013,19,12,201303,2013),('2013-03-20',201312,3,2013,20,12,201303,2013),('2013-03-21',201312,3,2013,21,12,201303,2013),('2013-03-22',201312,3,2013,22,12,201303,2013),('2013-03-23',201312,3,2013,23,12,201303,2013),('2013-03-24',201313,3,2013,24,13,201303,2013),('2013-03-25',201313,3,2013,25,13,201303,2013),('2013-03-26',201313,3,2013,26,13,201303,2013),('2013-03-27',201313,3,2013,27,13,201303,2013),('2013-03-28',201313,3,2013,28,13,201303,2013),('2013-03-29',201313,3,2013,29,13,201303,2013),('2013-03-30',201313,3,2013,30,13,201303,2013),('2013-03-31',201314,3,2013,31,14,201303,2013),('2013-04-01',201314,4,2013,1,14,201304,2013),('2013-04-02',201314,4,2013,2,14,201304,2013),('2013-04-03',201314,4,2013,3,14,201304,2013),('2013-04-04',201314,4,2013,4,14,201304,2013),('2013-04-05',201314,4,2013,5,14,201304,2013),('2013-04-06',201314,4,2013,6,14,201304,2013),('2013-04-07',201315,4,2013,7,15,201304,2013),('2013-04-08',201315,4,2013,8,15,201304,2013),('2013-04-09',201315,4,2013,9,15,201304,2013),('2013-04-10',201315,4,2013,10,15,201304,2013),('2013-04-11',201315,4,2013,11,15,201304,2013),('2013-04-12',201315,4,2013,12,15,201304,2013),('2013-04-13',201315,4,2013,13,15,201304,2013),('2013-04-14',201316,4,2013,14,16,201304,2013),('2013-04-15',201316,4,2013,15,16,201304,2013),('2013-04-16',201316,4,2013,16,16,201304,2013),('2013-04-17',201316,4,2013,17,16,201304,2013),('2013-04-18',201316,4,2013,18,16,201304,2013),('2013-04-19',201316,4,2013,19,16,201304,2013),('2013-04-20',201316,4,2013,20,16,201304,2013),('2013-04-21',201317,4,2013,21,17,201304,2013),('2013-04-22',201317,4,2013,22,17,201304,2013),('2013-04-23',201317,4,2013,23,17,201304,2013),('2013-04-24',201317,4,2013,24,17,201304,2013),('2013-04-25',201317,4,2013,25,17,201304,2013),('2013-04-26',201317,4,2013,26,17,201304,2013),('2013-04-27',201317,4,2013,27,17,201304,2013),('2013-04-28',201318,4,2013,28,18,201304,2013),('2013-04-29',201318,4,2013,29,18,201304,2013),('2013-04-30',201318,4,2013,30,18,201304,2013),('2013-05-01',201318,5,2013,1,18,201305,2013),('2013-05-02',201318,5,2013,2,18,201305,2013),('2013-05-03',201318,5,2013,3,18,201305,2013),('2013-05-04',201318,5,2013,4,18,201305,2013),('2013-05-05',201319,5,2013,5,19,201305,2013),('2013-05-06',201319,5,2013,6,19,201305,2013),('2013-05-07',201319,5,2013,7,19,201305,2013),('2013-05-08',201319,5,2013,8,19,201305,2013),('2013-05-09',201319,5,2013,9,19,201305,2013),('2013-05-10',201319,5,2013,10,19,201305,2013),('2013-05-11',201319,5,2013,11,19,201305,2013),('2013-05-12',201320,5,2013,12,20,201305,2013),('2013-05-13',201320,5,2013,13,20,201305,2013),('2013-05-14',201320,5,2013,14,20,201305,2013),('2013-05-15',201320,5,2013,15,20,201305,2013),('2013-05-16',201320,5,2013,16,20,201305,2013),('2013-05-17',201320,5,2013,17,20,201305,2013),('2013-05-18',201320,5,2013,18,20,201305,2013),('2013-05-19',201321,5,2013,19,21,201305,2013),('2013-05-20',201321,5,2013,20,21,201305,2013),('2013-05-21',201321,5,2013,21,21,201305,2013),('2013-05-22',201321,5,2013,22,21,201305,2013),('2013-05-23',201321,5,2013,23,21,201305,2013),('2013-05-24',201321,5,2013,24,21,201305,2013),('2013-05-25',201321,5,2013,25,21,201305,2013),('2013-05-26',201322,5,2013,26,22,201305,2013),('2013-05-27',201322,5,2013,27,22,201305,2013),('2013-05-28',201322,5,2013,28,22,201305,2013),('2013-05-29',201322,5,2013,29,22,201305,2013),('2013-05-30',201322,5,2013,30,22,201305,2013),('2013-05-31',201322,5,2013,31,22,201305,2013),('2013-06-01',201322,6,2013,1,22,201306,2013),('2013-06-02',201323,6,2013,2,23,201306,2013),('2013-06-03',201323,6,2013,3,23,201306,2013),('2013-06-04',201323,6,2013,4,23,201306,2013),('2013-06-05',201323,6,2013,5,23,201306,2013),('2013-06-06',201323,6,2013,6,23,201306,2013),('2013-06-07',201323,6,2013,7,23,201306,2013),('2013-06-08',201323,6,2013,8,23,201306,2013),('2013-06-09',201324,6,2013,9,24,201306,2013),('2013-06-10',201324,6,2013,10,24,201306,2013),('2013-06-11',201324,6,2013,11,24,201306,2013),('2013-06-12',201324,6,2013,12,24,201306,2013),('2013-06-13',201324,6,2013,13,24,201306,2013),('2013-06-14',201324,6,2013,14,24,201306,2013),('2013-06-15',201324,6,2013,15,24,201306,2013),('2013-06-16',201325,6,2013,16,25,201306,2013),('2013-06-17',201325,6,2013,17,25,201306,2013),('2013-06-18',201325,6,2013,18,25,201306,2013),('2013-06-19',201325,6,2013,19,25,201306,2013),('2013-06-20',201325,6,2013,20,25,201306,2013),('2013-06-21',201325,6,2013,21,25,201306,2013),('2013-06-22',201325,6,2013,22,25,201306,2013),('2013-06-23',201326,6,2013,23,26,201306,2013),('2013-06-24',201326,6,2013,24,26,201306,2013),('2013-06-25',201326,6,2013,25,26,201306,2013),('2013-06-26',201326,6,2013,26,26,201306,2013),('2013-06-27',201326,6,2013,27,26,201306,2013),('2013-06-28',201326,6,2013,28,26,201306,2013),('2013-06-29',201326,6,2013,29,26,201306,2013),('2013-06-30',201327,6,2013,30,27,201306,2013),('2013-07-01',201327,7,2013,1,27,201307,2013),('2013-07-02',201327,7,2013,2,27,201307,2013),('2013-07-03',201327,7,2013,3,27,201307,2013),('2013-07-04',201327,7,2013,4,27,201307,2013),('2013-07-05',201327,7,2013,5,27,201307,2013),('2013-07-06',201327,7,2013,6,27,201307,2013),('2013-07-07',201328,7,2013,7,28,201307,2013),('2013-07-08',201328,7,2013,8,28,201307,2013),('2013-07-09',201328,7,2013,9,28,201307,2013),('2013-07-10',201328,7,2013,10,28,201307,2013),('2013-07-11',201328,7,2013,11,28,201307,2013),('2013-07-12',201328,7,2013,12,28,201307,2013),('2013-07-13',201328,7,2013,13,28,201307,2013),('2013-07-14',201329,7,2013,14,29,201307,2013),('2013-07-15',201329,7,2013,15,29,201307,2013),('2013-07-16',201329,7,2013,16,29,201307,2013),('2013-07-17',201329,7,2013,17,29,201307,2013),('2013-07-18',201329,7,2013,18,29,201307,2013),('2013-07-19',201329,7,2013,19,29,201307,2013),('2013-07-20',201329,7,2013,20,29,201307,2013),('2013-07-21',201330,7,2013,21,30,201307,2013),('2013-07-22',201330,7,2013,22,30,201307,2013),('2013-07-23',201330,7,2013,23,30,201307,2013),('2013-07-24',201330,7,2013,24,30,201307,2013),('2013-07-25',201330,7,2013,25,30,201307,2013),('2013-07-26',201330,7,2013,26,30,201307,2013),('2013-07-27',201330,7,2013,27,30,201307,2013),('2013-07-28',201331,7,2013,28,31,201307,2013),('2013-07-29',201331,7,2013,29,31,201307,2013),('2013-07-30',201331,7,2013,30,31,201307,2013),('2013-07-31',201331,7,2013,31,31,201307,2013),('2013-08-01',201331,8,2013,1,31,201308,2013),('2013-08-02',201331,8,2013,2,31,201308,2013),('2013-08-03',201331,8,2013,3,31,201308,2013),('2013-08-04',201332,8,2013,4,32,201308,2013),('2013-08-05',201332,8,2013,5,32,201308,2013),('2013-08-06',201332,8,2013,6,32,201308,2013),('2013-08-07',201332,8,2013,7,32,201308,2013),('2013-08-08',201332,8,2013,8,32,201308,2013),('2013-08-09',201332,8,2013,9,32,201308,2013),('2013-08-10',201332,8,2013,10,32,201308,2013),('2013-08-11',201333,8,2013,11,33,201308,2013),('2013-08-12',201333,8,2013,12,33,201308,2013),('2013-08-13',201333,8,2013,13,33,201308,2013),('2013-08-14',201333,8,2013,14,33,201308,2013),('2013-08-15',201333,8,2013,15,33,201308,2013),('2013-08-16',201333,8,2013,16,33,201308,2013),('2013-08-17',201333,8,2013,17,33,201308,2013),('2013-08-18',201334,8,2013,18,34,201308,2013),('2013-08-19',201334,8,2013,19,34,201308,2013),('2013-08-20',201334,8,2013,20,34,201308,2013),('2013-08-21',201334,8,2013,21,34,201308,2013),('2013-08-22',201334,8,2013,22,34,201308,2013),('2013-08-23',201334,8,2013,23,34,201308,2013),('2013-08-24',201334,8,2013,24,34,201308,2013),('2013-08-25',201335,8,2013,25,35,201308,2013),('2013-08-26',201335,8,2013,26,35,201308,2013),('2013-08-27',201335,8,2013,27,35,201308,2013),('2013-08-28',201335,8,2013,28,35,201308,2013),('2013-08-29',201335,8,2013,29,35,201308,2013),('2013-08-30',201335,8,2013,30,35,201308,2013),('2013-08-31',201335,8,2013,31,35,201308,2013),('2013-09-01',201336,9,2013,1,36,201309,2013),('2013-09-02',201336,9,2013,2,36,201309,2013),('2013-09-03',201336,9,2013,3,36,201309,2013),('2013-09-04',201336,9,2013,4,36,201309,2013),('2013-09-05',201336,9,2013,5,36,201309,2013),('2013-09-06',201336,9,2013,6,36,201309,2013),('2013-09-07',201336,9,2013,7,36,201309,2013),('2013-09-08',201337,9,2013,8,37,201309,2013),('2013-09-09',201337,9,2013,9,37,201309,2013),('2013-09-10',201337,9,2013,10,37,201309,2013),('2013-09-11',201337,9,2013,11,37,201309,2013),('2013-09-12',201337,9,2013,12,37,201309,2013),('2013-09-13',201337,9,2013,13,37,201309,2013),('2013-09-14',201337,9,2013,14,37,201309,2013),('2013-09-15',201338,9,2013,15,38,201309,2013),('2013-09-16',201338,9,2013,16,38,201309,2013),('2013-09-17',201338,9,2013,17,38,201309,2013),('2013-09-18',201338,9,2013,18,38,201309,2013),('2013-09-19',201338,9,2013,19,38,201309,2013),('2013-09-20',201338,9,2013,20,38,201309,2013),('2013-09-21',201338,9,2013,21,38,201309,2013),('2013-09-22',201339,9,2013,22,39,201309,2013),('2013-09-23',201339,9,2013,23,39,201309,2013),('2013-09-24',201339,9,2013,24,39,201309,2013),('2013-09-25',201339,9,2013,25,39,201309,2013),('2013-09-26',201339,9,2013,26,39,201309,2013),('2013-09-27',201339,9,2013,27,39,201309,2013),('2013-09-28',201339,9,2013,28,39,201309,2013),('2013-09-29',201340,9,2013,29,40,201309,2013),('2013-09-30',201340,9,2013,30,40,201309,2013),('2013-10-01',201340,10,2013,1,40,201310,2013),('2013-10-02',201340,10,2013,2,40,201310,2013),('2013-10-03',201340,10,2013,3,40,201310,2013),('2013-10-04',201340,10,2013,4,40,201310,2013),('2013-10-05',201340,10,2013,5,40,201310,2013),('2013-10-06',201341,10,2013,6,41,201310,2013),('2013-10-07',201341,10,2013,7,41,201310,2013),('2013-10-08',201341,10,2013,8,41,201310,2013),('2013-10-09',201341,10,2013,9,41,201310,2013),('2013-10-10',201341,10,2013,10,41,201310,2013),('2013-10-11',201341,10,2013,11,41,201310,2013),('2013-10-12',201341,10,2013,12,41,201310,2013),('2013-10-13',201342,10,2013,13,42,201310,2013),('2013-10-14',201342,10,2013,14,42,201310,2013),('2013-10-15',201342,10,2013,15,42,201310,2013),('2013-10-16',201342,10,2013,16,42,201310,2013),('2013-10-17',201342,10,2013,17,42,201310,2013),('2013-10-18',201342,10,2013,18,42,201310,2013),('2013-10-19',201342,10,2013,19,42,201310,2013),('2013-10-20',201343,10,2013,20,43,201310,2013),('2013-10-21',201343,10,2013,21,43,201310,2013),('2013-10-22',201343,10,2013,22,43,201310,2013),('2013-10-23',201343,10,2013,23,43,201310,2013),('2013-10-24',201343,10,2013,24,43,201310,2013),('2013-10-25',201343,10,2013,25,43,201310,2013),('2013-10-26',201343,10,2013,26,43,201310,2013),('2013-10-27',201344,10,2013,27,44,201310,2013),('2013-10-28',201344,10,2013,28,44,201310,2013),('2013-10-29',201344,10,2013,29,44,201310,2013),('2013-10-30',201344,10,2013,30,44,201310,2013),('2013-10-31',201344,10,2013,31,44,201310,2013),('2013-11-01',201344,11,2013,1,44,201311,2013),('2013-11-02',201344,11,2013,2,44,201311,2013),('2013-11-03',201345,11,2013,3,45,201311,2013),('2013-11-04',201345,11,2013,4,45,201311,2013),('2013-11-05',201345,11,2013,5,45,201311,2013),('2013-11-06',201345,11,2013,6,45,201311,2013),('2013-11-07',201345,11,2013,7,45,201311,2013),('2013-11-08',201345,11,2013,8,45,201311,2013),('2013-11-09',201345,11,2013,9,45,201311,2013),('2013-11-10',201346,11,2013,10,46,201311,2013),('2013-11-11',201346,11,2013,11,46,201311,2013),('2013-11-12',201346,11,2013,12,46,201311,2013),('2013-11-13',201346,11,2013,13,46,201311,2013),('2013-11-14',201346,11,2013,14,46,201311,2013),('2013-11-15',201346,11,2013,15,46,201311,2013),('2013-11-16',201346,11,2013,16,46,201311,2013),('2013-11-17',201347,11,2013,17,47,201311,2013),('2013-11-18',201347,11,2013,18,47,201311,2013),('2013-11-19',201347,11,2013,19,47,201311,2013),('2013-11-20',201347,11,2013,20,47,201311,2013),('2013-11-21',201347,11,2013,21,47,201311,2013),('2013-11-22',201347,11,2013,22,47,201311,2013),('2013-11-23',201347,11,2013,23,47,201311,2013),('2013-11-24',201348,11,2013,24,48,201311,2013),('2013-11-25',201348,11,2013,25,48,201311,2013),('2013-11-26',201348,11,2013,26,48,201311,2013),('2013-11-27',201348,11,2013,27,48,201311,2013),('2013-11-28',201348,11,2013,28,48,201311,2013),('2013-11-29',201348,11,2013,29,48,201311,2013),('2013-11-30',201348,11,2013,30,48,201311,2013),('2013-12-01',201349,12,2013,1,49,201312,2014),('2013-12-02',201349,12,2013,2,49,201312,2014),('2013-12-03',201349,12,2013,3,49,201312,2014),('2013-12-04',201349,12,2013,4,49,201312,2014),('2013-12-05',201349,12,2013,5,49,201312,2014),('2013-12-06',201349,12,2013,6,49,201312,2014),('2013-12-07',201349,12,2013,7,49,201312,2014),('2013-12-08',201350,12,2013,8,50,201312,2014),('2013-12-09',201350,12,2013,9,50,201312,2014),('2013-12-10',201350,12,2013,10,50,201312,2014),('2013-12-11',201350,12,2013,11,50,201312,2014),('2013-12-12',201350,12,2013,12,50,201312,2014),('2013-12-13',201350,12,2013,13,50,201312,2014),('2013-12-14',201350,12,2013,14,50,201312,2014),('2013-12-15',201351,12,2013,15,51,201312,2014),('2013-12-16',201351,12,2013,16,51,201312,2014),('2013-12-17',201351,12,2013,17,51,201312,2014),('2013-12-18',201351,12,2013,18,51,201312,2014),('2013-12-19',201351,12,2013,19,51,201312,2014),('2013-12-20',201351,12,2013,20,51,201312,2014),('2013-12-21',201351,12,2013,21,51,201312,2014),('2013-12-22',201352,12,2013,22,52,201312,2014),('2013-12-23',201352,12,2013,23,52,201312,2014),('2013-12-24',201352,12,2013,24,52,201312,2014),('2013-12-25',201352,12,2013,25,52,201312,2014),('2013-12-26',201352,12,2013,26,52,201312,2014),('2013-12-27',201352,12,2013,27,52,201312,2014),('2013-12-28',201352,12,2013,28,52,201312,2014),('2013-12-29',201401,12,2013,29,1,201312,2014),('2013-12-30',201401,12,2013,30,1,201312,2014),('2013-12-31',201401,12,2013,31,1,201312,2014),('2014-01-01',201401,1,2014,1,1,201401,2014),('2014-01-02',201401,1,2014,2,1,201401,2014),('2014-01-03',201401,1,2014,3,1,201401,2014),('2014-01-04',201401,1,2014,4,1,201401,2014),('2014-01-05',201402,1,2014,5,2,201401,2014),('2014-01-06',201402,1,2014,6,2,201401,2014),('2014-01-07',201402,1,2014,7,2,201401,2014),('2014-01-08',201402,1,2014,8,2,201401,2014),('2014-01-09',201402,1,2014,9,2,201401,2014),('2014-01-10',201402,1,2014,10,2,201401,2014),('2014-01-11',201402,1,2014,11,2,201401,2014),('2014-01-12',201403,1,2014,12,3,201401,2014),('2014-01-13',201403,1,2014,13,3,201401,2014),('2014-01-14',201403,1,2014,14,3,201401,2014),('2014-01-15',201403,1,2014,15,3,201401,2014),('2014-01-16',201403,1,2014,16,3,201401,2014),('2014-01-17',201403,1,2014,17,3,201401,2014),('2014-01-18',201403,1,2014,18,3,201401,2014),('2014-01-19',201404,1,2014,19,4,201401,2014),('2014-01-20',201404,1,2014,20,4,201401,2014),('2014-01-21',201404,1,2014,21,4,201401,2014),('2014-01-22',201404,1,2014,22,4,201401,2014),('2014-01-23',201404,1,2014,23,4,201401,2014),('2014-01-24',201404,1,2014,24,4,201401,2014),('2014-01-25',201404,1,2014,25,4,201401,2014),('2014-01-26',201405,1,2014,26,5,201401,2014),('2014-01-27',201405,1,2014,27,5,201401,2014),('2014-01-28',201405,1,2014,28,5,201401,2014),('2014-01-29',201405,1,2014,29,5,201401,2014),('2014-01-30',201405,1,2014,30,5,201401,2014),('2014-01-31',201405,1,2014,31,5,201401,2014),('2014-02-01',201405,2,2014,1,5,201402,2014),('2014-02-02',201406,2,2014,2,6,201402,2014),('2014-02-03',201406,2,2014,3,6,201402,2014),('2014-02-04',201406,2,2014,4,6,201402,2014),('2014-02-05',201406,2,2014,5,6,201402,2014),('2014-02-06',201406,2,2014,6,6,201402,2014),('2014-02-07',201406,2,2014,7,6,201402,2014),('2014-02-08',201406,2,2014,8,6,201402,2014),('2014-02-09',201407,2,2014,9,7,201402,2014),('2014-02-10',201407,2,2014,10,7,201402,2014),('2014-02-11',201407,2,2014,11,7,201402,2014),('2014-02-12',201407,2,2014,12,7,201402,2014),('2014-02-13',201407,2,2014,13,7,201402,2014),('2014-02-14',201407,2,2014,14,7,201402,2014),('2014-02-15',201407,2,2014,15,7,201402,2014),('2014-02-16',201408,2,2014,16,8,201402,2014),('2014-02-17',201408,2,2014,17,8,201402,2014),('2014-02-18',201408,2,2014,18,8,201402,2014),('2014-02-19',201408,2,2014,19,8,201402,2014),('2014-02-20',201408,2,2014,20,8,201402,2014),('2014-02-21',201408,2,2014,21,8,201402,2014),('2014-02-22',201408,2,2014,22,8,201402,2014),('2014-02-23',201409,2,2014,23,9,201402,2014),('2014-02-24',201409,2,2014,24,9,201402,2014),('2014-02-25',201409,2,2014,25,9,201402,2014),('2014-02-26',201409,2,2014,26,9,201402,2014),('2014-02-27',201409,2,2014,27,9,201402,2014),('2014-02-28',201409,2,2014,28,9,201402,2014),('2014-03-01',201409,3,2014,1,9,201403,2014),('2014-03-02',201410,3,2014,2,10,201403,2014),('2014-03-03',201410,3,2014,3,10,201403,2014),('2014-03-04',201410,3,2014,4,10,201403,2014),('2014-03-05',201410,3,2014,5,10,201403,2014),('2014-03-06',201410,3,2014,6,10,201403,2014),('2014-03-07',201410,3,2014,7,10,201403,2014),('2014-03-08',201410,3,2014,8,10,201403,2014),('2014-03-09',201411,3,2014,9,11,201403,2014),('2014-03-10',201411,3,2014,10,11,201403,2014),('2014-03-11',201411,3,2014,11,11,201403,2014),('2014-03-12',201411,3,2014,12,11,201403,2014),('2014-03-13',201411,3,2014,13,11,201403,2014),('2014-03-14',201411,3,2014,14,11,201403,2014),('2014-03-15',201411,3,2014,15,11,201403,2014),('2014-03-16',201412,3,2014,16,12,201403,2014),('2014-03-17',201412,3,2014,17,12,201403,2014),('2014-03-18',201412,3,2014,18,12,201403,2014),('2014-03-19',201412,3,2014,19,12,201403,2014),('2014-03-20',201412,3,2014,20,12,201403,2014),('2014-03-21',201412,3,2014,21,12,201403,2014),('2014-03-22',201412,3,2014,22,12,201403,2014),('2014-03-23',201413,3,2014,23,13,201403,2014),('2014-03-24',201413,3,2014,24,13,201403,2014),('2014-03-25',201413,3,2014,25,13,201403,2014),('2014-03-26',201413,3,2014,26,13,201403,2014),('2014-03-27',201413,3,2014,27,13,201403,2014),('2014-03-28',201413,3,2014,28,13,201403,2014),('2014-03-29',201413,3,2014,29,13,201403,2014),('2014-03-30',201414,3,2014,30,14,201403,2014),('2014-03-31',201414,3,2014,31,14,201403,2014),('2014-04-01',201414,4,2014,1,14,201404,2014),('2014-04-02',201414,4,2014,2,14,201404,2014),('2014-04-03',201414,4,2014,3,14,201404,2014),('2014-04-04',201414,4,2014,4,14,201404,2014),('2014-04-05',201414,4,2014,5,14,201404,2014),('2014-04-06',201415,4,2014,6,15,201404,2014),('2014-04-07',201415,4,2014,7,15,201404,2014),('2014-04-08',201415,4,2014,8,15,201404,2014),('2014-04-09',201415,4,2014,9,15,201404,2014),('2014-04-10',201415,4,2014,10,15,201404,2014),('2014-04-11',201415,4,2014,11,15,201404,2014),('2014-04-12',201415,4,2014,12,15,201404,2014),('2014-04-13',201416,4,2014,13,16,201404,2014),('2014-04-14',201416,4,2014,14,16,201404,2014),('2014-04-15',201416,4,2014,15,16,201404,2014),('2014-04-16',201416,4,2014,16,16,201404,2014),('2014-04-17',201416,4,2014,17,16,201404,2014),('2014-04-18',201416,4,2014,18,16,201404,2014),('2014-04-19',201416,4,2014,19,16,201404,2014),('2014-04-20',201417,4,2014,20,17,201404,2014),('2014-04-21',201417,4,2014,21,17,201404,2014),('2014-04-22',201417,4,2014,22,17,201404,2014),('2014-04-23',201417,4,2014,23,17,201404,2014),('2014-04-24',201417,4,2014,24,17,201404,2014),('2014-04-25',201417,4,2014,25,17,201404,2014),('2014-04-26',201417,4,2014,26,17,201404,2014),('2014-04-27',201418,4,2014,27,18,201404,2014),('2014-04-28',201418,4,2014,28,18,201404,2014),('2014-04-29',201418,4,2014,29,18,201404,2014),('2014-04-30',201418,4,2014,30,18,201404,2014),('2014-05-01',201418,5,2014,1,18,201405,2014),('2014-05-02',201418,5,2014,2,18,201405,2014),('2014-05-03',201418,5,2014,3,18,201405,2014),('2014-05-04',201419,5,2014,4,19,201405,2014),('2014-05-05',201419,5,2014,5,19,201405,2014),('2014-05-06',201419,5,2014,6,19,201405,2014),('2014-05-07',201419,5,2014,7,19,201405,2014),('2014-05-08',201419,5,2014,8,19,201405,2014),('2014-05-09',201419,5,2014,9,19,201405,2014),('2014-05-10',201419,5,2014,10,19,201405,2014),('2014-05-11',201420,5,2014,11,20,201405,2014),('2014-05-12',201420,5,2014,12,20,201405,2014),('2014-05-13',201420,5,2014,13,20,201405,2014),('2014-05-14',201420,5,2014,14,20,201405,2014),('2014-05-15',201420,5,2014,15,20,201405,2014),('2014-05-16',201420,5,2014,16,20,201405,2014),('2014-05-17',201420,5,2014,17,20,201405,2014),('2014-05-18',201421,5,2014,18,21,201405,2014),('2014-05-19',201421,5,2014,19,21,201405,2014),('2014-05-20',201421,5,2014,20,21,201405,2014),('2014-05-21',201421,5,2014,21,21,201405,2014),('2014-05-22',201421,5,2014,22,21,201405,2014),('2014-05-23',201421,5,2014,23,21,201405,2014),('2014-05-24',201421,5,2014,24,21,201405,2014),('2014-05-25',201422,5,2014,25,22,201405,2014),('2014-05-26',201422,5,2014,26,22,201405,2014),('2014-05-27',201422,5,2014,27,22,201405,2014),('2014-05-28',201422,5,2014,28,22,201405,2014),('2014-05-29',201422,5,2014,29,22,201405,2014),('2014-05-30',201422,5,2014,30,22,201405,2014),('2014-05-31',201422,5,2014,31,22,201405,2014),('2014-06-01',201423,6,2014,1,23,201406,2014),('2014-06-02',201423,6,2014,2,23,201406,2014),('2014-06-03',201423,6,2014,3,23,201406,2014),('2014-06-04',201423,6,2014,4,23,201406,2014),('2014-06-05',201423,6,2014,5,23,201406,2014),('2014-06-06',201423,6,2014,6,23,201406,2014),('2014-06-07',201423,6,2014,7,23,201406,2014),('2014-06-08',201424,6,2014,8,24,201406,2014),('2014-06-09',201424,6,2014,9,24,201406,2014),('2014-06-10',201424,6,2014,10,24,201406,2014),('2014-06-11',201424,6,2014,11,24,201406,2014),('2014-06-12',201424,6,2014,12,24,201406,2014),('2014-06-13',201424,6,2014,13,24,201406,2014),('2014-06-14',201424,6,2014,14,24,201406,2014),('2014-06-15',201425,6,2014,15,25,201406,2014),('2014-06-16',201425,6,2014,16,25,201406,2014),('2014-06-17',201425,6,2014,17,25,201406,2014),('2014-06-18',201425,6,2014,18,25,201406,2014),('2014-06-19',201425,6,2014,19,25,201406,2014),('2014-06-20',201425,6,2014,20,25,201406,2014),('2014-06-21',201425,6,2014,21,25,201406,2014),('2014-06-22',201426,6,2014,22,26,201406,2014),('2014-06-23',201426,6,2014,23,26,201406,2014),('2014-06-24',201426,6,2014,24,26,201406,2014),('2014-06-25',201426,6,2014,25,26,201406,2014),('2014-06-26',201426,6,2014,26,26,201406,2014),('2014-06-27',201426,6,2014,27,26,201406,2014),('2014-06-28',201426,6,2014,28,26,201406,2014),('2014-06-29',201427,6,2014,29,27,201406,2014),('2014-06-30',201427,6,2014,30,27,201406,2014),('2014-07-01',201427,7,2014,1,27,201407,2014),('2014-07-02',201427,7,2014,2,27,201407,2014),('2014-07-03',201427,7,2014,3,27,201407,2014),('2014-07-04',201427,7,2014,4,27,201407,2014),('2014-07-05',201427,7,2014,5,27,201407,2014),('2014-07-06',201428,7,2014,6,28,201407,2014),('2014-07-07',201428,7,2014,7,28,201407,2014),('2014-07-08',201428,7,2014,8,28,201407,2014),('2014-07-09',201428,7,2014,9,28,201407,2014),('2014-07-10',201428,7,2014,10,28,201407,2014),('2014-07-11',201428,7,2014,11,28,201407,2014),('2014-07-12',201428,7,2014,12,28,201407,2014),('2014-07-13',201429,7,2014,13,29,201407,2014),('2014-07-14',201429,7,2014,14,29,201407,2014),('2014-07-15',201429,7,2014,15,29,201407,2014),('2014-07-16',201429,7,2014,16,29,201407,2014),('2014-07-17',201429,7,2014,17,29,201407,2014),('2014-07-18',201429,7,2014,18,29,201407,2014),('2014-07-19',201429,7,2014,19,29,201407,2014),('2014-07-20',201430,7,2014,20,30,201407,2014),('2014-07-21',201430,7,2014,21,30,201407,2014),('2014-07-22',201430,7,2014,22,30,201407,2014),('2014-07-23',201430,7,2014,23,30,201407,2014),('2014-07-24',201430,7,2014,24,30,201407,2014),('2014-07-25',201430,7,2014,25,30,201407,2014),('2014-07-26',201430,7,2014,26,30,201407,2014),('2014-07-27',201431,7,2014,27,31,201407,2014),('2014-07-28',201431,7,2014,28,31,201407,2014),('2014-07-29',201431,7,2014,29,31,201407,2014),('2014-07-30',201431,7,2014,30,31,201407,2014),('2014-07-31',201431,7,2014,31,31,201407,2014),('2014-08-01',201431,8,2014,1,31,201408,2014),('2014-08-02',201431,8,2014,2,31,201408,2014),('2014-08-03',201432,8,2014,3,32,201408,2014),('2014-08-04',201432,8,2014,4,32,201408,2014),('2014-08-05',201432,8,2014,5,32,201408,2014),('2014-08-06',201432,8,2014,6,32,201408,2014),('2014-08-07',201432,8,2014,7,32,201408,2014),('2014-08-08',201432,8,2014,8,32,201408,2014),('2014-08-09',201432,8,2014,9,32,201408,2014),('2014-08-10',201433,8,2014,10,33,201408,2014),('2014-08-11',201433,8,2014,11,33,201408,2014),('2014-08-12',201433,8,2014,12,33,201408,2014),('2014-08-13',201433,8,2014,13,33,201408,2014),('2014-08-14',201433,8,2014,14,33,201408,2014),('2014-08-15',201433,8,2014,15,33,201408,2014),('2014-08-16',201433,8,2014,16,33,201408,2014),('2014-08-17',201434,8,2014,17,34,201408,2014),('2014-08-18',201434,8,2014,18,34,201408,2014),('2014-08-19',201434,8,2014,19,34,201408,2014),('2014-08-20',201434,8,2014,20,34,201408,2014),('2014-08-21',201434,8,2014,21,34,201408,2014),('2014-08-22',201434,8,2014,22,34,201408,2014),('2014-08-23',201434,8,2014,23,34,201408,2014),('2014-08-24',201435,8,2014,24,35,201408,2014),('2014-08-25',201435,8,2014,25,35,201408,2014),('2014-08-26',201435,8,2014,26,35,201408,2014),('2014-08-27',201435,8,2014,27,35,201408,2014),('2014-08-28',201435,8,2014,28,35,201408,2014),('2014-08-29',201435,8,2014,29,35,201408,2014),('2014-08-30',201435,8,2014,30,35,201408,2014),('2014-08-31',201436,8,2014,31,36,201408,2014),('2014-09-01',201436,9,2014,1,36,201409,2014),('2014-09-02',201436,9,2014,2,36,201409,2014),('2014-09-03',201436,9,2014,3,36,201409,2014),('2014-09-04',201436,9,2014,4,36,201409,2014),('2014-09-05',201436,9,2014,5,36,201409,2014),('2014-09-06',201436,9,2014,6,36,201409,2014),('2014-09-07',201437,9,2014,7,37,201409,2014),('2014-09-08',201437,9,2014,8,37,201409,2014),('2014-09-09',201437,9,2014,9,37,201409,2014),('2014-09-10',201437,9,2014,10,37,201409,2014),('2014-09-11',201437,9,2014,11,37,201409,2014),('2014-09-12',201437,9,2014,12,37,201409,2014),('2014-09-13',201437,9,2014,13,37,201409,2014),('2014-09-14',201438,9,2014,14,38,201409,2014),('2014-09-15',201438,9,2014,15,38,201409,2014),('2014-09-16',201438,9,2014,16,38,201409,2014),('2014-09-17',201438,9,2014,17,38,201409,2014),('2014-09-18',201438,9,2014,18,38,201409,2014),('2014-09-19',201438,9,2014,19,38,201409,2014),('2014-09-20',201438,9,2014,20,38,201409,2014),('2014-09-21',201439,9,2014,21,39,201409,2014),('2014-09-22',201439,9,2014,22,39,201409,2014),('2014-09-23',201439,9,2014,23,39,201409,2014),('2014-09-24',201439,9,2014,24,39,201409,2014),('2014-09-25',201439,9,2014,25,39,201409,2014),('2014-09-26',201439,9,2014,26,39,201409,2014),('2014-09-27',201439,9,2014,27,39,201409,2014),('2014-09-28',201440,9,2014,28,40,201409,2014),('2014-09-29',201440,9,2014,29,40,201409,2014),('2014-09-30',201440,9,2014,30,40,201409,2014),('2014-10-01',201440,10,2014,1,40,201410,2014),('2014-10-02',201440,10,2014,2,40,201410,2014),('2014-10-03',201440,10,2014,3,40,201410,2014),('2014-10-04',201440,10,2014,4,40,201410,2014),('2014-10-05',201441,10,2014,5,41,201410,2014),('2014-10-06',201441,10,2014,6,41,201410,2014),('2014-10-07',201441,10,2014,7,41,201410,2014),('2014-10-08',201441,10,2014,8,41,201410,2014),('2014-10-09',201441,10,2014,9,41,201410,2014),('2014-10-10',201441,10,2014,10,41,201410,2014),('2014-10-11',201441,10,2014,11,41,201410,2014),('2014-10-12',201442,10,2014,12,42,201410,2014),('2014-10-13',201442,10,2014,13,42,201410,2014),('2014-10-14',201442,10,2014,14,42,201410,2014),('2014-10-15',201442,10,2014,15,42,201410,2014),('2014-10-16',201442,10,2014,16,42,201410,2014),('2014-10-17',201442,10,2014,17,42,201410,2014),('2014-10-18',201442,10,2014,18,42,201410,2014),('2014-10-19',201443,10,2014,19,43,201410,2014),('2014-10-20',201443,10,2014,20,43,201410,2014),('2014-10-21',201443,10,2014,21,43,201410,2014),('2014-10-22',201443,10,2014,22,43,201410,2014),('2014-10-23',201443,10,2014,23,43,201410,2014),('2014-10-24',201443,10,2014,24,43,201410,2014),('2014-10-25',201443,10,2014,25,43,201410,2014),('2014-10-26',201444,10,2014,26,44,201410,2014),('2014-10-27',201444,10,2014,27,44,201410,2014),('2014-10-28',201444,10,2014,28,44,201410,2014),('2014-10-29',201444,10,2014,29,44,201410,2014),('2014-10-30',201444,10,2014,30,44,201410,2014),('2014-10-31',201444,10,2014,31,44,201410,2014),('2014-11-01',201444,11,2014,1,44,201411,2014),('2014-11-02',201445,11,2014,2,45,201411,2014),('2014-11-03',201445,11,2014,3,45,201411,2014),('2014-11-04',201445,11,2014,4,45,201411,2014),('2014-11-05',201445,11,2014,5,45,201411,2014),('2014-11-06',201445,11,2014,6,45,201411,2014),('2014-11-07',201445,11,2014,7,45,201411,2014),('2014-11-08',201445,11,2014,8,45,201411,2014),('2014-11-09',201446,11,2014,9,46,201411,2014),('2014-11-10',201446,11,2014,10,46,201411,2014),('2014-11-11',201446,11,2014,11,46,201411,2014),('2014-11-12',201446,11,2014,12,46,201411,2014),('2014-11-13',201446,11,2014,13,46,201411,2014),('2014-11-14',201446,11,2014,14,46,201411,2014),('2014-11-15',201446,11,2014,15,46,201411,2014),('2014-11-16',201447,11,2014,16,47,201411,2014),('2014-11-17',201447,11,2014,17,47,201411,2014),('2014-11-18',201447,11,2014,18,47,201411,2014),('2014-11-19',201447,11,2014,19,47,201411,2014),('2014-11-20',201447,11,2014,20,47,201411,2014),('2014-11-21',201447,11,2014,21,47,201411,2014),('2014-11-22',201447,11,2014,22,47,201411,2014),('2014-11-23',201448,11,2014,23,48,201411,2014),('2014-11-24',201448,11,2014,24,48,201411,2014),('2014-11-25',201448,11,2014,25,48,201411,2014),('2014-11-26',201448,11,2014,26,48,201411,2014),('2014-11-27',201448,11,2014,27,48,201411,2014),('2014-11-28',201448,11,2014,28,48,201411,2014),('2014-11-29',201448,11,2014,29,48,201411,2014),('2014-11-30',201449,11,2014,30,49,201411,2014),('2014-12-01',201449,12,2014,1,49,201412,2015),('2014-12-02',201449,12,2014,2,49,201412,2015),('2014-12-03',201449,12,2014,3,49,201412,2015),('2014-12-04',201449,12,2014,4,49,201412,2015),('2014-12-05',201449,12,2014,5,49,201412,2015),('2014-12-06',201449,12,2014,6,49,201412,2015),('2014-12-07',201450,12,2014,7,50,201412,2015),('2014-12-08',201450,12,2014,8,50,201412,2015),('2014-12-09',201450,12,2014,9,50,201412,2015),('2014-12-10',201450,12,2014,10,50,201412,2015),('2014-12-11',201450,12,2014,11,50,201412,2015),('2014-12-12',201450,12,2014,12,50,201412,2015),('2014-12-13',201450,12,2014,13,50,201412,2015),('2014-12-14',201451,12,2014,14,51,201412,2015),('2014-12-15',201451,12,2014,15,51,201412,2015),('2014-12-16',201451,12,2014,16,51,201412,2015),('2014-12-17',201451,12,2014,17,51,201412,2015),('2014-12-18',201451,12,2014,18,51,201412,2015),('2014-12-19',201451,12,2014,19,51,201412,2015),('2014-12-20',201451,12,2014,20,51,201412,2015),('2014-12-21',201452,12,2014,21,52,201412,2015),('2014-12-22',201452,12,2014,22,52,201412,2015),('2014-12-23',201452,12,2014,23,52,201412,2015),('2014-12-24',201452,12,2014,24,52,201412,2015),('2014-12-25',201452,12,2014,25,52,201412,2015),('2014-12-26',201452,12,2014,26,52,201412,2015),('2014-12-27',201452,12,2014,27,52,201412,2015),('2014-12-28',201453,12,2014,28,53,201412,2015),('2014-12-29',201453,12,2014,29,53,201412,2015),('2014-12-30',201453,12,2014,30,53,201412,2015),('2014-12-31',201453,12,2014,31,53,201412,2015),('2015-01-01',201453,1,2015,1,53,201501,2015),('2015-01-02',201453,1,2015,2,53,201501,2015),('2015-01-03',201453,1,2015,3,53,201501,2015),('2015-01-04',201501,1,2015,4,1,201501,2015),('2015-01-05',201501,1,2015,5,1,201501,2015),('2015-01-06',201501,1,2015,6,1,201501,2015),('2015-01-07',201501,1,2015,7,1,201501,2015),('2015-01-08',201501,1,2015,8,1,201501,2015),('2015-01-09',201501,1,2015,9,1,201501,2015),('2015-01-10',201501,1,2015,10,1,201501,2015),('2015-01-11',201502,1,2015,11,2,201501,2015),('2015-01-12',201502,1,2015,12,2,201501,2015),('2015-01-13',201502,1,2015,13,2,201501,2015),('2015-01-14',201502,1,2015,14,2,201501,2015),('2015-01-15',201502,1,2015,15,2,201501,2015),('2015-01-16',201502,1,2015,16,2,201501,2015),('2015-01-17',201502,1,2015,17,2,201501,2015),('2015-01-18',201503,1,2015,18,3,201501,2015),('2015-01-19',201503,1,2015,19,3,201501,2015),('2015-01-20',201503,1,2015,20,3,201501,2015),('2015-01-21',201503,1,2015,21,3,201501,2015),('2015-01-22',201503,1,2015,22,3,201501,2015),('2015-01-23',201503,1,2015,23,3,201501,2015),('2015-01-24',201503,1,2015,24,3,201501,2015),('2015-01-25',201504,1,2015,25,4,201501,2015),('2015-01-26',201504,1,2015,26,4,201501,2015),('2015-01-27',201504,1,2015,27,4,201501,2015),('2015-01-28',201504,1,2015,28,4,201501,2015),('2015-01-29',201504,1,2015,29,4,201501,2015),('2015-01-30',201504,1,2015,30,4,201501,2015),('2015-01-31',201504,1,2015,31,4,201501,2015),('2015-02-01',201505,2,2015,1,5,201502,2015),('2015-02-02',201505,2,2015,2,5,201502,2015),('2015-02-03',201505,2,2015,3,5,201502,2015),('2015-02-04',201505,2,2015,4,5,201502,2015),('2015-02-05',201505,2,2015,5,5,201502,2015),('2015-02-06',201505,2,2015,6,5,201502,2015),('2015-02-07',201505,2,2015,7,5,201502,2015),('2015-02-08',201506,2,2015,8,6,201502,2015),('2015-02-09',201506,2,2015,9,6,201502,2015),('2015-02-10',201506,2,2015,10,6,201502,2015),('2015-02-11',201506,2,2015,11,6,201502,2015),('2015-02-12',201506,2,2015,12,6,201502,2015),('2015-02-13',201506,2,2015,13,6,201502,2015),('2015-02-14',201506,2,2015,14,6,201502,2015),('2015-02-15',201507,2,2015,15,7,201502,2015),('2015-02-16',201507,2,2015,16,7,201502,2015),('2015-02-17',201507,2,2015,17,7,201502,2015),('2015-02-18',201507,2,2015,18,7,201502,2015),('2015-02-19',201507,2,2015,19,7,201502,2015),('2015-02-20',201507,2,2015,20,7,201502,2015),('2015-02-21',201507,2,2015,21,7,201502,2015),('2015-02-22',201508,2,2015,22,8,201502,2015),('2015-02-23',201508,2,2015,23,8,201502,2015),('2015-02-24',201508,2,2015,24,8,201502,2015),('2015-02-25',201508,2,2015,25,8,201502,2015),('2015-02-26',201508,2,2015,26,8,201502,2015),('2015-02-27',201508,2,2015,27,8,201502,2015),('2015-02-28',201508,2,2015,28,8,201502,2015),('2015-03-01',201509,3,2015,1,9,201503,2015),('2015-03-02',201509,3,2015,2,9,201503,2015),('2015-03-03',201509,3,2015,3,9,201503,2015),('2015-03-04',201509,3,2015,4,9,201503,2015),('2015-03-05',201509,3,2015,5,9,201503,2015),('2015-03-06',201509,3,2015,6,9,201503,2015),('2015-03-07',201509,3,2015,7,9,201503,2015),('2015-03-08',201510,3,2015,8,10,201503,2015),('2015-03-09',201510,3,2015,9,10,201503,2015),('2015-03-10',201510,3,2015,10,10,201503,2015),('2015-03-11',201510,3,2015,11,10,201503,2015),('2015-03-12',201510,3,2015,12,10,201503,2015),('2015-03-13',201510,3,2015,13,10,201503,2015),('2015-03-14',201510,3,2015,14,10,201503,2015),('2015-03-15',201511,3,2015,15,11,201503,2015),('2015-03-16',201511,3,2015,16,11,201503,2015),('2015-03-17',201511,3,2015,17,11,201503,2015),('2015-03-18',201511,3,2015,18,11,201503,2015),('2015-03-19',201511,3,2015,19,11,201503,2015),('2015-03-20',201511,3,2015,20,11,201503,2015),('2015-03-21',201511,3,2015,21,11,201503,2015),('2015-03-22',201512,3,2015,22,12,201503,2015),('2015-03-23',201512,3,2015,23,12,201503,2015),('2015-03-24',201512,3,2015,24,12,201503,2015),('2015-03-25',201512,3,2015,25,12,201503,2015),('2015-03-26',201512,3,2015,26,12,201503,2015),('2015-03-27',201512,3,2015,27,12,201503,2015),('2015-03-28',201512,3,2015,28,12,201503,2015),('2015-03-29',201513,3,2015,29,13,201503,2015),('2015-03-30',201513,3,2015,30,13,201503,2015),('2015-03-31',201513,3,2015,31,13,201503,2015),('2015-04-01',201513,4,2015,1,13,201504,2015),('2015-04-02',201513,4,2015,2,13,201504,2015),('2015-04-03',201513,4,2015,3,13,201504,2015),('2015-04-04',201513,4,2015,4,13,201504,2015),('2015-04-05',201514,4,2015,5,14,201504,2015),('2015-04-06',201514,4,2015,6,14,201504,2015),('2015-04-07',201514,4,2015,7,14,201504,2015),('2015-04-08',201514,4,2015,8,14,201504,2015),('2015-04-09',201514,4,2015,9,14,201504,2015),('2015-04-10',201514,4,2015,10,14,201504,2015),('2015-04-11',201514,4,2015,11,14,201504,2015),('2015-04-12',201515,4,2015,12,15,201504,2015),('2015-04-13',201515,4,2015,13,15,201504,2015),('2015-04-14',201515,4,2015,14,15,201504,2015),('2015-04-15',201515,4,2015,15,15,201504,2015),('2015-04-16',201515,4,2015,16,15,201504,2015),('2015-04-17',201515,4,2015,17,15,201504,2015),('2015-04-18',201515,4,2015,18,15,201504,2015),('2015-04-19',201516,4,2015,19,16,201504,2015),('2015-04-20',201516,4,2015,20,16,201504,2015),('2015-04-21',201516,4,2015,21,16,201504,2015),('2015-04-22',201516,4,2015,22,16,201504,2015),('2015-04-23',201516,4,2015,23,16,201504,2015),('2015-04-24',201516,4,2015,24,16,201504,2015),('2015-04-25',201516,4,2015,25,16,201504,2015),('2015-04-26',201517,4,2015,26,17,201504,2015),('2015-04-27',201517,4,2015,27,17,201504,2015),('2015-04-28',201517,4,2015,28,17,201504,2015),('2015-04-29',201517,4,2015,29,17,201504,2015),('2015-04-30',201517,4,2015,30,17,201504,2015),('2015-05-01',201517,5,2015,1,17,201505,2015),('2015-05-02',201517,5,2015,2,17,201505,2015),('2015-05-03',201518,5,2015,3,18,201505,2015),('2015-05-04',201518,5,2015,4,18,201505,2015),('2015-05-05',201518,5,2015,5,18,201505,2015),('2015-05-06',201518,5,2015,6,18,201505,2015),('2015-05-07',201518,5,2015,7,18,201505,2015),('2015-05-08',201518,5,2015,8,18,201505,2015),('2015-05-09',201518,5,2015,9,18,201505,2015),('2015-05-10',201519,5,2015,10,19,201505,2015),('2015-05-11',201519,5,2015,11,19,201505,2015),('2015-05-12',201519,5,2015,12,19,201505,2015),('2015-05-13',201519,5,2015,13,19,201505,2015),('2015-05-14',201519,5,2015,14,19,201505,2015),('2015-05-15',201519,5,2015,15,19,201505,2015),('2015-05-16',201519,5,2015,16,19,201505,2015),('2015-05-17',201520,5,2015,17,20,201505,2015),('2015-05-18',201520,5,2015,18,20,201505,2015),('2015-05-19',201520,5,2015,19,20,201505,2015),('2015-05-20',201520,5,2015,20,20,201505,2015),('2015-05-21',201520,5,2015,21,20,201505,2015),('2015-05-22',201520,5,2015,22,20,201505,2015),('2015-05-23',201520,5,2015,23,20,201505,2015),('2015-05-24',201521,5,2015,24,21,201505,2015),('2015-05-25',201521,5,2015,25,21,201505,2015),('2015-05-26',201521,5,2015,26,21,201505,2015),('2015-05-27',201521,5,2015,27,21,201505,2015),('2015-05-28',201521,5,2015,28,21,201505,2015),('2015-05-29',201521,5,2015,29,21,201505,2015),('2015-05-30',201521,5,2015,30,21,201505,2015),('2015-05-31',201522,5,2015,31,22,201505,2015),('2015-06-01',201522,6,2015,1,22,201506,2015),('2015-06-02',201522,6,2015,2,22,201506,2015),('2015-06-03',201522,6,2015,3,22,201506,2015),('2015-06-04',201522,6,2015,4,22,201506,2015),('2015-06-05',201522,6,2015,5,22,201506,2015),('2015-06-06',201522,6,2015,6,22,201506,2015),('2015-06-07',201523,6,2015,7,23,201506,2015),('2015-06-08',201523,6,2015,8,23,201506,2015),('2015-06-09',201523,6,2015,9,23,201506,2015),('2015-06-10',201523,6,2015,10,23,201506,2015),('2015-06-11',201523,6,2015,11,23,201506,2015),('2015-06-12',201523,6,2015,12,23,201506,2015),('2015-06-13',201523,6,2015,13,23,201506,2015),('2015-06-14',201524,6,2015,14,24,201506,2015),('2015-06-15',201524,6,2015,15,24,201506,2015),('2015-06-16',201524,6,2015,16,24,201506,2015),('2015-06-17',201524,6,2015,17,24,201506,2015),('2015-06-18',201524,6,2015,18,24,201506,2015),('2015-06-19',201524,6,2015,19,24,201506,2015),('2015-06-20',201524,6,2015,20,24,201506,2015),('2015-06-21',201525,6,2015,21,25,201506,2015),('2015-06-22',201525,6,2015,22,25,201506,2015),('2015-06-23',201525,6,2015,23,25,201506,2015),('2015-06-24',201525,6,2015,24,25,201506,2015),('2015-06-25',201525,6,2015,25,25,201506,2015),('2015-06-26',201525,6,2015,26,25,201506,2015),('2015-06-27',201525,6,2015,27,25,201506,2015),('2015-06-28',201526,6,2015,28,26,201506,2015),('2015-06-29',201526,6,2015,29,26,201506,2015),('2015-06-30',201526,6,2015,30,26,201506,2015),('2015-07-01',201526,7,2015,1,26,201507,2015),('2015-07-02',201526,7,2015,2,26,201507,2015),('2015-07-03',201526,7,2015,3,26,201507,2015),('2015-07-04',201526,7,2015,4,26,201507,2015),('2015-07-05',201527,7,2015,5,27,201507,2015),('2015-07-06',201527,7,2015,6,27,201507,2015),('2015-07-07',201527,7,2015,7,27,201507,2015),('2015-07-08',201527,7,2015,8,27,201507,2015),('2015-07-09',201527,7,2015,9,27,201507,2015),('2015-07-10',201527,7,2015,10,27,201507,2015),('2015-07-11',201527,7,2015,11,27,201507,2015),('2015-07-12',201528,7,2015,12,28,201507,2015),('2015-07-13',201528,7,2015,13,28,201507,2015),('2015-07-14',201528,7,2015,14,28,201507,2015),('2015-07-15',201528,7,2015,15,28,201507,2015),('2015-07-16',201528,7,2015,16,28,201507,2015),('2015-07-17',201528,7,2015,17,28,201507,2015),('2015-07-18',201528,7,2015,18,28,201507,2015),('2015-07-19',201529,7,2015,19,29,201507,2015),('2015-07-20',201529,7,2015,20,29,201507,2015),('2015-07-21',201529,7,2015,21,29,201507,2015),('2015-07-22',201529,7,2015,22,29,201507,2015),('2015-07-23',201529,7,2015,23,29,201507,2015),('2015-07-24',201529,7,2015,24,29,201507,2015),('2015-07-25',201529,7,2015,25,29,201507,2015),('2015-07-26',201530,7,2015,26,30,201507,2015),('2015-07-27',201530,7,2015,27,30,201507,2015),('2015-07-28',201530,7,2015,28,30,201507,2015),('2015-07-29',201530,7,2015,29,30,201507,2015),('2015-07-30',201530,7,2015,30,30,201507,2015),('2015-07-31',201530,7,2015,31,30,201507,2015),('2015-08-01',201530,8,2015,1,30,201508,2015),('2015-08-02',201531,8,2015,2,31,201508,2015),('2015-08-03',201531,8,2015,3,31,201508,2015),('2015-08-04',201531,8,2015,4,31,201508,2015),('2015-08-05',201531,8,2015,5,31,201508,2015),('2015-08-06',201531,8,2015,6,31,201508,2015),('2015-08-07',201531,8,2015,7,31,201508,2015),('2015-08-08',201531,8,2015,8,31,201508,2015),('2015-08-09',201532,8,2015,9,32,201508,2015),('2015-08-10',201532,8,2015,10,32,201508,2015),('2015-08-11',201532,8,2015,11,32,201508,2015),('2015-08-12',201532,8,2015,12,32,201508,2015),('2015-08-13',201532,8,2015,13,32,201508,2015),('2015-08-14',201532,8,2015,14,32,201508,2015),('2015-08-15',201532,8,2015,15,32,201508,2015),('2015-08-16',201533,8,2015,16,33,201508,2015),('2015-08-17',201533,8,2015,17,33,201508,2015),('2015-08-18',201533,8,2015,18,33,201508,2015),('2015-08-19',201533,8,2015,19,33,201508,2015),('2015-08-20',201533,8,2015,20,33,201508,2015),('2015-08-21',201533,8,2015,21,33,201508,2015),('2015-08-22',201533,8,2015,22,33,201508,2015),('2015-08-23',201534,8,2015,23,34,201508,2015),('2015-08-24',201534,8,2015,24,34,201508,2015),('2015-08-25',201534,8,2015,25,34,201508,2015),('2015-08-26',201534,8,2015,26,34,201508,2015),('2015-08-27',201534,8,2015,27,34,201508,2015),('2015-08-28',201534,8,2015,28,34,201508,2015),('2015-08-29',201534,8,2015,29,34,201508,2015),('2015-08-30',201535,8,2015,30,35,201508,2015),('2015-08-31',201535,8,2015,31,35,201508,2015),('2015-09-01',201535,9,2015,1,35,201509,2015),('2015-09-02',201535,9,2015,2,35,201509,2015),('2015-09-03',201535,9,2015,3,35,201509,2015),('2015-09-04',201535,9,2015,4,35,201509,2015),('2015-09-05',201535,9,2015,5,35,201509,2015),('2015-09-06',201536,9,2015,6,36,201509,2015),('2015-09-07',201536,9,2015,7,36,201509,2015),('2015-09-08',201536,9,2015,8,36,201509,2015),('2015-09-09',201536,9,2015,9,36,201509,2015),('2015-09-10',201536,9,2015,10,36,201509,2015),('2015-09-11',201536,9,2015,11,36,201509,2015),('2015-09-12',201536,9,2015,12,36,201509,2015),('2015-09-13',201537,9,2015,13,37,201509,2015),('2015-09-14',201537,9,2015,14,37,201509,2015),('2015-09-15',201537,9,2015,15,37,201509,2015),('2015-09-16',201537,9,2015,16,37,201509,2015),('2015-09-17',201537,9,2015,17,37,201509,2015),('2015-09-18',201537,9,2015,18,37,201509,2015),('2015-09-19',201537,9,2015,19,37,201509,2015),('2015-09-20',201538,9,2015,20,38,201509,2015),('2015-09-21',201538,9,2015,21,38,201509,2015),('2015-09-22',201538,9,2015,22,38,201509,2015),('2015-09-23',201538,9,2015,23,38,201509,2015),('2015-09-24',201538,9,2015,24,38,201509,2015),('2015-09-25',201538,9,2015,25,38,201509,2015),('2015-09-26',201538,9,2015,26,38,201509,2015),('2015-09-27',201539,9,2015,27,39,201509,2015),('2015-09-28',201539,9,2015,28,39,201509,2015),('2015-09-29',201539,9,2015,29,39,201509,2015),('2015-09-30',201539,9,2015,30,39,201509,2015),('2015-10-01',201539,10,2015,1,39,201510,2015),('2015-10-02',201539,10,2015,2,39,201510,2015),('2015-10-03',201539,10,2015,3,39,201510,2015),('2015-10-04',201540,10,2015,4,40,201510,2015),('2015-10-05',201540,10,2015,5,40,201510,2015),('2015-10-06',201540,10,2015,6,40,201510,2015),('2015-10-07',201540,10,2015,7,40,201510,2015),('2015-10-08',201540,10,2015,8,40,201510,2015),('2015-10-09',201540,10,2015,9,40,201510,2015),('2015-10-10',201540,10,2015,10,40,201510,2015),('2015-10-11',201541,10,2015,11,41,201510,2015),('2015-10-12',201541,10,2015,12,41,201510,2015),('2015-10-13',201541,10,2015,13,41,201510,2015),('2015-10-14',201541,10,2015,14,41,201510,2015),('2015-10-15',201541,10,2015,15,41,201510,2015),('2015-10-16',201541,10,2015,16,41,201510,2015),('2015-10-17',201541,10,2015,17,41,201510,2015),('2015-10-18',201542,10,2015,18,42,201510,2015),('2015-10-19',201542,10,2015,19,42,201510,2015),('2015-10-20',201542,10,2015,20,42,201510,2015),('2015-10-21',201542,10,2015,21,42,201510,2015),('2015-10-22',201542,10,2015,22,42,201510,2015),('2015-10-23',201542,10,2015,23,42,201510,2015),('2015-10-24',201542,10,2015,24,42,201510,2015),('2015-10-25',201543,10,2015,25,43,201510,2015),('2015-10-26',201543,10,2015,26,43,201510,2015),('2015-10-27',201543,10,2015,27,43,201510,2015),('2015-10-28',201543,10,2015,28,43,201510,2015),('2015-10-29',201543,10,2015,29,43,201510,2015),('2015-10-30',201543,10,2015,30,43,201510,2015),('2015-10-31',201543,10,2015,31,43,201510,2015),('2015-11-01',201544,11,2015,1,44,201511,2015),('2015-11-02',201544,11,2015,2,44,201511,2015),('2015-11-03',201544,11,2015,3,44,201511,2015),('2015-11-04',201544,11,2015,4,44,201511,2015),('2015-11-05',201544,11,2015,5,44,201511,2015),('2015-11-06',201544,11,2015,6,44,201511,2015),('2015-11-07',201544,11,2015,7,44,201511,2015),('2015-11-08',201545,11,2015,8,45,201511,2015),('2015-11-09',201545,11,2015,9,45,201511,2015),('2015-11-10',201545,11,2015,10,45,201511,2015),('2015-11-11',201545,11,2015,11,45,201511,2015),('2015-11-12',201545,11,2015,12,45,201511,2015),('2015-11-13',201545,11,2015,13,45,201511,2015),('2015-11-14',201545,11,2015,14,45,201511,2015),('2015-11-15',201546,11,2015,15,46,201511,2015),('2015-11-16',201546,11,2015,16,46,201511,2015),('2015-11-17',201546,11,2015,17,46,201511,2015),('2015-11-18',201546,11,2015,18,46,201511,2015),('2015-11-19',201546,11,2015,19,46,201511,2015),('2015-11-20',201546,11,2015,20,46,201511,2015),('2015-11-21',201546,11,2015,21,46,201511,2015),('2015-11-22',201547,11,2015,22,47,201511,2015),('2015-11-23',201547,11,2015,23,47,201511,2015),('2015-11-24',201547,11,2015,24,47,201511,2015),('2015-11-25',201547,11,2015,25,47,201511,2015),('2015-11-26',201547,11,2015,26,47,201511,2015),('2015-11-27',201547,11,2015,27,47,201511,2015),('2015-11-28',201547,11,2015,28,47,201511,2015),('2015-11-29',201548,11,2015,29,48,201511,2015),('2015-11-30',201548,11,2015,30,48,201511,2015),('2015-12-01',201548,12,2015,1,48,201512,2016),('2015-12-02',201548,12,2015,2,48,201512,2016),('2015-12-03',201548,12,2015,3,48,201512,2016),('2015-12-04',201548,12,2015,4,48,201512,2016),('2015-12-05',201548,12,2015,5,48,201512,2016),('2015-12-06',201549,12,2015,6,49,201512,2016),('2015-12-07',201549,12,2015,7,49,201512,2016),('2015-12-08',201549,12,2015,8,49,201512,2016),('2015-12-09',201549,12,2015,9,49,201512,2016),('2015-12-10',201549,12,2015,10,49,201512,2016),('2015-12-11',201549,12,2015,11,49,201512,2016),('2015-12-12',201549,12,2015,12,49,201512,2016),('2015-12-13',201550,12,2015,13,50,201512,2016),('2015-12-14',201550,12,2015,14,50,201512,2016),('2015-12-15',201550,12,2015,15,50,201512,2016),('2015-12-16',201550,12,2015,16,50,201512,2016),('2015-12-17',201550,12,2015,17,50,201512,2016),('2015-12-18',201550,12,2015,18,50,201512,2016),('2015-12-19',201550,12,2015,19,50,201512,2016),('2015-12-20',201551,12,2015,20,51,201512,2016),('2015-12-21',201551,12,2015,21,51,201512,2016),('2015-12-22',201551,12,2015,22,51,201512,2016),('2015-12-23',201551,12,2015,23,51,201512,2016),('2015-12-24',201551,12,2015,24,51,201512,2016),('2015-12-25',201551,12,2015,25,51,201512,2016),('2015-12-26',201551,12,2015,26,51,201512,2016),('2015-12-27',201552,12,2015,27,52,201512,2016),('2015-12-28',201552,12,2015,28,52,201512,2016),('2015-12-29',201552,12,2015,29,52,201512,2016),('2015-12-30',201552,12,2015,30,52,201512,2016),('2015-12-31',201552,12,2015,31,52,201512,2016),('2016-01-01',201552,1,2016,1,1,201601,2016),('2016-01-02',201552,1,2016,2,1,201601,2016),('2016-01-03',201601,1,2016,3,1,201601,2016),('2016-01-04',201601,1,2016,4,1,201601,2016),('2016-01-05',201601,1,2016,5,1,201601,2016),('2016-01-06',201601,1,2016,6,1,201601,2016),('2016-01-07',201601,1,2016,7,1,201601,2016),('2016-01-08',201601,1,2016,8,1,201601,2016),('2016-01-09',201601,1,2016,9,1,201601,2016),('2016-01-10',201602,1,2016,10,2,201601,2016),('2016-01-11',201602,1,2016,11,2,201601,2016),('2016-01-12',201602,1,2016,12,2,201601,2016),('2016-01-13',201602,1,2016,13,2,201601,2016),('2016-01-14',201602,1,2016,14,2,201601,2016),('2016-01-15',201602,1,2016,15,2,201601,2016),('2016-01-16',201602,1,2016,16,2,201601,2016),('2016-01-17',201603,1,2016,17,3,201601,2016),('2016-01-18',201603,1,2016,18,3,201601,2016),('2016-01-19',201603,1,2016,19,3,201601,2016),('2016-01-20',201603,1,2016,20,3,201601,2016),('2016-01-21',201603,1,2016,21,3,201601,2016),('2016-01-22',201603,1,2016,22,3,201601,2016),('2016-01-23',201603,1,2016,23,3,201601,2016),('2016-01-24',201604,1,2016,24,4,201601,2016),('2016-01-25',201604,1,2016,25,4,201601,2016),('2016-01-26',201604,1,2016,26,4,201601,2016),('2016-01-27',201604,1,2016,27,4,201601,2016),('2016-01-28',201604,1,2016,28,4,201601,2016),('2016-01-29',201604,1,2016,29,4,201601,2016),('2016-01-30',201604,1,2016,30,4,201601,2016),('2016-01-31',201605,1,2016,31,5,201601,2016),('2016-02-01',201605,2,2016,1,5,201602,2016),('2016-02-02',201605,2,2016,2,5,201602,2016),('2016-02-03',201605,2,2016,3,5,201602,2016),('2016-02-04',201605,2,2016,4,5,201602,2016),('2016-02-05',201605,2,2016,5,5,201602,2016),('2016-02-06',201605,2,2016,6,5,201602,2016),('2016-02-07',201606,2,2016,7,6,201602,2016),('2016-02-08',201606,2,2016,8,6,201602,2016),('2016-02-09',201606,2,2016,9,6,201602,2016),('2016-02-10',201606,2,2016,10,6,201602,2016),('2016-02-11',201606,2,2016,11,6,201602,2016),('2016-02-12',201606,2,2016,12,6,201602,2016),('2016-02-13',201606,2,2016,13,6,201602,2016),('2016-02-14',201607,2,2016,14,7,201602,2016),('2016-02-15',201607,2,2016,15,7,201602,2016),('2016-02-16',201607,2,2016,16,7,201602,2016),('2016-02-17',201607,2,2016,17,7,201602,2016),('2016-02-18',201607,2,2016,18,7,201602,2016),('2016-02-19',201607,2,2016,19,7,201602,2016),('2016-02-20',201607,2,2016,20,7,201602,2016),('2016-02-21',201608,2,2016,21,8,201602,2016),('2016-02-22',201608,2,2016,22,8,201602,2016),('2016-02-23',201608,2,2016,23,8,201602,2016),('2016-02-24',201608,2,2016,24,8,201602,2016),('2016-02-25',201608,2,2016,25,8,201602,2016),('2016-02-26',201608,2,2016,26,8,201602,2016),('2016-02-27',201608,2,2016,27,8,201602,2016),('2016-02-28',201609,2,2016,28,9,201602,2016),('2016-02-29',201609,2,2016,29,9,201602,2016),('2016-03-01',201609,3,2016,1,9,201603,2016),('2016-03-02',201609,3,2016,2,9,201603,2016),('2016-03-03',201609,3,2016,3,9,201603,2016),('2016-03-04',201609,3,2016,4,9,201603,2016),('2016-03-05',201609,3,2016,5,9,201603,2016),('2016-03-06',201610,3,2016,6,10,201603,2016),('2016-03-07',201610,3,2016,7,10,201603,2016),('2016-03-08',201610,3,2016,8,10,201603,2016),('2016-03-09',201610,3,2016,9,10,201603,2016),('2016-03-10',201610,3,2016,10,10,201603,2016),('2016-03-11',201610,3,2016,11,10,201603,2016),('2016-03-12',201610,3,2016,12,10,201603,2016),('2016-03-13',201611,3,2016,13,11,201603,2016),('2016-03-14',201611,3,2016,14,11,201603,2016),('2016-03-15',201611,3,2016,15,11,201603,2016),('2016-03-16',201611,3,2016,16,11,201603,2016),('2016-03-17',201611,3,2016,17,11,201603,2016),('2016-03-18',201611,3,2016,18,11,201603,2016),('2016-03-19',201611,3,2016,19,11,201603,2016),('2016-03-20',201612,3,2016,20,12,201603,2016),('2016-03-21',201612,3,2016,21,12,201603,2016),('2016-03-22',201612,3,2016,22,12,201603,2016),('2016-03-23',201612,3,2016,23,12,201603,2016),('2016-03-24',201612,3,2016,24,12,201603,2016),('2016-03-25',201612,3,2016,25,12,201603,2016),('2016-03-26',201612,3,2016,26,12,201603,2016),('2016-03-27',201613,3,2016,27,13,201603,2016),('2016-03-28',201613,3,2016,28,13,201603,2016),('2016-03-29',201613,3,2016,29,13,201603,2016),('2016-03-30',201613,3,2016,30,13,201603,2016),('2016-03-31',201613,3,2016,31,13,201603,2016),('2016-04-01',201613,4,2016,1,13,201604,2016),('2016-04-02',201613,4,2016,2,13,201604,2016),('2016-04-03',201614,4,2016,3,14,201604,2016),('2016-04-04',201614,4,2016,4,14,201604,2016),('2016-04-05',201614,4,2016,5,14,201604,2016),('2016-04-06',201614,4,2016,6,14,201604,2016),('2016-04-07',201614,4,2016,7,14,201604,2016),('2016-04-08',201614,4,2016,8,14,201604,2016),('2016-04-09',201614,4,2016,9,14,201604,2016),('2016-04-10',201615,4,2016,10,15,201604,2016),('2016-04-11',201615,4,2016,11,15,201604,2016),('2016-04-12',201615,4,2016,12,15,201604,2016),('2016-04-13',201615,4,2016,13,15,201604,2016),('2016-04-14',201615,4,2016,14,15,201604,2016),('2016-04-15',201615,4,2016,15,15,201604,2016),('2016-04-16',201615,4,2016,16,15,201604,2016),('2016-04-17',201616,4,2016,17,16,201604,2016),('2016-04-18',201616,4,2016,18,16,201604,2016),('2016-04-19',201616,4,2016,19,16,201604,2016),('2016-04-20',201616,4,2016,20,16,201604,2016),('2016-04-21',201616,4,2016,21,16,201604,2016),('2016-04-22',201616,4,2016,22,16,201604,2016),('2016-04-23',201616,4,2016,23,16,201604,2016),('2016-04-24',201617,4,2016,24,17,201604,2016),('2016-04-25',201617,4,2016,25,17,201604,2016),('2016-04-26',201617,4,2016,26,17,201604,2016),('2016-04-27',201617,4,2016,27,17,201604,2016),('2016-04-28',201617,4,2016,28,17,201604,2016),('2016-04-29',201617,4,2016,29,17,201604,2016),('2016-04-30',201617,4,2016,30,17,201604,2016),('2016-05-01',201618,5,2016,1,18,201605,2016),('2016-05-02',201618,5,2016,2,18,201605,2016),('2016-05-03',201618,5,2016,3,18,201605,2016),('2016-05-04',201618,5,2016,4,18,201605,2016),('2016-05-05',201618,5,2016,5,18,201605,2016),('2016-05-06',201618,5,2016,6,18,201605,2016),('2016-05-07',201618,5,2016,7,18,201605,2016),('2016-05-08',201619,5,2016,8,19,201605,2016),('2016-05-09',201619,5,2016,9,19,201605,2016),('2016-05-10',201619,5,2016,10,19,201605,2016),('2016-05-11',201619,5,2016,11,19,201605,2016),('2016-05-12',201619,5,2016,12,19,201605,2016),('2016-05-13',201619,5,2016,13,19,201605,2016),('2016-05-14',201619,5,2016,14,19,201605,2016),('2016-05-15',201620,5,2016,15,20,201605,2016),('2016-05-16',201620,5,2016,16,20,201605,2016),('2016-05-17',201620,5,2016,17,20,201605,2016),('2016-05-18',201620,5,2016,18,20,201605,2016),('2016-05-19',201620,5,2016,19,20,201605,2016),('2016-05-20',201620,5,2016,20,20,201605,2016),('2016-05-21',201620,5,2016,21,20,201605,2016),('2016-05-22',201621,5,2016,22,21,201605,2016),('2016-05-23',201621,5,2016,23,21,201605,2016),('2016-05-24',201621,5,2016,24,21,201605,2016),('2016-05-25',201621,5,2016,25,21,201605,2016),('2016-05-26',201621,5,2016,26,21,201605,2016),('2016-05-27',201621,5,2016,27,21,201605,2016),('2016-05-28',201621,5,2016,28,21,201605,2016),('2016-05-29',201622,5,2016,29,22,201605,2016),('2016-05-30',201622,5,2016,30,22,201605,2016),('2016-05-31',201622,5,2016,31,22,201605,2016),('2016-06-01',201622,6,2016,1,22,201606,2016),('2016-06-02',201622,6,2016,2,22,201606,2016),('2016-06-03',201622,6,2016,3,22,201606,2016),('2016-06-04',201622,6,2016,4,22,201606,2016),('2016-06-05',201623,6,2016,5,23,201606,2016),('2016-06-06',201623,6,2016,6,23,201606,2016),('2016-06-07',201623,6,2016,7,23,201606,2016),('2016-06-08',201623,6,2016,8,23,201606,2016),('2016-06-09',201623,6,2016,9,23,201606,2016),('2016-06-10',201623,6,2016,10,23,201606,2016),('2016-06-11',201623,6,2016,11,23,201606,2016),('2016-06-12',201624,6,2016,12,24,201606,2016),('2016-06-13',201624,6,2016,13,24,201606,2016),('2016-06-14',201624,6,2016,14,24,201606,2016),('2016-06-15',201624,6,2016,15,24,201606,2016),('2016-06-16',201624,6,2016,16,24,201606,2016),('2016-06-17',201624,6,2016,17,24,201606,2016),('2016-06-18',201624,6,2016,18,24,201606,2016),('2016-06-19',201625,6,2016,19,25,201606,2016),('2016-06-20',201625,6,2016,20,25,201606,2016),('2016-06-21',201625,6,2016,21,25,201606,2016),('2016-06-22',201625,6,2016,22,25,201606,2016),('2016-06-23',201625,6,2016,23,25,201606,2016),('2016-06-24',201625,6,2016,24,25,201606,2016),('2016-06-25',201625,6,2016,25,25,201606,2016),('2016-06-26',201626,6,2016,26,26,201606,2016),('2016-06-27',201626,6,2016,27,26,201606,2016),('2016-06-28',201626,6,2016,28,26,201606,2016),('2016-06-29',201626,6,2016,29,26,201606,2016),('2016-06-30',201626,6,2016,30,26,201606,2016),('2016-07-01',201626,7,2016,1,26,201607,2016),('2016-07-02',201626,7,2016,2,26,201607,2016),('2016-07-03',201627,7,2016,3,27,201607,2016),('2016-07-04',201627,7,2016,4,27,201607,2016),('2016-07-05',201627,7,2016,5,27,201607,2016),('2016-07-06',201627,7,2016,6,27,201607,2016),('2016-07-07',201627,7,2016,7,27,201607,2016),('2016-07-08',201627,7,2016,8,27,201607,2016),('2016-07-09',201627,7,2016,9,27,201607,2016),('2016-07-10',201628,7,2016,10,28,201607,2016),('2016-07-11',201628,7,2016,11,28,201607,2016),('2016-07-12',201628,7,2016,12,28,201607,2016),('2016-07-13',201628,7,2016,13,28,201607,2016),('2016-07-14',201628,7,2016,14,28,201607,2016),('2016-07-15',201628,7,2016,15,28,201607,2016),('2016-07-16',201628,7,2016,16,28,201607,2016),('2016-07-17',201629,7,2016,17,29,201607,2016),('2016-07-18',201629,7,2016,18,29,201607,2016),('2016-07-19',201629,7,2016,19,29,201607,2016),('2016-07-20',201629,7,2016,20,29,201607,2016),('2016-07-21',201629,7,2016,21,29,201607,2016),('2016-07-22',201629,7,2016,22,29,201607,2016),('2016-07-23',201629,7,2016,23,29,201607,2016),('2016-07-24',201630,7,2016,24,30,201607,2016),('2016-07-25',201630,7,2016,25,30,201607,2016),('2016-07-26',201630,7,2016,26,30,201607,2016),('2016-07-27',201630,7,2016,27,30,201607,2016),('2016-07-28',201630,7,2016,28,30,201607,2016),('2016-07-29',201630,7,2016,29,30,201607,2016),('2016-07-30',201630,7,2016,30,30,201607,2016),('2016-07-31',201631,7,2016,31,31,201607,2016),('2016-08-01',201631,8,2016,1,31,201608,2016),('2016-08-02',201631,8,2016,2,31,201608,2016),('2016-08-03',201631,8,2016,3,31,201608,2016),('2016-08-04',201631,8,2016,4,31,201608,2016),('2016-08-05',201631,8,2016,5,31,201608,2016),('2016-08-06',201631,8,2016,6,31,201608,2016),('2016-08-07',201632,8,2016,7,32,201608,2016),('2016-08-08',201632,8,2016,8,32,201608,2016),('2016-08-09',201632,8,2016,9,32,201608,2016),('2016-08-10',201632,8,2016,10,32,201608,2016),('2016-08-11',201632,8,2016,11,32,201608,2016),('2016-08-12',201632,8,2016,12,32,201608,2016),('2016-08-13',201632,8,2016,13,32,201608,2016),('2016-08-14',201633,8,2016,14,33,201608,2016),('2016-08-15',201633,8,2016,15,33,201608,2016),('2016-08-16',201633,8,2016,16,33,201608,2016),('2016-08-17',201633,8,2016,17,33,201608,2016),('2016-08-18',201633,8,2016,18,33,201608,2016),('2016-08-19',201633,8,2016,19,33,201608,2016),('2016-08-20',201633,8,2016,20,33,201608,2016),('2016-08-21',201634,8,2016,21,34,201608,2016),('2016-08-22',201634,8,2016,22,34,201608,2016),('2016-08-23',201634,8,2016,23,34,201608,2016),('2016-08-24',201634,8,2016,24,34,201608,2016),('2016-08-25',201634,8,2016,25,34,201608,2016),('2016-08-26',201634,8,2016,26,34,201608,2016),('2016-08-27',201634,8,2016,27,34,201608,2016),('2016-08-28',201635,8,2016,28,35,201608,2016),('2016-08-29',201635,8,2016,29,35,201608,2016),('2016-08-30',201635,8,2016,30,35,201608,2016),('2016-08-31',201635,8,2016,31,35,201608,2016),('2016-09-01',201635,9,2016,1,35,201609,2016),('2016-09-02',201635,9,2016,2,35,201609,2016),('2016-09-03',201635,9,2016,3,35,201609,2016),('2016-09-04',201636,9,2016,4,36,201609,2016),('2016-09-05',201636,9,2016,5,36,201609,2016),('2016-09-06',201636,9,2016,6,36,201609,2016),('2016-09-07',201636,9,2016,7,36,201609,2016),('2016-09-08',201636,9,2016,8,36,201609,2016),('2016-09-09',201636,9,2016,9,36,201609,2016),('2016-09-10',201636,9,2016,10,36,201609,2016),('2016-09-11',201637,9,2016,11,37,201609,2016),('2016-09-12',201637,9,2016,12,37,201609,2016),('2016-09-13',201637,9,2016,13,37,201609,2016),('2016-09-14',201637,9,2016,14,37,201609,2016),('2016-09-15',201637,9,2016,15,37,201609,2016),('2016-09-16',201637,9,2016,16,37,201609,2016),('2016-09-17',201637,9,2016,17,37,201609,2016),('2016-09-18',201638,9,2016,18,38,201609,2016),('2016-09-19',201638,9,2016,19,38,201609,2016),('2016-09-20',201638,9,2016,20,38,201609,2016),('2016-09-21',201638,9,2016,21,38,201609,2016),('2016-09-22',201638,9,2016,22,38,201609,2016),('2016-09-23',201638,9,2016,23,38,201609,2016),('2016-09-24',201638,9,2016,24,38,201609,2016),('2016-09-25',201639,9,2016,25,39,201609,2016),('2016-09-26',201639,9,2016,26,39,201609,2016),('2016-09-27',201639,9,2016,27,39,201609,2016),('2016-09-28',201639,9,2016,28,39,201609,2016),('2016-09-29',201639,9,2016,29,39,201609,2016),('2016-09-30',201639,9,2016,30,39,201609,2016),('2016-10-01',201639,10,2016,1,39,201610,2016),('2016-10-02',201640,10,2016,2,40,201610,2016),('2016-10-03',201640,10,2016,3,40,201610,2016),('2016-10-04',201640,10,2016,4,40,201610,2016),('2016-10-05',201640,10,2016,5,40,201610,2016),('2016-10-06',201640,10,2016,6,40,201610,2016),('2016-10-07',201640,10,2016,7,40,201610,2016),('2016-10-08',201640,10,2016,8,40,201610,2016),('2016-10-09',201641,10,2016,9,41,201610,2016),('2016-10-10',201641,10,2016,10,41,201610,2016),('2016-10-11',201641,10,2016,11,41,201610,2016),('2016-10-12',201641,10,2016,12,41,201610,2016),('2016-10-13',201641,10,2016,13,41,201610,2016),('2016-10-14',201641,10,2016,14,41,201610,2016),('2016-10-15',201641,10,2016,15,41,201610,2016),('2016-10-16',201642,10,2016,16,42,201610,2016),('2016-10-17',201642,10,2016,17,42,201610,2016),('2016-10-18',201642,10,2016,18,42,201610,2016),('2016-10-19',201642,10,2016,19,42,201610,2016),('2016-10-20',201642,10,2016,20,42,201610,2016),('2016-10-21',201642,10,2016,21,42,201610,2016),('2016-10-22',201642,10,2016,22,42,201610,2016),('2016-10-23',201643,10,2016,23,43,201610,2016),('2016-10-24',201643,10,2016,24,43,201610,2016),('2016-10-25',201643,10,2016,25,43,201610,2016),('2016-10-26',201643,10,2016,26,43,201610,2016),('2016-10-27',201643,10,2016,27,43,201610,2016),('2016-10-28',201643,10,2016,28,43,201610,2016),('2016-10-29',201643,10,2016,29,43,201610,2016),('2016-10-30',201644,10,2016,30,44,201610,2016),('2016-10-31',201644,10,2016,31,44,201610,2016),('2016-11-01',201644,11,2016,1,44,201611,2016),('2016-11-02',201644,11,2016,2,44,201611,2016),('2016-11-03',201644,11,2016,3,44,201611,2016),('2016-11-04',201644,11,2016,4,44,201611,2016),('2016-11-05',201644,11,2016,5,44,201611,2016),('2016-11-06',201645,11,2016,6,45,201611,2016),('2016-11-07',201645,11,2016,7,45,201611,2016),('2016-11-08',201645,11,2016,8,45,201611,2016),('2016-11-09',201645,11,2016,9,45,201611,2016),('2016-11-10',201645,11,2016,10,45,201611,2016),('2016-11-11',201645,11,2016,11,45,201611,2016),('2016-11-12',201645,11,2016,12,45,201611,2016),('2016-11-13',201646,11,2016,13,46,201611,2016),('2016-11-14',201646,11,2016,14,46,201611,2016),('2016-11-15',201646,11,2016,15,46,201611,2016),('2016-11-16',201646,11,2016,16,46,201611,2016),('2016-11-17',201646,11,2016,17,46,201611,2016),('2016-11-18',201646,11,2016,18,46,201611,2016),('2016-11-19',201646,11,2016,19,46,201611,2016),('2016-11-20',201647,11,2016,20,47,201611,2016),('2016-11-21',201647,11,2016,21,47,201611,2016),('2016-11-22',201647,11,2016,22,47,201611,2016),('2016-11-23',201647,11,2016,23,47,201611,2016),('2016-11-24',201647,11,2016,24,47,201611,2016),('2016-11-25',201647,11,2016,25,47,201611,2016),('2016-11-26',201647,11,2016,26,47,201611,2016),('2016-11-27',201648,11,2016,27,48,201611,2016),('2016-11-28',201648,11,2016,28,48,201611,2016),('2016-11-29',201648,11,2016,29,48,201611,2016),('2016-11-30',201648,11,2016,30,48,201611,2016),('2016-12-01',201648,12,2016,1,48,201612,2017),('2016-12-02',201648,12,2016,2,48,201612,2017),('2016-12-03',201648,12,2016,3,48,201612,2017),('2016-12-04',201649,12,2016,4,49,201612,2017),('2016-12-05',201649,12,2016,5,49,201612,2017),('2016-12-06',201649,12,2016,6,49,201612,2017),('2016-12-07',201649,12,2016,7,49,201612,2017),('2016-12-08',201649,12,2016,8,49,201612,2017),('2016-12-09',201649,12,2016,9,49,201612,2017),('2016-12-10',201649,12,2016,10,49,201612,2017),('2016-12-11',201650,12,2016,11,50,201612,2017),('2016-12-12',201650,12,2016,12,50,201612,2017),('2016-12-13',201650,12,2016,13,50,201612,2017),('2016-12-14',201650,12,2016,14,50,201612,2017),('2016-12-15',201650,12,2016,15,50,201612,2017),('2016-12-16',201650,12,2016,16,50,201612,2017),('2016-12-17',201650,12,2016,17,50,201612,2017),('2016-12-18',201651,12,2016,18,51,201612,2017),('2016-12-19',201651,12,2016,19,51,201612,2017),('2016-12-20',201651,12,2016,20,51,201612,2017),('2016-12-21',201651,12,2016,21,51,201612,2017),('2016-12-22',201651,12,2016,22,51,201612,2017),('2016-12-23',201651,12,2016,23,51,201612,2017),('2016-12-24',201651,12,2016,24,51,201612,2017),('2016-12-25',201652,12,2016,25,52,201612,2017),('2016-12-26',201652,12,2016,26,52,201612,2017),('2016-12-27',201652,12,2016,27,52,201612,2017),('2016-12-28',201652,12,2016,28,52,201612,2017),('2016-12-29',201652,12,2016,29,52,201612,2017),('2016-12-30',201652,12,2016,30,52,201612,2017),('2016-12-31',201652,12,2016,31,52,201612,2017),('2017-01-01',201701,1,2017,1,1,201701,2017),('2017-01-02',201701,1,2017,2,1,201701,2017),('2017-01-03',201701,1,2017,3,1,201701,2017),('2017-01-04',201701,1,2017,4,1,201701,2017),('2017-01-05',201701,1,2017,5,1,201701,2017),('2017-01-06',201701,1,2017,6,1,201701,2017),('2017-01-07',201701,1,2017,7,1,201701,2017),('2017-01-08',201702,1,2017,8,2,201701,2017),('2017-01-09',201702,1,2017,9,2,201701,2017),('2017-01-10',201702,1,2017,10,2,201701,2017),('2017-01-11',201702,1,2017,11,2,201701,2017),('2017-01-12',201702,1,2017,12,2,201701,2017),('2017-01-13',201702,1,2017,13,2,201701,2017),('2017-01-14',201702,1,2017,14,2,201701,2017),('2017-01-15',201703,1,2017,15,3,201701,2017),('2017-01-16',201703,1,2017,16,3,201701,2017),('2017-01-17',201703,1,2017,17,3,201701,2017),('2017-01-18',201703,1,2017,18,3,201701,2017),('2017-01-19',201703,1,2017,19,3,201701,2017),('2017-01-20',201703,1,2017,20,3,201701,2017),('2017-01-21',201703,1,2017,21,3,201701,2017),('2017-01-22',201704,1,2017,22,4,201701,2017),('2017-01-23',201704,1,2017,23,4,201701,2017),('2017-01-24',201704,1,2017,24,4,201701,2017),('2017-01-25',201704,1,2017,25,4,201701,2017),('2017-01-26',201704,1,2017,26,4,201701,2017),('2017-01-27',201704,1,2017,27,4,201701,2017),('2017-01-28',201704,1,2017,28,4,201701,2017),('2017-01-29',201705,1,2017,29,5,201701,2017),('2017-01-30',201705,1,2017,30,5,201701,2017),('2017-01-31',201705,1,2017,31,5,201701,2017),('2017-02-01',201705,2,2017,1,5,201702,2017),('2017-02-02',201705,2,2017,2,5,201702,2017),('2017-02-03',201705,2,2017,3,5,201702,2017),('2017-02-04',201705,2,2017,4,5,201702,2017),('2017-02-05',201706,2,2017,5,6,201702,2017),('2017-02-06',201706,2,2017,6,6,201702,2017),('2017-02-07',201706,2,2017,7,6,201702,2017),('2017-02-08',201706,2,2017,8,6,201702,2017),('2017-02-09',201706,2,2017,9,6,201702,2017),('2017-02-10',201706,2,2017,10,6,201702,2017),('2017-02-11',201706,2,2017,11,6,201702,2017),('2017-02-12',201707,2,2017,12,7,201702,2017),('2017-02-13',201707,2,2017,13,7,201702,2017),('2017-02-14',201707,2,2017,14,7,201702,2017),('2017-02-15',201707,2,2017,15,7,201702,2017),('2017-02-16',201707,2,2017,16,7,201702,2017),('2017-02-17',201707,2,2017,17,7,201702,2017),('2017-02-18',201707,2,2017,18,7,201702,2017),('2017-02-19',201708,2,2017,19,8,201702,2017),('2017-02-20',201708,2,2017,20,8,201702,2017),('2017-02-21',201708,2,2017,21,8,201702,2017),('2017-02-22',201708,2,2017,22,8,201702,2017),('2017-02-23',201708,2,2017,23,8,201702,2017),('2017-02-24',201708,2,2017,24,8,201702,2017),('2017-02-25',201708,2,2017,25,8,201702,2017),('2017-02-26',201709,2,2017,26,9,201702,2017),('2017-02-27',201709,2,2017,27,9,201702,2017),('2017-02-28',201709,2,2017,28,9,201702,2017),('2017-03-01',201709,3,2017,1,9,201703,2017),('2017-03-02',201709,3,2017,2,9,201703,2017),('2017-03-03',201709,3,2017,3,9,201703,2017),('2017-03-04',201709,3,2017,4,9,201703,2017),('2017-03-05',201710,3,2017,5,10,201703,2017),('2017-03-06',201710,3,2017,6,10,201703,2017),('2017-03-07',201710,3,2017,7,10,201703,2017),('2017-03-08',201710,3,2017,8,10,201703,2017),('2017-03-09',201710,3,2017,9,10,201703,2017),('2017-03-10',201710,3,2017,10,10,201703,2017),('2017-03-11',201710,3,2017,11,10,201703,2017),('2017-03-12',201711,3,2017,12,11,201703,2017),('2017-03-13',201711,3,2017,13,11,201703,2017),('2017-03-14',201711,3,2017,14,11,201703,2017),('2017-03-15',201711,3,2017,15,11,201703,2017),('2017-03-16',201711,3,2017,16,11,201703,2017),('2017-03-17',201711,3,2017,17,11,201703,2017),('2017-03-18',201711,3,2017,18,11,201703,2017),('2017-03-19',201712,3,2017,19,12,201703,2017),('2017-03-20',201712,3,2017,20,12,201703,2017),('2017-03-21',201712,3,2017,21,12,201703,2017),('2017-03-22',201712,3,2017,22,12,201703,2017),('2017-03-23',201712,3,2017,23,12,201703,2017),('2017-03-24',201712,3,2017,24,12,201703,2017),('2017-03-25',201712,3,2017,25,12,201703,2017),('2017-03-26',201713,3,2017,26,13,201703,2017),('2017-03-27',201713,3,2017,27,13,201703,2017),('2017-03-28',201713,3,2017,28,13,201703,2017),('2017-03-29',201713,3,2017,29,13,201703,2017),('2017-03-30',201713,3,2017,30,13,201703,2017),('2017-03-31',201713,3,2017,31,13,201703,2017),('2017-04-01',201713,4,2017,1,13,201704,2017),('2017-04-02',201714,4,2017,2,14,201704,2017),('2017-04-03',201714,4,2017,3,14,201704,2017),('2017-04-04',201714,4,2017,4,14,201704,2017),('2017-04-05',201714,4,2017,5,14,201704,2017),('2017-04-06',201714,4,2017,6,14,201704,2017),('2017-04-07',201714,4,2017,7,14,201704,2017),('2017-04-08',201714,4,2017,8,14,201704,2017),('2017-04-09',201715,4,2017,9,15,201704,2017),('2017-04-10',201715,4,2017,10,15,201704,2017),('2017-04-11',201715,4,2017,11,15,201704,2017),('2017-04-12',201715,4,2017,12,15,201704,2017),('2017-04-13',201715,4,2017,13,15,201704,2017),('2017-04-14',201715,4,2017,14,15,201704,2017),('2017-04-15',201715,4,2017,15,15,201704,2017),('2017-04-16',201716,4,2017,16,16,201704,2017),('2017-04-17',201716,4,2017,17,16,201704,2017),('2017-04-18',201716,4,2017,18,16,201704,2017),('2017-04-19',201716,4,2017,19,16,201704,2017),('2017-04-20',201716,4,2017,20,16,201704,2017),('2017-04-21',201716,4,2017,21,16,201704,2017),('2017-04-22',201716,4,2017,22,16,201704,2017),('2017-04-23',201717,4,2017,23,17,201704,2017),('2017-04-24',201717,4,2017,24,17,201704,2017),('2017-04-25',201717,4,2017,25,17,201704,2017),('2017-04-26',201717,4,2017,26,17,201704,2017),('2017-04-27',201717,4,2017,27,17,201704,2017),('2017-04-28',201717,4,2017,28,17,201704,2017),('2017-04-29',201717,4,2017,29,17,201704,2017),('2017-04-30',201718,4,2017,30,18,201704,2017),('2017-05-01',201718,5,2017,1,18,201705,2017),('2017-05-02',201718,5,2017,2,18,201705,2017),('2017-05-03',201718,5,2017,3,18,201705,2017),('2017-05-04',201718,5,2017,4,18,201705,2017),('2017-05-05',201718,5,2017,5,18,201705,2017),('2017-05-06',201718,5,2017,6,18,201705,2017),('2017-05-07',201719,5,2017,7,19,201705,2017),('2017-05-08',201719,5,2017,8,19,201705,2017),('2017-05-09',201719,5,2017,9,19,201705,2017),('2017-05-10',201719,5,2017,10,19,201705,2017),('2017-05-11',201719,5,2017,11,19,201705,2017),('2017-05-12',201719,5,2017,12,19,201705,2017),('2017-05-13',201719,5,2017,13,19,201705,2017),('2017-05-14',201720,5,2017,14,20,201705,2017),('2017-05-15',201720,5,2017,15,20,201705,2017),('2017-05-16',201720,5,2017,16,20,201705,2017),('2017-05-17',201720,5,2017,17,20,201705,2017),('2017-05-18',201720,5,2017,18,20,201705,2017),('2017-05-19',201720,5,2017,19,20,201705,2017),('2017-05-20',201720,5,2017,20,20,201705,2017),('2017-05-21',201721,5,2017,21,21,201705,2017),('2017-05-22',201721,5,2017,22,21,201705,2017),('2017-05-23',201721,5,2017,23,21,201705,2017),('2017-05-24',201721,5,2017,24,21,201705,2017),('2017-05-25',201721,5,2017,25,21,201705,2017),('2017-05-26',201721,5,2017,26,21,201705,2017),('2017-05-27',201721,5,2017,27,21,201705,2017),('2017-05-28',201722,5,2017,28,22,201705,2017),('2017-05-29',201722,5,2017,29,22,201705,2017),('2017-05-30',201722,5,2017,30,22,201705,2017),('2017-05-31',201722,5,2017,31,22,201705,2017),('2017-06-01',201722,6,2017,1,22,201706,2017),('2017-06-02',201722,6,2017,2,22,201706,2017),('2017-06-03',201722,6,2017,3,22,201706,2017),('2017-06-04',201723,6,2017,4,23,201706,2017),('2017-06-05',201723,6,2017,5,23,201706,2017),('2017-06-06',201723,6,2017,6,23,201706,2017),('2017-06-07',201723,6,2017,7,23,201706,2017),('2017-06-08',201723,6,2017,8,23,201706,2017),('2017-06-09',201723,6,2017,9,23,201706,2017),('2017-06-10',201723,6,2017,10,23,201706,2017),('2017-06-11',201724,6,2017,11,24,201706,2017),('2017-06-12',201724,6,2017,12,24,201706,2017),('2017-06-13',201724,6,2017,13,24,201706,2017),('2017-06-14',201724,6,2017,14,24,201706,2017),('2017-06-15',201724,6,2017,15,24,201706,2017),('2017-06-16',201724,6,2017,16,24,201706,2017),('2017-06-17',201724,6,2017,17,24,201706,2017),('2017-06-18',201725,6,2017,18,25,201706,2017),('2017-06-19',201725,6,2017,19,25,201706,2017),('2017-06-20',201725,6,2017,20,25,201706,2017),('2017-06-21',201725,6,2017,21,25,201706,2017),('2017-06-22',201725,6,2017,22,25,201706,2017),('2017-06-23',201725,6,2017,23,25,201706,2017),('2017-06-24',201725,6,2017,24,25,201706,2017),('2017-06-25',201726,6,2017,25,26,201706,2017),('2017-06-26',201726,6,2017,26,26,201706,2017),('2017-06-27',201726,6,2017,27,26,201706,2017),('2017-06-28',201726,6,2017,28,26,201706,2017),('2017-06-29',201726,6,2017,29,26,201706,2017),('2017-06-30',201726,6,2017,30,26,201706,2017),('2017-07-01',201726,7,2017,1,26,201707,2017),('2017-07-02',201727,7,2017,2,27,201707,2017),('2017-07-03',201727,7,2017,3,27,201707,2017),('2017-07-04',201727,7,2017,4,27,201707,2017),('2017-07-05',201727,7,2017,5,27,201707,2017),('2017-07-06',201727,7,2017,6,27,201707,2017),('2017-07-07',201727,7,2017,7,27,201707,2017),('2017-07-08',201727,7,2017,8,27,201707,2017),('2017-07-09',201728,7,2017,9,28,201707,2017),('2017-07-10',201728,7,2017,10,28,201707,2017),('2017-07-11',201728,7,2017,11,28,201707,2017),('2017-07-12',201728,7,2017,12,28,201707,2017),('2017-07-13',201728,7,2017,13,28,201707,2017),('2017-07-14',201728,7,2017,14,28,201707,2017),('2017-07-15',201728,7,2017,15,28,201707,2017),('2017-07-16',201729,7,2017,16,29,201707,2017),('2017-07-17',201729,7,2017,17,29,201707,2017),('2017-07-18',201729,7,2017,18,29,201707,2017),('2017-07-19',201729,7,2017,19,29,201707,2017),('2017-07-20',201729,7,2017,20,29,201707,2017),('2017-07-21',201729,7,2017,21,29,201707,2017),('2017-07-22',201729,7,2017,22,29,201707,2017),('2017-07-23',201730,7,2017,23,30,201707,2017),('2017-07-24',201730,7,2017,24,30,201707,2017),('2017-07-25',201730,7,2017,25,30,201707,2017),('2017-07-26',201730,7,2017,26,30,201707,2017),('2017-07-27',201730,7,2017,27,30,201707,2017),('2017-07-28',201730,7,2017,28,30,201707,2017),('2017-07-29',201730,7,2017,29,30,201707,2017),('2017-07-30',201731,7,2017,30,31,201707,2017),('2017-07-31',201731,7,2017,31,31,201707,2017),('2017-08-01',201731,8,2017,1,31,201708,2017),('2017-08-02',201731,8,2017,2,31,201708,2017),('2017-08-03',201731,8,2017,3,31,201708,2017),('2017-08-04',201731,8,2017,4,31,201708,2017),('2017-08-05',201731,8,2017,5,31,201708,2017),('2017-08-06',201732,8,2017,6,32,201708,2017),('2017-08-07',201732,8,2017,7,32,201708,2017),('2017-08-08',201732,8,2017,8,32,201708,2017),('2017-08-09',201732,8,2017,9,32,201708,2017),('2017-08-10',201732,8,2017,10,32,201708,2017),('2017-08-11',201732,8,2017,11,32,201708,2017),('2017-08-12',201732,8,2017,12,32,201708,2017),('2017-08-13',201733,8,2017,13,33,201708,2017),('2017-08-14',201733,8,2017,14,33,201708,2017),('2017-08-15',201733,8,2017,15,33,201708,2017),('2017-08-16',201733,8,2017,16,33,201708,2017),('2017-08-17',201733,8,2017,17,33,201708,2017),('2017-08-18',201733,8,2017,18,33,201708,2017),('2017-08-19',201733,8,2017,19,33,201708,2017),('2017-08-20',201734,8,2017,20,34,201708,2017),('2017-08-21',201734,8,2017,21,34,201708,2017),('2017-08-22',201734,8,2017,22,34,201708,2017),('2017-08-23',201734,8,2017,23,34,201708,2017),('2017-08-24',201734,8,2017,24,34,201708,2017),('2017-08-25',201734,8,2017,25,34,201708,2017),('2017-08-26',201734,8,2017,26,34,201708,2017),('2017-08-27',201735,8,2017,27,35,201708,2017),('2017-08-28',201735,8,2017,28,35,201708,2017),('2017-08-29',201735,8,2017,29,35,201708,2017),('2017-08-30',201735,8,2017,30,35,201708,2017),('2017-08-31',201735,8,2017,31,35,201708,2017),('2017-09-01',201735,9,2017,1,35,201709,2017),('2017-09-02',201735,9,2017,2,35,201709,2017),('2017-09-03',201736,9,2017,3,36,201709,2017),('2017-09-04',201736,9,2017,4,36,201709,2017),('2017-09-05',201736,9,2017,5,36,201709,2017),('2017-09-06',201736,9,2017,6,36,201709,2017),('2017-09-07',201736,9,2017,7,36,201709,2017),('2017-09-08',201736,9,2017,8,36,201709,2017),('2017-09-09',201736,9,2017,9,36,201709,2017),('2017-09-10',201737,9,2017,10,37,201709,2017),('2017-09-11',201737,9,2017,11,37,201709,2017),('2017-09-12',201737,9,2017,12,37,201709,2017),('2017-09-13',201737,9,2017,13,37,201709,2017),('2017-09-14',201737,9,2017,14,37,201709,2017),('2017-09-15',201737,9,2017,15,37,201709,2017),('2017-09-16',201737,9,2017,16,37,201709,2017),('2017-09-17',201738,9,2017,17,38,201709,2017),('2017-09-18',201738,9,2017,18,38,201709,2017),('2017-09-19',201738,9,2017,19,38,201709,2017),('2017-09-20',201738,9,2017,20,38,201709,2017),('2017-09-21',201738,9,2017,21,38,201709,2017),('2017-09-22',201738,9,2017,22,38,201709,2017),('2017-09-23',201738,9,2017,23,38,201709,2017),('2017-09-24',201739,9,2017,24,39,201709,2017),('2017-09-25',201739,9,2017,25,39,201709,2017),('2017-09-26',201739,9,2017,26,39,201709,2017),('2017-09-27',201739,9,2017,27,39,201709,2017),('2017-09-28',201739,9,2017,28,39,201709,2017),('2017-09-29',201739,9,2017,29,39,201709,2017),('2017-09-30',201739,9,2017,30,39,201709,2017),('2017-10-01',201740,10,2017,1,40,201710,2017),('2017-10-02',201740,10,2017,2,40,201710,2017),('2017-10-03',201740,10,2017,3,40,201710,2017),('2017-10-04',201740,10,2017,4,40,201710,2017),('2017-10-05',201740,10,2017,5,40,201710,2017),('2017-10-06',201740,10,2017,6,40,201710,2017),('2017-10-07',201740,10,2017,7,40,201710,2017),('2017-10-08',201741,10,2017,8,41,201710,2017),('2017-10-09',201741,10,2017,9,41,201710,2017),('2017-10-10',201741,10,2017,10,41,201710,2017),('2017-10-11',201741,10,2017,11,41,201710,2017),('2017-10-12',201741,10,2017,12,41,201710,2017),('2017-10-13',201741,10,2017,13,41,201710,2017),('2017-10-14',201741,10,2017,14,41,201710,2017),('2017-10-15',201742,10,2017,15,42,201710,2017),('2017-10-16',201742,10,2017,16,42,201710,2017),('2017-10-17',201742,10,2017,17,42,201710,2017),('2017-10-18',201742,10,2017,18,42,201710,2017),('2017-10-19',201742,10,2017,19,42,201710,2017),('2017-10-20',201742,10,2017,20,42,201710,2017),('2017-10-21',201742,10,2017,21,42,201710,2017),('2017-10-22',201743,10,2017,22,43,201710,2017),('2017-10-23',201743,10,2017,23,43,201710,2017),('2017-10-24',201743,10,2017,24,43,201710,2017),('2017-10-25',201743,10,2017,25,43,201710,2017),('2017-10-26',201743,10,2017,26,43,201710,2017),('2017-10-27',201743,10,2017,27,43,201710,2017),('2017-10-28',201743,10,2017,28,43,201710,2017),('2017-10-29',201744,10,2017,29,44,201710,2017),('2017-10-30',201744,10,2017,30,44,201710,2017),('2017-10-31',201744,10,2017,31,44,201710,2017),('2017-11-01',201744,11,2017,1,44,201711,2017),('2017-11-02',201744,11,2017,2,44,201711,2017),('2017-11-03',201744,11,2017,3,44,201711,2017),('2017-11-04',201744,11,2017,4,44,201711,2017),('2017-11-05',201745,11,2017,5,45,201711,2017),('2017-11-06',201745,11,2017,6,45,201711,2017),('2017-11-07',201745,11,2017,7,45,201711,2017),('2017-11-08',201745,11,2017,8,45,201711,2017),('2017-11-09',201745,11,2017,9,45,201711,2017),('2017-11-10',201745,11,2017,10,45,201711,2017),('2017-11-11',201745,11,2017,11,45,201711,2017),('2017-11-12',201746,11,2017,12,46,201711,2017),('2017-11-13',201746,11,2017,13,46,201711,2017),('2017-11-14',201746,11,2017,14,46,201711,2017),('2017-11-15',201746,11,2017,15,46,201711,2017),('2017-11-16',201746,11,2017,16,46,201711,2017),('2017-11-17',201746,11,2017,17,46,201711,2017),('2017-11-18',201746,11,2017,18,46,201711,2017),('2017-11-19',201747,11,2017,19,47,201711,2017),('2017-11-20',201747,11,2017,20,47,201711,2017),('2017-11-21',201747,11,2017,21,47,201711,2017),('2017-11-22',201747,11,2017,22,47,201711,2017),('2017-11-23',201747,11,2017,23,47,201711,2017),('2017-11-24',201747,11,2017,24,47,201711,2017),('2017-11-25',201747,11,2017,25,47,201711,2017),('2017-11-26',201748,11,2017,26,48,201711,2017),('2017-11-27',201748,11,2017,27,48,201711,2017),('2017-11-28',201748,11,2017,28,48,201711,2017),('2017-11-29',201748,11,2017,29,48,201711,2017),('2017-11-30',201748,11,2017,30,48,201711,2017),('2017-12-01',201748,12,2017,1,48,201712,2018),('2017-12-02',201748,12,2017,2,48,201712,2018),('2017-12-03',201749,12,2017,3,49,201712,2018),('2017-12-04',201749,12,2017,4,49,201712,2018),('2017-12-05',201749,12,2017,5,49,201712,2018),('2017-12-06',201749,12,2017,6,49,201712,2018),('2017-12-07',201749,12,2017,7,49,201712,2018),('2017-12-08',201749,12,2017,8,49,201712,2018),('2017-12-09',201749,12,2017,9,49,201712,2018),('2017-12-10',201750,12,2017,10,50,201712,2018),('2017-12-11',201750,12,2017,11,50,201712,2018),('2017-12-12',201750,12,2017,12,50,201712,2018),('2017-12-13',201750,12,2017,13,50,201712,2018),('2017-12-14',201750,12,2017,14,50,201712,2018),('2017-12-15',201750,12,2017,15,50,201712,2018),('2017-12-16',201750,12,2017,16,50,201712,2018),('2017-12-17',201751,12,2017,17,51,201712,2018),('2017-12-18',201751,12,2017,18,51,201712,2018),('2017-12-19',201751,12,2017,19,51,201712,2018),('2017-12-20',201751,12,2017,20,51,201712,2018),('2017-12-21',201751,12,2017,21,51,201712,2018),('2017-12-22',201751,12,2017,22,51,201712,2018),('2017-12-23',201751,12,2017,23,51,201712,2018),('2017-12-24',201752,12,2017,24,52,201712,2018),('2017-12-25',201752,12,2017,25,52,201712,2018),('2017-12-26',201752,12,2017,26,52,201712,2018),('2017-12-27',201752,12,2017,27,52,201712,2018),('2017-12-28',201752,12,2017,28,52,201712,2018),('2017-12-29',201752,12,2017,29,52,201712,2018),('2017-12-30',201752,12,2017,30,52,201712,2018),('2017-12-31',201801,12,2017,31,1,201712,2018),('2018-01-01',201801,1,2018,1,1,201801,2018),('2018-01-02',201801,1,2018,2,1,201801,2018),('2018-01-03',201801,1,2018,3,1,201801,2018),('2018-01-04',201801,1,2018,4,1,201801,2018),('2018-01-05',201801,1,2018,5,1,201801,2018),('2018-01-06',201801,1,2018,6,1,201801,2018),('2018-01-07',201802,1,2018,7,2,201801,2018),('2018-01-08',201802,1,2018,8,2,201801,2018),('2018-01-09',201802,1,2018,9,2,201801,2018),('2018-01-10',201802,1,2018,10,2,201801,2018),('2018-01-11',201802,1,2018,11,2,201801,2018),('2018-01-12',201802,1,2018,12,2,201801,2018),('2018-01-13',201802,1,2018,13,2,201801,2018),('2018-01-14',201803,1,2018,14,3,201801,2018),('2018-01-15',201803,1,2018,15,3,201801,2018),('2018-01-16',201803,1,2018,16,3,201801,2018),('2018-01-17',201803,1,2018,17,3,201801,2018),('2018-01-18',201803,1,2018,18,3,201801,2018),('2018-01-19',201803,1,2018,19,3,201801,2018),('2018-01-20',201803,1,2018,20,3,201801,2018),('2018-01-21',201804,1,2018,21,4,201801,2018),('2018-01-22',201804,1,2018,22,4,201801,2018),('2018-01-23',201804,1,2018,23,4,201801,2018),('2018-01-24',201804,1,2018,24,4,201801,2018),('2018-01-25',201804,1,2018,25,4,201801,2018),('2018-01-26',201804,1,2018,26,4,201801,2018),('2018-01-27',201804,1,2018,27,4,201801,2018),('2018-01-28',201805,1,2018,28,5,201801,2018),('2018-01-29',201805,1,2018,29,5,201801,2018),('2018-01-30',201805,1,2018,30,5,201801,2018),('2018-01-31',201805,1,2018,31,5,201801,2018),('2018-02-01',201805,2,2018,1,5,201802,2018),('2018-02-02',201805,2,2018,2,5,201802,2018),('2018-02-03',201805,2,2018,3,5,201802,2018),('2018-02-04',201806,2,2018,4,6,201802,2018),('2018-02-05',201806,2,2018,5,6,201802,2018),('2018-02-06',201806,2,2018,6,6,201802,2018),('2018-02-07',201806,2,2018,7,6,201802,2018),('2018-02-08',201806,2,2018,8,6,201802,2018),('2018-02-09',201806,2,2018,9,6,201802,2018),('2018-02-10',201806,2,2018,10,6,201802,2018),('2018-02-11',201807,2,2018,11,7,201802,2018),('2018-02-12',201807,2,2018,12,7,201802,2018),('2018-02-13',201807,2,2018,13,7,201802,2018),('2018-02-14',201807,2,2018,14,7,201802,2018),('2018-02-15',201807,2,2018,15,7,201802,2018),('2018-02-16',201807,2,2018,16,7,201802,2018),('2018-02-17',201807,2,2018,17,7,201802,2018),('2018-02-18',201808,2,2018,18,8,201802,2018),('2018-02-19',201808,2,2018,19,8,201802,2018),('2018-02-20',201808,2,2018,20,8,201802,2018),('2018-02-21',201808,2,2018,21,8,201802,2018),('2018-02-22',201808,2,2018,22,8,201802,2018),('2018-02-23',201808,2,2018,23,8,201802,2018),('2018-02-24',201808,2,2018,24,8,201802,2018),('2018-02-25',201809,2,2018,25,9,201802,2018),('2018-02-26',201809,2,2018,26,9,201802,2018),('2018-02-27',201809,2,2018,27,9,201802,2018),('2018-02-28',201809,2,2018,28,9,201802,2018),('2018-03-01',201809,3,2018,1,9,201803,2018),('2018-03-02',201809,3,2018,2,9,201803,2018),('2018-03-03',201809,3,2018,3,9,201803,2018),('2018-03-04',201810,3,2018,4,10,201803,2018),('2018-03-05',201810,3,2018,5,10,201803,2018),('2018-03-06',201810,3,2018,6,10,201803,2018),('2018-03-07',201810,3,2018,7,10,201803,2018),('2018-03-08',201810,3,2018,8,10,201803,2018),('2018-03-09',201810,3,2018,9,10,201803,2018),('2018-03-10',201810,3,2018,10,10,201803,2018),('2018-03-11',201811,3,2018,11,11,201803,2018),('2018-03-12',201811,3,2018,12,11,201803,2018),('2018-03-13',201811,3,2018,13,11,201803,2018),('2018-03-14',201811,3,2018,14,11,201803,2018),('2018-03-15',201811,3,2018,15,11,201803,2018),('2018-03-16',201811,3,2018,16,11,201803,2018),('2018-03-17',201811,3,2018,17,11,201803,2018),('2018-03-18',201812,3,2018,18,12,201803,2018),('2018-03-19',201812,3,2018,19,12,201803,2018),('2018-03-20',201812,3,2018,20,12,201803,2018),('2018-03-21',201812,3,2018,21,12,201803,2018),('2018-03-22',201812,3,2018,22,12,201803,2018),('2018-03-23',201812,3,2018,23,12,201803,2018),('2018-03-24',201812,3,2018,24,12,201803,2018),('2018-03-25',201813,3,2018,25,13,201803,2018),('2018-03-26',201813,3,2018,26,13,201803,2018),('2018-03-27',201813,3,2018,27,13,201803,2018),('2018-03-28',201813,3,2018,28,13,201803,2018),('2018-03-29',201813,3,2018,29,13,201803,2018),('2018-03-30',201813,3,2018,30,13,201803,2018),('2018-03-31',201813,3,2018,31,13,201803,2018),('2018-04-01',201814,4,2018,1,14,201804,2018),('2018-04-02',201814,4,2018,2,14,201804,2018),('2018-04-03',201814,4,2018,3,14,201804,2018),('2018-04-04',201814,4,2018,4,14,201804,2018),('2018-04-05',201814,4,2018,5,14,201804,2018),('2018-04-06',201814,4,2018,6,14,201804,2018),('2018-04-07',201814,4,2018,7,14,201804,2018),('2018-04-08',201815,4,2018,8,15,201804,2018),('2018-04-09',201815,4,2018,9,15,201804,2018),('2018-04-10',201815,4,2018,10,15,201804,2018),('2018-04-11',201815,4,2018,11,15,201804,2018),('2018-04-12',201815,4,2018,12,15,201804,2018),('2018-04-13',201815,4,2018,13,15,201804,2018),('2018-04-14',201815,4,2018,14,15,201804,2018),('2018-04-15',201816,4,2018,15,16,201804,2018),('2018-04-16',201816,4,2018,16,16,201804,2018),('2018-04-17',201816,4,2018,17,16,201804,2018),('2018-04-18',201816,4,2018,18,16,201804,2018),('2018-04-19',201816,4,2018,19,16,201804,2018),('2018-04-20',201816,4,2018,20,16,201804,2018),('2018-04-21',201816,4,2018,21,16,201804,2018),('2018-04-22',201817,4,2018,22,17,201804,2018),('2018-04-23',201817,4,2018,23,17,201804,2018),('2018-04-24',201817,4,2018,24,17,201804,2018),('2018-04-25',201817,4,2018,25,17,201804,2018),('2018-04-26',201817,4,2018,26,17,201804,2018),('2018-04-27',201817,4,2018,27,17,201804,2018),('2018-04-28',201817,4,2018,28,17,201804,2018),('2018-04-29',201818,4,2018,29,18,201804,2018),('2018-04-30',201818,4,2018,30,18,201804,2018),('2018-05-01',201818,5,2018,1,18,201805,2018),('2018-05-02',201818,5,2018,2,18,201805,2018),('2018-05-03',201818,5,2018,3,18,201805,2018),('2018-05-04',201818,5,2018,4,18,201805,2018),('2018-05-05',201818,5,2018,5,18,201805,2018),('2018-05-06',201819,5,2018,6,19,201805,2018),('2018-05-07',201819,5,2018,7,19,201805,2018),('2018-05-08',201819,5,2018,8,19,201805,2018),('2018-05-09',201819,5,2018,9,19,201805,2018),('2018-05-10',201819,5,2018,10,19,201805,2018),('2018-05-11',201819,5,2018,11,19,201805,2018),('2018-05-12',201819,5,2018,12,19,201805,2018),('2018-05-13',201820,5,2018,13,20,201805,2018),('2018-05-14',201820,5,2018,14,20,201805,2018),('2018-05-15',201820,5,2018,15,20,201805,2018),('2018-05-16',201820,5,2018,16,20,201805,2018),('2018-05-17',201820,5,2018,17,20,201805,2018),('2018-05-18',201820,5,2018,18,20,201805,2018),('2018-05-19',201820,5,2018,19,20,201805,2018),('2018-05-20',201821,5,2018,20,21,201805,2018),('2018-05-21',201821,5,2018,21,21,201805,2018),('2018-05-22',201821,5,2018,22,21,201805,2018),('2018-05-23',201821,5,2018,23,21,201805,2018),('2018-05-24',201821,5,2018,24,21,201805,2018),('2018-05-25',201821,5,2018,25,21,201805,2018),('2018-05-26',201821,5,2018,26,21,201805,2018),('2018-05-27',201822,5,2018,27,22,201805,2018),('2018-05-28',201822,5,2018,28,22,201805,2018),('2018-05-29',201822,5,2018,29,22,201805,2018),('2018-05-30',201822,5,2018,30,22,201805,2018),('2018-05-31',201822,5,2018,31,22,201805,2018),('2018-06-01',201822,6,2018,1,22,201806,2018),('2018-06-02',201822,6,2018,2,22,201806,2018),('2018-06-03',201823,6,2018,3,23,201806,2018),('2018-06-04',201823,6,2018,4,23,201806,2018),('2018-06-05',201823,6,2018,5,23,201806,2018),('2018-06-06',201823,6,2018,6,23,201806,2018),('2018-06-07',201823,6,2018,7,23,201806,2018),('2018-06-08',201823,6,2018,8,23,201806,2018),('2018-06-09',201823,6,2018,9,23,201806,2018),('2018-06-10',201824,6,2018,10,24,201806,2018),('2018-06-11',201824,6,2018,11,24,201806,2018),('2018-06-12',201824,6,2018,12,24,201806,2018),('2018-06-13',201824,6,2018,13,24,201806,2018),('2018-06-14',201824,6,2018,14,24,201806,2018),('2018-06-15',201824,6,2018,15,24,201806,2018),('2018-06-16',201824,6,2018,16,24,201806,2018),('2018-06-17',201825,6,2018,17,25,201806,2018),('2018-06-18',201825,6,2018,18,25,201806,2018),('2018-06-19',201825,6,2018,19,25,201806,2018),('2018-06-20',201825,6,2018,20,25,201806,2018),('2018-06-21',201825,6,2018,21,25,201806,2018),('2018-06-22',201825,6,2018,22,25,201806,2018),('2018-06-23',201825,6,2018,23,25,201806,2018),('2018-06-24',201826,6,2018,24,26,201806,2018),('2018-06-25',201826,6,2018,25,26,201806,2018),('2018-06-26',201826,6,2018,26,26,201806,2018),('2018-06-27',201826,6,2018,27,26,201806,2018),('2018-06-28',201826,6,2018,28,26,201806,2018),('2018-06-29',201826,6,2018,29,26,201806,2018),('2018-06-30',201826,6,2018,30,26,201806,2018),('2018-07-01',201827,7,2018,1,27,201807,2018),('2018-07-02',201827,7,2018,2,27,201807,2018),('2018-07-03',201827,7,2018,3,27,201807,2018),('2018-07-04',201827,7,2018,4,27,201807,2018),('2018-07-05',201827,7,2018,5,27,201807,2018),('2018-07-06',201827,7,2018,6,27,201807,2018),('2018-07-07',201827,7,2018,7,27,201807,2018),('2018-07-08',201828,7,2018,8,28,201807,2018),('2018-07-09',201828,7,2018,9,28,201807,2018),('2018-07-10',201828,7,2018,10,28,201807,2018),('2018-07-11',201828,7,2018,11,28,201807,2018),('2018-07-12',201828,7,2018,12,28,201807,2018),('2018-07-13',201828,7,2018,13,28,201807,2018),('2018-07-14',201828,7,2018,14,28,201807,2018),('2018-07-15',201829,7,2018,15,29,201807,2018),('2018-07-16',201829,7,2018,16,29,201807,2018),('2018-07-17',201829,7,2018,17,29,201807,2018),('2018-07-18',201829,7,2018,18,29,201807,2018),('2018-07-19',201829,7,2018,19,29,201807,2018),('2018-07-20',201829,7,2018,20,29,201807,2018),('2018-07-21',201829,7,2018,21,29,201807,2018),('2018-07-22',201830,7,2018,22,30,201807,2018),('2018-07-23',201830,7,2018,23,30,201807,2018),('2018-07-24',201830,7,2018,24,30,201807,2018),('2018-07-25',201830,7,2018,25,30,201807,2018),('2018-07-26',201830,7,2018,26,30,201807,2018),('2018-07-27',201830,7,2018,27,30,201807,2018),('2018-07-28',201830,7,2018,28,30,201807,2018),('2018-07-29',201831,7,2018,29,31,201807,2018),('2018-07-30',201831,7,2018,30,31,201807,2018),('2018-07-31',201831,7,2018,31,31,201807,2018),('2018-08-01',201831,8,2018,1,31,201808,2018),('2018-08-02',201831,8,2018,2,31,201808,2018),('2018-08-03',201831,8,2018,3,31,201808,2018),('2018-08-04',201831,8,2018,4,31,201808,2018),('2018-08-05',201832,8,2018,5,32,201808,2018),('2018-08-06',201832,8,2018,6,32,201808,2018),('2018-08-07',201832,8,2018,7,32,201808,2018),('2018-08-08',201832,8,2018,8,32,201808,2018),('2018-08-09',201832,8,2018,9,32,201808,2018),('2018-08-10',201832,8,2018,10,32,201808,2018),('2018-08-11',201832,8,2018,11,32,201808,2018),('2018-08-12',201833,8,2018,12,33,201808,2018),('2018-08-13',201833,8,2018,13,33,201808,2018),('2018-08-14',201833,8,2018,14,33,201808,2018),('2018-08-15',201833,8,2018,15,33,201808,2018),('2018-08-16',201833,8,2018,16,33,201808,2018),('2018-08-17',201833,8,2018,17,33,201808,2018),('2018-08-18',201833,8,2018,18,33,201808,2018),('2018-08-19',201834,8,2018,19,34,201808,2018),('2018-08-20',201834,8,2018,20,34,201808,2018),('2018-08-21',201834,8,2018,21,34,201808,2018),('2018-08-22',201834,8,2018,22,34,201808,2018),('2018-08-23',201834,8,2018,23,34,201808,2018),('2018-08-24',201834,8,2018,24,34,201808,2018),('2018-08-25',201834,8,2018,25,34,201808,2018),('2018-08-26',201835,8,2018,26,35,201808,2018),('2018-08-27',201835,8,2018,27,35,201808,2018),('2018-08-28',201835,8,2018,28,35,201808,2018),('2018-08-29',201835,8,2018,29,35,201808,2018),('2018-08-30',201835,8,2018,30,35,201808,2018),('2018-08-31',201835,8,2018,31,35,201808,2018),('2018-09-01',201835,9,2018,1,35,201809,2018),('2018-09-02',201836,9,2018,2,36,201809,2018),('2018-09-03',201836,9,2018,3,36,201809,2018),('2018-09-04',201836,9,2018,4,36,201809,2018),('2018-09-05',201836,9,2018,5,36,201809,2018),('2018-09-06',201836,9,2018,6,36,201809,2018),('2018-09-07',201836,9,2018,7,36,201809,2018),('2018-09-08',201836,9,2018,8,36,201809,2018),('2018-09-09',201837,9,2018,9,37,201809,2018),('2018-09-10',201837,9,2018,10,37,201809,2018),('2018-09-11',201837,9,2018,11,37,201809,2018),('2018-09-12',201837,9,2018,12,37,201809,2018),('2018-09-13',201837,9,2018,13,37,201809,2018),('2018-09-14',201837,9,2018,14,37,201809,2018),('2018-09-15',201837,9,2018,15,37,201809,2018),('2018-09-16',201838,9,2018,16,38,201809,2018),('2018-09-17',201838,9,2018,17,38,201809,2018),('2018-09-18',201838,9,2018,18,38,201809,2018),('2018-09-19',201838,9,2018,19,38,201809,2018),('2018-09-20',201838,9,2018,20,38,201809,2018),('2018-09-21',201838,9,2018,21,38,201809,2018),('2018-09-22',201838,9,2018,22,38,201809,2018),('2018-09-23',201839,9,2018,23,39,201809,2018),('2018-09-24',201839,9,2018,24,39,201809,2018),('2018-09-25',201839,9,2018,25,39,201809,2018),('2018-09-26',201839,9,2018,26,39,201809,2018),('2018-09-27',201839,9,2018,27,39,201809,2018),('2018-09-28',201839,9,2018,28,39,201809,2018),('2018-09-29',201839,9,2018,29,39,201809,2018),('2018-09-30',201840,9,2018,30,40,201809,2018),('2018-10-01',201840,10,2018,1,40,201810,2018),('2018-10-02',201840,10,2018,2,40,201810,2018),('2018-10-03',201840,10,2018,3,40,201810,2018),('2018-10-04',201840,10,2018,4,40,201810,2018),('2018-10-05',201840,10,2018,5,40,201810,2018),('2018-10-06',201840,10,2018,6,40,201810,2018),('2018-10-07',201841,10,2018,7,41,201810,2018),('2018-10-08',201841,10,2018,8,41,201810,2018),('2018-10-09',201841,10,2018,9,41,201810,2018),('2018-10-10',201841,10,2018,10,41,201810,2018),('2018-10-11',201841,10,2018,11,41,201810,2018),('2018-10-12',201841,10,2018,12,41,201810,2018),('2018-10-13',201841,10,2018,13,41,201810,2018),('2018-10-14',201842,10,2018,14,42,201810,2018),('2018-10-15',201842,10,2018,15,42,201810,2018),('2018-10-16',201842,10,2018,16,42,201810,2018),('2018-10-17',201842,10,2018,17,42,201810,2018),('2018-10-18',201842,10,2018,18,42,201810,2018),('2018-10-19',201842,10,2018,19,42,201810,2018),('2018-10-20',201842,10,2018,20,42,201810,2018),('2018-10-21',201843,10,2018,21,43,201810,2018),('2018-10-22',201843,10,2018,22,43,201810,2018),('2018-10-23',201843,10,2018,23,43,201810,2018),('2018-10-24',201843,10,2018,24,43,201810,2018),('2018-10-25',201843,10,2018,25,43,201810,2018),('2018-10-26',201843,10,2018,26,43,201810,2018),('2018-10-27',201843,10,2018,27,43,201810,2018),('2018-10-28',201844,10,2018,28,44,201810,2018),('2018-10-29',201844,10,2018,29,44,201810,2018),('2018-10-30',201844,10,2018,30,44,201810,2018),('2018-10-31',201844,10,2018,31,44,201810,2018),('2018-11-01',201844,11,2018,1,44,201811,2018),('2018-11-02',201844,11,2018,2,44,201811,2018),('2018-11-03',201844,11,2018,3,44,201811,2018),('2018-11-04',201845,11,2018,4,45,201811,2018),('2018-11-05',201845,11,2018,5,45,201811,2018),('2018-11-06',201845,11,2018,6,45,201811,2018),('2018-11-07',201845,11,2018,7,45,201811,2018),('2018-11-08',201845,11,2018,8,45,201811,2018),('2018-11-09',201845,11,2018,9,45,201811,2018),('2018-11-10',201845,11,2018,10,45,201811,2018),('2018-11-11',201846,11,2018,11,46,201811,2018),('2018-11-12',201846,11,2018,12,46,201811,2018),('2018-11-13',201846,11,2018,13,46,201811,2018),('2018-11-14',201846,11,2018,14,46,201811,2018),('2018-11-15',201846,11,2018,15,46,201811,2018),('2018-11-16',201846,11,2018,16,46,201811,2018),('2018-11-17',201846,11,2018,17,46,201811,2018),('2018-11-18',201847,11,2018,18,47,201811,2018),('2018-11-19',201847,11,2018,19,47,201811,2018),('2018-11-20',201847,11,2018,20,47,201811,2018),('2018-11-21',201847,11,2018,21,47,201811,2018),('2018-11-22',201847,11,2018,22,47,201811,2018),('2018-11-23',201847,11,2018,23,47,201811,2018),('2018-11-24',201847,11,2018,24,47,201811,2018),('2018-11-25',201848,11,2018,25,48,201811,2018),('2018-11-26',201848,11,2018,26,48,201811,2018),('2018-11-27',201848,11,2018,27,48,201811,2018),('2018-11-28',201848,11,2018,28,48,201811,2018),('2018-11-29',201848,11,2018,29,48,201811,2018),('2018-11-30',201848,11,2018,30,48,201811,2018),('2018-12-01',201848,12,2018,1,48,201812,2019),('2018-12-02',201849,12,2018,2,49,201812,2019),('2018-12-03',201849,12,2018,3,49,201812,2019),('2018-12-04',201849,12,2018,4,49,201812,2019),('2018-12-05',201849,12,2018,5,49,201812,2019),('2018-12-06',201849,12,2018,6,49,201812,2019),('2018-12-07',201849,12,2018,7,49,201812,2019),('2018-12-08',201849,12,2018,8,49,201812,2019),('2018-12-09',201850,12,2018,9,50,201812,2019),('2018-12-10',201850,12,2018,10,50,201812,2019),('2018-12-11',201850,12,2018,11,50,201812,2019),('2018-12-12',201850,12,2018,12,50,201812,2019),('2018-12-13',201850,12,2018,13,50,201812,2019),('2018-12-14',201850,12,2018,14,50,201812,2019),('2018-12-15',201850,12,2018,15,50,201812,2019),('2018-12-16',201851,12,2018,16,51,201812,2019),('2018-12-17',201851,12,2018,17,51,201812,2019),('2018-12-18',201851,12,2018,18,51,201812,2019),('2018-12-19',201851,12,2018,19,51,201812,2019),('2018-12-20',201851,12,2018,20,51,201812,2019),('2018-12-21',201851,12,2018,21,51,201812,2019),('2018-12-22',201851,12,2018,22,51,201812,2019),('2018-12-23',201852,12,2018,23,52,201812,2019),('2018-12-24',201852,12,2018,24,52,201812,2019),('2018-12-25',201852,12,2018,25,52,201812,2019),('2018-12-26',201852,12,2018,26,52,201812,2019),('2018-12-27',201852,12,2018,27,52,201812,2019),('2018-12-28',201852,12,2018,28,52,201812,2019),('2018-12-29',201852,12,2018,29,52,201812,2019),('2018-12-30',201901,12,2019,30,1,201812,2019),('2018-12-31',201901,12,2019,31,1,201812,2019),('2019-01-01',201901,1,2019,1,1,201901,2019),('2019-01-02',201901,1,2019,2,1,201901,2019),('2019-01-03',201901,1,2019,3,1,201901,2019),('2019-01-04',201901,1,2019,4,1,201901,2019),('2019-01-05',201901,1,2019,5,1,201901,2019),('2019-01-06',201902,1,2019,6,2,201901,2019),('2019-01-07',201902,1,2019,7,2,201901,2019),('2019-01-08',201902,1,2019,8,2,201901,2019),('2019-01-09',201902,1,2019,9,2,201901,2019),('2019-01-10',201902,1,2019,10,2,201901,2019),('2019-01-11',201902,1,2019,11,2,201901,2019),('2019-01-12',201902,1,2019,12,2,201901,2019),('2019-01-13',201903,1,2019,13,3,201901,2019),('2019-01-14',201903,1,2019,14,3,201901,2019),('2019-01-15',201903,1,2019,15,3,201901,2019),('2019-01-16',201903,1,2019,16,3,201901,2019),('2019-01-17',201903,1,2019,17,3,201901,2019),('2019-01-18',201903,1,2019,18,3,201901,2019),('2019-01-19',201903,1,2019,19,3,201901,2019),('2019-01-20',201904,1,2019,20,4,201901,2019),('2019-01-21',201904,1,2019,21,4,201901,2019),('2019-01-22',201904,1,2019,22,4,201901,2019),('2019-01-23',201904,1,2019,23,4,201901,2019),('2019-01-24',201904,1,2019,24,4,201901,2019),('2019-01-25',201904,1,2019,25,4,201901,2019),('2019-01-26',201904,1,2019,26,4,201901,2019),('2019-01-27',201905,1,2019,27,5,201901,2019),('2019-01-28',201905,1,2019,28,5,201901,2019),('2019-01-29',201905,1,2019,29,5,201901,2019),('2019-01-30',201905,1,2019,30,5,201901,2019),('2019-01-31',201905,1,2019,31,5,201901,2019),('2019-02-01',201905,2,2019,1,5,201902,2019),('2019-02-02',201905,2,2019,2,5,201902,2019),('2019-02-03',201906,2,2019,3,6,201902,2019),('2019-02-04',201906,2,2019,4,6,201902,2019),('2019-02-05',201906,2,2019,5,6,201902,2019),('2019-02-06',201906,2,2019,6,6,201902,2019),('2019-02-07',201906,2,2019,7,6,201902,2019),('2019-02-08',201906,2,2019,8,6,201902,2019),('2019-02-09',201906,2,2019,9,6,201902,2019),('2019-02-10',201907,2,2019,10,7,201902,2019),('2019-02-11',201907,2,2019,11,7,201902,2019),('2019-02-12',201907,2,2019,12,7,201902,2019),('2019-02-13',201907,2,2019,13,7,201902,2019),('2019-02-14',201907,2,2019,14,7,201902,2019),('2019-02-15',201907,2,2019,15,7,201902,2019),('2019-02-16',201907,2,2019,16,7,201902,2019),('2019-02-17',201908,2,2019,17,8,201902,2019),('2019-02-18',201908,2,2019,18,8,201902,2019),('2019-02-19',201908,2,2019,19,8,201902,2019),('2019-02-20',201908,2,2019,20,8,201902,2019),('2019-02-21',201908,2,2019,21,8,201902,2019),('2019-02-22',201908,2,2019,22,8,201902,2019),('2019-02-23',201908,2,2019,23,8,201902,2019),('2019-02-24',201909,2,2019,24,9,201902,2019),('2019-02-25',201909,2,2019,25,9,201902,2019),('2019-02-26',201909,2,2019,26,9,201902,2019),('2019-02-27',201909,2,2019,27,9,201902,2019),('2019-02-28',201909,2,2019,28,9,201902,2019),('2019-03-01',201909,3,2019,1,9,201903,2019),('2019-03-02',201909,3,2019,2,9,201903,2019),('2019-03-03',201910,3,2019,3,10,201903,2019),('2019-03-04',201910,3,2019,4,10,201903,2019),('2019-03-05',201910,3,2019,5,10,201903,2019),('2019-03-06',201910,3,2019,6,10,201903,2019),('2019-03-07',201910,3,2019,7,10,201903,2019),('2019-03-08',201910,3,2019,8,10,201903,2019),('2019-03-09',201910,3,2019,9,10,201903,2019),('2019-03-10',201911,3,2019,10,11,201903,2019),('2019-03-11',201911,3,2019,11,11,201903,2019),('2019-03-12',201911,3,2019,12,11,201903,2019),('2019-03-13',201911,3,2019,13,11,201903,2019),('2019-03-14',201911,3,2019,14,11,201903,2019),('2019-03-15',201911,3,2019,15,11,201903,2019),('2019-03-16',201911,3,2019,16,11,201903,2019),('2019-03-17',201912,3,2019,17,12,201903,2019),('2019-03-18',201912,3,2019,18,12,201903,2019),('2019-03-19',201912,3,2019,19,12,201903,2019),('2019-03-20',201912,3,2019,20,12,201903,2019),('2019-03-21',201912,3,2019,21,12,201903,2019),('2019-03-22',201912,3,2019,22,12,201903,2019),('2019-03-23',201912,3,2019,23,12,201903,2019),('2019-03-24',201913,3,2019,24,13,201903,2019),('2019-03-25',201913,3,2019,25,13,201903,2019),('2019-03-26',201913,3,2019,26,13,201903,2019),('2019-03-27',201913,3,2019,27,13,201903,2019),('2019-03-28',201913,3,2019,28,13,201903,2019),('2019-03-29',201913,3,2019,29,13,201903,2019),('2019-03-30',201913,3,2019,30,13,201903,2019),('2019-03-31',201914,3,2019,31,14,201903,2019),('2019-04-01',201914,4,2019,1,14,201904,2019),('2019-04-02',201914,4,2019,2,14,201904,2019),('2019-04-03',201914,4,2019,3,14,201904,2019),('2019-04-04',201914,4,2019,4,14,201904,2019),('2019-04-05',201914,4,2019,5,14,201904,2019),('2019-04-06',201914,4,2019,6,14,201904,2019),('2019-04-07',201915,4,2019,7,15,201904,2019),('2019-04-08',201915,4,2019,8,15,201904,2019),('2019-04-09',201915,4,2019,9,15,201904,2019),('2019-04-10',201915,4,2019,10,15,201904,2019),('2019-04-11',201915,4,2019,11,15,201904,2019),('2019-04-12',201915,4,2019,12,15,201904,2019),('2019-04-13',201915,4,2019,13,15,201904,2019),('2019-04-14',201916,4,2019,14,16,201904,2019),('2019-04-15',201916,4,2019,15,16,201904,2019),('2019-04-16',201916,4,2019,16,16,201904,2019),('2019-04-17',201916,4,2019,17,16,201904,2019),('2019-04-18',201916,4,2019,18,16,201904,2019),('2019-04-19',201916,4,2019,19,16,201904,2019),('2019-04-20',201916,4,2019,20,16,201904,2019),('2019-04-21',201917,4,2019,21,17,201904,2019),('2019-04-22',201917,4,2019,22,17,201904,2019),('2019-04-23',201917,4,2019,23,17,201904,2019),('2019-04-24',201917,4,2019,24,17,201904,2019),('2019-04-25',201917,4,2019,25,17,201904,2019),('2019-04-26',201917,4,2019,26,17,201904,2019),('2019-04-27',201917,4,2019,27,17,201904,2019),('2019-04-28',201918,4,2019,28,18,201904,2019),('2019-04-29',201918,4,2019,29,18,201904,2019),('2019-04-30',201918,4,2019,30,18,201904,2019),('2019-05-01',201918,5,2019,1,18,201905,2019),('2019-05-02',201918,5,2019,2,18,201905,2019),('2019-05-03',201918,5,2019,3,18,201905,2019),('2019-05-04',201918,5,2019,4,18,201905,2019),('2019-05-05',201919,5,2019,5,19,201905,2019),('2019-05-06',201919,5,2019,6,19,201905,2019),('2019-05-07',201919,5,2019,7,19,201905,2019),('2019-05-08',201919,5,2019,8,19,201905,2019),('2019-05-09',201919,5,2019,9,19,201905,2019),('2019-05-10',201919,5,2019,10,19,201905,2019),('2019-05-11',201919,5,2019,11,19,201905,2019),('2019-05-12',201920,5,2019,12,20,201905,2019),('2019-05-13',201920,5,2019,13,20,201905,2019),('2019-05-14',201920,5,2019,14,20,201905,2019),('2019-05-15',201920,5,2019,15,20,201905,2019),('2019-05-16',201920,5,2019,16,20,201905,2019),('2019-05-17',201920,5,2019,17,20,201905,2019),('2019-05-18',201920,5,2019,18,20,201905,2019),('2019-05-19',201921,5,2019,19,21,201905,2019),('2019-05-20',201921,5,2019,20,21,201905,2019),('2019-05-21',201921,5,2019,21,21,201905,2019),('2019-05-22',201921,5,2019,22,21,201905,2019),('2019-05-23',201921,5,2019,23,21,201905,2019),('2019-05-24',201921,5,2019,24,21,201905,2019),('2019-05-25',201921,5,2019,25,21,201905,2019),('2019-05-26',201922,5,2019,26,22,201905,2019),('2019-05-27',201922,5,2019,27,22,201905,2019),('2019-05-28',201922,5,2019,28,22,201905,2019),('2019-05-29',201922,5,2019,29,22,201905,2019),('2019-05-30',201922,5,2019,30,22,201905,2019),('2019-05-31',201922,5,2019,31,22,201905,2019),('2019-06-01',201922,6,2019,1,22,201906,2019),('2019-06-02',201923,6,2019,2,23,201906,2019),('2019-06-03',201923,6,2019,3,23,201906,2019),('2019-06-04',201923,6,2019,4,23,201906,2019),('2019-06-05',201923,6,2019,5,23,201906,2019),('2019-06-06',201923,6,2019,6,23,201906,2019),('2019-06-07',201923,6,2019,7,23,201906,2019),('2019-06-08',201923,6,2019,8,23,201906,2019),('2019-06-09',201924,6,2019,9,24,201906,2019),('2019-06-10',201924,6,2019,10,24,201906,2019),('2019-06-11',201924,6,2019,11,24,201906,2019),('2019-06-12',201924,6,2019,12,24,201906,2019),('2019-06-13',201924,6,2019,13,24,201906,2019),('2019-06-14',201924,6,2019,14,24,201906,2019),('2019-06-15',201924,6,2019,15,24,201906,2019),('2019-06-16',201925,6,2019,16,25,201906,2019),('2019-06-17',201925,6,2019,17,25,201906,2019),('2019-06-18',201925,6,2019,18,25,201906,2019),('2019-06-19',201925,6,2019,19,25,201906,2019),('2019-06-20',201925,6,2019,20,25,201906,2019),('2019-06-21',201925,6,2019,21,25,201906,2019),('2019-06-22',201925,6,2019,22,25,201906,2019),('2019-06-23',201926,6,2019,23,26,201906,2019),('2019-06-24',201926,6,2019,24,26,201906,2019),('2019-06-25',201926,6,2019,25,26,201906,2019),('2019-06-26',201926,6,2019,26,26,201906,2019),('2019-06-27',201926,6,2019,27,26,201906,2019),('2019-06-28',201926,6,2019,28,26,201906,2019),('2019-06-29',201926,6,2019,29,26,201906,2019),('2019-06-30',201927,6,2019,30,27,201906,2019),('2019-07-01',201927,7,2019,1,27,201907,2019),('2019-07-02',201927,7,2019,2,27,201907,2019),('2019-07-03',201927,7,2019,3,27,201907,2019),('2019-07-04',201927,7,2019,4,27,201907,2019),('2019-07-05',201927,7,2019,5,27,201907,2019),('2019-07-06',201927,7,2019,6,27,201907,2019),('2019-07-07',201928,7,2019,7,28,201907,2019),('2019-07-08',201928,7,2019,8,28,201907,2019),('2019-07-09',201928,7,2019,9,28,201907,2019),('2019-07-10',201928,7,2019,10,28,201907,2019),('2019-07-11',201928,7,2019,11,28,201907,2019),('2019-07-12',201928,7,2019,12,28,201907,2019),('2019-07-13',201928,7,2019,13,28,201907,2019),('2019-07-14',201929,7,2019,14,29,201907,2019),('2019-07-15',201929,7,2019,15,29,201907,2019),('2019-07-16',201929,7,2019,16,29,201907,2019),('2019-07-17',201929,7,2019,17,29,201907,2019),('2019-07-18',201929,7,2019,18,29,201907,2019),('2019-07-19',201929,7,2019,19,29,201907,2019),('2019-07-20',201929,7,2019,20,29,201907,2019),('2019-07-21',201930,7,2019,21,30,201907,2019),('2019-07-22',201930,7,2019,22,30,201907,2019),('2019-07-23',201930,7,2019,23,30,201907,2019),('2019-07-24',201930,7,2019,24,30,201907,2019),('2019-07-25',201930,7,2019,25,30,201907,2019),('2019-07-26',201930,7,2019,26,30,201907,2019),('2019-07-27',201930,7,2019,27,30,201907,2019),('2019-07-28',201931,7,2019,28,31,201907,2019),('2019-07-29',201931,7,2019,29,31,201907,2019),('2019-07-30',201931,7,2019,30,31,201907,2019),('2019-07-31',201931,7,2019,31,31,201907,2019),('2019-08-01',201931,8,2019,1,31,201908,2019),('2019-08-02',201931,8,2019,2,31,201908,2019),('2019-08-03',201931,8,2019,3,31,201908,2019),('2019-08-04',201932,8,2019,4,32,201908,2019),('2019-08-05',201932,8,2019,5,32,201908,2019),('2019-08-06',201932,8,2019,6,32,201908,2019),('2019-08-07',201932,8,2019,7,32,201908,2019),('2019-08-08',201932,8,2019,8,32,201908,2019),('2019-08-09',201932,8,2019,9,32,201908,2019),('2019-08-10',201932,8,2019,10,32,201908,2019),('2019-08-11',201933,8,2019,11,33,201908,2019),('2019-08-12',201933,8,2019,12,33,201908,2019),('2019-08-13',201933,8,2019,13,33,201908,2019),('2019-08-14',201933,8,2019,14,33,201908,2019),('2019-08-15',201933,8,2019,15,33,201908,2019),('2019-08-16',201933,8,2019,16,33,201908,2019),('2019-08-17',201933,8,2019,17,33,201908,2019),('2019-08-18',201934,8,2019,18,34,201908,2019),('2019-08-19',201934,8,2019,19,34,201908,2019),('2019-08-20',201934,8,2019,20,34,201908,2019),('2019-08-21',201934,8,2019,21,34,201908,2019),('2019-08-22',201934,8,2019,22,34,201908,2019),('2019-08-23',201934,8,2019,23,34,201908,2019),('2019-08-24',201934,8,2019,24,34,201908,2019),('2019-08-25',201935,8,2019,25,35,201908,2019),('2019-08-26',201935,8,2019,26,35,201908,2019),('2019-08-27',201935,8,2019,27,35,201908,2019),('2019-08-28',201935,8,2019,28,35,201908,2019),('2019-08-29',201935,8,2019,29,35,201908,2019),('2019-08-30',201935,8,2019,30,35,201908,2019),('2019-08-31',201935,8,2019,31,35,201908,2019),('2019-09-01',201936,9,2019,1,36,201909,2019),('2019-09-02',201936,9,2019,2,36,201909,2019),('2019-09-03',201936,9,2019,3,36,201909,2019),('2019-09-04',201936,9,2019,4,36,201909,2019),('2019-09-05',201936,9,2019,5,36,201909,2019),('2019-09-06',201936,9,2019,6,36,201909,2019),('2019-09-07',201936,9,2019,7,36,201909,2019),('2019-09-08',201937,9,2019,8,37,201909,2019),('2019-09-09',201937,9,2019,9,37,201909,2019),('2019-09-10',201937,9,2019,10,37,201909,2019),('2019-09-11',201937,9,2019,11,37,201909,2019),('2019-09-12',201937,9,2019,12,37,201909,2019),('2019-09-13',201937,9,2019,13,37,201909,2019),('2019-09-14',201937,9,2019,14,37,201909,2019),('2019-09-15',201938,9,2019,15,38,201909,2019),('2019-09-16',201938,9,2019,16,38,201909,2019),('2019-09-17',201938,9,2019,17,38,201909,2019),('2019-09-18',201938,9,2019,18,38,201909,2019),('2019-09-19',201938,9,2019,19,38,201909,2019),('2019-09-20',201938,9,2019,20,38,201909,2019),('2019-09-21',201938,9,2019,21,38,201909,2019),('2019-09-22',201939,9,2019,22,39,201909,2019),('2019-09-23',201939,9,2019,23,39,201909,2019),('2019-09-24',201939,9,2019,24,39,201909,2019),('2019-09-25',201939,9,2019,25,39,201909,2019),('2019-09-26',201939,9,2019,26,39,201909,2019),('2019-09-27',201939,9,2019,27,39,201909,2019),('2019-09-28',201939,9,2019,28,39,201909,2019),('2019-09-29',201940,9,2019,29,40,201909,2019),('2019-09-30',201940,9,2019,30,40,201909,2019),('2019-10-01',201940,10,2019,1,40,201910,2019),('2019-10-02',201940,10,2019,2,40,201910,2019),('2019-10-03',201940,10,2019,3,40,201910,2019),('2019-10-04',201940,10,2019,4,40,201910,2019),('2019-10-05',201940,10,2019,5,40,201910,2019),('2019-10-06',201941,10,2019,6,41,201910,2019),('2019-10-07',201941,10,2019,7,41,201910,2019),('2019-10-08',201941,10,2019,8,41,201910,2019),('2019-10-09',201941,10,2019,9,41,201910,2019),('2019-10-10',201941,10,2019,10,41,201910,2019),('2019-10-11',201941,10,2019,11,41,201910,2019),('2019-10-12',201941,10,2019,12,41,201910,2019),('2019-10-13',201942,10,2019,13,42,201910,2019),('2019-10-14',201942,10,2019,14,42,201910,2019),('2019-10-15',201942,10,2019,15,42,201910,2019),('2019-10-16',201942,10,2019,16,42,201910,2019),('2019-10-17',201942,10,2019,17,42,201910,2019),('2019-10-18',201942,10,2019,18,42,201910,2019),('2019-10-19',201942,10,2019,19,42,201910,2019),('2019-10-20',201943,10,2019,20,43,201910,2019),('2019-10-21',201943,10,2019,21,43,201910,2019),('2019-10-22',201943,10,2019,22,43,201910,2019),('2019-10-23',201943,10,2019,23,43,201910,2019),('2019-10-24',201943,10,2019,24,43,201910,2019),('2019-10-25',201943,10,2019,25,43,201910,2019),('2019-10-26',201943,10,2019,26,43,201910,2019),('2019-10-27',201944,10,2019,27,44,201910,2019),('2019-10-28',201944,10,2019,28,44,201910,2019),('2019-10-29',201944,10,2019,29,44,201910,2019),('2019-10-30',201944,10,2019,30,44,201910,2019),('2019-10-31',201944,10,2019,31,44,201910,2019),('2019-11-01',201944,11,2019,1,44,201911,2019),('2019-11-02',201944,11,2019,2,44,201911,2019),('2019-11-03',201945,11,2019,3,45,201911,2019),('2019-11-04',201945,11,2019,4,45,201911,2019),('2019-11-05',201945,11,2019,5,45,201911,2019),('2019-11-06',201945,11,2019,6,45,201911,2019),('2019-11-07',201945,11,2019,7,45,201911,2019),('2019-11-08',201945,11,2019,8,45,201911,2019),('2019-11-09',201945,11,2019,9,45,201911,2019),('2019-11-10',201946,11,2019,10,46,201911,2019),('2019-11-11',201946,11,2019,11,46,201911,2019),('2019-11-12',201946,11,2019,12,46,201911,2019),('2019-11-13',201946,11,2019,13,46,201911,2019),('2019-11-14',201946,11,2019,14,46,201911,2019),('2019-11-15',201946,11,2019,15,46,201911,2019),('2019-11-16',201946,11,2019,16,46,201911,2019),('2019-11-17',201947,11,2019,17,47,201911,2019),('2019-11-18',201947,11,2019,18,47,201911,2019),('2019-11-19',201947,11,2019,19,47,201911,2019),('2019-11-20',201947,11,2019,20,47,201911,2019),('2019-11-21',201947,11,2019,21,47,201911,2019),('2019-11-22',201947,11,2019,22,47,201911,2019),('2019-11-23',201947,11,2019,23,47,201911,2019),('2019-11-24',201948,11,2019,24,48,201911,2019),('2019-11-25',201948,11,2019,25,48,201911,2019),('2019-11-26',201948,11,2019,26,48,201911,2019),('2019-11-27',201948,11,2019,27,48,201911,2019),('2019-11-28',201948,11,2019,28,48,201911,2019),('2019-11-29',201948,11,2019,29,48,201911,2019),('2019-11-30',201948,11,2019,30,48,201911,2019),('2019-12-01',201949,12,2019,1,49,201912,2020),('2019-12-02',201949,12,2019,2,49,201912,2020),('2019-12-03',201949,12,2019,3,49,201912,2020),('2019-12-04',201949,12,2019,4,49,201912,2020),('2019-12-05',201949,12,2019,5,49,201912,2020),('2019-12-06',201949,12,2019,6,49,201912,2020),('2019-12-07',201949,12,2019,7,49,201912,2020),('2019-12-08',201950,12,2019,8,50,201912,2020),('2019-12-09',201950,12,2019,9,50,201912,2020),('2019-12-10',201950,12,2019,10,50,201912,2020),('2019-12-11',201950,12,2019,11,50,201912,2020),('2019-12-12',201950,12,2019,12,50,201912,2020),('2019-12-13',201950,12,2019,13,50,201912,2020),('2019-12-14',201950,12,2019,14,50,201912,2020),('2019-12-15',201951,12,2019,15,51,201912,2020),('2019-12-16',201951,12,2019,16,51,201912,2020),('2019-12-17',201951,12,2019,17,51,201912,2020),('2019-12-18',201951,12,2019,18,51,201912,2020),('2019-12-19',201951,12,2019,19,51,201912,2020),('2019-12-20',201951,12,2019,20,51,201912,2020),('2019-12-21',201951,12,2019,21,51,201912,2020),('2019-12-22',201952,12,2019,22,52,201912,2020),('2019-12-23',201952,12,2019,23,52,201912,2020),('2019-12-24',201952,12,2019,24,52,201912,2020),('2019-12-25',201952,12,2019,25,52,201912,2020),('2019-12-26',201952,12,2019,26,52,201912,2020),('2019-12-27',201952,12,2019,27,52,201912,2020),('2019-12-28',201952,12,2019,28,52,201912,2020),('2019-12-29',201953,12,2019,29,1,201912,2020),('2019-12-30',201953,12,2019,30,1,201912,2020),('2019-12-31',201953,12,2019,31,1,201912,2020),('2020-01-01',201953,1,2020,1,1,202001,2020),('2020-01-02',201953,1,2020,2,1,202001,2020),('2020-01-03',201953,1,2020,3,1,202001,2020),('2020-01-04',201953,1,2020,4,1,202001,2020),('2020-01-05',202001,1,2020,5,2,202001,2020),('2020-01-06',202001,1,2020,6,2,202001,2020),('2020-01-07',202001,1,2020,7,2,202001,2020),('2020-01-08',202001,1,2020,8,2,202001,2020),('2020-01-09',202001,1,2020,9,2,202001,2020),('2020-01-10',202001,1,2020,10,2,202001,2020),('2020-01-11',202001,1,2020,11,2,202001,2020),('2020-01-12',202002,1,2020,12,3,202001,2020),('2020-01-13',202002,1,2020,13,3,202001,2020),('2020-01-14',202002,1,2020,14,3,202001,2020),('2020-01-15',202002,1,2020,15,3,202001,2020),('2020-01-16',202002,1,2020,16,3,202001,2020),('2020-01-17',202002,1,2020,17,3,202001,2020),('2020-01-18',202002,1,2020,18,3,202001,2020),('2020-01-19',202003,1,2020,19,4,202001,2020),('2020-01-20',202003,1,2020,20,4,202001,2020),('2020-01-21',202003,1,2020,21,4,202001,2020),('2020-01-22',202003,1,2020,22,4,202001,2020),('2020-01-23',202003,1,2020,23,4,202001,2020),('2020-01-24',202003,1,2020,24,4,202001,2020),('2020-01-25',202003,1,2020,25,4,202001,2020),('2020-01-26',202004,1,2020,26,5,202001,2020),('2020-01-27',202004,1,2020,27,5,202001,2020),('2020-01-28',202004,1,2020,28,5,202001,2020),('2020-01-29',202004,1,2020,29,5,202001,2020),('2020-01-30',202004,1,2020,30,5,202001,2020),('2020-01-31',202004,1,2020,31,5,202001,2020),('2020-02-01',202004,2,2020,1,5,202002,2020),('2020-02-02',202005,2,2020,2,6,202002,2020),('2020-02-03',202005,2,2020,3,6,202002,2020),('2020-02-04',202005,2,2020,4,6,202002,2020),('2020-02-05',202005,2,2020,5,6,202002,2020),('2020-02-06',202005,2,2020,6,6,202002,2020),('2020-02-07',202005,2,2020,7,6,202002,2020),('2020-02-08',202005,2,2020,8,6,202002,2020),('2020-02-09',202006,2,2020,9,7,202002,2020),('2020-02-10',202006,2,2020,10,7,202002,2020),('2020-02-11',202006,2,2020,11,7,202002,2020),('2020-02-12',202006,2,2020,12,7,202002,2020),('2020-02-13',202006,2,2020,13,7,202002,2020),('2020-02-14',202006,2,2020,14,7,202002,2020),('2020-02-15',202006,2,2020,15,7,202002,2020),('2020-02-16',202007,2,2020,16,8,202002,2020),('2020-02-17',202007,2,2020,17,8,202002,2020),('2020-02-18',202007,2,2020,18,8,202002,2020),('2020-02-19',202007,2,2020,19,8,202002,2020),('2020-02-20',202007,2,2020,20,8,202002,2020),('2020-02-21',202007,2,2020,21,8,202002,2020),('2020-02-22',202007,2,2020,22,8,202002,2020),('2020-02-23',202008,2,2020,23,9,202002,2020),('2020-02-24',202008,2,2020,24,9,202002,2020),('2020-02-25',202008,2,2020,25,9,202002,2020),('2020-02-26',202008,2,2020,26,9,202002,2020),('2020-02-27',202008,2,2020,27,9,202002,2020),('2020-02-28',202008,2,2020,28,9,202002,2020),('2020-02-29',202008,2,2020,29,9,202002,2020),('2020-03-01',202009,3,2020,1,10,202003,2020),('2020-03-02',202009,3,2020,2,10,202003,2020),('2020-03-03',202009,3,2020,3,10,202003,2020),('2020-03-04',202009,3,2020,4,10,202003,2020),('2020-03-05',202009,3,2020,5,10,202003,2020),('2020-03-06',202009,3,2020,6,10,202003,2020),('2020-03-07',202009,3,2020,7,10,202003,2020),('2020-03-08',202010,3,2020,8,11,202003,2020),('2020-03-09',202010,3,2020,9,11,202003,2020),('2020-03-10',202010,3,2020,10,11,202003,2020),('2020-03-11',202010,3,2020,11,11,202003,2020),('2020-03-12',202010,3,2020,12,11,202003,2020),('2020-03-13',202010,3,2020,13,11,202003,2020),('2020-03-14',202010,3,2020,14,11,202003,2020),('2020-03-15',202011,3,2020,15,12,202003,2020),('2020-03-16',202011,3,2020,16,12,202003,2020),('2020-03-17',202011,3,2020,17,12,202003,2020),('2020-03-18',202011,3,2020,18,12,202003,2020),('2020-03-19',202011,3,2020,19,12,202003,2020),('2020-03-20',202011,3,2020,20,12,202003,2020),('2020-03-21',202011,3,2020,21,12,202003,2020),('2020-03-22',202012,3,2020,22,13,202003,2020),('2020-03-23',202012,3,2020,23,13,202003,2020),('2020-03-24',202012,3,2020,24,13,202003,2020),('2020-03-25',202012,3,2020,25,13,202003,2020),('2020-03-26',202012,3,2020,26,13,202003,2020),('2020-03-27',202012,3,2020,27,13,202003,2020),('2020-03-28',202012,3,2020,28,13,202003,2020),('2020-03-29',202013,3,2020,29,14,202003,2020),('2020-03-30',202013,3,2020,30,14,202003,2020),('2020-03-31',202013,3,2020,31,14,202003,2020),('2020-04-01',202013,4,2020,1,14,202004,2020),('2020-04-02',202013,4,2020,2,14,202004,2020),('2020-04-03',202013,4,2020,3,14,202004,2020),('2020-04-04',202013,4,2020,4,14,202004,2020),('2020-04-05',202014,4,2020,5,15,202004,2020),('2020-04-06',202014,4,2020,6,15,202004,2020),('2020-04-07',202014,4,2020,7,15,202004,2020),('2020-04-08',202014,4,2020,8,15,202004,2020),('2020-04-09',202014,4,2020,9,15,202004,2020),('2020-04-10',202014,4,2020,10,15,202004,2020),('2020-04-11',202014,4,2020,11,15,202004,2020),('2020-04-12',202015,4,2020,12,16,202004,2020),('2020-04-13',202015,4,2020,13,16,202004,2020),('2020-04-14',202015,4,2020,14,16,202004,2020),('2020-04-15',202015,4,2020,15,16,202004,2020),('2020-04-16',202015,4,2020,16,16,202004,2020),('2020-04-17',202015,4,2020,17,16,202004,2020),('2020-04-18',202015,4,2020,18,16,202004,2020),('2020-04-19',202016,4,2020,19,17,202004,2020),('2020-04-20',202016,4,2020,20,17,202004,2020),('2020-04-21',202016,4,2020,21,17,202004,2020),('2020-04-22',202016,4,2020,22,17,202004,2020),('2020-04-23',202016,4,2020,23,17,202004,2020),('2020-04-24',202016,4,2020,24,17,202004,2020),('2020-04-25',202016,4,2020,25,17,202004,2020),('2020-04-26',202017,4,2020,26,18,202004,2020),('2020-04-27',202017,4,2020,27,18,202004,2020),('2020-04-28',202017,4,2020,28,18,202004,2020),('2020-04-29',202017,4,2020,29,18,202004,2020),('2020-04-30',202017,4,2020,30,18,202004,2020),('2020-05-01',202017,5,2020,1,18,202005,2020),('2020-05-02',202017,5,2020,2,18,202005,2020),('2020-05-03',202018,5,2020,3,19,202005,2020),('2020-05-04',202018,5,2020,4,19,202005,2020),('2020-05-05',202018,5,2020,5,19,202005,2020),('2020-05-06',202018,5,2020,6,19,202005,2020),('2020-05-07',202018,5,2020,7,19,202005,2020),('2020-05-08',202018,5,2020,8,19,202005,2020),('2020-05-09',202018,5,2020,9,19,202005,2020),('2020-05-10',202019,5,2020,10,20,202005,2020),('2020-05-11',202019,5,2020,11,20,202005,2020),('2020-05-12',202019,5,2020,12,20,202005,2020),('2020-05-13',202019,5,2020,13,20,202005,2020),('2020-05-14',202019,5,2020,14,20,202005,2020),('2020-05-15',202019,5,2020,15,20,202005,2020),('2020-05-16',202019,5,2020,16,20,202005,2020),('2020-05-17',202020,5,2020,17,21,202005,2020),('2020-05-18',202020,5,2020,18,21,202005,2020),('2020-05-19',202020,5,2020,19,21,202005,2020),('2020-05-20',202020,5,2020,20,21,202005,2020),('2020-05-21',202020,5,2020,21,21,202005,2020),('2020-05-22',202020,5,2020,22,21,202005,2020),('2020-05-23',202020,5,2020,23,21,202005,2020),('2020-05-24',202021,5,2020,24,22,202005,2020),('2020-05-25',202021,5,2020,25,22,202005,2020),('2020-05-26',202021,5,2020,26,22,202005,2020),('2020-05-27',202021,5,2020,27,22,202005,2020),('2020-05-28',202021,5,2020,28,22,202005,2020),('2020-05-29',202021,5,2020,29,22,202005,2020),('2020-05-30',202021,5,2020,30,22,202005,2020),('2020-05-31',202022,5,2020,31,23,202005,2020),('2020-06-01',202022,6,2020,1,23,202006,2020),('2020-06-02',202022,6,2020,2,23,202006,2020),('2020-06-03',202022,6,2020,3,23,202006,2020),('2020-06-04',202022,6,2020,4,23,202006,2020),('2020-06-05',202022,6,2020,5,23,202006,2020),('2020-06-06',202022,6,2020,6,23,202006,2020),('2020-06-07',202023,6,2020,7,24,202006,2020),('2020-06-08',202023,6,2020,8,24,202006,2020),('2020-06-09',202023,6,2020,9,24,202006,2020),('2020-06-10',202023,6,2020,10,24,202006,2020),('2020-06-11',202023,6,2020,11,24,202006,2020),('2020-06-12',202023,6,2020,12,24,202006,2020),('2020-06-13',202023,6,2020,13,24,202006,2020),('2020-06-14',202024,6,2020,14,25,202006,2020),('2020-06-15',202024,6,2020,15,25,202006,2020),('2020-06-16',202024,6,2020,16,25,202006,2020),('2020-06-17',202024,6,2020,17,25,202006,2020),('2020-06-18',202024,6,2020,18,25,202006,2020),('2020-06-19',202024,6,2020,19,25,202006,2020),('2020-06-20',202024,6,2020,20,25,202006,2020),('2020-06-21',202025,6,2020,21,26,202006,2020),('2020-06-22',202025,6,2020,22,26,202006,2020),('2020-06-23',202025,6,2020,23,26,202006,2020),('2020-06-24',202025,6,2020,24,26,202006,2020),('2020-06-25',202025,6,2020,25,26,202006,2020),('2020-06-26',202025,6,2020,26,26,202006,2020),('2020-06-27',202025,6,2020,27,26,202006,2020),('2020-06-28',202026,6,2020,28,27,202006,2020),('2020-06-29',202026,6,2020,29,27,202006,2020),('2020-06-30',202026,6,2020,30,27,202006,2020),('2020-07-01',202026,7,2020,1,27,202007,2020),('2020-07-02',202026,7,2020,2,27,202007,2020),('2020-07-03',202026,7,2020,3,27,202007,2020),('2020-07-04',202026,7,2020,4,27,202007,2020),('2020-07-05',202027,7,2020,5,28,202007,2020),('2020-07-06',202027,7,2020,6,28,202007,2020),('2020-07-07',202027,7,2020,7,28,202007,2020),('2020-07-08',202027,7,2020,8,28,202007,2020),('2020-07-09',202027,7,2020,9,28,202007,2020),('2020-07-10',202027,7,2020,10,28,202007,2020),('2020-07-11',202027,7,2020,11,28,202007,2020),('2020-07-12',202028,7,2020,12,29,202007,2020),('2020-07-13',202028,7,2020,13,29,202007,2020),('2020-07-14',202028,7,2020,14,29,202007,2020),('2020-07-15',202028,7,2020,15,29,202007,2020),('2020-07-16',202028,7,2020,16,29,202007,2020),('2020-07-17',202028,7,2020,17,29,202007,2020),('2020-07-18',202028,7,2020,18,29,202007,2020),('2020-07-19',202029,7,2020,19,30,202007,2020),('2020-07-20',202029,7,2020,20,30,202007,2020),('2020-07-21',202029,7,2020,21,30,202007,2020),('2020-07-22',202029,7,2020,22,30,202007,2020),('2020-07-23',202029,7,2020,23,30,202007,2020),('2020-07-24',202029,7,2020,24,30,202007,2020),('2020-07-25',202029,7,2020,25,30,202007,2020),('2020-07-26',202030,7,2020,26,31,202007,2020),('2020-07-27',202030,7,2020,27,31,202007,2020),('2020-07-28',202030,7,2020,28,31,202007,2020),('2020-07-29',202030,7,2020,29,31,202007,2020),('2020-07-30',202030,7,2020,30,31,202007,2020),('2020-07-31',202030,7,2020,31,31,202007,2020),('2020-08-01',202030,8,2020,1,31,202008,2020),('2020-08-02',202031,8,2020,2,32,202008,2020),('2020-08-03',202031,8,2020,3,32,202008,2020),('2020-08-04',202031,8,2020,4,32,202008,2020),('2020-08-05',202031,8,2020,5,32,202008,2020),('2020-08-06',202031,8,2020,6,32,202008,2020),('2020-08-07',202031,8,2020,7,32,202008,2020),('2020-08-08',202031,8,2020,8,32,202008,2020),('2020-08-09',202032,8,2020,9,33,202008,2020),('2020-08-10',202032,8,2020,10,33,202008,2020),('2020-08-11',202032,8,2020,11,33,202008,2020),('2020-08-12',202032,8,2020,12,33,202008,2020),('2020-08-13',202032,8,2020,13,33,202008,2020),('2020-08-14',202032,8,2020,14,33,202008,2020),('2020-08-15',202032,8,2020,15,33,202008,2020),('2020-08-16',202033,8,2020,16,34,202008,2020),('2020-08-17',202033,8,2020,17,34,202008,2020),('2020-08-18',202033,8,2020,18,34,202008,2020),('2020-08-19',202033,8,2020,19,34,202008,2020),('2020-08-20',202033,8,2020,20,34,202008,2020),('2020-08-21',202033,8,2020,21,34,202008,2020),('2020-08-22',202033,8,2020,22,34,202008,2020),('2020-08-23',202034,8,2020,23,35,202008,2020),('2020-08-24',202034,8,2020,24,35,202008,2020),('2020-08-25',202034,8,2020,25,35,202008,2020),('2020-08-26',202034,8,2020,26,35,202008,2020),('2020-08-27',202034,8,2020,27,35,202008,2020),('2020-08-28',202034,8,2020,28,35,202008,2020),('2020-08-29',202034,8,2020,29,35,202008,2020),('2020-08-30',202035,8,2020,30,36,202008,2020),('2020-08-31',202035,8,2020,31,36,202008,2020),('2020-09-01',202035,9,2020,1,36,202009,2020),('2020-09-02',202035,9,2020,2,36,202009,2020),('2020-09-03',202035,9,2020,3,36,202009,2020),('2020-09-04',202035,9,2020,4,36,202009,2020),('2020-09-05',202035,9,2020,5,36,202009,2020),('2020-09-06',202036,9,2020,6,37,202009,2020),('2020-09-07',202036,9,2020,7,37,202009,2020),('2020-09-08',202036,9,2020,8,37,202009,2020),('2020-09-09',202036,9,2020,9,37,202009,2020),('2020-09-10',202036,9,2020,10,37,202009,2020),('2020-09-11',202036,9,2020,11,37,202009,2020),('2020-09-12',202036,9,2020,12,37,202009,2020),('2020-09-13',202037,9,2020,13,38,202009,2020),('2020-09-14',202037,9,2020,14,38,202009,2020),('2020-09-15',202037,9,2020,15,38,202009,2020),('2020-09-16',202037,9,2020,16,38,202009,2020),('2020-09-17',202037,9,2020,17,38,202009,2020),('2020-09-18',202037,9,2020,18,38,202009,2020),('2020-09-19',202037,9,2020,19,38,202009,2020),('2020-09-20',202038,9,2020,20,39,202009,2020),('2020-09-21',202038,9,2020,21,39,202009,2020),('2020-09-22',202038,9,2020,22,39,202009,2020),('2020-09-23',202038,9,2020,23,39,202009,2020),('2020-09-24',202038,9,2020,24,39,202009,2020),('2020-09-25',202038,9,2020,25,39,202009,2020),('2020-09-26',202038,9,2020,26,39,202009,2020),('2020-09-27',202039,9,2020,27,40,202009,2020),('2020-09-28',202039,9,2020,28,40,202009,2020),('2020-09-29',202039,9,2020,29,40,202009,2020),('2020-09-30',202039,9,2020,30,40,202009,2020),('2020-10-01',202039,10,2020,1,40,202010,2020),('2020-10-02',202039,10,2020,2,40,202010,2020),('2020-10-03',202039,10,2020,3,40,202010,2020),('2020-10-04',202040,10,2020,4,41,202010,2020),('2020-10-05',202040,10,2020,5,41,202010,2020),('2020-10-06',202040,10,2020,6,41,202010,2020),('2020-10-07',202040,10,2020,7,41,202010,2020),('2020-10-08',202040,10,2020,8,41,202010,2020),('2020-10-09',202040,10,2020,9,41,202010,2020),('2020-10-10',202040,10,2020,10,41,202010,2020),('2020-10-11',202041,10,2020,11,42,202010,2020),('2020-10-12',202041,10,2020,12,42,202010,2020),('2020-10-13',202041,10,2020,13,42,202010,2020),('2020-10-14',202041,10,2020,14,42,202010,2020),('2020-10-15',202041,10,2020,15,42,202010,2020),('2020-10-16',202041,10,2020,16,42,202010,2020),('2020-10-17',202041,10,2020,17,42,202010,2020),('2020-10-18',202042,10,2020,18,43,202010,2020),('2020-10-19',202042,10,2020,19,43,202010,2020),('2020-10-20',202042,10,2020,20,43,202010,2020),('2020-10-21',202042,10,2020,21,43,202010,2020),('2020-10-22',202042,10,2020,22,43,202010,2020),('2020-10-23',202042,10,2020,23,43,202010,2020),('2020-10-24',202042,10,2020,24,43,202010,2020),('2020-10-25',202043,10,2020,25,44,202010,2020),('2020-10-26',202043,10,2020,26,44,202010,2020),('2020-10-27',202043,10,2020,27,44,202010,2020),('2020-10-28',202043,10,2020,28,44,202010,2020),('2020-10-29',202043,10,2020,29,44,202010,2020),('2020-10-30',202043,10,2020,30,44,202010,2020),('2020-10-31',202043,10,2020,31,44,202010,2020),('2020-11-01',202044,11,2020,1,45,202011,2020),('2020-11-02',202044,11,2020,2,45,202011,2020),('2020-11-03',202044,11,2020,3,45,202011,2020),('2020-11-04',202044,11,2020,4,45,202011,2020),('2020-11-05',202044,11,2020,5,45,202011,2020),('2020-11-06',202044,11,2020,6,45,202011,2020),('2020-11-07',202044,11,2020,7,45,202011,2020),('2020-11-08',202045,11,2020,8,46,202011,2020),('2020-11-09',202045,11,2020,9,46,202011,2020),('2020-11-10',202045,11,2020,10,46,202011,2020),('2020-11-11',202045,11,2020,11,46,202011,2020),('2020-11-12',202045,11,2020,12,46,202011,2020),('2020-11-13',202045,11,2020,13,46,202011,2020),('2020-11-14',202045,11,2020,14,46,202011,2020),('2020-11-15',202046,11,2020,15,47,202011,2020),('2020-11-16',202046,11,2020,16,47,202011,2020),('2020-11-17',202046,11,2020,17,47,202011,2020),('2020-11-18',202046,11,2020,18,47,202011,2020),('2020-11-19',202046,11,2020,19,47,202011,2020),('2020-11-20',202046,11,2020,20,47,202011,2020),('2020-11-21',202046,11,2020,21,47,202011,2020),('2020-11-22',202047,11,2020,22,48,202011,2020),('2020-11-23',202047,11,2020,23,48,202011,2020),('2020-11-24',202047,11,2020,24,48,202011,2020),('2020-11-25',202047,11,2020,25,48,202011,2020),('2020-11-26',202047,11,2020,26,48,202011,2020),('2020-11-27',202047,11,2020,27,48,202011,2020),('2020-11-28',202047,11,2020,28,48,202011,2020),('2020-11-29',202048,11,2020,29,49,202011,2020),('2020-11-30',202048,11,2020,30,49,202011,2020),('2020-12-01',202048,12,2020,1,49,202012,2021),('2020-12-02',202048,12,2020,2,49,202012,2021),('2020-12-03',202048,12,2020,3,49,202012,2021),('2020-12-04',202048,12,2020,4,49,202012,2021),('2020-12-05',202048,12,2020,5,49,202012,2021),('2020-12-06',202049,12,2020,6,50,202012,2021),('2020-12-07',202049,12,2020,7,50,202012,2021),('2020-12-08',202049,12,2020,8,50,202012,2021),('2020-12-09',202049,12,2020,9,50,202012,2021),('2020-12-10',202049,12,2020,10,50,202012,2021),('2020-12-11',202049,12,2020,11,50,202012,2021),('2020-12-12',202049,12,2020,12,50,202012,2021),('2020-12-13',202050,12,2020,13,51,202012,2021),('2020-12-14',202050,12,2020,14,51,202012,2021),('2020-12-15',202050,12,2020,15,51,202012,2021),('2020-12-16',202050,12,2020,16,51,202012,2021),('2020-12-17',202050,12,2020,17,51,202012,2021),('2020-12-18',202050,12,2020,18,51,202012,2021),('2020-12-19',202050,12,2020,19,51,202012,2021),('2020-12-20',202051,12,2020,20,52,202012,2021),('2020-12-21',202051,12,2020,21,52,202012,2021),('2020-12-22',202051,12,2020,22,52,202012,2021),('2020-12-23',202051,12,2020,23,52,202012,2021),('2020-12-24',202051,12,2020,24,52,202012,2021),('2020-12-25',202051,12,2020,25,52,202012,2021),('2020-12-26',202051,12,2020,26,52,202012,2021),('2020-12-27',202052,12,2020,27,53,202012,2021),('2020-12-28',202052,12,2020,28,53,202012,2021),('2020-12-29',202052,12,2020,29,53,202012,2021),('2020-12-30',202052,12,2020,30,53,202012,2021),('2020-12-31',202052,12,2020,31,53,202012,2021),('2021-01-01',202101,1,2021,1,1,202101,2021),('2021-01-02',202101,1,2021,2,1,202101,2021),('2021-01-03',202101,1,2021,3,1,202101,2021),('2021-01-04',202101,1,2021,4,1,202101,2021),('2021-01-05',202101,1,2021,5,1,202101,2021),('2021-01-06',202101,1,2021,6,1,202101,2021),('2021-01-07',202101,1,2021,7,1,202101,2021),('2021-01-08',202101,1,2021,8,1,202101,2021),('2021-01-09',202101,1,2021,9,1,202101,2021),('2021-01-10',202102,1,2021,10,2,202101,2021),('2021-01-11',202102,1,2021,11,2,202101,2021),('2021-01-12',202102,1,2021,12,2,202101,2021),('2021-01-13',202102,1,2021,13,2,202101,2021),('2021-01-14',202102,1,2021,14,2,202101,2021),('2021-01-15',202102,1,2021,15,2,202101,2021),('2021-01-16',202102,1,2021,16,2,202101,2021),('2021-01-17',202103,1,2021,17,3,202101,2021),('2021-01-18',202103,1,2021,18,3,202101,2021),('2021-01-19',202103,1,2021,19,3,202101,2021),('2021-01-20',202103,1,2021,20,3,202101,2021),('2021-01-21',202103,1,2021,21,3,202101,2021),('2021-01-22',202103,1,2021,22,3,202101,2021),('2021-01-23',202103,1,2021,23,3,202101,2021),('2021-01-24',202104,1,2021,24,4,202101,2021),('2021-01-25',202104,1,2021,25,4,202101,2021),('2021-01-26',202104,1,2021,26,4,202101,2021),('2021-01-27',202104,1,2021,27,4,202101,2021),('2021-01-28',202104,1,2021,28,4,202101,2021),('2021-01-29',202104,1,2021,29,4,202101,2021),('2021-01-30',202104,1,2021,30,4,202101,2021),('2021-01-31',202105,1,2021,31,5,202101,2021),('2021-02-01',202105,2,2021,1,5,202102,2021),('2021-02-02',202105,2,2021,2,5,202102,2021),('2021-02-03',202105,2,2021,3,5,202102,2021),('2021-02-04',202105,2,2021,4,5,202102,2021),('2021-02-05',202105,2,2021,5,5,202102,2021),('2021-02-06',202105,2,2021,6,5,202102,2021),('2021-02-07',202106,2,2021,7,6,202102,2021),('2021-02-08',202106,2,2021,8,6,202102,2021),('2021-02-09',202106,2,2021,9,6,202102,2021),('2021-02-10',202106,2,2021,10,6,202102,2021),('2021-02-11',202106,2,2021,11,6,202102,2021),('2021-02-12',202106,2,2021,12,6,202102,2021),('2021-02-13',202106,2,2021,13,6,202102,2021),('2021-02-14',202107,2,2021,14,7,202102,2021),('2021-02-15',202107,2,2021,15,7,202102,2021),('2021-02-16',202107,2,2021,16,7,202102,2021),('2021-02-17',202107,2,2021,17,7,202102,2021),('2021-02-18',202107,2,2021,18,7,202102,2021),('2021-02-19',202107,2,2021,19,7,202102,2021),('2021-02-20',202107,2,2021,20,7,202102,2021),('2021-02-21',202108,2,2021,21,8,202102,2021),('2021-02-22',202108,2,2021,22,8,202102,2021),('2021-02-23',202108,2,2021,23,8,202102,2021),('2021-02-24',202108,2,2021,24,8,202102,2021),('2021-02-25',202108,2,2021,25,8,202102,2021),('2021-02-26',202108,2,2021,26,8,202102,2021),('2021-02-27',202108,2,2021,27,8,202102,2021),('2021-02-28',202109,2,2021,28,9,202102,2021),('2021-03-01',202109,3,2021,1,9,202103,2021),('2021-03-02',202109,3,2021,2,9,202103,2021),('2021-03-03',202109,3,2021,3,9,202103,2021),('2021-03-04',202109,3,2021,4,9,202103,2021),('2021-03-05',202109,3,2021,5,9,202103,2021),('2021-03-06',202109,3,2021,6,9,202103,2021),('2021-03-07',202110,3,2021,7,10,202103,2021),('2021-03-08',202110,3,2021,8,10,202103,2021),('2021-03-09',202110,3,2021,9,10,202103,2021),('2021-03-10',202110,3,2021,10,10,202103,2021),('2021-03-11',202110,3,2021,11,10,202103,2021),('2021-03-12',202110,3,2021,12,10,202103,2021),('2021-03-13',202110,3,2021,13,10,202103,2021),('2021-03-14',202111,3,2021,14,11,202103,2021),('2021-03-15',202111,3,2021,15,11,202103,2021),('2021-03-16',202111,3,2021,16,11,202103,2021),('2021-03-17',202111,3,2021,17,11,202103,2021),('2021-03-18',202111,3,2021,18,11,202103,2021),('2021-03-19',202111,3,2021,19,11,202103,2021),('2021-03-20',202111,3,2021,20,11,202103,2021),('2021-03-21',202112,3,2021,21,12,202103,2021),('2021-03-22',202112,3,2021,22,12,202103,2021),('2021-03-23',202112,3,2021,23,12,202103,2021),('2021-03-24',202112,3,2021,24,12,202103,2021),('2021-03-25',202112,3,2021,25,12,202103,2021),('2021-03-26',202112,3,2021,26,12,202103,2021),('2021-03-27',202112,3,2021,27,12,202103,2021),('2021-03-28',202113,3,2021,28,13,202103,2021),('2021-03-29',202113,3,2021,29,13,202103,2021),('2021-03-30',202113,3,2021,30,13,202103,2021),('2021-03-31',202113,3,2021,31,13,202103,2021),('2021-04-01',202113,4,2021,1,13,202104,2021),('2021-04-02',202113,4,2021,2,13,202104,2021),('2021-04-03',202113,4,2021,3,13,202104,2021),('2021-04-04',202114,4,2021,4,14,202104,2021),('2021-04-05',202114,4,2021,5,14,202104,2021),('2021-04-06',202114,4,2021,6,14,202104,2021),('2021-04-07',202114,4,2021,7,14,202104,2021),('2021-04-08',202114,4,2021,8,14,202104,2021),('2021-04-09',202114,4,2021,9,14,202104,2021),('2021-04-10',202114,4,2021,10,14,202104,2021),('2021-04-11',202115,4,2021,11,15,202104,2021),('2021-04-12',202115,4,2021,12,15,202104,2021),('2021-04-13',202115,4,2021,13,15,202104,2021),('2021-04-14',202115,4,2021,14,15,202104,2021),('2021-04-15',202115,4,2021,15,15,202104,2021),('2021-04-16',202115,4,2021,16,15,202104,2021),('2021-04-17',202115,4,2021,17,15,202104,2021),('2021-04-18',202116,4,2021,18,16,202104,2021),('2021-04-19',202116,4,2021,19,16,202104,2021),('2021-04-20',202116,4,2021,20,16,202104,2021),('2021-04-21',202116,4,2021,21,16,202104,2021),('2021-04-22',202116,4,2021,22,16,202104,2021),('2021-04-23',202116,4,2021,23,16,202104,2021),('2021-04-24',202116,4,2021,24,16,202104,2021),('2021-04-25',202117,4,2021,25,17,202104,2021),('2021-04-26',202117,4,2021,26,17,202104,2021),('2021-04-27',202117,4,2021,27,17,202104,2021),('2021-04-28',202117,4,2021,28,17,202104,2021),('2021-04-29',202117,4,2021,29,17,202104,2021),('2021-04-30',202117,4,2021,30,17,202104,2021),('2021-05-01',202117,5,2021,1,17,202105,2021),('2021-05-02',202118,5,2021,2,18,202105,2021),('2021-05-03',202118,5,2021,3,18,202105,2021),('2021-05-04',202118,5,2021,4,18,202105,2021),('2021-05-05',202118,5,2021,5,18,202105,2021),('2021-05-06',202118,5,2021,6,18,202105,2021),('2021-05-07',202118,5,2021,7,18,202105,2021),('2021-05-08',202118,5,2021,8,18,202105,2021),('2021-05-09',202119,5,2021,9,19,202105,2021),('2021-05-10',202119,5,2021,10,19,202105,2021),('2021-05-11',202119,5,2021,11,19,202105,2021),('2021-05-12',202119,5,2021,12,19,202105,2021),('2021-05-13',202119,5,2021,13,19,202105,2021),('2021-05-14',202119,5,2021,14,19,202105,2021),('2021-05-15',202119,5,2021,15,19,202105,2021),('2021-05-16',202120,5,2021,16,20,202105,2021),('2021-05-17',202120,5,2021,17,20,202105,2021),('2021-05-18',202120,5,2021,18,20,202105,2021),('2021-05-19',202120,5,2021,19,20,202105,2021),('2021-05-20',202120,5,2021,20,20,202105,2021),('2021-05-21',202120,5,2021,21,20,202105,2021),('2021-05-22',202120,5,2021,22,20,202105,2021),('2021-05-23',202121,5,2021,23,21,202105,2021),('2021-05-24',202121,5,2021,24,21,202105,2021),('2021-05-25',202121,5,2021,25,21,202105,2021),('2021-05-26',202121,5,2021,26,21,202105,2021),('2021-05-27',202121,5,2021,27,21,202105,2021),('2021-05-28',202121,5,2021,28,21,202105,2021),('2021-05-29',202121,5,2021,29,21,202105,2021),('2021-05-30',202122,5,2021,30,22,202105,2021),('2021-05-31',202122,5,2021,31,22,202105,2021),('2021-06-01',202122,6,2021,1,22,202106,2021),('2021-06-02',202122,6,2021,2,22,202106,2021),('2021-06-03',202122,6,2021,3,22,202106,2021),('2021-06-04',202122,6,2021,4,22,202106,2021),('2021-06-05',202122,6,2021,5,22,202106,2021),('2021-06-06',202123,6,2021,6,23,202106,2021),('2021-06-07',202123,6,2021,7,23,202106,2021),('2021-06-08',202123,6,2021,8,23,202106,2021),('2021-06-09',202123,6,2021,9,23,202106,2021),('2021-06-10',202123,6,2021,10,23,202106,2021),('2021-06-11',202123,6,2021,11,23,202106,2021),('2021-06-12',202123,6,2021,12,23,202106,2021),('2021-06-13',202124,6,2021,13,24,202106,2021),('2021-06-14',202124,6,2021,14,24,202106,2021),('2021-06-15',202124,6,2021,15,24,202106,2021),('2021-06-16',202124,6,2021,16,24,202106,2021),('2021-06-17',202124,6,2021,17,24,202106,2021),('2021-06-18',202124,6,2021,18,24,202106,2021),('2021-06-19',202124,6,2021,19,24,202106,2021),('2021-06-20',202125,6,2021,20,25,202106,2021),('2021-06-21',202125,6,2021,21,25,202106,2021),('2021-06-22',202125,6,2021,22,25,202106,2021),('2021-06-23',202125,6,2021,23,25,202106,2021),('2021-06-24',202125,6,2021,24,25,202106,2021),('2021-06-25',202125,6,2021,25,25,202106,2021),('2021-06-26',202125,6,2021,26,25,202106,2021),('2021-06-27',202126,6,2021,27,26,202106,2021),('2021-06-28',202126,6,2021,28,26,202106,2021),('2021-06-29',202126,6,2021,29,26,202106,2021),('2021-06-30',202126,6,2021,30,26,202106,2021),('2021-07-01',202126,7,2021,1,26,202107,2021),('2021-07-02',202126,7,2021,2,26,202107,2021),('2021-07-03',202126,7,2021,3,26,202107,2021),('2021-07-04',202127,7,2021,4,27,202107,2021),('2021-07-05',202127,7,2021,5,27,202107,2021),('2021-07-06',202127,7,2021,6,27,202107,2021),('2021-07-07',202127,7,2021,7,27,202107,2021),('2021-07-08',202127,7,2021,8,27,202107,2021),('2021-07-09',202127,7,2021,9,27,202107,2021),('2021-07-10',202127,7,2021,10,27,202107,2021),('2021-07-11',202128,7,2021,11,28,202107,2021),('2021-07-12',202128,7,2021,12,28,202107,2021),('2021-07-13',202128,7,2021,13,28,202107,2021),('2021-07-14',202128,7,2021,14,28,202107,2021),('2021-07-15',202128,7,2021,15,28,202107,2021),('2021-07-16',202128,7,2021,16,28,202107,2021),('2021-07-17',202128,7,2021,17,28,202107,2021),('2021-07-18',202129,7,2021,18,29,202107,2021),('2021-07-19',202129,7,2021,19,29,202107,2021),('2021-07-20',202129,7,2021,20,29,202107,2021),('2021-07-21',202129,7,2021,21,29,202107,2021),('2021-07-22',202129,7,2021,22,29,202107,2021),('2021-07-23',202129,7,2021,23,29,202107,2021),('2021-07-24',202129,7,2021,24,29,202107,2021),('2021-07-25',202130,7,2021,25,30,202107,2021),('2021-07-26',202130,7,2021,26,30,202107,2021),('2021-07-27',202130,7,2021,27,30,202107,2021),('2021-07-28',202130,7,2021,28,30,202107,2021),('2021-07-29',202130,7,2021,29,30,202107,2021),('2021-07-30',202130,7,2021,30,30,202107,2021),('2021-07-31',202130,7,2021,31,30,202107,2021),('2021-08-01',202131,8,2021,1,31,202108,2021),('2021-08-02',202131,8,2021,2,31,202108,2021),('2021-08-03',202131,8,2021,3,31,202108,2021),('2021-08-04',202131,8,2021,4,31,202108,2021),('2021-08-05',202131,8,2021,5,31,202108,2021),('2021-08-06',202131,8,2021,6,31,202108,2021),('2021-08-07',202131,8,2021,7,31,202108,2021),('2021-08-08',202132,8,2021,8,32,202108,2021),('2021-08-09',202132,8,2021,9,32,202108,2021),('2021-08-10',202132,8,2021,10,32,202108,2021),('2021-08-11',202132,8,2021,11,32,202108,2021),('2021-08-12',202132,8,2021,12,32,202108,2021),('2021-08-13',202132,8,2021,13,32,202108,2021),('2021-08-14',202132,8,2021,14,32,202108,2021),('2021-08-15',202133,8,2021,15,33,202108,2021),('2021-08-16',202133,8,2021,16,33,202108,2021),('2021-08-17',202133,8,2021,17,33,202108,2021),('2021-08-18',202133,8,2021,18,33,202108,2021),('2021-08-19',202133,8,2021,19,33,202108,2021),('2021-08-20',202133,8,2021,20,33,202108,2021),('2021-08-21',202133,8,2021,21,33,202108,2021),('2021-08-22',202134,8,2021,22,34,202108,2021),('2021-08-23',202134,8,2021,23,34,202108,2021),('2021-08-24',202134,8,2021,24,34,202108,2021),('2021-08-25',202134,8,2021,25,34,202108,2021),('2021-08-26',202134,8,2021,26,34,202108,2021),('2021-08-27',202134,8,2021,27,34,202108,2021),('2021-08-28',202134,8,2021,28,34,202108,2021),('2021-08-29',202135,8,2021,29,35,202108,2021),('2021-08-30',202135,8,2021,30,35,202108,2021),('2021-08-31',202135,8,2021,31,35,202108,2021),('2021-09-01',202135,9,2021,1,35,202109,2021),('2021-09-02',202135,9,2021,2,35,202109,2021),('2021-09-03',202135,9,2021,3,35,202109,2021),('2021-09-04',202135,9,2021,4,35,202109,2021),('2021-09-05',202136,9,2021,5,36,202109,2021),('2021-09-06',202136,9,2021,6,36,202109,2021),('2021-09-07',202136,9,2021,7,36,202109,2021),('2021-09-08',202136,9,2021,8,36,202109,2021),('2021-09-09',202136,9,2021,9,36,202109,2021),('2021-09-10',202136,9,2021,10,36,202109,2021),('2021-09-11',202136,9,2021,11,36,202109,2021),('2021-09-12',202137,9,2021,12,37,202109,2021),('2021-09-13',202137,9,2021,13,37,202109,2021),('2021-09-14',202137,9,2021,14,37,202109,2021),('2021-09-15',202137,9,2021,15,37,202109,2021),('2021-09-16',202137,9,2021,16,37,202109,2021),('2021-09-17',202137,9,2021,17,37,202109,2021),('2021-09-18',202137,9,2021,18,37,202109,2021),('2021-09-19',202138,9,2021,19,38,202109,2021),('2021-09-20',202138,9,2021,20,38,202109,2021),('2021-09-21',202138,9,2021,21,38,202109,2021),('2021-09-22',202138,9,2021,22,38,202109,2021),('2021-09-23',202138,9,2021,23,38,202109,2021),('2021-09-24',202138,9,2021,24,38,202109,2021),('2021-09-25',202138,9,2021,25,38,202109,2021),('2021-09-26',202139,9,2021,26,39,202109,2021),('2021-09-27',202139,9,2021,27,39,202109,2021),('2021-09-28',202139,9,2021,28,39,202109,2021),('2021-09-29',202139,9,2021,29,39,202109,2021),('2021-09-30',202139,9,2021,30,39,202109,2021),('2021-10-01',202139,10,2021,1,39,202110,2021),('2021-10-02',202139,10,2021,2,39,202110,2021),('2021-10-03',202140,10,2021,3,40,202110,2021),('2021-10-04',202140,10,2021,4,40,202110,2021),('2021-10-05',202140,10,2021,5,40,202110,2021),('2021-10-06',202140,10,2021,6,40,202110,2021),('2021-10-07',202140,10,2021,7,40,202110,2021),('2021-10-08',202140,10,2021,8,40,202110,2021),('2021-10-09',202140,10,2021,9,40,202110,2021),('2021-10-10',202141,10,2021,10,41,202110,2021),('2021-10-11',202141,10,2021,11,41,202110,2021),('2021-10-12',202141,10,2021,12,41,202110,2021),('2021-10-13',202141,10,2021,13,41,202110,2021),('2021-10-14',202141,10,2021,14,41,202110,2021),('2021-10-15',202141,10,2021,15,41,202110,2021),('2021-10-16',202141,10,2021,16,41,202110,2021),('2021-10-17',202142,10,2021,17,42,202110,2021),('2021-10-18',202142,10,2021,18,42,202110,2021),('2021-10-19',202142,10,2021,19,42,202110,2021),('2021-10-20',202142,10,2021,20,42,202110,2021),('2021-10-21',202142,10,2021,21,42,202110,2021),('2021-10-22',202142,10,2021,22,42,202110,2021),('2021-10-23',202142,10,2021,23,42,202110,2021),('2021-10-24',202143,10,2021,24,43,202110,2021),('2021-10-25',202143,10,2021,25,43,202110,2021),('2021-10-26',202143,10,2021,26,43,202110,2021),('2021-10-27',202143,10,2021,27,43,202110,2021),('2021-10-28',202143,10,2021,28,43,202110,2021),('2021-10-29',202143,10,2021,29,43,202110,2021),('2021-10-30',202143,10,2021,30,43,202110,2021),('2021-10-31',202144,10,2021,31,44,202110,2021),('2021-11-01',202144,11,2021,1,44,202111,2021),('2021-11-02',202144,11,2021,2,44,202111,2021),('2021-11-03',202144,11,2021,3,44,202111,2021),('2021-11-04',202144,11,2021,4,44,202111,2021),('2021-11-05',202144,11,2021,5,44,202111,2021),('2021-11-06',202144,11,2021,6,44,202111,2021),('2021-11-07',202145,11,2021,7,45,202111,2021),('2021-11-08',202145,11,2021,8,45,202111,2021),('2021-11-09',202145,11,2021,9,45,202111,2021),('2021-11-10',202145,11,2021,10,45,202111,2021),('2021-11-11',202145,11,2021,11,45,202111,2021),('2021-11-12',202145,11,2021,12,45,202111,2021),('2021-11-13',202145,11,2021,13,45,202111,2021),('2021-11-14',202146,11,2021,14,46,202111,2021),('2021-11-15',202146,11,2021,15,46,202111,2021),('2021-11-16',202146,11,2021,16,46,202111,2021),('2021-11-17',202146,11,2021,17,46,202111,2021),('2021-11-18',202146,11,2021,18,46,202111,2021),('2021-11-19',202146,11,2021,19,46,202111,2021),('2021-11-20',202146,11,2021,20,46,202111,2021),('2021-11-21',202147,11,2021,21,47,202111,2021),('2021-11-22',202147,11,2021,22,47,202111,2021),('2021-11-23',202147,11,2021,23,47,202111,2021),('2021-11-24',202147,11,2021,24,47,202111,2021),('2021-11-25',202147,11,2021,25,47,202111,2021),('2021-11-26',202147,11,2021,26,47,202111,2021),('2021-11-27',202147,11,2021,27,47,202111,2021),('2021-11-28',202148,11,2021,28,48,202111,2021),('2021-11-29',202148,11,2021,29,48,202111,2021),('2021-11-30',202148,11,2021,30,48,202111,2021),('2021-12-01',202148,12,2021,1,48,202112,2022),('2021-12-02',202148,12,2021,2,48,202112,2022),('2021-12-03',202148,12,2021,3,48,202112,2022),('2021-12-04',202148,12,2021,4,48,202112,2022),('2021-12-05',202149,12,2021,5,49,202112,2022),('2021-12-06',202149,12,2021,6,49,202112,2022),('2021-12-07',202149,12,2021,7,49,202112,2022),('2021-12-08',202149,12,2021,8,49,202112,2022),('2021-12-09',202149,12,2021,9,49,202112,2022),('2021-12-10',202149,12,2021,10,49,202112,2022),('2021-12-11',202149,12,2021,11,49,202112,2022),('2021-12-12',202150,12,2021,12,50,202112,2022),('2021-12-13',202150,12,2021,13,50,202112,2022),('2021-12-14',202150,12,2021,14,50,202112,2022),('2021-12-15',202150,12,2021,15,50,202112,2022),('2021-12-16',202150,12,2021,16,50,202112,2022),('2021-12-17',202150,12,2021,17,50,202112,2022),('2021-12-18',202150,12,2021,18,50,202112,2022),('2021-12-19',202151,12,2021,19,51,202112,2022),('2021-12-20',202151,12,2021,20,51,202112,2022),('2021-12-21',202151,12,2021,21,51,202112,2022),('2021-12-22',202151,12,2021,22,51,202112,2022),('2021-12-23',202151,12,2021,23,51,202112,2022),('2021-12-24',202151,12,2021,24,51,202112,2022),('2021-12-25',202151,12,2021,25,51,202112,2022),('2021-12-26',202152,12,2021,26,52,202112,2022),('2021-12-27',202152,12,2021,27,52,202112,2022),('2021-12-28',202152,12,2021,28,52,202112,2022),('2021-12-29',202152,12,2021,29,52,202112,2022),('2021-12-30',202152,12,2021,30,52,202112,2022),('2021-12-31',202152,12,2021,31,52,202112,2022),('2022-01-01',202252,1,2022,1,52,202201,2022),('2022-01-02',202201,1,2022,2,1,202201,2022),('2022-01-03',202201,1,2022,3,1,202201,2022),('2022-01-04',202201,1,2022,4,1,202201,2022),('2022-01-05',202201,1,2022,5,1,202201,2022),('2022-01-06',202201,1,2022,6,1,202201,2022),('2022-01-07',202201,1,2022,7,1,202201,2022),('2022-01-08',202201,1,2022,8,1,202201,2022),('2022-01-09',202202,1,2022,9,2,202201,2022),('2022-01-10',202202,1,2022,10,2,202201,2022),('2022-01-11',202202,1,2022,11,2,202201,2022),('2022-01-12',202202,1,2022,12,2,202201,2022),('2022-01-13',202202,1,2022,13,2,202201,2022),('2022-01-14',202202,1,2022,14,2,202201,2022),('2022-01-15',202202,1,2022,15,2,202201,2022),('2022-01-16',202203,1,2022,16,3,202201,2022),('2022-01-17',202203,1,2022,17,3,202201,2022),('2022-01-18',202203,1,2022,18,3,202201,2022),('2022-01-19',202203,1,2022,19,3,202201,2022),('2022-01-20',202203,1,2022,20,3,202201,2022),('2022-01-21',202203,1,2022,21,3,202201,2022),('2022-01-22',202203,1,2022,22,3,202201,2022),('2022-01-23',202204,1,2022,23,4,202201,2022),('2022-01-24',202204,1,2022,24,4,202201,2022),('2022-01-25',202204,1,2022,25,4,202201,2022),('2022-01-26',202204,1,2022,26,4,202201,2022),('2022-01-27',202204,1,2022,27,4,202201,2022),('2022-01-28',202204,1,2022,28,4,202201,2022),('2022-01-29',202204,1,2022,29,4,202201,2022),('2022-01-30',202205,1,2022,30,5,202201,2022),('2022-01-31',202205,1,2022,31,5,202201,2022),('2022-02-01',202205,2,2022,1,5,202202,2022),('2022-02-02',202205,2,2022,2,5,202202,2022),('2022-02-03',202205,2,2022,3,5,202202,2022),('2022-02-04',202205,2,2022,4,5,202202,2022),('2022-02-05',202205,2,2022,5,5,202202,2022),('2022-02-06',202206,2,2022,6,6,202202,2022),('2022-02-07',202206,2,2022,7,6,202202,2022),('2022-02-08',202206,2,2022,8,6,202202,2022),('2022-02-09',202206,2,2022,9,6,202202,2022),('2022-02-10',202206,2,2022,10,6,202202,2022),('2022-02-11',202206,2,2022,11,6,202202,2022),('2022-02-12',202206,2,2022,12,6,202202,2022),('2022-02-13',202207,2,2022,13,7,202202,2022),('2022-02-14',202207,2,2022,14,7,202202,2022),('2022-02-15',202207,2,2022,15,7,202202,2022),('2022-02-16',202207,2,2022,16,7,202202,2022),('2022-02-17',202207,2,2022,17,7,202202,2022),('2022-02-18',202207,2,2022,18,7,202202,2022),('2022-02-19',202207,2,2022,19,7,202202,2022),('2022-02-20',202208,2,2022,20,8,202202,2022),('2022-02-21',202208,2,2022,21,8,202202,2022),('2022-02-22',202208,2,2022,22,8,202202,2022),('2022-02-23',202208,2,2022,23,8,202202,2022),('2022-02-24',202208,2,2022,24,8,202202,2022),('2022-02-25',202208,2,2022,25,8,202202,2022),('2022-02-26',202208,2,2022,26,8,202202,2022),('2022-02-27',202209,2,2022,27,9,202202,2022),('2022-02-28',202209,2,2022,28,9,202202,2022),('2022-03-01',202209,3,2022,1,9,202203,2022),('2022-03-02',202209,3,2022,2,9,202203,2022),('2022-03-03',202209,3,2022,3,9,202203,2022),('2022-03-04',202209,3,2022,4,9,202203,2022),('2022-03-05',202209,3,2022,5,9,202203,2022),('2022-03-06',202210,3,2022,6,10,202203,2022),('2022-03-07',202210,3,2022,7,10,202203,2022),('2022-03-08',202210,3,2022,8,10,202203,2022),('2022-03-09',202210,3,2022,9,10,202203,2022),('2022-03-10',202210,3,2022,10,10,202203,2022),('2022-03-11',202210,3,2022,11,10,202203,2022),('2022-03-12',202210,3,2022,12,10,202203,2022),('2022-03-13',202211,3,2022,13,11,202203,2022),('2022-03-14',202211,3,2022,14,11,202203,2022),('2022-03-15',202211,3,2022,15,11,202203,2022),('2022-03-16',202211,3,2022,16,11,202203,2022),('2022-03-17',202211,3,2022,17,11,202203,2022),('2022-03-18',202211,3,2022,18,11,202203,2022),('2022-03-19',202211,3,2022,19,11,202203,2022),('2022-03-20',202212,3,2022,20,12,202203,2022),('2022-03-21',202212,3,2022,21,12,202203,2022),('2022-03-22',202212,3,2022,22,12,202203,2022),('2022-03-23',202212,3,2022,23,12,202203,2022),('2022-03-24',202212,3,2022,24,12,202203,2022),('2022-03-25',202212,3,2022,25,12,202203,2022),('2022-03-26',202212,3,2022,26,12,202203,2022),('2022-03-27',202213,3,2022,27,13,202203,2022),('2022-03-28',202213,3,2022,28,13,202203,2022),('2022-03-29',202213,3,2022,29,13,202203,2022),('2022-03-30',202213,3,2022,30,13,202203,2022),('2022-03-31',202213,3,2022,31,13,202203,2022),('2022-04-01',202213,4,2022,1,13,202204,2022),('2022-04-02',202213,4,2022,2,13,202204,2022),('2022-04-03',202214,4,2022,3,14,202204,2022),('2022-04-04',202214,4,2022,4,14,202204,2022),('2022-04-05',202214,4,2022,5,14,202204,2022),('2022-04-06',202214,4,2022,6,14,202204,2022),('2022-04-07',202214,4,2022,7,14,202204,2022),('2022-04-08',202214,4,2022,8,14,202204,2022),('2022-04-09',202214,4,2022,9,14,202204,2022),('2022-04-10',202215,4,2022,10,15,202204,2022),('2022-04-11',202215,4,2022,11,15,202204,2022),('2022-04-12',202215,4,2022,12,15,202204,2022),('2022-04-13',202215,4,2022,13,15,202204,2022),('2022-04-14',202215,4,2022,14,15,202204,2022),('2022-04-15',202215,4,2022,15,15,202204,2022),('2022-04-16',202215,4,2022,16,15,202204,2022),('2022-04-17',202216,4,2022,17,16,202204,2022),('2022-04-18',202216,4,2022,18,16,202204,2022),('2022-04-19',202216,4,2022,19,16,202204,2022),('2022-04-20',202216,4,2022,20,16,202204,2022),('2022-04-21',202216,4,2022,21,16,202204,2022),('2022-04-22',202216,4,2022,22,16,202204,2022),('2022-04-23',202216,4,2022,23,16,202204,2022),('2022-04-24',202217,4,2022,24,17,202204,2022),('2022-04-25',202217,4,2022,25,17,202204,2022),('2022-04-26',202217,4,2022,26,17,202204,2022),('2022-04-27',202217,4,2022,27,17,202204,2022),('2022-04-28',202217,4,2022,28,17,202204,2022),('2022-04-29',202217,4,2022,29,17,202204,2022),('2022-04-30',202217,4,2022,30,17,202204,2022),('2022-05-01',202218,5,2022,1,18,202205,2022),('2022-05-02',202218,5,2022,2,18,202205,2022),('2022-05-03',202218,5,2022,3,18,202205,2022),('2022-05-04',202218,5,2022,4,18,202205,2022),('2022-05-05',202218,5,2022,5,18,202205,2022),('2022-05-06',202218,5,2022,6,18,202205,2022),('2022-05-07',202218,5,2022,7,18,202205,2022),('2022-05-08',202219,5,2022,8,19,202205,2022),('2022-05-09',202219,5,2022,9,19,202205,2022),('2022-05-10',202219,5,2022,10,19,202205,2022),('2022-05-11',202219,5,2022,11,19,202205,2022),('2022-05-12',202219,5,2022,12,19,202205,2022),('2022-05-13',202219,5,2022,13,19,202205,2022),('2022-05-14',202219,5,2022,14,19,202205,2022),('2022-05-15',202220,5,2022,15,20,202205,2022),('2022-05-16',202220,5,2022,16,20,202205,2022),('2022-05-17',202220,5,2022,17,20,202205,2022),('2022-05-18',202220,5,2022,18,20,202205,2022),('2022-05-19',202220,5,2022,19,20,202205,2022),('2022-05-20',202220,5,2022,20,20,202205,2022),('2022-05-21',202220,5,2022,21,20,202205,2022),('2022-05-22',202221,5,2022,22,21,202205,2022),('2022-05-23',202221,5,2022,23,21,202205,2022),('2022-05-24',202221,5,2022,24,21,202205,2022),('2022-05-25',202221,5,2022,25,21,202205,2022),('2022-05-26',202221,5,2022,26,21,202205,2022),('2022-05-27',202221,5,2022,27,21,202205,2022),('2022-05-28',202221,5,2022,28,21,202205,2022),('2022-05-29',202222,5,2022,29,22,202205,2022),('2022-05-30',202222,5,2022,30,22,202205,2022),('2022-05-31',202222,5,2022,31,22,202205,2022),('2022-06-01',202222,6,2022,1,22,202206,2022),('2022-06-02',202222,6,2022,2,22,202206,2022),('2022-06-03',202222,6,2022,3,22,202206,2022),('2022-06-04',202222,6,2022,4,22,202206,2022),('2022-06-05',202223,6,2022,5,23,202206,2022),('2022-06-06',202223,6,2022,6,23,202206,2022),('2022-06-07',202223,6,2022,7,23,202206,2022),('2022-06-08',202223,6,2022,8,23,202206,2022),('2022-06-09',202223,6,2022,9,23,202206,2022),('2022-06-10',202223,6,2022,10,23,202206,2022),('2022-06-11',202223,6,2022,11,23,202206,2022),('2022-06-12',202224,6,2022,12,24,202206,2022),('2022-06-13',202224,6,2022,13,24,202206,2022),('2022-06-14',202224,6,2022,14,24,202206,2022),('2022-06-15',202224,6,2022,15,24,202206,2022),('2022-06-16',202224,6,2022,16,24,202206,2022),('2022-06-17',202224,6,2022,17,24,202206,2022),('2022-06-18',202224,6,2022,18,24,202206,2022),('2022-06-19',202225,6,2022,19,25,202206,2022),('2022-06-20',202225,6,2022,20,25,202206,2022),('2022-06-21',202225,6,2022,21,25,202206,2022),('2022-06-22',202225,6,2022,22,25,202206,2022),('2022-06-23',202225,6,2022,23,25,202206,2022),('2022-06-24',202225,6,2022,24,25,202206,2022),('2022-06-25',202225,6,2022,25,25,202206,2022),('2022-06-26',202226,6,2022,26,26,202206,2022),('2022-06-27',202226,6,2022,27,26,202206,2022),('2022-06-28',202226,6,2022,28,26,202206,2022),('2022-06-29',202226,6,2022,29,26,202206,2022),('2022-06-30',202226,6,2022,30,26,202206,2022),('2022-07-01',202226,7,2022,1,26,202207,2022),('2022-07-02',202226,7,2022,2,26,202207,2022),('2022-07-03',202227,7,2022,3,27,202207,2022),('2022-07-04',202227,7,2022,4,27,202207,2022),('2022-07-05',202227,7,2022,5,27,202207,2022),('2022-07-06',202227,7,2022,6,27,202207,2022),('2022-07-07',202227,7,2022,7,27,202207,2022),('2022-07-08',202227,7,2022,8,27,202207,2022),('2022-07-09',202227,7,2022,9,27,202207,2022),('2022-07-10',202228,7,2022,10,28,202207,2022),('2022-07-11',202228,7,2022,11,28,202207,2022),('2022-07-12',202228,7,2022,12,28,202207,2022),('2022-07-13',202228,7,2022,13,28,202207,2022),('2022-07-14',202228,7,2022,14,28,202207,2022),('2022-07-15',202228,7,2022,15,28,202207,2022),('2022-07-16',202228,7,2022,16,28,202207,2022),('2022-07-17',202229,7,2022,17,29,202207,2022),('2022-07-18',202229,7,2022,18,29,202207,2022),('2022-07-19',202229,7,2022,19,29,202207,2022),('2022-07-20',202229,7,2022,20,29,202207,2022),('2022-07-21',202229,7,2022,21,29,202207,2022),('2022-07-22',202229,7,2022,22,29,202207,2022),('2022-07-23',202229,7,2022,23,29,202207,2022),('2022-07-24',202230,7,2022,24,30,202207,2022),('2022-07-25',202230,7,2022,25,30,202207,2022),('2022-07-26',202230,7,2022,26,30,202207,2022),('2022-07-27',202230,7,2022,27,30,202207,2022),('2022-07-28',202230,7,2022,28,30,202207,2022),('2022-07-29',202230,7,2022,29,30,202207,2022),('2022-07-30',202230,7,2022,30,30,202207,2022),('2022-07-31',202231,7,2022,31,31,202207,2022),('2022-08-01',202231,8,2022,1,31,202208,2022),('2022-08-02',202231,8,2022,2,31,202208,2022),('2022-08-03',202231,8,2022,3,31,202208,2022),('2022-08-04',202231,8,2022,4,31,202208,2022),('2022-08-05',202231,8,2022,5,31,202208,2022),('2022-08-06',202231,8,2022,6,31,202208,2022),('2022-08-07',202232,8,2022,7,32,202208,2022),('2022-08-08',202232,8,2022,8,32,202208,2022),('2022-08-09',202232,8,2022,9,32,202208,2022),('2022-08-10',202232,8,2022,10,32,202208,2022),('2022-08-11',202232,8,2022,11,32,202208,2022),('2022-08-12',202232,8,2022,12,32,202208,2022),('2022-08-13',202232,8,2022,13,32,202208,2022),('2022-08-14',202233,8,2022,14,33,202208,2022),('2022-08-15',202233,8,2022,15,33,202208,2022),('2022-08-16',202233,8,2022,16,33,202208,2022),('2022-08-17',202233,8,2022,17,33,202208,2022),('2022-08-18',202233,8,2022,18,33,202208,2022),('2022-08-19',202233,8,2022,19,33,202208,2022),('2022-08-20',202233,8,2022,20,33,202208,2022),('2022-08-21',202234,8,2022,21,34,202208,2022),('2022-08-22',202234,8,2022,22,34,202208,2022),('2022-08-23',202234,8,2022,23,34,202208,2022),('2022-08-24',202234,8,2022,24,34,202208,2022),('2022-08-25',202234,8,2022,25,34,202208,2022),('2022-08-26',202234,8,2022,26,34,202208,2022),('2022-08-27',202234,8,2022,27,34,202208,2022),('2022-08-28',202235,8,2022,28,35,202208,2022),('2022-08-29',202235,8,2022,29,35,202208,2022),('2022-08-30',202235,8,2022,30,35,202208,2022),('2022-08-31',202235,8,2022,31,35,202208,2022),('2022-09-01',202235,9,2022,1,35,202209,2022),('2022-09-02',202235,9,2022,2,35,202209,2022),('2022-09-03',202235,9,2022,3,35,202209,2022),('2022-09-04',202236,9,2022,4,36,202209,2022),('2022-09-05',202236,9,2022,5,36,202209,2022),('2022-09-06',202236,9,2022,6,36,202209,2022),('2022-09-07',202236,9,2022,7,36,202209,2022),('2022-09-08',202236,9,2022,8,36,202209,2022),('2022-09-09',202236,9,2022,9,36,202209,2022),('2022-09-10',202236,9,2022,10,36,202209,2022),('2022-09-11',202237,9,2022,11,37,202209,2022),('2022-09-12',202237,9,2022,12,37,202209,2022),('2022-09-13',202237,9,2022,13,37,202209,2022),('2022-09-14',202237,9,2022,14,37,202209,2022),('2022-09-15',202237,9,2022,15,37,202209,2022),('2022-09-16',202237,9,2022,16,37,202209,2022),('2022-09-17',202237,9,2022,17,37,202209,2022),('2022-09-18',202238,9,2022,18,38,202209,2022),('2022-09-19',202238,9,2022,19,38,202209,2022),('2022-09-20',202238,9,2022,20,38,202209,2022),('2022-09-21',202238,9,2022,21,38,202209,2022),('2022-09-22',202238,9,2022,22,38,202209,2022),('2022-09-23',202238,9,2022,23,38,202209,2022),('2022-09-24',202238,9,2022,24,38,202209,2022),('2022-09-25',202239,9,2022,25,39,202209,2022),('2022-09-26',202239,9,2022,26,39,202209,2022),('2022-09-27',202239,9,2022,27,39,202209,2022),('2022-09-28',202239,9,2022,28,39,202209,2022),('2022-09-29',202239,9,2022,29,39,202209,2022),('2022-09-30',202239,9,2022,30,39,202209,2022),('2022-10-01',202239,10,2022,1,39,202210,2022),('2022-10-02',202240,10,2022,2,40,202210,2022),('2022-10-03',202240,10,2022,3,40,202210,2022),('2022-10-04',202240,10,2022,4,40,202210,2022),('2022-10-05',202240,10,2022,5,40,202210,2022),('2022-10-06',202240,10,2022,6,40,202210,2022),('2022-10-07',202240,10,2022,7,40,202210,2022),('2022-10-08',202240,10,2022,8,40,202210,2022),('2022-10-09',202241,10,2022,9,41,202210,2022),('2022-10-10',202241,10,2022,10,41,202210,2022),('2022-10-11',202241,10,2022,11,41,202210,2022),('2022-10-12',202241,10,2022,12,41,202210,2022),('2022-10-13',202241,10,2022,13,41,202210,2022),('2022-10-14',202241,10,2022,14,41,202210,2022),('2022-10-15',202241,10,2022,15,41,202210,2022),('2022-10-16',202242,10,2022,16,42,202210,2022),('2022-10-17',202242,10,2022,17,42,202210,2022),('2022-10-18',202242,10,2022,18,42,202210,2022),('2022-10-19',202242,10,2022,19,42,202210,2022),('2022-10-20',202242,10,2022,20,42,202210,2022),('2022-10-21',202242,10,2022,21,42,202210,2022),('2022-10-22',202242,10,2022,22,42,202210,2022),('2022-10-23',202243,10,2022,23,43,202210,2022),('2022-10-24',202243,10,2022,24,43,202210,2022),('2022-10-25',202243,10,2022,25,43,202210,2022),('2022-10-26',202243,10,2022,26,43,202210,2022),('2022-10-27',202243,10,2022,27,43,202210,2022),('2022-10-28',202243,10,2022,28,43,202210,2022),('2022-10-29',202243,10,2022,29,43,202210,2022),('2022-10-30',202244,10,2022,30,44,202210,2022),('2022-10-31',202244,10,2022,31,44,202210,2022),('2022-11-01',202244,11,2022,1,44,202211,2022),('2022-11-02',202244,11,2022,2,44,202211,2022),('2022-11-03',202244,11,2022,3,44,202211,2022),('2022-11-04',202244,11,2022,4,44,202211,2022),('2022-11-05',202244,11,2022,5,44,202211,2022),('2022-11-06',202245,11,2022,6,45,202211,2022),('2022-11-07',202245,11,2022,7,45,202211,2022),('2022-11-08',202245,11,2022,8,45,202211,2022),('2022-11-09',202245,11,2022,9,45,202211,2022),('2022-11-10',202245,11,2022,10,45,202211,2022),('2022-11-11',202245,11,2022,11,45,202211,2022),('2022-11-12',202245,11,2022,12,45,202211,2022),('2022-11-13',202246,11,2022,13,46,202211,2022),('2022-11-14',202246,11,2022,14,46,202211,2022),('2022-11-15',202246,11,2022,15,46,202211,2022),('2022-11-16',202246,11,2022,16,46,202211,2022),('2022-11-17',202246,11,2022,17,46,202211,2022),('2022-11-18',202246,11,2022,18,46,202211,2022),('2022-11-19',202246,11,2022,19,46,202211,2022),('2022-11-20',202247,11,2022,20,47,202211,2022),('2022-11-21',202247,11,2022,21,47,202211,2022),('2022-11-22',202247,11,2022,22,47,202211,2022),('2022-11-23',202247,11,2022,23,47,202211,2022),('2022-11-24',202247,11,2022,24,47,202211,2022),('2022-11-25',202247,11,2022,25,47,202211,2022),('2022-11-26',202247,11,2022,26,47,202211,2022),('2022-11-27',202248,11,2022,27,48,202211,2022),('2022-11-28',202248,11,2022,28,48,202211,2022),('2022-11-29',202248,11,2022,29,48,202211,2022),('2022-11-30',202248,11,2022,30,48,202211,2022),('2022-12-01',202248,12,2022,1,48,202212,2023),('2022-12-02',202248,12,2022,2,48,202212,2023),('2022-12-03',202248,12,2022,3,48,202212,2023),('2022-12-04',202249,12,2022,4,49,202212,2023),('2022-12-05',202249,12,2022,5,49,202212,2023),('2022-12-06',202249,12,2022,6,49,202212,2023),('2022-12-07',202249,12,2022,7,49,202212,2023),('2022-12-08',202249,12,2022,8,49,202212,2023),('2022-12-09',202249,12,2022,9,49,202212,2023),('2022-12-10',202249,12,2022,10,49,202212,2023),('2022-12-11',202250,12,2022,11,50,202212,2023),('2022-12-12',202250,12,2022,12,50,202212,2023),('2022-12-13',202250,12,2022,13,50,202212,2023),('2022-12-14',202250,12,2022,14,50,202212,2023),('2022-12-15',202250,12,2022,15,50,202212,2023),('2022-12-16',202250,12,2022,16,50,202212,2023),('2022-12-17',202250,12,2022,17,50,202212,2023),('2022-12-18',202251,12,2022,18,51,202212,2023),('2022-12-19',202251,12,2022,19,51,202212,2023),('2022-12-20',202251,12,2022,20,51,202212,2023),('2022-12-21',202251,12,2022,21,51,202212,2023),('2022-12-22',202251,12,2022,22,51,202212,2023),('2022-12-23',202251,12,2022,23,51,202212,2023),('2022-12-24',202251,12,2022,24,51,202212,2023),('2022-12-25',202252,12,2022,25,52,202212,2023),('2022-12-26',202252,12,2022,26,52,202212,2023),('2022-12-27',202252,12,2022,27,52,202212,2023),('2022-12-28',202252,12,2022,28,52,202212,2023),('2022-12-29',202252,12,2022,29,52,202212,2023),('2022-12-30',202252,12,2022,30,52,202212,2023),('2022-12-31',202252,12,2022,31,52,202212,2023),('2023-01-01',202353,1,2023,1,1,202301,2023),('2023-01-02',202301,1,2023,2,1,202301,2023),('2023-01-03',202301,1,2023,3,1,202301,2023),('2023-01-04',202301,1,2023,4,1,202301,2023),('2023-01-05',202301,1,2023,5,1,202301,2023),('2023-01-06',202301,1,2023,6,1,202301,2023),('2023-01-07',202301,1,2023,7,1,202301,2023),('2023-01-08',202302,1,2023,8,2,202301,2023),('2023-01-09',202302,1,2023,9,2,202301,2023),('2023-01-10',202302,1,2023,10,2,202301,2023),('2023-01-11',202302,1,2023,11,2,202301,2023),('2023-01-12',202302,1,2023,12,2,202301,2023),('2023-01-13',202302,1,2023,13,2,202301,2023),('2023-01-14',202302,1,2023,14,2,202301,2023),('2023-01-15',202303,1,2023,15,3,202301,2023),('2023-01-16',202303,1,2023,16,3,202301,2023),('2023-01-17',202303,1,2023,17,3,202301,2023),('2023-01-18',202303,1,2023,18,3,202301,2023),('2023-01-19',202303,1,2023,19,3,202301,2023),('2023-01-20',202303,1,2023,20,3,202301,2023),('2023-01-21',202303,1,2023,21,3,202301,2023),('2023-01-22',202304,1,2023,22,4,202301,2023),('2023-01-23',202304,1,2023,23,4,202301,2023),('2023-01-24',202304,1,2023,24,4,202301,2023),('2023-01-25',202304,1,2023,25,4,202301,2023),('2023-01-26',202304,1,2023,26,4,202301,2023),('2023-01-27',202304,1,2023,27,4,202301,2023),('2023-01-28',202304,1,2023,28,4,202301,2023),('2023-01-29',202305,1,2023,29,5,202301,2023),('2023-01-30',202305,1,2023,30,5,202301,2023),('2023-01-31',202305,1,2023,31,5,202301,2023),('2023-02-01',202305,2,2023,1,5,202302,2023),('2023-02-02',202305,2,2023,2,5,202302,2023),('2023-02-03',202305,2,2023,3,5,202302,2023),('2023-02-04',202305,2,2023,4,5,202302,2023),('2023-02-05',202306,2,2023,5,6,202302,2023),('2023-02-06',202306,2,2023,6,6,202302,2023),('2023-02-07',202306,2,2023,7,6,202302,2023),('2023-02-08',202306,2,2023,8,6,202302,2023),('2023-02-09',202306,2,2023,9,6,202302,2023),('2023-02-10',202306,2,2023,10,6,202302,2023),('2023-02-11',202306,2,2023,11,6,202302,2023),('2023-02-12',202307,2,2023,12,7,202302,2023),('2023-02-13',202307,2,2023,13,7,202302,2023),('2023-02-14',202307,2,2023,14,7,202302,2023),('2023-02-15',202307,2,2023,15,7,202302,2023),('2023-02-16',202307,2,2023,16,7,202302,2023),('2023-02-17',202307,2,2023,17,7,202302,2023),('2023-02-18',202307,2,2023,18,7,202302,2023),('2023-02-19',202308,2,2023,19,8,202302,2023),('2023-02-20',202308,2,2023,20,8,202302,2023),('2023-02-21',202308,2,2023,21,8,202302,2023),('2023-02-22',202308,2,2023,22,8,202302,2023),('2023-02-23',202308,2,2023,23,8,202302,2023),('2023-02-24',202308,2,2023,24,8,202302,2023),('2023-02-25',202308,2,2023,25,8,202302,2023),('2023-02-26',202309,2,2023,26,9,202302,2023),('2023-02-27',202309,2,2023,27,9,202302,2023),('2023-02-28',202309,2,2023,28,9,202302,2023),('2023-03-01',202309,3,2023,1,9,202303,2023),('2023-03-02',202309,3,2023,2,9,202303,2023),('2023-03-03',202309,3,2023,3,9,202303,2023),('2023-03-04',202309,3,2023,4,9,202303,2023),('2023-03-05',202310,3,2023,5,10,202303,2023),('2023-03-06',202310,3,2023,6,10,202303,2023),('2023-03-07',202310,3,2023,7,10,202303,2023),('2023-03-08',202310,3,2023,8,10,202303,2023),('2023-03-09',202310,3,2023,9,10,202303,2023),('2023-03-10',202310,3,2023,10,10,202303,2023),('2023-03-11',202310,3,2023,11,10,202303,2023),('2023-03-12',202311,3,2023,12,11,202303,2023),('2023-03-13',202311,3,2023,13,11,202303,2023),('2023-03-14',202311,3,2023,14,11,202303,2023),('2023-03-15',202311,3,2023,15,11,202303,2023),('2023-03-16',202311,3,2023,16,11,202303,2023),('2023-03-17',202311,3,2023,17,11,202303,2023),('2023-03-18',202311,3,2023,18,11,202303,2023),('2023-03-19',202312,3,2023,19,12,202303,2023),('2023-03-20',202312,3,2023,20,12,202303,2023),('2023-03-21',202312,3,2023,21,12,202303,2023),('2023-03-22',202312,3,2023,22,12,202303,2023),('2023-03-23',202312,3,2023,23,12,202303,2023),('2023-03-24',202312,3,2023,24,12,202303,2023),('2023-03-25',202312,3,2023,25,12,202303,2023),('2023-03-26',202313,3,2023,26,13,202303,2023),('2023-03-27',202313,3,2023,27,13,202303,2023),('2023-03-28',202313,3,2023,28,13,202303,2023),('2023-03-29',202313,3,2023,29,13,202303,2023),('2023-03-30',202313,3,2023,30,13,202303,2023),('2023-03-31',202313,3,2023,31,13,202303,2023),('2023-04-01',202313,4,2023,1,13,202304,2023),('2023-04-02',202314,4,2023,2,14,202304,2023),('2023-04-03',202314,4,2023,3,14,202304,2023),('2023-04-04',202314,4,2023,4,14,202304,2023),('2023-04-05',202314,4,2023,5,14,202304,2023),('2023-04-06',202314,4,2023,6,14,202304,2023),('2023-04-07',202314,4,2023,7,14,202304,2023),('2023-04-08',202314,4,2023,8,14,202304,2023),('2023-04-09',202315,4,2023,9,15,202304,2023),('2023-04-10',202315,4,2023,10,15,202304,2023),('2023-04-11',202315,4,2023,11,15,202304,2023),('2023-04-12',202315,4,2023,12,15,202304,2023),('2023-04-13',202315,4,2023,13,15,202304,2023),('2023-04-14',202315,4,2023,14,15,202304,2023),('2023-04-15',202315,4,2023,15,15,202304,2023),('2023-04-16',202316,4,2023,16,16,202304,2023),('2023-04-17',202316,4,2023,17,16,202304,2023),('2023-04-18',202316,4,2023,18,16,202304,2023),('2023-04-19',202316,4,2023,19,16,202304,2023),('2023-04-20',202316,4,2023,20,16,202304,2023),('2023-04-21',202316,4,2023,21,16,202304,2023),('2023-04-22',202316,4,2023,22,16,202304,2023),('2023-04-23',202317,4,2023,23,17,202304,2023),('2023-04-24',202317,4,2023,24,17,202304,2023),('2023-04-25',202317,4,2023,25,17,202304,2023),('2023-04-26',202317,4,2023,26,17,202304,2023),('2023-04-27',202317,4,2023,27,17,202304,2023),('2023-04-28',202317,4,2023,28,17,202304,2023),('2023-04-29',202317,4,2023,29,17,202304,2023),('2023-04-30',202318,4,2023,30,18,202304,2023),('2023-05-01',202318,5,2023,1,18,202305,2023),('2023-05-02',202318,5,2023,2,18,202305,2023),('2023-05-03',202318,5,2023,3,18,202305,2023),('2023-05-04',202318,5,2023,4,18,202305,2023),('2023-05-05',202318,5,2023,5,18,202305,2023),('2023-05-06',202318,5,2023,6,18,202305,2023),('2023-05-07',202319,5,2023,7,19,202305,2023),('2023-05-08',202319,5,2023,8,19,202305,2023),('2023-05-09',202319,5,2023,9,19,202305,2023),('2023-05-10',202319,5,2023,10,19,202305,2023),('2023-05-11',202319,5,2023,11,19,202305,2023),('2023-05-12',202319,5,2023,12,19,202305,2023),('2023-05-13',202319,5,2023,13,19,202305,2023),('2023-05-14',202320,5,2023,14,20,202305,2023),('2023-05-15',202320,5,2023,15,20,202305,2023),('2023-05-16',202320,5,2023,16,20,202305,2023),('2023-05-17',202320,5,2023,17,20,202305,2023),('2023-05-18',202320,5,2023,18,20,202305,2023),('2023-05-19',202320,5,2023,19,20,202305,2023),('2023-05-20',202320,5,2023,20,20,202305,2023),('2023-05-21',202321,5,2023,21,21,202305,2023),('2023-05-22',202321,5,2023,22,21,202305,2023),('2023-05-23',202321,5,2023,23,21,202305,2023),('2023-05-24',202321,5,2023,24,21,202305,2023),('2023-05-25',202321,5,2023,25,21,202305,2023),('2023-05-26',202321,5,2023,26,21,202305,2023),('2023-05-27',202321,5,2023,27,21,202305,2023),('2023-05-28',202322,5,2023,28,22,202305,2023),('2023-05-29',202322,5,2023,29,22,202305,2023),('2023-05-30',202322,5,2023,30,22,202305,2023),('2023-05-31',202322,5,2023,31,22,202305,2023),('2023-06-01',202322,6,2023,1,22,202306,2023),('2023-06-02',202322,6,2023,2,22,202306,2023),('2023-06-03',202322,6,2023,3,22,202306,2023),('2023-06-04',202323,6,2023,4,23,202306,2023),('2023-06-05',202323,6,2023,5,23,202306,2023),('2023-06-06',202323,6,2023,6,23,202306,2023),('2023-06-07',202323,6,2023,7,23,202306,2023),('2023-06-08',202323,6,2023,8,23,202306,2023),('2023-06-09',202323,6,2023,9,23,202306,2023),('2023-06-10',202323,6,2023,10,23,202306,2023),('2023-06-11',202324,6,2023,11,24,202306,2023),('2023-06-12',202324,6,2023,12,24,202306,2023),('2023-06-13',202324,6,2023,13,24,202306,2023),('2023-06-14',202324,6,2023,14,24,202306,2023),('2023-06-15',202324,6,2023,15,24,202306,2023),('2023-06-16',202324,6,2023,16,24,202306,2023),('2023-06-17',202324,6,2023,17,24,202306,2023),('2023-06-18',202325,6,2023,18,25,202306,2023),('2023-06-19',202325,6,2023,19,25,202306,2023),('2023-06-20',202325,6,2023,20,25,202306,2023),('2023-06-21',202325,6,2023,21,25,202306,2023),('2023-06-22',202325,6,2023,22,25,202306,2023),('2023-06-23',202325,6,2023,23,25,202306,2023),('2023-06-24',202325,6,2023,24,25,202306,2023),('2023-06-25',202326,6,2023,25,26,202306,2023),('2023-06-26',202326,6,2023,26,26,202306,2023),('2023-06-27',202326,6,2023,27,26,202306,2023),('2023-06-28',202326,6,2023,28,26,202306,2023),('2023-06-29',202326,6,2023,29,26,202306,2023),('2023-06-30',202326,6,2023,30,26,202306,2023),('2023-07-01',202326,7,2023,1,26,202307,2023),('2023-07-02',202327,7,2023,2,27,202307,2023),('2023-07-03',202327,7,2023,3,27,202307,2023),('2023-07-04',202327,7,2023,4,27,202307,2023),('2023-07-05',202327,7,2023,5,27,202307,2023),('2023-07-06',202327,7,2023,6,27,202307,2023),('2023-07-07',202327,7,2023,7,27,202307,2023),('2023-07-08',202327,7,2023,8,27,202307,2023),('2023-07-09',202328,7,2023,9,28,202307,2023),('2023-07-10',202328,7,2023,10,28,202307,2023),('2023-07-11',202328,7,2023,11,28,202307,2023),('2023-07-12',202328,7,2023,12,28,202307,2023),('2023-07-13',202328,7,2023,13,28,202307,2023),('2023-07-14',202328,7,2023,14,28,202307,2023),('2023-07-15',202328,7,2023,15,28,202307,2023),('2023-07-16',202329,7,2023,16,29,202307,2023),('2023-07-17',202329,7,2023,17,29,202307,2023),('2023-07-18',202329,7,2023,18,29,202307,2023),('2023-07-19',202329,7,2023,19,29,202307,2023),('2023-07-20',202329,7,2023,20,29,202307,2023),('2023-07-21',202329,7,2023,21,29,202307,2023),('2023-07-22',202329,7,2023,22,29,202307,2023),('2023-07-23',202330,7,2023,23,30,202307,2023),('2023-07-24',202330,7,2023,24,30,202307,2023),('2023-07-25',202330,7,2023,25,30,202307,2023),('2023-07-26',202330,7,2023,26,30,202307,2023),('2023-07-27',202330,7,2023,27,30,202307,2023),('2023-07-28',202330,7,2023,28,30,202307,2023),('2023-07-29',202330,7,2023,29,30,202307,2023),('2023-07-30',202331,7,2023,30,31,202307,2023),('2023-07-31',202331,7,2023,31,31,202307,2023),('2023-08-01',202331,8,2023,1,31,202308,2023),('2023-08-02',202331,8,2023,2,31,202308,2023),('2023-08-03',202331,8,2023,3,31,202308,2023),('2023-08-04',202331,8,2023,4,31,202308,2023),('2023-08-05',202331,8,2023,5,31,202308,2023),('2023-08-06',202332,8,2023,6,32,202308,2023),('2023-08-07',202332,8,2023,7,32,202308,2023),('2023-08-08',202332,8,2023,8,32,202308,2023),('2023-08-09',202332,8,2023,9,32,202308,2023),('2023-08-10',202332,8,2023,10,32,202308,2023),('2023-08-11',202332,8,2023,11,32,202308,2023),('2023-08-12',202332,8,2023,12,32,202308,2023),('2023-08-13',202333,8,2023,13,33,202308,2023),('2023-08-14',202333,8,2023,14,33,202308,2023),('2023-08-15',202333,8,2023,15,33,202308,2023),('2023-08-16',202333,8,2023,16,33,202308,2023),('2023-08-17',202333,8,2023,17,33,202308,2023),('2023-08-18',202333,8,2023,18,33,202308,2023),('2023-08-19',202333,8,2023,19,33,202308,2023),('2023-08-20',202334,8,2023,20,34,202308,2023),('2023-08-21',202334,8,2023,21,34,202308,2023),('2023-08-22',202334,8,2023,22,34,202308,2023),('2023-08-23',202334,8,2023,23,34,202308,2023),('2023-08-24',202334,8,2023,24,34,202308,2023),('2023-08-25',202334,8,2023,25,34,202308,2023),('2023-08-26',202334,8,2023,26,34,202308,2023),('2023-08-27',202335,8,2023,27,35,202308,2023),('2023-08-28',202335,8,2023,28,35,202308,2023),('2023-08-29',202335,8,2023,29,35,202308,2023),('2023-08-30',202335,8,2023,30,35,202308,2023),('2023-08-31',202335,8,2023,31,35,202308,2023),('2023-09-01',202335,9,2023,1,35,202309,2023),('2023-09-02',202335,9,2023,2,35,202309,2023),('2023-09-03',202336,9,2023,3,36,202309,2023),('2023-09-04',202336,9,2023,4,36,202309,2023),('2023-09-05',202336,9,2023,5,36,202309,2023),('2023-09-06',202336,9,2023,6,36,202309,2023),('2023-09-07',202336,9,2023,7,36,202309,2023),('2023-09-08',202336,9,2023,8,36,202309,2023),('2023-09-09',202336,9,2023,9,36,202309,2023),('2023-09-10',202337,9,2023,10,37,202309,2023),('2023-09-11',202337,9,2023,11,37,202309,2023),('2023-09-12',202337,9,2023,12,37,202309,2023),('2023-09-13',202337,9,2023,13,37,202309,2023),('2023-09-14',202337,9,2023,14,37,202309,2023),('2023-09-15',202337,9,2023,15,37,202309,2023),('2023-09-16',202337,9,2023,16,37,202309,2023),('2023-09-17',202338,9,2023,17,38,202309,2023),('2023-09-18',202338,9,2023,18,38,202309,2023),('2023-09-19',202338,9,2023,19,38,202309,2023),('2023-09-20',202338,9,2023,20,38,202309,2023),('2023-09-21',202338,9,2023,21,38,202309,2023),('2023-09-22',202338,9,2023,22,38,202309,2023),('2023-09-23',202338,9,2023,23,38,202309,2023),('2023-09-24',202339,9,2023,24,39,202309,2023),('2023-09-25',202339,9,2023,25,39,202309,2023),('2023-09-26',202339,9,2023,26,39,202309,2023),('2023-09-27',202339,9,2023,27,39,202309,2023),('2023-09-28',202339,9,2023,28,39,202309,2023),('2023-09-29',202339,9,2023,29,39,202309,2023),('2023-09-30',202339,9,2023,30,39,202309,2023),('2023-10-01',202340,10,2023,1,40,202310,2023),('2023-10-02',202340,10,2023,2,40,202310,2023),('2023-10-03',202340,10,2023,3,40,202310,2023),('2023-10-04',202340,10,2023,4,40,202310,2023),('2023-10-05',202340,10,2023,5,40,202310,2023),('2023-10-06',202340,10,2023,6,40,202310,2023),('2023-10-07',202340,10,2023,7,40,202310,2023),('2023-10-08',202341,10,2023,8,41,202310,2023),('2023-10-09',202341,10,2023,9,41,202310,2023),('2023-10-10',202341,10,2023,10,41,202310,2023),('2023-10-11',202341,10,2023,11,41,202310,2023),('2023-10-12',202341,10,2023,12,41,202310,2023),('2023-10-13',202341,10,2023,13,41,202310,2023),('2023-10-14',202341,10,2023,14,41,202310,2023),('2023-10-15',202342,10,2023,15,42,202310,2023),('2023-10-16',202342,10,2023,16,42,202310,2023),('2023-10-17',202342,10,2023,17,42,202310,2023),('2023-10-18',202342,10,2023,18,42,202310,2023),('2023-10-19',202342,10,2023,19,42,202310,2023),('2023-10-20',202342,10,2023,20,42,202310,2023),('2023-10-21',202342,10,2023,21,42,202310,2023),('2023-10-22',202343,10,2023,22,43,202310,2023),('2023-10-23',202343,10,2023,23,43,202310,2023),('2023-10-24',202343,10,2023,24,43,202310,2023),('2023-10-25',202343,10,2023,25,43,202310,2023),('2023-10-26',202343,10,2023,26,43,202310,2023),('2023-10-27',202343,10,2023,27,43,202310,2023),('2023-10-28',202343,10,2023,28,43,202310,2023),('2023-10-29',202344,10,2023,29,44,202310,2023),('2023-10-30',202344,10,2023,30,44,202310,2023),('2023-10-31',202344,10,2023,31,44,202310,2023),('2023-11-01',202344,11,2023,1,44,202311,2023),('2023-11-02',202344,11,2023,2,44,202311,2023),('2023-11-03',202344,11,2023,3,44,202311,2023),('2023-11-04',202344,11,2023,4,44,202311,2023),('2023-11-05',202345,11,2023,5,45,202311,2023),('2023-11-06',202345,11,2023,6,45,202311,2023),('2023-11-07',202345,11,2023,7,45,202311,2023),('2023-11-08',202345,11,2023,8,45,202311,2023),('2023-11-09',202345,11,2023,9,45,202311,2023),('2023-11-10',202345,11,2023,10,45,202311,2023),('2023-11-11',202345,11,2023,11,45,202311,2023),('2023-11-12',202346,11,2023,12,46,202311,2023),('2023-11-13',202346,11,2023,13,46,202311,2023),('2023-11-14',202346,11,2023,14,46,202311,2023),('2023-11-15',202346,11,2023,15,46,202311,2023),('2023-11-16',202346,11,2023,16,46,202311,2023),('2023-11-17',202346,11,2023,17,46,202311,2023),('2023-11-18',202346,11,2023,18,46,202311,2023),('2023-11-19',202347,11,2023,19,47,202311,2023),('2023-11-20',202347,11,2023,20,47,202311,2023),('2023-11-21',202347,11,2023,21,47,202311,2023),('2023-11-22',202347,11,2023,22,47,202311,2023),('2023-11-23',202347,11,2023,23,47,202311,2023),('2023-11-24',202347,11,2023,24,47,202311,2023),('2023-11-25',202347,11,2023,25,47,202311,2023),('2023-11-26',202348,11,2023,26,48,202311,2023),('2023-11-27',202348,11,2023,27,48,202311,2023),('2023-11-28',202348,11,2023,28,48,202311,2023),('2023-11-29',202348,11,2023,29,48,202311,2023),('2023-11-30',202348,11,2023,30,48,202311,2023),('2023-12-01',202348,12,2023,1,48,202312,2024),('2023-12-02',202348,12,2023,2,48,202312,2024),('2023-12-03',202349,12,2023,3,49,202312,2024),('2023-12-04',202349,12,2023,4,49,202312,2024),('2023-12-05',202349,12,2023,5,49,202312,2024),('2023-12-06',202349,12,2023,6,49,202312,2024),('2023-12-07',202349,12,2023,7,49,202312,2024),('2023-12-08',202349,12,2023,8,49,202312,2024),('2023-12-09',202349,12,2023,9,49,202312,2024),('2023-12-10',202350,12,2023,10,50,202312,2024),('2023-12-11',202350,12,2023,11,50,202312,2024),('2023-12-12',202350,12,2023,12,50,202312,2024),('2023-12-13',202350,12,2023,13,50,202312,2024),('2023-12-14',202350,12,2023,14,50,202312,2024),('2023-12-15',202350,12,2023,15,50,202312,2024),('2023-12-16',202350,12,2023,16,50,202312,2024),('2023-12-17',202351,12,2023,17,51,202312,2024),('2023-12-18',202351,12,2023,18,51,202312,2024),('2023-12-19',202351,12,2023,19,51,202312,2024),('2023-12-20',202351,12,2023,20,51,202312,2024),('2023-12-21',202351,12,2023,21,51,202312,2024),('2023-12-22',202351,12,2023,22,51,202312,2024),('2023-12-23',202351,12,2023,23,51,202312,2024),('2023-12-24',202352,12,2023,24,52,202312,2024),('2023-12-25',202352,12,2023,25,52,202312,2024),('2023-12-26',202352,12,2023,26,52,202312,2024),('2023-12-27',202352,12,2023,27,52,202312,2024),('2023-12-28',202352,12,2023,28,52,202312,2024),('2023-12-29',202352,12,2023,29,52,202312,2024),('2023-12-30',202352,12,2023,30,52,202312,2024),('2023-12-31',202353,12,2023,31,1,202312,2024),('2024-01-01',202401,1,2024,1,1,202401,2024),('2024-01-02',202401,1,2024,2,1,202401,2024),('2024-01-03',202401,1,2024,3,1,202401,2024),('2024-01-04',202401,1,2024,4,1,202401,2024),('2024-01-05',202401,1,2024,5,1,202401,2024),('2024-01-06',202401,1,2024,6,1,202401,2024),('2024-01-07',202402,1,2024,7,2,202401,2024),('2024-01-08',202402,1,2024,8,2,202401,2024),('2024-01-09',202402,1,2024,9,2,202401,2024),('2024-01-10',202402,1,2024,10,2,202401,2024),('2024-01-11',202402,1,2024,11,2,202401,2024),('2024-01-12',202402,1,2024,12,2,202401,2024),('2024-01-13',202402,1,2024,13,2,202401,2024),('2024-01-14',202403,1,2024,14,3,202401,2024),('2024-01-15',202403,1,2024,15,3,202401,2024),('2024-01-16',202403,1,2024,16,3,202401,2024),('2024-01-17',202403,1,2024,17,3,202401,2024),('2024-01-18',202403,1,2024,18,3,202401,2024),('2024-01-19',202403,1,2024,19,3,202401,2024),('2024-01-20',202403,1,2024,20,3,202401,2024),('2024-01-21',202404,1,2024,21,4,202401,2024),('2024-01-22',202404,1,2024,22,4,202401,2024),('2024-01-23',202404,1,2024,23,4,202401,2024),('2024-01-24',202404,1,2024,24,4,202401,2024),('2024-01-25',202404,1,2024,25,4,202401,2024),('2024-01-26',202404,1,2024,26,4,202401,2024),('2024-01-27',202404,1,2024,27,4,202401,2024),('2024-01-28',202405,1,2024,28,5,202401,2024),('2024-01-29',202405,1,2024,29,5,202401,2024),('2024-01-30',202405,1,2024,30,5,202401,2024),('2024-01-31',202405,1,2024,31,5,202401,2024),('2024-02-01',202405,2,2024,1,5,202402,2024),('2024-02-02',202405,2,2024,2,5,202402,2024),('2024-02-03',202405,2,2024,3,5,202402,2024),('2024-02-04',202406,2,2024,4,6,202402,2024),('2024-02-05',202406,2,2024,5,6,202402,2024),('2024-02-06',202406,2,2024,6,6,202402,2024),('2024-02-07',202406,2,2024,7,6,202402,2024),('2024-02-08',202406,2,2024,8,6,202402,2024),('2024-02-09',202406,2,2024,9,6,202402,2024),('2024-02-10',202406,2,2024,10,6,202402,2024),('2024-02-11',202407,2,2024,11,7,202402,2024),('2024-02-12',202407,2,2024,12,7,202402,2024),('2024-02-13',202407,2,2024,13,7,202402,2024),('2024-02-14',202407,2,2024,14,7,202402,2024),('2024-02-15',202407,2,2024,15,7,202402,2024),('2024-02-16',202407,2,2024,16,7,202402,2024),('2024-02-17',202407,2,2024,17,7,202402,2024),('2024-02-18',202408,2,2024,18,8,202402,2024),('2024-02-19',202408,2,2024,19,8,202402,2024),('2024-02-20',202408,2,2024,20,8,202402,2024),('2024-02-21',202408,2,2024,21,8,202402,2024),('2024-02-22',202408,2,2024,22,8,202402,2024),('2024-02-23',202408,2,2024,23,8,202402,2024),('2024-02-24',202408,2,2024,24,8,202402,2024),('2024-02-25',202409,2,2024,25,9,202402,2024),('2024-02-26',202409,2,2024,26,9,202402,2024),('2024-02-27',202409,2,2024,27,9,202402,2024),('2024-02-28',202409,2,2024,28,9,202402,2024),('2024-02-29',202409,2,2024,29,9,202402,2024),('2024-03-01',202409,3,2024,1,9,202403,2024),('2024-03-02',202409,3,2024,2,9,202403,2024),('2024-03-03',202410,3,2024,3,10,202403,2024),('2024-03-04',202410,3,2024,4,10,202403,2024),('2024-03-05',202410,3,2024,5,10,202403,2024),('2024-03-06',202410,3,2024,6,10,202403,2024),('2024-03-07',202410,3,2024,7,10,202403,2024),('2024-03-08',202410,3,2024,8,10,202403,2024),('2024-03-09',202410,3,2024,9,10,202403,2024),('2024-03-10',202411,3,2024,10,11,202403,2024),('2024-03-11',202411,3,2024,11,11,202403,2024),('2024-03-12',202411,3,2024,12,11,202403,2024),('2024-03-13',202411,3,2024,13,11,202403,2024),('2024-03-14',202411,3,2024,14,11,202403,2024),('2024-03-15',202411,3,2024,15,11,202403,2024),('2024-03-16',202411,3,2024,16,11,202403,2024),('2024-03-17',202412,3,2024,17,12,202403,2024),('2024-03-18',202412,3,2024,18,12,202403,2024),('2024-03-19',202412,3,2024,19,12,202403,2024),('2024-03-20',202412,3,2024,20,12,202403,2024),('2024-03-21',202412,3,2024,21,12,202403,2024),('2024-03-22',202412,3,2024,22,12,202403,2024),('2024-03-23',202412,3,2024,23,12,202403,2024),('2024-03-24',202413,3,2024,24,13,202403,2024),('2024-03-25',202413,3,2024,25,13,202403,2024),('2024-03-26',202413,3,2024,26,13,202403,2024),('2024-03-27',202413,3,2024,27,13,202403,2024),('2024-03-28',202413,3,2024,28,13,202403,2024),('2024-03-29',202413,3,2024,29,13,202403,2024),('2024-03-30',202413,3,2024,30,13,202403,2024),('2024-03-31',202414,3,2024,31,14,202403,2024),('2024-04-01',202414,4,2024,1,14,202404,2024),('2024-04-02',202414,4,2024,2,14,202404,2024),('2024-04-03',202414,4,2024,3,14,202404,2024),('2024-04-04',202414,4,2024,4,14,202404,2024),('2024-04-05',202414,4,2024,5,14,202404,2024),('2024-04-06',202414,4,2024,6,14,202404,2024),('2024-04-07',202415,4,2024,7,15,202404,2024),('2024-04-08',202415,4,2024,8,15,202404,2024),('2024-04-09',202415,4,2024,9,15,202404,2024),('2024-04-10',202415,4,2024,10,15,202404,2024),('2024-04-11',202415,4,2024,11,15,202404,2024),('2024-04-12',202415,4,2024,12,15,202404,2024),('2024-04-13',202415,4,2024,13,15,202404,2024),('2024-04-14',202416,4,2024,14,16,202404,2024),('2024-04-15',202416,4,2024,15,16,202404,2024),('2024-04-16',202416,4,2024,16,16,202404,2024),('2024-04-17',202416,4,2024,17,16,202404,2024),('2024-04-18',202416,4,2024,18,16,202404,2024),('2024-04-19',202416,4,2024,19,16,202404,2024),('2024-04-20',202416,4,2024,20,16,202404,2024),('2024-04-21',202417,4,2024,21,17,202404,2024),('2024-04-22',202417,4,2024,22,17,202404,2024),('2024-04-23',202417,4,2024,23,17,202404,2024),('2024-04-24',202417,4,2024,24,17,202404,2024),('2024-04-25',202417,4,2024,25,17,202404,2024),('2024-04-26',202417,4,2024,26,17,202404,2024),('2024-04-27',202417,4,2024,27,17,202404,2024),('2024-04-28',202418,4,2024,28,18,202404,2024),('2024-04-29',202418,4,2024,29,18,202404,2024),('2024-04-30',202418,4,2024,30,18,202404,2024),('2024-05-01',202418,5,2024,1,18,202405,2024),('2024-05-02',202418,5,2024,2,18,202405,2024),('2024-05-03',202418,5,2024,3,18,202405,2024),('2024-05-04',202418,5,2024,4,18,202405,2024),('2024-05-05',202419,5,2024,5,19,202405,2024),('2024-05-06',202419,5,2024,6,19,202405,2024),('2024-05-07',202419,5,2024,7,19,202405,2024),('2024-05-08',202419,5,2024,8,19,202405,2024),('2024-05-09',202419,5,2024,9,19,202405,2024),('2024-05-10',202419,5,2024,10,19,202405,2024),('2024-05-11',202419,5,2024,11,19,202405,2024),('2024-05-12',202420,5,2024,12,20,202405,2024),('2024-05-13',202420,5,2024,13,20,202405,2024),('2024-05-14',202420,5,2024,14,20,202405,2024),('2024-05-15',202420,5,2024,15,20,202405,2024),('2024-05-16',202420,5,2024,16,20,202405,2024),('2024-05-17',202420,5,2024,17,20,202405,2024),('2024-05-18',202420,5,2024,18,20,202405,2024),('2024-05-19',202421,5,2024,19,21,202405,2024),('2024-05-20',202421,5,2024,20,21,202405,2024),('2024-05-21',202421,5,2024,21,21,202405,2024),('2024-05-22',202421,5,2024,22,21,202405,2024),('2024-05-23',202421,5,2024,23,21,202405,2024),('2024-05-24',202421,5,2024,24,21,202405,2024),('2024-05-25',202421,5,2024,25,21,202405,2024),('2024-05-26',202422,5,2024,26,22,202405,2024),('2024-05-27',202422,5,2024,27,22,202405,2024),('2024-05-28',202422,5,2024,28,22,202405,2024),('2024-05-29',202422,5,2024,29,22,202405,2024),('2024-05-30',202422,5,2024,30,22,202405,2024),('2024-05-31',202422,5,2024,31,22,202405,2024),('2024-06-01',202422,6,2024,1,22,202406,2024),('2024-06-02',202423,6,2024,2,23,202406,2024),('2024-06-03',202423,6,2024,3,23,202406,2024),('2024-06-04',202423,6,2024,4,23,202406,2024),('2024-06-05',202423,6,2024,5,23,202406,2024),('2024-06-06',202423,6,2024,6,23,202406,2024),('2024-06-07',202423,6,2024,7,23,202406,2024),('2024-06-08',202423,6,2024,8,23,202406,2024),('2024-06-09',202424,6,2024,9,24,202406,2024),('2024-06-10',202424,6,2024,10,24,202406,2024),('2024-06-11',202424,6,2024,11,24,202406,2024),('2024-06-12',202424,6,2024,12,24,202406,2024),('2024-06-13',202424,6,2024,13,24,202406,2024),('2024-06-14',202424,6,2024,14,24,202406,2024),('2024-06-15',202424,6,2024,15,24,202406,2024),('2024-06-16',202425,6,2024,16,25,202406,2024),('2024-06-17',202425,6,2024,17,25,202406,2024),('2024-06-18',202425,6,2024,18,25,202406,2024),('2024-06-19',202425,6,2024,19,25,202406,2024),('2024-06-20',202425,6,2024,20,25,202406,2024),('2024-06-21',202425,6,2024,21,25,202406,2024),('2024-06-22',202425,6,2024,22,25,202406,2024),('2024-06-23',202426,6,2024,23,26,202406,2024),('2024-06-24',202426,6,2024,24,26,202406,2024),('2024-06-25',202426,6,2024,25,26,202406,2024),('2024-06-26',202426,6,2024,26,26,202406,2024),('2024-06-27',202426,6,2024,27,26,202406,2024),('2024-06-28',202426,6,2024,28,26,202406,2024),('2024-06-29',202426,6,2024,29,26,202406,2024),('2024-06-30',202427,6,2024,30,27,202406,2024),('2024-07-01',202427,7,2024,1,27,202407,2024),('2024-07-02',202427,7,2024,2,27,202407,2024),('2024-07-03',202427,7,2024,3,27,202407,2024),('2024-07-04',202427,7,2024,4,27,202407,2024),('2024-07-05',202427,7,2024,5,27,202407,2024),('2024-07-06',202427,7,2024,6,27,202407,2024),('2024-07-07',202428,7,2024,7,28,202407,2024),('2024-07-08',202428,7,2024,8,28,202407,2024),('2024-07-09',202428,7,2024,9,28,202407,2024),('2024-07-10',202428,7,2024,10,28,202407,2024),('2024-07-11',202428,7,2024,11,28,202407,2024),('2024-07-12',202428,7,2024,12,28,202407,2024),('2024-07-13',202428,7,2024,13,28,202407,2024),('2024-07-14',202429,7,2024,14,29,202407,2024),('2024-07-15',202429,7,2024,15,29,202407,2024),('2024-07-16',202429,7,2024,16,29,202407,2024),('2024-07-17',202429,7,2024,17,29,202407,2024),('2024-07-18',202429,7,2024,18,29,202407,2024),('2024-07-19',202429,7,2024,19,29,202407,2024),('2024-07-20',202429,7,2024,20,29,202407,2024),('2024-07-21',202430,7,2024,21,30,202407,2024),('2024-07-22',202430,7,2024,22,30,202407,2024),('2024-07-23',202430,7,2024,23,30,202407,2024),('2024-07-24',202430,7,2024,24,30,202407,2024),('2024-07-25',202430,7,2024,25,30,202407,2024),('2024-07-26',202430,7,2024,26,30,202407,2024),('2024-07-27',202430,7,2024,27,30,202407,2024),('2024-07-28',202431,7,2024,28,31,202407,2024),('2024-07-29',202431,7,2024,29,31,202407,2024),('2024-07-30',202431,7,2024,30,31,202407,2024),('2024-07-31',202431,7,2024,31,31,202407,2024),('2024-08-01',202431,8,2024,1,31,202408,2024),('2024-08-02',202431,8,2024,2,31,202408,2024),('2024-08-03',202431,8,2024,3,31,202408,2024),('2024-08-04',202432,8,2024,4,32,202408,2024),('2024-08-05',202432,8,2024,5,32,202408,2024),('2024-08-06',202432,8,2024,6,32,202408,2024),('2024-08-07',202432,8,2024,7,32,202408,2024),('2024-08-08',202432,8,2024,8,32,202408,2024),('2024-08-09',202432,8,2024,9,32,202408,2024),('2024-08-10',202432,8,2024,10,32,202408,2024),('2024-08-11',202433,8,2024,11,33,202408,2024),('2024-08-12',202433,8,2024,12,33,202408,2024),('2024-08-13',202433,8,2024,13,33,202408,2024),('2024-08-14',202433,8,2024,14,33,202408,2024),('2024-08-15',202433,8,2024,15,33,202408,2024),('2024-08-16',202433,8,2024,16,33,202408,2024),('2024-08-17',202433,8,2024,17,33,202408,2024),('2024-08-18',202434,8,2024,18,34,202408,2024),('2024-08-19',202434,8,2024,19,34,202408,2024),('2024-08-20',202434,8,2024,20,34,202408,2024),('2024-08-21',202434,8,2024,21,34,202408,2024),('2024-08-22',202434,8,2024,22,34,202408,2024),('2024-08-23',202434,8,2024,23,34,202408,2024),('2024-08-24',202434,8,2024,24,34,202408,2024),('2024-08-25',202435,8,2024,25,35,202408,2024),('2024-08-26',202435,8,2024,26,35,202408,2024),('2024-08-27',202435,8,2024,27,35,202408,2024),('2024-08-28',202435,8,2024,28,35,202408,2024),('2024-08-29',202435,8,2024,29,35,202408,2024),('2024-08-30',202435,8,2024,30,35,202408,2024),('2024-08-31',202435,8,2024,31,35,202408,2024),('2024-09-01',202436,9,2024,1,36,202409,2024),('2024-09-02',202436,9,2024,2,36,202409,2024),('2024-09-03',202436,9,2024,3,36,202409,2024),('2024-09-04',202436,9,2024,4,36,202409,2024),('2024-09-05',202436,9,2024,5,36,202409,2024),('2024-09-06',202436,9,2024,6,36,202409,2024),('2024-09-07',202436,9,2024,7,36,202409,2024),('2024-09-08',202437,9,2024,8,37,202409,2024),('2024-09-09',202437,9,2024,9,37,202409,2024),('2024-09-10',202437,9,2024,10,37,202409,2024),('2024-09-11',202437,9,2024,11,37,202409,2024),('2024-09-12',202437,9,2024,12,37,202409,2024),('2024-09-13',202437,9,2024,13,37,202409,2024),('2024-09-14',202437,9,2024,14,37,202409,2024),('2024-09-15',202438,9,2024,15,38,202409,2024),('2024-09-16',202438,9,2024,16,38,202409,2024),('2024-09-17',202438,9,2024,17,38,202409,2024),('2024-09-18',202438,9,2024,18,38,202409,2024),('2024-09-19',202438,9,2024,19,38,202409,2024),('2024-09-20',202438,9,2024,20,38,202409,2024),('2024-09-21',202438,9,2024,21,38,202409,2024),('2024-09-22',202439,9,2024,22,39,202409,2024),('2024-09-23',202439,9,2024,23,39,202409,2024),('2024-09-24',202439,9,2024,24,39,202409,2024),('2024-09-25',202439,9,2024,25,39,202409,2024),('2024-09-26',202439,9,2024,26,39,202409,2024),('2024-09-27',202439,9,2024,27,39,202409,2024),('2024-09-28',202439,9,2024,28,39,202409,2024),('2024-09-29',202440,9,2024,29,40,202409,2024),('2024-09-30',202440,9,2024,30,40,202409,2024),('2024-10-01',202440,10,2024,1,40,202410,2024),('2024-10-02',202440,10,2024,2,40,202410,2024),('2024-10-03',202440,10,2024,3,40,202410,2024),('2024-10-04',202440,10,2024,4,40,202410,2024),('2024-10-05',202440,10,2024,5,40,202410,2024),('2024-10-06',202441,10,2024,6,41,202410,2024),('2024-10-07',202441,10,2024,7,41,202410,2024),('2024-10-08',202441,10,2024,8,41,202410,2024),('2024-10-09',202441,10,2024,9,41,202410,2024),('2024-10-10',202441,10,2024,10,41,202410,2024),('2024-10-11',202441,10,2024,11,41,202410,2024),('2024-10-12',202441,10,2024,12,41,202410,2024),('2024-10-13',202442,10,2024,13,42,202410,2024),('2024-10-14',202442,10,2024,14,42,202410,2024),('2024-10-15',202442,10,2024,15,42,202410,2024),('2024-10-16',202442,10,2024,16,42,202410,2024),('2024-10-17',202442,10,2024,17,42,202410,2024),('2024-10-18',202442,10,2024,18,42,202410,2024),('2024-10-19',202442,10,2024,19,42,202410,2024),('2024-10-20',202443,10,2024,20,43,202410,2024),('2024-10-21',202443,10,2024,21,43,202410,2024),('2024-10-22',202443,10,2024,22,43,202410,2024),('2024-10-23',202443,10,2024,23,43,202410,2024),('2024-10-24',202443,10,2024,24,43,202410,2024),('2024-10-25',202443,10,2024,25,43,202410,2024),('2024-10-26',202443,10,2024,26,43,202410,2024),('2024-10-27',202444,10,2024,27,44,202410,2024),('2024-10-28',202444,10,2024,28,44,202410,2024),('2024-10-29',202444,10,2024,29,44,202410,2024),('2024-10-30',202444,10,2024,30,44,202410,2024),('2024-10-31',202444,10,2024,31,44,202410,2024),('2024-11-01',202444,11,2024,1,44,202411,2024),('2024-11-02',202444,11,2024,2,44,202411,2024),('2024-11-03',202445,11,2024,3,45,202411,2024),('2024-11-04',202445,11,2024,4,45,202411,2024),('2024-11-05',202445,11,2024,5,45,202411,2024),('2024-11-06',202445,11,2024,6,45,202411,2024),('2024-11-07',202445,11,2024,7,45,202411,2024),('2024-11-08',202445,11,2024,8,45,202411,2024),('2024-11-09',202445,11,2024,9,45,202411,2024),('2024-11-10',202446,11,2024,10,46,202411,2024),('2024-11-11',202446,11,2024,11,46,202411,2024),('2024-11-12',202446,11,2024,12,46,202411,2024),('2024-11-13',202446,11,2024,13,46,202411,2024),('2024-11-14',202446,11,2024,14,46,202411,2024),('2024-11-15',202446,11,2024,15,46,202411,2024),('2024-11-16',202446,11,2024,16,46,202411,2024),('2024-11-17',202447,11,2024,17,47,202411,2024),('2024-11-18',202447,11,2024,18,47,202411,2024),('2024-11-19',202447,11,2024,19,47,202411,2024),('2024-11-20',202447,11,2024,20,47,202411,2024),('2024-11-21',202447,11,2024,21,47,202411,2024),('2024-11-22',202447,11,2024,22,47,202411,2024),('2024-11-23',202447,11,2024,23,47,202411,2024),('2024-11-24',202448,11,2024,24,48,202411,2024),('2024-11-25',202448,11,2024,25,48,202411,2024),('2024-11-26',202448,11,2024,26,48,202411,2024),('2024-11-27',202448,11,2024,27,48,202411,2024),('2024-11-28',202448,11,2024,28,48,202411,2024),('2024-11-29',202448,11,2024,29,48,202411,2024),('2024-11-30',202448,11,2024,30,48,202411,2024),('2024-12-01',202449,12,2024,1,49,202412,2025),('2024-12-02',202449,12,2024,2,49,202412,2025),('2024-12-03',202449,12,2024,3,49,202412,2025),('2024-12-04',202449,12,2024,4,49,202412,2025),('2024-12-05',202449,12,2024,5,49,202412,2025),('2024-12-06',202449,12,2024,6,49,202412,2025),('2024-12-07',202449,12,2024,7,49,202412,2025),('2024-12-08',202450,12,2024,8,50,202412,2025),('2024-12-09',202450,12,2024,9,50,202412,2025),('2024-12-10',202450,12,2024,10,50,202412,2025),('2024-12-11',202450,12,2024,11,50,202412,2025),('2024-12-12',202450,12,2024,12,50,202412,2025),('2024-12-13',202450,12,2024,13,50,202412,2025),('2024-12-14',202450,12,2024,14,50,202412,2025),('2024-12-15',202451,12,2024,15,51,202412,2025),('2024-12-16',202451,12,2024,16,51,202412,2025),('2024-12-17',202451,12,2024,17,51,202412,2025),('2024-12-18',202451,12,2024,18,51,202412,2025),('2024-12-19',202451,12,2024,19,51,202412,2025),('2024-12-20',202451,12,2024,20,51,202412,2025),('2024-12-21',202451,12,2024,21,51,202412,2025),('2024-12-22',202452,12,2024,22,52,202412,2025),('2024-12-23',202452,12,2024,23,52,202412,2025),('2024-12-24',202452,12,2024,24,52,202412,2025),('2024-12-25',202452,12,2024,25,52,202412,2025),('2024-12-26',202452,12,2024,26,52,202412,2025),('2024-12-27',202452,12,2024,27,52,202412,2025),('2024-12-28',202452,12,2024,28,52,202412,2025),('2024-12-29',202453,12,2024,29,1,202412,2025),('2024-12-30',202401,12,2024,30,1,202412,2025),('2024-12-31',202401,12,2024,31,1,202412,2025),('2025-01-01',202501,1,2025,1,1,202501,2025),('2025-01-02',202501,1,2025,2,1,202501,2025),('2025-01-03',202501,1,2025,3,1,202501,2025),('2025-01-04',202501,1,2025,4,1,202501,2025),('2025-01-05',202502,1,2025,5,2,202501,2025),('2025-01-06',202502,1,2025,6,2,202501,2025),('2025-01-07',202502,1,2025,7,2,202501,2025),('2025-01-08',202502,1,2025,8,2,202501,2025),('2025-01-09',202502,1,2025,9,2,202501,2025),('2025-01-10',202502,1,2025,10,2,202501,2025),('2025-01-11',202502,1,2025,11,2,202501,2025),('2025-01-12',202503,1,2025,12,3,202501,2025),('2025-01-13',202503,1,2025,13,3,202501,2025),('2025-01-14',202503,1,2025,14,3,202501,2025),('2025-01-15',202503,1,2025,15,3,202501,2025),('2025-01-16',202503,1,2025,16,3,202501,2025),('2025-01-17',202503,1,2025,17,3,202501,2025),('2025-01-18',202503,1,2025,18,3,202501,2025),('2025-01-19',202504,1,2025,19,4,202501,2025),('2025-01-20',202504,1,2025,20,4,202501,2025),('2025-01-21',202504,1,2025,21,4,202501,2025),('2025-01-22',202504,1,2025,22,4,202501,2025),('2025-01-23',202504,1,2025,23,4,202501,2025),('2025-01-24',202504,1,2025,24,4,202501,2025),('2025-01-25',202504,1,2025,25,4,202501,2025),('2025-01-26',202505,1,2025,26,5,202501,2025),('2025-01-27',202505,1,2025,27,5,202501,2025),('2025-01-28',202505,1,2025,28,5,202501,2025),('2025-01-29',202505,1,2025,29,5,202501,2025),('2025-01-30',202505,1,2025,30,5,202501,2025),('2025-01-31',202505,1,2025,31,5,202501,2025),('2025-02-01',202505,2,2025,1,5,202502,2025),('2025-02-02',202506,2,2025,2,6,202502,2025),('2025-02-03',202506,2,2025,3,6,202502,2025),('2025-02-04',202506,2,2025,4,6,202502,2025),('2025-02-05',202506,2,2025,5,6,202502,2025),('2025-02-06',202506,2,2025,6,6,202502,2025),('2025-02-07',202506,2,2025,7,6,202502,2025),('2025-02-08',202506,2,2025,8,6,202502,2025),('2025-02-09',202507,2,2025,9,7,202502,2025),('2025-02-10',202507,2,2025,10,7,202502,2025),('2025-02-11',202507,2,2025,11,7,202502,2025),('2025-02-12',202507,2,2025,12,7,202502,2025),('2025-02-13',202507,2,2025,13,7,202502,2025),('2025-02-14',202507,2,2025,14,7,202502,2025),('2025-02-15',202507,2,2025,15,7,202502,2025),('2025-02-16',202508,2,2025,16,8,202502,2025),('2025-02-17',202508,2,2025,17,8,202502,2025),('2025-02-18',202508,2,2025,18,8,202502,2025),('2025-02-19',202508,2,2025,19,8,202502,2025),('2025-02-20',202508,2,2025,20,8,202502,2025),('2025-02-21',202508,2,2025,21,8,202502,2025),('2025-02-22',202508,2,2025,22,8,202502,2025),('2025-02-23',202509,2,2025,23,9,202502,2025),('2025-02-24',202509,2,2025,24,9,202502,2025),('2025-02-25',202509,2,2025,25,9,202502,2025),('2025-02-26',202509,2,2025,26,9,202502,2025),('2025-02-27',202509,2,2025,27,9,202502,2025),('2025-02-28',202509,2,2025,28,9,202502,2025),('2025-03-01',202509,3,2025,1,9,202503,2025),('2025-03-02',202510,3,2025,2,10,202503,2025),('2025-03-03',202510,3,2025,3,10,202503,2025),('2025-03-04',202510,3,2025,4,10,202503,2025),('2025-03-05',202510,3,2025,5,10,202503,2025),('2025-03-06',202510,3,2025,6,10,202503,2025),('2025-03-07',202510,3,2025,7,10,202503,2025),('2025-03-08',202510,3,2025,8,10,202503,2025),('2025-03-09',202511,3,2025,9,11,202503,2025),('2025-03-10',202511,3,2025,10,11,202503,2025),('2025-03-11',202511,3,2025,11,11,202503,2025),('2025-03-12',202511,3,2025,12,11,202503,2025),('2025-03-13',202511,3,2025,13,11,202503,2025),('2025-03-14',202511,3,2025,14,11,202503,2025),('2025-03-15',202511,3,2025,15,11,202503,2025),('2025-03-16',202512,3,2025,16,12,202503,2025),('2025-03-17',202512,3,2025,17,12,202503,2025),('2025-03-18',202512,3,2025,18,12,202503,2025),('2025-03-19',202512,3,2025,19,12,202503,2025),('2025-03-20',202512,3,2025,20,12,202503,2025),('2025-03-21',202512,3,2025,21,12,202503,2025),('2025-03-22',202512,3,2025,22,12,202503,2025),('2025-03-23',202513,3,2025,23,13,202503,2025),('2025-03-24',202513,3,2025,24,13,202503,2025),('2025-03-25',202513,3,2025,25,13,202503,2025),('2025-03-26',202513,3,2025,26,13,202503,2025),('2025-03-27',202513,3,2025,27,13,202503,2025),('2025-03-28',202513,3,2025,28,13,202503,2025),('2025-03-29',202513,3,2025,29,13,202503,2025),('2025-03-30',202514,3,2025,30,14,202503,2025),('2025-03-31',202514,3,2025,31,14,202503,2025),('2025-04-01',202514,4,2025,1,14,202504,2025),('2025-04-02',202514,4,2025,2,14,202504,2025),('2025-04-03',202514,4,2025,3,14,202504,2025),('2025-04-04',202514,4,2025,4,14,202504,2025),('2025-04-05',202514,4,2025,5,14,202504,2025),('2025-04-06',202515,4,2025,6,15,202504,2025),('2025-04-07',202515,4,2025,7,15,202504,2025),('2025-04-08',202515,4,2025,8,15,202504,2025),('2025-04-09',202515,4,2025,9,15,202504,2025),('2025-04-10',202515,4,2025,10,15,202504,2025),('2025-04-11',202515,4,2025,11,15,202504,2025),('2025-04-12',202515,4,2025,12,15,202504,2025),('2025-04-13',202516,4,2025,13,16,202504,2025),('2025-04-14',202516,4,2025,14,16,202504,2025),('2025-04-15',202516,4,2025,15,16,202504,2025),('2025-04-16',202516,4,2025,16,16,202504,2025),('2025-04-17',202516,4,2025,17,16,202504,2025),('2025-04-18',202516,4,2025,18,16,202504,2025),('2025-04-19',202516,4,2025,19,16,202504,2025),('2025-04-20',202517,4,2025,20,17,202504,2025),('2025-04-21',202517,4,2025,21,17,202504,2025),('2025-04-22',202517,4,2025,22,17,202504,2025),('2025-04-23',202517,4,2025,23,17,202504,2025),('2025-04-24',202517,4,2025,24,17,202504,2025),('2025-04-25',202517,4,2025,25,17,202504,2025),('2025-04-26',202517,4,2025,26,17,202504,2025),('2025-04-27',202518,4,2025,27,18,202504,2025),('2025-04-28',202518,4,2025,28,18,202504,2025),('2025-04-29',202518,4,2025,29,18,202504,2025),('2025-04-30',202518,4,2025,30,18,202504,2025),('2025-05-01',202518,5,2025,1,18,202505,2025),('2025-05-02',202518,5,2025,2,18,202505,2025),('2025-05-03',202518,5,2025,3,18,202505,2025),('2025-05-04',202519,5,2025,4,19,202505,2025),('2025-05-05',202519,5,2025,5,19,202505,2025),('2025-05-06',202519,5,2025,6,19,202505,2025),('2025-05-07',202519,5,2025,7,19,202505,2025),('2025-05-08',202519,5,2025,8,19,202505,2025),('2025-05-09',202519,5,2025,9,19,202505,2025),('2025-05-10',202519,5,2025,10,19,202505,2025),('2025-05-11',202520,5,2025,11,20,202505,2025),('2025-05-12',202520,5,2025,12,20,202505,2025),('2025-05-13',202520,5,2025,13,20,202505,2025),('2025-05-14',202520,5,2025,14,20,202505,2025),('2025-05-15',202520,5,2025,15,20,202505,2025),('2025-05-16',202520,5,2025,16,20,202505,2025),('2025-05-17',202520,5,2025,17,20,202505,2025),('2025-05-18',202521,5,2025,18,21,202505,2025),('2025-05-19',202521,5,2025,19,21,202505,2025),('2025-05-20',202521,5,2025,20,21,202505,2025),('2025-05-21',202521,5,2025,21,21,202505,2025),('2025-05-22',202521,5,2025,22,21,202505,2025),('2025-05-23',202521,5,2025,23,21,202505,2025),('2025-05-24',202521,5,2025,24,21,202505,2025),('2025-05-25',202522,5,2025,25,22,202505,2025),('2025-05-26',202522,5,2025,26,22,202505,2025),('2025-05-27',202522,5,2025,27,22,202505,2025),('2025-05-28',202522,5,2025,28,22,202505,2025),('2025-05-29',202522,5,2025,29,22,202505,2025),('2025-05-30',202522,5,2025,30,22,202505,2025),('2025-05-31',202522,5,2025,31,22,202505,2025),('2025-06-01',202523,6,2025,1,23,202506,2025),('2025-06-02',202523,6,2025,2,23,202506,2025),('2025-06-03',202523,6,2025,3,23,202506,2025),('2025-06-04',202523,6,2025,4,23,202506,2025),('2025-06-05',202523,6,2025,5,23,202506,2025),('2025-06-06',202523,6,2025,6,23,202506,2025),('2025-06-07',202523,6,2025,7,23,202506,2025),('2025-06-08',202524,6,2025,8,24,202506,2025),('2025-06-09',202524,6,2025,9,24,202506,2025),('2025-06-10',202524,6,2025,10,24,202506,2025),('2025-06-11',202524,6,2025,11,24,202506,2025),('2025-06-12',202524,6,2025,12,24,202506,2025),('2025-06-13',202524,6,2025,13,24,202506,2025),('2025-06-14',202524,6,2025,14,24,202506,2025),('2025-06-15',202525,6,2025,15,25,202506,2025),('2025-06-16',202525,6,2025,16,25,202506,2025),('2025-06-17',202525,6,2025,17,25,202506,2025),('2025-06-18',202525,6,2025,18,25,202506,2025),('2025-06-19',202525,6,2025,19,25,202506,2025),('2025-06-20',202525,6,2025,20,25,202506,2025),('2025-06-21',202525,6,2025,21,25,202506,2025),('2025-06-22',202526,6,2025,22,26,202506,2025),('2025-06-23',202526,6,2025,23,26,202506,2025),('2025-06-24',202526,6,2025,24,26,202506,2025),('2025-06-25',202526,6,2025,25,26,202506,2025),('2025-06-26',202526,6,2025,26,26,202506,2025),('2025-06-27',202526,6,2025,27,26,202506,2025),('2025-06-28',202526,6,2025,28,26,202506,2025),('2025-06-29',202527,6,2025,29,27,202506,2025),('2025-06-30',202527,6,2025,30,27,202506,2025),('2025-07-01',202527,7,2025,1,27,202507,2025),('2025-07-02',202527,7,2025,2,27,202507,2025),('2025-07-03',202527,7,2025,3,27,202507,2025),('2025-07-04',202527,7,2025,4,27,202507,2025),('2025-07-05',202527,7,2025,5,27,202507,2025),('2025-07-06',202528,7,2025,6,28,202507,2025),('2025-07-07',202528,7,2025,7,28,202507,2025),('2025-07-08',202528,7,2025,8,28,202507,2025),('2025-07-09',202528,7,2025,9,28,202507,2025),('2025-07-10',202528,7,2025,10,28,202507,2025),('2025-07-11',202528,7,2025,11,28,202507,2025),('2025-07-12',202528,7,2025,12,28,202507,2025),('2025-07-13',202529,7,2025,13,29,202507,2025),('2025-07-14',202529,7,2025,14,29,202507,2025),('2025-07-15',202529,7,2025,15,29,202507,2025),('2025-07-16',202529,7,2025,16,29,202507,2025),('2025-07-17',202529,7,2025,17,29,202507,2025),('2025-07-18',202529,7,2025,18,29,202507,2025),('2025-07-19',202529,7,2025,19,29,202507,2025),('2025-07-20',202530,7,2025,20,30,202507,2025),('2025-07-21',202530,7,2025,21,30,202507,2025),('2025-07-22',202530,7,2025,22,30,202507,2025),('2025-07-23',202530,7,2025,23,30,202507,2025),('2025-07-24',202530,7,2025,24,30,202507,2025),('2025-07-25',202530,7,2025,25,30,202507,2025),('2025-07-26',202530,7,2025,26,30,202507,2025),('2025-07-27',202531,7,2025,27,31,202507,2025),('2025-07-28',202531,7,2025,28,31,202507,2025),('2025-07-29',202531,7,2025,29,31,202507,2025),('2025-07-30',202531,7,2025,30,31,202507,2025),('2025-07-31',202531,7,2025,31,31,202507,2025),('2025-08-01',202531,8,2025,1,31,202508,2025),('2025-08-02',202531,8,2025,2,31,202508,2025),('2025-08-03',202532,8,2025,3,32,202508,2025),('2025-08-04',202532,8,2025,4,32,202508,2025),('2025-08-05',202532,8,2025,5,32,202508,2025),('2025-08-06',202532,8,2025,6,32,202508,2025),('2025-08-07',202532,8,2025,7,32,202508,2025),('2025-08-08',202532,8,2025,8,32,202508,2025),('2025-08-09',202532,8,2025,9,32,202508,2025),('2025-08-10',202533,8,2025,10,33,202508,2025),('2025-08-11',202533,8,2025,11,33,202508,2025),('2025-08-12',202533,8,2025,12,33,202508,2025),('2025-08-13',202533,8,2025,13,33,202508,2025),('2025-08-14',202533,8,2025,14,33,202508,2025),('2025-08-15',202533,8,2025,15,33,202508,2025),('2025-08-16',202533,8,2025,16,33,202508,2025),('2025-08-17',202534,8,2025,17,34,202508,2025),('2025-08-18',202534,8,2025,18,34,202508,2025),('2025-08-19',202534,8,2025,19,34,202508,2025),('2025-08-20',202534,8,2025,20,34,202508,2025),('2025-08-21',202534,8,2025,21,34,202508,2025),('2025-08-22',202534,8,2025,22,34,202508,2025),('2025-08-23',202534,8,2025,23,34,202508,2025),('2025-08-24',202535,8,2025,24,35,202508,2025),('2025-08-25',202535,8,2025,25,35,202508,2025),('2025-08-26',202535,8,2025,26,35,202508,2025),('2025-08-27',202535,8,2025,27,35,202508,2025),('2025-08-28',202535,8,2025,28,35,202508,2025),('2025-08-29',202535,8,2025,29,35,202508,2025),('2025-08-30',202535,8,2025,30,35,202508,2025),('2025-08-31',202536,8,2025,31,36,202508,2025),('2025-09-01',202536,9,2025,1,36,202509,2025),('2025-09-02',202536,9,2025,2,36,202509,2025),('2025-09-03',202536,9,2025,3,36,202509,2025),('2025-09-04',202536,9,2025,4,36,202509,2025),('2025-09-05',202536,9,2025,5,36,202509,2025),('2025-09-06',202536,9,2025,6,36,202509,2025),('2025-09-07',202537,9,2025,7,37,202509,2025),('2025-09-08',202537,9,2025,8,37,202509,2025),('2025-09-09',202537,9,2025,9,37,202509,2025),('2025-09-10',202537,9,2025,10,37,202509,2025),('2025-09-11',202537,9,2025,11,37,202509,2025),('2025-09-12',202537,9,2025,12,37,202509,2025),('2025-09-13',202537,9,2025,13,37,202509,2025),('2025-09-14',202538,9,2025,14,38,202509,2025),('2025-09-15',202538,9,2025,15,38,202509,2025),('2025-09-16',202538,9,2025,16,38,202509,2025),('2025-09-17',202538,9,2025,17,38,202509,2025),('2025-09-18',202538,9,2025,18,38,202509,2025),('2025-09-19',202538,9,2025,19,38,202509,2025),('2025-09-20',202538,9,2025,20,38,202509,2025),('2025-09-21',202539,9,2025,21,39,202509,2025),('2025-09-22',202539,9,2025,22,39,202509,2025),('2025-09-23',202539,9,2025,23,39,202509,2025),('2025-09-24',202539,9,2025,24,39,202509,2025),('2025-09-25',202539,9,2025,25,39,202509,2025),('2025-09-26',202539,9,2025,26,39,202509,2025),('2025-09-27',202539,9,2025,27,39,202509,2025),('2025-09-28',202540,9,2025,28,40,202509,2025),('2025-09-29',202540,9,2025,29,40,202509,2025),('2025-09-30',202540,9,2025,30,40,202509,2025),('2025-10-01',202540,10,2025,1,40,202510,2025),('2025-10-02',202540,10,2025,2,40,202510,2025),('2025-10-03',202540,10,2025,3,40,202510,2025),('2025-10-04',202540,10,2025,4,40,202510,2025),('2025-10-05',202541,10,2025,5,41,202510,2025),('2025-10-06',202541,10,2025,6,41,202510,2025),('2025-10-07',202541,10,2025,7,41,202510,2025),('2025-10-08',202541,10,2025,8,41,202510,2025),('2025-10-09',202541,10,2025,9,41,202510,2025),('2025-10-10',202541,10,2025,10,41,202510,2025),('2025-10-11',202541,10,2025,11,41,202510,2025),('2025-10-12',202542,10,2025,12,42,202510,2025),('2025-10-13',202542,10,2025,13,42,202510,2025),('2025-10-14',202542,10,2025,14,42,202510,2025),('2025-10-15',202542,10,2025,15,42,202510,2025),('2025-10-16',202542,10,2025,16,42,202510,2025),('2025-10-17',202542,10,2025,17,42,202510,2025),('2025-10-18',202542,10,2025,18,42,202510,2025),('2025-10-19',202543,10,2025,19,43,202510,2025),('2025-10-20',202543,10,2025,20,43,202510,2025),('2025-10-21',202543,10,2025,21,43,202510,2025),('2025-10-22',202543,10,2025,22,43,202510,2025),('2025-10-23',202543,10,2025,23,43,202510,2025),('2025-10-24',202543,10,2025,24,43,202510,2025),('2025-10-25',202543,10,2025,25,43,202510,2025),('2025-10-26',202544,10,2025,26,44,202510,2025),('2025-10-27',202544,10,2025,27,44,202510,2025),('2025-10-28',202544,10,2025,28,44,202510,2025),('2025-10-29',202544,10,2025,29,44,202510,2025),('2025-10-30',202544,10,2025,30,44,202510,2025),('2025-10-31',202544,10,2025,31,44,202510,2025),('2025-11-01',202544,11,2025,1,44,202511,2025),('2025-11-02',202545,11,2025,2,45,202511,2025),('2025-11-03',202545,11,2025,3,45,202511,2025),('2025-11-04',202545,11,2025,4,45,202511,2025),('2025-11-05',202545,11,2025,5,45,202511,2025),('2025-11-06',202545,11,2025,6,45,202511,2025),('2025-11-07',202545,11,2025,7,45,202511,2025),('2025-11-08',202545,11,2025,8,45,202511,2025),('2025-11-09',202546,11,2025,9,46,202511,2025),('2025-11-10',202546,11,2025,10,46,202511,2025),('2025-11-11',202546,11,2025,11,46,202511,2025),('2025-11-12',202546,11,2025,12,46,202511,2025),('2025-11-13',202546,11,2025,13,46,202511,2025),('2025-11-14',202546,11,2025,14,46,202511,2025),('2025-11-15',202546,11,2025,15,46,202511,2025),('2025-11-16',202547,11,2025,16,47,202511,2025),('2025-11-17',202547,11,2025,17,47,202511,2025),('2025-11-18',202547,11,2025,18,47,202511,2025),('2025-11-19',202547,11,2025,19,47,202511,2025),('2025-11-20',202547,11,2025,20,47,202511,2025),('2025-11-21',202547,11,2025,21,47,202511,2025),('2025-11-22',202547,11,2025,22,47,202511,2025),('2025-11-23',202548,11,2025,23,48,202511,2025),('2025-11-24',202548,11,2025,24,48,202511,2025),('2025-11-25',202548,11,2025,25,48,202511,2025),('2025-11-26',202548,11,2025,26,48,202511,2025),('2025-11-27',202548,11,2025,27,48,202511,2025),('2025-11-28',202548,11,2025,28,48,202511,2025),('2025-11-29',202548,11,2025,29,48,202511,2025),('2025-11-30',202549,11,2025,30,49,202511,2025),('2025-12-01',202549,12,2025,1,49,202512,2026),('2025-12-02',202549,12,2025,2,49,202512,2026),('2025-12-03',202549,12,2025,3,49,202512,2026),('2025-12-04',202549,12,2025,4,49,202512,2026),('2025-12-05',202549,12,2025,5,49,202512,2026),('2025-12-06',202549,12,2025,6,49,202512,2026),('2025-12-07',202550,12,2025,7,50,202512,2026),('2025-12-08',202550,12,2025,8,50,202512,2026),('2025-12-09',202550,12,2025,9,50,202512,2026),('2025-12-10',202550,12,2025,10,50,202512,2026),('2025-12-11',202550,12,2025,11,50,202512,2026),('2025-12-12',202550,12,2025,12,50,202512,2026),('2025-12-13',202550,12,2025,13,50,202512,2026),('2025-12-14',202551,12,2025,14,51,202512,2026),('2025-12-15',202551,12,2025,15,51,202512,2026),('2025-12-16',202551,12,2025,16,51,202512,2026),('2025-12-17',202551,12,2025,17,51,202512,2026),('2025-12-18',202551,12,2025,18,51,202512,2026),('2025-12-19',202551,12,2025,19,51,202512,2026),('2025-12-20',202551,12,2025,20,51,202512,2026),('2025-12-21',202552,12,2025,21,52,202512,2026),('2025-12-22',202552,12,2025,22,52,202512,2026),('2025-12-23',202552,12,2025,23,52,202512,2026),('2025-12-24',202552,12,2025,24,52,202512,2026),('2025-12-25',202552,12,2025,25,52,202512,2026),('2025-12-26',202552,12,2025,26,52,202512,2026),('2025-12-27',202552,12,2025,27,52,202512,2026),('2025-12-28',202553,12,2025,28,53,202512,2026),('2025-12-29',202501,12,2025,29,53,202512,2026),('2025-12-30',202501,12,2025,30,53,202512,2026),('2025-12-31',202501,12,2025,31,53,202512,2026),('2026-01-01',202601,1,2026,1,53,202601,2026),('2026-01-02',202601,1,2026,2,53,202601,2026),('2026-01-03',202601,1,2026,3,53,202601,2026),('2026-01-04',202602,1,2026,4,1,202601,2026),('2026-01-05',202602,1,2026,5,1,202601,2026),('2026-01-06',202602,1,2026,6,1,202601,2026),('2026-01-07',202602,1,2026,7,1,202601,2026),('2026-01-08',202602,1,2026,8,1,202601,2026),('2026-01-09',202602,1,2026,9,1,202601,2026),('2026-01-10',202602,1,2026,10,1,202601,2026),('2026-01-11',202603,1,2026,11,2,202601,2026),('2026-01-12',202603,1,2026,12,2,202601,2026),('2026-01-13',202603,1,2026,13,2,202601,2026),('2026-01-14',202603,1,2026,14,2,202601,2026),('2026-01-15',202603,1,2026,15,2,202601,2026),('2026-01-16',202603,1,2026,16,2,202601,2026),('2026-01-17',202603,1,2026,17,2,202601,2026),('2026-01-18',202604,1,2026,18,3,202601,2026),('2026-01-19',202604,1,2026,19,3,202601,2026),('2026-01-20',202604,1,2026,20,3,202601,2026),('2026-01-21',202604,1,2026,21,3,202601,2026),('2026-01-22',202604,1,2026,22,3,202601,2026),('2026-01-23',202604,1,2026,23,3,202601,2026),('2026-01-24',202604,1,2026,24,3,202601,2026),('2026-01-25',202605,1,2026,25,4,202601,2026),('2026-01-26',202605,1,2026,26,4,202601,2026),('2026-01-27',202605,1,2026,27,4,202601,2026),('2026-01-28',202605,1,2026,28,4,202601,2026),('2026-01-29',202605,1,2026,29,4,202601,2026),('2026-01-30',202605,1,2026,30,4,202601,2026),('2026-01-31',202605,1,2026,31,4,202601,2026),('2026-02-01',202606,2,2026,1,5,202602,2026),('2026-02-02',202606,2,2026,2,5,202602,2026),('2026-02-03',202606,2,2026,3,5,202602,2026),('2026-02-04',202606,2,2026,4,5,202602,2026),('2026-02-05',202606,2,2026,5,5,202602,2026),('2026-02-06',202606,2,2026,6,5,202602,2026),('2026-02-07',202606,2,2026,7,5,202602,2026),('2026-02-08',202607,2,2026,8,6,202602,2026),('2026-02-09',202607,2,2026,9,6,202602,2026),('2026-02-10',202607,2,2026,10,6,202602,2026),('2026-02-11',202607,2,2026,11,6,202602,2026),('2026-02-12',202607,2,2026,12,6,202602,2026),('2026-02-13',202607,2,2026,13,6,202602,2026),('2026-02-14',202607,2,2026,14,6,202602,2026),('2026-02-15',202608,2,2026,15,7,202602,2026),('2026-02-16',202608,2,2026,16,7,202602,2026),('2026-02-17',202608,2,2026,17,7,202602,2026),('2026-02-18',202608,2,2026,18,7,202602,2026),('2026-02-19',202608,2,2026,19,7,202602,2026),('2026-02-20',202608,2,2026,20,7,202602,2026),('2026-02-21',202608,2,2026,21,7,202602,2026),('2026-02-22',202609,2,2026,22,8,202602,2026),('2026-02-23',202609,2,2026,23,8,202602,2026),('2026-02-24',202609,2,2026,24,8,202602,2026),('2026-02-25',202609,2,2026,25,8,202602,2026),('2026-02-26',202609,2,2026,26,8,202602,2026),('2026-02-27',202609,2,2026,27,8,202602,2026),('2026-02-28',202609,2,2026,28,8,202602,2026),('2026-03-01',202610,3,2026,1,9,202603,2026),('2026-03-02',202610,3,2026,2,9,202603,2026),('2026-03-03',202610,3,2026,3,9,202603,2026),('2026-03-04',202610,3,2026,4,9,202603,2026),('2026-03-05',202610,3,2026,5,9,202603,2026),('2026-03-06',202610,3,2026,6,9,202603,2026),('2026-03-07',202610,3,2026,7,9,202603,2026),('2026-03-08',202611,3,2026,8,10,202603,2026),('2026-03-09',202611,3,2026,9,10,202603,2026),('2026-03-10',202611,3,2026,10,10,202603,2026),('2026-03-11',202611,3,2026,11,10,202603,2026),('2026-03-12',202611,3,2026,12,10,202603,2026),('2026-03-13',202611,3,2026,13,10,202603,2026),('2026-03-14',202611,3,2026,14,10,202603,2026),('2026-03-15',202612,3,2026,15,11,202603,2026),('2026-03-16',202612,3,2026,16,11,202603,2026),('2026-03-17',202612,3,2026,17,11,202603,2026),('2026-03-18',202612,3,2026,18,11,202603,2026),('2026-03-19',202612,3,2026,19,11,202603,2026),('2026-03-20',202612,3,2026,20,11,202603,2026),('2026-03-21',202612,3,2026,21,11,202603,2026),('2026-03-22',202613,3,2026,22,12,202603,2026),('2026-03-23',202613,3,2026,23,12,202603,2026),('2026-03-24',202613,3,2026,24,12,202603,2026),('2026-03-25',202613,3,2026,25,12,202603,2026),('2026-03-26',202613,3,2026,26,12,202603,2026),('2026-03-27',202613,3,2026,27,12,202603,2026),('2026-03-28',202613,3,2026,28,12,202603,2026),('2026-03-29',202614,3,2026,29,13,202603,2026),('2026-03-30',202614,3,2026,30,13,202603,2026),('2026-03-31',202614,3,2026,31,13,202603,2026),('2026-04-01',202614,4,2026,1,13,202604,2026),('2026-04-02',202614,4,2026,2,13,202604,2026),('2026-04-03',202614,4,2026,3,13,202604,2026),('2026-04-04',202614,4,2026,4,13,202604,2026),('2026-04-05',202615,4,2026,5,14,202604,2026),('2026-04-06',202615,4,2026,6,14,202604,2026),('2026-04-07',202615,4,2026,7,14,202604,2026),('2026-04-08',202615,4,2026,8,14,202604,2026),('2026-04-09',202615,4,2026,9,14,202604,2026),('2026-04-10',202615,4,2026,10,14,202604,2026),('2026-04-11',202615,4,2026,11,14,202604,2026),('2026-04-12',202616,4,2026,12,15,202604,2026),('2026-04-13',202616,4,2026,13,15,202604,2026),('2026-04-14',202616,4,2026,14,15,202604,2026),('2026-04-15',202616,4,2026,15,15,202604,2026),('2026-04-16',202616,4,2026,16,15,202604,2026),('2026-04-17',202616,4,2026,17,15,202604,2026),('2026-04-18',202616,4,2026,18,15,202604,2026),('2026-04-19',202617,4,2026,19,16,202604,2026),('2026-04-20',202617,4,2026,20,16,202604,2026),('2026-04-21',202617,4,2026,21,16,202604,2026),('2026-04-22',202617,4,2026,22,16,202604,2026),('2026-04-23',202617,4,2026,23,16,202604,2026),('2026-04-24',202617,4,2026,24,16,202604,2026),('2026-04-25',202617,4,2026,25,16,202604,2026),('2026-04-26',202618,4,2026,26,17,202604,2026),('2026-04-27',202618,4,2026,27,17,202604,2026),('2026-04-28',202618,4,2026,28,17,202604,2026),('2026-04-29',202618,4,2026,29,17,202604,2026),('2026-04-30',202618,4,2026,30,17,202604,2026),('2026-05-01',202618,5,2026,1,17,202605,2026),('2026-05-02',202618,5,2026,2,17,202605,2026),('2026-05-03',202619,5,2026,3,18,202605,2026),('2026-05-04',202619,5,2026,4,18,202605,2026),('2026-05-05',202619,5,2026,5,18,202605,2026),('2026-05-06',202619,5,2026,6,18,202605,2026),('2026-05-07',202619,5,2026,7,18,202605,2026),('2026-05-08',202619,5,2026,8,18,202605,2026),('2026-05-09',202619,5,2026,9,18,202605,2026),('2026-05-10',202620,5,2026,10,19,202605,2026),('2026-05-11',202620,5,2026,11,19,202605,2026),('2026-05-12',202620,5,2026,12,19,202605,2026),('2026-05-13',202620,5,2026,13,19,202605,2026),('2026-05-14',202620,5,2026,14,19,202605,2026),('2026-05-15',202620,5,2026,15,19,202605,2026),('2026-05-16',202620,5,2026,16,19,202605,2026),('2026-05-17',202621,5,2026,17,20,202605,2026),('2026-05-18',202621,5,2026,18,20,202605,2026),('2026-05-19',202621,5,2026,19,20,202605,2026),('2026-05-20',202621,5,2026,20,20,202605,2026),('2026-05-21',202621,5,2026,21,20,202605,2026),('2026-05-22',202621,5,2026,22,20,202605,2026),('2026-05-23',202621,5,2026,23,20,202605,2026),('2026-05-24',202622,5,2026,24,21,202605,2026),('2026-05-25',202622,5,2026,25,21,202605,2026),('2026-05-26',202622,5,2026,26,21,202605,2026),('2026-05-27',202622,5,2026,27,21,202605,2026),('2026-05-28',202622,5,2026,28,21,202605,2026),('2026-05-29',202622,5,2026,29,21,202605,2026),('2026-05-30',202622,5,2026,30,21,202605,2026),('2026-05-31',202623,5,2026,31,22,202605,2026),('2026-06-01',202623,6,2026,1,22,202606,2026),('2026-06-02',202623,6,2026,2,22,202606,2026),('2026-06-03',202623,6,2026,3,22,202606,2026),('2026-06-04',202623,6,2026,4,22,202606,2026),('2026-06-05',202623,6,2026,5,22,202606,2026),('2026-06-06',202623,6,2026,6,22,202606,2026),('2026-06-07',202624,6,2026,7,23,202606,2026),('2026-06-08',202624,6,2026,8,23,202606,2026),('2026-06-09',202624,6,2026,9,23,202606,2026),('2026-06-10',202624,6,2026,10,23,202606,2026),('2026-06-11',202624,6,2026,11,23,202606,2026),('2026-06-12',202624,6,2026,12,23,202606,2026),('2026-06-13',202624,6,2026,13,23,202606,2026),('2026-06-14',202625,6,2026,14,24,202606,2026),('2026-06-15',202625,6,2026,15,24,202606,2026),('2026-06-16',202625,6,2026,16,24,202606,2026),('2026-06-17',202625,6,2026,17,24,202606,2026),('2026-06-18',202625,6,2026,18,24,202606,2026),('2026-06-19',202625,6,2026,19,24,202606,2026),('2026-06-20',202625,6,2026,20,24,202606,2026),('2026-06-21',202626,6,2026,21,25,202606,2026),('2026-06-22',202626,6,2026,22,25,202606,2026),('2026-06-23',202626,6,2026,23,25,202606,2026),('2026-06-24',202626,6,2026,24,25,202606,2026),('2026-06-25',202626,6,2026,25,25,202606,2026),('2026-06-26',202626,6,2026,26,25,202606,2026),('2026-06-27',202626,6,2026,27,25,202606,2026),('2026-06-28',202627,6,2026,28,26,202606,2026),('2026-06-29',202627,6,2026,29,26,202606,2026),('2026-06-30',202627,6,2026,30,26,202606,2026),('2026-07-01',202627,7,2026,1,26,202607,2026),('2026-07-02',202627,7,2026,2,26,202607,2026),('2026-07-03',202627,7,2026,3,26,202607,2026),('2026-07-04',202627,7,2026,4,26,202607,2026),('2026-07-05',202628,7,2026,5,27,202607,2026),('2026-07-06',202628,7,2026,6,27,202607,2026),('2026-07-07',202628,7,2026,7,27,202607,2026),('2026-07-08',202628,7,2026,8,27,202607,2026),('2026-07-09',202628,7,2026,9,27,202607,2026),('2026-07-10',202628,7,2026,10,27,202607,2026),('2026-07-11',202628,7,2026,11,27,202607,2026),('2026-07-12',202629,7,2026,12,28,202607,2026),('2026-07-13',202629,7,2026,13,28,202607,2026),('2026-07-14',202629,7,2026,14,28,202607,2026),('2026-07-15',202629,7,2026,15,28,202607,2026),('2026-07-16',202629,7,2026,16,28,202607,2026),('2026-07-17',202629,7,2026,17,28,202607,2026),('2026-07-18',202629,7,2026,18,28,202607,2026),('2026-07-19',202630,7,2026,19,29,202607,2026),('2026-07-20',202630,7,2026,20,29,202607,2026),('2026-07-21',202630,7,2026,21,29,202607,2026),('2026-07-22',202630,7,2026,22,29,202607,2026),('2026-07-23',202630,7,2026,23,29,202607,2026),('2026-07-24',202630,7,2026,24,29,202607,2026),('2026-07-25',202630,7,2026,25,29,202607,2026),('2026-07-26',202631,7,2026,26,30,202607,2026),('2026-07-27',202631,7,2026,27,30,202607,2026),('2026-07-28',202631,7,2026,28,30,202607,2026),('2026-07-29',202631,7,2026,29,30,202607,2026),('2026-07-30',202631,7,2026,30,30,202607,2026),('2026-07-31',202631,7,2026,31,30,202607,2026),('2026-08-01',202631,8,2026,1,30,202608,2026),('2026-08-02',202632,8,2026,2,31,202608,2026),('2026-08-03',202632,8,2026,3,31,202608,2026),('2026-08-04',202632,8,2026,4,31,202608,2026),('2026-08-05',202632,8,2026,5,31,202608,2026),('2026-08-06',202632,8,2026,6,31,202608,2026),('2026-08-07',202632,8,2026,7,31,202608,2026),('2026-08-08',202632,8,2026,8,31,202608,2026),('2026-08-09',202633,8,2026,9,32,202608,2026),('2026-08-10',202633,8,2026,10,32,202608,2026),('2026-08-11',202633,8,2026,11,32,202608,2026),('2026-08-12',202633,8,2026,12,32,202608,2026),('2026-08-13',202633,8,2026,13,32,202608,2026),('2026-08-14',202633,8,2026,14,32,202608,2026),('2026-08-15',202633,8,2026,15,32,202608,2026),('2026-08-16',202634,8,2026,16,33,202608,2026),('2026-08-17',202634,8,2026,17,33,202608,2026),('2026-08-18',202634,8,2026,18,33,202608,2026),('2026-08-19',202634,8,2026,19,33,202608,2026),('2026-08-20',202634,8,2026,20,33,202608,2026),('2026-08-21',202634,8,2026,21,33,202608,2026),('2026-08-22',202634,8,2026,22,33,202608,2026),('2026-08-23',202635,8,2026,23,34,202608,2026),('2026-08-24',202635,8,2026,24,34,202608,2026),('2026-08-25',202635,8,2026,25,34,202608,2026),('2026-08-26',202635,8,2026,26,34,202608,2026),('2026-08-27',202635,8,2026,27,34,202608,2026),('2026-08-28',202635,8,2026,28,34,202608,2026),('2026-08-29',202635,8,2026,29,34,202608,2026),('2026-08-30',202636,8,2026,30,35,202608,2026),('2026-08-31',202636,8,2026,31,35,202608,2026),('2026-09-01',202636,9,2026,1,35,202609,2026),('2026-09-02',202636,9,2026,2,35,202609,2026),('2026-09-03',202636,9,2026,3,35,202609,2026),('2026-09-04',202636,9,2026,4,35,202609,2026),('2026-09-05',202636,9,2026,5,35,202609,2026),('2026-09-06',202637,9,2026,6,36,202609,2026),('2026-09-07',202637,9,2026,7,36,202609,2026),('2026-09-08',202637,9,2026,8,36,202609,2026),('2026-09-09',202637,9,2026,9,36,202609,2026),('2026-09-10',202637,9,2026,10,36,202609,2026),('2026-09-11',202637,9,2026,11,36,202609,2026),('2026-09-12',202637,9,2026,12,36,202609,2026),('2026-09-13',202638,9,2026,13,37,202609,2026),('2026-09-14',202638,9,2026,14,37,202609,2026),('2026-09-15',202638,9,2026,15,37,202609,2026),('2026-09-16',202638,9,2026,16,37,202609,2026),('2026-09-17',202638,9,2026,17,37,202609,2026),('2026-09-18',202638,9,2026,18,37,202609,2026),('2026-09-19',202638,9,2026,19,37,202609,2026),('2026-09-20',202639,9,2026,20,38,202609,2026),('2026-09-21',202639,9,2026,21,38,202609,2026),('2026-09-22',202639,9,2026,22,38,202609,2026),('2026-09-23',202639,9,2026,23,38,202609,2026),('2026-09-24',202639,9,2026,24,38,202609,2026),('2026-09-25',202639,9,2026,25,38,202609,2026),('2026-09-26',202639,9,2026,26,38,202609,2026),('2026-09-27',202640,9,2026,27,39,202609,2026),('2026-09-28',202640,9,2026,28,39,202609,2026),('2026-09-29',202640,9,2026,29,39,202609,2026),('2026-09-30',202640,9,2026,30,39,202609,2026),('2026-10-01',202640,10,2026,1,39,202610,2026),('2026-10-02',202640,10,2026,2,39,202610,2026),('2026-10-03',202640,10,2026,3,39,202610,2026),('2026-10-04',202641,10,2026,4,40,202610,2026),('2026-10-05',202641,10,2026,5,40,202610,2026),('2026-10-06',202641,10,2026,6,40,202610,2026),('2026-10-07',202641,10,2026,7,40,202610,2026),('2026-10-08',202641,10,2026,8,40,202610,2026),('2026-10-09',202641,10,2026,9,40,202610,2026),('2026-10-10',202641,10,2026,10,40,202610,2026),('2026-10-11',202642,10,2026,11,41,202610,2026),('2026-10-12',202642,10,2026,12,41,202610,2026),('2026-10-13',202642,10,2026,13,41,202610,2026),('2026-10-14',202642,10,2026,14,41,202610,2026),('2026-10-15',202642,10,2026,15,41,202610,2026),('2026-10-16',202642,10,2026,16,41,202610,2026),('2026-10-17',202642,10,2026,17,41,202610,2026),('2026-10-18',202643,10,2026,18,42,202610,2026),('2026-10-19',202643,10,2026,19,42,202610,2026),('2026-10-20',202643,10,2026,20,42,202610,2026),('2026-10-21',202643,10,2026,21,42,202610,2026),('2026-10-22',202643,10,2026,22,42,202610,2026),('2026-10-23',202643,10,2026,23,42,202610,2026),('2026-10-24',202643,10,2026,24,42,202610,2026),('2026-10-25',202644,10,2026,25,43,202610,2026),('2026-10-26',202644,10,2026,26,43,202610,2026),('2026-10-27',202644,10,2026,27,43,202610,2026),('2026-10-28',202644,10,2026,28,43,202610,2026),('2026-10-29',202644,10,2026,29,43,202610,2026),('2026-10-30',202644,10,2026,30,43,202610,2026),('2026-10-31',202644,10,2026,31,43,202610,2026),('2026-11-01',202645,11,2026,1,44,202611,2026),('2026-11-02',202645,11,2026,2,44,202611,2026),('2026-11-03',202645,11,2026,3,44,202611,2026),('2026-11-04',202645,11,2026,4,44,202611,2026),('2026-11-05',202645,11,2026,5,44,202611,2026),('2026-11-06',202645,11,2026,6,44,202611,2026),('2026-11-07',202645,11,2026,7,44,202611,2026),('2026-11-08',202646,11,2026,8,45,202611,2026),('2026-11-09',202646,11,2026,9,45,202611,2026),('2026-11-10',202646,11,2026,10,45,202611,2026),('2026-11-11',202646,11,2026,11,45,202611,2026),('2026-11-12',202646,11,2026,12,45,202611,2026),('2026-11-13',202646,11,2026,13,45,202611,2026),('2026-11-14',202646,11,2026,14,45,202611,2026),('2026-11-15',202647,11,2026,15,46,202611,2026),('2026-11-16',202647,11,2026,16,46,202611,2026),('2026-11-17',202647,11,2026,17,46,202611,2026),('2026-11-18',202647,11,2026,18,46,202611,2026),('2026-11-19',202647,11,2026,19,46,202611,2026),('2026-11-20',202647,11,2026,20,46,202611,2026),('2026-11-21',202647,11,2026,21,46,202611,2026),('2026-11-22',202648,11,2026,22,47,202611,2026),('2026-11-23',202648,11,2026,23,47,202611,2026),('2026-11-24',202648,11,2026,24,47,202611,2026),('2026-11-25',202648,11,2026,25,47,202611,2026),('2026-11-26',202648,11,2026,26,47,202611,2026),('2026-11-27',202648,11,2026,27,47,202611,2026),('2026-11-28',202648,11,2026,28,47,202611,2026),('2026-11-29',202649,11,2026,29,48,202611,2026),('2026-11-30',202649,11,2026,30,48,202611,2026),('2026-12-01',202649,12,2026,1,48,202612,2027),('2026-12-02',202649,12,2026,2,48,202612,2027),('2026-12-03',202649,12,2026,3,48,202612,2027),('2026-12-04',202649,12,2026,4,48,202612,2027),('2026-12-05',202649,12,2026,5,48,202612,2027),('2026-12-06',202650,12,2026,6,49,202612,2027),('2026-12-07',202650,12,2026,7,49,202612,2027),('2026-12-08',202650,12,2026,8,49,202612,2027),('2026-12-09',202650,12,2026,9,49,202612,2027),('2026-12-10',202650,12,2026,10,49,202612,2027),('2026-12-11',202650,12,2026,11,49,202612,2027),('2026-12-12',202650,12,2026,12,49,202612,2027),('2026-12-13',202651,12,2026,13,50,202612,2027),('2026-12-14',202651,12,2026,14,50,202612,2027),('2026-12-15',202651,12,2026,15,50,202612,2027),('2026-12-16',202651,12,2026,16,50,202612,2027),('2026-12-17',202651,12,2026,17,50,202612,2027),('2026-12-18',202651,12,2026,18,50,202612,2027),('2026-12-19',202651,12,2026,19,50,202612,2027),('2026-12-20',202652,12,2026,20,51,202612,2027),('2026-12-21',202652,12,2026,21,51,202612,2027),('2026-12-22',202652,12,2026,22,51,202612,2027),('2026-12-23',202652,12,2026,23,51,202612,2027),('2026-12-24',202652,12,2026,24,51,202612,2027),('2026-12-25',202652,12,2026,25,51,202612,2027),('2026-12-26',202652,12,2026,26,51,202612,2027),('2026-12-27',202653,12,2026,27,52,202612,2027),('2026-12-28',202653,12,2026,28,52,202612,2027),('2026-12-29',202653,12,2026,29,52,202612,2027),('2026-12-30',202653,12,2026,30,52,202612,2027),('2026-12-31',202653,12,2026,31,52,202612,2027),('2027-01-01',202753,1,2027,1,52,202701,2027),('2027-01-02',202753,1,2027,2,52,202701,2027),('2027-01-03',202754,1,2027,3,1,202701,2027),('2027-01-04',202701,1,2027,4,1,202701,2027),('2027-01-05',202701,1,2027,5,1,202701,2027),('2027-01-06',202701,1,2027,6,1,202701,2027),('2027-01-07',202701,1,2027,7,1,202701,2027),('2027-01-08',202701,1,2027,8,1,202701,2027),('2027-01-09',202701,1,2027,9,1,202701,2027),('2027-01-10',202702,1,2027,10,2,202701,2027),('2027-01-11',202702,1,2027,11,2,202701,2027),('2027-01-12',202702,1,2027,12,2,202701,2027),('2027-01-13',202702,1,2027,13,2,202701,2027),('2027-01-14',202702,1,2027,14,2,202701,2027),('2027-01-15',202702,1,2027,15,2,202701,2027),('2027-01-16',202702,1,2027,16,2,202701,2027),('2027-01-17',202703,1,2027,17,3,202701,2027),('2027-01-18',202703,1,2027,18,3,202701,2027),('2027-01-19',202703,1,2027,19,3,202701,2027),('2027-01-20',202703,1,2027,20,3,202701,2027),('2027-01-21',202703,1,2027,21,3,202701,2027),('2027-01-22',202703,1,2027,22,3,202701,2027),('2027-01-23',202703,1,2027,23,3,202701,2027),('2027-01-24',202704,1,2027,24,4,202701,2027),('2027-01-25',202704,1,2027,25,4,202701,2027),('2027-01-26',202704,1,2027,26,4,202701,2027),('2027-01-27',202704,1,2027,27,4,202701,2027),('2027-01-28',202704,1,2027,28,4,202701,2027),('2027-01-29',202704,1,2027,29,4,202701,2027),('2027-01-30',202704,1,2027,30,4,202701,2027),('2027-01-31',202705,1,2027,31,5,202701,2027),('2027-02-01',202705,2,2027,1,5,202702,2027),('2027-02-02',202705,2,2027,2,5,202702,2027),('2027-02-03',202705,2,2027,3,5,202702,2027),('2027-02-04',202705,2,2027,4,5,202702,2027),('2027-02-05',202705,2,2027,5,5,202702,2027),('2027-02-06',202705,2,2027,6,5,202702,2027),('2027-02-07',202706,2,2027,7,6,202702,2027),('2027-02-08',202706,2,2027,8,6,202702,2027),('2027-02-09',202706,2,2027,9,6,202702,2027),('2027-02-10',202706,2,2027,10,6,202702,2027),('2027-02-11',202706,2,2027,11,6,202702,2027),('2027-02-12',202706,2,2027,12,6,202702,2027),('2027-02-13',202706,2,2027,13,6,202702,2027),('2027-02-14',202707,2,2027,14,7,202702,2027),('2027-02-15',202707,2,2027,15,7,202702,2027),('2027-02-16',202707,2,2027,16,7,202702,2027),('2027-02-17',202707,2,2027,17,7,202702,2027),('2027-02-18',202707,2,2027,18,7,202702,2027),('2027-02-19',202707,2,2027,19,7,202702,2027),('2027-02-20',202707,2,2027,20,7,202702,2027),('2027-02-21',202708,2,2027,21,8,202702,2027),('2027-02-22',202708,2,2027,22,8,202702,2027),('2027-02-23',202708,2,2027,23,8,202702,2027),('2027-02-24',202708,2,2027,24,8,202702,2027),('2027-02-25',202708,2,2027,25,8,202702,2027),('2027-02-26',202708,2,2027,26,8,202702,2027),('2027-02-27',202708,2,2027,27,8,202702,2027),('2027-02-28',202709,2,2027,28,9,202702,2027),('2027-03-01',202709,3,2027,1,9,202703,2027),('2027-03-02',202709,3,2027,2,9,202703,2027),('2027-03-03',202709,3,2027,3,9,202703,2027),('2027-03-04',202709,3,2027,4,9,202703,2027),('2027-03-05',202709,3,2027,5,9,202703,2027),('2027-03-06',202709,3,2027,6,9,202703,2027),('2027-03-07',202710,3,2027,7,10,202703,2027),('2027-03-08',202710,3,2027,8,10,202703,2027),('2027-03-09',202710,3,2027,9,10,202703,2027),('2027-03-10',202710,3,2027,10,10,202703,2027),('2027-03-11',202710,3,2027,11,10,202703,2027),('2027-03-12',202710,3,2027,12,10,202703,2027),('2027-03-13',202710,3,2027,13,10,202703,2027),('2027-03-14',202711,3,2027,14,11,202703,2027),('2027-03-15',202711,3,2027,15,11,202703,2027),('2027-03-16',202711,3,2027,16,11,202703,2027),('2027-03-17',202711,3,2027,17,11,202703,2027),('2027-03-18',202711,3,2027,18,11,202703,2027),('2027-03-19',202711,3,2027,19,11,202703,2027),('2027-03-20',202711,3,2027,20,11,202703,2027),('2027-03-21',202712,3,2027,21,12,202703,2027),('2027-03-22',202712,3,2027,22,12,202703,2027),('2027-03-23',202712,3,2027,23,12,202703,2027),('2027-03-24',202712,3,2027,24,12,202703,2027),('2027-03-25',202712,3,2027,25,12,202703,2027),('2027-03-26',202712,3,2027,26,12,202703,2027),('2027-03-27',202712,3,2027,27,12,202703,2027),('2027-03-28',202713,3,2027,28,13,202703,2027),('2027-03-29',202713,3,2027,29,13,202703,2027),('2027-03-30',202713,3,2027,30,13,202703,2027),('2027-03-31',202713,3,2027,31,13,202703,2027),('2027-04-01',202713,4,2027,1,13,202704,2027),('2027-04-02',202713,4,2027,2,13,202704,2027),('2027-04-03',202713,4,2027,3,13,202704,2027),('2027-04-04',202714,4,2027,4,14,202704,2027),('2027-04-05',202714,4,2027,5,14,202704,2027),('2027-04-06',202714,4,2027,6,14,202704,2027),('2027-04-07',202714,4,2027,7,14,202704,2027),('2027-04-08',202714,4,2027,8,14,202704,2027),('2027-04-09',202714,4,2027,9,14,202704,2027),('2027-04-10',202714,4,2027,10,14,202704,2027),('2027-04-11',202715,4,2027,11,15,202704,2027),('2027-04-12',202715,4,2027,12,15,202704,2027),('2027-04-13',202715,4,2027,13,15,202704,2027),('2027-04-14',202715,4,2027,14,15,202704,2027),('2027-04-15',202715,4,2027,15,15,202704,2027),('2027-04-16',202715,4,2027,16,15,202704,2027),('2027-04-17',202715,4,2027,17,15,202704,2027),('2027-04-18',202716,4,2027,18,16,202704,2027),('2027-04-19',202716,4,2027,19,16,202704,2027),('2027-04-20',202716,4,2027,20,16,202704,2027),('2027-04-21',202716,4,2027,21,16,202704,2027),('2027-04-22',202716,4,2027,22,16,202704,2027),('2027-04-23',202716,4,2027,23,16,202704,2027),('2027-04-24',202716,4,2027,24,16,202704,2027),('2027-04-25',202717,4,2027,25,17,202704,2027),('2027-04-26',202717,4,2027,26,17,202704,2027),('2027-04-27',202717,4,2027,27,17,202704,2027),('2027-04-28',202717,4,2027,28,17,202704,2027),('2027-04-29',202717,4,2027,29,17,202704,2027),('2027-04-30',202717,4,2027,30,17,202704,2027),('2027-05-01',202717,5,2027,1,17,202705,2027),('2027-05-02',202718,5,2027,2,18,202705,2027),('2027-05-03',202718,5,2027,3,18,202705,2027),('2027-05-04',202718,5,2027,4,18,202705,2027),('2027-05-05',202718,5,2027,5,18,202705,2027),('2027-05-06',202718,5,2027,6,18,202705,2027),('2027-05-07',202718,5,2027,7,18,202705,2027),('2027-05-08',202718,5,2027,8,18,202705,2027),('2027-05-09',202719,5,2027,9,19,202705,2027),('2027-05-10',202719,5,2027,10,19,202705,2027),('2027-05-11',202719,5,2027,11,19,202705,2027),('2027-05-12',202719,5,2027,12,19,202705,2027),('2027-05-13',202719,5,2027,13,19,202705,2027),('2027-05-14',202719,5,2027,14,19,202705,2027),('2027-05-15',202719,5,2027,15,19,202705,2027),('2027-05-16',202720,5,2027,16,20,202705,2027),('2027-05-17',202720,5,2027,17,20,202705,2027),('2027-05-18',202720,5,2027,18,20,202705,2027),('2027-05-19',202720,5,2027,19,20,202705,2027),('2027-05-20',202720,5,2027,20,20,202705,2027),('2027-05-21',202720,5,2027,21,20,202705,2027),('2027-05-22',202720,5,2027,22,20,202705,2027),('2027-05-23',202721,5,2027,23,21,202705,2027),('2027-05-24',202721,5,2027,24,21,202705,2027),('2027-05-25',202721,5,2027,25,21,202705,2027),('2027-05-26',202721,5,2027,26,21,202705,2027),('2027-05-27',202721,5,2027,27,21,202705,2027),('2027-05-28',202721,5,2027,28,21,202705,2027),('2027-05-29',202721,5,2027,29,21,202705,2027),('2027-05-30',202722,5,2027,30,22,202705,2027),('2027-05-31',202722,5,2027,31,22,202705,2027),('2027-06-01',202722,6,2027,1,22,202706,2027),('2027-06-02',202722,6,2027,2,22,202706,2027),('2027-06-03',202722,6,2027,3,22,202706,2027),('2027-06-04',202722,6,2027,4,22,202706,2027),('2027-06-05',202722,6,2027,5,22,202706,2027),('2027-06-06',202723,6,2027,6,23,202706,2027),('2027-06-07',202723,6,2027,7,23,202706,2027),('2027-06-08',202723,6,2027,8,23,202706,2027),('2027-06-09',202723,6,2027,9,23,202706,2027),('2027-06-10',202723,6,2027,10,23,202706,2027),('2027-06-11',202723,6,2027,11,23,202706,2027),('2027-06-12',202723,6,2027,12,23,202706,2027),('2027-06-13',202724,6,2027,13,24,202706,2027),('2027-06-14',202724,6,2027,14,24,202706,2027),('2027-06-15',202724,6,2027,15,24,202706,2027),('2027-06-16',202724,6,2027,16,24,202706,2027),('2027-06-17',202724,6,2027,17,24,202706,2027),('2027-06-18',202724,6,2027,18,24,202706,2027),('2027-06-19',202724,6,2027,19,24,202706,2027),('2027-06-20',202725,6,2027,20,25,202706,2027),('2027-06-21',202725,6,2027,21,25,202706,2027),('2027-06-22',202725,6,2027,22,25,202706,2027),('2027-06-23',202725,6,2027,23,25,202706,2027),('2027-06-24',202725,6,2027,24,25,202706,2027),('2027-06-25',202725,6,2027,25,25,202706,2027),('2027-06-26',202725,6,2027,26,25,202706,2027),('2027-06-27',202726,6,2027,27,26,202706,2027),('2027-06-28',202726,6,2027,28,26,202706,2027),('2027-06-29',202726,6,2027,29,26,202706,2027),('2027-06-30',202726,6,2027,30,26,202706,2027),('2027-07-01',202726,7,2027,1,26,202707,2027),('2027-07-02',202726,7,2027,2,26,202707,2027),('2027-07-03',202726,7,2027,3,26,202707,2027),('2027-07-04',202727,7,2027,4,27,202707,2027),('2027-07-05',202727,7,2027,5,27,202707,2027),('2027-07-06',202727,7,2027,6,27,202707,2027),('2027-07-07',202727,7,2027,7,27,202707,2027),('2027-07-08',202727,7,2027,8,27,202707,2027),('2027-07-09',202727,7,2027,9,27,202707,2027),('2027-07-10',202727,7,2027,10,27,202707,2027),('2027-07-11',202728,7,2027,11,28,202707,2027),('2027-07-12',202728,7,2027,12,28,202707,2027),('2027-07-13',202728,7,2027,13,28,202707,2027),('2027-07-14',202728,7,2027,14,28,202707,2027),('2027-07-15',202728,7,2027,15,28,202707,2027),('2027-07-16',202728,7,2027,16,28,202707,2027),('2027-07-17',202728,7,2027,17,28,202707,2027),('2027-07-18',202729,7,2027,18,29,202707,2027),('2027-07-19',202729,7,2027,19,29,202707,2027),('2027-07-20',202729,7,2027,20,29,202707,2027),('2027-07-21',202729,7,2027,21,29,202707,2027),('2027-07-22',202729,7,2027,22,29,202707,2027),('2027-07-23',202729,7,2027,23,29,202707,2027),('2027-07-24',202729,7,2027,24,29,202707,2027),('2027-07-25',202730,7,2027,25,30,202707,2027),('2027-07-26',202730,7,2027,26,30,202707,2027),('2027-07-27',202730,7,2027,27,30,202707,2027),('2027-07-28',202730,7,2027,28,30,202707,2027),('2027-07-29',202730,7,2027,29,30,202707,2027),('2027-07-30',202730,7,2027,30,30,202707,2027),('2027-07-31',202730,7,2027,31,30,202707,2027),('2027-08-01',202731,8,2027,1,31,202708,2027),('2027-08-02',202731,8,2027,2,31,202708,2027),('2027-08-03',202731,8,2027,3,31,202708,2027),('2027-08-04',202731,8,2027,4,31,202708,2027),('2027-08-05',202731,8,2027,5,31,202708,2027),('2027-08-06',202731,8,2027,6,31,202708,2027),('2027-08-07',202731,8,2027,7,31,202708,2027),('2027-08-08',202732,8,2027,8,32,202708,2027),('2027-08-09',202732,8,2027,9,32,202708,2027),('2027-08-10',202732,8,2027,10,32,202708,2027),('2027-08-11',202732,8,2027,11,32,202708,2027),('2027-08-12',202732,8,2027,12,32,202708,2027),('2027-08-13',202732,8,2027,13,32,202708,2027),('2027-08-14',202732,8,2027,14,32,202708,2027),('2027-08-15',202733,8,2027,15,33,202708,2027),('2027-08-16',202733,8,2027,16,33,202708,2027),('2027-08-17',202733,8,2027,17,33,202708,2027),('2027-08-18',202733,8,2027,18,33,202708,2027),('2027-08-19',202733,8,2027,19,33,202708,2027),('2027-08-20',202733,8,2027,20,33,202708,2027),('2027-08-21',202733,8,2027,21,33,202708,2027),('2027-08-22',202734,8,2027,22,34,202708,2027),('2027-08-23',202734,8,2027,23,34,202708,2027),('2027-08-24',202734,8,2027,24,34,202708,2027),('2027-08-25',202734,8,2027,25,34,202708,2027),('2027-08-26',202734,8,2027,26,34,202708,2027),('2027-08-27',202734,8,2027,27,34,202708,2027),('2027-08-28',202734,8,2027,28,34,202708,2027),('2027-08-29',202735,8,2027,29,35,202708,2027),('2027-08-30',202735,8,2027,30,35,202708,2027),('2027-08-31',202735,8,2027,31,35,202708,2027),('2027-09-01',202735,9,2027,1,35,202709,2027),('2027-09-02',202735,9,2027,2,35,202709,2027),('2027-09-03',202735,9,2027,3,35,202709,2027),('2027-09-04',202735,9,2027,4,35,202709,2027),('2027-09-05',202736,9,2027,5,36,202709,2027),('2027-09-06',202736,9,2027,6,36,202709,2027),('2027-09-07',202736,9,2027,7,36,202709,2027),('2027-09-08',202736,9,2027,8,36,202709,2027),('2027-09-09',202736,9,2027,9,36,202709,2027),('2027-09-10',202736,9,2027,10,36,202709,2027),('2027-09-11',202736,9,2027,11,36,202709,2027),('2027-09-12',202737,9,2027,12,37,202709,2027),('2027-09-13',202737,9,2027,13,37,202709,2027),('2027-09-14',202737,9,2027,14,37,202709,2027),('2027-09-15',202737,9,2027,15,37,202709,2027),('2027-09-16',202737,9,2027,16,37,202709,2027),('2027-09-17',202737,9,2027,17,37,202709,2027),('2027-09-18',202737,9,2027,18,37,202709,2027),('2027-09-19',202738,9,2027,19,38,202709,2027),('2027-09-20',202738,9,2027,20,38,202709,2027),('2027-09-21',202738,9,2027,21,38,202709,2027),('2027-09-22',202738,9,2027,22,38,202709,2027),('2027-09-23',202738,9,2027,23,38,202709,2027),('2027-09-24',202738,9,2027,24,38,202709,2027),('2027-09-25',202738,9,2027,25,38,202709,2027),('2027-09-26',202739,9,2027,26,39,202709,2027),('2027-09-27',202739,9,2027,27,39,202709,2027),('2027-09-28',202739,9,2027,28,39,202709,2027),('2027-09-29',202739,9,2027,29,39,202709,2027),('2027-09-30',202739,9,2027,30,39,202709,2027),('2027-10-01',202739,10,2027,1,39,202710,2027),('2027-10-02',202739,10,2027,2,39,202710,2027),('2027-10-03',202740,10,2027,3,40,202710,2027),('2027-10-04',202740,10,2027,4,40,202710,2027),('2027-10-05',202740,10,2027,5,40,202710,2027),('2027-10-06',202740,10,2027,6,40,202710,2027),('2027-10-07',202740,10,2027,7,40,202710,2027),('2027-10-08',202740,10,2027,8,40,202710,2027),('2027-10-09',202740,10,2027,9,40,202710,2027),('2027-10-10',202741,10,2027,10,41,202710,2027),('2027-10-11',202741,10,2027,11,41,202710,2027),('2027-10-12',202741,10,2027,12,41,202710,2027),('2027-10-13',202741,10,2027,13,41,202710,2027),('2027-10-14',202741,10,2027,14,41,202710,2027),('2027-10-15',202741,10,2027,15,41,202710,2027),('2027-10-16',202741,10,2027,16,41,202710,2027),('2027-10-17',202742,10,2027,17,42,202710,2027),('2027-10-18',202742,10,2027,18,42,202710,2027),('2027-10-19',202742,10,2027,19,42,202710,2027),('2027-10-20',202742,10,2027,20,42,202710,2027),('2027-10-21',202742,10,2027,21,42,202710,2027),('2027-10-22',202742,10,2027,22,42,202710,2027),('2027-10-23',202742,10,2027,23,42,202710,2027),('2027-10-24',202743,10,2027,24,43,202710,2027),('2027-10-25',202743,10,2027,25,43,202710,2027),('2027-10-26',202743,10,2027,26,43,202710,2027),('2027-10-27',202743,10,2027,27,43,202710,2027),('2027-10-28',202743,10,2027,28,43,202710,2027),('2027-10-29',202743,10,2027,29,43,202710,2027),('2027-10-30',202743,10,2027,30,43,202710,2027),('2027-10-31',202744,10,2027,31,44,202710,2027),('2027-11-01',202744,11,2027,1,44,202711,2027),('2027-11-02',202744,11,2027,2,44,202711,2027),('2027-11-03',202744,11,2027,3,44,202711,2027),('2027-11-04',202744,11,2027,4,44,202711,2027),('2027-11-05',202744,11,2027,5,44,202711,2027),('2027-11-06',202744,11,2027,6,44,202711,2027),('2027-11-07',202745,11,2027,7,45,202711,2027),('2027-11-08',202745,11,2027,8,45,202711,2027),('2027-11-09',202745,11,2027,9,45,202711,2027),('2027-11-10',202745,11,2027,10,45,202711,2027),('2027-11-11',202745,11,2027,11,45,202711,2027),('2027-11-12',202745,11,2027,12,45,202711,2027),('2027-11-13',202745,11,2027,13,45,202711,2027),('2027-11-14',202746,11,2027,14,46,202711,2027),('2027-11-15',202746,11,2027,15,46,202711,2027),('2027-11-16',202746,11,2027,16,46,202711,2027),('2027-11-17',202746,11,2027,17,46,202711,2027),('2027-11-18',202746,11,2027,18,46,202711,2027),('2027-11-19',202746,11,2027,19,46,202711,2027),('2027-11-20',202746,11,2027,20,46,202711,2027),('2027-11-21',202747,11,2027,21,47,202711,2027),('2027-11-22',202747,11,2027,22,47,202711,2027),('2027-11-23',202747,11,2027,23,47,202711,2027),('2027-11-24',202747,11,2027,24,47,202711,2027),('2027-11-25',202747,11,2027,25,47,202711,2027),('2027-11-26',202747,11,2027,26,47,202711,2027),('2027-11-27',202747,11,2027,27,47,202711,2027),('2027-11-28',202748,11,2027,28,48,202711,2027),('2027-11-29',202748,11,2027,29,48,202711,2027),('2027-11-30',202748,11,2027,30,48,202711,2027),('2027-12-01',202748,12,2027,1,48,202712,2028),('2027-12-02',202748,12,2027,2,48,202712,2028),('2027-12-03',202748,12,2027,3,48,202712,2028),('2027-12-04',202748,12,2027,4,48,202712,2028),('2027-12-05',202749,12,2027,5,49,202712,2028),('2027-12-06',202749,12,2027,6,49,202712,2028),('2027-12-07',202749,12,2027,7,49,202712,2028),('2027-12-08',202749,12,2027,8,49,202712,2028),('2027-12-09',202749,12,2027,9,49,202712,2028),('2027-12-10',202749,12,2027,10,49,202712,2028),('2027-12-11',202749,12,2027,11,49,202712,2028),('2027-12-12',202750,12,2027,12,50,202712,2028),('2027-12-13',202750,12,2027,13,50,202712,2028),('2027-12-14',202750,12,2027,14,50,202712,2028),('2027-12-15',202750,12,2027,15,50,202712,2028),('2027-12-16',202750,12,2027,16,50,202712,2028),('2027-12-17',202750,12,2027,17,50,202712,2028),('2027-12-18',202750,12,2027,18,50,202712,2028),('2027-12-19',202751,12,2027,19,51,202712,2028),('2027-12-20',202751,12,2027,20,51,202712,2028),('2027-12-21',202751,12,2027,21,51,202712,2028),('2027-12-22',202751,12,2027,22,51,202712,2028),('2027-12-23',202751,12,2027,23,51,202712,2028),('2027-12-24',202751,12,2027,24,51,202712,2028),('2027-12-25',202751,12,2027,25,51,202712,2028),('2027-12-26',202752,12,2027,26,52,202712,2028),('2027-12-27',202752,12,2027,27,52,202712,2028),('2027-12-28',202752,12,2027,28,52,202712,2028),('2027-12-29',202752,12,2027,29,52,202712,2028),('2027-12-30',202752,12,2027,30,52,202712,2028),('2027-12-31',202752,12,2027,31,52,202712,2028),('2028-01-01',202852,1,2028,1,52,202801,2028),('2028-01-02',202853,1,2028,2,1,202801,2028),('2028-01-03',202801,1,2028,3,1,202801,2028),('2028-01-04',202801,1,2028,4,1,202801,2028),('2028-01-05',202801,1,2028,5,1,202801,2028),('2028-01-06',202801,1,2028,6,1,202801,2028),('2028-01-07',202801,1,2028,7,1,202801,2028),('2028-01-08',202801,1,2028,8,1,202801,2028),('2028-01-09',202802,1,2028,9,2,202801,2028),('2028-01-10',202802,1,2028,10,2,202801,2028),('2028-01-11',202802,1,2028,11,2,202801,2028),('2028-01-12',202802,1,2028,12,2,202801,2028),('2028-01-13',202802,1,2028,13,2,202801,2028),('2028-01-14',202802,1,2028,14,2,202801,2028),('2028-01-15',202802,1,2028,15,2,202801,2028),('2028-01-16',202803,1,2028,16,3,202801,2028),('2028-01-17',202803,1,2028,17,3,202801,2028),('2028-01-18',202803,1,2028,18,3,202801,2028),('2028-01-19',202803,1,2028,19,3,202801,2028),('2028-01-20',202803,1,2028,20,3,202801,2028),('2028-01-21',202803,1,2028,21,3,202801,2028),('2028-01-22',202803,1,2028,22,3,202801,2028),('2028-01-23',202804,1,2028,23,4,202801,2028),('2028-01-24',202804,1,2028,24,4,202801,2028),('2028-01-25',202804,1,2028,25,4,202801,2028),('2028-01-26',202804,1,2028,26,4,202801,2028),('2028-01-27',202804,1,2028,27,4,202801,2028),('2028-01-28',202804,1,2028,28,4,202801,2028),('2028-01-29',202804,1,2028,29,4,202801,2028),('2028-01-30',202805,1,2028,30,5,202801,2028),('2028-01-31',202805,1,2028,31,5,202801,2028),('2028-02-01',202805,2,2028,1,5,202802,2028),('2028-02-02',202805,2,2028,2,5,202802,2028),('2028-02-03',202805,2,2028,3,5,202802,2028),('2028-02-04',202805,2,2028,4,5,202802,2028),('2028-02-05',202805,2,2028,5,5,202802,2028),('2028-02-06',202806,2,2028,6,6,202802,2028),('2028-02-07',202806,2,2028,7,6,202802,2028),('2028-02-08',202806,2,2028,8,6,202802,2028),('2028-02-09',202806,2,2028,9,6,202802,2028),('2028-02-10',202806,2,2028,10,6,202802,2028),('2028-02-11',202806,2,2028,11,6,202802,2028),('2028-02-12',202806,2,2028,12,6,202802,2028),('2028-02-13',202807,2,2028,13,7,202802,2028),('2028-02-14',202807,2,2028,14,7,202802,2028),('2028-02-15',202807,2,2028,15,7,202802,2028),('2028-02-16',202807,2,2028,16,7,202802,2028),('2028-02-17',202807,2,2028,17,7,202802,2028),('2028-02-18',202807,2,2028,18,7,202802,2028),('2028-02-19',202807,2,2028,19,7,202802,2028),('2028-02-20',202808,2,2028,20,8,202802,2028),('2028-02-21',202808,2,2028,21,8,202802,2028),('2028-02-22',202808,2,2028,22,8,202802,2028),('2028-02-23',202808,2,2028,23,8,202802,2028),('2028-02-24',202808,2,2028,24,8,202802,2028),('2028-02-25',202808,2,2028,25,8,202802,2028),('2028-02-26',202808,2,2028,26,8,202802,2028),('2028-02-27',202809,2,2028,27,9,202802,2028),('2028-02-28',202809,2,2028,28,9,202802,2028),('2028-02-29',202809,2,2028,29,9,202802,2028),('2028-03-01',202809,3,2028,1,9,202803,2028),('2028-03-02',202809,3,2028,2,9,202803,2028),('2028-03-03',202809,3,2028,3,9,202803,2028),('2028-03-04',202809,3,2028,4,9,202803,2028),('2028-03-05',202810,3,2028,5,10,202803,2028),('2028-03-06',202810,3,2028,6,10,202803,2028),('2028-03-07',202810,3,2028,7,10,202803,2028),('2028-03-08',202810,3,2028,8,10,202803,2028),('2028-03-09',202810,3,2028,9,10,202803,2028),('2028-03-10',202810,3,2028,10,10,202803,2028),('2028-03-11',202810,3,2028,11,10,202803,2028),('2028-03-12',202811,3,2028,12,11,202803,2028),('2028-03-13',202811,3,2028,13,11,202803,2028),('2028-03-14',202811,3,2028,14,11,202803,2028),('2028-03-15',202811,3,2028,15,11,202803,2028),('2028-03-16',202811,3,2028,16,11,202803,2028),('2028-03-17',202811,3,2028,17,11,202803,2028),('2028-03-18',202811,3,2028,18,11,202803,2028),('2028-03-19',202812,3,2028,19,12,202803,2028),('2028-03-20',202812,3,2028,20,12,202803,2028),('2028-03-21',202812,3,2028,21,12,202803,2028),('2028-03-22',202812,3,2028,22,12,202803,2028),('2028-03-23',202812,3,2028,23,12,202803,2028),('2028-03-24',202812,3,2028,24,12,202803,2028),('2028-03-25',202812,3,2028,25,12,202803,2028),('2028-03-26',202813,3,2028,26,13,202803,2028),('2028-03-27',202813,3,2028,27,13,202803,2028),('2028-03-28',202813,3,2028,28,13,202803,2028),('2028-03-29',202813,3,2028,29,13,202803,2028),('2028-03-30',202813,3,2028,30,13,202803,2028),('2028-03-31',202813,3,2028,31,13,202803,2028),('2028-04-01',202813,4,2028,1,13,202804,2028),('2028-04-02',202814,4,2028,2,14,202804,2028),('2028-04-03',202814,4,2028,3,14,202804,2028),('2028-04-04',202814,4,2028,4,14,202804,2028),('2028-04-05',202814,4,2028,5,14,202804,2028),('2028-04-06',202814,4,2028,6,14,202804,2028),('2028-04-07',202814,4,2028,7,14,202804,2028),('2028-04-08',202814,4,2028,8,14,202804,2028),('2028-04-09',202815,4,2028,9,15,202804,2028),('2028-04-10',202815,4,2028,10,15,202804,2028),('2028-04-11',202815,4,2028,11,15,202804,2028),('2028-04-12',202815,4,2028,12,15,202804,2028),('2028-04-13',202815,4,2028,13,15,202804,2028),('2028-04-14',202815,4,2028,14,15,202804,2028),('2028-04-15',202815,4,2028,15,15,202804,2028),('2028-04-16',202816,4,2028,16,16,202804,2028),('2028-04-17',202816,4,2028,17,16,202804,2028),('2028-04-18',202816,4,2028,18,16,202804,2028),('2028-04-19',202816,4,2028,19,16,202804,2028),('2028-04-20',202816,4,2028,20,16,202804,2028),('2028-04-21',202816,4,2028,21,16,202804,2028),('2028-04-22',202816,4,2028,22,16,202804,2028),('2028-04-23',202817,4,2028,23,17,202804,2028),('2028-04-24',202817,4,2028,24,17,202804,2028),('2028-04-25',202817,4,2028,25,17,202804,2028),('2028-04-26',202817,4,2028,26,17,202804,2028),('2028-04-27',202817,4,2028,27,17,202804,2028),('2028-04-28',202817,4,2028,28,17,202804,2028),('2028-04-29',202817,4,2028,29,17,202804,2028),('2028-04-30',202818,4,2028,30,18,202804,2028),('2028-05-01',202818,5,2028,1,18,202805,2028),('2028-05-02',202818,5,2028,2,18,202805,2028),('2028-05-03',202818,5,2028,3,18,202805,2028),('2028-05-04',202818,5,2028,4,18,202805,2028),('2028-05-05',202818,5,2028,5,18,202805,2028),('2028-05-06',202818,5,2028,6,18,202805,2028),('2028-05-07',202819,5,2028,7,19,202805,2028),('2028-05-08',202819,5,2028,8,19,202805,2028),('2028-05-09',202819,5,2028,9,19,202805,2028),('2028-05-10',202819,5,2028,10,19,202805,2028),('2028-05-11',202819,5,2028,11,19,202805,2028),('2028-05-12',202819,5,2028,12,19,202805,2028),('2028-05-13',202819,5,2028,13,19,202805,2028),('2028-05-14',202820,5,2028,14,20,202805,2028),('2028-05-15',202820,5,2028,15,20,202805,2028),('2028-05-16',202820,5,2028,16,20,202805,2028),('2028-05-17',202820,5,2028,17,20,202805,2028),('2028-05-18',202820,5,2028,18,20,202805,2028),('2028-05-19',202820,5,2028,19,20,202805,2028),('2028-05-20',202820,5,2028,20,20,202805,2028),('2028-05-21',202821,5,2028,21,21,202805,2028),('2028-05-22',202821,5,2028,22,21,202805,2028),('2028-05-23',202821,5,2028,23,21,202805,2028),('2028-05-24',202821,5,2028,24,21,202805,2028),('2028-05-25',202821,5,2028,25,21,202805,2028),('2028-05-26',202821,5,2028,26,21,202805,2028),('2028-05-27',202821,5,2028,27,21,202805,2028),('2028-05-28',202822,5,2028,28,22,202805,2028),('2028-05-29',202822,5,2028,29,22,202805,2028),('2028-05-30',202822,5,2028,30,22,202805,2028),('2028-05-31',202822,5,2028,31,22,202805,2028),('2028-06-01',202822,6,2028,1,22,202806,2028),('2028-06-02',202822,6,2028,2,22,202806,2028),('2028-06-03',202822,6,2028,3,22,202806,2028),('2028-06-04',202823,6,2028,4,23,202806,2028),('2028-06-05',202823,6,2028,5,23,202806,2028),('2028-06-06',202823,6,2028,6,23,202806,2028),('2028-06-07',202823,6,2028,7,23,202806,2028),('2028-06-08',202823,6,2028,8,23,202806,2028),('2028-06-09',202823,6,2028,9,23,202806,2028),('2028-06-10',202823,6,2028,10,23,202806,2028),('2028-06-11',202824,6,2028,11,24,202806,2028),('2028-06-12',202824,6,2028,12,24,202806,2028),('2028-06-13',202824,6,2028,13,24,202806,2028),('2028-06-14',202824,6,2028,14,24,202806,2028),('2028-06-15',202824,6,2028,15,24,202806,2028),('2028-06-16',202824,6,2028,16,24,202806,2028),('2028-06-17',202824,6,2028,17,24,202806,2028),('2028-06-18',202825,6,2028,18,25,202806,2028),('2028-06-19',202825,6,2028,19,25,202806,2028),('2028-06-20',202825,6,2028,20,25,202806,2028),('2028-06-21',202825,6,2028,21,25,202806,2028),('2028-06-22',202825,6,2028,22,25,202806,2028),('2028-06-23',202825,6,2028,23,25,202806,2028),('2028-06-24',202825,6,2028,24,25,202806,2028),('2028-06-25',202826,6,2028,25,26,202806,2028),('2028-06-26',202826,6,2028,26,26,202806,2028),('2028-06-27',202826,6,2028,27,26,202806,2028),('2028-06-28',202826,6,2028,28,26,202806,2028),('2028-06-29',202826,6,2028,29,26,202806,2028),('2028-06-30',202826,6,2028,30,26,202806,2028),('2028-07-01',202826,7,2028,1,26,202807,2028),('2028-07-02',202827,7,2028,2,27,202807,2028),('2028-07-03',202827,7,2028,3,27,202807,2028),('2028-07-04',202827,7,2028,4,27,202807,2028),('2028-07-05',202827,7,2028,5,27,202807,2028),('2028-07-06',202827,7,2028,6,27,202807,2028),('2028-07-07',202827,7,2028,7,27,202807,2028),('2028-07-08',202827,7,2028,8,27,202807,2028),('2028-07-09',202828,7,2028,9,28,202807,2028),('2028-07-10',202828,7,2028,10,28,202807,2028),('2028-07-11',202828,7,2028,11,28,202807,2028),('2028-07-12',202828,7,2028,12,28,202807,2028),('2028-07-13',202828,7,2028,13,28,202807,2028),('2028-07-14',202828,7,2028,14,28,202807,2028),('2028-07-15',202828,7,2028,15,28,202807,2028),('2028-07-16',202829,7,2028,16,29,202807,2028),('2028-07-17',202829,7,2028,17,29,202807,2028),('2028-07-18',202829,7,2028,18,29,202807,2028),('2028-07-19',202829,7,2028,19,29,202807,2028),('2028-07-20',202829,7,2028,20,29,202807,2028),('2028-07-21',202829,7,2028,21,29,202807,2028),('2028-07-22',202829,7,2028,22,29,202807,2028),('2028-07-23',202830,7,2028,23,30,202807,2028),('2028-07-24',202830,7,2028,24,30,202807,2028),('2028-07-25',202830,7,2028,25,30,202807,2028),('2028-07-26',202830,7,2028,26,30,202807,2028),('2028-07-27',202830,7,2028,27,30,202807,2028),('2028-07-28',202830,7,2028,28,30,202807,2028),('2028-07-29',202830,7,2028,29,30,202807,2028),('2028-07-30',202831,7,2028,30,31,202807,2028),('2028-07-31',202831,7,2028,31,31,202807,2028),('2028-08-01',202831,8,2028,1,31,202808,2028),('2028-08-02',202831,8,2028,2,31,202808,2028),('2028-08-03',202831,8,2028,3,31,202808,2028),('2028-08-04',202831,8,2028,4,31,202808,2028),('2028-08-05',202831,8,2028,5,31,202808,2028),('2028-08-06',202832,8,2028,6,32,202808,2028),('2028-08-07',202832,8,2028,7,32,202808,2028),('2028-08-08',202832,8,2028,8,32,202808,2028),('2028-08-09',202832,8,2028,9,32,202808,2028),('2028-08-10',202832,8,2028,10,32,202808,2028),('2028-08-11',202832,8,2028,11,32,202808,2028),('2028-08-12',202832,8,2028,12,32,202808,2028),('2028-08-13',202833,8,2028,13,33,202808,2028),('2028-08-14',202833,8,2028,14,33,202808,2028),('2028-08-15',202833,8,2028,15,33,202808,2028),('2028-08-16',202833,8,2028,16,33,202808,2028),('2028-08-17',202833,8,2028,17,33,202808,2028),('2028-08-18',202833,8,2028,18,33,202808,2028),('2028-08-19',202833,8,2028,19,33,202808,2028),('2028-08-20',202834,8,2028,20,34,202808,2028),('2028-08-21',202834,8,2028,21,34,202808,2028),('2028-08-22',202834,8,2028,22,34,202808,2028),('2028-08-23',202834,8,2028,23,34,202808,2028),('2028-08-24',202834,8,2028,24,34,202808,2028),('2028-08-25',202834,8,2028,25,34,202808,2028),('2028-08-26',202834,8,2028,26,34,202808,2028),('2028-08-27',202835,8,2028,27,35,202808,2028),('2028-08-28',202835,8,2028,28,35,202808,2028),('2028-08-29',202835,8,2028,29,35,202808,2028),('2028-08-30',202835,8,2028,30,35,202808,2028),('2028-08-31',202835,8,2028,31,35,202808,2028),('2028-09-01',202835,9,2028,1,35,202809,2028),('2028-09-02',202835,9,2028,2,35,202809,2028),('2028-09-03',202836,9,2028,3,36,202809,2028),('2028-09-04',202836,9,2028,4,36,202809,2028),('2028-09-05',202836,9,2028,5,36,202809,2028),('2028-09-06',202836,9,2028,6,36,202809,2028),('2028-09-07',202836,9,2028,7,36,202809,2028),('2028-09-08',202836,9,2028,8,36,202809,2028),('2028-09-09',202836,9,2028,9,36,202809,2028),('2028-09-10',202837,9,2028,10,37,202809,2028),('2028-09-11',202837,9,2028,11,37,202809,2028),('2028-09-12',202837,9,2028,12,37,202809,2028),('2028-09-13',202837,9,2028,13,37,202809,2028),('2028-09-14',202837,9,2028,14,37,202809,2028),('2028-09-15',202837,9,2028,15,37,202809,2028),('2028-09-16',202837,9,2028,16,37,202809,2028),('2028-09-17',202838,9,2028,17,38,202809,2028),('2028-09-18',202838,9,2028,18,38,202809,2028),('2028-09-19',202838,9,2028,19,38,202809,2028),('2028-09-20',202838,9,2028,20,38,202809,2028),('2028-09-21',202838,9,2028,21,38,202809,2028),('2028-09-22',202838,9,2028,22,38,202809,2028),('2028-09-23',202838,9,2028,23,38,202809,2028),('2028-09-24',202839,9,2028,24,39,202809,2028),('2028-09-25',202839,9,2028,25,39,202809,2028),('2028-09-26',202839,9,2028,26,39,202809,2028),('2028-09-27',202839,9,2028,27,39,202809,2028),('2028-09-28',202839,9,2028,28,39,202809,2028),('2028-09-29',202839,9,2028,29,39,202809,2028),('2028-09-30',202839,9,2028,30,39,202809,2028),('2028-10-01',202840,10,2028,1,40,202810,2028),('2028-10-02',202840,10,2028,2,40,202810,2028),('2028-10-03',202840,10,2028,3,40,202810,2028),('2028-10-04',202840,10,2028,4,40,202810,2028),('2028-10-05',202840,10,2028,5,40,202810,2028),('2028-10-06',202840,10,2028,6,40,202810,2028),('2028-10-07',202840,10,2028,7,40,202810,2028),('2028-10-08',202841,10,2028,8,41,202810,2028),('2028-10-09',202841,10,2028,9,41,202810,2028),('2028-10-10',202841,10,2028,10,41,202810,2028),('2028-10-11',202841,10,2028,11,41,202810,2028),('2028-10-12',202841,10,2028,12,41,202810,2028),('2028-10-13',202841,10,2028,13,41,202810,2028),('2028-10-14',202841,10,2028,14,41,202810,2028),('2028-10-15',202842,10,2028,15,42,202810,2028),('2028-10-16',202842,10,2028,16,42,202810,2028),('2028-10-17',202842,10,2028,17,42,202810,2028),('2028-10-18',202842,10,2028,18,42,202810,2028),('2028-10-19',202842,10,2028,19,42,202810,2028),('2028-10-20',202842,10,2028,20,42,202810,2028),('2028-10-21',202842,10,2028,21,42,202810,2028),('2028-10-22',202843,10,2028,22,43,202810,2028),('2028-10-23',202843,10,2028,23,43,202810,2028),('2028-10-24',202843,10,2028,24,43,202810,2028),('2028-10-25',202843,10,2028,25,43,202810,2028),('2028-10-26',202843,10,2028,26,43,202810,2028),('2028-10-27',202843,10,2028,27,43,202810,2028),('2028-10-28',202843,10,2028,28,43,202810,2028),('2028-10-29',202844,10,2028,29,44,202810,2028),('2028-10-30',202844,10,2028,30,44,202810,2028),('2028-10-31',202844,10,2028,31,44,202810,2028),('2028-11-01',202844,11,2028,1,44,202811,2028),('2028-11-02',202844,11,2028,2,44,202811,2028),('2028-11-03',202844,11,2028,3,44,202811,2028),('2028-11-04',202844,11,2028,4,44,202811,2028),('2028-11-05',202845,11,2028,5,45,202811,2028),('2028-11-06',202845,11,2028,6,45,202811,2028),('2028-11-07',202845,11,2028,7,45,202811,2028),('2028-11-08',202845,11,2028,8,45,202811,2028),('2028-11-09',202845,11,2028,9,45,202811,2028),('2028-11-10',202845,11,2028,10,45,202811,2028),('2028-11-11',202845,11,2028,11,45,202811,2028),('2028-11-12',202846,11,2028,12,46,202811,2028),('2028-11-13',202846,11,2028,13,46,202811,2028),('2028-11-14',202846,11,2028,14,46,202811,2028),('2028-11-15',202846,11,2028,15,46,202811,2028),('2028-11-16',202846,11,2028,16,46,202811,2028),('2028-11-17',202846,11,2028,17,46,202811,2028),('2028-11-18',202846,11,2028,18,46,202811,2028),('2028-11-19',202847,11,2028,19,47,202811,2028),('2028-11-20',202847,11,2028,20,47,202811,2028),('2028-11-21',202847,11,2028,21,47,202811,2028),('2028-11-22',202847,11,2028,22,47,202811,2028),('2028-11-23',202847,11,2028,23,47,202811,2028),('2028-11-24',202847,11,2028,24,47,202811,2028),('2028-11-25',202847,11,2028,25,47,202811,2028),('2028-11-26',202848,11,2028,26,48,202811,2028),('2028-11-27',202848,11,2028,27,48,202811,2028),('2028-11-28',202848,11,2028,28,48,202811,2028),('2028-11-29',202848,11,2028,29,48,202811,2028),('2028-11-30',202848,11,2028,30,48,202811,2028),('2028-12-01',202848,12,2028,1,48,202812,2029),('2028-12-02',202848,12,2028,2,48,202812,2029),('2028-12-03',202849,12,2028,3,49,202812,2029),('2028-12-04',202849,12,2028,4,49,202812,2029),('2028-12-05',202849,12,2028,5,49,202812,2029),('2028-12-06',202849,12,2028,6,49,202812,2029),('2028-12-07',202849,12,2028,7,49,202812,2029),('2028-12-08',202849,12,2028,8,49,202812,2029),('2028-12-09',202849,12,2028,9,49,202812,2029),('2028-12-10',202850,12,2028,10,50,202812,2029),('2028-12-11',202850,12,2028,11,50,202812,2029),('2028-12-12',202850,12,2028,12,50,202812,2029),('2028-12-13',202850,12,2028,13,50,202812,2029),('2028-12-14',202850,12,2028,14,50,202812,2029),('2028-12-15',202850,12,2028,15,50,202812,2029),('2028-12-16',202850,12,2028,16,50,202812,2029),('2028-12-17',202851,12,2028,17,51,202812,2029),('2028-12-18',202851,12,2028,18,51,202812,2029),('2028-12-19',202851,12,2028,19,51,202812,2029),('2028-12-20',202851,12,2028,20,51,202812,2029),('2028-12-21',202851,12,2028,21,51,202812,2029),('2028-12-22',202851,12,2028,22,51,202812,2029),('2028-12-23',202851,12,2028,23,51,202812,2029),('2028-12-24',202852,12,2028,24,52,202812,2029),('2028-12-25',202852,12,2028,25,52,202812,2029),('2028-12-26',202852,12,2028,26,52,202812,2029),('2028-12-27',202852,12,2028,27,52,202812,2029),('2028-12-28',202852,12,2028,28,52,202812,2029),('2028-12-29',202852,12,2028,29,52,202812,2029),('2028-12-30',202852,12,2028,30,52,202812,2029),('2028-12-31',202853,12,2028,31,1,202812,2029),('2029-01-01',202901,1,2029,1,1,202901,2029),('2029-01-02',202901,1,2029,2,1,202901,2029),('2029-01-03',202901,1,2029,3,1,202901,2029),('2029-01-04',202901,1,2029,4,1,202901,2029),('2029-01-05',202901,1,2029,5,1,202901,2029),('2029-01-06',202901,1,2029,6,1,202901,2029),('2029-01-07',202902,1,2029,7,2,202901,2029),('2029-01-08',202902,1,2029,8,2,202901,2029),('2029-01-09',202902,1,2029,9,2,202901,2029),('2029-01-10',202902,1,2029,10,2,202901,2029),('2029-01-11',202902,1,2029,11,2,202901,2029),('2029-01-12',202902,1,2029,12,2,202901,2029),('2029-01-13',202902,1,2029,13,2,202901,2029),('2029-01-14',202903,1,2029,14,3,202901,2029),('2029-01-15',202903,1,2029,15,3,202901,2029),('2029-01-16',202903,1,2029,16,3,202901,2029),('2029-01-17',202903,1,2029,17,3,202901,2029),('2029-01-18',202903,1,2029,18,3,202901,2029),('2029-01-19',202903,1,2029,19,3,202901,2029),('2029-01-20',202903,1,2029,20,3,202901,2029),('2029-01-21',202904,1,2029,21,4,202901,2029),('2029-01-22',202904,1,2029,22,4,202901,2029),('2029-01-23',202904,1,2029,23,4,202901,2029),('2029-01-24',202904,1,2029,24,4,202901,2029),('2029-01-25',202904,1,2029,25,4,202901,2029),('2029-01-26',202904,1,2029,26,4,202901,2029),('2029-01-27',202904,1,2029,27,4,202901,2029),('2029-01-28',202905,1,2029,28,5,202901,2029),('2029-01-29',202905,1,2029,29,5,202901,2029),('2029-01-30',202905,1,2029,30,5,202901,2029),('2029-01-31',202905,1,2029,31,5,202901,2029),('2029-02-01',202905,2,2029,1,5,202902,2029),('2029-02-02',202905,2,2029,2,5,202902,2029),('2029-02-03',202905,2,2029,3,5,202902,2029),('2029-02-04',202906,2,2029,4,6,202902,2029),('2029-02-05',202906,2,2029,5,6,202902,2029),('2029-02-06',202906,2,2029,6,6,202902,2029),('2029-02-07',202906,2,2029,7,6,202902,2029),('2029-02-08',202906,2,2029,8,6,202902,2029),('2029-02-09',202906,2,2029,9,6,202902,2029),('2029-02-10',202906,2,2029,10,6,202902,2029),('2029-02-11',202907,2,2029,11,7,202902,2029),('2029-02-12',202907,2,2029,12,7,202902,2029),('2029-02-13',202907,2,2029,13,7,202902,2029),('2029-02-14',202907,2,2029,14,7,202902,2029),('2029-02-15',202907,2,2029,15,7,202902,2029),('2029-02-16',202907,2,2029,16,7,202902,2029),('2029-02-17',202907,2,2029,17,7,202902,2029),('2029-02-18',202908,2,2029,18,8,202902,2029),('2029-02-19',202908,2,2029,19,8,202902,2029),('2029-02-20',202908,2,2029,20,8,202902,2029),('2029-02-21',202908,2,2029,21,8,202902,2029),('2029-02-22',202908,2,2029,22,8,202902,2029),('2029-02-23',202908,2,2029,23,8,202902,2029),('2029-02-24',202908,2,2029,24,8,202902,2029),('2029-02-25',202909,2,2029,25,9,202902,2029),('2029-02-26',202909,2,2029,26,9,202902,2029),('2029-02-27',202909,2,2029,27,9,202902,2029),('2029-02-28',202909,2,2029,28,9,202902,2029),('2029-03-01',202909,3,2029,1,9,202903,2029),('2029-03-02',202909,3,2029,2,9,202903,2029),('2029-03-03',202909,3,2029,3,9,202903,2029),('2029-03-04',202910,3,2029,4,10,202903,2029),('2029-03-05',202910,3,2029,5,10,202903,2029),('2029-03-06',202910,3,2029,6,10,202903,2029),('2029-03-07',202910,3,2029,7,10,202903,2029),('2029-03-08',202910,3,2029,8,10,202903,2029),('2029-03-09',202910,3,2029,9,10,202903,2029),('2029-03-10',202910,3,2029,10,10,202903,2029),('2029-03-11',202911,3,2029,11,11,202903,2029),('2029-03-12',202911,3,2029,12,11,202903,2029),('2029-03-13',202911,3,2029,13,11,202903,2029),('2029-03-14',202911,3,2029,14,11,202903,2029),('2029-03-15',202911,3,2029,15,11,202903,2029),('2029-03-16',202911,3,2029,16,11,202903,2029),('2029-03-17',202911,3,2029,17,11,202903,2029),('2029-03-18',202912,3,2029,18,12,202903,2029),('2029-03-19',202912,3,2029,19,12,202903,2029),('2029-03-20',202912,3,2029,20,12,202903,2029),('2029-03-21',202912,3,2029,21,12,202903,2029),('2029-03-22',202912,3,2029,22,12,202903,2029),('2029-03-23',202912,3,2029,23,12,202903,2029),('2029-03-24',202912,3,2029,24,12,202903,2029),('2029-03-25',202913,3,2029,25,13,202903,2029),('2029-03-26',202913,3,2029,26,13,202903,2029),('2029-03-27',202913,3,2029,27,13,202903,2029),('2029-03-28',202913,3,2029,28,13,202903,2029),('2029-03-29',202913,3,2029,29,13,202903,2029),('2029-03-30',202913,3,2029,30,13,202903,2029),('2029-03-31',202913,3,2029,31,13,202903,2029),('2029-04-01',202914,4,2029,1,14,202904,2029),('2029-04-02',202914,4,2029,2,14,202904,2029),('2029-04-03',202914,4,2029,3,14,202904,2029),('2029-04-04',202914,4,2029,4,14,202904,2029),('2029-04-05',202914,4,2029,5,14,202904,2029),('2029-04-06',202914,4,2029,6,14,202904,2029),('2029-04-07',202914,4,2029,7,14,202904,2029),('2029-04-08',202915,4,2029,8,15,202904,2029),('2029-04-09',202915,4,2029,9,15,202904,2029),('2029-04-10',202915,4,2029,10,15,202904,2029),('2029-04-11',202915,4,2029,11,15,202904,2029),('2029-04-12',202915,4,2029,12,15,202904,2029),('2029-04-13',202915,4,2029,13,15,202904,2029),('2029-04-14',202915,4,2029,14,15,202904,2029),('2029-04-15',202916,4,2029,15,16,202904,2029),('2029-04-16',202916,4,2029,16,16,202904,2029),('2029-04-17',202916,4,2029,17,16,202904,2029),('2029-04-18',202916,4,2029,18,16,202904,2029),('2029-04-19',202916,4,2029,19,16,202904,2029),('2029-04-20',202916,4,2029,20,16,202904,2029),('2029-04-21',202916,4,2029,21,16,202904,2029),('2029-04-22',202917,4,2029,22,17,202904,2029),('2029-04-23',202917,4,2029,23,17,202904,2029),('2029-04-24',202917,4,2029,24,17,202904,2029),('2029-04-25',202917,4,2029,25,17,202904,2029),('2029-04-26',202917,4,2029,26,17,202904,2029),('2029-04-27',202917,4,2029,27,17,202904,2029),('2029-04-28',202917,4,2029,28,17,202904,2029),('2029-04-29',202918,4,2029,29,18,202904,2029),('2029-04-30',202918,4,2029,30,18,202904,2029),('2029-05-01',202918,5,2029,1,18,202905,2029),('2029-05-02',202918,5,2029,2,18,202905,2029),('2029-05-03',202918,5,2029,3,18,202905,2029),('2029-05-04',202918,5,2029,4,18,202905,2029),('2029-05-05',202918,5,2029,5,18,202905,2029),('2029-05-06',202919,5,2029,6,19,202905,2029),('2029-05-07',202919,5,2029,7,19,202905,2029),('2029-05-08',202919,5,2029,8,19,202905,2029),('2029-05-09',202919,5,2029,9,19,202905,2029),('2029-05-10',202919,5,2029,10,19,202905,2029),('2029-05-11',202919,5,2029,11,19,202905,2029),('2029-05-12',202919,5,2029,12,19,202905,2029),('2029-05-13',202920,5,2029,13,20,202905,2029),('2029-05-14',202920,5,2029,14,20,202905,2029),('2029-05-15',202920,5,2029,15,20,202905,2029),('2029-05-16',202920,5,2029,16,20,202905,2029),('2029-05-17',202920,5,2029,17,20,202905,2029),('2029-05-18',202920,5,2029,18,20,202905,2029),('2029-05-19',202920,5,2029,19,20,202905,2029),('2029-05-20',202921,5,2029,20,21,202905,2029),('2029-05-21',202921,5,2029,21,21,202905,2029),('2029-05-22',202921,5,2029,22,21,202905,2029),('2029-05-23',202921,5,2029,23,21,202905,2029),('2029-05-24',202921,5,2029,24,21,202905,2029),('2029-05-25',202921,5,2029,25,21,202905,2029),('2029-05-26',202921,5,2029,26,21,202905,2029),('2029-05-27',202922,5,2029,27,22,202905,2029),('2029-05-28',202922,5,2029,28,22,202905,2029),('2029-05-29',202922,5,2029,29,22,202905,2029),('2029-05-30',202922,5,2029,30,22,202905,2029),('2029-05-31',202922,5,2029,31,22,202905,2029),('2029-06-01',202922,6,2029,1,22,202906,2029),('2029-06-02',202922,6,2029,2,22,202906,2029),('2029-06-03',202923,6,2029,3,23,202906,2029),('2029-06-04',202923,6,2029,4,23,202906,2029),('2029-06-05',202923,6,2029,5,23,202906,2029),('2029-06-06',202923,6,2029,6,23,202906,2029),('2029-06-07',202923,6,2029,7,23,202906,2029),('2029-06-08',202923,6,2029,8,23,202906,2029),('2029-06-09',202923,6,2029,9,23,202906,2029),('2029-06-10',202924,6,2029,10,24,202906,2029),('2029-06-11',202924,6,2029,11,24,202906,2029),('2029-06-12',202924,6,2029,12,24,202906,2029),('2029-06-13',202924,6,2029,13,24,202906,2029),('2029-06-14',202924,6,2029,14,24,202906,2029),('2029-06-15',202924,6,2029,15,24,202906,2029),('2029-06-16',202924,6,2029,16,24,202906,2029),('2029-06-17',202925,6,2029,17,25,202906,2029),('2029-06-18',202925,6,2029,18,25,202906,2029),('2029-06-19',202925,6,2029,19,25,202906,2029),('2029-06-20',202925,6,2029,20,25,202906,2029),('2029-06-21',202925,6,2029,21,25,202906,2029),('2029-06-22',202925,6,2029,22,25,202906,2029),('2029-06-23',202925,6,2029,23,25,202906,2029),('2029-06-24',202926,6,2029,24,26,202906,2029),('2029-06-25',202926,6,2029,25,26,202906,2029),('2029-06-26',202926,6,2029,26,26,202906,2029),('2029-06-27',202926,6,2029,27,26,202906,2029),('2029-06-28',202926,6,2029,28,26,202906,2029),('2029-06-29',202926,6,2029,29,26,202906,2029),('2029-06-30',202926,6,2029,30,26,202906,2029),('2029-07-01',202927,7,2029,1,27,202907,2029),('2029-07-02',202927,7,2029,2,27,202907,2029),('2029-07-03',202927,7,2029,3,27,202907,2029),('2029-07-04',202927,7,2029,4,27,202907,2029),('2029-07-05',202927,7,2029,5,27,202907,2029),('2029-07-06',202927,7,2029,6,27,202907,2029),('2029-07-07',202927,7,2029,7,27,202907,2029),('2029-07-08',202928,7,2029,8,28,202907,2029),('2029-07-09',202928,7,2029,9,28,202907,2029),('2029-07-10',202928,7,2029,10,28,202907,2029),('2029-07-11',202928,7,2029,11,28,202907,2029),('2029-07-12',202928,7,2029,12,28,202907,2029),('2029-07-13',202928,7,2029,13,28,202907,2029),('2029-07-14',202928,7,2029,14,28,202907,2029),('2029-07-15',202929,7,2029,15,29,202907,2029),('2029-07-16',202929,7,2029,16,29,202907,2029),('2029-07-17',202929,7,2029,17,29,202907,2029),('2029-07-18',202929,7,2029,18,29,202907,2029),('2029-07-19',202929,7,2029,19,29,202907,2029),('2029-07-20',202929,7,2029,20,29,202907,2029),('2029-07-21',202929,7,2029,21,29,202907,2029),('2029-07-22',202930,7,2029,22,30,202907,2029),('2029-07-23',202930,7,2029,23,30,202907,2029),('2029-07-24',202930,7,2029,24,30,202907,2029),('2029-07-25',202930,7,2029,25,30,202907,2029),('2029-07-26',202930,7,2029,26,30,202907,2029),('2029-07-27',202930,7,2029,27,30,202907,2029),('2029-07-28',202930,7,2029,28,30,202907,2029),('2029-07-29',202931,7,2029,29,31,202907,2029),('2029-07-30',202931,7,2029,30,31,202907,2029),('2029-07-31',202931,7,2029,31,31,202907,2029),('2029-08-01',202931,8,2029,1,31,202908,2029),('2029-08-02',202931,8,2029,2,31,202908,2029),('2029-08-03',202931,8,2029,3,31,202908,2029),('2029-08-04',202931,8,2029,4,31,202908,2029),('2029-08-05',202932,8,2029,5,32,202908,2029),('2029-08-06',202932,8,2029,6,32,202908,2029),('2029-08-07',202932,8,2029,7,32,202908,2029),('2029-08-08',202932,8,2029,8,32,202908,2029),('2029-08-09',202932,8,2029,9,32,202908,2029),('2029-08-10',202932,8,2029,10,32,202908,2029),('2029-08-11',202932,8,2029,11,32,202908,2029),('2029-08-12',202933,8,2029,12,33,202908,2029),('2029-08-13',202933,8,2029,13,33,202908,2029),('2029-08-14',202933,8,2029,14,33,202908,2029),('2029-08-15',202933,8,2029,15,33,202908,2029),('2029-08-16',202933,8,2029,16,33,202908,2029),('2029-08-17',202933,8,2029,17,33,202908,2029),('2029-08-18',202933,8,2029,18,33,202908,2029),('2029-08-19',202934,8,2029,19,34,202908,2029),('2029-08-20',202934,8,2029,20,34,202908,2029),('2029-08-21',202934,8,2029,21,34,202908,2029),('2029-08-22',202934,8,2029,22,34,202908,2029),('2029-08-23',202934,8,2029,23,34,202908,2029),('2029-08-24',202934,8,2029,24,34,202908,2029),('2029-08-25',202934,8,2029,25,34,202908,2029),('2029-08-26',202935,8,2029,26,35,202908,2029),('2029-08-27',202935,8,2029,27,35,202908,2029),('2029-08-28',202935,8,2029,28,35,202908,2029),('2029-08-29',202935,8,2029,29,35,202908,2029),('2029-08-30',202935,8,2029,30,35,202908,2029),('2029-08-31',202935,8,2029,31,35,202908,2029),('2029-09-01',202935,9,2029,1,35,202909,2029),('2029-09-02',202936,9,2029,2,36,202909,2029),('2029-09-03',202936,9,2029,3,36,202909,2029),('2029-09-04',202936,9,2029,4,36,202909,2029),('2029-09-05',202936,9,2029,5,36,202909,2029),('2029-09-06',202936,9,2029,6,36,202909,2029),('2029-09-07',202936,9,2029,7,36,202909,2029),('2029-09-08',202936,9,2029,8,36,202909,2029),('2029-09-09',202937,9,2029,9,37,202909,2029),('2029-09-10',202937,9,2029,10,37,202909,2029),('2029-09-11',202937,9,2029,11,37,202909,2029),('2029-09-12',202937,9,2029,12,37,202909,2029),('2029-09-13',202937,9,2029,13,37,202909,2029),('2029-09-14',202937,9,2029,14,37,202909,2029),('2029-09-15',202937,9,2029,15,37,202909,2029),('2029-09-16',202938,9,2029,16,38,202909,2029),('2029-09-17',202938,9,2029,17,38,202909,2029),('2029-09-18',202938,9,2029,18,38,202909,2029),('2029-09-19',202938,9,2029,19,38,202909,2029),('2029-09-20',202938,9,2029,20,38,202909,2029),('2029-09-21',202938,9,2029,21,38,202909,2029),('2029-09-22',202938,9,2029,22,38,202909,2029),('2029-09-23',202939,9,2029,23,39,202909,2029),('2029-09-24',202939,9,2029,24,39,202909,2029),('2029-09-25',202939,9,2029,25,39,202909,2029),('2029-09-26',202939,9,2029,26,39,202909,2029),('2029-09-27',202939,9,2029,27,39,202909,2029),('2029-09-28',202939,9,2029,28,39,202909,2029),('2029-09-29',202939,9,2029,29,39,202909,2029),('2029-09-30',202940,9,2029,30,40,202909,2029),('2029-10-01',202940,10,2029,1,40,202910,2029),('2029-10-02',202940,10,2029,2,40,202910,2029),('2029-10-03',202940,10,2029,3,40,202910,2029),('2029-10-04',202940,10,2029,4,40,202910,2029),('2029-10-05',202940,10,2029,5,40,202910,2029),('2029-10-06',202940,10,2029,6,40,202910,2029),('2029-10-07',202941,10,2029,7,41,202910,2029),('2029-10-08',202941,10,2029,8,41,202910,2029),('2029-10-09',202941,10,2029,9,41,202910,2029),('2029-10-10',202941,10,2029,10,41,202910,2029),('2029-10-11',202941,10,2029,11,41,202910,2029),('2029-10-12',202941,10,2029,12,41,202910,2029),('2029-10-13',202941,10,2029,13,41,202910,2029),('2029-10-14',202942,10,2029,14,42,202910,2029),('2029-10-15',202942,10,2029,15,42,202910,2029),('2029-10-16',202942,10,2029,16,42,202910,2029),('2029-10-17',202942,10,2029,17,42,202910,2029),('2029-10-18',202942,10,2029,18,42,202910,2029),('2029-10-19',202942,10,2029,19,42,202910,2029),('2029-10-20',202942,10,2029,20,42,202910,2029),('2029-10-21',202943,10,2029,21,43,202910,2029),('2029-10-22',202943,10,2029,22,43,202910,2029),('2029-10-23',202943,10,2029,23,43,202910,2029),('2029-10-24',202943,10,2029,24,43,202910,2029),('2029-10-25',202943,10,2029,25,43,202910,2029),('2029-10-26',202943,10,2029,26,43,202910,2029),('2029-10-27',202943,10,2029,27,43,202910,2029),('2029-10-28',202944,10,2029,28,44,202910,2029),('2029-10-29',202944,10,2029,29,44,202910,2029),('2029-10-30',202944,10,2029,30,44,202910,2029),('2029-10-31',202944,10,2029,31,44,202910,2029),('2029-11-01',202944,11,2029,1,44,202911,2029),('2029-11-02',202944,11,2029,2,44,202911,2029),('2029-11-03',202944,11,2029,3,44,202911,2029),('2029-11-04',202945,11,2029,4,45,202911,2029),('2029-11-05',202945,11,2029,5,45,202911,2029),('2029-11-06',202945,11,2029,6,45,202911,2029),('2029-11-07',202945,11,2029,7,45,202911,2029),('2029-11-08',202945,11,2029,8,45,202911,2029),('2029-11-09',202945,11,2029,9,45,202911,2029),('2029-11-10',202945,11,2029,10,45,202911,2029),('2029-11-11',202946,11,2029,11,46,202911,2029),('2029-11-12',202946,11,2029,12,46,202911,2029),('2029-11-13',202946,11,2029,13,46,202911,2029),('2029-11-14',202946,11,2029,14,46,202911,2029),('2029-11-15',202946,11,2029,15,46,202911,2029),('2029-11-16',202946,11,2029,16,46,202911,2029),('2029-11-17',202946,11,2029,17,46,202911,2029),('2029-11-18',202947,11,2029,18,47,202911,2029),('2029-11-19',202947,11,2029,19,47,202911,2029),('2029-11-20',202947,11,2029,20,47,202911,2029),('2029-11-21',202947,11,2029,21,47,202911,2029),('2029-11-22',202947,11,2029,22,47,202911,2029),('2029-11-23',202947,11,2029,23,47,202911,2029),('2029-11-24',202947,11,2029,24,47,202911,2029),('2029-11-25',202948,11,2029,25,48,202911,2029),('2029-11-26',202948,11,2029,26,48,202911,2029),('2029-11-27',202948,11,2029,27,48,202911,2029),('2029-11-28',202948,11,2029,28,48,202911,2029),('2029-11-29',202948,11,2029,29,48,202911,2029),('2029-11-30',202948,11,2029,30,48,202911,2029),('2029-12-01',202948,12,2029,1,48,202912,2030),('2029-12-02',202949,12,2029,2,49,202912,2030),('2029-12-03',202949,12,2029,3,49,202912,2030),('2029-12-04',202949,12,2029,4,49,202912,2030),('2029-12-05',202949,12,2029,5,49,202912,2030),('2029-12-06',202949,12,2029,6,49,202912,2030),('2029-12-07',202949,12,2029,7,49,202912,2030),('2029-12-08',202949,12,2029,8,49,202912,2030),('2029-12-09',202950,12,2029,9,50,202912,2030),('2029-12-10',202950,12,2029,10,50,202912,2030),('2029-12-11',202950,12,2029,11,50,202912,2030),('2029-12-12',202950,12,2029,12,50,202912,2030),('2029-12-13',202950,12,2029,13,50,202912,2030),('2029-12-14',202950,12,2029,14,50,202912,2030),('2029-12-15',202950,12,2029,15,50,202912,2030),('2029-12-16',202951,12,2029,16,51,202912,2030),('2029-12-17',202951,12,2029,17,51,202912,2030),('2029-12-18',202951,12,2029,18,51,202912,2030),('2029-12-19',202951,12,2029,19,51,202912,2030),('2029-12-20',202951,12,2029,20,51,202912,2030),('2029-12-21',202951,12,2029,21,51,202912,2030),('2029-12-22',202951,12,2029,22,51,202912,2030),('2029-12-23',202952,12,2029,23,52,202912,2030),('2029-12-24',202952,12,2029,24,52,202912,2030),('2029-12-25',202952,12,2029,25,52,202912,2030),('2029-12-26',202952,12,2029,26,52,202912,2030),('2029-12-27',202952,12,2029,27,52,202912,2030),('2029-12-28',202952,12,2029,28,52,202912,2030),('2029-12-29',202952,12,2029,29,52,202912,2030),('2029-12-30',202953,12,2029,30,1,202912,2030),('2029-12-31',202901,12,2029,31,1,202912,2030),('2030-01-01',203001,1,2030,1,1,203001,2030),('2030-01-02',203001,1,2030,2,1,203001,2030),('2030-01-03',203001,1,2030,3,1,203001,2030),('2030-01-04',203001,1,2030,4,1,203001,2030),('2030-01-05',203001,1,2030,5,1,203001,2030),('2030-01-06',203002,1,2030,6,2,203001,2030),('2030-01-07',203002,1,2030,7,2,203001,2030),('2030-01-08',203002,1,2030,8,2,203001,2030),('2030-01-09',203002,1,2030,9,2,203001,2030),('2030-01-10',203002,1,2030,10,2,203001,2030),('2030-01-11',203002,1,2030,11,2,203001,2030),('2030-01-12',203002,1,2030,12,2,203001,2030),('2030-01-13',203003,1,2030,13,3,203001,2030),('2030-01-14',203003,1,2030,14,3,203001,2030),('2030-01-15',203003,1,2030,15,3,203001,2030),('2030-01-16',203003,1,2030,16,3,203001,2030),('2030-01-17',203003,1,2030,17,3,203001,2030),('2030-01-18',203003,1,2030,18,3,203001,2030),('2030-01-19',203003,1,2030,19,3,203001,2030),('2030-01-20',203004,1,2030,20,4,203001,2030),('2030-01-21',203004,1,2030,21,4,203001,2030),('2030-01-22',203004,1,2030,22,4,203001,2030),('2030-01-23',203004,1,2030,23,4,203001,2030),('2030-01-24',203004,1,2030,24,4,203001,2030),('2030-01-25',203004,1,2030,25,4,203001,2030),('2030-01-26',203004,1,2030,26,4,203001,2030),('2030-01-27',203005,1,2030,27,5,203001,2030),('2030-01-28',203005,1,2030,28,5,203001,2030),('2030-01-29',203005,1,2030,29,5,203001,2030),('2030-01-30',203005,1,2030,30,5,203001,2030),('2030-01-31',203005,1,2030,31,5,203001,2030),('2030-02-01',203005,2,2030,1,5,203002,2030),('2030-02-02',203005,2,2030,2,5,203002,2030),('2030-02-03',203006,2,2030,3,6,203002,2030),('2030-02-04',203006,2,2030,4,6,203002,2030),('2030-02-05',203006,2,2030,5,6,203002,2030),('2030-02-06',203006,2,2030,6,6,203002,2030),('2030-02-07',203006,2,2030,7,6,203002,2030),('2030-02-08',203006,2,2030,8,6,203002,2030),('2030-02-09',203006,2,2030,9,6,203002,2030),('2030-02-10',203007,2,2030,10,7,203002,2030),('2030-02-11',203007,2,2030,11,7,203002,2030),('2030-02-12',203007,2,2030,12,7,203002,2030),('2030-02-13',203007,2,2030,13,7,203002,2030),('2030-02-14',203007,2,2030,14,7,203002,2030),('2030-02-15',203007,2,2030,15,7,203002,2030),('2030-02-16',203007,2,2030,16,7,203002,2030),('2030-02-17',203008,2,2030,17,8,203002,2030),('2030-02-18',203008,2,2030,18,8,203002,2030),('2030-02-19',203008,2,2030,19,8,203002,2030),('2030-02-20',203008,2,2030,20,8,203002,2030),('2030-02-21',203008,2,2030,21,8,203002,2030),('2030-02-22',203008,2,2030,22,8,203002,2030),('2030-02-23',203008,2,2030,23,8,203002,2030),('2030-02-24',203009,2,2030,24,9,203002,2030),('2030-02-25',203009,2,2030,25,9,203002,2030),('2030-02-26',203009,2,2030,26,9,203002,2030),('2030-02-27',203009,2,2030,27,9,203002,2030),('2030-02-28',203009,2,2030,28,9,203002,2030),('2030-03-01',203009,3,2030,1,9,203003,2030),('2030-03-02',203009,3,2030,2,9,203003,2030),('2030-03-03',203010,3,2030,3,10,203003,2030),('2030-03-04',203010,3,2030,4,10,203003,2030),('2030-03-05',203010,3,2030,5,10,203003,2030),('2030-03-06',203010,3,2030,6,10,203003,2030),('2030-03-07',203010,3,2030,7,10,203003,2030),('2030-03-08',203010,3,2030,8,10,203003,2030),('2030-03-09',203010,3,2030,9,10,203003,2030),('2030-03-10',203011,3,2030,10,11,203003,2030),('2030-03-11',203011,3,2030,11,11,203003,2030),('2030-03-12',203011,3,2030,12,11,203003,2030),('2030-03-13',203011,3,2030,13,11,203003,2030),('2030-03-14',203011,3,2030,14,11,203003,2030),('2030-03-15',203011,3,2030,15,11,203003,2030),('2030-03-16',203011,3,2030,16,11,203003,2030),('2030-03-17',203012,3,2030,17,12,203003,2030),('2030-03-18',203012,3,2030,18,12,203003,2030),('2030-03-19',203012,3,2030,19,12,203003,2030),('2030-03-20',203012,3,2030,20,12,203003,2030),('2030-03-21',203012,3,2030,21,12,203003,2030),('2030-03-22',203012,3,2030,22,12,203003,2030),('2030-03-23',203012,3,2030,23,12,203003,2030),('2030-03-24',203013,3,2030,24,13,203003,2030),('2030-03-25',203013,3,2030,25,13,203003,2030),('2030-03-26',203013,3,2030,26,13,203003,2030),('2030-03-27',203013,3,2030,27,13,203003,2030),('2030-03-28',203013,3,2030,28,13,203003,2030),('2030-03-29',203013,3,2030,29,13,203003,2030),('2030-03-30',203013,3,2030,30,13,203003,2030),('2030-03-31',203014,3,2030,31,14,203003,2030),('2030-04-01',203014,4,2030,1,14,203004,2030),('2030-04-02',203014,4,2030,2,14,203004,2030),('2030-04-03',203014,4,2030,3,14,203004,2030),('2030-04-04',203014,4,2030,4,14,203004,2030),('2030-04-05',203014,4,2030,5,14,203004,2030),('2030-04-06',203014,4,2030,6,14,203004,2030),('2030-04-07',203015,4,2030,7,15,203004,2030),('2030-04-08',203015,4,2030,8,15,203004,2030),('2030-04-09',203015,4,2030,9,15,203004,2030),('2030-04-10',203015,4,2030,10,15,203004,2030),('2030-04-11',203015,4,2030,11,15,203004,2030),('2030-04-12',203015,4,2030,12,15,203004,2030),('2030-04-13',203015,4,2030,13,15,203004,2030),('2030-04-14',203016,4,2030,14,16,203004,2030),('2030-04-15',203016,4,2030,15,16,203004,2030),('2030-04-16',203016,4,2030,16,16,203004,2030),('2030-04-17',203016,4,2030,17,16,203004,2030),('2030-04-18',203016,4,2030,18,16,203004,2030),('2030-04-19',203016,4,2030,19,16,203004,2030),('2030-04-20',203016,4,2030,20,16,203004,2030),('2030-04-21',203017,4,2030,21,17,203004,2030),('2030-04-22',203017,4,2030,22,17,203004,2030),('2030-04-23',203017,4,2030,23,17,203004,2030),('2030-04-24',203017,4,2030,24,17,203004,2030),('2030-04-25',203017,4,2030,25,17,203004,2030),('2030-04-26',203017,4,2030,26,17,203004,2030),('2030-04-27',203017,4,2030,27,17,203004,2030),('2030-04-28',203018,4,2030,28,18,203004,2030),('2030-04-29',203018,4,2030,29,18,203004,2030),('2030-04-30',203018,4,2030,30,18,203004,2030),('2030-05-01',203018,5,2030,1,18,203005,2030),('2030-05-02',203018,5,2030,2,18,203005,2030),('2030-05-03',203018,5,2030,3,18,203005,2030),('2030-05-04',203018,5,2030,4,18,203005,2030),('2030-05-05',203019,5,2030,5,19,203005,2030),('2030-05-06',203019,5,2030,6,19,203005,2030),('2030-05-07',203019,5,2030,7,19,203005,2030),('2030-05-08',203019,5,2030,8,19,203005,2030),('2030-05-09',203019,5,2030,9,19,203005,2030),('2030-05-10',203019,5,2030,10,19,203005,2030),('2030-05-11',203019,5,2030,11,19,203005,2030),('2030-05-12',203020,5,2030,12,20,203005,2030),('2030-05-13',203020,5,2030,13,20,203005,2030),('2030-05-14',203020,5,2030,14,20,203005,2030),('2030-05-15',203020,5,2030,15,20,203005,2030),('2030-05-16',203020,5,2030,16,20,203005,2030),('2030-05-17',203020,5,2030,17,20,203005,2030),('2030-05-18',203020,5,2030,18,20,203005,2030),('2030-05-19',203021,5,2030,19,21,203005,2030),('2030-05-20',203021,5,2030,20,21,203005,2030),('2030-05-21',203021,5,2030,21,21,203005,2030),('2030-05-22',203021,5,2030,22,21,203005,2030),('2030-05-23',203021,5,2030,23,21,203005,2030),('2030-05-24',203021,5,2030,24,21,203005,2030),('2030-05-25',203021,5,2030,25,21,203005,2030),('2030-05-26',203022,5,2030,26,22,203005,2030),('2030-05-27',203022,5,2030,27,22,203005,2030),('2030-05-28',203022,5,2030,28,22,203005,2030),('2030-05-29',203022,5,2030,29,22,203005,2030),('2030-05-30',203022,5,2030,30,22,203005,2030),('2030-05-31',203022,5,2030,31,22,203005,2030),('2030-06-01',203022,6,2030,1,22,203006,2030),('2030-06-02',203023,6,2030,2,23,203006,2030),('2030-06-03',203023,6,2030,3,23,203006,2030),('2030-06-04',203023,6,2030,4,23,203006,2030),('2030-06-05',203023,6,2030,5,23,203006,2030),('2030-06-06',203023,6,2030,6,23,203006,2030),('2030-06-07',203023,6,2030,7,23,203006,2030),('2030-06-08',203023,6,2030,8,23,203006,2030),('2030-06-09',203024,6,2030,9,24,203006,2030),('2030-06-10',203024,6,2030,10,24,203006,2030),('2030-06-11',203024,6,2030,11,24,203006,2030),('2030-06-12',203024,6,2030,12,24,203006,2030),('2030-06-13',203024,6,2030,13,24,203006,2030),('2030-06-14',203024,6,2030,14,24,203006,2030),('2030-06-15',203024,6,2030,15,24,203006,2030),('2030-06-16',203025,6,2030,16,25,203006,2030),('2030-06-17',203025,6,2030,17,25,203006,2030),('2030-06-18',203025,6,2030,18,25,203006,2030),('2030-06-19',203025,6,2030,19,25,203006,2030),('2030-06-20',203025,6,2030,20,25,203006,2030),('2030-06-21',203025,6,2030,21,25,203006,2030),('2030-06-22',203025,6,2030,22,25,203006,2030),('2030-06-23',203026,6,2030,23,26,203006,2030),('2030-06-24',203026,6,2030,24,26,203006,2030),('2030-06-25',203026,6,2030,25,26,203006,2030),('2030-06-26',203026,6,2030,26,26,203006,2030),('2030-06-27',203026,6,2030,27,26,203006,2030),('2030-06-28',203026,6,2030,28,26,203006,2030),('2030-06-29',203026,6,2030,29,26,203006,2030),('2030-06-30',203027,6,2030,30,27,203006,2030),('2030-07-01',203027,7,2030,1,27,203007,2030),('2030-07-02',203027,7,2030,2,27,203007,2030),('2030-07-03',203027,7,2030,3,27,203007,2030),('2030-07-04',203027,7,2030,4,27,203007,2030),('2030-07-05',203027,7,2030,5,27,203007,2030),('2030-07-06',203027,7,2030,6,27,203007,2030),('2030-07-07',203028,7,2030,7,28,203007,2030),('2030-07-08',203028,7,2030,8,28,203007,2030),('2030-07-09',203028,7,2030,9,28,203007,2030),('2030-07-10',203028,7,2030,10,28,203007,2030),('2030-07-11',203028,7,2030,11,28,203007,2030),('2030-07-12',203028,7,2030,12,28,203007,2030),('2030-07-13',203028,7,2030,13,28,203007,2030),('2030-07-14',203029,7,2030,14,29,203007,2030),('2030-07-15',203029,7,2030,15,29,203007,2030),('2030-07-16',203029,7,2030,16,29,203007,2030),('2030-07-17',203029,7,2030,17,29,203007,2030),('2030-07-18',203029,7,2030,18,29,203007,2030),('2030-07-19',203029,7,2030,19,29,203007,2030),('2030-07-20',203029,7,2030,20,29,203007,2030),('2030-07-21',203030,7,2030,21,30,203007,2030),('2030-07-22',203030,7,2030,22,30,203007,2030),('2030-07-23',203030,7,2030,23,30,203007,2030),('2030-07-24',203030,7,2030,24,30,203007,2030),('2030-07-25',203030,7,2030,25,30,203007,2030),('2030-07-26',203030,7,2030,26,30,203007,2030),('2030-07-27',203030,7,2030,27,30,203007,2030),('2030-07-28',203031,7,2030,28,31,203007,2030),('2030-07-29',203031,7,2030,29,31,203007,2030),('2030-07-30',203031,7,2030,30,31,203007,2030),('2030-07-31',203031,7,2030,31,31,203007,2030),('2030-08-01',203031,8,2030,1,31,203008,2030),('2030-08-02',203031,8,2030,2,31,203008,2030),('2030-08-03',203031,8,2030,3,31,203008,2030),('2030-08-04',203032,8,2030,4,32,203008,2030),('2030-08-05',203032,8,2030,5,32,203008,2030),('2030-08-06',203032,8,2030,6,32,203008,2030),('2030-08-07',203032,8,2030,7,32,203008,2030),('2030-08-08',203032,8,2030,8,32,203008,2030),('2030-08-09',203032,8,2030,9,32,203008,2030),('2030-08-10',203032,8,2030,10,32,203008,2030),('2030-08-11',203033,8,2030,11,33,203008,2030),('2030-08-12',203033,8,2030,12,33,203008,2030),('2030-08-13',203033,8,2030,13,33,203008,2030),('2030-08-14',203033,8,2030,14,33,203008,2030),('2030-08-15',203033,8,2030,15,33,203008,2030),('2030-08-16',203033,8,2030,16,33,203008,2030),('2030-08-17',203033,8,2030,17,33,203008,2030),('2030-08-18',203034,8,2030,18,34,203008,2030),('2030-08-19',203034,8,2030,19,34,203008,2030),('2030-08-20',203034,8,2030,20,34,203008,2030),('2030-08-21',203034,8,2030,21,34,203008,2030),('2030-08-22',203034,8,2030,22,34,203008,2030),('2030-08-23',203034,8,2030,23,34,203008,2030),('2030-08-24',203034,8,2030,24,34,203008,2030),('2030-08-25',203035,8,2030,25,35,203008,2030),('2030-08-26',203035,8,2030,26,35,203008,2030),('2030-08-27',203035,8,2030,27,35,203008,2030),('2030-08-28',203035,8,2030,28,35,203008,2030),('2030-08-29',203035,8,2030,29,35,203008,2030),('2030-08-30',203035,8,2030,30,35,203008,2030),('2030-08-31',203035,8,2030,31,35,203008,2030),('2030-09-01',203036,9,2030,1,36,203009,2030),('2030-09-02',203036,9,2030,2,36,203009,2030),('2030-09-03',203036,9,2030,3,36,203009,2030),('2030-09-04',203036,9,2030,4,36,203009,2030),('2030-09-05',203036,9,2030,5,36,203009,2030),('2030-09-06',203036,9,2030,6,36,203009,2030),('2030-09-07',203036,9,2030,7,36,203009,2030),('2030-09-08',203037,9,2030,8,37,203009,2030),('2030-09-09',203037,9,2030,9,37,203009,2030),('2030-09-10',203037,9,2030,10,37,203009,2030),('2030-09-11',203037,9,2030,11,37,203009,2030),('2030-09-12',203037,9,2030,12,37,203009,2030),('2030-09-13',203037,9,2030,13,37,203009,2030),('2030-09-14',203037,9,2030,14,37,203009,2030),('2030-09-15',203038,9,2030,15,38,203009,2030),('2030-09-16',203038,9,2030,16,38,203009,2030),('2030-09-17',203038,9,2030,17,38,203009,2030),('2030-09-18',203038,9,2030,18,38,203009,2030),('2030-09-19',203038,9,2030,19,38,203009,2030),('2030-09-20',203038,9,2030,20,38,203009,2030),('2030-09-21',203038,9,2030,21,38,203009,2030),('2030-09-22',203039,9,2030,22,39,203009,2030),('2030-09-23',203039,9,2030,23,39,203009,2030),('2030-09-24',203039,9,2030,24,39,203009,2030),('2030-09-25',203039,9,2030,25,39,203009,2030),('2030-09-26',203039,9,2030,26,39,203009,2030),('2030-09-27',203039,9,2030,27,39,203009,2030),('2030-09-28',203039,9,2030,28,39,203009,2030),('2030-09-29',203040,9,2030,29,40,203009,2030),('2030-09-30',203040,9,2030,30,40,203009,2030),('2030-10-01',203040,10,2030,1,40,203010,2030),('2030-10-02',203040,10,2030,2,40,203010,2030),('2030-10-03',203040,10,2030,3,40,203010,2030),('2030-10-04',203040,10,2030,4,40,203010,2030),('2030-10-05',203040,10,2030,5,40,203010,2030),('2030-10-06',203041,10,2030,6,41,203010,2030),('2030-10-07',203041,10,2030,7,41,203010,2030),('2030-10-08',203041,10,2030,8,41,203010,2030),('2030-10-09',203041,10,2030,9,41,203010,2030),('2030-10-10',203041,10,2030,10,41,203010,2030),('2030-10-11',203041,10,2030,11,41,203010,2030),('2030-10-12',203041,10,2030,12,41,203010,2030),('2030-10-13',203042,10,2030,13,42,203010,2030),('2030-10-14',203042,10,2030,14,42,203010,2030),('2030-10-15',203042,10,2030,15,42,203010,2030),('2030-10-16',203042,10,2030,16,42,203010,2030),('2030-10-17',203042,10,2030,17,42,203010,2030),('2030-10-18',203042,10,2030,18,42,203010,2030),('2030-10-19',203042,10,2030,19,42,203010,2030),('2030-10-20',203043,10,2030,20,43,203010,2030),('2030-10-21',203043,10,2030,21,43,203010,2030),('2030-10-22',203043,10,2030,22,43,203010,2030),('2030-10-23',203043,10,2030,23,43,203010,2030),('2030-10-24',203043,10,2030,24,43,203010,2030),('2030-10-25',203043,10,2030,25,43,203010,2030),('2030-10-26',203043,10,2030,26,43,203010,2030),('2030-10-27',203044,10,2030,27,44,203010,2030),('2030-10-28',203044,10,2030,28,44,203010,2030),('2030-10-29',203044,10,2030,29,44,203010,2030),('2030-10-30',203044,10,2030,30,44,203010,2030),('2030-10-31',203044,10,2030,31,44,203010,2030),('2030-11-01',203044,11,2030,1,44,203011,2030),('2030-11-02',203044,11,2030,2,44,203011,2030),('2030-11-03',203045,11,2030,3,45,203011,2030),('2030-11-04',203045,11,2030,4,45,203011,2030),('2030-11-05',203045,11,2030,5,45,203011,2030),('2030-11-06',203045,11,2030,6,45,203011,2030),('2030-11-07',203045,11,2030,7,45,203011,2030),('2030-11-08',203045,11,2030,8,45,203011,2030),('2030-11-09',203045,11,2030,9,45,203011,2030),('2030-11-10',203046,11,2030,10,46,203011,2030),('2030-11-11',203046,11,2030,11,46,203011,2030),('2030-11-12',203046,11,2030,12,46,203011,2030),('2030-11-13',203046,11,2030,13,46,203011,2030),('2030-11-14',203046,11,2030,14,46,203011,2030),('2030-11-15',203046,11,2030,15,46,203011,2030),('2030-11-16',203046,11,2030,16,46,203011,2030),('2030-11-17',203047,11,2030,17,47,203011,2030),('2030-11-18',203047,11,2030,18,47,203011,2030),('2030-11-19',203047,11,2030,19,47,203011,2030),('2030-11-20',203047,11,2030,20,47,203011,2030),('2030-11-21',203047,11,2030,21,47,203011,2030),('2030-11-22',203047,11,2030,22,47,203011,2030),('2030-11-23',203047,11,2030,23,47,203011,2030),('2030-11-24',203048,11,2030,24,48,203011,2030),('2030-11-25',203048,11,2030,25,48,203011,2030),('2030-11-26',203048,11,2030,26,48,203011,2030),('2030-11-27',203048,11,2030,27,48,203011,2030),('2030-11-28',203048,11,2030,28,48,203011,2030),('2030-11-29',203048,11,2030,29,48,203011,2030),('2030-11-30',203048,11,2030,30,48,203011,2030),('2030-12-01',203049,12,2030,1,49,203012,2031),('2030-12-02',203049,12,2030,2,49,203012,2031),('2030-12-03',203049,12,2030,3,49,203012,2031),('2030-12-04',203049,12,2030,4,49,203012,2031),('2030-12-05',203049,12,2030,5,49,203012,2031),('2030-12-06',203049,12,2030,6,49,203012,2031),('2030-12-07',203049,12,2030,7,49,203012,2031),('2030-12-08',203050,12,2030,8,50,203012,2031),('2030-12-09',203050,12,2030,9,50,203012,2031),('2030-12-10',203050,12,2030,10,50,203012,2031),('2030-12-11',203050,12,2030,11,50,203012,2031),('2030-12-12',203050,12,2030,12,50,203012,2031),('2030-12-13',203050,12,2030,13,50,203012,2031),('2030-12-14',203050,12,2030,14,50,203012,2031),('2030-12-15',203051,12,2030,15,51,203012,2031),('2030-12-16',203051,12,2030,16,51,203012,2031),('2030-12-17',203051,12,2030,17,51,203012,2031),('2030-12-18',203051,12,2030,18,51,203012,2031),('2030-12-19',203051,12,2030,19,51,203012,2031),('2030-12-20',203051,12,2030,20,51,203012,2031),('2030-12-21',203051,12,2030,21,51,203012,2031),('2030-12-22',203052,12,2030,22,52,203012,2031),('2030-12-23',203052,12,2030,23,52,203012,2031),('2030-12-24',203052,12,2030,24,52,203012,2031),('2030-12-25',203052,12,2030,25,52,203012,2031),('2030-12-26',203052,12,2030,26,52,203012,2031),('2030-12-27',203052,12,2030,27,52,203012,2031),('2030-12-28',203052,12,2030,28,52,203012,2031),('2030-12-29',203053,12,2030,29,1,203012,2031),('2030-12-30',203001,12,2030,30,1,203012,2031),('2030-12-31',203001,12,2030,31,1,203012,2031),('2031-01-01',203101,1,2031,1,1,203101,2031),('2031-01-02',203101,1,2031,2,1,203101,2031),('2031-01-03',203101,1,2031,3,1,203101,2031),('2031-01-04',203101,1,2031,4,1,203101,2031),('2031-01-05',203102,1,2031,5,2,203101,2031),('2031-01-06',203102,1,2031,6,2,203101,2031),('2031-01-07',203102,1,2031,7,2,203101,2031),('2031-01-08',203102,1,2031,8,2,203101,2031),('2031-01-09',203102,1,2031,9,2,203101,2031),('2031-01-10',203102,1,2031,10,2,203101,2031),('2031-01-11',203102,1,2031,11,2,203101,2031),('2031-01-12',203103,1,2031,12,3,203101,2031),('2031-01-13',203103,1,2031,13,3,203101,2031),('2031-01-14',203103,1,2031,14,3,203101,2031),('2031-01-15',203103,1,2031,15,3,203101,2031),('2031-01-16',203103,1,2031,16,3,203101,2031),('2031-01-17',203103,1,2031,17,3,203101,2031),('2031-01-18',203103,1,2031,18,3,203101,2031),('2031-01-19',203104,1,2031,19,4,203101,2031),('2031-01-20',203104,1,2031,20,4,203101,2031),('2031-01-21',203104,1,2031,21,4,203101,2031),('2031-01-22',203104,1,2031,22,4,203101,2031),('2031-01-23',203104,1,2031,23,4,203101,2031),('2031-01-24',203104,1,2031,24,4,203101,2031),('2031-01-25',203104,1,2031,25,4,203101,2031),('2031-01-26',203105,1,2031,26,5,203101,2031),('2031-01-27',203105,1,2031,27,5,203101,2031),('2031-01-28',203105,1,2031,28,5,203101,2031),('2031-01-29',203105,1,2031,29,5,203101,2031),('2031-01-30',203105,1,2031,30,5,203101,2031),('2031-01-31',203105,1,2031,31,5,203101,2031),('2031-02-01',203105,2,2031,1,5,203102,2031),('2031-02-02',203106,2,2031,2,6,203102,2031),('2031-02-03',203106,2,2031,3,6,203102,2031),('2031-02-04',203106,2,2031,4,6,203102,2031),('2031-02-05',203106,2,2031,5,6,203102,2031),('2031-02-06',203106,2,2031,6,6,203102,2031),('2031-02-07',203106,2,2031,7,6,203102,2031),('2031-02-08',203106,2,2031,8,6,203102,2031),('2031-02-09',203107,2,2031,9,7,203102,2031),('2031-02-10',203107,2,2031,10,7,203102,2031),('2031-02-11',203107,2,2031,11,7,203102,2031),('2031-02-12',203107,2,2031,12,7,203102,2031),('2031-02-13',203107,2,2031,13,7,203102,2031),('2031-02-14',203107,2,2031,14,7,203102,2031),('2031-02-15',203107,2,2031,15,7,203102,2031),('2031-02-16',203108,2,2031,16,8,203102,2031),('2031-02-17',203108,2,2031,17,8,203102,2031),('2031-02-18',203108,2,2031,18,8,203102,2031),('2031-02-19',203108,2,2031,19,8,203102,2031),('2031-02-20',203108,2,2031,20,8,203102,2031),('2031-02-21',203108,2,2031,21,8,203102,2031),('2031-02-22',203108,2,2031,22,8,203102,2031),('2031-02-23',203109,2,2031,23,9,203102,2031),('2031-02-24',203109,2,2031,24,9,203102,2031),('2031-02-25',203109,2,2031,25,9,203102,2031),('2031-02-26',203109,2,2031,26,9,203102,2031),('2031-02-27',203109,2,2031,27,9,203102,2031),('2031-02-28',203109,2,2031,28,9,203102,2031),('2031-03-01',203109,3,2031,1,9,203103,2031),('2031-03-02',203110,3,2031,2,10,203103,2031),('2031-03-03',203110,3,2031,3,10,203103,2031),('2031-03-04',203110,3,2031,4,10,203103,2031),('2031-03-05',203110,3,2031,5,10,203103,2031),('2031-03-06',203110,3,2031,6,10,203103,2031),('2031-03-07',203110,3,2031,7,10,203103,2031),('2031-03-08',203110,3,2031,8,10,203103,2031),('2031-03-09',203111,3,2031,9,11,203103,2031),('2031-03-10',203111,3,2031,10,11,203103,2031),('2031-03-11',203111,3,2031,11,11,203103,2031),('2031-03-12',203111,3,2031,12,11,203103,2031),('2031-03-13',203111,3,2031,13,11,203103,2031),('2031-03-14',203111,3,2031,14,11,203103,2031),('2031-03-15',203111,3,2031,15,11,203103,2031),('2031-03-16',203112,3,2031,16,12,203103,2031),('2031-03-17',203112,3,2031,17,12,203103,2031),('2031-03-18',203112,3,2031,18,12,203103,2031),('2031-03-19',203112,3,2031,19,12,203103,2031),('2031-03-20',203112,3,2031,20,12,203103,2031),('2031-03-21',203112,3,2031,21,12,203103,2031),('2031-03-22',203112,3,2031,22,12,203103,2031),('2031-03-23',203113,3,2031,23,13,203103,2031),('2031-03-24',203113,3,2031,24,13,203103,2031),('2031-03-25',203113,3,2031,25,13,203103,2031),('2031-03-26',203113,3,2031,26,13,203103,2031),('2031-03-27',203113,3,2031,27,13,203103,2031),('2031-03-28',203113,3,2031,28,13,203103,2031),('2031-03-29',203113,3,2031,29,13,203103,2031),('2031-03-30',203114,3,2031,30,14,203103,2031),('2031-03-31',203114,3,2031,31,14,203103,2031),('2031-04-01',203114,4,2031,1,14,203104,2031),('2031-04-02',203114,4,2031,2,14,203104,2031),('2031-04-03',203114,4,2031,3,14,203104,2031),('2031-04-04',203114,4,2031,4,14,203104,2031),('2031-04-05',203114,4,2031,5,14,203104,2031),('2031-04-06',203115,4,2031,6,15,203104,2031),('2031-04-07',203115,4,2031,7,15,203104,2031),('2031-04-08',203115,4,2031,8,15,203104,2031),('2031-04-09',203115,4,2031,9,15,203104,2031),('2031-04-10',203115,4,2031,10,15,203104,2031),('2031-04-11',203115,4,2031,11,15,203104,2031),('2031-04-12',203115,4,2031,12,15,203104,2031),('2031-04-13',203116,4,2031,13,16,203104,2031),('2031-04-14',203116,4,2031,14,16,203104,2031),('2031-04-15',203116,4,2031,15,16,203104,2031),('2031-04-16',203116,4,2031,16,16,203104,2031),('2031-04-17',203116,4,2031,17,16,203104,2031),('2031-04-18',203116,4,2031,18,16,203104,2031),('2031-04-19',203116,4,2031,19,16,203104,2031),('2031-04-20',203117,4,2031,20,17,203104,2031),('2031-04-21',203117,4,2031,21,17,203104,2031),('2031-04-22',203117,4,2031,22,17,203104,2031),('2031-04-23',203117,4,2031,23,17,203104,2031),('2031-04-24',203117,4,2031,24,17,203104,2031),('2031-04-25',203117,4,2031,25,17,203104,2031),('2031-04-26',203117,4,2031,26,17,203104,2031),('2031-04-27',203118,4,2031,27,18,203104,2031),('2031-04-28',203118,4,2031,28,18,203104,2031),('2031-04-29',203118,4,2031,29,18,203104,2031),('2031-04-30',203118,4,2031,30,18,203104,2031),('2031-05-01',203118,5,2031,1,18,203105,2031),('2031-05-02',203118,5,2031,2,18,203105,2031),('2031-05-03',203118,5,2031,3,18,203105,2031),('2031-05-04',203119,5,2031,4,19,203105,2031),('2031-05-05',203119,5,2031,5,19,203105,2031),('2031-05-06',203119,5,2031,6,19,203105,2031),('2031-05-07',203119,5,2031,7,19,203105,2031),('2031-05-08',203119,5,2031,8,19,203105,2031),('2031-05-09',203119,5,2031,9,19,203105,2031),('2031-05-10',203119,5,2031,10,19,203105,2031),('2031-05-11',203120,5,2031,11,20,203105,2031),('2031-05-12',203120,5,2031,12,20,203105,2031),('2031-05-13',203120,5,2031,13,20,203105,2031),('2031-05-14',203120,5,2031,14,20,203105,2031),('2031-05-15',203120,5,2031,15,20,203105,2031),('2031-05-16',203120,5,2031,16,20,203105,2031),('2031-05-17',203120,5,2031,17,20,203105,2031),('2031-05-18',203121,5,2031,18,21,203105,2031),('2031-05-19',203121,5,2031,19,21,203105,2031),('2031-05-20',203121,5,2031,20,21,203105,2031),('2031-05-21',203121,5,2031,21,21,203105,2031),('2031-05-22',203121,5,2031,22,21,203105,2031),('2031-05-23',203121,5,2031,23,21,203105,2031),('2031-05-24',203121,5,2031,24,21,203105,2031),('2031-05-25',203122,5,2031,25,22,203105,2031),('2031-05-26',203122,5,2031,26,22,203105,2031),('2031-05-27',203122,5,2031,27,22,203105,2031),('2031-05-28',203122,5,2031,28,22,203105,2031),('2031-05-29',203122,5,2031,29,22,203105,2031),('2031-05-30',203122,5,2031,30,22,203105,2031),('2031-05-31',203122,5,2031,31,22,203105,2031),('2031-06-01',203123,6,2031,1,23,203106,2031),('2031-06-02',203123,6,2031,2,23,203106,2031),('2031-06-03',203123,6,2031,3,23,203106,2031),('2031-06-04',203123,6,2031,4,23,203106,2031),('2031-06-05',203123,6,2031,5,23,203106,2031),('2031-06-06',203123,6,2031,6,23,203106,2031),('2031-06-07',203123,6,2031,7,23,203106,2031),('2031-06-08',203124,6,2031,8,24,203106,2031),('2031-06-09',203124,6,2031,9,24,203106,2031),('2031-06-10',203124,6,2031,10,24,203106,2031),('2031-06-11',203124,6,2031,11,24,203106,2031),('2031-06-12',203124,6,2031,12,24,203106,2031),('2031-06-13',203124,6,2031,13,24,203106,2031),('2031-06-14',203124,6,2031,14,24,203106,2031),('2031-06-15',203125,6,2031,15,25,203106,2031),('2031-06-16',203125,6,2031,16,25,203106,2031),('2031-06-17',203125,6,2031,17,25,203106,2031),('2031-06-18',203125,6,2031,18,25,203106,2031),('2031-06-19',203125,6,2031,19,25,203106,2031),('2031-06-20',203125,6,2031,20,25,203106,2031),('2031-06-21',203125,6,2031,21,25,203106,2031),('2031-06-22',203126,6,2031,22,26,203106,2031),('2031-06-23',203126,6,2031,23,26,203106,2031),('2031-06-24',203126,6,2031,24,26,203106,2031),('2031-06-25',203126,6,2031,25,26,203106,2031),('2031-06-26',203126,6,2031,26,26,203106,2031),('2031-06-27',203126,6,2031,27,26,203106,2031),('2031-06-28',203126,6,2031,28,26,203106,2031),('2031-06-29',203127,6,2031,29,27,203106,2031),('2031-06-30',203127,6,2031,30,27,203106,2031),('2031-07-01',203127,7,2031,1,27,203107,2031),('2031-07-02',203127,7,2031,2,27,203107,2031),('2031-07-03',203127,7,2031,3,27,203107,2031),('2031-07-04',203127,7,2031,4,27,203107,2031),('2031-07-05',203127,7,2031,5,27,203107,2031),('2031-07-06',203128,7,2031,6,28,203107,2031),('2031-07-07',203128,7,2031,7,28,203107,2031),('2031-07-08',203128,7,2031,8,28,203107,2031),('2031-07-09',203128,7,2031,9,28,203107,2031),('2031-07-10',203128,7,2031,10,28,203107,2031),('2031-07-11',203128,7,2031,11,28,203107,2031),('2031-07-12',203128,7,2031,12,28,203107,2031),('2031-07-13',203129,7,2031,13,29,203107,2031),('2031-07-14',203129,7,2031,14,29,203107,2031),('2031-07-15',203129,7,2031,15,29,203107,2031),('2031-07-16',203129,7,2031,16,29,203107,2031),('2031-07-17',203129,7,2031,17,29,203107,2031),('2031-07-18',203129,7,2031,18,29,203107,2031),('2031-07-19',203129,7,2031,19,29,203107,2031),('2031-07-20',203130,7,2031,20,30,203107,2031),('2031-07-21',203130,7,2031,21,30,203107,2031),('2031-07-22',203130,7,2031,22,30,203107,2031),('2031-07-23',203130,7,2031,23,30,203107,2031),('2031-07-24',203130,7,2031,24,30,203107,2031),('2031-07-25',203130,7,2031,25,30,203107,2031),('2031-07-26',203130,7,2031,26,30,203107,2031),('2031-07-27',203131,7,2031,27,31,203107,2031),('2031-07-28',203131,7,2031,28,31,203107,2031),('2031-07-29',203131,7,2031,29,31,203107,2031),('2031-07-30',203131,7,2031,30,31,203107,2031),('2031-07-31',203131,7,2031,31,31,203107,2031),('2031-08-01',203131,8,2031,1,31,203108,2031),('2031-08-02',203131,8,2031,2,31,203108,2031),('2031-08-03',203132,8,2031,3,32,203108,2031),('2031-08-04',203132,8,2031,4,32,203108,2031),('2031-08-05',203132,8,2031,5,32,203108,2031),('2031-08-06',203132,8,2031,6,32,203108,2031),('2031-08-07',203132,8,2031,7,32,203108,2031),('2031-08-08',203132,8,2031,8,32,203108,2031),('2031-08-09',203132,8,2031,9,32,203108,2031),('2031-08-10',203133,8,2031,10,33,203108,2031),('2031-08-11',203133,8,2031,11,33,203108,2031),('2031-08-12',203133,8,2031,12,33,203108,2031),('2031-08-13',203133,8,2031,13,33,203108,2031),('2031-08-14',203133,8,2031,14,33,203108,2031),('2031-08-15',203133,8,2031,15,33,203108,2031),('2031-08-16',203133,8,2031,16,33,203108,2031),('2031-08-17',203134,8,2031,17,34,203108,2031),('2031-08-18',203134,8,2031,18,34,203108,2031),('2031-08-19',203134,8,2031,19,34,203108,2031),('2031-08-20',203134,8,2031,20,34,203108,2031),('2031-08-21',203134,8,2031,21,34,203108,2031),('2031-08-22',203134,8,2031,22,34,203108,2031),('2031-08-23',203134,8,2031,23,34,203108,2031),('2031-08-24',203135,8,2031,24,35,203108,2031),('2031-08-25',203135,8,2031,25,35,203108,2031),('2031-08-26',203135,8,2031,26,35,203108,2031),('2031-08-27',203135,8,2031,27,35,203108,2031),('2031-08-28',203135,8,2031,28,35,203108,2031),('2031-08-29',203135,8,2031,29,35,203108,2031),('2031-08-30',203135,8,2031,30,35,203108,2031),('2031-08-31',203136,8,2031,31,36,203108,2031),('2031-09-01',203136,9,2031,1,36,203109,2031),('2031-09-02',203136,9,2031,2,36,203109,2031),('2031-09-03',203136,9,2031,3,36,203109,2031),('2031-09-04',203136,9,2031,4,36,203109,2031),('2031-09-05',203136,9,2031,5,36,203109,2031),('2031-09-06',203136,9,2031,6,36,203109,2031),('2031-09-07',203137,9,2031,7,37,203109,2031),('2031-09-08',203137,9,2031,8,37,203109,2031),('2031-09-09',203137,9,2031,9,37,203109,2031),('2031-09-10',203137,9,2031,10,37,203109,2031),('2031-09-11',203137,9,2031,11,37,203109,2031),('2031-09-12',203137,9,2031,12,37,203109,2031),('2031-09-13',203137,9,2031,13,37,203109,2031),('2031-09-14',203138,9,2031,14,38,203109,2031),('2031-09-15',203138,9,2031,15,38,203109,2031),('2031-09-16',203138,9,2031,16,38,203109,2031),('2031-09-17',203138,9,2031,17,38,203109,2031),('2031-09-18',203138,9,2031,18,38,203109,2031),('2031-09-19',203138,9,2031,19,38,203109,2031),('2031-09-20',203138,9,2031,20,38,203109,2031),('2031-09-21',203139,9,2031,21,39,203109,2031),('2031-09-22',203139,9,2031,22,39,203109,2031),('2031-09-23',203139,9,2031,23,39,203109,2031),('2031-09-24',203139,9,2031,24,39,203109,2031),('2031-09-25',203139,9,2031,25,39,203109,2031),('2031-09-26',203139,9,2031,26,39,203109,2031),('2031-09-27',203139,9,2031,27,39,203109,2031),('2031-09-28',203140,9,2031,28,40,203109,2031),('2031-09-29',203140,9,2031,29,40,203109,2031),('2031-09-30',203140,9,2031,30,40,203109,2031),('2031-10-01',203140,10,2031,1,40,203110,2031),('2031-10-02',203140,10,2031,2,40,203110,2031),('2031-10-03',203140,10,2031,3,40,203110,2031),('2031-10-04',203140,10,2031,4,40,203110,2031),('2031-10-05',203141,10,2031,5,41,203110,2031),('2031-10-06',203141,10,2031,6,41,203110,2031),('2031-10-07',203141,10,2031,7,41,203110,2031),('2031-10-08',203141,10,2031,8,41,203110,2031),('2031-10-09',203141,10,2031,9,41,203110,2031),('2031-10-10',203141,10,2031,10,41,203110,2031),('2031-10-11',203141,10,2031,11,41,203110,2031),('2031-10-12',203142,10,2031,12,42,203110,2031),('2031-10-13',203142,10,2031,13,42,203110,2031),('2031-10-14',203142,10,2031,14,42,203110,2031),('2031-10-15',203142,10,2031,15,42,203110,2031),('2031-10-16',203142,10,2031,16,42,203110,2031),('2031-10-17',203142,10,2031,17,42,203110,2031),('2031-10-18',203142,10,2031,18,42,203110,2031),('2031-10-19',203143,10,2031,19,43,203110,2031),('2031-10-20',203143,10,2031,20,43,203110,2031),('2031-10-21',203143,10,2031,21,43,203110,2031),('2031-10-22',203143,10,2031,22,43,203110,2031),('2031-10-23',203143,10,2031,23,43,203110,2031),('2031-10-24',203143,10,2031,24,43,203110,2031),('2031-10-25',203143,10,2031,25,43,203110,2031),('2031-10-26',203144,10,2031,26,44,203110,2031),('2031-10-27',203144,10,2031,27,44,203110,2031),('2031-10-28',203144,10,2031,28,44,203110,2031),('2031-10-29',203144,10,2031,29,44,203110,2031),('2031-10-30',203144,10,2031,30,44,203110,2031),('2031-10-31',203144,10,2031,31,44,203110,2031),('2031-11-01',203144,11,2031,1,44,203111,2031),('2031-11-02',203145,11,2031,2,45,203111,2031),('2031-11-03',203145,11,2031,3,45,203111,2031),('2031-11-04',203145,11,2031,4,45,203111,2031),('2031-11-05',203145,11,2031,5,45,203111,2031),('2031-11-06',203145,11,2031,6,45,203111,2031),('2031-11-07',203145,11,2031,7,45,203111,2031),('2031-11-08',203145,11,2031,8,45,203111,2031),('2031-11-09',203146,11,2031,9,46,203111,2031),('2031-11-10',203146,11,2031,10,46,203111,2031),('2031-11-11',203146,11,2031,11,46,203111,2031),('2031-11-12',203146,11,2031,12,46,203111,2031),('2031-11-13',203146,11,2031,13,46,203111,2031),('2031-11-14',203146,11,2031,14,46,203111,2031),('2031-11-15',203146,11,2031,15,46,203111,2031),('2031-11-16',203147,11,2031,16,47,203111,2031),('2031-11-17',203147,11,2031,17,47,203111,2031),('2031-11-18',203147,11,2031,18,47,203111,2031),('2031-11-19',203147,11,2031,19,47,203111,2031),('2031-11-20',203147,11,2031,20,47,203111,2031),('2031-11-21',203147,11,2031,21,47,203111,2031),('2031-11-22',203147,11,2031,22,47,203111,2031),('2031-11-23',203148,11,2031,23,48,203111,2031),('2031-11-24',203148,11,2031,24,48,203111,2031),('2031-11-25',203148,11,2031,25,48,203111,2031),('2031-11-26',203148,11,2031,26,48,203111,2031),('2031-11-27',203148,11,2031,27,48,203111,2031),('2031-11-28',203148,11,2031,28,48,203111,2031),('2031-11-29',203148,11,2031,29,48,203111,2031),('2031-11-30',203149,11,2031,30,49,203111,2031),('2031-12-01',203149,12,2031,1,49,203112,2032),('2031-12-02',203149,12,2031,2,49,203112,2032),('2031-12-03',203149,12,2031,3,49,203112,2032),('2031-12-04',203149,12,2031,4,49,203112,2032),('2031-12-05',203149,12,2031,5,49,203112,2032),('2031-12-06',203149,12,2031,6,49,203112,2032),('2031-12-07',203150,12,2031,7,50,203112,2032),('2031-12-08',203150,12,2031,8,50,203112,2032),('2031-12-09',203150,12,2031,9,50,203112,2032),('2031-12-10',203150,12,2031,10,50,203112,2032),('2031-12-11',203150,12,2031,11,50,203112,2032),('2031-12-12',203150,12,2031,12,50,203112,2032),('2031-12-13',203150,12,2031,13,50,203112,2032),('2031-12-14',203151,12,2031,14,51,203112,2032),('2031-12-15',203151,12,2031,15,51,203112,2032),('2031-12-16',203151,12,2031,16,51,203112,2032),('2031-12-17',203151,12,2031,17,51,203112,2032),('2031-12-18',203151,12,2031,18,51,203112,2032),('2031-12-19',203151,12,2031,19,51,203112,2032),('2031-12-20',203151,12,2031,20,51,203112,2032),('2031-12-21',203152,12,2031,21,52,203112,2032),('2031-12-22',203152,12,2031,22,52,203112,2032),('2031-12-23',203152,12,2031,23,52,203112,2032),('2031-12-24',203152,12,2031,24,52,203112,2032),('2031-12-25',203152,12,2031,25,52,203112,2032),('2031-12-26',203152,12,2031,26,52,203112,2032),('2031-12-27',203152,12,2031,27,52,203112,2032),('2031-12-28',203153,12,2031,28,53,203112,2032),('2031-12-29',203101,12,2031,29,53,203112,2032),('2031-12-30',203101,12,2031,30,53,203112,2032),('2031-12-31',203101,12,2031,31,53,203112,2032),('2032-01-01',203201,1,2032,1,53,203201,2032),('2032-01-02',203201,1,2032,2,53,203201,2032),('2032-01-03',203201,1,2032,3,53,203201,2032),('2032-01-04',203202,1,2032,4,1,203201,2032),('2032-01-05',203202,1,2032,5,1,203201,2032),('2032-01-06',203202,1,2032,6,1,203201,2032),('2032-01-07',203202,1,2032,7,1,203201,2032),('2032-01-08',203202,1,2032,8,1,203201,2032),('2032-01-09',203202,1,2032,9,1,203201,2032),('2032-01-10',203202,1,2032,10,1,203201,2032),('2032-01-11',203203,1,2032,11,2,203201,2032),('2032-01-12',203203,1,2032,12,2,203201,2032),('2032-01-13',203203,1,2032,13,2,203201,2032),('2032-01-14',203203,1,2032,14,2,203201,2032),('2032-01-15',203203,1,2032,15,2,203201,2032),('2032-01-16',203203,1,2032,16,2,203201,2032),('2032-01-17',203203,1,2032,17,2,203201,2032),('2032-01-18',203204,1,2032,18,3,203201,2032),('2032-01-19',203204,1,2032,19,3,203201,2032),('2032-01-20',203204,1,2032,20,3,203201,2032),('2032-01-21',203204,1,2032,21,3,203201,2032),('2032-01-22',203204,1,2032,22,3,203201,2032),('2032-01-23',203204,1,2032,23,3,203201,2032),('2032-01-24',203204,1,2032,24,3,203201,2032),('2032-01-25',203205,1,2032,25,4,203201,2032),('2032-01-26',203205,1,2032,26,4,203201,2032),('2032-01-27',203205,1,2032,27,4,203201,2032),('2032-01-28',203205,1,2032,28,4,203201,2032),('2032-01-29',203205,1,2032,29,4,203201,2032),('2032-01-30',203205,1,2032,30,4,203201,2032),('2032-01-31',203205,1,2032,31,4,203201,2032),('2032-02-01',203206,2,2032,1,5,203202,2032),('2032-02-02',203206,2,2032,2,5,203202,2032),('2032-02-03',203206,2,2032,3,5,203202,2032),('2032-02-04',203206,2,2032,4,5,203202,2032),('2032-02-05',203206,2,2032,5,5,203202,2032),('2032-02-06',203206,2,2032,6,5,203202,2032),('2032-02-07',203206,2,2032,7,5,203202,2032),('2032-02-08',203207,2,2032,8,6,203202,2032),('2032-02-09',203207,2,2032,9,6,203202,2032),('2032-02-10',203207,2,2032,10,6,203202,2032),('2032-02-11',203207,2,2032,11,6,203202,2032),('2032-02-12',203207,2,2032,12,6,203202,2032),('2032-02-13',203207,2,2032,13,6,203202,2032),('2032-02-14',203207,2,2032,14,6,203202,2032),('2032-02-15',203208,2,2032,15,7,203202,2032),('2032-02-16',203208,2,2032,16,7,203202,2032),('2032-02-17',203208,2,2032,17,7,203202,2032),('2032-02-18',203208,2,2032,18,7,203202,2032),('2032-02-19',203208,2,2032,19,7,203202,2032),('2032-02-20',203208,2,2032,20,7,203202,2032),('2032-02-21',203208,2,2032,21,7,203202,2032),('2032-02-22',203209,2,2032,22,8,203202,2032),('2032-02-23',203209,2,2032,23,8,203202,2032),('2032-02-24',203209,2,2032,24,8,203202,2032),('2032-02-25',203209,2,2032,25,8,203202,2032),('2032-02-26',203209,2,2032,26,8,203202,2032),('2032-02-27',203209,2,2032,27,8,203202,2032),('2032-02-28',203209,2,2032,28,8,203202,2032),('2032-02-29',203210,2,2032,29,9,203202,2032),('2032-03-01',203210,3,2032,1,9,203203,2032),('2032-03-02',203210,3,2032,2,9,203203,2032),('2032-03-03',203210,3,2032,3,9,203203,2032),('2032-03-04',203210,3,2032,4,9,203203,2032),('2032-03-05',203210,3,2032,5,9,203203,2032),('2032-03-06',203210,3,2032,6,9,203203,2032),('2032-03-07',203211,3,2032,7,10,203203,2032),('2032-03-08',203211,3,2032,8,10,203203,2032),('2032-03-09',203211,3,2032,9,10,203203,2032),('2032-03-10',203211,3,2032,10,10,203203,2032),('2032-03-11',203211,3,2032,11,10,203203,2032),('2032-03-12',203211,3,2032,12,10,203203,2032),('2032-03-13',203211,3,2032,13,10,203203,2032),('2032-03-14',203212,3,2032,14,11,203203,2032),('2032-03-15',203212,3,2032,15,11,203203,2032),('2032-03-16',203212,3,2032,16,11,203203,2032),('2032-03-17',203212,3,2032,17,11,203203,2032),('2032-03-18',203212,3,2032,18,11,203203,2032),('2032-03-19',203212,3,2032,19,11,203203,2032),('2032-03-20',203212,3,2032,20,11,203203,2032),('2032-03-21',203213,3,2032,21,12,203203,2032),('2032-03-22',203213,3,2032,22,12,203203,2032),('2032-03-23',203213,3,2032,23,12,203203,2032),('2032-03-24',203213,3,2032,24,12,203203,2032),('2032-03-25',203213,3,2032,25,12,203203,2032),('2032-03-26',203213,3,2032,26,12,203203,2032),('2032-03-27',203213,3,2032,27,12,203203,2032),('2032-03-28',203214,3,2032,28,13,203203,2032),('2032-03-29',203214,3,2032,29,13,203203,2032),('2032-03-30',203214,3,2032,30,13,203203,2032),('2032-03-31',203214,3,2032,31,13,203203,2032),('2032-04-01',203214,4,2032,1,13,203204,2032),('2032-04-02',203214,4,2032,2,13,203204,2032),('2032-04-03',203214,4,2032,3,13,203204,2032),('2032-04-04',203215,4,2032,4,14,203204,2032),('2032-04-05',203215,4,2032,5,14,203204,2032),('2032-04-06',203215,4,2032,6,14,203204,2032),('2032-04-07',203215,4,2032,7,14,203204,2032),('2032-04-08',203215,4,2032,8,14,203204,2032),('2032-04-09',203215,4,2032,9,14,203204,2032),('2032-04-10',203215,4,2032,10,14,203204,2032),('2032-04-11',203216,4,2032,11,15,203204,2032),('2032-04-12',203216,4,2032,12,15,203204,2032),('2032-04-13',203216,4,2032,13,15,203204,2032),('2032-04-14',203216,4,2032,14,15,203204,2032),('2032-04-15',203216,4,2032,15,15,203204,2032),('2032-04-16',203216,4,2032,16,15,203204,2032),('2032-04-17',203216,4,2032,17,15,203204,2032),('2032-04-18',203217,4,2032,18,16,203204,2032),('2032-04-19',203217,4,2032,19,16,203204,2032),('2032-04-20',203217,4,2032,20,16,203204,2032),('2032-04-21',203217,4,2032,21,16,203204,2032),('2032-04-22',203217,4,2032,22,16,203204,2032),('2032-04-23',203217,4,2032,23,16,203204,2032),('2032-04-24',203217,4,2032,24,16,203204,2032),('2032-04-25',203218,4,2032,25,17,203204,2032),('2032-04-26',203218,4,2032,26,17,203204,2032),('2032-04-27',203218,4,2032,27,17,203204,2032),('2032-04-28',203218,4,2032,28,17,203204,2032),('2032-04-29',203218,4,2032,29,17,203204,2032),('2032-04-30',203218,4,2032,30,17,203204,2032),('2032-05-01',203218,5,2032,1,17,203205,2032),('2032-05-02',203219,5,2032,2,18,203205,2032),('2032-05-03',203219,5,2032,3,18,203205,2032),('2032-05-04',203219,5,2032,4,18,203205,2032),('2032-05-05',203219,5,2032,5,18,203205,2032),('2032-05-06',203219,5,2032,6,18,203205,2032),('2032-05-07',203219,5,2032,7,18,203205,2032),('2032-05-08',203219,5,2032,8,18,203205,2032),('2032-05-09',203220,5,2032,9,19,203205,2032),('2032-05-10',203220,5,2032,10,19,203205,2032),('2032-05-11',203220,5,2032,11,19,203205,2032),('2032-05-12',203220,5,2032,12,19,203205,2032),('2032-05-13',203220,5,2032,13,19,203205,2032),('2032-05-14',203220,5,2032,14,19,203205,2032),('2032-05-15',203220,5,2032,15,19,203205,2032),('2032-05-16',203221,5,2032,16,20,203205,2032),('2032-05-17',203221,5,2032,17,20,203205,2032),('2032-05-18',203221,5,2032,18,20,203205,2032),('2032-05-19',203221,5,2032,19,20,203205,2032),('2032-05-20',203221,5,2032,20,20,203205,2032),('2032-05-21',203221,5,2032,21,20,203205,2032),('2032-05-22',203221,5,2032,22,20,203205,2032),('2032-05-23',203222,5,2032,23,21,203205,2032),('2032-05-24',203222,5,2032,24,21,203205,2032),('2032-05-25',203222,5,2032,25,21,203205,2032),('2032-05-26',203222,5,2032,26,21,203205,2032),('2032-05-27',203222,5,2032,27,21,203205,2032),('2032-05-28',203222,5,2032,28,21,203205,2032),('2032-05-29',203222,5,2032,29,21,203205,2032),('2032-05-30',203223,5,2032,30,22,203205,2032),('2032-05-31',203223,5,2032,31,22,203205,2032),('2032-06-01',203223,6,2032,1,22,203206,2032),('2032-06-02',203223,6,2032,2,22,203206,2032),('2032-06-03',203223,6,2032,3,22,203206,2032),('2032-06-04',203223,6,2032,4,22,203206,2032),('2032-06-05',203223,6,2032,5,22,203206,2032),('2032-06-06',203224,6,2032,6,23,203206,2032),('2032-06-07',203224,6,2032,7,23,203206,2032),('2032-06-08',203224,6,2032,8,23,203206,2032),('2032-06-09',203224,6,2032,9,23,203206,2032),('2032-06-10',203224,6,2032,10,23,203206,2032),('2032-06-11',203224,6,2032,11,23,203206,2032),('2032-06-12',203224,6,2032,12,23,203206,2032),('2032-06-13',203225,6,2032,13,24,203206,2032),('2032-06-14',203225,6,2032,14,24,203206,2032),('2032-06-15',203225,6,2032,15,24,203206,2032),('2032-06-16',203225,6,2032,16,24,203206,2032),('2032-06-17',203225,6,2032,17,24,203206,2032),('2032-06-18',203225,6,2032,18,24,203206,2032),('2032-06-19',203225,6,2032,19,24,203206,2032),('2032-06-20',203226,6,2032,20,25,203206,2032),('2032-06-21',203226,6,2032,21,25,203206,2032),('2032-06-22',203226,6,2032,22,25,203206,2032),('2032-06-23',203226,6,2032,23,25,203206,2032),('2032-06-24',203226,6,2032,24,25,203206,2032),('2032-06-25',203226,6,2032,25,25,203206,2032),('2032-06-26',203226,6,2032,26,25,203206,2032),('2032-06-27',203227,6,2032,27,26,203206,2032),('2032-06-28',203227,6,2032,28,26,203206,2032),('2032-06-29',203227,6,2032,29,26,203206,2032),('2032-06-30',203227,6,2032,30,26,203206,2032),('2032-07-01',203227,7,2032,1,26,203207,2032),('2032-07-02',203227,7,2032,2,26,203207,2032),('2032-07-03',203227,7,2032,3,26,203207,2032),('2032-07-04',203228,7,2032,4,27,203207,2032),('2032-07-05',203228,7,2032,5,27,203207,2032),('2032-07-06',203228,7,2032,6,27,203207,2032),('2032-07-07',203228,7,2032,7,27,203207,2032),('2032-07-08',203228,7,2032,8,27,203207,2032),('2032-07-09',203228,7,2032,9,27,203207,2032),('2032-07-10',203228,7,2032,10,27,203207,2032),('2032-07-11',203229,7,2032,11,28,203207,2032),('2032-07-12',203229,7,2032,12,28,203207,2032),('2032-07-13',203229,7,2032,13,28,203207,2032),('2032-07-14',203229,7,2032,14,28,203207,2032),('2032-07-15',203229,7,2032,15,28,203207,2032),('2032-07-16',203229,7,2032,16,28,203207,2032),('2032-07-17',203229,7,2032,17,28,203207,2032),('2032-07-18',203230,7,2032,18,29,203207,2032),('2032-07-19',203230,7,2032,19,29,203207,2032),('2032-07-20',203230,7,2032,20,29,203207,2032),('2032-07-21',203230,7,2032,21,29,203207,2032),('2032-07-22',203230,7,2032,22,29,203207,2032),('2032-07-23',203230,7,2032,23,29,203207,2032),('2032-07-24',203230,7,2032,24,29,203207,2032),('2032-07-25',203231,7,2032,25,30,203207,2032),('2032-07-26',203231,7,2032,26,30,203207,2032),('2032-07-27',203231,7,2032,27,30,203207,2032),('2032-07-28',203231,7,2032,28,30,203207,2032),('2032-07-29',203231,7,2032,29,30,203207,2032),('2032-07-30',203231,7,2032,30,30,203207,2032),('2032-07-31',203231,7,2032,31,30,203207,2032),('2032-08-01',203232,8,2032,1,31,203208,2032),('2032-08-02',203232,8,2032,2,31,203208,2032),('2032-08-03',203232,8,2032,3,31,203208,2032),('2032-08-04',203232,8,2032,4,31,203208,2032),('2032-08-05',203232,8,2032,5,31,203208,2032),('2032-08-06',203232,8,2032,6,31,203208,2032),('2032-08-07',203232,8,2032,7,31,203208,2032),('2032-08-08',203233,8,2032,8,32,203208,2032),('2032-08-09',203233,8,2032,9,32,203208,2032),('2032-08-10',203233,8,2032,10,32,203208,2032),('2032-08-11',203233,8,2032,11,32,203208,2032),('2032-08-12',203233,8,2032,12,32,203208,2032),('2032-08-13',203233,8,2032,13,32,203208,2032),('2032-08-14',203233,8,2032,14,32,203208,2032),('2032-08-15',203234,8,2032,15,33,203208,2032),('2032-08-16',203234,8,2032,16,33,203208,2032),('2032-08-17',203234,8,2032,17,33,203208,2032),('2032-08-18',203234,8,2032,18,33,203208,2032),('2032-08-19',203234,8,2032,19,33,203208,2032),('2032-08-20',203234,8,2032,20,33,203208,2032),('2032-08-21',203234,8,2032,21,33,203208,2032),('2032-08-22',203235,8,2032,22,34,203208,2032),('2032-08-23',203235,8,2032,23,34,203208,2032),('2032-08-24',203235,8,2032,24,34,203208,2032),('2032-08-25',203235,8,2032,25,34,203208,2032),('2032-08-26',203235,8,2032,26,34,203208,2032),('2032-08-27',203235,8,2032,27,34,203208,2032),('2032-08-28',203235,8,2032,28,34,203208,2032),('2032-08-29',203236,8,2032,29,35,203208,2032),('2032-08-30',203236,8,2032,30,35,203208,2032),('2032-08-31',203236,8,2032,31,35,203208,2032),('2032-09-01',203236,9,2032,1,35,203209,2032),('2032-09-02',203236,9,2032,2,35,203209,2032),('2032-09-03',203236,9,2032,3,35,203209,2032),('2032-09-04',203236,9,2032,4,35,203209,2032),('2032-09-05',203237,9,2032,5,36,203209,2032),('2032-09-06',203237,9,2032,6,36,203209,2032),('2032-09-07',203237,9,2032,7,36,203209,2032),('2032-09-08',203237,9,2032,8,36,203209,2032),('2032-09-09',203237,9,2032,9,36,203209,2032),('2032-09-10',203237,9,2032,10,36,203209,2032),('2032-09-11',203237,9,2032,11,36,203209,2032),('2032-09-12',203238,9,2032,12,37,203209,2032),('2032-09-13',203238,9,2032,13,37,203209,2032),('2032-09-14',203238,9,2032,14,37,203209,2032),('2032-09-15',203238,9,2032,15,37,203209,2032),('2032-09-16',203238,9,2032,16,37,203209,2032),('2032-09-17',203238,9,2032,17,37,203209,2032),('2032-09-18',203238,9,2032,18,37,203209,2032),('2032-09-19',203239,9,2032,19,38,203209,2032),('2032-09-20',203239,9,2032,20,38,203209,2032),('2032-09-21',203239,9,2032,21,38,203209,2032),('2032-09-22',203239,9,2032,22,38,203209,2032),('2032-09-23',203239,9,2032,23,38,203209,2032),('2032-09-24',203239,9,2032,24,38,203209,2032),('2032-09-25',203239,9,2032,25,38,203209,2032),('2032-09-26',203240,9,2032,26,39,203209,2032),('2032-09-27',203240,9,2032,27,39,203209,2032),('2032-09-28',203240,9,2032,28,39,203209,2032),('2032-09-29',203240,9,2032,29,39,203209,2032),('2032-09-30',203240,9,2032,30,39,203209,2032),('2032-10-01',203240,10,2032,1,39,203210,2032),('2032-10-02',203240,10,2032,2,39,203210,2032),('2032-10-03',203241,10,2032,3,40,203210,2032),('2032-10-04',203241,10,2032,4,40,203210,2032),('2032-10-05',203241,10,2032,5,40,203210,2032),('2032-10-06',203241,10,2032,6,40,203210,2032),('2032-10-07',203241,10,2032,7,40,203210,2032),('2032-10-08',203241,10,2032,8,40,203210,2032),('2032-10-09',203241,10,2032,9,40,203210,2032),('2032-10-10',203242,10,2032,10,41,203210,2032),('2032-10-11',203242,10,2032,11,41,203210,2032),('2032-10-12',203242,10,2032,12,41,203210,2032),('2032-10-13',203242,10,2032,13,41,203210,2032),('2032-10-14',203242,10,2032,14,41,203210,2032),('2032-10-15',203242,10,2032,15,41,203210,2032),('2032-10-16',203242,10,2032,16,41,203210,2032),('2032-10-17',203243,10,2032,17,42,203210,2032),('2032-10-18',203243,10,2032,18,42,203210,2032),('2032-10-19',203243,10,2032,19,42,203210,2032),('2032-10-20',203243,10,2032,20,42,203210,2032),('2032-10-21',203243,10,2032,21,42,203210,2032),('2032-10-22',203243,10,2032,22,42,203210,2032),('2032-10-23',203243,10,2032,23,42,203210,2032),('2032-10-24',203244,10,2032,24,43,203210,2032),('2032-10-25',203244,10,2032,25,43,203210,2032),('2032-10-26',203244,10,2032,26,43,203210,2032),('2032-10-27',203244,10,2032,27,43,203210,2032),('2032-10-28',203244,10,2032,28,43,203210,2032),('2032-10-29',203244,10,2032,29,43,203210,2032),('2032-10-30',203244,10,2032,30,43,203210,2032),('2032-10-31',203245,10,2032,31,44,203210,2032),('2032-11-01',203245,11,2032,1,44,203211,2032),('2032-11-02',203245,11,2032,2,44,203211,2032),('2032-11-03',203245,11,2032,3,44,203211,2032),('2032-11-04',203245,11,2032,4,44,203211,2032),('2032-11-05',203245,11,2032,5,44,203211,2032),('2032-11-06',203245,11,2032,6,44,203211,2032),('2032-11-07',203246,11,2032,7,45,203211,2032),('2032-11-08',203246,11,2032,8,45,203211,2032),('2032-11-09',203246,11,2032,9,45,203211,2032),('2032-11-10',203246,11,2032,10,45,203211,2032),('2032-11-11',203246,11,2032,11,45,203211,2032),('2032-11-12',203246,11,2032,12,45,203211,2032),('2032-11-13',203246,11,2032,13,45,203211,2032),('2032-11-14',203247,11,2032,14,46,203211,2032),('2032-11-15',203247,11,2032,15,46,203211,2032),('2032-11-16',203247,11,2032,16,46,203211,2032),('2032-11-17',203247,11,2032,17,46,203211,2032),('2032-11-18',203247,11,2032,18,46,203211,2032),('2032-11-19',203247,11,2032,19,46,203211,2032),('2032-11-20',203247,11,2032,20,46,203211,2032),('2032-11-21',203248,11,2032,21,47,203211,2032),('2032-11-22',203248,11,2032,22,47,203211,2032),('2032-11-23',203248,11,2032,23,47,203211,2032),('2032-11-24',203248,11,2032,24,47,203211,2032),('2032-11-25',203248,11,2032,25,47,203211,2032),('2032-11-26',203248,11,2032,26,47,203211,2032),('2032-11-27',203248,11,2032,27,47,203211,2032),('2032-11-28',203249,11,2032,28,48,203211,2032),('2032-11-29',203249,11,2032,29,48,203211,2032),('2032-11-30',203249,11,2032,30,48,203211,2032),('2032-12-01',203249,12,2032,1,48,203212,2033),('2032-12-02',203249,12,2032,2,48,203212,2033),('2032-12-03',203249,12,2032,3,48,203212,2033),('2032-12-04',203249,12,2032,4,48,203212,2033),('2032-12-05',203250,12,2032,5,49,203212,2033),('2032-12-06',203250,12,2032,6,49,203212,2033),('2032-12-07',203250,12,2032,7,49,203212,2033),('2032-12-08',203250,12,2032,8,49,203212,2033),('2032-12-09',203250,12,2032,9,49,203212,2033),('2032-12-10',203250,12,2032,10,49,203212,2033),('2032-12-11',203250,12,2032,11,49,203212,2033),('2032-12-12',203251,12,2032,12,50,203212,2033),('2032-12-13',203251,12,2032,13,50,203212,2033),('2032-12-14',203251,12,2032,14,50,203212,2033),('2032-12-15',203251,12,2032,15,50,203212,2033),('2032-12-16',203251,12,2032,16,50,203212,2033),('2032-12-17',203251,12,2032,17,50,203212,2033),('2032-12-18',203251,12,2032,18,50,203212,2033),('2032-12-19',203252,12,2032,19,51,203212,2033),('2032-12-20',203252,12,2032,20,51,203212,2033),('2032-12-21',203252,12,2032,21,51,203212,2033),('2032-12-22',203252,12,2032,22,51,203212,2033),('2032-12-23',203252,12,2032,23,51,203212,2033),('2032-12-24',203252,12,2032,24,51,203212,2033),('2032-12-25',203252,12,2032,25,51,203212,2033),('2032-12-26',203253,12,2032,26,52,203212,2033),('2032-12-27',203253,12,2032,27,52,203212,2033),('2032-12-28',203253,12,2032,28,52,203212,2033),('2032-12-29',203253,12,2032,29,52,203212,2033),('2032-12-30',203253,12,2032,30,52,203212,2033),('2032-12-31',203253,12,2032,31,52,203212,2033),('2033-01-01',203353,1,2033,1,52,203301,2033),('2033-01-02',203354,1,2033,2,1,203301,2033),('2033-01-03',203301,1,2033,3,1,203301,2033),('2033-01-04',203301,1,2033,4,1,203301,2033),('2033-01-05',203301,1,2033,5,1,203301,2033),('2033-01-06',203301,1,2033,6,1,203301,2033),('2033-01-07',203301,1,2033,7,1,203301,2033),('2033-01-08',203301,1,2033,8,1,203301,2033),('2033-01-09',203302,1,2033,9,2,203301,2033),('2033-01-10',203302,1,2033,10,2,203301,2033),('2033-01-11',203302,1,2033,11,2,203301,2033),('2033-01-12',203302,1,2033,12,2,203301,2033),('2033-01-13',203302,1,2033,13,2,203301,2033),('2033-01-14',203302,1,2033,14,2,203301,2033),('2033-01-15',203302,1,2033,15,2,203301,2033),('2033-01-16',203303,1,2033,16,3,203301,2033),('2033-01-17',203303,1,2033,17,3,203301,2033),('2033-01-18',203303,1,2033,18,3,203301,2033),('2033-01-19',203303,1,2033,19,3,203301,2033),('2033-01-20',203303,1,2033,20,3,203301,2033),('2033-01-21',203303,1,2033,21,3,203301,2033),('2033-01-22',203303,1,2033,22,3,203301,2033),('2033-01-23',203304,1,2033,23,4,203301,2033),('2033-01-24',203304,1,2033,24,4,203301,2033),('2033-01-25',203304,1,2033,25,4,203301,2033),('2033-01-26',203304,1,2033,26,4,203301,2033),('2033-01-27',203304,1,2033,27,4,203301,2033),('2033-01-28',203304,1,2033,28,4,203301,2033),('2033-01-29',203304,1,2033,29,4,203301,2033),('2033-01-30',203305,1,2033,30,5,203301,2033),('2033-01-31',203305,1,2033,31,5,203301,2033),('2033-02-01',203305,2,2033,1,5,203302,2033),('2033-02-02',203305,2,2033,2,5,203302,2033),('2033-02-03',203305,2,2033,3,5,203302,2033),('2033-02-04',203305,2,2033,4,5,203302,2033),('2033-02-05',203305,2,2033,5,5,203302,2033),('2033-02-06',203306,2,2033,6,6,203302,2033),('2033-02-07',203306,2,2033,7,6,203302,2033),('2033-02-08',203306,2,2033,8,6,203302,2033),('2033-02-09',203306,2,2033,9,6,203302,2033),('2033-02-10',203306,2,2033,10,6,203302,2033),('2033-02-11',203306,2,2033,11,6,203302,2033),('2033-02-12',203306,2,2033,12,6,203302,2033),('2033-02-13',203307,2,2033,13,7,203302,2033),('2033-02-14',203307,2,2033,14,7,203302,2033),('2033-02-15',203307,2,2033,15,7,203302,2033),('2033-02-16',203307,2,2033,16,7,203302,2033),('2033-02-17',203307,2,2033,17,7,203302,2033),('2033-02-18',203307,2,2033,18,7,203302,2033),('2033-02-19',203307,2,2033,19,7,203302,2033),('2033-02-20',203308,2,2033,20,8,203302,2033),('2033-02-21',203308,2,2033,21,8,203302,2033),('2033-02-22',203308,2,2033,22,8,203302,2033),('2033-02-23',203308,2,2033,23,8,203302,2033),('2033-02-24',203308,2,2033,24,8,203302,2033),('2033-02-25',203308,2,2033,25,8,203302,2033),('2033-02-26',203308,2,2033,26,8,203302,2033),('2033-02-27',203309,2,2033,27,9,203302,2033),('2033-02-28',203309,2,2033,28,9,203302,2033),('2033-03-01',203309,3,2033,1,9,203303,2033),('2033-03-02',203309,3,2033,2,9,203303,2033),('2033-03-03',203309,3,2033,3,9,203303,2033),('2033-03-04',203309,3,2033,4,9,203303,2033),('2033-03-05',203309,3,2033,5,9,203303,2033),('2033-03-06',203310,3,2033,6,10,203303,2033),('2033-03-07',203310,3,2033,7,10,203303,2033),('2033-03-08',203310,3,2033,8,10,203303,2033),('2033-03-09',203310,3,2033,9,10,203303,2033),('2033-03-10',203310,3,2033,10,10,203303,2033),('2033-03-11',203310,3,2033,11,10,203303,2033),('2033-03-12',203310,3,2033,12,10,203303,2033),('2033-03-13',203311,3,2033,13,11,203303,2033),('2033-03-14',203311,3,2033,14,11,203303,2033),('2033-03-15',203311,3,2033,15,11,203303,2033),('2033-03-16',203311,3,2033,16,11,203303,2033),('2033-03-17',203311,3,2033,17,11,203303,2033),('2033-03-18',203311,3,2033,18,11,203303,2033),('2033-03-19',203311,3,2033,19,11,203303,2033),('2033-03-20',203312,3,2033,20,12,203303,2033),('2033-03-21',203312,3,2033,21,12,203303,2033),('2033-03-22',203312,3,2033,22,12,203303,2033),('2033-03-23',203312,3,2033,23,12,203303,2033),('2033-03-24',203312,3,2033,24,12,203303,2033),('2033-03-25',203312,3,2033,25,12,203303,2033),('2033-03-26',203312,3,2033,26,12,203303,2033),('2033-03-27',203313,3,2033,27,13,203303,2033),('2033-03-28',203313,3,2033,28,13,203303,2033),('2033-03-29',203313,3,2033,29,13,203303,2033),('2033-03-30',203313,3,2033,30,13,203303,2033),('2033-03-31',203313,3,2033,31,13,203303,2033),('2033-04-01',203313,4,2033,1,13,203304,2033),('2033-04-02',203313,4,2033,2,13,203304,2033),('2033-04-03',203314,4,2033,3,14,203304,2033),('2033-04-04',203314,4,2033,4,14,203304,2033),('2033-04-05',203314,4,2033,5,14,203304,2033),('2033-04-06',203314,4,2033,6,14,203304,2033),('2033-04-07',203314,4,2033,7,14,203304,2033),('2033-04-08',203314,4,2033,8,14,203304,2033),('2033-04-09',203314,4,2033,9,14,203304,2033),('2033-04-10',203315,4,2033,10,15,203304,2033),('2033-04-11',203315,4,2033,11,15,203304,2033),('2033-04-12',203315,4,2033,12,15,203304,2033),('2033-04-13',203315,4,2033,13,15,203304,2033),('2033-04-14',203315,4,2033,14,15,203304,2033),('2033-04-15',203315,4,2033,15,15,203304,2033),('2033-04-16',203315,4,2033,16,15,203304,2033),('2033-04-17',203316,4,2033,17,16,203304,2033),('2033-04-18',203316,4,2033,18,16,203304,2033),('2033-04-19',203316,4,2033,19,16,203304,2033),('2033-04-20',203316,4,2033,20,16,203304,2033),('2033-04-21',203316,4,2033,21,16,203304,2033),('2033-04-22',203316,4,2033,22,16,203304,2033),('2033-04-23',203316,4,2033,23,16,203304,2033),('2033-04-24',203317,4,2033,24,17,203304,2033),('2033-04-25',203317,4,2033,25,17,203304,2033),('2033-04-26',203317,4,2033,26,17,203304,2033),('2033-04-27',203317,4,2033,27,17,203304,2033),('2033-04-28',203317,4,2033,28,17,203304,2033),('2033-04-29',203317,4,2033,29,17,203304,2033),('2033-04-30',203317,4,2033,30,17,203304,2033),('2033-05-01',203318,5,2033,1,18,203305,2033),('2033-05-02',203318,5,2033,2,18,203305,2033),('2033-05-03',203318,5,2033,3,18,203305,2033),('2033-05-04',203318,5,2033,4,18,203305,2033),('2033-05-05',203318,5,2033,5,18,203305,2033),('2033-05-06',203318,5,2033,6,18,203305,2033),('2033-05-07',203318,5,2033,7,18,203305,2033),('2033-05-08',203319,5,2033,8,19,203305,2033),('2033-05-09',203319,5,2033,9,19,203305,2033),('2033-05-10',203319,5,2033,10,19,203305,2033),('2033-05-11',203319,5,2033,11,19,203305,2033),('2033-05-12',203319,5,2033,12,19,203305,2033),('2033-05-13',203319,5,2033,13,19,203305,2033),('2033-05-14',203319,5,2033,14,19,203305,2033),('2033-05-15',203320,5,2033,15,20,203305,2033),('2033-05-16',203320,5,2033,16,20,203305,2033),('2033-05-17',203320,5,2033,17,20,203305,2033),('2033-05-18',203320,5,2033,18,20,203305,2033),('2033-05-19',203320,5,2033,19,20,203305,2033),('2033-05-20',203320,5,2033,20,20,203305,2033),('2033-05-21',203320,5,2033,21,20,203305,2033),('2033-05-22',203321,5,2033,22,21,203305,2033),('2033-05-23',203321,5,2033,23,21,203305,2033),('2033-05-24',203321,5,2033,24,21,203305,2033),('2033-05-25',203321,5,2033,25,21,203305,2033),('2033-05-26',203321,5,2033,26,21,203305,2033),('2033-05-27',203321,5,2033,27,21,203305,2033),('2033-05-28',203321,5,2033,28,21,203305,2033),('2033-05-29',203322,5,2033,29,22,203305,2033),('2033-05-30',203322,5,2033,30,22,203305,2033),('2033-05-31',203322,5,2033,31,22,203305,2033),('2033-06-01',203322,6,2033,1,22,203306,2033),('2033-06-02',203322,6,2033,2,22,203306,2033),('2033-06-03',203322,6,2033,3,22,203306,2033),('2033-06-04',203322,6,2033,4,22,203306,2033),('2033-06-05',203323,6,2033,5,23,203306,2033),('2033-06-06',203323,6,2033,6,23,203306,2033),('2033-06-07',203323,6,2033,7,23,203306,2033),('2033-06-08',203323,6,2033,8,23,203306,2033),('2033-06-09',203323,6,2033,9,23,203306,2033),('2033-06-10',203323,6,2033,10,23,203306,2033),('2033-06-11',203323,6,2033,11,23,203306,2033),('2033-06-12',203324,6,2033,12,24,203306,2033),('2033-06-13',203324,6,2033,13,24,203306,2033),('2033-06-14',203324,6,2033,14,24,203306,2033),('2033-06-15',203324,6,2033,15,24,203306,2033),('2033-06-16',203324,6,2033,16,24,203306,2033),('2033-06-17',203324,6,2033,17,24,203306,2033),('2033-06-18',203324,6,2033,18,24,203306,2033),('2033-06-19',203325,6,2033,19,25,203306,2033),('2033-06-20',203325,6,2033,20,25,203306,2033),('2033-06-21',203325,6,2033,21,25,203306,2033),('2033-06-22',203325,6,2033,22,25,203306,2033),('2033-06-23',203325,6,2033,23,25,203306,2033),('2033-06-24',203325,6,2033,24,25,203306,2033),('2033-06-25',203325,6,2033,25,25,203306,2033),('2033-06-26',203326,6,2033,26,26,203306,2033),('2033-06-27',203326,6,2033,27,26,203306,2033),('2033-06-28',203326,6,2033,28,26,203306,2033),('2033-06-29',203326,6,2033,29,26,203306,2033),('2033-06-30',203326,6,2033,30,26,203306,2033),('2033-07-01',203326,7,2033,1,26,203307,2033),('2033-07-02',203326,7,2033,2,26,203307,2033),('2033-07-03',203327,7,2033,3,27,203307,2033),('2033-07-04',203327,7,2033,4,27,203307,2033),('2033-07-05',203327,7,2033,5,27,203307,2033),('2033-07-06',203327,7,2033,6,27,203307,2033),('2033-07-07',203327,7,2033,7,27,203307,2033),('2033-07-08',203327,7,2033,8,27,203307,2033),('2033-07-09',203327,7,2033,9,27,203307,2033),('2033-07-10',203328,7,2033,10,28,203307,2033),('2033-07-11',203328,7,2033,11,28,203307,2033),('2033-07-12',203328,7,2033,12,28,203307,2033),('2033-07-13',203328,7,2033,13,28,203307,2033),('2033-07-14',203328,7,2033,14,28,203307,2033),('2033-07-15',203328,7,2033,15,28,203307,2033),('2033-07-16',203328,7,2033,16,28,203307,2033),('2033-07-17',203329,7,2033,17,29,203307,2033),('2033-07-18',203329,7,2033,18,29,203307,2033),('2033-07-19',203329,7,2033,19,29,203307,2033),('2033-07-20',203329,7,2033,20,29,203307,2033),('2033-07-21',203329,7,2033,21,29,203307,2033),('2033-07-22',203329,7,2033,22,29,203307,2033),('2033-07-23',203329,7,2033,23,29,203307,2033),('2033-07-24',203330,7,2033,24,30,203307,2033),('2033-07-25',203330,7,2033,25,30,203307,2033),('2033-07-26',203330,7,2033,26,30,203307,2033),('2033-07-27',203330,7,2033,27,30,203307,2033),('2033-07-28',203330,7,2033,28,30,203307,2033),('2033-07-29',203330,7,2033,29,30,203307,2033),('2033-07-30',203330,7,2033,30,30,203307,2033),('2033-07-31',203331,7,2033,31,31,203307,2033),('2033-08-01',203331,8,2033,1,31,203308,2033),('2033-08-02',203331,8,2033,2,31,203308,2033),('2033-08-03',203331,8,2033,3,31,203308,2033),('2033-08-04',203331,8,2033,4,31,203308,2033),('2033-08-05',203331,8,2033,5,31,203308,2033),('2033-08-06',203331,8,2033,6,31,203308,2033),('2033-08-07',203332,8,2033,7,32,203308,2033),('2033-08-08',203332,8,2033,8,32,203308,2033),('2033-08-09',203332,8,2033,9,32,203308,2033),('2033-08-10',203332,8,2033,10,32,203308,2033),('2033-08-11',203332,8,2033,11,32,203308,2033),('2033-08-12',203332,8,2033,12,32,203308,2033),('2033-08-13',203332,8,2033,13,32,203308,2033),('2033-08-14',203333,8,2033,14,33,203308,2033),('2033-08-15',203333,8,2033,15,33,203308,2033),('2033-08-16',203333,8,2033,16,33,203308,2033),('2033-08-17',203333,8,2033,17,33,203308,2033),('2033-08-18',203333,8,2033,18,33,203308,2033),('2033-08-19',203333,8,2033,19,33,203308,2033),('2033-08-20',203333,8,2033,20,33,203308,2033),('2033-08-21',203334,8,2033,21,34,203308,2033),('2033-08-22',203334,8,2033,22,34,203308,2033),('2033-08-23',203334,8,2033,23,34,203308,2033),('2033-08-24',203334,8,2033,24,34,203308,2033),('2033-08-25',203334,8,2033,25,34,203308,2033),('2033-08-26',203334,8,2033,26,34,203308,2033),('2033-08-27',203334,8,2033,27,34,203308,2033),('2033-08-28',203335,8,2033,28,35,203308,2033),('2033-08-29',203335,8,2033,29,35,203308,2033),('2033-08-30',203335,8,2033,30,35,203308,2033),('2033-08-31',203335,8,2033,31,35,203308,2033),('2033-09-01',203335,9,2033,1,35,203309,2033),('2033-09-02',203335,9,2033,2,35,203309,2033),('2033-09-03',203335,9,2033,3,35,203309,2033),('2033-09-04',203336,9,2033,4,36,203309,2033),('2033-09-05',203336,9,2033,5,36,203309,2033),('2033-09-06',203336,9,2033,6,36,203309,2033),('2033-09-07',203336,9,2033,7,36,203309,2033),('2033-09-08',203336,9,2033,8,36,203309,2033),('2033-09-09',203336,9,2033,9,36,203309,2033),('2033-09-10',203336,9,2033,10,36,203309,2033),('2033-09-11',203337,9,2033,11,37,203309,2033),('2033-09-12',203337,9,2033,12,37,203309,2033),('2033-09-13',203337,9,2033,13,37,203309,2033),('2033-09-14',203337,9,2033,14,37,203309,2033),('2033-09-15',203337,9,2033,15,37,203309,2033),('2033-09-16',203337,9,2033,16,37,203309,2033),('2033-09-17',203337,9,2033,17,37,203309,2033),('2033-09-18',203338,9,2033,18,38,203309,2033),('2033-09-19',203338,9,2033,19,38,203309,2033),('2033-09-20',203338,9,2033,20,38,203309,2033),('2033-09-21',203338,9,2033,21,38,203309,2033),('2033-09-22',203338,9,2033,22,38,203309,2033),('2033-09-23',203338,9,2033,23,38,203309,2033),('2033-09-24',203338,9,2033,24,38,203309,2033),('2033-09-25',203339,9,2033,25,39,203309,2033),('2033-09-26',203339,9,2033,26,39,203309,2033),('2033-09-27',203339,9,2033,27,39,203309,2033),('2033-09-28',203339,9,2033,28,39,203309,2033),('2033-09-29',203339,9,2033,29,39,203309,2033),('2033-09-30',203339,9,2033,30,39,203309,2033),('2033-10-01',203339,10,2033,1,39,203310,2033),('2033-10-02',203340,10,2033,2,40,203310,2033),('2033-10-03',203340,10,2033,3,40,203310,2033),('2033-10-04',203340,10,2033,4,40,203310,2033),('2033-10-05',203340,10,2033,5,40,203310,2033),('2033-10-06',203340,10,2033,6,40,203310,2033),('2033-10-07',203340,10,2033,7,40,203310,2033),('2033-10-08',203340,10,2033,8,40,203310,2033),('2033-10-09',203341,10,2033,9,41,203310,2033),('2033-10-10',203341,10,2033,10,41,203310,2033),('2033-10-11',203341,10,2033,11,41,203310,2033),('2033-10-12',203341,10,2033,12,41,203310,2033),('2033-10-13',203341,10,2033,13,41,203310,2033),('2033-10-14',203341,10,2033,14,41,203310,2033),('2033-10-15',203341,10,2033,15,41,203310,2033),('2033-10-16',203342,10,2033,16,42,203310,2033),('2033-10-17',203342,10,2033,17,42,203310,2033),('2033-10-18',203342,10,2033,18,42,203310,2033),('2033-10-19',203342,10,2033,19,42,203310,2033),('2033-10-20',203342,10,2033,20,42,203310,2033),('2033-10-21',203342,10,2033,21,42,203310,2033),('2033-10-22',203342,10,2033,22,42,203310,2033),('2033-10-23',203343,10,2033,23,43,203310,2033),('2033-10-24',203343,10,2033,24,43,203310,2033),('2033-10-25',203343,10,2033,25,43,203310,2033),('2033-10-26',203343,10,2033,26,43,203310,2033),('2033-10-27',203343,10,2033,27,43,203310,2033),('2033-10-28',203343,10,2033,28,43,203310,2033),('2033-10-29',203343,10,2033,29,43,203310,2033),('2033-10-30',203344,10,2033,30,44,203310,2033),('2033-10-31',203344,10,2033,31,44,203310,2033),('2033-11-01',203344,11,2033,1,44,203311,2033),('2033-11-02',203344,11,2033,2,44,203311,2033),('2033-11-03',203344,11,2033,3,44,203311,2033),('2033-11-04',203344,11,2033,4,44,203311,2033),('2033-11-05',203344,11,2033,5,44,203311,2033),('2033-11-06',203345,11,2033,6,45,203311,2033),('2033-11-07',203345,11,2033,7,45,203311,2033),('2033-11-08',203345,11,2033,8,45,203311,2033),('2033-11-09',203345,11,2033,9,45,203311,2033),('2033-11-10',203345,11,2033,10,45,203311,2033),('2033-11-11',203345,11,2033,11,45,203311,2033),('2033-11-12',203345,11,2033,12,45,203311,2033),('2033-11-13',203346,11,2033,13,46,203311,2033),('2033-11-14',203346,11,2033,14,46,203311,2033),('2033-11-15',203346,11,2033,15,46,203311,2033),('2033-11-16',203346,11,2033,16,46,203311,2033),('2033-11-17',203346,11,2033,17,46,203311,2033),('2033-11-18',203346,11,2033,18,46,203311,2033),('2033-11-19',203346,11,2033,19,46,203311,2033),('2033-11-20',203347,11,2033,20,47,203311,2033),('2033-11-21',203347,11,2033,21,47,203311,2033),('2033-11-22',203347,11,2033,22,47,203311,2033),('2033-11-23',203347,11,2033,23,47,203311,2033),('2033-11-24',203347,11,2033,24,47,203311,2033),('2033-11-25',203347,11,2033,25,47,203311,2033),('2033-11-26',203347,11,2033,26,47,203311,2033),('2033-11-27',203348,11,2033,27,48,203311,2033),('2033-11-28',203348,11,2033,28,48,203311,2033),('2033-11-29',203348,11,2033,29,48,203311,2033),('2033-11-30',203348,11,2033,30,48,203311,2033),('2033-12-01',203348,12,2033,1,48,203312,2034),('2033-12-02',203348,12,2033,2,48,203312,2034),('2033-12-03',203348,12,2033,3,48,203312,2034),('2033-12-04',203349,12,2033,4,49,203312,2034),('2033-12-05',203349,12,2033,5,49,203312,2034),('2033-12-06',203349,12,2033,6,49,203312,2034),('2033-12-07',203349,12,2033,7,49,203312,2034),('2033-12-08',203349,12,2033,8,49,203312,2034),('2033-12-09',203349,12,2033,9,49,203312,2034),('2033-12-10',203349,12,2033,10,49,203312,2034),('2033-12-11',203350,12,2033,11,50,203312,2034),('2033-12-12',203350,12,2033,12,50,203312,2034),('2033-12-13',203350,12,2033,13,50,203312,2034),('2033-12-14',203350,12,2033,14,50,203312,2034),('2033-12-15',203350,12,2033,15,50,203312,2034),('2033-12-16',203350,12,2033,16,50,203312,2034),('2033-12-17',203350,12,2033,17,50,203312,2034),('2033-12-18',203351,12,2033,18,51,203312,2034),('2033-12-19',203351,12,2033,19,51,203312,2034),('2033-12-20',203351,12,2033,20,51,203312,2034),('2033-12-21',203351,12,2033,21,51,203312,2034),('2033-12-22',203351,12,2033,22,51,203312,2034),('2033-12-23',203351,12,2033,23,51,203312,2034),('2033-12-24',203351,12,2033,24,51,203312,2034),('2033-12-25',203352,12,2033,25,52,203312,2034),('2033-12-26',203352,12,2033,26,52,203312,2034),('2033-12-27',203352,12,2033,27,52,203312,2034),('2033-12-28',203352,12,2033,28,52,203312,2034),('2033-12-29',203352,12,2033,29,52,203312,2034),('2033-12-30',203352,12,2033,30,52,203312,2034),('2033-12-31',203352,12,2033,31,52,203312,2034),('2034-01-01',203453,1,2034,1,1,203401,2034),('2034-01-02',203401,1,2034,2,1,203401,2034),('2034-01-03',203401,1,2034,3,1,203401,2034),('2034-01-04',203401,1,2034,4,1,203401,2034),('2034-01-05',203401,1,2034,5,1,203401,2034),('2034-01-06',203401,1,2034,6,1,203401,2034),('2034-01-07',203401,1,2034,7,1,203401,2034),('2034-01-08',203402,1,2034,8,2,203401,2034),('2034-01-09',203402,1,2034,9,2,203401,2034),('2034-01-10',203402,1,2034,10,2,203401,2034),('2034-01-11',203402,1,2034,11,2,203401,2034),('2034-01-12',203402,1,2034,12,2,203401,2034),('2034-01-13',203402,1,2034,13,2,203401,2034),('2034-01-14',203402,1,2034,14,2,203401,2034),('2034-01-15',203403,1,2034,15,3,203401,2034),('2034-01-16',203403,1,2034,16,3,203401,2034),('2034-01-17',203403,1,2034,17,3,203401,2034),('2034-01-18',203403,1,2034,18,3,203401,2034),('2034-01-19',203403,1,2034,19,3,203401,2034),('2034-01-20',203403,1,2034,20,3,203401,2034),('2034-01-21',203403,1,2034,21,3,203401,2034),('2034-01-22',203404,1,2034,22,4,203401,2034),('2034-01-23',203404,1,2034,23,4,203401,2034),('2034-01-24',203404,1,2034,24,4,203401,2034),('2034-01-25',203404,1,2034,25,4,203401,2034),('2034-01-26',203404,1,2034,26,4,203401,2034),('2034-01-27',203404,1,2034,27,4,203401,2034),('2034-01-28',203404,1,2034,28,4,203401,2034),('2034-01-29',203405,1,2034,29,5,203401,2034),('2034-01-30',203405,1,2034,30,5,203401,2034),('2034-01-31',203405,1,2034,31,5,203401,2034),('2034-02-01',203405,2,2034,1,5,203402,2034),('2034-02-02',203405,2,2034,2,5,203402,2034),('2034-02-03',203405,2,2034,3,5,203402,2034),('2034-02-04',203405,2,2034,4,5,203402,2034),('2034-02-05',203406,2,2034,5,6,203402,2034),('2034-02-06',203406,2,2034,6,6,203402,2034),('2034-02-07',203406,2,2034,7,6,203402,2034),('2034-02-08',203406,2,2034,8,6,203402,2034),('2034-02-09',203406,2,2034,9,6,203402,2034),('2034-02-10',203406,2,2034,10,6,203402,2034),('2034-02-11',203406,2,2034,11,6,203402,2034),('2034-02-12',203407,2,2034,12,7,203402,2034),('2034-02-13',203407,2,2034,13,7,203402,2034),('2034-02-14',203407,2,2034,14,7,203402,2034),('2034-02-15',203407,2,2034,15,7,203402,2034),('2034-02-16',203407,2,2034,16,7,203402,2034),('2034-02-17',203407,2,2034,17,7,203402,2034),('2034-02-18',203407,2,2034,18,7,203402,2034),('2034-02-19',203408,2,2034,19,8,203402,2034),('2034-02-20',203408,2,2034,20,8,203402,2034),('2034-02-21',203408,2,2034,21,8,203402,2034),('2034-02-22',203408,2,2034,22,8,203402,2034),('2034-02-23',203408,2,2034,23,8,203402,2034),('2034-02-24',203408,2,2034,24,8,203402,2034),('2034-02-25',203408,2,2034,25,8,203402,2034),('2034-02-26',203409,2,2034,26,9,203402,2034),('2034-02-27',203409,2,2034,27,9,203402,2034),('2034-02-28',203409,2,2034,28,9,203402,2034),('2034-03-01',203409,3,2034,1,9,203403,2034),('2034-03-02',203409,3,2034,2,9,203403,2034),('2034-03-03',203409,3,2034,3,9,203403,2034),('2034-03-04',203409,3,2034,4,9,203403,2034),('2034-03-05',203410,3,2034,5,10,203403,2034),('2034-03-06',203410,3,2034,6,10,203403,2034),('2034-03-07',203410,3,2034,7,10,203403,2034),('2034-03-08',203410,3,2034,8,10,203403,2034),('2034-03-09',203410,3,2034,9,10,203403,2034),('2034-03-10',203410,3,2034,10,10,203403,2034),('2034-03-11',203410,3,2034,11,10,203403,2034),('2034-03-12',203411,3,2034,12,11,203403,2034),('2034-03-13',203411,3,2034,13,11,203403,2034),('2034-03-14',203411,3,2034,14,11,203403,2034),('2034-03-15',203411,3,2034,15,11,203403,2034),('2034-03-16',203411,3,2034,16,11,203403,2034),('2034-03-17',203411,3,2034,17,11,203403,2034),('2034-03-18',203411,3,2034,18,11,203403,2034),('2034-03-19',203412,3,2034,19,12,203403,2034),('2034-03-20',203412,3,2034,20,12,203403,2034),('2034-03-21',203412,3,2034,21,12,203403,2034),('2034-03-22',203412,3,2034,22,12,203403,2034),('2034-03-23',203412,3,2034,23,12,203403,2034),('2034-03-24',203412,3,2034,24,12,203403,2034),('2034-03-25',203412,3,2034,25,12,203403,2034),('2034-03-26',203413,3,2034,26,13,203403,2034),('2034-03-27',203413,3,2034,27,13,203403,2034),('2034-03-28',203413,3,2034,28,13,203403,2034),('2034-03-29',203413,3,2034,29,13,203403,2034),('2034-03-30',203413,3,2034,30,13,203403,2034),('2034-03-31',203413,3,2034,31,13,203403,2034),('2034-04-01',203413,4,2034,1,13,203404,2034),('2034-04-02',203414,4,2034,2,14,203404,2034),('2034-04-03',203414,4,2034,3,14,203404,2034),('2034-04-04',203414,4,2034,4,14,203404,2034),('2034-04-05',203414,4,2034,5,14,203404,2034),('2034-04-06',203414,4,2034,6,14,203404,2034),('2034-04-07',203414,4,2034,7,14,203404,2034),('2034-04-08',203414,4,2034,8,14,203404,2034),('2034-04-09',203415,4,2034,9,15,203404,2034),('2034-04-10',203415,4,2034,10,15,203404,2034),('2034-04-11',203415,4,2034,11,15,203404,2034),('2034-04-12',203415,4,2034,12,15,203404,2034),('2034-04-13',203415,4,2034,13,15,203404,2034),('2034-04-14',203415,4,2034,14,15,203404,2034),('2034-04-15',203415,4,2034,15,15,203404,2034),('2034-04-16',203416,4,2034,16,16,203404,2034),('2034-04-17',203416,4,2034,17,16,203404,2034),('2034-04-18',203416,4,2034,18,16,203404,2034),('2034-04-19',203416,4,2034,19,16,203404,2034),('2034-04-20',203416,4,2034,20,16,203404,2034),('2034-04-21',203416,4,2034,21,16,203404,2034),('2034-04-22',203416,4,2034,22,16,203404,2034),('2034-04-23',203417,4,2034,23,17,203404,2034),('2034-04-24',203417,4,2034,24,17,203404,2034),('2034-04-25',203417,4,2034,25,17,203404,2034),('2034-04-26',203417,4,2034,26,17,203404,2034),('2034-04-27',203417,4,2034,27,17,203404,2034),('2034-04-28',203417,4,2034,28,17,203404,2034),('2034-04-29',203417,4,2034,29,17,203404,2034),('2034-04-30',203418,4,2034,30,18,203404,2034),('2034-05-01',203418,5,2034,1,18,203405,2034),('2034-05-02',203418,5,2034,2,18,203405,2034),('2034-05-03',203418,5,2034,3,18,203405,2034),('2034-05-04',203418,5,2034,4,18,203405,2034),('2034-05-05',203418,5,2034,5,18,203405,2034),('2034-05-06',203418,5,2034,6,18,203405,2034),('2034-05-07',203419,5,2034,7,19,203405,2034),('2034-05-08',203419,5,2034,8,19,203405,2034),('2034-05-09',203419,5,2034,9,19,203405,2034),('2034-05-10',203419,5,2034,10,19,203405,2034),('2034-05-11',203419,5,2034,11,19,203405,2034),('2034-05-12',203419,5,2034,12,19,203405,2034),('2034-05-13',203419,5,2034,13,19,203405,2034),('2034-05-14',203420,5,2034,14,20,203405,2034),('2034-05-15',203420,5,2034,15,20,203405,2034),('2034-05-16',203420,5,2034,16,20,203405,2034),('2034-05-17',203420,5,2034,17,20,203405,2034),('2034-05-18',203420,5,2034,18,20,203405,2034),('2034-05-19',203420,5,2034,19,20,203405,2034),('2034-05-20',203420,5,2034,20,20,203405,2034),('2034-05-21',203421,5,2034,21,21,203405,2034),('2034-05-22',203421,5,2034,22,21,203405,2034),('2034-05-23',203421,5,2034,23,21,203405,2034),('2034-05-24',203421,5,2034,24,21,203405,2034),('2034-05-25',203421,5,2034,25,21,203405,2034),('2034-05-26',203421,5,2034,26,21,203405,2034),('2034-05-27',203421,5,2034,27,21,203405,2034),('2034-05-28',203422,5,2034,28,22,203405,2034),('2034-05-29',203422,5,2034,29,22,203405,2034),('2034-05-30',203422,5,2034,30,22,203405,2034),('2034-05-31',203422,5,2034,31,22,203405,2034),('2034-06-01',203422,6,2034,1,22,203406,2034),('2034-06-02',203422,6,2034,2,22,203406,2034),('2034-06-03',203422,6,2034,3,22,203406,2034),('2034-06-04',203423,6,2034,4,23,203406,2034),('2034-06-05',203423,6,2034,5,23,203406,2034),('2034-06-06',203423,6,2034,6,23,203406,2034),('2034-06-07',203423,6,2034,7,23,203406,2034),('2034-06-08',203423,6,2034,8,23,203406,2034),('2034-06-09',203423,6,2034,9,23,203406,2034),('2034-06-10',203423,6,2034,10,23,203406,2034),('2034-06-11',203424,6,2034,11,24,203406,2034),('2034-06-12',203424,6,2034,12,24,203406,2034),('2034-06-13',203424,6,2034,13,24,203406,2034),('2034-06-14',203424,6,2034,14,24,203406,2034),('2034-06-15',203424,6,2034,15,24,203406,2034),('2034-06-16',203424,6,2034,16,24,203406,2034),('2034-06-17',203424,6,2034,17,24,203406,2034),('2034-06-18',203425,6,2034,18,25,203406,2034),('2034-06-19',203425,6,2034,19,25,203406,2034),('2034-06-20',203425,6,2034,20,25,203406,2034),('2034-06-21',203425,6,2034,21,25,203406,2034),('2034-06-22',203425,6,2034,22,25,203406,2034),('2034-06-23',203425,6,2034,23,25,203406,2034),('2034-06-24',203425,6,2034,24,25,203406,2034),('2034-06-25',203426,6,2034,25,26,203406,2034),('2034-06-26',203426,6,2034,26,26,203406,2034),('2034-06-27',203426,6,2034,27,26,203406,2034),('2034-06-28',203426,6,2034,28,26,203406,2034),('2034-06-29',203426,6,2034,29,26,203406,2034),('2034-06-30',203426,6,2034,30,26,203406,2034),('2034-07-01',203426,7,2034,1,26,203407,2034),('2034-07-02',203427,7,2034,2,27,203407,2034),('2034-07-03',203427,7,2034,3,27,203407,2034),('2034-07-04',203427,7,2034,4,27,203407,2034),('2034-07-05',203427,7,2034,5,27,203407,2034),('2034-07-06',203427,7,2034,6,27,203407,2034),('2034-07-07',203427,7,2034,7,27,203407,2034),('2034-07-08',203427,7,2034,8,27,203407,2034),('2034-07-09',203428,7,2034,9,28,203407,2034),('2034-07-10',203428,7,2034,10,28,203407,2034),('2034-07-11',203428,7,2034,11,28,203407,2034),('2034-07-12',203428,7,2034,12,28,203407,2034),('2034-07-13',203428,7,2034,13,28,203407,2034),('2034-07-14',203428,7,2034,14,28,203407,2034),('2034-07-15',203428,7,2034,15,28,203407,2034),('2034-07-16',203429,7,2034,16,29,203407,2034),('2034-07-17',203429,7,2034,17,29,203407,2034),('2034-07-18',203429,7,2034,18,29,203407,2034),('2034-07-19',203429,7,2034,19,29,203407,2034),('2034-07-20',203429,7,2034,20,29,203407,2034),('2034-07-21',203429,7,2034,21,29,203407,2034),('2034-07-22',203429,7,2034,22,29,203407,2034),('2034-07-23',203430,7,2034,23,30,203407,2034),('2034-07-24',203430,7,2034,24,30,203407,2034),('2034-07-25',203430,7,2034,25,30,203407,2034),('2034-07-26',203430,7,2034,26,30,203407,2034),('2034-07-27',203430,7,2034,27,30,203407,2034),('2034-07-28',203430,7,2034,28,30,203407,2034),('2034-07-29',203430,7,2034,29,30,203407,2034),('2034-07-30',203431,7,2034,30,31,203407,2034),('2034-07-31',203431,7,2034,31,31,203407,2034),('2034-08-01',203431,8,2034,1,31,203408,2034),('2034-08-02',203431,8,2034,2,31,203408,2034),('2034-08-03',203431,8,2034,3,31,203408,2034),('2034-08-04',203431,8,2034,4,31,203408,2034),('2034-08-05',203431,8,2034,5,31,203408,2034),('2034-08-06',203432,8,2034,6,32,203408,2034),('2034-08-07',203432,8,2034,7,32,203408,2034),('2034-08-08',203432,8,2034,8,32,203408,2034),('2034-08-09',203432,8,2034,9,32,203408,2034),('2034-08-10',203432,8,2034,10,32,203408,2034),('2034-08-11',203432,8,2034,11,32,203408,2034),('2034-08-12',203432,8,2034,12,32,203408,2034),('2034-08-13',203433,8,2034,13,33,203408,2034),('2034-08-14',203433,8,2034,14,33,203408,2034),('2034-08-15',203433,8,2034,15,33,203408,2034),('2034-08-16',203433,8,2034,16,33,203408,2034),('2034-08-17',203433,8,2034,17,33,203408,2034),('2034-08-18',203433,8,2034,18,33,203408,2034),('2034-08-19',203433,8,2034,19,33,203408,2034),('2034-08-20',203434,8,2034,20,34,203408,2034),('2034-08-21',203434,8,2034,21,34,203408,2034),('2034-08-22',203434,8,2034,22,34,203408,2034),('2034-08-23',203434,8,2034,23,34,203408,2034),('2034-08-24',203434,8,2034,24,34,203408,2034),('2034-08-25',203434,8,2034,25,34,203408,2034),('2034-08-26',203434,8,2034,26,34,203408,2034),('2034-08-27',203435,8,2034,27,35,203408,2034),('2034-08-28',203435,8,2034,28,35,203408,2034),('2034-08-29',203435,8,2034,29,35,203408,2034),('2034-08-30',203435,8,2034,30,35,203408,2034),('2034-08-31',203435,8,2034,31,35,203408,2034),('2034-09-01',203435,9,2034,1,35,203409,2034),('2034-09-02',203435,9,2034,2,35,203409,2034),('2034-09-03',203436,9,2034,3,36,203409,2034),('2034-09-04',203436,9,2034,4,36,203409,2034),('2034-09-05',203436,9,2034,5,36,203409,2034),('2034-09-06',203436,9,2034,6,36,203409,2034),('2034-09-07',203436,9,2034,7,36,203409,2034),('2034-09-08',203436,9,2034,8,36,203409,2034),('2034-09-09',203436,9,2034,9,36,203409,2034),('2034-09-10',203437,9,2034,10,37,203409,2034),('2034-09-11',203437,9,2034,11,37,203409,2034),('2034-09-12',203437,9,2034,12,37,203409,2034),('2034-09-13',203437,9,2034,13,37,203409,2034),('2034-09-14',203437,9,2034,14,37,203409,2034),('2034-09-15',203437,9,2034,15,37,203409,2034),('2034-09-16',203437,9,2034,16,37,203409,2034),('2034-09-17',203438,9,2034,17,38,203409,2034),('2034-09-18',203438,9,2034,18,38,203409,2034),('2034-09-19',203438,9,2034,19,38,203409,2034),('2034-09-20',203438,9,2034,20,38,203409,2034),('2034-09-21',203438,9,2034,21,38,203409,2034),('2034-09-22',203438,9,2034,22,38,203409,2034),('2034-09-23',203438,9,2034,23,38,203409,2034),('2034-09-24',203439,9,2034,24,39,203409,2034),('2034-09-25',203439,9,2034,25,39,203409,2034),('2034-09-26',203439,9,2034,26,39,203409,2034),('2034-09-27',203439,9,2034,27,39,203409,2034),('2034-09-28',203439,9,2034,28,39,203409,2034),('2034-09-29',203439,9,2034,29,39,203409,2034),('2034-09-30',203439,9,2034,30,39,203409,2034),('2034-10-01',203440,10,2034,1,40,203410,2034),('2034-10-02',203440,10,2034,2,40,203410,2034),('2034-10-03',203440,10,2034,3,40,203410,2034),('2034-10-04',203440,10,2034,4,40,203410,2034),('2034-10-05',203440,10,2034,5,40,203410,2034),('2034-10-06',203440,10,2034,6,40,203410,2034),('2034-10-07',203440,10,2034,7,40,203410,2034),('2034-10-08',203441,10,2034,8,41,203410,2034),('2034-10-09',203441,10,2034,9,41,203410,2034),('2034-10-10',203441,10,2034,10,41,203410,2034),('2034-10-11',203441,10,2034,11,41,203410,2034),('2034-10-12',203441,10,2034,12,41,203410,2034),('2034-10-13',203441,10,2034,13,41,203410,2034),('2034-10-14',203441,10,2034,14,41,203410,2034),('2034-10-15',203442,10,2034,15,42,203410,2034),('2034-10-16',203442,10,2034,16,42,203410,2034),('2034-10-17',203442,10,2034,17,42,203410,2034),('2034-10-18',203442,10,2034,18,42,203410,2034),('2034-10-19',203442,10,2034,19,42,203410,2034),('2034-10-20',203442,10,2034,20,42,203410,2034),('2034-10-21',203442,10,2034,21,42,203410,2034),('2034-10-22',203443,10,2034,22,43,203410,2034),('2034-10-23',203443,10,2034,23,43,203410,2034),('2034-10-24',203443,10,2034,24,43,203410,2034),('2034-10-25',203443,10,2034,25,43,203410,2034),('2034-10-26',203443,10,2034,26,43,203410,2034),('2034-10-27',203443,10,2034,27,43,203410,2034),('2034-10-28',203443,10,2034,28,43,203410,2034),('2034-10-29',203444,10,2034,29,44,203410,2034),('2034-10-30',203444,10,2034,30,44,203410,2034),('2034-10-31',203444,10,2034,31,44,203410,2034),('2034-11-01',203444,11,2034,1,44,203411,2034),('2034-11-02',203444,11,2034,2,44,203411,2034),('2034-11-03',203444,11,2034,3,44,203411,2034),('2034-11-04',203444,11,2034,4,44,203411,2034),('2034-11-05',203445,11,2034,5,45,203411,2034),('2034-11-06',203445,11,2034,6,45,203411,2034),('2034-11-07',203445,11,2034,7,45,203411,2034),('2034-11-08',203445,11,2034,8,45,203411,2034),('2034-11-09',203445,11,2034,9,45,203411,2034),('2034-11-10',203445,11,2034,10,45,203411,2034),('2034-11-11',203445,11,2034,11,45,203411,2034),('2034-11-12',203446,11,2034,12,46,203411,2034),('2034-11-13',203446,11,2034,13,46,203411,2034),('2034-11-14',203446,11,2034,14,46,203411,2034),('2034-11-15',203446,11,2034,15,46,203411,2034),('2034-11-16',203446,11,2034,16,46,203411,2034),('2034-11-17',203446,11,2034,17,46,203411,2034),('2034-11-18',203446,11,2034,18,46,203411,2034),('2034-11-19',203447,11,2034,19,47,203411,2034),('2034-11-20',203447,11,2034,20,47,203411,2034),('2034-11-21',203447,11,2034,21,47,203411,2034),('2034-11-22',203447,11,2034,22,47,203411,2034),('2034-11-23',203447,11,2034,23,47,203411,2034),('2034-11-24',203447,11,2034,24,47,203411,2034),('2034-11-25',203447,11,2034,25,47,203411,2034),('2034-11-26',203448,11,2034,26,48,203411,2034),('2034-11-27',203448,11,2034,27,48,203411,2034),('2034-11-28',203448,11,2034,28,48,203411,2034),('2034-11-29',203448,11,2034,29,48,203411,2034),('2034-11-30',203448,11,2034,30,48,203411,2034),('2034-12-01',203448,12,2034,1,48,203412,2035),('2034-12-02',203448,12,2034,2,48,203412,2035),('2034-12-03',203449,12,2034,3,49,203412,2035),('2034-12-04',203449,12,2034,4,49,203412,2035),('2034-12-05',203449,12,2034,5,49,203412,2035),('2034-12-06',203449,12,2034,6,49,203412,2035),('2034-12-07',203449,12,2034,7,49,203412,2035),('2034-12-08',203449,12,2034,8,49,203412,2035),('2034-12-09',203449,12,2034,9,49,203412,2035),('2034-12-10',203450,12,2034,10,50,203412,2035),('2034-12-11',203450,12,2034,11,50,203412,2035),('2034-12-12',203450,12,2034,12,50,203412,2035),('2034-12-13',203450,12,2034,13,50,203412,2035),('2034-12-14',203450,12,2034,14,50,203412,2035),('2034-12-15',203450,12,2034,15,50,203412,2035),('2034-12-16',203450,12,2034,16,50,203412,2035),('2034-12-17',203451,12,2034,17,51,203412,2035),('2034-12-18',203451,12,2034,18,51,203412,2035),('2034-12-19',203451,12,2034,19,51,203412,2035),('2034-12-20',203451,12,2034,20,51,203412,2035),('2034-12-21',203451,12,2034,21,51,203412,2035),('2034-12-22',203451,12,2034,22,51,203412,2035),('2034-12-23',203451,12,2034,23,51,203412,2035),('2034-12-24',203452,12,2034,24,52,203412,2035),('2034-12-25',203452,12,2034,25,52,203412,2035),('2034-12-26',203452,12,2034,26,52,203412,2035),('2034-12-27',203452,12,2034,27,52,203412,2035),('2034-12-28',203452,12,2034,28,52,203412,2035),('2034-12-29',203452,12,2034,29,52,203412,2035),('2034-12-30',203452,12,2034,30,52,203412,2035),('2034-12-31',203453,12,2034,31,1,203412,2035),('2035-01-01',203501,1,2035,1,1,203501,2035),('2035-01-02',203501,1,2035,2,1,203501,2035),('2035-01-03',203501,1,2035,3,1,203501,2035),('2035-01-04',203501,1,2035,4,1,203501,2035),('2035-01-05',203501,1,2035,5,1,203501,2035),('2035-01-06',203501,1,2035,6,1,203501,2035),('2035-01-07',203502,1,2035,7,2,203501,2035),('2035-01-08',203502,1,2035,8,2,203501,2035),('2035-01-09',203502,1,2035,9,2,203501,2035),('2035-01-10',203502,1,2035,10,2,203501,2035),('2035-01-11',203502,1,2035,11,2,203501,2035),('2035-01-12',203502,1,2035,12,2,203501,2035),('2035-01-13',203502,1,2035,13,2,203501,2035),('2035-01-14',203503,1,2035,14,3,203501,2035),('2035-01-15',203503,1,2035,15,3,203501,2035),('2035-01-16',203503,1,2035,16,3,203501,2035),('2035-01-17',203503,1,2035,17,3,203501,2035),('2035-01-18',203503,1,2035,18,3,203501,2035),('2035-01-19',203503,1,2035,19,3,203501,2035),('2035-01-20',203503,1,2035,20,3,203501,2035),('2035-01-21',203504,1,2035,21,4,203501,2035),('2035-01-22',203504,1,2035,22,4,203501,2035),('2035-01-23',203504,1,2035,23,4,203501,2035),('2035-01-24',203504,1,2035,24,4,203501,2035),('2035-01-25',203504,1,2035,25,4,203501,2035),('2035-01-26',203504,1,2035,26,4,203501,2035),('2035-01-27',203504,1,2035,27,4,203501,2035),('2035-01-28',203505,1,2035,28,5,203501,2035),('2035-01-29',203505,1,2035,29,5,203501,2035),('2035-01-30',203505,1,2035,30,5,203501,2035),('2035-01-31',203505,1,2035,31,5,203501,2035),('2035-02-01',203505,2,2035,1,5,203502,2035),('2035-02-02',203505,2,2035,2,5,203502,2035),('2035-02-03',203505,2,2035,3,5,203502,2035),('2035-02-04',203506,2,2035,4,6,203502,2035),('2035-02-05',203506,2,2035,5,6,203502,2035),('2035-02-06',203506,2,2035,6,6,203502,2035),('2035-02-07',203506,2,2035,7,6,203502,2035),('2035-02-08',203506,2,2035,8,6,203502,2035),('2035-02-09',203506,2,2035,9,6,203502,2035),('2035-02-10',203506,2,2035,10,6,203502,2035),('2035-02-11',203507,2,2035,11,7,203502,2035),('2035-02-12',203507,2,2035,12,7,203502,2035),('2035-02-13',203507,2,2035,13,7,203502,2035),('2035-02-14',203507,2,2035,14,7,203502,2035),('2035-02-15',203507,2,2035,15,7,203502,2035),('2035-02-16',203507,2,2035,16,7,203502,2035),('2035-02-17',203507,2,2035,17,7,203502,2035),('2035-02-18',203508,2,2035,18,8,203502,2035),('2035-02-19',203508,2,2035,19,8,203502,2035),('2035-02-20',203508,2,2035,20,8,203502,2035),('2035-02-21',203508,2,2035,21,8,203502,2035),('2035-02-22',203508,2,2035,22,8,203502,2035),('2035-02-23',203508,2,2035,23,8,203502,2035),('2035-02-24',203508,2,2035,24,8,203502,2035),('2035-02-25',203509,2,2035,25,9,203502,2035),('2035-02-26',203509,2,2035,26,9,203502,2035),('2035-02-27',203509,2,2035,27,9,203502,2035),('2035-02-28',203509,2,2035,28,9,203502,2035),('2035-03-01',203509,3,2035,1,9,203503,2035),('2035-03-02',203509,3,2035,2,9,203503,2035),('2035-03-03',203509,3,2035,3,9,203503,2035),('2035-03-04',203510,3,2035,4,10,203503,2035),('2035-03-05',203510,3,2035,5,10,203503,2035),('2035-03-06',203510,3,2035,6,10,203503,2035),('2035-03-07',203510,3,2035,7,10,203503,2035),('2035-03-08',203510,3,2035,8,10,203503,2035),('2035-03-09',203510,3,2035,9,10,203503,2035),('2035-03-10',203510,3,2035,10,10,203503,2035),('2035-03-11',203511,3,2035,11,11,203503,2035),('2035-03-12',203511,3,2035,12,11,203503,2035),('2035-03-13',203511,3,2035,13,11,203503,2035),('2035-03-14',203511,3,2035,14,11,203503,2035),('2035-03-15',203511,3,2035,15,11,203503,2035),('2035-03-16',203511,3,2035,16,11,203503,2035),('2035-03-17',203511,3,2035,17,11,203503,2035),('2035-03-18',203512,3,2035,18,12,203503,2035),('2035-03-19',203512,3,2035,19,12,203503,2035),('2035-03-20',203512,3,2035,20,12,203503,2035),('2035-03-21',203512,3,2035,21,12,203503,2035),('2035-03-22',203512,3,2035,22,12,203503,2035),('2035-03-23',203512,3,2035,23,12,203503,2035),('2035-03-24',203512,3,2035,24,12,203503,2035),('2035-03-25',203513,3,2035,25,13,203503,2035),('2035-03-26',203513,3,2035,26,13,203503,2035),('2035-03-27',203513,3,2035,27,13,203503,2035),('2035-03-28',203513,3,2035,28,13,203503,2035),('2035-03-29',203513,3,2035,29,13,203503,2035),('2035-03-30',203513,3,2035,30,13,203503,2035),('2035-03-31',203513,3,2035,31,13,203503,2035),('2035-04-01',203514,4,2035,1,14,203504,2035),('2035-04-02',203514,4,2035,2,14,203504,2035),('2035-04-03',203514,4,2035,3,14,203504,2035),('2035-04-04',203514,4,2035,4,14,203504,2035),('2035-04-05',203514,4,2035,5,14,203504,2035),('2035-04-06',203514,4,2035,6,14,203504,2035),('2035-04-07',203514,4,2035,7,14,203504,2035),('2035-04-08',203515,4,2035,8,15,203504,2035),('2035-04-09',203515,4,2035,9,15,203504,2035),('2035-04-10',203515,4,2035,10,15,203504,2035),('2035-04-11',203515,4,2035,11,15,203504,2035),('2035-04-12',203515,4,2035,12,15,203504,2035),('2035-04-13',203515,4,2035,13,15,203504,2035),('2035-04-14',203515,4,2035,14,15,203504,2035),('2035-04-15',203516,4,2035,15,16,203504,2035),('2035-04-16',203516,4,2035,16,16,203504,2035),('2035-04-17',203516,4,2035,17,16,203504,2035),('2035-04-18',203516,4,2035,18,16,203504,2035),('2035-04-19',203516,4,2035,19,16,203504,2035),('2035-04-20',203516,4,2035,20,16,203504,2035),('2035-04-21',203516,4,2035,21,16,203504,2035),('2035-04-22',203517,4,2035,22,17,203504,2035),('2035-04-23',203517,4,2035,23,17,203504,2035),('2035-04-24',203517,4,2035,24,17,203504,2035),('2035-04-25',203517,4,2035,25,17,203504,2035),('2035-04-26',203517,4,2035,26,17,203504,2035),('2035-04-27',203517,4,2035,27,17,203504,2035),('2035-04-28',203517,4,2035,28,17,203504,2035),('2035-04-29',203518,4,2035,29,18,203504,2035),('2035-04-30',203518,4,2035,30,18,203504,2035),('2035-05-01',203518,5,2035,1,18,203505,2035),('2035-05-02',203518,5,2035,2,18,203505,2035),('2035-05-03',203518,5,2035,3,18,203505,2035),('2035-05-04',203518,5,2035,4,18,203505,2035),('2035-05-05',203518,5,2035,5,18,203505,2035),('2035-05-06',203519,5,2035,6,19,203505,2035),('2035-05-07',203519,5,2035,7,19,203505,2035),('2035-05-08',203519,5,2035,8,19,203505,2035),('2035-05-09',203519,5,2035,9,19,203505,2035),('2035-05-10',203519,5,2035,10,19,203505,2035),('2035-05-11',203519,5,2035,11,19,203505,2035),('2035-05-12',203519,5,2035,12,19,203505,2035),('2035-05-13',203520,5,2035,13,20,203505,2035),('2035-05-14',203520,5,2035,14,20,203505,2035),('2035-05-15',203520,5,2035,15,20,203505,2035),('2035-05-16',203520,5,2035,16,20,203505,2035),('2035-05-17',203520,5,2035,17,20,203505,2035),('2035-05-18',203520,5,2035,18,20,203505,2035),('2035-05-19',203520,5,2035,19,20,203505,2035),('2035-05-20',203521,5,2035,20,21,203505,2035),('2035-05-21',203521,5,2035,21,21,203505,2035),('2035-05-22',203521,5,2035,22,21,203505,2035),('2035-05-23',203521,5,2035,23,21,203505,2035),('2035-05-24',203521,5,2035,24,21,203505,2035),('2035-05-25',203521,5,2035,25,21,203505,2035),('2035-05-26',203521,5,2035,26,21,203505,2035),('2035-05-27',203522,5,2035,27,22,203505,2035),('2035-05-28',203522,5,2035,28,22,203505,2035),('2035-05-29',203522,5,2035,29,22,203505,2035),('2035-05-30',203522,5,2035,30,22,203505,2035),('2035-05-31',203522,5,2035,31,22,203505,2035),('2035-06-01',203522,6,2035,1,22,203506,2035),('2035-06-02',203522,6,2035,2,22,203506,2035),('2035-06-03',203523,6,2035,3,23,203506,2035),('2035-06-04',203523,6,2035,4,23,203506,2035),('2035-06-05',203523,6,2035,5,23,203506,2035),('2035-06-06',203523,6,2035,6,23,203506,2035),('2035-06-07',203523,6,2035,7,23,203506,2035),('2035-06-08',203523,6,2035,8,23,203506,2035),('2035-06-09',203523,6,2035,9,23,203506,2035),('2035-06-10',203524,6,2035,10,24,203506,2035),('2035-06-11',203524,6,2035,11,24,203506,2035),('2035-06-12',203524,6,2035,12,24,203506,2035),('2035-06-13',203524,6,2035,13,24,203506,2035),('2035-06-14',203524,6,2035,14,24,203506,2035),('2035-06-15',203524,6,2035,15,24,203506,2035),('2035-06-16',203524,6,2035,16,24,203506,2035),('2035-06-17',203525,6,2035,17,25,203506,2035),('2035-06-18',203525,6,2035,18,25,203506,2035),('2035-06-19',203525,6,2035,19,25,203506,2035),('2035-06-20',203525,6,2035,20,25,203506,2035),('2035-06-21',203525,6,2035,21,25,203506,2035),('2035-06-22',203525,6,2035,22,25,203506,2035),('2035-06-23',203525,6,2035,23,25,203506,2035),('2035-06-24',203526,6,2035,24,26,203506,2035),('2035-06-25',203526,6,2035,25,26,203506,2035),('2035-06-26',203526,6,2035,26,26,203506,2035),('2035-06-27',203526,6,2035,27,26,203506,2035),('2035-06-28',203526,6,2035,28,26,203506,2035),('2035-06-29',203526,6,2035,29,26,203506,2035),('2035-06-30',203526,6,2035,30,26,203506,2035),('2035-07-01',203527,7,2035,1,27,203507,2035),('2035-07-02',203527,7,2035,2,27,203507,2035),('2035-07-03',203527,7,2035,3,27,203507,2035),('2035-07-04',203527,7,2035,4,27,203507,2035),('2035-07-05',203527,7,2035,5,27,203507,2035),('2035-07-06',203527,7,2035,6,27,203507,2035),('2035-07-07',203527,7,2035,7,27,203507,2035),('2035-07-08',203528,7,2035,8,28,203507,2035),('2035-07-09',203528,7,2035,9,28,203507,2035),('2035-07-10',203528,7,2035,10,28,203507,2035),('2035-07-11',203528,7,2035,11,28,203507,2035),('2035-07-12',203528,7,2035,12,28,203507,2035),('2035-07-13',203528,7,2035,13,28,203507,2035),('2035-07-14',203528,7,2035,14,28,203507,2035),('2035-07-15',203529,7,2035,15,29,203507,2035),('2035-07-16',203529,7,2035,16,29,203507,2035),('2035-07-17',203529,7,2035,17,29,203507,2035),('2035-07-18',203529,7,2035,18,29,203507,2035),('2035-07-19',203529,7,2035,19,29,203507,2035),('2035-07-20',203529,7,2035,20,29,203507,2035),('2035-07-21',203529,7,2035,21,29,203507,2035),('2035-07-22',203530,7,2035,22,30,203507,2035),('2035-07-23',203530,7,2035,23,30,203507,2035),('2035-07-24',203530,7,2035,24,30,203507,2035),('2035-07-25',203530,7,2035,25,30,203507,2035),('2035-07-26',203530,7,2035,26,30,203507,2035),('2035-07-27',203530,7,2035,27,30,203507,2035),('2035-07-28',203530,7,2035,28,30,203507,2035),('2035-07-29',203531,7,2035,29,31,203507,2035),('2035-07-30',203531,7,2035,30,31,203507,2035),('2035-07-31',203531,7,2035,31,31,203507,2035),('2035-08-01',203531,8,2035,1,31,203508,2035),('2035-08-02',203531,8,2035,2,31,203508,2035),('2035-08-03',203531,8,2035,3,31,203508,2035),('2035-08-04',203531,8,2035,4,31,203508,2035),('2035-08-05',203532,8,2035,5,32,203508,2035),('2035-08-06',203532,8,2035,6,32,203508,2035),('2035-08-07',203532,8,2035,7,32,203508,2035),('2035-08-08',203532,8,2035,8,32,203508,2035),('2035-08-09',203532,8,2035,9,32,203508,2035),('2035-08-10',203532,8,2035,10,32,203508,2035),('2035-08-11',203532,8,2035,11,32,203508,2035),('2035-08-12',203533,8,2035,12,33,203508,2035),('2035-08-13',203533,8,2035,13,33,203508,2035),('2035-08-14',203533,8,2035,14,33,203508,2035),('2035-08-15',203533,8,2035,15,33,203508,2035),('2035-08-16',203533,8,2035,16,33,203508,2035),('2035-08-17',203533,8,2035,17,33,203508,2035),('2035-08-18',203533,8,2035,18,33,203508,2035),('2035-08-19',203534,8,2035,19,34,203508,2035),('2035-08-20',203534,8,2035,20,34,203508,2035),('2035-08-21',203534,8,2035,21,34,203508,2035),('2035-08-22',203534,8,2035,22,34,203508,2035),('2035-08-23',203534,8,2035,23,34,203508,2035),('2035-08-24',203534,8,2035,24,34,203508,2035),('2035-08-25',203534,8,2035,25,34,203508,2035),('2035-08-26',203535,8,2035,26,35,203508,2035),('2035-08-27',203535,8,2035,27,35,203508,2035),('2035-08-28',203535,8,2035,28,35,203508,2035),('2035-08-29',203535,8,2035,29,35,203508,2035),('2035-08-30',203535,8,2035,30,35,203508,2035),('2035-08-31',203535,8,2035,31,35,203508,2035),('2035-09-01',203535,9,2035,1,35,203509,2035),('2035-09-02',203536,9,2035,2,36,203509,2035),('2035-09-03',203536,9,2035,3,36,203509,2035),('2035-09-04',203536,9,2035,4,36,203509,2035),('2035-09-05',203536,9,2035,5,36,203509,2035),('2035-09-06',203536,9,2035,6,36,203509,2035),('2035-09-07',203536,9,2035,7,36,203509,2035),('2035-09-08',203536,9,2035,8,36,203509,2035),('2035-09-09',203537,9,2035,9,37,203509,2035),('2035-09-10',203537,9,2035,10,37,203509,2035),('2035-09-11',203537,9,2035,11,37,203509,2035),('2035-09-12',203537,9,2035,12,37,203509,2035),('2035-09-13',203537,9,2035,13,37,203509,2035),('2035-09-14',203537,9,2035,14,37,203509,2035),('2035-09-15',203537,9,2035,15,37,203509,2035),('2035-09-16',203538,9,2035,16,38,203509,2035),('2035-09-17',203538,9,2035,17,38,203509,2035),('2035-09-18',203538,9,2035,18,38,203509,2035),('2035-09-19',203538,9,2035,19,38,203509,2035),('2035-09-20',203538,9,2035,20,38,203509,2035),('2035-09-21',203538,9,2035,21,38,203509,2035),('2035-09-22',203538,9,2035,22,38,203509,2035),('2035-09-23',203539,9,2035,23,39,203509,2035),('2035-09-24',203539,9,2035,24,39,203509,2035),('2035-09-25',203539,9,2035,25,39,203509,2035),('2035-09-26',203539,9,2035,26,39,203509,2035),('2035-09-27',203539,9,2035,27,39,203509,2035),('2035-09-28',203539,9,2035,28,39,203509,2035),('2035-09-29',203539,9,2035,29,39,203509,2035),('2035-09-30',203540,9,2035,30,40,203509,2035),('2035-10-01',203540,10,2035,1,40,203510,2035),('2035-10-02',203540,10,2035,2,40,203510,2035),('2035-10-03',203540,10,2035,3,40,203510,2035),('2035-10-04',203540,10,2035,4,40,203510,2035),('2035-10-05',203540,10,2035,5,40,203510,2035),('2035-10-06',203540,10,2035,6,40,203510,2035),('2035-10-07',203541,10,2035,7,41,203510,2035),('2035-10-08',203541,10,2035,8,41,203510,2035),('2035-10-09',203541,10,2035,9,41,203510,2035),('2035-10-10',203541,10,2035,10,41,203510,2035),('2035-10-11',203541,10,2035,11,41,203510,2035),('2035-10-12',203541,10,2035,12,41,203510,2035),('2035-10-13',203541,10,2035,13,41,203510,2035),('2035-10-14',203542,10,2035,14,42,203510,2035),('2035-10-15',203542,10,2035,15,42,203510,2035),('2035-10-16',203542,10,2035,16,42,203510,2035),('2035-10-17',203542,10,2035,17,42,203510,2035),('2035-10-18',203542,10,2035,18,42,203510,2035),('2035-10-19',203542,10,2035,19,42,203510,2035),('2035-10-20',203542,10,2035,20,42,203510,2035),('2035-10-21',203543,10,2035,21,43,203510,2035),('2035-10-22',203543,10,2035,22,43,203510,2035),('2035-10-23',203543,10,2035,23,43,203510,2035),('2035-10-24',203543,10,2035,24,43,203510,2035),('2035-10-25',203543,10,2035,25,43,203510,2035),('2035-10-26',203543,10,2035,26,43,203510,2035),('2035-10-27',203543,10,2035,27,43,203510,2035),('2035-10-28',203544,10,2035,28,44,203510,2035),('2035-10-29',203544,10,2035,29,44,203510,2035),('2035-10-30',203544,10,2035,30,44,203510,2035),('2035-10-31',203544,10,2035,31,44,203510,2035),('2035-11-01',203544,11,2035,1,44,203511,2035),('2035-11-02',203544,11,2035,2,44,203511,2035),('2035-11-03',203544,11,2035,3,44,203511,2035),('2035-11-04',203545,11,2035,4,45,203511,2035),('2035-11-05',203545,11,2035,5,45,203511,2035),('2035-11-06',203545,11,2035,6,45,203511,2035),('2035-11-07',203545,11,2035,7,45,203511,2035),('2035-11-08',203545,11,2035,8,45,203511,2035),('2035-11-09',203545,11,2035,9,45,203511,2035),('2035-11-10',203545,11,2035,10,45,203511,2035),('2035-11-11',203546,11,2035,11,46,203511,2035),('2035-11-12',203546,11,2035,12,46,203511,2035),('2035-11-13',203546,11,2035,13,46,203511,2035),('2035-11-14',203546,11,2035,14,46,203511,2035),('2035-11-15',203546,11,2035,15,46,203511,2035),('2035-11-16',203546,11,2035,16,46,203511,2035),('2035-11-17',203546,11,2035,17,46,203511,2035),('2035-11-18',203547,11,2035,18,47,203511,2035),('2035-11-19',203547,11,2035,19,47,203511,2035),('2035-11-20',203547,11,2035,20,47,203511,2035),('2035-11-21',203547,11,2035,21,47,203511,2035),('2035-11-22',203547,11,2035,22,47,203511,2035),('2035-11-23',203547,11,2035,23,47,203511,2035),('2035-11-24',203547,11,2035,24,47,203511,2035),('2035-11-25',203548,11,2035,25,48,203511,2035),('2035-11-26',203548,11,2035,26,48,203511,2035),('2035-11-27',203548,11,2035,27,48,203511,2035),('2035-11-28',203548,11,2035,28,48,203511,2035),('2035-11-29',203548,11,2035,29,48,203511,2035),('2035-11-30',203548,11,2035,30,48,203511,2035),('2035-12-01',203548,12,2035,1,48,203512,2036),('2035-12-02',203549,12,2035,2,49,203512,2036),('2035-12-03',203549,12,2035,3,49,203512,2036),('2035-12-04',203549,12,2035,4,49,203512,2036),('2035-12-05',203549,12,2035,5,49,203512,2036),('2035-12-06',203549,12,2035,6,49,203512,2036),('2035-12-07',203549,12,2035,7,49,203512,2036),('2035-12-08',203549,12,2035,8,49,203512,2036),('2035-12-09',203550,12,2035,9,50,203512,2036),('2035-12-10',203550,12,2035,10,50,203512,2036),('2035-12-11',203550,12,2035,11,50,203512,2036),('2035-12-12',203550,12,2035,12,50,203512,2036),('2035-12-13',203550,12,2035,13,50,203512,2036),('2035-12-14',203550,12,2035,14,50,203512,2036),('2035-12-15',203550,12,2035,15,50,203512,2036),('2035-12-16',203551,12,2035,16,51,203512,2036),('2035-12-17',203551,12,2035,17,51,203512,2036),('2035-12-18',203551,12,2035,18,51,203512,2036),('2035-12-19',203551,12,2035,19,51,203512,2036),('2035-12-20',203551,12,2035,20,51,203512,2036),('2035-12-21',203551,12,2035,21,51,203512,2036),('2035-12-22',203551,12,2035,22,51,203512,2036),('2035-12-23',203552,12,2035,23,52,203512,2036),('2035-12-24',203552,12,2035,24,52,203512,2036),('2035-12-25',203552,12,2035,25,52,203512,2036),('2035-12-26',203552,12,2035,26,52,203512,2036),('2035-12-27',203552,12,2035,27,52,203512,2036),('2035-12-28',203552,12,2035,28,52,203512,2036),('2035-12-29',203552,12,2035,29,52,203512,2036),('2035-12-30',203553,12,2035,30,1,203512,2036),('2035-12-31',203501,12,2035,31,1,203512,2036),('2036-01-01',203601,1,2036,1,1,203601,2036),('2036-01-02',203601,1,2036,2,1,203601,2036),('2036-01-03',203601,1,2036,3,1,203601,2036),('2036-01-04',203601,1,2036,4,1,203601,2036),('2036-01-05',203601,1,2036,5,1,203601,2036),('2036-01-06',203602,1,2036,6,2,203601,2036),('2036-01-07',203602,1,2036,7,2,203601,2036),('2036-01-08',203602,1,2036,8,2,203601,2036),('2036-01-09',203602,1,2036,9,2,203601,2036),('2036-01-10',203602,1,2036,10,2,203601,2036),('2036-01-11',203602,1,2036,11,2,203601,2036),('2036-01-12',203602,1,2036,12,2,203601,2036),('2036-01-13',203603,1,2036,13,3,203601,2036),('2036-01-14',203603,1,2036,14,3,203601,2036),('2036-01-15',203603,1,2036,15,3,203601,2036),('2036-01-16',203603,1,2036,16,3,203601,2036),('2036-01-17',203603,1,2036,17,3,203601,2036),('2036-01-18',203603,1,2036,18,3,203601,2036),('2036-01-19',203603,1,2036,19,3,203601,2036),('2036-01-20',203604,1,2036,20,4,203601,2036),('2036-01-21',203604,1,2036,21,4,203601,2036),('2036-01-22',203604,1,2036,22,4,203601,2036),('2036-01-23',203604,1,2036,23,4,203601,2036),('2036-01-24',203604,1,2036,24,4,203601,2036),('2036-01-25',203604,1,2036,25,4,203601,2036),('2036-01-26',203604,1,2036,26,4,203601,2036),('2036-01-27',203605,1,2036,27,5,203601,2036),('2036-01-28',203605,1,2036,28,5,203601,2036),('2036-01-29',203605,1,2036,29,5,203601,2036),('2036-01-30',203605,1,2036,30,5,203601,2036),('2036-01-31',203605,1,2036,31,5,203601,2036),('2036-02-01',203605,2,2036,1,5,203602,2036),('2036-02-02',203605,2,2036,2,5,203602,2036),('2036-02-03',203606,2,2036,3,6,203602,2036),('2036-02-04',203606,2,2036,4,6,203602,2036),('2036-02-05',203606,2,2036,5,6,203602,2036),('2036-02-06',203606,2,2036,6,6,203602,2036),('2036-02-07',203606,2,2036,7,6,203602,2036),('2036-02-08',203606,2,2036,8,6,203602,2036),('2036-02-09',203606,2,2036,9,6,203602,2036),('2036-02-10',203607,2,2036,10,7,203602,2036),('2036-02-11',203607,2,2036,11,7,203602,2036),('2036-02-12',203607,2,2036,12,7,203602,2036),('2036-02-13',203607,2,2036,13,7,203602,2036),('2036-02-14',203607,2,2036,14,7,203602,2036),('2036-02-15',203607,2,2036,15,7,203602,2036),('2036-02-16',203607,2,2036,16,7,203602,2036),('2036-02-17',203608,2,2036,17,8,203602,2036),('2036-02-18',203608,2,2036,18,8,203602,2036),('2036-02-19',203608,2,2036,19,8,203602,2036),('2036-02-20',203608,2,2036,20,8,203602,2036),('2036-02-21',203608,2,2036,21,8,203602,2036),('2036-02-22',203608,2,2036,22,8,203602,2036),('2036-02-23',203608,2,2036,23,8,203602,2036),('2036-02-24',203609,2,2036,24,9,203602,2036),('2036-02-25',203609,2,2036,25,9,203602,2036),('2036-02-26',203609,2,2036,26,9,203602,2036),('2036-02-27',203609,2,2036,27,9,203602,2036),('2036-02-28',203609,2,2036,28,9,203602,2036),('2036-02-29',203609,2,2036,29,9,203602,2036),('2036-03-01',203609,3,2036,1,9,203603,2036),('2036-03-02',203610,3,2036,2,10,203603,2036),('2036-03-03',203610,3,2036,3,10,203603,2036),('2036-03-04',203610,3,2036,4,10,203603,2036),('2036-03-05',203610,3,2036,5,10,203603,2036),('2036-03-06',203610,3,2036,6,10,203603,2036),('2036-03-07',203610,3,2036,7,10,203603,2036),('2036-03-08',203610,3,2036,8,10,203603,2036),('2036-03-09',203611,3,2036,9,11,203603,2036),('2036-03-10',203611,3,2036,10,11,203603,2036),('2036-03-11',203611,3,2036,11,11,203603,2036),('2036-03-12',203611,3,2036,12,11,203603,2036),('2036-03-13',203611,3,2036,13,11,203603,2036),('2036-03-14',203611,3,2036,14,11,203603,2036),('2036-03-15',203611,3,2036,15,11,203603,2036),('2036-03-16',203612,3,2036,16,12,203603,2036),('2036-03-17',203612,3,2036,17,12,203603,2036),('2036-03-18',203612,3,2036,18,12,203603,2036),('2036-03-19',203612,3,2036,19,12,203603,2036),('2036-03-20',203612,3,2036,20,12,203603,2036),('2036-03-21',203612,3,2036,21,12,203603,2036),('2036-03-22',203612,3,2036,22,12,203603,2036),('2036-03-23',203613,3,2036,23,13,203603,2036),('2036-03-24',203613,3,2036,24,13,203603,2036),('2036-03-25',203613,3,2036,25,13,203603,2036),('2036-03-26',203613,3,2036,26,13,203603,2036),('2036-03-27',203613,3,2036,27,13,203603,2036),('2036-03-28',203613,3,2036,28,13,203603,2036),('2036-03-29',203613,3,2036,29,13,203603,2036),('2036-03-30',203614,3,2036,30,14,203603,2036),('2036-03-31',203614,3,2036,31,14,203603,2036),('2036-04-01',203614,4,2036,1,14,203604,2036),('2036-04-02',203614,4,2036,2,14,203604,2036),('2036-04-03',203614,4,2036,3,14,203604,2036),('2036-04-04',203614,4,2036,4,14,203604,2036),('2036-04-05',203614,4,2036,5,14,203604,2036),('2036-04-06',203615,4,2036,6,15,203604,2036),('2036-04-07',203615,4,2036,7,15,203604,2036),('2036-04-08',203615,4,2036,8,15,203604,2036),('2036-04-09',203615,4,2036,9,15,203604,2036),('2036-04-10',203615,4,2036,10,15,203604,2036),('2036-04-11',203615,4,2036,11,15,203604,2036),('2036-04-12',203615,4,2036,12,15,203604,2036),('2036-04-13',203616,4,2036,13,16,203604,2036),('2036-04-14',203616,4,2036,14,16,203604,2036),('2036-04-15',203616,4,2036,15,16,203604,2036),('2036-04-16',203616,4,2036,16,16,203604,2036),('2036-04-17',203616,4,2036,17,16,203604,2036),('2036-04-18',203616,4,2036,18,16,203604,2036),('2036-04-19',203616,4,2036,19,16,203604,2036),('2036-04-20',203617,4,2036,20,17,203604,2036),('2036-04-21',203617,4,2036,21,17,203604,2036),('2036-04-22',203617,4,2036,22,17,203604,2036),('2036-04-23',203617,4,2036,23,17,203604,2036),('2036-04-24',203617,4,2036,24,17,203604,2036),('2036-04-25',203617,4,2036,25,17,203604,2036),('2036-04-26',203617,4,2036,26,17,203604,2036),('2036-04-27',203618,4,2036,27,18,203604,2036),('2036-04-28',203618,4,2036,28,18,203604,2036),('2036-04-29',203618,4,2036,29,18,203604,2036),('2036-04-30',203618,4,2036,30,18,203604,2036),('2036-05-01',203618,5,2036,1,18,203605,2036),('2036-05-02',203618,5,2036,2,18,203605,2036),('2036-05-03',203618,5,2036,3,18,203605,2036),('2036-05-04',203619,5,2036,4,19,203605,2036),('2036-05-05',203619,5,2036,5,19,203605,2036),('2036-05-06',203619,5,2036,6,19,203605,2036),('2036-05-07',203619,5,2036,7,19,203605,2036),('2036-05-08',203619,5,2036,8,19,203605,2036),('2036-05-09',203619,5,2036,9,19,203605,2036),('2036-05-10',203619,5,2036,10,19,203605,2036),('2036-05-11',203620,5,2036,11,20,203605,2036),('2036-05-12',203620,5,2036,12,20,203605,2036),('2036-05-13',203620,5,2036,13,20,203605,2036),('2036-05-14',203620,5,2036,14,20,203605,2036),('2036-05-15',203620,5,2036,15,20,203605,2036),('2036-05-16',203620,5,2036,16,20,203605,2036),('2036-05-17',203620,5,2036,17,20,203605,2036),('2036-05-18',203621,5,2036,18,21,203605,2036),('2036-05-19',203621,5,2036,19,21,203605,2036),('2036-05-20',203621,5,2036,20,21,203605,2036),('2036-05-21',203621,5,2036,21,21,203605,2036),('2036-05-22',203621,5,2036,22,21,203605,2036),('2036-05-23',203621,5,2036,23,21,203605,2036),('2036-05-24',203621,5,2036,24,21,203605,2036),('2036-05-25',203622,5,2036,25,22,203605,2036),('2036-05-26',203622,5,2036,26,22,203605,2036),('2036-05-27',203622,5,2036,27,22,203605,2036),('2036-05-28',203622,5,2036,28,22,203605,2036),('2036-05-29',203622,5,2036,29,22,203605,2036),('2036-05-30',203622,5,2036,30,22,203605,2036),('2036-05-31',203622,5,2036,31,22,203605,2036),('2036-06-01',203623,6,2036,1,23,203606,2036),('2036-06-02',203623,6,2036,2,23,203606,2036),('2036-06-03',203623,6,2036,3,23,203606,2036),('2036-06-04',203623,6,2036,4,23,203606,2036),('2036-06-05',203623,6,2036,5,23,203606,2036),('2036-06-06',203623,6,2036,6,23,203606,2036),('2036-06-07',203623,6,2036,7,23,203606,2036),('2036-06-08',203624,6,2036,8,24,203606,2036),('2036-06-09',203624,6,2036,9,24,203606,2036),('2036-06-10',203624,6,2036,10,24,203606,2036),('2036-06-11',203624,6,2036,11,24,203606,2036),('2036-06-12',203624,6,2036,12,24,203606,2036),('2036-06-13',203624,6,2036,13,24,203606,2036),('2036-06-14',203624,6,2036,14,24,203606,2036),('2036-06-15',203625,6,2036,15,25,203606,2036),('2036-06-16',203625,6,2036,16,25,203606,2036),('2036-06-17',203625,6,2036,17,25,203606,2036),('2036-06-18',203625,6,2036,18,25,203606,2036),('2036-06-19',203625,6,2036,19,25,203606,2036),('2036-06-20',203625,6,2036,20,25,203606,2036),('2036-06-21',203625,6,2036,21,25,203606,2036),('2036-06-22',203626,6,2036,22,26,203606,2036),('2036-06-23',203626,6,2036,23,26,203606,2036),('2036-06-24',203626,6,2036,24,26,203606,2036),('2036-06-25',203626,6,2036,25,26,203606,2036),('2036-06-26',203626,6,2036,26,26,203606,2036),('2036-06-27',203626,6,2036,27,26,203606,2036),('2036-06-28',203626,6,2036,28,26,203606,2036),('2036-06-29',203627,6,2036,29,27,203606,2036),('2036-06-30',203627,6,2036,30,27,203606,2036),('2036-07-01',203627,7,2036,1,27,203607,2036),('2036-07-02',203627,7,2036,2,27,203607,2036),('2036-07-03',203627,7,2036,3,27,203607,2036),('2036-07-04',203627,7,2036,4,27,203607,2036),('2036-07-05',203627,7,2036,5,27,203607,2036),('2036-07-06',203628,7,2036,6,28,203607,2036),('2036-07-07',203628,7,2036,7,28,203607,2036),('2036-07-08',203628,7,2036,8,28,203607,2036),('2036-07-09',203628,7,2036,9,28,203607,2036),('2036-07-10',203628,7,2036,10,28,203607,2036),('2036-07-11',203628,7,2036,11,28,203607,2036),('2036-07-12',203628,7,2036,12,28,203607,2036),('2036-07-13',203629,7,2036,13,29,203607,2036),('2036-07-14',203629,7,2036,14,29,203607,2036),('2036-07-15',203629,7,2036,15,29,203607,2036),('2036-07-16',203629,7,2036,16,29,203607,2036),('2036-07-17',203629,7,2036,17,29,203607,2036),('2036-07-18',203629,7,2036,18,29,203607,2036),('2036-07-19',203629,7,2036,19,29,203607,2036),('2036-07-20',203630,7,2036,20,30,203607,2036),('2036-07-21',203630,7,2036,21,30,203607,2036),('2036-07-22',203630,7,2036,22,30,203607,2036),('2036-07-23',203630,7,2036,23,30,203607,2036),('2036-07-24',203630,7,2036,24,30,203607,2036),('2036-07-25',203630,7,2036,25,30,203607,2036),('2036-07-26',203630,7,2036,26,30,203607,2036),('2036-07-27',203631,7,2036,27,31,203607,2036),('2036-07-28',203631,7,2036,28,31,203607,2036),('2036-07-29',203631,7,2036,29,31,203607,2036),('2036-07-30',203631,7,2036,30,31,203607,2036),('2036-07-31',203631,7,2036,31,31,203607,2036),('2036-08-01',203631,8,2036,1,31,203608,2036),('2036-08-02',203631,8,2036,2,31,203608,2036),('2036-08-03',203632,8,2036,3,32,203608,2036),('2036-08-04',203632,8,2036,4,32,203608,2036),('2036-08-05',203632,8,2036,5,32,203608,2036),('2036-08-06',203632,8,2036,6,32,203608,2036),('2036-08-07',203632,8,2036,7,32,203608,2036),('2036-08-08',203632,8,2036,8,32,203608,2036),('2036-08-09',203632,8,2036,9,32,203608,2036),('2036-08-10',203633,8,2036,10,33,203608,2036),('2036-08-11',203633,8,2036,11,33,203608,2036),('2036-08-12',203633,8,2036,12,33,203608,2036),('2036-08-13',203633,8,2036,13,33,203608,2036),('2036-08-14',203633,8,2036,14,33,203608,2036),('2036-08-15',203633,8,2036,15,33,203608,2036),('2036-08-16',203633,8,2036,16,33,203608,2036),('2036-08-17',203634,8,2036,17,34,203608,2036),('2036-08-18',203634,8,2036,18,34,203608,2036),('2036-08-19',203634,8,2036,19,34,203608,2036),('2036-08-20',203634,8,2036,20,34,203608,2036),('2036-08-21',203634,8,2036,21,34,203608,2036),('2036-08-22',203634,8,2036,22,34,203608,2036),('2036-08-23',203634,8,2036,23,34,203608,2036),('2036-08-24',203635,8,2036,24,35,203608,2036),('2036-08-25',203635,8,2036,25,35,203608,2036),('2036-08-26',203635,8,2036,26,35,203608,2036),('2036-08-27',203635,8,2036,27,35,203608,2036),('2036-08-28',203635,8,2036,28,35,203608,2036),('2036-08-29',203635,8,2036,29,35,203608,2036),('2036-08-30',203635,8,2036,30,35,203608,2036),('2036-08-31',203636,8,2036,31,36,203608,2036),('2036-09-01',203636,9,2036,1,36,203609,2036),('2036-09-02',203636,9,2036,2,36,203609,2036),('2036-09-03',203636,9,2036,3,36,203609,2036),('2036-09-04',203636,9,2036,4,36,203609,2036),('2036-09-05',203636,9,2036,5,36,203609,2036),('2036-09-06',203636,9,2036,6,36,203609,2036),('2036-09-07',203637,9,2036,7,37,203609,2036),('2036-09-08',203637,9,2036,8,37,203609,2036),('2036-09-09',203637,9,2036,9,37,203609,2036),('2036-09-10',203637,9,2036,10,37,203609,2036),('2036-09-11',203637,9,2036,11,37,203609,2036),('2036-09-12',203637,9,2036,12,37,203609,2036),('2036-09-13',203637,9,2036,13,37,203609,2036),('2036-09-14',203638,9,2036,14,38,203609,2036),('2036-09-15',203638,9,2036,15,38,203609,2036),('2036-09-16',203638,9,2036,16,38,203609,2036),('2036-09-17',203638,9,2036,17,38,203609,2036),('2036-09-18',203638,9,2036,18,38,203609,2036),('2036-09-19',203638,9,2036,19,38,203609,2036),('2036-09-20',203638,9,2036,20,38,203609,2036),('2036-09-21',203639,9,2036,21,39,203609,2036),('2036-09-22',203639,9,2036,22,39,203609,2036),('2036-09-23',203639,9,2036,23,39,203609,2036),('2036-09-24',203639,9,2036,24,39,203609,2036),('2036-09-25',203639,9,2036,25,39,203609,2036),('2036-09-26',203639,9,2036,26,39,203609,2036),('2036-09-27',203639,9,2036,27,39,203609,2036),('2036-09-28',203640,9,2036,28,40,203609,2036),('2036-09-29',203640,9,2036,29,40,203609,2036),('2036-09-30',203640,9,2036,30,40,203609,2036),('2036-10-01',203640,10,2036,1,40,203610,2036),('2036-10-02',203640,10,2036,2,40,203610,2036),('2036-10-03',203640,10,2036,3,40,203610,2036),('2036-10-04',203640,10,2036,4,40,203610,2036),('2036-10-05',203641,10,2036,5,41,203610,2036),('2036-10-06',203641,10,2036,6,41,203610,2036),('2036-10-07',203641,10,2036,7,41,203610,2036),('2036-10-08',203641,10,2036,8,41,203610,2036),('2036-10-09',203641,10,2036,9,41,203610,2036),('2036-10-10',203641,10,2036,10,41,203610,2036),('2036-10-11',203641,10,2036,11,41,203610,2036),('2036-10-12',203642,10,2036,12,42,203610,2036),('2036-10-13',203642,10,2036,13,42,203610,2036),('2036-10-14',203642,10,2036,14,42,203610,2036),('2036-10-15',203642,10,2036,15,42,203610,2036),('2036-10-16',203642,10,2036,16,42,203610,2036),('2036-10-17',203642,10,2036,17,42,203610,2036),('2036-10-18',203642,10,2036,18,42,203610,2036),('2036-10-19',203643,10,2036,19,43,203610,2036),('2036-10-20',203643,10,2036,20,43,203610,2036),('2036-10-21',203643,10,2036,21,43,203610,2036),('2036-10-22',203643,10,2036,22,43,203610,2036),('2036-10-23',203643,10,2036,23,43,203610,2036),('2036-10-24',203643,10,2036,24,43,203610,2036),('2036-10-25',203643,10,2036,25,43,203610,2036),('2036-10-26',203644,10,2036,26,44,203610,2036),('2036-10-27',203644,10,2036,27,44,203610,2036),('2036-10-28',203644,10,2036,28,44,203610,2036),('2036-10-29',203644,10,2036,29,44,203610,2036),('2036-10-30',203644,10,2036,30,44,203610,2036),('2036-10-31',203644,10,2036,31,44,203610,2036),('2036-11-01',203644,11,2036,1,44,203611,2036),('2036-11-02',203645,11,2036,2,45,203611,2036),('2036-11-03',203645,11,2036,3,45,203611,2036),('2036-11-04',203645,11,2036,4,45,203611,2036),('2036-11-05',203645,11,2036,5,45,203611,2036),('2036-11-06',203645,11,2036,6,45,203611,2036),('2036-11-07',203645,11,2036,7,45,203611,2036),('2036-11-08',203645,11,2036,8,45,203611,2036),('2036-11-09',203646,11,2036,9,46,203611,2036),('2036-11-10',203646,11,2036,10,46,203611,2036),('2036-11-11',203646,11,2036,11,46,203611,2036),('2036-11-12',203646,11,2036,12,46,203611,2036),('2036-11-13',203646,11,2036,13,46,203611,2036),('2036-11-14',203646,11,2036,14,46,203611,2036),('2036-11-15',203646,11,2036,15,46,203611,2036),('2036-11-16',203647,11,2036,16,47,203611,2036),('2036-11-17',203647,11,2036,17,47,203611,2036),('2036-11-18',203647,11,2036,18,47,203611,2036),('2036-11-19',203647,11,2036,19,47,203611,2036),('2036-11-20',203647,11,2036,20,47,203611,2036),('2036-11-21',203647,11,2036,21,47,203611,2036),('2036-11-22',203647,11,2036,22,47,203611,2036),('2036-11-23',203648,11,2036,23,48,203611,2036),('2036-11-24',203648,11,2036,24,48,203611,2036),('2036-11-25',203648,11,2036,25,48,203611,2036),('2036-11-26',203648,11,2036,26,48,203611,2036),('2036-11-27',203648,11,2036,27,48,203611,2036),('2036-11-28',203648,11,2036,28,48,203611,2036),('2036-11-29',203648,11,2036,29,48,203611,2036),('2036-11-30',203649,11,2036,30,49,203611,2036),('2036-12-01',203649,12,2036,1,49,203612,2037),('2036-12-02',203649,12,2036,2,49,203612,2037),('2036-12-03',203649,12,2036,3,49,203612,2037),('2036-12-04',203649,12,2036,4,49,203612,2037),('2036-12-05',203649,12,2036,5,49,203612,2037),('2036-12-06',203649,12,2036,6,49,203612,2037),('2036-12-07',203650,12,2036,7,50,203612,2037),('2036-12-08',203650,12,2036,8,50,203612,2037),('2036-12-09',203650,12,2036,9,50,203612,2037),('2036-12-10',203650,12,2036,10,50,203612,2037),('2036-12-11',203650,12,2036,11,50,203612,2037),('2036-12-12',203650,12,2036,12,50,203612,2037),('2036-12-13',203650,12,2036,13,50,203612,2037),('2036-12-14',203651,12,2036,14,51,203612,2037),('2036-12-15',203651,12,2036,15,51,203612,2037),('2036-12-16',203651,12,2036,16,51,203612,2037),('2036-12-17',203651,12,2036,17,51,203612,2037),('2036-12-18',203651,12,2036,18,51,203612,2037),('2036-12-19',203651,12,2036,19,51,203612,2037),('2036-12-20',203651,12,2036,20,51,203612,2037),('2036-12-21',203652,12,2036,21,52,203612,2037),('2036-12-22',203652,12,2036,22,52,203612,2037),('2036-12-23',203652,12,2036,23,52,203612,2037),('2036-12-24',203652,12,2036,24,52,203612,2037),('2036-12-25',203652,12,2036,25,52,203612,2037),('2036-12-26',203652,12,2036,26,52,203612,2037),('2036-12-27',203652,12,2036,27,52,203612,2037),('2036-12-28',203653,12,2036,28,53,203612,2037),('2036-12-29',203601,12,2036,29,53,203612,2037),('2036-12-30',203601,12,2036,30,53,203612,2037); +INSERT INTO `time` VALUES ('2007-12-31',200801,12,2007,31,1,200712,2008),('2008-01-01',200801,1,2008,1,1,200801,2008),('2008-01-02',200801,1,2008,2,1,200801,2008),('2008-01-03',200801,1,2008,3,1,200801,2008),('2008-01-04',200801,1,2008,4,1,200801,2008),('2008-01-05',200801,1,2008,5,1,200801,2008),('2008-01-06',200802,1,2008,6,2,200801,2008),('2008-01-07',200802,1,2008,7,2,200801,2008),('2008-01-08',200802,1,2008,8,2,200801,2008),('2008-01-09',200802,1,2008,9,2,200801,2008),('2008-01-10',200802,1,2008,10,2,200801,2008),('2008-01-11',200802,1,2008,11,2,200801,2008),('2008-01-12',200802,1,2008,12,2,200801,2008),('2008-01-13',200803,1,2008,13,3,200801,2008),('2008-01-14',200803,1,2008,14,3,200801,2008),('2008-01-15',200803,1,2008,15,3,200801,2008),('2008-01-16',200803,1,2008,16,3,200801,2008),('2008-01-17',200803,1,2008,17,3,200801,2008),('2008-01-18',200803,1,2008,18,3,200801,2008),('2008-01-19',200803,1,2008,19,3,200801,2008),('2008-01-20',200804,1,2008,20,4,200801,2008),('2008-01-21',200804,1,2008,21,4,200801,2008),('2008-01-22',200804,1,2008,22,4,200801,2008),('2008-01-23',200804,1,2008,23,4,200801,2008),('2008-01-24',200804,1,2008,24,4,200801,2008),('2008-01-25',200804,1,2008,25,4,200801,2008),('2008-01-26',200804,1,2008,26,4,200801,2008),('2008-01-27',200805,1,2008,27,5,200801,2008),('2008-01-28',200805,1,2008,28,5,200801,2008),('2008-01-29',200805,1,2008,29,5,200801,2008),('2008-01-30',200805,1,2008,30,5,200801,2008),('2008-01-31',200805,1,2008,31,5,200801,2008),('2008-02-01',200805,2,2008,1,5,200802,2008),('2008-02-02',200805,2,2008,2,5,200802,2008),('2008-02-03',200806,2,2008,3,6,200802,2008),('2008-02-04',200806,2,2008,4,6,200802,2008),('2008-02-05',200806,2,2008,5,6,200802,2008),('2008-02-06',200806,2,2008,6,6,200802,2008),('2008-02-07',200806,2,2008,7,6,200802,2008),('2008-02-08',200806,2,2008,8,6,200802,2008),('2008-02-09',200806,2,2008,9,6,200802,2008),('2008-02-10',200807,2,2008,10,7,200802,2008),('2008-02-11',200807,2,2008,11,7,200802,2008),('2008-02-12',200807,2,2008,12,7,200802,2008),('2008-02-13',200807,2,2008,13,7,200802,2008),('2008-02-14',200807,2,2008,14,7,200802,2008),('2008-02-15',200807,2,2008,15,7,200802,2008),('2008-02-16',200807,2,2008,16,7,200802,2008),('2008-02-17',200808,2,2008,17,8,200802,2008),('2008-02-18',200808,2,2008,18,8,200802,2008),('2008-02-19',200808,2,2008,19,8,200802,2008),('2008-02-20',200808,2,2008,20,8,200802,2008),('2008-02-21',200808,2,2008,21,8,200802,2008),('2008-02-22',200808,2,2008,22,8,200802,2008),('2008-02-23',200808,2,2008,23,8,200802,2008),('2008-02-24',200809,2,2008,24,9,200802,2008),('2008-02-25',200809,2,2008,25,9,200802,2008),('2008-02-26',200809,2,2008,26,9,200802,2008),('2008-02-27',200809,2,2008,27,9,200802,2008),('2008-02-28',200809,2,2008,28,9,200802,2008),('2008-02-29',200809,2,2008,29,9,200802,2008),('2008-03-01',200809,3,2008,1,9,200803,2008),('2008-03-02',200810,3,2008,2,10,200803,2008),('2008-03-03',200810,3,2008,3,10,200803,2008),('2008-03-04',200810,3,2008,4,10,200803,2008),('2008-03-05',200810,3,2008,5,10,200803,2008),('2008-03-06',200810,3,2008,6,10,200803,2008),('2008-03-07',200810,3,2008,7,10,200803,2008),('2008-03-08',200810,3,2008,8,10,200803,2008),('2008-03-09',200811,3,2008,9,11,200803,2008),('2008-03-10',200811,3,2008,10,11,200803,2008),('2008-03-11',200811,3,2008,11,11,200803,2008),('2008-03-12',200811,3,2008,12,11,200803,2008),('2008-03-13',200811,3,2008,13,11,200803,2008),('2008-03-14',200811,3,2008,14,11,200803,2008),('2008-03-15',200811,3,2008,15,11,200803,2008),('2008-03-16',200812,3,2008,16,12,200803,2008),('2008-03-17',200812,3,2008,17,12,200803,2008),('2008-03-18',200812,3,2008,18,12,200803,2008),('2008-03-19',200812,3,2008,19,12,200803,2008),('2008-03-20',200812,3,2008,20,12,200803,2008),('2008-03-21',200812,3,2008,21,12,200803,2008),('2008-03-22',200812,3,2008,22,12,200803,2008),('2008-03-23',200813,3,2008,23,13,200803,2008),('2008-03-24',200813,3,2008,24,13,200803,2008),('2008-03-25',200813,3,2008,25,13,200803,2008),('2008-03-26',200813,3,2008,26,13,200803,2008),('2008-03-27',200813,3,2008,27,13,200803,2008),('2008-03-28',200813,3,2008,28,13,200803,2008),('2008-03-29',200813,3,2008,29,13,200803,2008),('2008-03-30',200814,3,2008,30,14,200803,2008),('2008-03-31',200814,3,2008,31,14,200803,2008),('2008-04-01',200814,4,2008,1,14,200804,2008),('2008-04-02',200814,4,2008,2,14,200804,2008),('2008-04-03',200814,4,2008,3,14,200804,2008),('2008-04-04',200814,4,2008,4,14,200804,2008),('2008-04-05',200814,4,2008,5,14,200804,2008),('2008-04-06',200815,4,2008,6,15,200804,2008),('2008-04-07',200815,4,2008,7,15,200804,2008),('2008-04-08',200815,4,2008,8,15,200804,2008),('2008-04-09',200815,4,2008,9,15,200804,2008),('2008-04-10',200815,4,2008,10,15,200804,2008),('2008-04-11',200815,4,2008,11,15,200804,2008),('2008-04-12',200815,4,2008,12,15,200804,2008),('2008-04-13',200816,4,2008,13,16,200804,2008),('2008-04-14',200816,4,2008,14,16,200804,2008),('2008-04-15',200816,4,2008,15,16,200804,2008),('2008-04-16',200816,4,2008,16,16,200804,2008),('2008-04-17',200816,4,2008,17,16,200804,2008),('2008-04-18',200816,4,2008,18,16,200804,2008),('2008-04-19',200816,4,2008,19,16,200804,2008),('2008-04-20',200817,4,2008,20,17,200804,2008),('2008-04-21',200817,4,2008,21,17,200804,2008),('2008-04-22',200817,4,2008,22,17,200804,2008),('2008-04-23',200817,4,2008,23,17,200804,2008),('2008-04-24',200817,4,2008,24,17,200804,2008),('2008-04-25',200817,4,2008,25,17,200804,2008),('2008-04-26',200817,4,2008,26,17,200804,2008),('2008-04-27',200818,4,2008,27,18,200804,2008),('2008-04-28',200818,4,2008,28,18,200804,2008),('2008-04-29',200818,4,2008,29,18,200804,2008),('2008-04-30',200818,4,2008,30,18,200804,2008),('2008-05-01',200818,5,2008,1,18,200805,2008),('2008-05-02',200818,5,2008,2,18,200805,2008),('2008-05-03',200818,5,2008,3,18,200805,2008),('2008-05-04',200819,5,2008,4,19,200805,2008),('2008-05-05',200819,5,2008,5,19,200805,2008),('2008-05-06',200819,5,2008,6,19,200805,2008),('2008-05-07',200819,5,2008,7,19,200805,2008),('2008-05-08',200819,5,2008,8,19,200805,2008),('2008-05-09',200819,5,2008,9,19,200805,2008),('2008-05-10',200819,5,2008,10,19,200805,2008),('2008-05-11',200820,5,2008,11,20,200805,2008),('2008-05-12',200820,5,2008,12,20,200805,2008),('2008-05-13',200820,5,2008,13,20,200805,2008),('2008-05-14',200820,5,2008,14,20,200805,2008),('2008-05-15',200820,5,2008,15,20,200805,2008),('2008-05-16',200820,5,2008,16,20,200805,2008),('2008-05-17',200820,5,2008,17,20,200805,2008),('2008-05-18',200821,5,2008,18,21,200805,2008),('2008-05-19',200821,5,2008,19,21,200805,2008),('2008-05-20',200821,5,2008,20,21,200805,2008),('2008-05-21',200821,5,2008,21,21,200805,2008),('2008-05-22',200821,5,2008,22,21,200805,2008),('2008-05-23',200821,5,2008,23,21,200805,2008),('2008-05-24',200821,5,2008,24,21,200805,2008),('2008-05-25',200822,5,2008,25,22,200805,2008),('2008-05-26',200822,5,2008,26,22,200805,2008),('2008-05-27',200822,5,2008,27,22,200805,2008),('2008-05-28',200822,5,2008,28,22,200805,2008),('2008-05-29',200822,5,2008,29,22,200805,2008),('2008-05-30',200822,5,2008,30,22,200805,2008),('2008-05-31',200822,5,2008,31,22,200805,2008),('2008-06-01',200823,6,2008,1,23,200806,2008),('2008-06-02',200823,6,2008,2,23,200806,2008),('2008-06-03',200823,6,2008,3,23,200806,2008),('2008-06-04',200823,6,2008,4,23,200806,2008),('2008-06-05',200823,6,2008,5,23,200806,2008),('2008-06-06',200823,6,2008,6,23,200806,2008),('2008-06-07',200823,6,2008,7,23,200806,2008),('2008-06-08',200824,6,2008,8,24,200806,2008),('2008-06-09',200824,6,2008,9,24,200806,2008),('2008-06-10',200824,6,2008,10,24,200806,2008),('2008-06-11',200824,6,2008,11,24,200806,2008),('2008-06-12',200824,6,2008,12,24,200806,2008),('2008-06-13',200824,6,2008,13,24,200806,2008),('2008-06-14',200824,6,2008,14,24,200806,2008),('2008-06-15',200825,6,2008,15,25,200806,2008),('2008-06-16',200825,6,2008,16,25,200806,2008),('2008-06-17',200825,6,2008,17,25,200806,2008),('2008-06-18',200825,6,2008,18,25,200806,2008),('2008-06-19',200825,6,2008,19,25,200806,2008),('2008-06-20',200825,6,2008,20,25,200806,2008),('2008-06-21',200825,6,2008,21,25,200806,2008),('2008-06-22',200826,6,2008,22,26,200806,2008),('2008-06-23',200826,6,2008,23,26,200806,2008),('2008-06-24',200826,6,2008,24,26,200806,2008),('2008-06-25',200826,6,2008,25,26,200806,2008),('2008-06-26',200826,6,2008,26,26,200806,2008),('2008-06-27',200826,6,2008,27,26,200806,2008),('2008-06-28',200826,6,2008,28,26,200806,2008),('2008-06-29',200827,6,2008,29,27,200806,2008),('2008-06-30',200827,6,2008,30,27,200806,2008),('2008-07-01',200827,7,2008,1,27,200807,2008),('2008-07-02',200827,7,2008,2,27,200807,2008),('2008-07-03',200827,7,2008,3,27,200807,2008),('2008-07-04',200827,7,2008,4,27,200807,2008),('2008-07-05',200827,7,2008,5,27,200807,2008),('2008-07-06',200828,7,2008,6,28,200807,2008),('2008-07-07',200828,7,2008,7,28,200807,2008),('2008-07-08',200828,7,2008,8,28,200807,2008),('2008-07-09',200828,7,2008,9,28,200807,2008),('2008-07-10',200828,7,2008,10,28,200807,2008),('2008-07-11',200828,7,2008,11,28,200807,2008),('2008-07-12',200828,7,2008,12,28,200807,2008),('2008-07-13',200829,7,2008,13,29,200807,2008),('2008-07-14',200829,7,2008,14,29,200807,2008),('2008-07-15',200829,7,2008,15,29,200807,2008),('2008-07-16',200829,7,2008,16,29,200807,2008),('2008-07-17',200829,7,2008,17,29,200807,2008),('2008-07-18',200829,7,2008,18,29,200807,2008),('2008-07-19',200829,7,2008,19,29,200807,2008),('2008-07-20',200830,7,2008,20,30,200807,2008),('2008-07-21',200830,7,2008,21,30,200807,2008),('2008-07-22',200830,7,2008,22,30,200807,2008),('2008-07-23',200830,7,2008,23,30,200807,2008),('2008-07-24',200830,7,2008,24,30,200807,2008),('2008-07-25',200830,7,2008,25,30,200807,2008),('2008-07-26',200830,7,2008,26,30,200807,2008),('2008-07-27',200831,7,2008,27,31,200807,2008),('2008-07-28',200831,7,2008,28,31,200807,2008),('2008-07-29',200831,7,2008,29,31,200807,2008),('2008-07-30',200831,7,2008,30,31,200807,2008),('2008-07-31',200831,7,2008,31,31,200807,2008),('2008-08-01',200831,8,2008,1,31,200808,2008),('2008-08-02',200831,8,2008,2,31,200808,2008),('2008-08-03',200832,8,2008,3,32,200808,2008),('2008-08-04',200832,8,2008,4,32,200808,2008),('2008-08-05',200832,8,2008,5,32,200808,2008),('2008-08-06',200832,8,2008,6,32,200808,2008),('2008-08-07',200832,8,2008,7,32,200808,2008),('2008-08-08',200832,8,2008,8,32,200808,2008),('2008-08-09',200832,8,2008,9,32,200808,2008),('2008-08-10',200833,8,2008,10,33,200808,2008),('2008-08-11',200833,8,2008,11,33,200808,2008),('2008-08-12',200833,8,2008,12,33,200808,2008),('2008-08-13',200833,8,2008,13,33,200808,2008),('2008-08-14',200833,8,2008,14,33,200808,2008),('2008-08-15',200833,8,2008,15,33,200808,2008),('2008-08-16',200833,8,2008,16,33,200808,2008),('2008-08-17',200834,8,2008,17,34,200808,2008),('2008-08-18',200834,8,2008,18,34,200808,2008),('2008-08-19',200834,8,2008,19,34,200808,2008),('2008-08-20',200834,8,2008,20,34,200808,2008),('2008-08-21',200834,8,2008,21,34,200808,2008),('2008-08-22',200834,8,2008,22,34,200808,2008),('2008-08-23',200834,8,2008,23,34,200808,2008),('2008-08-24',200835,8,2008,24,35,200808,2008),('2008-08-25',200835,8,2008,25,35,200808,2008),('2008-08-26',200835,8,2008,26,35,200808,2008),('2008-08-27',200835,8,2008,27,35,200808,2008),('2008-08-28',200835,8,2008,28,35,200808,2008),('2008-08-29',200835,8,2008,29,35,200808,2008),('2008-08-30',200835,8,2008,30,35,200808,2008),('2008-08-31',200836,8,2008,31,36,200808,2008),('2008-09-01',200836,9,2008,1,36,200809,2008),('2008-09-02',200836,9,2008,2,36,200809,2008),('2008-09-03',200836,9,2008,3,36,200809,2008),('2008-09-04',200836,9,2008,4,36,200809,2008),('2008-09-05',200836,9,2008,5,36,200809,2008),('2008-09-06',200836,9,2008,6,36,200809,2008),('2008-09-07',200837,9,2008,7,37,200809,2008),('2008-09-08',200837,9,2008,8,37,200809,2008),('2008-09-09',200837,9,2008,9,37,200809,2008),('2008-09-10',200837,9,2008,10,37,200809,2008),('2008-09-11',200837,9,2008,11,37,200809,2008),('2008-09-12',200837,9,2008,12,37,200809,2008),('2008-09-13',200837,9,2008,13,37,200809,2008),('2008-09-14',200838,9,2008,14,38,200809,2008),('2008-09-15',200838,9,2008,15,38,200809,2008),('2008-09-16',200838,9,2008,16,38,200809,2008),('2008-09-17',200838,9,2008,17,38,200809,2008),('2008-09-18',200838,9,2008,18,38,200809,2008),('2008-09-19',200838,9,2008,19,38,200809,2008),('2008-09-20',200838,9,2008,20,38,200809,2008),('2008-09-21',200839,9,2008,21,39,200809,2008),('2008-09-22',200839,9,2008,22,39,200809,2008),('2008-09-23',200839,9,2008,23,39,200809,2008),('2008-09-24',200839,9,2008,24,39,200809,2008),('2008-09-25',200839,9,2008,25,39,200809,2008),('2008-09-26',200839,9,2008,26,39,200809,2008),('2008-09-27',200839,9,2008,27,39,200809,2008),('2008-09-28',200840,9,2008,28,40,200809,2008),('2008-09-29',200840,9,2008,29,40,200809,2008),('2008-09-30',200840,9,2008,30,40,200809,2008),('2008-10-01',200840,10,2008,1,40,200810,2008),('2008-10-02',200840,10,2008,2,40,200810,2008),('2008-10-03',200840,10,2008,3,40,200810,2008),('2008-10-04',200840,10,2008,4,40,200810,2008),('2008-10-05',200841,10,2008,5,41,200810,2008),('2008-10-06',200841,10,2008,6,41,200810,2008),('2008-10-07',200841,10,2008,7,41,200810,2008),('2008-10-08',200841,10,2008,8,41,200810,2008),('2008-10-09',200841,10,2008,9,41,200810,2008),('2008-10-10',200841,10,2008,10,41,200810,2008),('2008-10-11',200841,10,2008,11,41,200810,2008),('2008-10-12',200842,10,2008,12,42,200810,2008),('2008-10-13',200842,10,2008,13,42,200810,2008),('2008-10-14',200842,10,2008,14,42,200810,2008),('2008-10-15',200842,10,2008,15,42,200810,2008),('2008-10-16',200842,10,2008,16,42,200810,2008),('2008-10-17',200842,10,2008,17,42,200810,2008),('2008-10-18',200842,10,2008,18,42,200810,2008),('2008-10-19',200843,10,2008,19,43,200810,2008),('2008-10-20',200843,10,2008,20,43,200810,2008),('2008-10-21',200843,10,2008,21,43,200810,2008),('2008-10-22',200843,10,2008,22,43,200810,2008),('2008-10-23',200843,10,2008,23,43,200810,2008),('2008-10-24',200843,10,2008,24,43,200810,2008),('2008-10-25',200843,10,2008,25,43,200810,2008),('2008-10-26',200844,10,2008,26,44,200810,2008),('2008-10-27',200844,10,2008,27,44,200810,2008),('2008-10-28',200844,10,2008,28,44,200810,2008),('2008-10-29',200844,10,2008,29,44,200810,2008),('2008-10-30',200844,10,2008,30,44,200810,2008),('2008-10-31',200844,10,2008,31,44,200810,2008),('2008-11-01',200844,11,2008,1,44,200811,2008),('2008-11-02',200845,11,2008,2,45,200811,2008),('2008-11-03',200845,11,2008,3,45,200811,2008),('2008-11-04',200845,11,2008,4,45,200811,2008),('2008-11-05',200845,11,2008,5,45,200811,2008),('2008-11-06',200845,11,2008,6,45,200811,2008),('2008-11-07',200845,11,2008,7,45,200811,2008),('2008-11-08',200845,11,2008,8,45,200811,2008),('2008-11-09',200846,11,2008,9,46,200811,2008),('2008-11-10',200846,11,2008,10,46,200811,2008),('2008-11-11',200846,11,2008,11,46,200811,2008),('2008-11-12',200846,11,2008,12,46,200811,2008),('2008-11-13',200846,11,2008,13,46,200811,2008),('2008-11-14',200846,11,2008,14,46,200811,2008),('2008-11-15',200846,11,2008,15,46,200811,2008),('2008-11-16',200847,11,2008,16,47,200811,2008),('2008-11-17',200847,11,2008,17,47,200811,2008),('2008-11-18',200847,11,2008,18,47,200811,2008),('2008-11-19',200847,11,2008,19,47,200811,2008),('2008-11-20',200847,11,2008,20,47,200811,2008),('2008-11-21',200847,11,2008,21,47,200811,2008),('2008-11-22',200847,11,2008,22,47,200811,2008),('2008-11-23',200848,11,2008,23,48,200811,2008),('2008-11-24',200848,11,2008,24,48,200811,2008),('2008-11-25',200848,11,2008,25,48,200811,2008),('2008-11-26',200848,11,2008,26,48,200811,2008),('2008-11-27',200848,11,2008,27,48,200811,2008),('2008-11-28',200848,11,2008,28,48,200811,2008),('2008-11-29',200848,11,2008,29,48,200811,2008),('2008-11-30',200849,11,2008,30,49,200811,2008),('2008-12-01',200849,12,2008,1,49,200812,2009),('2008-12-02',200849,12,2008,2,49,200812,2009),('2008-12-03',200849,12,2008,3,49,200812,2009),('2008-12-04',200849,12,2008,4,49,200812,2009),('2008-12-05',200849,12,2008,5,49,200812,2009),('2008-12-06',200849,12,2008,6,49,200812,2009),('2008-12-07',200850,12,2008,7,50,200812,2009),('2008-12-08',200850,12,2008,8,50,200812,2009),('2008-12-09',200850,12,2008,9,50,200812,2009),('2008-12-10',200850,12,2008,10,50,200812,2009),('2008-12-11',200850,12,2008,11,50,200812,2009),('2008-12-12',200850,12,2008,12,50,200812,2009),('2008-12-13',200850,12,2008,13,50,200812,2009),('2008-12-14',200851,12,2008,14,51,200812,2009),('2008-12-15',200851,12,2008,15,51,200812,2009),('2008-12-16',200851,12,2008,16,51,200812,2009),('2008-12-17',200851,12,2008,17,51,200812,2009),('2008-12-18',200851,12,2008,18,51,200812,2009),('2008-12-19',200851,12,2008,19,51,200812,2009),('2008-12-20',200851,12,2008,20,51,200812,2009),('2008-12-21',200852,12,2008,21,52,200812,2009),('2008-12-22',200852,12,2008,22,52,200812,2009),('2008-12-23',200852,12,2008,23,52,200812,2009),('2008-12-24',200852,12,2008,24,52,200812,2009),('2008-12-25',200852,12,2008,25,52,200812,2009),('2008-12-26',200852,12,2008,26,52,200812,2009),('2008-12-27',200852,12,2008,27,52,200812,2009),('2008-12-28',200853,12,2008,28,53,200812,2009),('2008-12-29',200901,12,2008,29,53,200812,2009),('2008-12-30',200901,12,2008,30,53,200812,2009),('2008-12-31',200901,12,2008,31,53,200812,2009),('2009-01-01',200901,1,2009,1,53,200901,2009),('2009-01-02',200901,1,2009,2,53,200901,2009),('2009-01-03',200901,1,2009,3,53,200901,2009),('2009-01-04',200902,1,2009,4,1,200901,2009),('2009-01-05',200902,1,2009,5,1,200901,2009),('2009-01-06',200902,1,2009,6,1,200901,2009),('2009-01-07',200902,1,2009,7,1,200901,2009),('2009-01-08',200902,1,2009,8,1,200901,2009),('2009-01-09',200902,1,2009,9,1,200901,2009),('2009-01-10',200902,1,2009,10,1,200901,2009),('2009-01-11',200903,1,2009,11,2,200901,2009),('2009-01-12',200903,1,2009,12,2,200901,2009),('2009-01-13',200903,1,2009,13,2,200901,2009),('2009-01-14',200903,1,2009,14,2,200901,2009),('2009-01-15',200903,1,2009,15,2,200901,2009),('2009-01-16',200903,1,2009,16,2,200901,2009),('2009-01-17',200903,1,2009,17,2,200901,2009),('2009-01-18',200904,1,2009,18,3,200901,2009),('2009-01-19',200904,1,2009,19,3,200901,2009),('2009-01-20',200904,1,2009,20,3,200901,2009),('2009-01-21',200904,1,2009,21,3,200901,2009),('2009-01-22',200904,1,2009,22,3,200901,2009),('2009-01-23',200904,1,2009,23,3,200901,2009),('2009-01-24',200904,1,2009,24,3,200901,2009),('2009-01-25',200905,1,2009,25,4,200901,2009),('2009-01-26',200905,1,2009,26,4,200901,2009),('2009-01-27',200905,1,2009,27,4,200901,2009),('2009-01-28',200905,1,2009,28,4,200901,2009),('2009-01-29',200905,1,2009,29,4,200901,2009),('2009-01-30',200905,1,2009,30,4,200901,2009),('2009-01-31',200905,1,2009,31,4,200901,2009),('2009-02-01',200906,2,2009,1,5,200902,2009),('2009-02-02',200906,2,2009,2,5,200902,2009),('2009-02-03',200906,2,2009,3,5,200902,2009),('2009-02-04',200906,2,2009,4,5,200902,2009),('2009-02-05',200906,2,2009,5,5,200902,2009),('2009-02-06',200906,2,2009,6,5,200902,2009),('2009-02-07',200906,2,2009,7,5,200902,2009),('2009-02-08',200907,2,2009,8,6,200902,2009),('2009-02-09',200907,2,2009,9,6,200902,2009),('2009-02-10',200907,2,2009,10,6,200902,2009),('2009-02-11',200907,2,2009,11,6,200902,2009),('2009-02-12',200907,2,2009,12,6,200902,2009),('2009-02-13',200907,2,2009,13,6,200902,2009),('2009-02-14',200907,2,2009,14,6,200902,2009),('2009-02-15',200908,2,2009,15,7,200902,2009),('2009-02-16',200908,2,2009,16,7,200902,2009),('2009-02-17',200908,2,2009,17,7,200902,2009),('2009-02-18',200908,2,2009,18,7,200902,2009),('2009-02-19',200908,2,2009,19,7,200902,2009),('2009-02-20',200908,2,2009,20,7,200902,2009),('2009-02-21',200908,2,2009,21,7,200902,2009),('2009-02-22',200909,2,2009,22,8,200902,2009),('2009-02-23',200909,2,2009,23,8,200902,2009),('2009-02-24',200909,2,2009,24,8,200902,2009),('2009-02-25',200909,2,2009,25,8,200902,2009),('2009-02-26',200909,2,2009,26,8,200902,2009),('2009-02-27',200909,2,2009,27,8,200902,2009),('2009-02-28',200909,2,2009,28,8,200902,2009),('2009-03-01',200910,3,2009,1,9,200903,2009),('2009-03-02',200910,3,2009,2,9,200903,2009),('2009-03-03',200910,3,2009,3,9,200903,2009),('2009-03-04',200910,3,2009,4,9,200903,2009),('2009-03-05',200910,3,2009,5,9,200903,2009),('2009-03-06',200910,3,2009,6,9,200903,2009),('2009-03-07',200910,3,2009,7,9,200903,2009),('2009-03-08',200911,3,2009,8,10,200903,2009),('2009-03-09',200911,3,2009,9,10,200903,2009),('2009-03-10',200911,3,2009,10,10,200903,2009),('2009-03-11',200911,3,2009,11,10,200903,2009),('2009-03-12',200911,3,2009,12,10,200903,2009),('2009-03-13',200911,3,2009,13,10,200903,2009),('2009-03-14',200911,3,2009,14,10,200903,2009),('2009-03-15',200912,3,2009,15,11,200903,2009),('2009-03-16',200912,3,2009,16,11,200903,2009),('2009-03-17',200912,3,2009,17,11,200903,2009),('2009-03-18',200912,3,2009,18,11,200903,2009),('2009-03-19',200912,3,2009,19,11,200903,2009),('2009-03-20',200912,3,2009,20,11,200903,2009),('2009-03-21',200912,3,2009,21,11,200903,2009),('2009-03-22',200913,3,2009,22,12,200903,2009),('2009-03-23',200913,3,2009,23,12,200903,2009),('2009-03-24',200913,3,2009,24,12,200903,2009),('2009-03-25',200913,3,2009,25,12,200903,2009),('2009-03-26',200913,3,2009,26,12,200903,2009),('2009-03-27',200913,3,2009,27,12,200903,2009),('2009-03-28',200913,3,2009,28,12,200903,2009),('2009-03-29',200914,3,2009,29,13,200903,2009),('2009-03-30',200914,3,2009,30,13,200903,2009),('2009-03-31',200914,3,2009,31,13,200903,2009),('2009-04-01',200914,4,2009,1,13,200904,2009),('2009-04-02',200914,4,2009,2,13,200904,2009),('2009-04-03',200914,4,2009,3,13,200904,2009),('2009-04-04',200914,4,2009,4,13,200904,2009),('2009-04-05',200915,4,2009,5,14,200904,2009),('2009-04-06',200915,4,2009,6,14,200904,2009),('2009-04-07',200915,4,2009,7,14,200904,2009),('2009-04-08',200915,4,2009,8,14,200904,2009),('2009-04-09',200915,4,2009,9,14,200904,2009),('2009-04-10',200915,4,2009,10,14,200904,2009),('2009-04-11',200915,4,2009,11,14,200904,2009),('2009-04-12',200916,4,2009,12,15,200904,2009),('2009-04-13',200916,4,2009,13,15,200904,2009),('2009-04-14',200916,4,2009,14,15,200904,2009),('2009-04-15',200916,4,2009,15,15,200904,2009),('2009-04-16',200916,4,2009,16,15,200904,2009),('2009-04-17',200916,4,2009,17,15,200904,2009),('2009-04-18',200916,4,2009,18,15,200904,2009),('2009-04-19',200917,4,2009,19,16,200904,2009),('2009-04-20',200917,4,2009,20,16,200904,2009),('2009-04-21',200917,4,2009,21,16,200904,2009),('2009-04-22',200917,4,2009,22,16,200904,2009),('2009-04-23',200917,4,2009,23,16,200904,2009),('2009-04-24',200917,4,2009,24,16,200904,2009),('2009-04-25',200917,4,2009,25,16,200904,2009),('2009-04-26',200918,4,2009,26,17,200904,2009),('2009-04-27',200918,4,2009,27,17,200904,2009),('2009-04-28',200918,4,2009,28,17,200904,2009),('2009-04-29',200918,4,2009,29,17,200904,2009),('2009-04-30',200918,4,2009,30,17,200904,2009),('2009-05-01',200918,5,2009,1,17,200905,2009),('2009-05-02',200918,5,2009,2,17,200905,2009),('2009-05-03',200919,5,2009,3,18,200905,2009),('2009-05-04',200919,5,2009,4,18,200905,2009),('2009-05-05',200919,5,2009,5,18,200905,2009),('2009-05-06',200919,5,2009,6,18,200905,2009),('2009-05-07',200919,5,2009,7,18,200905,2009),('2009-05-08',200919,5,2009,8,18,200905,2009),('2009-05-09',200919,5,2009,9,18,200905,2009),('2009-05-10',200920,5,2009,10,19,200905,2009),('2009-05-11',200920,5,2009,11,19,200905,2009),('2009-05-12',200920,5,2009,12,19,200905,2009),('2009-05-13',200920,5,2009,13,19,200905,2009),('2009-05-14',200920,5,2009,14,19,200905,2009),('2009-05-15',200920,5,2009,15,19,200905,2009),('2009-05-16',200920,5,2009,16,19,200905,2009),('2009-05-17',200921,5,2009,17,20,200905,2009),('2009-05-18',200921,5,2009,18,20,200905,2009),('2009-05-19',200921,5,2009,19,20,200905,2009),('2009-05-20',200921,5,2009,20,20,200905,2009),('2009-05-21',200921,5,2009,21,20,200905,2009),('2009-05-22',200921,5,2009,22,20,200905,2009),('2009-05-23',200921,5,2009,23,20,200905,2009),('2009-05-24',200922,5,2009,24,21,200905,2009),('2009-05-25',200922,5,2009,25,21,200905,2009),('2009-05-26',200922,5,2009,26,21,200905,2009),('2009-05-27',200922,5,2009,27,21,200905,2009),('2009-05-28',200922,5,2009,28,21,200905,2009),('2009-05-29',200922,5,2009,29,21,200905,2009),('2009-05-30',200922,5,2009,30,21,200905,2009),('2009-05-31',200923,5,2009,31,22,200905,2009),('2009-06-01',200923,6,2009,1,22,200906,2009),('2009-06-02',200923,6,2009,2,22,200906,2009),('2009-06-03',200923,6,2009,3,22,200906,2009),('2009-06-04',200923,6,2009,4,22,200906,2009),('2009-06-05',200923,6,2009,5,22,200906,2009),('2009-06-06',200923,6,2009,6,22,200906,2009),('2009-06-07',200924,6,2009,7,23,200906,2009),('2009-06-08',200924,6,2009,8,23,200906,2009),('2009-06-09',200924,6,2009,9,23,200906,2009),('2009-06-10',200924,6,2009,10,23,200906,2009),('2009-06-11',200924,6,2009,11,23,200906,2009),('2009-06-12',200924,6,2009,12,23,200906,2009),('2009-06-13',200924,6,2009,13,23,200906,2009),('2009-06-14',200925,6,2009,14,24,200906,2009),('2009-06-15',200925,6,2009,15,24,200906,2009),('2009-06-16',200925,6,2009,16,24,200906,2009),('2009-06-17',200925,6,2009,17,24,200906,2009),('2009-06-18',200925,6,2009,18,24,200906,2009),('2009-06-19',200925,6,2009,19,24,200906,2009),('2009-06-20',200925,6,2009,20,24,200906,2009),('2009-06-21',200926,6,2009,21,25,200906,2009),('2009-06-22',200926,6,2009,22,25,200906,2009),('2009-06-23',200926,6,2009,23,25,200906,2009),('2009-06-24',200926,6,2009,24,25,200906,2009),('2009-06-25',200926,6,2009,25,25,200906,2009),('2009-06-26',200926,6,2009,26,25,200906,2009),('2009-06-27',200926,6,2009,27,25,200906,2009),('2009-06-28',200927,6,2009,28,26,200906,2009),('2009-06-29',200927,6,2009,29,26,200906,2009),('2009-06-30',200927,6,2009,30,26,200906,2009),('2009-07-01',200927,7,2009,1,26,200907,2009),('2009-07-02',200927,7,2009,2,26,200907,2009),('2009-07-03',200927,7,2009,3,26,200907,2009),('2009-07-04',200927,7,2009,4,26,200907,2009),('2009-07-05',200928,7,2009,5,27,200907,2009),('2009-07-06',200928,7,2009,6,27,200907,2009),('2009-07-07',200928,7,2009,7,27,200907,2009),('2009-07-08',200928,7,2009,8,27,200907,2009),('2009-07-09',200928,7,2009,9,27,200907,2009),('2009-07-10',200928,7,2009,10,27,200907,2009),('2009-07-11',200928,7,2009,11,27,200907,2009),('2009-07-12',200929,7,2009,12,28,200907,2009),('2009-07-13',200929,7,2009,13,28,200907,2009),('2009-07-14',200929,7,2009,14,28,200907,2009),('2009-07-15',200929,7,2009,15,28,200907,2009),('2009-07-16',200929,7,2009,16,28,200907,2009),('2009-07-17',200929,7,2009,17,28,200907,2009),('2009-07-18',200929,7,2009,18,28,200907,2009),('2009-07-19',200930,7,2009,19,29,200907,2009),('2009-07-20',200930,7,2009,20,29,200907,2009),('2009-07-21',200930,7,2009,21,29,200907,2009),('2009-07-22',200930,7,2009,22,29,200907,2009),('2009-07-23',200930,7,2009,23,29,200907,2009),('2009-07-24',200930,7,2009,24,29,200907,2009),('2009-07-25',200930,7,2009,25,29,200907,2009),('2009-07-26',200931,7,2009,26,30,200907,2009),('2009-07-27',200931,7,2009,27,30,200907,2009),('2009-07-28',200931,7,2009,28,30,200907,2009),('2009-07-29',200931,7,2009,29,30,200907,2009),('2009-07-30',200931,7,2009,30,30,200907,2009),('2009-07-31',200931,7,2009,31,30,200907,2009),('2009-08-01',200931,8,2009,1,30,200908,2009),('2009-08-02',200932,8,2009,2,31,200908,2009),('2009-08-03',200932,8,2009,3,31,200908,2009),('2009-08-04',200932,8,2009,4,31,200908,2009),('2009-08-05',200932,8,2009,5,31,200908,2009),('2009-08-06',200932,8,2009,6,31,200908,2009),('2009-08-07',200932,8,2009,7,31,200908,2009),('2009-08-08',200932,8,2009,8,31,200908,2009),('2009-08-09',200933,8,2009,9,32,200908,2009),('2009-08-10',200933,8,2009,10,32,200908,2009),('2009-08-11',200933,8,2009,11,32,200908,2009),('2009-08-12',200933,8,2009,12,32,200908,2009),('2009-08-13',200933,8,2009,13,32,200908,2009),('2009-08-14',200933,8,2009,14,32,200908,2009),('2009-08-15',200933,8,2009,15,32,200908,2009),('2009-08-16',200934,8,2009,16,33,200908,2009),('2009-08-17',200934,8,2009,17,33,200908,2009),('2009-08-18',200934,8,2009,18,33,200908,2009),('2009-08-19',200934,8,2009,19,33,200908,2009),('2009-08-20',200934,8,2009,20,33,200908,2009),('2009-08-21',200934,8,2009,21,33,200908,2009),('2009-08-22',200934,8,2009,22,33,200908,2009),('2009-08-23',200935,8,2009,23,34,200908,2009),('2009-08-24',200935,8,2009,24,34,200908,2009),('2009-08-25',200935,8,2009,25,34,200908,2009),('2009-08-26',200935,8,2009,26,34,200908,2009),('2009-08-27',200935,8,2009,27,34,200908,2009),('2009-08-28',200935,8,2009,28,34,200908,2009),('2009-08-29',200935,8,2009,29,34,200908,2009),('2009-08-30',200936,8,2009,30,35,200908,2009),('2009-08-31',200936,8,2009,31,35,200908,2009),('2009-09-01',200936,9,2009,1,35,200909,2009),('2009-09-02',200936,9,2009,2,35,200909,2009),('2009-09-03',200936,9,2009,3,35,200909,2009),('2009-09-04',200936,9,2009,4,35,200909,2009),('2009-09-05',200936,9,2009,5,35,200909,2009),('2009-09-06',200937,9,2009,6,36,200909,2009),('2009-09-07',200937,9,2009,7,36,200909,2009),('2009-09-08',200937,9,2009,8,36,200909,2009),('2009-09-09',200937,9,2009,9,36,200909,2009),('2009-09-10',200937,9,2009,10,36,200909,2009),('2009-09-11',200937,9,2009,11,36,200909,2009),('2009-09-12',200937,9,2009,12,36,200909,2009),('2009-09-13',200938,9,2009,13,37,200909,2009),('2009-09-14',200938,9,2009,14,37,200909,2009),('2009-09-15',200938,9,2009,15,37,200909,2009),('2009-09-16',200938,9,2009,16,37,200909,2009),('2009-09-17',200938,9,2009,17,37,200909,2009),('2009-09-18',200938,9,2009,18,37,200909,2009),('2009-09-19',200938,9,2009,19,37,200909,2009),('2009-09-20',200939,9,2009,20,38,200909,2009),('2009-09-21',200939,9,2009,21,38,200909,2009),('2009-09-22',200939,9,2009,22,38,200909,2009),('2009-09-23',200939,9,2009,23,38,200909,2009),('2009-09-24',200939,9,2009,24,38,200909,2009),('2009-09-25',200939,9,2009,25,38,200909,2009),('2009-09-26',200939,9,2009,26,38,200909,2009),('2009-09-27',200940,9,2009,27,39,200909,2009),('2009-09-28',200940,9,2009,28,39,200909,2009),('2009-09-29',200940,9,2009,29,39,200909,2009),('2009-09-30',200940,9,2009,30,39,200909,2009),('2009-10-01',200940,10,2009,1,39,200910,2009),('2009-10-02',200940,10,2009,2,39,200910,2009),('2009-10-03',200940,10,2009,3,39,200910,2009),('2009-10-04',200941,10,2009,4,40,200910,2009),('2009-10-05',200941,10,2009,5,40,200910,2009),('2009-10-06',200941,10,2009,6,40,200910,2009),('2009-10-07',200941,10,2009,7,40,200910,2009),('2009-10-08',200941,10,2009,8,40,200910,2009),('2009-10-09',200941,10,2009,9,40,200910,2009),('2009-10-10',200941,10,2009,10,40,200910,2009),('2009-10-11',200942,10,2009,11,41,200910,2009),('2009-10-12',200942,10,2009,12,41,200910,2009),('2009-10-13',200942,10,2009,13,41,200910,2009),('2009-10-14',200942,10,2009,14,41,200910,2009),('2009-10-15',200942,10,2009,15,41,200910,2009),('2009-10-16',200942,10,2009,16,41,200910,2009),('2009-10-17',200942,10,2009,17,41,200910,2009),('2009-10-18',200943,10,2009,18,42,200910,2009),('2009-10-19',200943,10,2009,19,42,200910,2009),('2009-10-20',200943,10,2009,20,42,200910,2009),('2009-10-21',200943,10,2009,21,42,200910,2009),('2009-10-22',200943,10,2009,22,42,200910,2009),('2009-10-23',200943,10,2009,23,42,200910,2009),('2009-10-24',200943,10,2009,24,42,200910,2009),('2009-10-25',200944,10,2009,25,43,200910,2009),('2009-10-26',200944,10,2009,26,43,200910,2009),('2009-10-27',200944,10,2009,27,43,200910,2009),('2009-10-28',200944,10,2009,28,43,200910,2009),('2009-10-29',200944,10,2009,29,43,200910,2009),('2009-10-30',200944,10,2009,30,43,200910,2009),('2009-10-31',200944,10,2009,31,43,200910,2009),('2009-11-01',200945,11,2009,1,44,200911,2009),('2009-11-02',200945,11,2009,2,44,200911,2009),('2009-11-03',200945,11,2009,3,44,200911,2009),('2009-11-04',200945,11,2009,4,44,200911,2009),('2009-11-05',200945,11,2009,5,44,200911,2009),('2009-11-06',200945,11,2009,6,44,200911,2009),('2009-11-07',200945,11,2009,7,44,200911,2009),('2009-11-08',200946,11,2009,8,45,200911,2009),('2009-11-09',200946,11,2009,9,45,200911,2009),('2009-11-10',200946,11,2009,10,45,200911,2009),('2009-11-11',200946,11,2009,11,45,200911,2009),('2009-11-12',200946,11,2009,12,45,200911,2009),('2009-11-13',200946,11,2009,13,45,200911,2009),('2009-11-14',200946,11,2009,14,45,200911,2009),('2009-11-15',200947,11,2009,15,46,200911,2009),('2009-11-16',200947,11,2009,16,46,200911,2009),('2009-11-17',200947,11,2009,17,46,200911,2009),('2009-11-18',200947,11,2009,18,46,200911,2009),('2009-11-19',200947,11,2009,19,46,200911,2009),('2009-11-20',200947,11,2009,20,46,200911,2009),('2009-11-21',200947,11,2009,21,46,200911,2009),('2009-11-22',200948,11,2009,22,47,200911,2009),('2009-11-23',200948,11,2009,23,47,200911,2009),('2009-11-24',200948,11,2009,24,47,200911,2009),('2009-11-25',200948,11,2009,25,47,200911,2009),('2009-11-26',200948,11,2009,26,47,200911,2009),('2009-11-27',200948,11,2009,27,47,200911,2009),('2009-11-28',200948,11,2009,28,47,200911,2009),('2009-11-29',200949,11,2009,29,48,200911,2009),('2009-11-30',200949,11,2009,30,48,200911,2009),('2009-12-01',200949,12,2009,1,48,200912,2010),('2009-12-02',200949,12,2009,2,48,200912,2010),('2009-12-03',200949,12,2009,3,48,200912,2010),('2009-12-04',200949,12,2009,4,48,200912,2010),('2009-12-05',200949,12,2009,5,48,200912,2010),('2009-12-06',200950,12,2009,6,49,200912,2010),('2009-12-07',200950,12,2009,7,49,200912,2010),('2009-12-08',200950,12,2009,8,49,200912,2010),('2009-12-09',200950,12,2009,9,49,200912,2010),('2009-12-10',200950,12,2009,10,49,200912,2010),('2009-12-11',200950,12,2009,11,49,200912,2010),('2009-12-12',200950,12,2009,12,49,200912,2010),('2009-12-13',200951,12,2009,13,50,200912,2010),('2009-12-14',200951,12,2009,14,50,200912,2010),('2009-12-15',200951,12,2009,15,50,200912,2010),('2009-12-16',200951,12,2009,16,50,200912,2010),('2009-12-17',200951,12,2009,17,50,200912,2010),('2009-12-18',200951,12,2009,18,50,200912,2010),('2009-12-19',200951,12,2009,19,50,200912,2010),('2009-12-20',200952,12,2009,20,51,200912,2010),('2009-12-21',200952,12,2009,21,51,200912,2010),('2009-12-22',200952,12,2009,22,51,200912,2010),('2009-12-23',200952,12,2009,23,51,200912,2010),('2009-12-24',200952,12,2009,24,51,200912,2010),('2009-12-25',200952,12,2009,25,51,200912,2010),('2009-12-26',200952,12,2009,26,51,200912,2010),('2009-12-27',200953,12,2009,27,52,200912,2010),('2009-12-28',200952,12,2009,28,52,200912,2010),('2009-12-29',200952,12,2009,29,52,200912,2010),('2009-12-30',200952,12,2009,30,52,200912,2010),('2009-12-31',200952,12,2009,31,52,200912,2010),('2010-01-01',201001,1,2010,1,52,201001,2010),('2010-01-02',201001,1,2010,2,52,201001,2010),('2010-01-03',201002,1,2010,3,1,201001,2010),('2010-01-04',201001,1,2010,4,1,201001,2010),('2010-01-05',201001,1,2010,5,1,201001,2010),('2010-01-06',201001,1,2010,6,1,201001,2010),('2010-01-07',201001,1,2010,7,1,201001,2010),('2010-01-08',201001,1,2010,8,1,201001,2010),('2010-01-09',201001,1,2010,9,1,201001,2010),('2010-01-10',201002,1,2010,10,2,201001,2010),('2010-01-11',201002,1,2010,11,2,201001,2010),('2010-01-12',201002,1,2010,12,2,201001,2010),('2010-01-13',201002,1,2010,13,2,201001,2010),('2010-01-14',201002,1,2010,14,2,201001,2010),('2010-01-15',201002,1,2010,15,2,201001,2010),('2010-01-16',201002,1,2010,16,2,201001,2010),('2010-01-17',201003,1,2010,17,3,201001,2010),('2010-01-18',201003,1,2010,18,3,201001,2010),('2010-01-19',201003,1,2010,19,3,201001,2010),('2010-01-20',201003,1,2010,20,3,201001,2010),('2010-01-21',201003,1,2010,21,3,201001,2010),('2010-01-22',201003,1,2010,22,3,201001,2010),('2010-01-23',201003,1,2010,23,3,201001,2010),('2010-01-24',201004,1,2010,24,4,201001,2010),('2010-01-25',201004,1,2010,25,4,201001,2010),('2010-01-26',201004,1,2010,26,4,201001,2010),('2010-01-27',201004,1,2010,27,4,201001,2010),('2010-01-28',201004,1,2010,28,4,201001,2010),('2010-01-29',201004,1,2010,29,4,201001,2010),('2010-01-30',201004,1,2010,30,4,201001,2010),('2010-01-31',201005,1,2010,31,5,201001,2010),('2010-02-01',201005,2,2010,1,5,201002,2010),('2010-02-02',201005,2,2010,2,5,201002,2010),('2010-02-03',201005,2,2010,3,5,201002,2010),('2010-02-04',201005,2,2010,4,5,201002,2010),('2010-02-05',201005,2,2010,5,5,201002,2010),('2010-02-06',201005,2,2010,6,5,201002,2010),('2010-02-07',201006,2,2010,7,6,201002,2010),('2010-02-08',201006,2,2010,8,6,201002,2010),('2010-02-09',201006,2,2010,9,6,201002,2010),('2010-02-10',201006,2,2010,10,6,201002,2010),('2010-02-11',201006,2,2010,11,6,201002,2010),('2010-02-12',201006,2,2010,12,6,201002,2010),('2010-02-13',201006,2,2010,13,6,201002,2010),('2010-02-14',201007,2,2010,14,7,201002,2010),('2010-02-15',201007,2,2010,15,7,201002,2010),('2010-02-16',201007,2,2010,16,7,201002,2010),('2010-02-17',201007,2,2010,17,7,201002,2010),('2010-02-18',201007,2,2010,18,7,201002,2010),('2010-02-19',201007,2,2010,19,7,201002,2010),('2010-02-20',201007,2,2010,20,7,201002,2010),('2010-02-21',201008,2,2010,21,8,201002,2010),('2010-02-22',201008,2,2010,22,8,201002,2010),('2010-02-23',201008,2,2010,23,8,201002,2010),('2010-02-24',201008,2,2010,24,8,201002,2010),('2010-02-25',201008,2,2010,25,8,201002,2010),('2010-02-26',201008,2,2010,26,8,201002,2010),('2010-02-27',201008,2,2010,27,8,201002,2010),('2010-02-28',201009,2,2010,28,9,201002,2010),('2010-03-01',201009,3,2010,1,9,201003,2010),('2010-03-02',201009,3,2010,2,9,201003,2010),('2010-03-03',201009,3,2010,3,9,201003,2010),('2010-03-04',201009,3,2010,4,9,201003,2010),('2010-03-05',201009,3,2010,5,9,201003,2010),('2010-03-06',201009,3,2010,6,9,201003,2010),('2010-03-07',201010,3,2010,7,10,201003,2010),('2010-03-08',201010,3,2010,8,10,201003,2010),('2010-03-09',201010,3,2010,9,10,201003,2010),('2010-03-10',201010,3,2010,10,10,201003,2010),('2010-03-11',201010,3,2010,11,10,201003,2010),('2010-03-12',201010,3,2010,12,10,201003,2010),('2010-03-13',201010,3,2010,13,10,201003,2010),('2010-03-14',201011,3,2010,14,11,201003,2010),('2010-03-15',201011,3,2010,15,11,201003,2010),('2010-03-16',201011,3,2010,16,11,201003,2010),('2010-03-17',201011,3,2010,17,11,201003,2010),('2010-03-18',201011,3,2010,18,11,201003,2010),('2010-03-19',201011,3,2010,19,11,201003,2010),('2010-03-20',201011,3,2010,20,11,201003,2010),('2010-03-21',201012,3,2010,21,12,201003,2010),('2010-03-22',201012,3,2010,22,12,201003,2010),('2010-03-23',201012,3,2010,23,12,201003,2010),('2010-03-24',201012,3,2010,24,12,201003,2010),('2010-03-25',201012,3,2010,25,12,201003,2010),('2010-03-26',201012,3,2010,26,12,201003,2010),('2010-03-27',201012,3,2010,27,12,201003,2010),('2010-03-28',201013,3,2010,28,13,201003,2010),('2010-03-29',201013,3,2010,29,13,201003,2010),('2010-03-30',201013,3,2010,30,13,201003,2010),('2010-03-31',201013,3,2010,31,13,201003,2010),('2010-04-01',201013,4,2010,1,13,201004,2010),('2010-04-02',201013,4,2010,2,13,201004,2010),('2010-04-03',201013,4,2010,3,13,201004,2010),('2010-04-04',201014,4,2010,4,14,201004,2010),('2010-04-05',201014,4,2010,5,14,201004,2010),('2010-04-06',201014,4,2010,6,14,201004,2010),('2010-04-07',201014,4,2010,7,14,201004,2010),('2010-04-08',201014,4,2010,8,14,201004,2010),('2010-04-09',201014,4,2010,9,14,201004,2010),('2010-04-10',201014,4,2010,10,14,201004,2010),('2010-04-11',201015,4,2010,11,15,201004,2010),('2010-04-12',201015,4,2010,12,15,201004,2010),('2010-04-13',201015,4,2010,13,15,201004,2010),('2010-04-14',201015,4,2010,14,15,201004,2010),('2010-04-15',201015,4,2010,15,15,201004,2010),('2010-04-16',201015,4,2010,16,15,201004,2010),('2010-04-17',201015,4,2010,17,15,201004,2010),('2010-04-18',201016,4,2010,18,16,201004,2010),('2010-04-19',201016,4,2010,19,16,201004,2010),('2010-04-20',201016,4,2010,20,16,201004,2010),('2010-04-21',201016,4,2010,21,16,201004,2010),('2010-04-22',201016,4,2010,22,16,201004,2010),('2010-04-23',201016,4,2010,23,16,201004,2010),('2010-04-24',201016,4,2010,24,16,201004,2010),('2010-04-25',201017,4,2010,25,17,201004,2010),('2010-04-26',201017,4,2010,26,17,201004,2010),('2010-04-27',201017,4,2010,27,17,201004,2010),('2010-04-28',201017,4,2010,28,17,201004,2010),('2010-04-29',201017,4,2010,29,17,201004,2010),('2010-04-30',201017,4,2010,30,17,201004,2010),('2010-05-01',201017,5,2010,1,17,201005,2010),('2010-05-02',201018,5,2010,2,18,201005,2010),('2010-05-03',201018,5,2010,3,18,201005,2010),('2010-05-04',201018,5,2010,4,18,201005,2010),('2010-05-05',201018,5,2010,5,18,201005,2010),('2010-05-06',201018,5,2010,6,18,201005,2010),('2010-05-07',201018,5,2010,7,18,201005,2010),('2010-05-08',201018,5,2010,8,18,201005,2010),('2010-05-09',201019,5,2010,9,19,201005,2010),('2010-05-10',201019,5,2010,10,19,201005,2010),('2010-05-11',201019,5,2010,11,19,201005,2010),('2010-05-12',201019,5,2010,12,19,201005,2010),('2010-05-13',201019,5,2010,13,19,201005,2010),('2010-05-14',201019,5,2010,14,19,201005,2010),('2010-05-15',201019,5,2010,15,19,201005,2010),('2010-05-16',201020,5,2010,16,20,201005,2010),('2010-05-17',201020,5,2010,17,20,201005,2010),('2010-05-18',201020,5,2010,18,20,201005,2010),('2010-05-19',201020,5,2010,19,20,201005,2010),('2010-05-20',201020,5,2010,20,20,201005,2010),('2010-05-21',201020,5,2010,21,20,201005,2010),('2010-05-22',201020,5,2010,22,20,201005,2010),('2010-05-23',201021,5,2010,23,21,201005,2010),('2010-05-24',201021,5,2010,24,21,201005,2010),('2010-05-25',201021,5,2010,25,21,201005,2010),('2010-05-26',201021,5,2010,26,21,201005,2010),('2010-05-27',201021,5,2010,27,21,201005,2010),('2010-05-28',201021,5,2010,28,21,201005,2010),('2010-05-29',201021,5,2010,29,21,201005,2010),('2010-05-30',201022,5,2010,30,22,201005,2010),('2010-05-31',201022,5,2010,31,22,201005,2010),('2010-06-01',201022,6,2010,1,22,201006,2010),('2010-06-02',201022,6,2010,2,22,201006,2010),('2010-06-03',201022,6,2010,3,22,201006,2010),('2010-06-04',201022,6,2010,4,22,201006,2010),('2010-06-05',201022,6,2010,5,22,201006,2010),('2010-06-06',201023,6,2010,6,23,201006,2010),('2010-06-07',201023,6,2010,7,23,201006,2010),('2010-06-08',201023,6,2010,8,23,201006,2010),('2010-06-09',201023,6,2010,9,23,201006,2010),('2010-06-10',201023,6,2010,10,23,201006,2010),('2010-06-11',201023,6,2010,11,23,201006,2010),('2010-06-12',201023,6,2010,12,23,201006,2010),('2010-06-13',201024,6,2010,13,24,201006,2010),('2010-06-14',201024,6,2010,14,24,201006,2010),('2010-06-15',201024,6,2010,15,24,201006,2010),('2010-06-16',201024,6,2010,16,24,201006,2010),('2010-06-17',201024,6,2010,17,24,201006,2010),('2010-06-18',201024,6,2010,18,24,201006,2010),('2010-06-19',201024,6,2010,19,24,201006,2010),('2010-06-20',201025,6,2010,20,25,201006,2010),('2010-06-21',201025,6,2010,21,25,201006,2010),('2010-06-22',201025,6,2010,22,25,201006,2010),('2010-06-23',201025,6,2010,23,25,201006,2010),('2010-06-24',201025,6,2010,24,25,201006,2010),('2010-06-25',201025,6,2010,25,25,201006,2010),('2010-06-26',201025,6,2010,26,25,201006,2010),('2010-06-27',201026,6,2010,27,26,201006,2010),('2010-06-28',201026,6,2010,28,26,201006,2010),('2010-06-29',201026,6,2010,29,26,201006,2010),('2010-06-30',201026,6,2010,30,26,201006,2010),('2010-07-01',201026,7,2010,1,26,201007,2010),('2010-07-02',201026,7,2010,2,26,201007,2010),('2010-07-03',201026,7,2010,3,26,201007,2010),('2010-07-04',201027,7,2010,4,27,201007,2010),('2010-07-05',201027,7,2010,5,27,201007,2010),('2010-07-06',201027,7,2010,6,27,201007,2010),('2010-07-07',201027,7,2010,7,27,201007,2010),('2010-07-08',201027,7,2010,8,27,201007,2010),('2010-07-09',201027,7,2010,9,27,201007,2010),('2010-07-10',201027,7,2010,10,27,201007,2010),('2010-07-11',201028,7,2010,11,28,201007,2010),('2010-07-12',201028,7,2010,12,28,201007,2010),('2010-07-13',201028,7,2010,13,28,201007,2010),('2010-07-14',201028,7,2010,14,28,201007,2010),('2010-07-15',201028,7,2010,15,28,201007,2010),('2010-07-16',201028,7,2010,16,28,201007,2010),('2010-07-17',201028,7,2010,17,28,201007,2010),('2010-07-18',201029,7,2010,18,29,201007,2010),('2010-07-19',201029,7,2010,19,29,201007,2010),('2010-07-20',201029,7,2010,20,29,201007,2010),('2010-07-21',201029,7,2010,21,29,201007,2010),('2010-07-22',201029,7,2010,22,29,201007,2010),('2010-07-23',201029,7,2010,23,29,201007,2010),('2010-07-24',201029,7,2010,24,29,201007,2010),('2010-07-25',201030,7,2010,25,30,201007,2010),('2010-07-26',201030,7,2010,26,30,201007,2010),('2010-07-27',201030,7,2010,27,30,201007,2010),('2010-07-28',201030,7,2010,28,30,201007,2010),('2010-07-29',201030,7,2010,29,30,201007,2010),('2010-07-30',201030,7,2010,30,30,201007,2010),('2010-07-31',201030,7,2010,31,30,201007,2010),('2010-08-01',201031,8,2010,1,31,201008,2010),('2010-08-02',201031,8,2010,2,31,201008,2010),('2010-08-03',201031,8,2010,3,31,201008,2010),('2010-08-04',201031,8,2010,4,31,201008,2010),('2010-08-05',201031,8,2010,5,31,201008,2010),('2010-08-06',201031,8,2010,6,31,201008,2010),('2010-08-07',201031,8,2010,7,31,201008,2010),('2010-08-08',201032,8,2010,8,32,201008,2010),('2010-08-09',201032,8,2010,9,32,201008,2010),('2010-08-10',201032,8,2010,10,32,201008,2010),('2010-08-11',201032,8,2010,11,32,201008,2010),('2010-08-12',201032,8,2010,12,32,201008,2010),('2010-08-13',201032,8,2010,13,32,201008,2010),('2010-08-14',201032,8,2010,14,32,201008,2010),('2010-08-15',201033,8,2010,15,33,201008,2010),('2010-08-16',201033,8,2010,16,33,201008,2010),('2010-08-17',201033,8,2010,17,33,201008,2010),('2010-08-18',201033,8,2010,18,33,201008,2010),('2010-08-19',201033,8,2010,19,33,201008,2010),('2010-08-20',201033,8,2010,20,33,201008,2010),('2010-08-21',201033,8,2010,21,33,201008,2010),('2010-08-22',201034,8,2010,22,34,201008,2010),('2010-08-23',201034,8,2010,23,34,201008,2010),('2010-08-24',201034,8,2010,24,34,201008,2010),('2010-08-25',201034,8,2010,25,34,201008,2010),('2010-08-26',201034,8,2010,26,34,201008,2010),('2010-08-27',201034,8,2010,27,34,201008,2010),('2010-08-28',201034,8,2010,28,34,201008,2010),('2010-08-29',201035,8,2010,29,35,201008,2010),('2010-08-30',201035,8,2010,30,35,201008,2010),('2010-08-31',201035,8,2010,31,35,201008,2010),('2010-09-01',201035,9,2010,1,35,201009,2010),('2010-09-02',201035,9,2010,2,35,201009,2010),('2010-09-03',201035,9,2010,3,35,201009,2010),('2010-09-04',201035,9,2010,4,35,201009,2010),('2010-09-05',201036,9,2010,5,36,201009,2010),('2010-09-06',201036,9,2010,6,36,201009,2010),('2010-09-07',201036,9,2010,7,36,201009,2010),('2010-09-08',201036,9,2010,8,36,201009,2010),('2010-09-09',201036,9,2010,9,36,201009,2010),('2010-09-10',201036,9,2010,10,36,201009,2010),('2010-09-11',201036,9,2010,11,36,201009,2010),('2010-09-12',201037,9,2010,12,37,201009,2010),('2010-09-13',201037,9,2010,13,37,201009,2010),('2010-09-14',201037,9,2010,14,37,201009,2010),('2010-09-15',201037,9,2010,15,37,201009,2010),('2010-09-16',201037,9,2010,16,37,201009,2010),('2010-09-17',201037,9,2010,17,37,201009,2010),('2010-09-18',201037,9,2010,18,37,201009,2010),('2010-09-19',201038,9,2010,19,38,201009,2010),('2010-09-20',201038,9,2010,20,38,201009,2010),('2010-09-21',201038,9,2010,21,38,201009,2010),('2010-09-22',201038,9,2010,22,38,201009,2010),('2010-09-23',201038,9,2010,23,38,201009,2010),('2010-09-24',201038,9,2010,24,38,201009,2010),('2010-09-25',201038,9,2010,25,38,201009,2010),('2010-09-26',201039,9,2010,26,39,201009,2010),('2010-09-27',201039,9,2010,27,39,201009,2010),('2010-09-28',201039,9,2010,28,39,201009,2010),('2010-09-29',201039,9,2010,29,39,201009,2010),('2010-09-30',201039,9,2010,30,39,201009,2010),('2010-10-01',201039,10,2010,1,39,201010,2010),('2010-10-02',201039,10,2010,2,39,201010,2010),('2010-10-03',201040,10,2010,3,40,201010,2010),('2010-10-04',201040,10,2010,4,40,201010,2010),('2010-10-05',201040,10,2010,5,40,201010,2010),('2010-10-06',201040,10,2010,6,40,201010,2010),('2010-10-07',201040,10,2010,7,40,201010,2010),('2010-10-08',201040,10,2010,8,40,201010,2010),('2010-10-09',201040,10,2010,9,40,201010,2010),('2010-10-10',201041,10,2010,10,41,201010,2010),('2010-10-11',201041,10,2010,11,41,201010,2010),('2010-10-12',201041,10,2010,12,41,201010,2010),('2010-10-13',201041,10,2010,13,41,201010,2010),('2010-10-14',201041,10,2010,14,41,201010,2010),('2010-10-15',201041,10,2010,15,41,201010,2010),('2010-10-16',201041,10,2010,16,41,201010,2010),('2010-10-17',201042,10,2010,17,42,201010,2010),('2010-10-18',201042,10,2010,18,42,201010,2010),('2010-10-19',201042,10,2010,19,42,201010,2010),('2010-10-20',201042,10,2010,20,42,201010,2010),('2010-10-21',201042,10,2010,21,42,201010,2010),('2010-10-22',201042,10,2010,22,42,201010,2010),('2010-10-23',201042,10,2010,23,42,201010,2010),('2010-10-24',201043,10,2010,24,43,201010,2010),('2010-10-25',201043,10,2010,25,43,201010,2010),('2010-10-26',201043,10,2010,26,43,201010,2010),('2010-10-27',201043,10,2010,27,43,201010,2010),('2010-10-28',201043,10,2010,28,43,201010,2010),('2010-10-29',201043,10,2010,29,43,201010,2010),('2010-10-30',201043,10,2010,30,43,201010,2010),('2010-10-31',201044,10,2010,31,44,201010,2010),('2010-11-01',201044,11,2010,1,44,201011,2010),('2010-11-02',201044,11,2010,2,44,201011,2010),('2010-11-03',201044,11,2010,3,44,201011,2010),('2010-11-04',201044,11,2010,4,44,201011,2010),('2010-11-05',201044,11,2010,5,44,201011,2010),('2010-11-06',201044,11,2010,6,44,201011,2010),('2010-11-07',201045,11,2010,7,45,201011,2010),('2010-11-08',201045,11,2010,8,45,201011,2010),('2010-11-09',201045,11,2010,9,45,201011,2010),('2010-11-10',201045,11,2010,10,45,201011,2010),('2010-11-11',201045,11,2010,11,45,201011,2010),('2010-11-12',201045,11,2010,12,45,201011,2010),('2010-11-13',201045,11,2010,13,45,201011,2010),('2010-11-14',201046,11,2010,14,46,201011,2010),('2010-11-15',201046,11,2010,15,46,201011,2010),('2010-11-16',201046,11,2010,16,46,201011,2010),('2010-11-17',201046,11,2010,17,46,201011,2010),('2010-11-18',201046,11,2010,18,46,201011,2010),('2010-11-19',201046,11,2010,19,46,201011,2010),('2010-11-20',201046,11,2010,20,46,201011,2010),('2010-11-21',201047,11,2010,21,47,201011,2010),('2010-11-22',201047,11,2010,22,47,201011,2010),('2010-11-23',201047,11,2010,23,47,201011,2010),('2010-11-24',201047,11,2010,24,47,201011,2010),('2010-11-25',201047,11,2010,25,47,201011,2010),('2010-11-26',201047,11,2010,26,47,201011,2010),('2010-11-27',201047,11,2010,27,47,201011,2010),('2010-11-28',201048,11,2010,28,48,201011,2010),('2010-11-29',201048,11,2010,29,48,201011,2010),('2010-11-30',201048,11,2010,30,48,201011,2010),('2010-12-01',201048,12,2010,1,48,201012,2011),('2010-12-02',201048,12,2010,2,48,201012,2011),('2010-12-03',201048,12,2010,3,48,201012,2011),('2010-12-04',201048,12,2010,4,48,201012,2011),('2010-12-05',201049,12,2010,5,49,201012,2011),('2010-12-06',201049,12,2010,6,49,201012,2011),('2010-12-07',201049,12,2010,7,49,201012,2011),('2010-12-08',201049,12,2010,8,49,201012,2011),('2010-12-09',201049,12,2010,9,49,201012,2011),('2010-12-10',201049,12,2010,10,49,201012,2011),('2010-12-11',201049,12,2010,11,49,201012,2011),('2010-12-12',201050,12,2010,12,50,201012,2011),('2010-12-13',201050,12,2010,13,50,201012,2011),('2010-12-14',201050,12,2010,14,50,201012,2011),('2010-12-15',201050,12,2010,15,50,201012,2011),('2010-12-16',201050,12,2010,16,50,201012,2011),('2010-12-17',201050,12,2010,17,50,201012,2011),('2010-12-18',201050,12,2010,18,50,201012,2011),('2010-12-19',201051,12,2010,19,51,201012,2011),('2010-12-20',201051,12,2010,20,51,201012,2011),('2010-12-21',201051,12,2010,21,51,201012,2011),('2010-12-22',201051,12,2010,22,51,201012,2011),('2010-12-23',201051,12,2010,23,51,201012,2011),('2010-12-24',201051,12,2010,24,51,201012,2011),('2010-12-25',201051,12,2010,25,51,201012,2011),('2010-12-26',201052,12,2010,26,52,201012,2011),('2010-12-27',201052,12,2010,27,52,201012,2011),('2010-12-28',201052,12,2010,28,52,201012,2011),('2010-12-29',201052,12,2010,29,52,201012,2011),('2010-12-30',201052,12,2010,30,52,201012,2011),('2010-12-31',201052,12,2010,31,52,201012,2011),('2011-01-01',201052,1,2011,1,52,201101,2011),('2011-01-02',201053,1,2011,2,1,201101,2011),('2011-01-03',201101,1,2011,3,1,201101,2011),('2011-01-04',201101,1,2011,4,1,201101,2011),('2011-01-05',201101,1,2011,5,1,201101,2011),('2011-01-06',201101,1,2011,6,1,201101,2011),('2011-01-07',201101,1,2011,7,1,201101,2011),('2011-01-08',201101,1,2011,8,1,201101,2011),('2011-01-09',201102,1,2011,9,2,201101,2011),('2011-01-10',201102,1,2011,10,2,201101,2011),('2011-01-11',201102,1,2011,11,2,201101,2011),('2011-01-12',201102,1,2011,12,2,201101,2011),('2011-01-13',201102,1,2011,13,2,201101,2011),('2011-01-14',201102,1,2011,14,2,201101,2011),('2011-01-15',201102,1,2011,15,2,201101,2011),('2011-01-16',201103,1,2011,16,3,201101,2011),('2011-01-17',201103,1,2011,17,3,201101,2011),('2011-01-18',201103,1,2011,18,3,201101,2011),('2011-01-19',201103,1,2011,19,3,201101,2011),('2011-01-20',201103,1,2011,20,3,201101,2011),('2011-01-21',201103,1,2011,21,3,201101,2011),('2011-01-22',201103,1,2011,22,3,201101,2011),('2011-01-23',201104,1,2011,23,4,201101,2011),('2011-01-24',201104,1,2011,24,4,201101,2011),('2011-01-25',201104,1,2011,25,4,201101,2011),('2011-01-26',201104,1,2011,26,4,201101,2011),('2011-01-27',201104,1,2011,27,4,201101,2011),('2011-01-28',201104,1,2011,28,4,201101,2011),('2011-01-29',201104,1,2011,29,4,201101,2011),('2011-01-30',201105,1,2011,30,5,201101,2011),('2011-01-31',201105,1,2011,31,5,201101,2011),('2011-02-01',201105,2,2011,1,5,201102,2011),('2011-02-02',201105,2,2011,2,5,201102,2011),('2011-02-03',201105,2,2011,3,5,201102,2011),('2011-02-04',201105,2,2011,4,5,201102,2011),('2011-02-05',201105,2,2011,5,5,201102,2011),('2011-02-06',201106,2,2011,6,6,201102,2011),('2011-02-07',201106,2,2011,7,6,201102,2011),('2011-02-08',201106,2,2011,8,6,201102,2011),('2011-02-09',201106,2,2011,9,6,201102,2011),('2011-02-10',201106,2,2011,10,6,201102,2011),('2011-02-11',201106,2,2011,11,6,201102,2011),('2011-02-12',201106,2,2011,12,6,201102,2011),('2011-02-13',201107,2,2011,13,7,201102,2011),('2011-02-14',201107,2,2011,14,7,201102,2011),('2011-02-15',201107,2,2011,15,7,201102,2011),('2011-02-16',201107,2,2011,16,7,201102,2011),('2011-02-17',201107,2,2011,17,7,201102,2011),('2011-02-18',201107,2,2011,18,7,201102,2011),('2011-02-19',201107,2,2011,19,7,201102,2011),('2011-02-20',201108,2,2011,20,8,201102,2011),('2011-02-21',201108,2,2011,21,8,201102,2011),('2011-02-22',201108,2,2011,22,8,201102,2011),('2011-02-23',201108,2,2011,23,8,201102,2011),('2011-02-24',201108,2,2011,24,8,201102,2011),('2011-02-25',201108,2,2011,25,8,201102,2011),('2011-02-26',201108,2,2011,26,8,201102,2011),('2011-02-27',201109,2,2011,27,9,201102,2011),('2011-02-28',201109,2,2011,28,9,201102,2011),('2011-03-01',201109,3,2011,1,9,201103,2011),('2011-03-02',201109,3,2011,2,9,201103,2011),('2011-03-03',201109,3,2011,3,9,201103,2011),('2011-03-04',201109,3,2011,4,9,201103,2011),('2011-03-05',201109,3,2011,5,9,201103,2011),('2011-03-06',201110,3,2011,6,10,201103,2011),('2011-03-07',201110,3,2011,7,10,201103,2011),('2011-03-08',201110,3,2011,8,10,201103,2011),('2011-03-09',201110,3,2011,9,10,201103,2011),('2011-03-10',201110,3,2011,10,10,201103,2011),('2011-03-11',201110,3,2011,11,10,201103,2011),('2011-03-12',201110,3,2011,12,10,201103,2011),('2011-03-13',201111,3,2011,13,11,201103,2011),('2011-03-14',201111,3,2011,14,11,201103,2011),('2011-03-15',201111,3,2011,15,11,201103,2011),('2011-03-16',201111,3,2011,16,11,201103,2011),('2011-03-17',201111,3,2011,17,11,201103,2011),('2011-03-18',201111,3,2011,18,11,201103,2011),('2011-03-19',201111,3,2011,19,11,201103,2011),('2011-03-20',201112,3,2011,20,12,201103,2011),('2011-03-21',201112,3,2011,21,12,201103,2011),('2011-03-22',201112,3,2011,22,12,201103,2011),('2011-03-23',201112,3,2011,23,12,201103,2011),('2011-03-24',201112,3,2011,24,12,201103,2011),('2011-03-25',201112,3,2011,25,12,201103,2011),('2011-03-26',201112,3,2011,26,12,201103,2011),('2011-03-27',201113,3,2011,27,13,201103,2011),('2011-03-28',201113,3,2011,28,13,201103,2011),('2011-03-29',201113,3,2011,29,13,201103,2011),('2011-03-30',201113,3,2011,30,13,201103,2011),('2011-03-31',201113,3,2011,31,13,201103,2011),('2011-04-01',201113,4,2011,1,13,201104,2011),('2011-04-02',201113,4,2011,2,13,201104,2011),('2011-04-03',201114,4,2011,3,14,201104,2011),('2011-04-04',201114,4,2011,4,14,201104,2011),('2011-04-05',201114,4,2011,5,14,201104,2011),('2011-04-06',201114,4,2011,6,14,201104,2011),('2011-04-07',201114,4,2011,7,14,201104,2011),('2011-04-08',201114,4,2011,8,14,201104,2011),('2011-04-09',201114,4,2011,9,14,201104,2011),('2011-04-10',201115,4,2011,10,15,201104,2011),('2011-04-11',201115,4,2011,11,15,201104,2011),('2011-04-12',201115,4,2011,12,15,201104,2011),('2011-04-13',201115,4,2011,13,15,201104,2011),('2011-04-14',201115,4,2011,14,15,201104,2011),('2011-04-15',201115,4,2011,15,15,201104,2011),('2011-04-16',201115,4,2011,16,15,201104,2011),('2011-04-17',201116,4,2011,17,16,201104,2011),('2011-04-18',201116,4,2011,18,16,201104,2011),('2011-04-19',201116,4,2011,19,16,201104,2011),('2011-04-20',201116,4,2011,20,16,201104,2011),('2011-04-21',201116,4,2011,21,16,201104,2011),('2011-04-22',201116,4,2011,22,16,201104,2011),('2011-04-23',201116,4,2011,23,16,201104,2011),('2011-04-24',201117,4,2011,24,17,201104,2011),('2011-04-25',201117,4,2011,25,17,201104,2011),('2011-04-26',201117,4,2011,26,17,201104,2011),('2011-04-27',201117,4,2011,27,17,201104,2011),('2011-04-28',201117,4,2011,28,17,201104,2011),('2011-04-29',201117,4,2011,29,17,201104,2011),('2011-04-30',201117,4,2011,30,17,201104,2011),('2011-05-01',201118,5,2011,1,18,201105,2011),('2011-05-02',201118,5,2011,2,18,201105,2011),('2011-05-03',201118,5,2011,3,18,201105,2011),('2011-05-04',201118,5,2011,4,18,201105,2011),('2011-05-05',201118,5,2011,5,18,201105,2011),('2011-05-06',201118,5,2011,6,18,201105,2011),('2011-05-07',201118,5,2011,7,18,201105,2011),('2011-05-08',201119,5,2011,8,19,201105,2011),('2011-05-09',201119,5,2011,9,19,201105,2011),('2011-05-10',201119,5,2011,10,19,201105,2011),('2011-05-11',201119,5,2011,11,19,201105,2011),('2011-05-12',201119,5,2011,12,19,201105,2011),('2011-05-13',201119,5,2011,13,19,201105,2011),('2011-05-14',201119,5,2011,14,19,201105,2011),('2011-05-15',201120,5,2011,15,20,201105,2011),('2011-05-16',201120,5,2011,16,20,201105,2011),('2011-05-17',201120,5,2011,17,20,201105,2011),('2011-05-18',201120,5,2011,18,20,201105,2011),('2011-05-19',201120,5,2011,19,20,201105,2011),('2011-05-20',201120,5,2011,20,20,201105,2011),('2011-05-21',201120,5,2011,21,20,201105,2011),('2011-05-22',201121,5,2011,22,21,201105,2011),('2011-05-23',201121,5,2011,23,21,201105,2011),('2011-05-24',201121,5,2011,24,21,201105,2011),('2011-05-25',201121,5,2011,25,21,201105,2011),('2011-05-26',201121,5,2011,26,21,201105,2011),('2011-05-27',201121,5,2011,27,21,201105,2011),('2011-05-28',201121,5,2011,28,21,201105,2011),('2011-05-29',201122,5,2011,29,22,201105,2011),('2011-05-30',201122,5,2011,30,22,201105,2011),('2011-05-31',201122,5,2011,31,22,201105,2011),('2011-06-01',201122,6,2011,1,22,201106,2011),('2011-06-02',201122,6,2011,2,22,201106,2011),('2011-06-03',201122,6,2011,3,22,201106,2011),('2011-06-04',201122,6,2011,4,22,201106,2011),('2011-06-05',201123,6,2011,5,23,201106,2011),('2011-06-06',201123,6,2011,6,23,201106,2011),('2011-06-07',201123,6,2011,7,23,201106,2011),('2011-06-08',201123,6,2011,8,23,201106,2011),('2011-06-09',201123,6,2011,9,23,201106,2011),('2011-06-10',201123,6,2011,10,23,201106,2011),('2011-06-11',201123,6,2011,11,23,201106,2011),('2011-06-12',201124,6,2011,12,24,201106,2011),('2011-06-13',201124,6,2011,13,24,201106,2011),('2011-06-14',201124,6,2011,14,24,201106,2011),('2011-06-15',201124,6,2011,15,24,201106,2011),('2011-06-16',201124,6,2011,16,24,201106,2011),('2011-06-17',201124,6,2011,17,24,201106,2011),('2011-06-18',201124,6,2011,18,24,201106,2011),('2011-06-19',201125,6,2011,19,25,201106,2011),('2011-06-20',201125,6,2011,20,25,201106,2011),('2011-06-21',201125,6,2011,21,25,201106,2011),('2011-06-22',201125,6,2011,22,25,201106,2011),('2011-06-23',201125,6,2011,23,25,201106,2011),('2011-06-24',201125,6,2011,24,25,201106,2011),('2011-06-25',201125,6,2011,25,25,201106,2011),('2011-06-26',201126,6,2011,26,26,201106,2011),('2011-06-27',201126,6,2011,27,26,201106,2011),('2011-06-28',201126,6,2011,28,26,201106,2011),('2011-06-29',201126,6,2011,29,26,201106,2011),('2011-06-30',201126,6,2011,30,26,201106,2011),('2011-07-01',201126,7,2011,1,26,201107,2011),('2011-07-02',201126,7,2011,2,26,201107,2011),('2011-07-03',201127,7,2011,3,27,201107,2011),('2011-07-04',201127,7,2011,4,27,201107,2011),('2011-07-05',201127,7,2011,5,27,201107,2011),('2011-07-06',201127,7,2011,6,27,201107,2011),('2011-07-07',201127,7,2011,7,27,201107,2011),('2011-07-08',201127,7,2011,8,27,201107,2011),('2011-07-09',201127,7,2011,9,27,201107,2011),('2011-07-10',201128,7,2011,10,28,201107,2011),('2011-07-11',201128,7,2011,11,28,201107,2011),('2011-07-12',201128,7,2011,12,28,201107,2011),('2011-07-13',201128,7,2011,13,28,201107,2011),('2011-07-14',201128,7,2011,14,28,201107,2011),('2011-07-15',201128,7,2011,15,28,201107,2011),('2011-07-16',201128,7,2011,16,28,201107,2011),('2011-07-17',201129,7,2011,17,29,201107,2011),('2011-07-18',201129,7,2011,18,29,201107,2011),('2011-07-19',201129,7,2011,19,29,201107,2011),('2011-07-20',201129,7,2011,20,29,201107,2011),('2011-07-21',201129,7,2011,21,29,201107,2011),('2011-07-22',201129,7,2011,22,29,201107,2011),('2011-07-23',201129,7,2011,23,29,201107,2011),('2011-07-24',201130,7,2011,24,30,201107,2011),('2011-07-25',201130,7,2011,25,30,201107,2011),('2011-07-26',201130,7,2011,26,30,201107,2011),('2011-07-27',201130,7,2011,27,30,201107,2011),('2011-07-28',201130,7,2011,28,30,201107,2011),('2011-07-29',201130,7,2011,29,30,201107,2011),('2011-07-30',201130,7,2011,30,30,201107,2011),('2011-07-31',201131,7,2011,31,31,201107,2011),('2011-08-01',201131,8,2011,1,31,201108,2011),('2011-08-02',201131,8,2011,2,31,201108,2011),('2011-08-03',201131,8,2011,3,31,201108,2011),('2011-08-04',201131,8,2011,4,31,201108,2011),('2011-08-05',201131,8,2011,5,31,201108,2011),('2011-08-06',201131,8,2011,6,31,201108,2011),('2011-08-07',201132,8,2011,7,32,201108,2011),('2011-08-08',201132,8,2011,8,32,201108,2011),('2011-08-09',201132,8,2011,9,32,201108,2011),('2011-08-10',201132,8,2011,10,32,201108,2011),('2011-08-11',201132,8,2011,11,32,201108,2011),('2011-08-12',201132,8,2011,12,32,201108,2011),('2011-08-13',201132,8,2011,13,32,201108,2011),('2011-08-14',201133,8,2011,14,33,201108,2011),('2011-08-15',201133,8,2011,15,33,201108,2011),('2011-08-16',201133,8,2011,16,33,201108,2011),('2011-08-17',201133,8,2011,17,33,201108,2011),('2011-08-18',201133,8,2011,18,33,201108,2011),('2011-08-19',201133,8,2011,19,33,201108,2011),('2011-08-20',201133,8,2011,20,33,201108,2011),('2011-08-21',201134,8,2011,21,34,201108,2011),('2011-08-22',201134,8,2011,22,34,201108,2011),('2011-08-23',201134,8,2011,23,34,201108,2011),('2011-08-24',201134,8,2011,24,34,201108,2011),('2011-08-25',201134,8,2011,25,34,201108,2011),('2011-08-26',201134,8,2011,26,34,201108,2011),('2011-08-27',201134,8,2011,27,34,201108,2011),('2011-08-28',201135,8,2011,28,35,201108,2011),('2011-08-29',201135,8,2011,29,35,201108,2011),('2011-08-30',201135,8,2011,30,35,201108,2011),('2011-08-31',201135,8,2011,31,35,201108,2011),('2011-09-01',201135,9,2011,1,35,201109,2011),('2011-09-02',201135,9,2011,2,35,201109,2011),('2011-09-03',201135,9,2011,3,35,201109,2011),('2011-09-04',201136,9,2011,4,36,201109,2011),('2011-09-05',201136,9,2011,5,36,201109,2011),('2011-09-06',201136,9,2011,6,36,201109,2011),('2011-09-07',201136,9,2011,7,36,201109,2011),('2011-09-08',201136,9,2011,8,36,201109,2011),('2011-09-09',201136,9,2011,9,36,201109,2011),('2011-09-10',201136,9,2011,10,36,201109,2011),('2011-09-11',201137,9,2011,11,37,201109,2011),('2011-09-12',201137,9,2011,12,37,201109,2011),('2011-09-13',201137,9,2011,13,37,201109,2011),('2011-09-14',201137,9,2011,14,37,201109,2011),('2011-09-15',201137,9,2011,15,37,201109,2011),('2011-09-16',201137,9,2011,16,37,201109,2011),('2011-09-17',201137,9,2011,17,37,201109,2011),('2011-09-18',201138,9,2011,18,38,201109,2011),('2011-09-19',201138,9,2011,19,38,201109,2011),('2011-09-20',201138,9,2011,20,38,201109,2011),('2011-09-21',201138,9,2011,21,38,201109,2011),('2011-09-22',201138,9,2011,22,38,201109,2011),('2011-09-23',201138,9,2011,23,38,201109,2011),('2011-09-24',201138,9,2011,24,38,201109,2011),('2011-09-25',201139,9,2011,25,39,201109,2011),('2011-09-26',201139,9,2011,26,39,201109,2011),('2011-09-27',201139,9,2011,27,39,201109,2011),('2011-09-28',201139,9,2011,28,39,201109,2011),('2011-09-29',201139,9,2011,29,39,201109,2011),('2011-09-30',201139,9,2011,30,39,201109,2011),('2011-10-01',201139,10,2011,1,39,201110,2011),('2011-10-02',201140,10,2011,2,40,201110,2011),('2011-10-03',201140,10,2011,3,40,201110,2011),('2011-10-04',201140,10,2011,4,40,201110,2011),('2011-10-05',201140,10,2011,5,40,201110,2011),('2011-10-06',201140,10,2011,6,40,201110,2011),('2011-10-07',201140,10,2011,7,40,201110,2011),('2011-10-08',201140,10,2011,8,40,201110,2011),('2011-10-09',201141,10,2011,9,41,201110,2011),('2011-10-10',201141,10,2011,10,41,201110,2011),('2011-10-11',201141,10,2011,11,41,201110,2011),('2011-10-12',201141,10,2011,12,41,201110,2011),('2011-10-13',201141,10,2011,13,41,201110,2011),('2011-10-14',201141,10,2011,14,41,201110,2011),('2011-10-15',201141,10,2011,15,41,201110,2011),('2011-10-16',201142,10,2011,16,42,201110,2011),('2011-10-17',201142,10,2011,17,42,201110,2011),('2011-10-18',201142,10,2011,18,42,201110,2011),('2011-10-19',201142,10,2011,19,42,201110,2011),('2011-10-20',201142,10,2011,20,42,201110,2011),('2011-10-21',201142,10,2011,21,42,201110,2011),('2011-10-22',201142,10,2011,22,42,201110,2011),('2011-10-23',201143,10,2011,23,43,201110,2011),('2011-10-24',201143,10,2011,24,43,201110,2011),('2011-10-25',201143,10,2011,25,43,201110,2011),('2011-10-26',201143,10,2011,26,43,201110,2011),('2011-10-27',201143,10,2011,27,43,201110,2011),('2011-10-28',201143,10,2011,28,43,201110,2011),('2011-10-29',201143,10,2011,29,43,201110,2011),('2011-10-30',201144,10,2011,30,44,201110,2011),('2011-10-31',201144,10,2011,31,44,201110,2011),('2011-11-01',201144,11,2011,1,44,201111,2011),('2011-11-02',201144,11,2011,2,44,201111,2011),('2011-11-03',201144,11,2011,3,44,201111,2011),('2011-11-04',201144,11,2011,4,44,201111,2011),('2011-11-05',201144,11,2011,5,44,201111,2011),('2011-11-06',201145,11,2011,6,45,201111,2011),('2011-11-07',201145,11,2011,7,45,201111,2011),('2011-11-08',201145,11,2011,8,45,201111,2011),('2011-11-09',201145,11,2011,9,45,201111,2011),('2011-11-10',201145,11,2011,10,45,201111,2011),('2011-11-11',201145,11,2011,11,45,201111,2011),('2011-11-12',201145,11,2011,12,45,201111,2011),('2011-11-13',201146,11,2011,13,46,201111,2011),('2011-11-14',201146,11,2011,14,46,201111,2011),('2011-11-15',201146,11,2011,15,46,201111,2011),('2011-11-16',201146,11,2011,16,46,201111,2011),('2011-11-17',201146,11,2011,17,46,201111,2011),('2011-11-18',201146,11,2011,18,46,201111,2011),('2011-11-19',201146,11,2011,19,46,201111,2011),('2011-11-20',201147,11,2011,20,47,201111,2011),('2011-11-21',201147,11,2011,21,47,201111,2011),('2011-11-22',201147,11,2011,22,47,201111,2011),('2011-11-23',201147,11,2011,23,47,201111,2011),('2011-11-24',201147,11,2011,24,47,201111,2011),('2011-11-25',201147,11,2011,25,47,201111,2011),('2011-11-26',201147,11,2011,26,47,201111,2011),('2011-11-27',201148,11,2011,27,48,201111,2011),('2011-11-28',201148,11,2011,28,48,201111,2011),('2011-11-29',201148,11,2011,29,48,201111,2011),('2011-11-30',201148,11,2011,30,48,201111,2011),('2011-12-01',201148,12,2011,1,48,201112,2012),('2011-12-02',201148,12,2011,2,48,201112,2012),('2011-12-03',201148,12,2011,3,48,201112,2012),('2011-12-04',201149,12,2011,4,49,201112,2012),('2011-12-05',201149,12,2011,5,49,201112,2012),('2011-12-06',201149,12,2011,6,49,201112,2012),('2011-12-07',201149,12,2011,7,49,201112,2012),('2011-12-08',201149,12,2011,8,49,201112,2012),('2011-12-09',201149,12,2011,9,49,201112,2012),('2011-12-10',201149,12,2011,10,49,201112,2012),('2011-12-11',201150,12,2011,11,50,201112,2012),('2011-12-12',201150,12,2011,12,50,201112,2012),('2011-12-13',201150,12,2011,13,50,201112,2012),('2011-12-14',201150,12,2011,14,50,201112,2012),('2011-12-15',201150,12,2011,15,50,201112,2012),('2011-12-16',201150,12,2011,16,50,201112,2012),('2011-12-17',201150,12,2011,17,50,201112,2012),('2011-12-18',201151,12,2011,18,51,201112,2012),('2011-12-19',201151,12,2011,19,51,201112,2012),('2011-12-20',201151,12,2011,20,51,201112,2012),('2011-12-21',201151,12,2011,21,51,201112,2012),('2011-12-22',201151,12,2011,22,51,201112,2012),('2011-12-23',201151,12,2011,23,51,201112,2012),('2011-12-24',201151,12,2011,24,51,201112,2012),('2011-12-25',201152,12,2011,25,52,201112,2012),('2011-12-26',201152,12,2011,26,52,201112,2012),('2011-12-27',201152,12,2011,27,52,201112,2012),('2011-12-28',201152,12,2011,28,52,201112,2012),('2011-12-29',201152,12,2011,29,52,201112,2012),('2011-12-30',201152,12,2011,30,52,201112,2012),('2011-12-31',201152,12,2011,31,52,201112,2012),('2012-01-01',201153,1,2012,1,1,201201,2012),('2012-01-02',201201,1,2012,2,1,201201,2012),('2012-01-03',201201,1,2012,3,1,201201,2012),('2012-01-04',201201,1,2012,4,1,201201,2012),('2012-01-05',201201,1,2012,5,1,201201,2012),('2012-01-06',201201,1,2012,6,1,201201,2012),('2012-01-07',201201,1,2012,7,1,201201,2012),('2012-01-08',201202,1,2012,8,2,201201,2012),('2012-01-09',201202,1,2012,9,2,201201,2012),('2012-01-10',201202,1,2012,10,2,201201,2012),('2012-01-11',201202,1,2012,11,2,201201,2012),('2012-01-12',201202,1,2012,12,2,201201,2012),('2012-01-13',201202,1,2012,13,2,201201,2012),('2012-01-14',201202,1,2012,14,2,201201,2012),('2012-01-15',201203,1,2012,15,3,201201,2012),('2012-01-16',201203,1,2012,16,3,201201,2012),('2012-01-17',201203,1,2012,17,3,201201,2012),('2012-01-18',201203,1,2012,18,3,201201,2012),('2012-01-19',201203,1,2012,19,3,201201,2012),('2012-01-20',201203,1,2012,20,3,201201,2012),('2012-01-21',201203,1,2012,21,3,201201,2012),('2012-01-22',201204,1,2012,22,4,201201,2012),('2012-01-23',201204,1,2012,23,4,201201,2012),('2012-01-24',201204,1,2012,24,4,201201,2012),('2012-01-25',201204,1,2012,25,4,201201,2012),('2012-01-26',201204,1,2012,26,4,201201,2012),('2012-01-27',201204,1,2012,27,4,201201,2012),('2012-01-28',201204,1,2012,28,4,201201,2012),('2012-01-29',201205,1,2012,29,5,201201,2012),('2012-01-30',201205,1,2012,30,5,201201,2012),('2012-01-31',201205,1,2012,31,5,201201,2012),('2012-02-01',201205,2,2012,1,5,201202,2012),('2012-02-02',201205,2,2012,2,5,201202,2012),('2012-02-03',201205,2,2012,3,5,201202,2012),('2012-02-04',201205,2,2012,4,5,201202,2012),('2012-02-05',201206,2,2012,5,6,201202,2012),('2012-02-06',201206,2,2012,6,6,201202,2012),('2012-02-07',201206,2,2012,7,6,201202,2012),('2012-02-08',201206,2,2012,8,6,201202,2012),('2012-02-09',201206,2,2012,9,6,201202,2012),('2012-02-10',201206,2,2012,10,6,201202,2012),('2012-02-11',201206,2,2012,11,6,201202,2012),('2012-02-12',201207,2,2012,12,7,201202,2012),('2012-02-13',201207,2,2012,13,7,201202,2012),('2012-02-14',201207,2,2012,14,7,201202,2012),('2012-02-15',201207,2,2012,15,7,201202,2012),('2012-02-16',201207,2,2012,16,7,201202,2012),('2012-02-17',201207,2,2012,17,7,201202,2012),('2012-02-18',201207,2,2012,18,7,201202,2012),('2012-02-19',201208,2,2012,19,8,201202,2012),('2012-02-20',201208,2,2012,20,8,201202,2012),('2012-02-21',201208,2,2012,21,8,201202,2012),('2012-02-22',201208,2,2012,22,8,201202,2012),('2012-02-23',201208,2,2012,23,8,201202,2012),('2012-02-24',201208,2,2012,24,8,201202,2012),('2012-02-25',201208,2,2012,25,8,201202,2012),('2012-02-26',201209,2,2012,26,9,201202,2012),('2012-02-27',201209,2,2012,27,9,201202,2012),('2012-02-28',201209,2,2012,28,9,201202,2012),('2012-02-29',201209,2,2012,29,9,201202,2012),('2012-03-01',201209,3,2012,1,9,201203,2012),('2012-03-02',201209,3,2012,2,9,201203,2012),('2012-03-03',201209,3,2012,3,9,201203,2012),('2012-03-04',201210,3,2012,4,10,201203,2012),('2012-03-05',201210,3,2012,5,10,201203,2012),('2012-03-06',201210,3,2012,6,10,201203,2012),('2012-03-07',201210,3,2012,7,10,201203,2012),('2012-03-08',201210,3,2012,8,10,201203,2012),('2012-03-09',201210,3,2012,9,10,201203,2012),('2012-03-10',201210,3,2012,10,10,201203,2012),('2012-03-11',201211,3,2012,11,11,201203,2012),('2012-03-12',201211,3,2012,12,11,201203,2012),('2012-03-13',201211,3,2012,13,11,201203,2012),('2012-03-14',201211,3,2012,14,11,201203,2012),('2012-03-15',201211,3,2012,15,11,201203,2012),('2012-03-16',201211,3,2012,16,11,201203,2012),('2012-03-17',201211,3,2012,17,11,201203,2012),('2012-03-18',201212,3,2012,18,12,201203,2012),('2012-03-19',201212,3,2012,19,12,201203,2012),('2012-03-20',201212,3,2012,20,12,201203,2012),('2012-03-21',201212,3,2012,21,12,201203,2012),('2012-03-22',201212,3,2012,22,12,201203,2012),('2012-03-23',201212,3,2012,23,12,201203,2012),('2012-03-24',201212,3,2012,24,12,201203,2012),('2012-03-25',201213,3,2012,25,13,201203,2012),('2012-03-26',201213,3,2012,26,13,201203,2012),('2012-03-27',201213,3,2012,27,13,201203,2012),('2012-03-28',201213,3,2012,28,13,201203,2012),('2012-03-29',201213,3,2012,29,13,201203,2012),('2012-03-30',201213,3,2012,30,13,201203,2012),('2012-03-31',201213,3,2012,31,13,201203,2012),('2012-04-01',201214,4,2012,1,14,201204,2012),('2012-04-02',201214,4,2012,2,14,201204,2012),('2012-04-03',201214,4,2012,3,14,201204,2012),('2012-04-04',201214,4,2012,4,14,201204,2012),('2012-04-05',201214,4,2012,5,14,201204,2012),('2012-04-06',201214,4,2012,6,14,201204,2012),('2012-04-07',201214,4,2012,7,14,201204,2012),('2012-04-08',201215,4,2012,8,15,201204,2012),('2012-04-09',201215,4,2012,9,15,201204,2012),('2012-04-10',201215,4,2012,10,15,201204,2012),('2012-04-11',201215,4,2012,11,15,201204,2012),('2012-04-12',201215,4,2012,12,15,201204,2012),('2012-04-13',201215,4,2012,13,15,201204,2012),('2012-04-14',201215,4,2012,14,15,201204,2012),('2012-04-15',201216,4,2012,15,16,201204,2012),('2012-04-16',201216,4,2012,16,16,201204,2012),('2012-04-17',201216,4,2012,17,16,201204,2012),('2012-04-18',201216,4,2012,18,16,201204,2012),('2012-04-19',201216,4,2012,19,16,201204,2012),('2012-04-20',201216,4,2012,20,16,201204,2012),('2012-04-21',201216,4,2012,21,16,201204,2012),('2012-04-22',201217,4,2012,22,17,201204,2012),('2012-04-23',201217,4,2012,23,17,201204,2012),('2012-04-24',201217,4,2012,24,17,201204,2012),('2012-04-25',201217,4,2012,25,17,201204,2012),('2012-04-26',201217,4,2012,26,17,201204,2012),('2012-04-27',201217,4,2012,27,17,201204,2012),('2012-04-28',201217,4,2012,28,17,201204,2012),('2012-04-29',201218,4,2012,29,18,201204,2012),('2012-04-30',201218,4,2012,30,18,201204,2012),('2012-05-01',201218,5,2012,1,18,201205,2012),('2012-05-02',201218,5,2012,2,18,201205,2012),('2012-05-03',201218,5,2012,3,18,201205,2012),('2012-05-04',201218,5,2012,4,18,201205,2012),('2012-05-05',201218,5,2012,5,18,201205,2012),('2012-05-06',201219,5,2012,6,19,201205,2012),('2012-05-07',201219,5,2012,7,19,201205,2012),('2012-05-08',201219,5,2012,8,19,201205,2012),('2012-05-09',201219,5,2012,9,19,201205,2012),('2012-05-10',201219,5,2012,10,19,201205,2012),('2012-05-11',201219,5,2012,11,19,201205,2012),('2012-05-12',201219,5,2012,12,19,201205,2012),('2012-05-13',201220,5,2012,13,20,201205,2012),('2012-05-14',201220,5,2012,14,20,201205,2012),('2012-05-15',201220,5,2012,15,20,201205,2012),('2012-05-16',201220,5,2012,16,20,201205,2012),('2012-05-17',201220,5,2012,17,20,201205,2012),('2012-05-18',201220,5,2012,18,20,201205,2012),('2012-05-19',201220,5,2012,19,20,201205,2012),('2012-05-20',201221,5,2012,20,21,201205,2012),('2012-05-21',201221,5,2012,21,21,201205,2012),('2012-05-22',201221,5,2012,22,21,201205,2012),('2012-05-23',201221,5,2012,23,21,201205,2012),('2012-05-24',201221,5,2012,24,21,201205,2012),('2012-05-25',201221,5,2012,25,21,201205,2012),('2012-05-26',201221,5,2012,26,21,201205,2012),('2012-05-27',201222,5,2012,27,22,201205,2012),('2012-05-28',201222,5,2012,28,22,201205,2012),('2012-05-29',201222,5,2012,29,22,201205,2012),('2012-05-30',201222,5,2012,30,22,201205,2012),('2012-05-31',201222,5,2012,31,22,201205,2012),('2012-06-01',201222,6,2012,1,22,201206,2012),('2012-06-02',201222,6,2012,2,22,201206,2012),('2012-06-03',201223,6,2012,3,23,201206,2012),('2012-06-04',201223,6,2012,4,23,201206,2012),('2012-06-05',201223,6,2012,5,23,201206,2012),('2012-06-06',201223,6,2012,6,23,201206,2012),('2012-06-07',201223,6,2012,7,23,201206,2012),('2012-06-08',201223,6,2012,8,23,201206,2012),('2012-06-09',201223,6,2012,9,23,201206,2012),('2012-06-10',201224,6,2012,10,24,201206,2012),('2012-06-11',201224,6,2012,11,24,201206,2012),('2012-06-12',201224,6,2012,12,24,201206,2012),('2012-06-13',201224,6,2012,13,24,201206,2012),('2012-06-14',201224,6,2012,14,24,201206,2012),('2012-06-15',201224,6,2012,15,24,201206,2012),('2012-06-16',201224,6,2012,16,24,201206,2012),('2012-06-17',201225,6,2012,17,25,201206,2012),('2012-06-18',201225,6,2012,18,25,201206,2012),('2012-06-19',201225,6,2012,19,25,201206,2012),('2012-06-20',201225,6,2012,20,25,201206,2012),('2012-06-21',201225,6,2012,21,25,201206,2012),('2012-06-22',201225,6,2012,22,25,201206,2012),('2012-06-23',201225,6,2012,23,25,201206,2012),('2012-06-24',201226,6,2012,24,26,201206,2012),('2012-06-25',201226,6,2012,25,26,201206,2012),('2012-06-26',201226,6,2012,26,26,201206,2012),('2012-06-27',201226,6,2012,27,26,201206,2012),('2012-06-28',201226,6,2012,28,26,201206,2012),('2012-06-29',201226,6,2012,29,26,201206,2012),('2012-06-30',201226,6,2012,30,26,201206,2012),('2012-07-01',201227,7,2012,1,27,201207,2012),('2012-07-02',201227,7,2012,2,27,201207,2012),('2012-07-03',201227,7,2012,3,27,201207,2012),('2012-07-04',201227,7,2012,4,27,201207,2012),('2012-07-05',201227,7,2012,5,27,201207,2012),('2012-07-06',201227,7,2012,6,27,201207,2012),('2012-07-07',201227,7,2012,7,27,201207,2012),('2012-07-08',201228,7,2012,8,28,201207,2012),('2012-07-09',201228,7,2012,9,28,201207,2012),('2012-07-10',201228,7,2012,10,28,201207,2012),('2012-07-11',201228,7,2012,11,28,201207,2012),('2012-07-12',201228,7,2012,12,28,201207,2012),('2012-07-13',201228,7,2012,13,28,201207,2012),('2012-07-14',201228,7,2012,14,28,201207,2012),('2012-07-15',201229,7,2012,15,29,201207,2012),('2012-07-16',201229,7,2012,16,29,201207,2012),('2012-07-17',201229,7,2012,17,29,201207,2012),('2012-07-18',201229,7,2012,18,29,201207,2012),('2012-07-19',201229,7,2012,19,29,201207,2012),('2012-07-20',201229,7,2012,20,29,201207,2012),('2012-07-21',201229,7,2012,21,29,201207,2012),('2012-07-22',201230,7,2012,22,30,201207,2012),('2012-07-23',201230,7,2012,23,30,201207,2012),('2012-07-24',201230,7,2012,24,30,201207,2012),('2012-07-25',201230,7,2012,25,30,201207,2012),('2012-07-26',201230,7,2012,26,30,201207,2012),('2012-07-27',201230,7,2012,27,30,201207,2012),('2012-07-28',201230,7,2012,28,30,201207,2012),('2012-07-29',201231,7,2012,29,31,201207,2012),('2012-07-30',201231,7,2012,30,31,201207,2012),('2012-07-31',201231,7,2012,31,31,201207,2012),('2012-08-01',201231,8,2012,1,31,201208,2012),('2012-08-02',201231,8,2012,2,31,201208,2012),('2012-08-03',201231,8,2012,3,31,201208,2012),('2012-08-04',201231,8,2012,4,31,201208,2012),('2012-08-05',201232,8,2012,5,32,201208,2012),('2012-08-06',201232,8,2012,6,32,201208,2012),('2012-08-07',201232,8,2012,7,32,201208,2012),('2012-08-08',201232,8,2012,8,32,201208,2012),('2012-08-09',201232,8,2012,9,32,201208,2012),('2012-08-10',201232,8,2012,10,32,201208,2012),('2012-08-11',201232,8,2012,11,32,201208,2012),('2012-08-12',201233,8,2012,12,33,201208,2012),('2012-08-13',201233,8,2012,13,33,201208,2012),('2012-08-14',201233,8,2012,14,33,201208,2012),('2012-08-15',201233,8,2012,15,33,201208,2012),('2012-08-16',201233,8,2012,16,33,201208,2012),('2012-08-17',201233,8,2012,17,33,201208,2012),('2012-08-18',201233,8,2012,18,33,201208,2012),('2012-08-19',201234,8,2012,19,34,201208,2012),('2012-08-20',201234,8,2012,20,34,201208,2012),('2012-08-21',201234,8,2012,21,34,201208,2012),('2012-08-22',201234,8,2012,22,34,201208,2012),('2012-08-23',201234,8,2012,23,34,201208,2012),('2012-08-24',201234,8,2012,24,34,201208,2012),('2012-08-25',201234,8,2012,25,34,201208,2012),('2012-08-26',201235,8,2012,26,35,201208,2012),('2012-08-27',201235,8,2012,27,35,201208,2012),('2012-08-28',201235,8,2012,28,35,201208,2012),('2012-08-29',201235,8,2012,29,35,201208,2012),('2012-08-30',201235,8,2012,30,35,201208,2012),('2012-08-31',201235,8,2012,31,35,201208,2012),('2012-09-01',201235,9,2012,1,35,201209,2012),('2012-09-02',201236,9,2012,2,36,201209,2012),('2012-09-03',201236,9,2012,3,36,201209,2012),('2012-09-04',201236,9,2012,4,36,201209,2012),('2012-09-05',201236,9,2012,5,36,201209,2012),('2012-09-06',201236,9,2012,6,36,201209,2012),('2012-09-07',201236,9,2012,7,36,201209,2012),('2012-09-08',201236,9,2012,8,36,201209,2012),('2012-09-09',201237,9,2012,9,37,201209,2012),('2012-09-10',201237,9,2012,10,37,201209,2012),('2012-09-11',201237,9,2012,11,37,201209,2012),('2012-09-12',201237,9,2012,12,37,201209,2012),('2012-09-13',201237,9,2012,13,37,201209,2012),('2012-09-14',201237,9,2012,14,37,201209,2012),('2012-09-15',201237,9,2012,15,37,201209,2012),('2012-09-16',201238,9,2012,16,38,201209,2012),('2012-09-17',201238,9,2012,17,38,201209,2012),('2012-09-18',201238,9,2012,18,38,201209,2012),('2012-09-19',201238,9,2012,19,38,201209,2012),('2012-09-20',201238,9,2012,20,38,201209,2012),('2012-09-21',201238,9,2012,21,38,201209,2012),('2012-09-22',201238,9,2012,22,38,201209,2012),('2012-09-23',201239,9,2012,23,39,201209,2012),('2012-09-24',201239,9,2012,24,39,201209,2012),('2012-09-25',201239,9,2012,25,39,201209,2012),('2012-09-26',201239,9,2012,26,39,201209,2012),('2012-09-27',201239,9,2012,27,39,201209,2012),('2012-09-28',201239,9,2012,28,39,201209,2012),('2012-09-29',201239,9,2012,29,39,201209,2012),('2012-09-30',201240,9,2012,30,40,201209,2012),('2012-10-01',201240,10,2012,1,40,201210,2012),('2012-10-02',201240,10,2012,2,40,201210,2012),('2012-10-03',201240,10,2012,3,40,201210,2012),('2012-10-04',201240,10,2012,4,40,201210,2012),('2012-10-05',201240,10,2012,5,40,201210,2012),('2012-10-06',201240,10,2012,6,40,201210,2012),('2012-10-07',201241,10,2012,7,41,201210,2012),('2012-10-08',201241,10,2012,8,41,201210,2012),('2012-10-09',201241,10,2012,9,41,201210,2012),('2012-10-10',201241,10,2012,10,41,201210,2012),('2012-10-11',201241,10,2012,11,41,201210,2012),('2012-10-12',201241,10,2012,12,41,201210,2012),('2012-10-13',201241,10,2012,13,41,201210,2012),('2012-10-14',201242,10,2012,14,42,201210,2012),('2012-10-15',201242,10,2012,15,42,201210,2012),('2012-10-16',201242,10,2012,16,42,201210,2012),('2012-10-17',201242,10,2012,17,42,201210,2012),('2012-10-18',201242,10,2012,18,42,201210,2012),('2012-10-19',201242,10,2012,19,42,201210,2012),('2012-10-20',201242,10,2012,20,42,201210,2012),('2012-10-21',201243,10,2012,21,43,201210,2012),('2012-10-22',201243,10,2012,22,43,201210,2012),('2012-10-23',201243,10,2012,23,43,201210,2012),('2012-10-24',201243,10,2012,24,43,201210,2012),('2012-10-25',201243,10,2012,25,43,201210,2012),('2012-10-26',201243,10,2012,26,43,201210,2012),('2012-10-27',201243,10,2012,27,43,201210,2012),('2012-10-28',201244,10,2012,28,44,201210,2012),('2012-10-29',201244,10,2012,29,44,201210,2012),('2012-10-30',201244,10,2012,30,44,201210,2012),('2012-10-31',201244,10,2012,31,44,201210,2012),('2012-11-01',201244,11,2012,1,44,201211,2012),('2012-11-02',201244,11,2012,2,44,201211,2012),('2012-11-03',201244,11,2012,3,44,201211,2012),('2012-11-04',201245,11,2012,4,45,201211,2012),('2012-11-05',201245,11,2012,5,45,201211,2012),('2012-11-06',201245,11,2012,6,45,201211,2012),('2012-11-07',201245,11,2012,7,45,201211,2012),('2012-11-08',201245,11,2012,8,45,201211,2012),('2012-11-09',201245,11,2012,9,45,201211,2012),('2012-11-10',201245,11,2012,10,45,201211,2012),('2012-11-11',201246,11,2012,11,46,201211,2012),('2012-11-12',201246,11,2012,12,46,201211,2012),('2012-11-13',201246,11,2012,13,46,201211,2012),('2012-11-14',201246,11,2012,14,46,201211,2012),('2012-11-15',201246,11,2012,15,46,201211,2012),('2012-11-16',201246,11,2012,16,46,201211,2012),('2012-11-17',201246,11,2012,17,46,201211,2012),('2012-11-18',201247,11,2012,18,47,201211,2012),('2012-11-19',201247,11,2012,19,47,201211,2012),('2012-11-20',201247,11,2012,20,47,201211,2012),('2012-11-21',201247,11,2012,21,47,201211,2012),('2012-11-22',201247,11,2012,22,47,201211,2012),('2012-11-23',201247,11,2012,23,47,201211,2012),('2012-11-24',201247,11,2012,24,47,201211,2012),('2012-11-25',201248,11,2012,25,48,201211,2012),('2012-11-26',201248,11,2012,26,48,201211,2012),('2012-11-27',201248,11,2012,27,48,201211,2012),('2012-11-28',201248,11,2012,28,48,201211,2012),('2012-11-29',201248,11,2012,29,48,201211,2012),('2012-11-30',201248,11,2012,30,48,201211,2012),('2012-12-01',201248,12,2012,1,48,201212,2013),('2012-12-02',201249,12,2012,2,49,201212,2013),('2012-12-03',201249,12,2012,3,49,201212,2013),('2012-12-04',201249,12,2012,4,49,201212,2013),('2012-12-05',201249,12,2012,5,49,201212,2013),('2012-12-06',201249,12,2012,6,49,201212,2013),('2012-12-07',201249,12,2012,7,49,201212,2013),('2012-12-08',201249,12,2012,8,49,201212,2013),('2012-12-09',201250,12,2012,9,50,201212,2013),('2012-12-10',201250,12,2012,10,50,201212,2013),('2012-12-11',201250,12,2012,11,50,201212,2013),('2012-12-12',201250,12,2012,12,50,201212,2013),('2012-12-13',201250,12,2012,13,50,201212,2013),('2012-12-14',201250,12,2012,14,50,201212,2013),('2012-12-15',201250,12,2012,15,50,201212,2013),('2012-12-16',201251,12,2012,16,51,201212,2013),('2012-12-17',201251,12,2012,17,51,201212,2013),('2012-12-18',201251,12,2012,18,51,201212,2013),('2012-12-19',201251,12,2012,19,51,201212,2013),('2012-12-20',201251,12,2012,20,51,201212,2013),('2012-12-21',201251,12,2012,21,51,201212,2013),('2012-12-22',201251,12,2012,22,51,201212,2013),('2012-12-23',201252,12,2012,23,52,201212,2013),('2012-12-24',201252,12,2012,24,52,201212,2013),('2012-12-25',201252,12,2012,25,52,201212,2013),('2012-12-26',201252,12,2012,26,52,201212,2013),('2012-12-27',201252,12,2012,27,52,201212,2013),('2012-12-28',201252,12,2012,28,52,201212,2013),('2012-12-29',201252,12,2012,29,52,201212,2013),('2012-12-30',201301,12,2012,30,1,201212,2013),('2012-12-31',201301,12,2012,31,1,201212,2013),('2013-01-01',201301,1,2013,1,1,201301,2013),('2013-01-02',201301,1,2013,2,1,201301,2013),('2013-01-03',201301,1,2013,3,1,201301,2013),('2013-01-04',201301,1,2013,4,1,201301,2013),('2013-01-05',201301,1,2013,5,1,201301,2013),('2013-01-06',201302,1,2013,6,2,201301,2013),('2013-01-07',201302,1,2013,7,2,201301,2013),('2013-01-08',201302,1,2013,8,2,201301,2013),('2013-01-09',201302,1,2013,9,2,201301,2013),('2013-01-10',201302,1,2013,10,2,201301,2013),('2013-01-11',201302,1,2013,11,2,201301,2013),('2013-01-12',201302,1,2013,12,2,201301,2013),('2013-01-13',201303,1,2013,13,3,201301,2013),('2013-01-14',201303,1,2013,14,3,201301,2013),('2013-01-15',201303,1,2013,15,3,201301,2013),('2013-01-16',201303,1,2013,16,3,201301,2013),('2013-01-17',201303,1,2013,17,3,201301,2013),('2013-01-18',201303,1,2013,18,3,201301,2013),('2013-01-19',201303,1,2013,19,3,201301,2013),('2013-01-20',201304,1,2013,20,4,201301,2013),('2013-01-21',201304,1,2013,21,4,201301,2013),('2013-01-22',201304,1,2013,22,4,201301,2013),('2013-01-23',201304,1,2013,23,4,201301,2013),('2013-01-24',201304,1,2013,24,4,201301,2013),('2013-01-25',201304,1,2013,25,4,201301,2013),('2013-01-26',201304,1,2013,26,4,201301,2013),('2013-01-27',201305,1,2013,27,5,201301,2013),('2013-01-28',201305,1,2013,28,5,201301,2013),('2013-01-29',201305,1,2013,29,5,201301,2013),('2013-01-30',201305,1,2013,30,5,201301,2013),('2013-01-31',201305,1,2013,31,5,201301,2013),('2013-02-01',201305,2,2013,1,5,201302,2013),('2013-02-02',201305,2,2013,2,5,201302,2013),('2013-02-03',201306,2,2013,3,6,201302,2013),('2013-02-04',201306,2,2013,4,6,201302,2013),('2013-02-05',201306,2,2013,5,6,201302,2013),('2013-02-06',201306,2,2013,6,6,201302,2013),('2013-02-07',201306,2,2013,7,6,201302,2013),('2013-02-08',201306,2,2013,8,6,201302,2013),('2013-02-09',201306,2,2013,9,6,201302,2013),('2013-02-10',201307,2,2013,10,7,201302,2013),('2013-02-11',201307,2,2013,11,7,201302,2013),('2013-02-12',201307,2,2013,12,7,201302,2013),('2013-02-13',201307,2,2013,13,7,201302,2013),('2013-02-14',201307,2,2013,14,7,201302,2013),('2013-02-15',201307,2,2013,15,7,201302,2013),('2013-02-16',201307,2,2013,16,7,201302,2013),('2013-02-17',201308,2,2013,17,8,201302,2013),('2013-02-18',201308,2,2013,18,8,201302,2013),('2013-02-19',201308,2,2013,19,8,201302,2013),('2013-02-20',201308,2,2013,20,8,201302,2013),('2013-02-21',201308,2,2013,21,8,201302,2013),('2013-02-22',201308,2,2013,22,8,201302,2013),('2013-02-23',201308,2,2013,23,8,201302,2013),('2013-02-24',201309,2,2013,24,9,201302,2013),('2013-02-25',201309,2,2013,25,9,201302,2013),('2013-02-26',201309,2,2013,26,9,201302,2013),('2013-02-27',201309,2,2013,27,9,201302,2013),('2013-02-28',201309,2,2013,28,9,201302,2013),('2013-03-01',201309,3,2013,1,9,201303,2013),('2013-03-02',201309,3,2013,2,9,201303,2013),('2013-03-03',201310,3,2013,3,10,201303,2013),('2013-03-04',201310,3,2013,4,10,201303,2013),('2013-03-05',201310,3,2013,5,10,201303,2013),('2013-03-06',201310,3,2013,6,10,201303,2013),('2013-03-07',201310,3,2013,7,10,201303,2013),('2013-03-08',201310,3,2013,8,10,201303,2013),('2013-03-09',201310,3,2013,9,10,201303,2013),('2013-03-10',201311,3,2013,10,11,201303,2013),('2013-03-11',201311,3,2013,11,11,201303,2013),('2013-03-12',201311,3,2013,12,11,201303,2013),('2013-03-13',201311,3,2013,13,11,201303,2013),('2013-03-14',201311,3,2013,14,11,201303,2013),('2013-03-15',201311,3,2013,15,11,201303,2013),('2013-03-16',201311,3,2013,16,11,201303,2013),('2013-03-17',201312,3,2013,17,12,201303,2013),('2013-03-18',201312,3,2013,18,12,201303,2013),('2013-03-19',201312,3,2013,19,12,201303,2013),('2013-03-20',201312,3,2013,20,12,201303,2013),('2013-03-21',201312,3,2013,21,12,201303,2013),('2013-03-22',201312,3,2013,22,12,201303,2013),('2013-03-23',201312,3,2013,23,12,201303,2013),('2013-03-24',201313,3,2013,24,13,201303,2013),('2013-03-25',201313,3,2013,25,13,201303,2013),('2013-03-26',201313,3,2013,26,13,201303,2013),('2013-03-27',201313,3,2013,27,13,201303,2013),('2013-03-28',201313,3,2013,28,13,201303,2013),('2013-03-29',201313,3,2013,29,13,201303,2013),('2013-03-30',201313,3,2013,30,13,201303,2013),('2013-03-31',201314,3,2013,31,14,201303,2013),('2013-04-01',201314,4,2013,1,14,201304,2013),('2013-04-02',201314,4,2013,2,14,201304,2013),('2013-04-03',201314,4,2013,3,14,201304,2013),('2013-04-04',201314,4,2013,4,14,201304,2013),('2013-04-05',201314,4,2013,5,14,201304,2013),('2013-04-06',201314,4,2013,6,14,201304,2013),('2013-04-07',201315,4,2013,7,15,201304,2013),('2013-04-08',201315,4,2013,8,15,201304,2013),('2013-04-09',201315,4,2013,9,15,201304,2013),('2013-04-10',201315,4,2013,10,15,201304,2013),('2013-04-11',201315,4,2013,11,15,201304,2013),('2013-04-12',201315,4,2013,12,15,201304,2013),('2013-04-13',201315,4,2013,13,15,201304,2013),('2013-04-14',201316,4,2013,14,16,201304,2013),('2013-04-15',201316,4,2013,15,16,201304,2013),('2013-04-16',201316,4,2013,16,16,201304,2013),('2013-04-17',201316,4,2013,17,16,201304,2013),('2013-04-18',201316,4,2013,18,16,201304,2013),('2013-04-19',201316,4,2013,19,16,201304,2013),('2013-04-20',201316,4,2013,20,16,201304,2013),('2013-04-21',201317,4,2013,21,17,201304,2013),('2013-04-22',201317,4,2013,22,17,201304,2013),('2013-04-23',201317,4,2013,23,17,201304,2013),('2013-04-24',201317,4,2013,24,17,201304,2013),('2013-04-25',201317,4,2013,25,17,201304,2013),('2013-04-26',201317,4,2013,26,17,201304,2013),('2013-04-27',201317,4,2013,27,17,201304,2013),('2013-04-28',201318,4,2013,28,18,201304,2013),('2013-04-29',201318,4,2013,29,18,201304,2013),('2013-04-30',201318,4,2013,30,18,201304,2013),('2013-05-01',201318,5,2013,1,18,201305,2013),('2013-05-02',201318,5,2013,2,18,201305,2013),('2013-05-03',201318,5,2013,3,18,201305,2013),('2013-05-04',201318,5,2013,4,18,201305,2013),('2013-05-05',201319,5,2013,5,19,201305,2013),('2013-05-06',201319,5,2013,6,19,201305,2013),('2013-05-07',201319,5,2013,7,19,201305,2013),('2013-05-08',201319,5,2013,8,19,201305,2013),('2013-05-09',201319,5,2013,9,19,201305,2013),('2013-05-10',201319,5,2013,10,19,201305,2013),('2013-05-11',201319,5,2013,11,19,201305,2013),('2013-05-12',201320,5,2013,12,20,201305,2013),('2013-05-13',201320,5,2013,13,20,201305,2013),('2013-05-14',201320,5,2013,14,20,201305,2013),('2013-05-15',201320,5,2013,15,20,201305,2013),('2013-05-16',201320,5,2013,16,20,201305,2013),('2013-05-17',201320,5,2013,17,20,201305,2013),('2013-05-18',201320,5,2013,18,20,201305,2013),('2013-05-19',201321,5,2013,19,21,201305,2013),('2013-05-20',201321,5,2013,20,21,201305,2013),('2013-05-21',201321,5,2013,21,21,201305,2013),('2013-05-22',201321,5,2013,22,21,201305,2013),('2013-05-23',201321,5,2013,23,21,201305,2013),('2013-05-24',201321,5,2013,24,21,201305,2013),('2013-05-25',201321,5,2013,25,21,201305,2013),('2013-05-26',201322,5,2013,26,22,201305,2013),('2013-05-27',201322,5,2013,27,22,201305,2013),('2013-05-28',201322,5,2013,28,22,201305,2013),('2013-05-29',201322,5,2013,29,22,201305,2013),('2013-05-30',201322,5,2013,30,22,201305,2013),('2013-05-31',201322,5,2013,31,22,201305,2013),('2013-06-01',201322,6,2013,1,22,201306,2013),('2013-06-02',201323,6,2013,2,23,201306,2013),('2013-06-03',201323,6,2013,3,23,201306,2013),('2013-06-04',201323,6,2013,4,23,201306,2013),('2013-06-05',201323,6,2013,5,23,201306,2013),('2013-06-06',201323,6,2013,6,23,201306,2013),('2013-06-07',201323,6,2013,7,23,201306,2013),('2013-06-08',201323,6,2013,8,23,201306,2013),('2013-06-09',201324,6,2013,9,24,201306,2013),('2013-06-10',201324,6,2013,10,24,201306,2013),('2013-06-11',201324,6,2013,11,24,201306,2013),('2013-06-12',201324,6,2013,12,24,201306,2013),('2013-06-13',201324,6,2013,13,24,201306,2013),('2013-06-14',201324,6,2013,14,24,201306,2013),('2013-06-15',201324,6,2013,15,24,201306,2013),('2013-06-16',201325,6,2013,16,25,201306,2013),('2013-06-17',201325,6,2013,17,25,201306,2013),('2013-06-18',201325,6,2013,18,25,201306,2013),('2013-06-19',201325,6,2013,19,25,201306,2013),('2013-06-20',201325,6,2013,20,25,201306,2013),('2013-06-21',201325,6,2013,21,25,201306,2013),('2013-06-22',201325,6,2013,22,25,201306,2013),('2013-06-23',201326,6,2013,23,26,201306,2013),('2013-06-24',201326,6,2013,24,26,201306,2013),('2013-06-25',201326,6,2013,25,26,201306,2013),('2013-06-26',201326,6,2013,26,26,201306,2013),('2013-06-27',201326,6,2013,27,26,201306,2013),('2013-06-28',201326,6,2013,28,26,201306,2013),('2013-06-29',201326,6,2013,29,26,201306,2013),('2013-06-30',201327,6,2013,30,27,201306,2013),('2013-07-01',201327,7,2013,1,27,201307,2013),('2013-07-02',201327,7,2013,2,27,201307,2013),('2013-07-03',201327,7,2013,3,27,201307,2013),('2013-07-04',201327,7,2013,4,27,201307,2013),('2013-07-05',201327,7,2013,5,27,201307,2013),('2013-07-06',201327,7,2013,6,27,201307,2013),('2013-07-07',201328,7,2013,7,28,201307,2013),('2013-07-08',201328,7,2013,8,28,201307,2013),('2013-07-09',201328,7,2013,9,28,201307,2013),('2013-07-10',201328,7,2013,10,28,201307,2013),('2013-07-11',201328,7,2013,11,28,201307,2013),('2013-07-12',201328,7,2013,12,28,201307,2013),('2013-07-13',201328,7,2013,13,28,201307,2013),('2013-07-14',201329,7,2013,14,29,201307,2013),('2013-07-15',201329,7,2013,15,29,201307,2013),('2013-07-16',201329,7,2013,16,29,201307,2013),('2013-07-17',201329,7,2013,17,29,201307,2013),('2013-07-18',201329,7,2013,18,29,201307,2013),('2013-07-19',201329,7,2013,19,29,201307,2013),('2013-07-20',201329,7,2013,20,29,201307,2013),('2013-07-21',201330,7,2013,21,30,201307,2013),('2013-07-22',201330,7,2013,22,30,201307,2013),('2013-07-23',201330,7,2013,23,30,201307,2013),('2013-07-24',201330,7,2013,24,30,201307,2013),('2013-07-25',201330,7,2013,25,30,201307,2013),('2013-07-26',201330,7,2013,26,30,201307,2013),('2013-07-27',201330,7,2013,27,30,201307,2013),('2013-07-28',201331,7,2013,28,31,201307,2013),('2013-07-29',201331,7,2013,29,31,201307,2013),('2013-07-30',201331,7,2013,30,31,201307,2013),('2013-07-31',201331,7,2013,31,31,201307,2013),('2013-08-01',201331,8,2013,1,31,201308,2013),('2013-08-02',201331,8,2013,2,31,201308,2013),('2013-08-03',201331,8,2013,3,31,201308,2013),('2013-08-04',201332,8,2013,4,32,201308,2013),('2013-08-05',201332,8,2013,5,32,201308,2013),('2013-08-06',201332,8,2013,6,32,201308,2013),('2013-08-07',201332,8,2013,7,32,201308,2013),('2013-08-08',201332,8,2013,8,32,201308,2013),('2013-08-09',201332,8,2013,9,32,201308,2013),('2013-08-10',201332,8,2013,10,32,201308,2013),('2013-08-11',201333,8,2013,11,33,201308,2013),('2013-08-12',201333,8,2013,12,33,201308,2013),('2013-08-13',201333,8,2013,13,33,201308,2013),('2013-08-14',201333,8,2013,14,33,201308,2013),('2013-08-15',201333,8,2013,15,33,201308,2013),('2013-08-16',201333,8,2013,16,33,201308,2013),('2013-08-17',201333,8,2013,17,33,201308,2013),('2013-08-18',201334,8,2013,18,34,201308,2013),('2013-08-19',201334,8,2013,19,34,201308,2013),('2013-08-20',201334,8,2013,20,34,201308,2013),('2013-08-21',201334,8,2013,21,34,201308,2013),('2013-08-22',201334,8,2013,22,34,201308,2013),('2013-08-23',201334,8,2013,23,34,201308,2013),('2013-08-24',201334,8,2013,24,34,201308,2013),('2013-08-25',201335,8,2013,25,35,201308,2013),('2013-08-26',201335,8,2013,26,35,201308,2013),('2013-08-27',201335,8,2013,27,35,201308,2013),('2013-08-28',201335,8,2013,28,35,201308,2013),('2013-08-29',201335,8,2013,29,35,201308,2013),('2013-08-30',201335,8,2013,30,35,201308,2013),('2013-08-31',201335,8,2013,31,35,201308,2013),('2013-09-01',201336,9,2013,1,36,201309,2013),('2013-09-02',201336,9,2013,2,36,201309,2013),('2013-09-03',201336,9,2013,3,36,201309,2013),('2013-09-04',201336,9,2013,4,36,201309,2013),('2013-09-05',201336,9,2013,5,36,201309,2013),('2013-09-06',201336,9,2013,6,36,201309,2013),('2013-09-07',201336,9,2013,7,36,201309,2013),('2013-09-08',201337,9,2013,8,37,201309,2013),('2013-09-09',201337,9,2013,9,37,201309,2013),('2013-09-10',201337,9,2013,10,37,201309,2013),('2013-09-11',201337,9,2013,11,37,201309,2013),('2013-09-12',201337,9,2013,12,37,201309,2013),('2013-09-13',201337,9,2013,13,37,201309,2013),('2013-09-14',201337,9,2013,14,37,201309,2013),('2013-09-15',201338,9,2013,15,38,201309,2013),('2013-09-16',201338,9,2013,16,38,201309,2013),('2013-09-17',201338,9,2013,17,38,201309,2013),('2013-09-18',201338,9,2013,18,38,201309,2013),('2013-09-19',201338,9,2013,19,38,201309,2013),('2013-09-20',201338,9,2013,20,38,201309,2013),('2013-09-21',201338,9,2013,21,38,201309,2013),('2013-09-22',201339,9,2013,22,39,201309,2013),('2013-09-23',201339,9,2013,23,39,201309,2013),('2013-09-24',201339,9,2013,24,39,201309,2013),('2013-09-25',201339,9,2013,25,39,201309,2013),('2013-09-26',201339,9,2013,26,39,201309,2013),('2013-09-27',201339,9,2013,27,39,201309,2013),('2013-09-28',201339,9,2013,28,39,201309,2013),('2013-09-29',201340,9,2013,29,40,201309,2013),('2013-09-30',201340,9,2013,30,40,201309,2013),('2013-10-01',201340,10,2013,1,40,201310,2013),('2013-10-02',201340,10,2013,2,40,201310,2013),('2013-10-03',201340,10,2013,3,40,201310,2013),('2013-10-04',201340,10,2013,4,40,201310,2013),('2013-10-05',201340,10,2013,5,40,201310,2013),('2013-10-06',201341,10,2013,6,41,201310,2013),('2013-10-07',201341,10,2013,7,41,201310,2013),('2013-10-08',201341,10,2013,8,41,201310,2013),('2013-10-09',201341,10,2013,9,41,201310,2013),('2013-10-10',201341,10,2013,10,41,201310,2013),('2013-10-11',201341,10,2013,11,41,201310,2013),('2013-10-12',201341,10,2013,12,41,201310,2013),('2013-10-13',201342,10,2013,13,42,201310,2013),('2013-10-14',201342,10,2013,14,42,201310,2013),('2013-10-15',201342,10,2013,15,42,201310,2013),('2013-10-16',201342,10,2013,16,42,201310,2013),('2013-10-17',201342,10,2013,17,42,201310,2013),('2013-10-18',201342,10,2013,18,42,201310,2013),('2013-10-19',201342,10,2013,19,42,201310,2013),('2013-10-20',201343,10,2013,20,43,201310,2013),('2013-10-21',201343,10,2013,21,43,201310,2013),('2013-10-22',201343,10,2013,22,43,201310,2013),('2013-10-23',201343,10,2013,23,43,201310,2013),('2013-10-24',201343,10,2013,24,43,201310,2013),('2013-10-25',201343,10,2013,25,43,201310,2013),('2013-10-26',201343,10,2013,26,43,201310,2013),('2013-10-27',201344,10,2013,27,44,201310,2013),('2013-10-28',201344,10,2013,28,44,201310,2013),('2013-10-29',201344,10,2013,29,44,201310,2013),('2013-10-30',201344,10,2013,30,44,201310,2013),('2013-10-31',201344,10,2013,31,44,201310,2013),('2013-11-01',201344,11,2013,1,44,201311,2013),('2013-11-02',201344,11,2013,2,44,201311,2013),('2013-11-03',201345,11,2013,3,45,201311,2013),('2013-11-04',201345,11,2013,4,45,201311,2013),('2013-11-05',201345,11,2013,5,45,201311,2013),('2013-11-06',201345,11,2013,6,45,201311,2013),('2013-11-07',201345,11,2013,7,45,201311,2013),('2013-11-08',201345,11,2013,8,45,201311,2013),('2013-11-09',201345,11,2013,9,45,201311,2013),('2013-11-10',201346,11,2013,10,46,201311,2013),('2013-11-11',201346,11,2013,11,46,201311,2013),('2013-11-12',201346,11,2013,12,46,201311,2013),('2013-11-13',201346,11,2013,13,46,201311,2013),('2013-11-14',201346,11,2013,14,46,201311,2013),('2013-11-15',201346,11,2013,15,46,201311,2013),('2013-11-16',201346,11,2013,16,46,201311,2013),('2013-11-17',201347,11,2013,17,47,201311,2013),('2013-11-18',201347,11,2013,18,47,201311,2013),('2013-11-19',201347,11,2013,19,47,201311,2013),('2013-11-20',201347,11,2013,20,47,201311,2013),('2013-11-21',201347,11,2013,21,47,201311,2013),('2013-11-22',201347,11,2013,22,47,201311,2013),('2013-11-23',201347,11,2013,23,47,201311,2013),('2013-11-24',201348,11,2013,24,48,201311,2013),('2013-11-25',201348,11,2013,25,48,201311,2013),('2013-11-26',201348,11,2013,26,48,201311,2013),('2013-11-27',201348,11,2013,27,48,201311,2013),('2013-11-28',201348,11,2013,28,48,201311,2013),('2013-11-29',201348,11,2013,29,48,201311,2013),('2013-11-30',201348,11,2013,30,48,201311,2013),('2013-12-01',201349,12,2013,1,49,201312,2014),('2013-12-02',201349,12,2013,2,49,201312,2014),('2013-12-03',201349,12,2013,3,49,201312,2014),('2013-12-04',201349,12,2013,4,49,201312,2014),('2013-12-05',201349,12,2013,5,49,201312,2014),('2013-12-06',201349,12,2013,6,49,201312,2014),('2013-12-07',201349,12,2013,7,49,201312,2014),('2013-12-08',201350,12,2013,8,50,201312,2014),('2013-12-09',201350,12,2013,9,50,201312,2014),('2013-12-10',201350,12,2013,10,50,201312,2014),('2013-12-11',201350,12,2013,11,50,201312,2014),('2013-12-12',201350,12,2013,12,50,201312,2014),('2013-12-13',201350,12,2013,13,50,201312,2014),('2013-12-14',201350,12,2013,14,50,201312,2014),('2013-12-15',201351,12,2013,15,51,201312,2014),('2013-12-16',201351,12,2013,16,51,201312,2014),('2013-12-17',201351,12,2013,17,51,201312,2014),('2013-12-18',201351,12,2013,18,51,201312,2014),('2013-12-19',201351,12,2013,19,51,201312,2014),('2013-12-20',201351,12,2013,20,51,201312,2014),('2013-12-21',201351,12,2013,21,51,201312,2014),('2013-12-22',201352,12,2013,22,52,201312,2014),('2013-12-23',201352,12,2013,23,52,201312,2014),('2013-12-24',201352,12,2013,24,52,201312,2014),('2013-12-25',201352,12,2013,25,52,201312,2014),('2013-12-26',201352,12,2013,26,52,201312,2014),('2013-12-27',201352,12,2013,27,52,201312,2014),('2013-12-28',201352,12,2013,28,52,201312,2014),('2013-12-29',201401,12,2013,29,1,201312,2014),('2013-12-30',201401,12,2013,30,1,201312,2014),('2013-12-31',201401,12,2013,31,1,201312,2014),('2014-01-01',201401,1,2014,1,1,201401,2014),('2014-01-02',201401,1,2014,2,1,201401,2014),('2014-01-03',201401,1,2014,3,1,201401,2014),('2014-01-04',201401,1,2014,4,1,201401,2014),('2014-01-05',201402,1,2014,5,2,201401,2014),('2014-01-06',201402,1,2014,6,2,201401,2014),('2014-01-07',201402,1,2014,7,2,201401,2014),('2014-01-08',201402,1,2014,8,2,201401,2014),('2014-01-09',201402,1,2014,9,2,201401,2014),('2014-01-10',201402,1,2014,10,2,201401,2014),('2014-01-11',201402,1,2014,11,2,201401,2014),('2014-01-12',201403,1,2014,12,3,201401,2014),('2014-01-13',201403,1,2014,13,3,201401,2014),('2014-01-14',201403,1,2014,14,3,201401,2014),('2014-01-15',201403,1,2014,15,3,201401,2014),('2014-01-16',201403,1,2014,16,3,201401,2014),('2014-01-17',201403,1,2014,17,3,201401,2014),('2014-01-18',201403,1,2014,18,3,201401,2014),('2014-01-19',201404,1,2014,19,4,201401,2014),('2014-01-20',201404,1,2014,20,4,201401,2014),('2014-01-21',201404,1,2014,21,4,201401,2014),('2014-01-22',201404,1,2014,22,4,201401,2014),('2014-01-23',201404,1,2014,23,4,201401,2014),('2014-01-24',201404,1,2014,24,4,201401,2014),('2014-01-25',201404,1,2014,25,4,201401,2014),('2014-01-26',201405,1,2014,26,5,201401,2014),('2014-01-27',201405,1,2014,27,5,201401,2014),('2014-01-28',201405,1,2014,28,5,201401,2014),('2014-01-29',201405,1,2014,29,5,201401,2014),('2014-01-30',201405,1,2014,30,5,201401,2014),('2014-01-31',201405,1,2014,31,5,201401,2014),('2014-02-01',201405,2,2014,1,5,201402,2014),('2014-02-02',201406,2,2014,2,6,201402,2014),('2014-02-03',201406,2,2014,3,6,201402,2014),('2014-02-04',201406,2,2014,4,6,201402,2014),('2014-02-05',201406,2,2014,5,6,201402,2014),('2014-02-06',201406,2,2014,6,6,201402,2014),('2014-02-07',201406,2,2014,7,6,201402,2014),('2014-02-08',201406,2,2014,8,6,201402,2014),('2014-02-09',201407,2,2014,9,7,201402,2014),('2014-02-10',201407,2,2014,10,7,201402,2014),('2014-02-11',201407,2,2014,11,7,201402,2014),('2014-02-12',201407,2,2014,12,7,201402,2014),('2014-02-13',201407,2,2014,13,7,201402,2014),('2014-02-14',201407,2,2014,14,7,201402,2014),('2014-02-15',201407,2,2014,15,7,201402,2014),('2014-02-16',201408,2,2014,16,8,201402,2014),('2014-02-17',201408,2,2014,17,8,201402,2014),('2014-02-18',201408,2,2014,18,8,201402,2014),('2014-02-19',201408,2,2014,19,8,201402,2014),('2014-02-20',201408,2,2014,20,8,201402,2014),('2014-02-21',201408,2,2014,21,8,201402,2014),('2014-02-22',201408,2,2014,22,8,201402,2014),('2014-02-23',201409,2,2014,23,9,201402,2014),('2014-02-24',201409,2,2014,24,9,201402,2014),('2014-02-25',201409,2,2014,25,9,201402,2014),('2014-02-26',201409,2,2014,26,9,201402,2014),('2014-02-27',201409,2,2014,27,9,201402,2014),('2014-02-28',201409,2,2014,28,9,201402,2014),('2014-03-01',201409,3,2014,1,9,201403,2014),('2014-03-02',201410,3,2014,2,10,201403,2014),('2014-03-03',201410,3,2014,3,10,201403,2014),('2014-03-04',201410,3,2014,4,10,201403,2014),('2014-03-05',201410,3,2014,5,10,201403,2014),('2014-03-06',201410,3,2014,6,10,201403,2014),('2014-03-07',201410,3,2014,7,10,201403,2014),('2014-03-08',201410,3,2014,8,10,201403,2014),('2014-03-09',201411,3,2014,9,11,201403,2014),('2014-03-10',201411,3,2014,10,11,201403,2014),('2014-03-11',201411,3,2014,11,11,201403,2014),('2014-03-12',201411,3,2014,12,11,201403,2014),('2014-03-13',201411,3,2014,13,11,201403,2014),('2014-03-14',201411,3,2014,14,11,201403,2014),('2014-03-15',201411,3,2014,15,11,201403,2014),('2014-03-16',201412,3,2014,16,12,201403,2014),('2014-03-17',201412,3,2014,17,12,201403,2014),('2014-03-18',201412,3,2014,18,12,201403,2014),('2014-03-19',201412,3,2014,19,12,201403,2014),('2014-03-20',201412,3,2014,20,12,201403,2014),('2014-03-21',201412,3,2014,21,12,201403,2014),('2014-03-22',201412,3,2014,22,12,201403,2014),('2014-03-23',201413,3,2014,23,13,201403,2014),('2014-03-24',201413,3,2014,24,13,201403,2014),('2014-03-25',201413,3,2014,25,13,201403,2014),('2014-03-26',201413,3,2014,26,13,201403,2014),('2014-03-27',201413,3,2014,27,13,201403,2014),('2014-03-28',201413,3,2014,28,13,201403,2014),('2014-03-29',201413,3,2014,29,13,201403,2014),('2014-03-30',201414,3,2014,30,14,201403,2014),('2014-03-31',201414,3,2014,31,14,201403,2014),('2014-04-01',201414,4,2014,1,14,201404,2014),('2014-04-02',201414,4,2014,2,14,201404,2014),('2014-04-03',201414,4,2014,3,14,201404,2014),('2014-04-04',201414,4,2014,4,14,201404,2014),('2014-04-05',201414,4,2014,5,14,201404,2014),('2014-04-06',201415,4,2014,6,15,201404,2014),('2014-04-07',201415,4,2014,7,15,201404,2014),('2014-04-08',201415,4,2014,8,15,201404,2014),('2014-04-09',201415,4,2014,9,15,201404,2014),('2014-04-10',201415,4,2014,10,15,201404,2014),('2014-04-11',201415,4,2014,11,15,201404,2014),('2014-04-12',201415,4,2014,12,15,201404,2014),('2014-04-13',201416,4,2014,13,16,201404,2014),('2014-04-14',201416,4,2014,14,16,201404,2014),('2014-04-15',201416,4,2014,15,16,201404,2014),('2014-04-16',201416,4,2014,16,16,201404,2014),('2014-04-17',201416,4,2014,17,16,201404,2014),('2014-04-18',201416,4,2014,18,16,201404,2014),('2014-04-19',201416,4,2014,19,16,201404,2014),('2014-04-20',201417,4,2014,20,17,201404,2014),('2014-04-21',201417,4,2014,21,17,201404,2014),('2014-04-22',201417,4,2014,22,17,201404,2014),('2014-04-23',201417,4,2014,23,17,201404,2014),('2014-04-24',201417,4,2014,24,17,201404,2014),('2014-04-25',201417,4,2014,25,17,201404,2014),('2014-04-26',201417,4,2014,26,17,201404,2014),('2014-04-27',201418,4,2014,27,18,201404,2014),('2014-04-28',201418,4,2014,28,18,201404,2014),('2014-04-29',201418,4,2014,29,18,201404,2014),('2014-04-30',201418,4,2014,30,18,201404,2014),('2014-05-01',201418,5,2014,1,18,201405,2014),('2014-05-02',201418,5,2014,2,18,201405,2014),('2014-05-03',201418,5,2014,3,18,201405,2014),('2014-05-04',201419,5,2014,4,19,201405,2014),('2014-05-05',201419,5,2014,5,19,201405,2014),('2014-05-06',201419,5,2014,6,19,201405,2014),('2014-05-07',201419,5,2014,7,19,201405,2014),('2014-05-08',201419,5,2014,8,19,201405,2014),('2014-05-09',201419,5,2014,9,19,201405,2014),('2014-05-10',201419,5,2014,10,19,201405,2014),('2014-05-11',201420,5,2014,11,20,201405,2014),('2014-05-12',201420,5,2014,12,20,201405,2014),('2014-05-13',201420,5,2014,13,20,201405,2014),('2014-05-14',201420,5,2014,14,20,201405,2014),('2014-05-15',201420,5,2014,15,20,201405,2014),('2014-05-16',201420,5,2014,16,20,201405,2014),('2014-05-17',201420,5,2014,17,20,201405,2014),('2014-05-18',201421,5,2014,18,21,201405,2014),('2014-05-19',201421,5,2014,19,21,201405,2014),('2014-05-20',201421,5,2014,20,21,201405,2014),('2014-05-21',201421,5,2014,21,21,201405,2014),('2014-05-22',201421,5,2014,22,21,201405,2014),('2014-05-23',201421,5,2014,23,21,201405,2014),('2014-05-24',201421,5,2014,24,21,201405,2014),('2014-05-25',201422,5,2014,25,22,201405,2014),('2014-05-26',201422,5,2014,26,22,201405,2014),('2014-05-27',201422,5,2014,27,22,201405,2014),('2014-05-28',201422,5,2014,28,22,201405,2014),('2014-05-29',201422,5,2014,29,22,201405,2014),('2014-05-30',201422,5,2014,30,22,201405,2014),('2014-05-31',201422,5,2014,31,22,201405,2014),('2014-06-01',201423,6,2014,1,23,201406,2014),('2014-06-02',201423,6,2014,2,23,201406,2014),('2014-06-03',201423,6,2014,3,23,201406,2014),('2014-06-04',201423,6,2014,4,23,201406,2014),('2014-06-05',201423,6,2014,5,23,201406,2014),('2014-06-06',201423,6,2014,6,23,201406,2014),('2014-06-07',201423,6,2014,7,23,201406,2014),('2014-06-08',201424,6,2014,8,24,201406,2014),('2014-06-09',201424,6,2014,9,24,201406,2014),('2014-06-10',201424,6,2014,10,24,201406,2014),('2014-06-11',201424,6,2014,11,24,201406,2014),('2014-06-12',201424,6,2014,12,24,201406,2014),('2014-06-13',201424,6,2014,13,24,201406,2014),('2014-06-14',201424,6,2014,14,24,201406,2014),('2014-06-15',201425,6,2014,15,25,201406,2014),('2014-06-16',201425,6,2014,16,25,201406,2014),('2014-06-17',201425,6,2014,17,25,201406,2014),('2014-06-18',201425,6,2014,18,25,201406,2014),('2014-06-19',201425,6,2014,19,25,201406,2014),('2014-06-20',201425,6,2014,20,25,201406,2014),('2014-06-21',201425,6,2014,21,25,201406,2014),('2014-06-22',201426,6,2014,22,26,201406,2014),('2014-06-23',201426,6,2014,23,26,201406,2014),('2014-06-24',201426,6,2014,24,26,201406,2014),('2014-06-25',201426,6,2014,25,26,201406,2014),('2014-06-26',201426,6,2014,26,26,201406,2014),('2014-06-27',201426,6,2014,27,26,201406,2014),('2014-06-28',201426,6,2014,28,26,201406,2014),('2014-06-29',201427,6,2014,29,27,201406,2014),('2014-06-30',201427,6,2014,30,27,201406,2014),('2014-07-01',201427,7,2014,1,27,201407,2014),('2014-07-02',201427,7,2014,2,27,201407,2014),('2014-07-03',201427,7,2014,3,27,201407,2014),('2014-07-04',201427,7,2014,4,27,201407,2014),('2014-07-05',201427,7,2014,5,27,201407,2014),('2014-07-06',201428,7,2014,6,28,201407,2014),('2014-07-07',201428,7,2014,7,28,201407,2014),('2014-07-08',201428,7,2014,8,28,201407,2014),('2014-07-09',201428,7,2014,9,28,201407,2014),('2014-07-10',201428,7,2014,10,28,201407,2014),('2014-07-11',201428,7,2014,11,28,201407,2014),('2014-07-12',201428,7,2014,12,28,201407,2014),('2014-07-13',201429,7,2014,13,29,201407,2014),('2014-07-14',201429,7,2014,14,29,201407,2014),('2014-07-15',201429,7,2014,15,29,201407,2014),('2014-07-16',201429,7,2014,16,29,201407,2014),('2014-07-17',201429,7,2014,17,29,201407,2014),('2014-07-18',201429,7,2014,18,29,201407,2014),('2014-07-19',201429,7,2014,19,29,201407,2014),('2014-07-20',201430,7,2014,20,30,201407,2014),('2014-07-21',201430,7,2014,21,30,201407,2014),('2014-07-22',201430,7,2014,22,30,201407,2014),('2014-07-23',201430,7,2014,23,30,201407,2014),('2014-07-24',201430,7,2014,24,30,201407,2014),('2014-07-25',201430,7,2014,25,30,201407,2014),('2014-07-26',201430,7,2014,26,30,201407,2014),('2014-07-27',201431,7,2014,27,31,201407,2014),('2014-07-28',201431,7,2014,28,31,201407,2014),('2014-07-29',201431,7,2014,29,31,201407,2014),('2014-07-30',201431,7,2014,30,31,201407,2014),('2014-07-31',201431,7,2014,31,31,201407,2014),('2014-08-01',201431,8,2014,1,31,201408,2014),('2014-08-02',201431,8,2014,2,31,201408,2014),('2014-08-03',201432,8,2014,3,32,201408,2014),('2014-08-04',201432,8,2014,4,32,201408,2014),('2014-08-05',201432,8,2014,5,32,201408,2014),('2014-08-06',201432,8,2014,6,32,201408,2014),('2014-08-07',201432,8,2014,7,32,201408,2014),('2014-08-08',201432,8,2014,8,32,201408,2014),('2014-08-09',201432,8,2014,9,32,201408,2014),('2014-08-10',201433,8,2014,10,33,201408,2014),('2014-08-11',201433,8,2014,11,33,201408,2014),('2014-08-12',201433,8,2014,12,33,201408,2014),('2014-08-13',201433,8,2014,13,33,201408,2014),('2014-08-14',201433,8,2014,14,33,201408,2014),('2014-08-15',201433,8,2014,15,33,201408,2014),('2014-08-16',201433,8,2014,16,33,201408,2014),('2014-08-17',201434,8,2014,17,34,201408,2014),('2014-08-18',201434,8,2014,18,34,201408,2014),('2014-08-19',201434,8,2014,19,34,201408,2014),('2014-08-20',201434,8,2014,20,34,201408,2014),('2014-08-21',201434,8,2014,21,34,201408,2014),('2014-08-22',201434,8,2014,22,34,201408,2014),('2014-08-23',201434,8,2014,23,34,201408,2014),('2014-08-24',201435,8,2014,24,35,201408,2014),('2014-08-25',201435,8,2014,25,35,201408,2014),('2014-08-26',201435,8,2014,26,35,201408,2014),('2014-08-27',201435,8,2014,27,35,201408,2014),('2014-08-28',201435,8,2014,28,35,201408,2014),('2014-08-29',201435,8,2014,29,35,201408,2014),('2014-08-30',201435,8,2014,30,35,201408,2014),('2014-08-31',201436,8,2014,31,36,201408,2014),('2014-09-01',201436,9,2014,1,36,201409,2014),('2014-09-02',201436,9,2014,2,36,201409,2014),('2014-09-03',201436,9,2014,3,36,201409,2014),('2014-09-04',201436,9,2014,4,36,201409,2014),('2014-09-05',201436,9,2014,5,36,201409,2014),('2014-09-06',201436,9,2014,6,36,201409,2014),('2014-09-07',201437,9,2014,7,37,201409,2014),('2014-09-08',201437,9,2014,8,37,201409,2014),('2014-09-09',201437,9,2014,9,37,201409,2014),('2014-09-10',201437,9,2014,10,37,201409,2014),('2014-09-11',201437,9,2014,11,37,201409,2014),('2014-09-12',201437,9,2014,12,37,201409,2014),('2014-09-13',201437,9,2014,13,37,201409,2014),('2014-09-14',201438,9,2014,14,38,201409,2014),('2014-09-15',201438,9,2014,15,38,201409,2014),('2014-09-16',201438,9,2014,16,38,201409,2014),('2014-09-17',201438,9,2014,17,38,201409,2014),('2014-09-18',201438,9,2014,18,38,201409,2014),('2014-09-19',201438,9,2014,19,38,201409,2014),('2014-09-20',201438,9,2014,20,38,201409,2014),('2014-09-21',201439,9,2014,21,39,201409,2014),('2014-09-22',201439,9,2014,22,39,201409,2014),('2014-09-23',201439,9,2014,23,39,201409,2014),('2014-09-24',201439,9,2014,24,39,201409,2014),('2014-09-25',201439,9,2014,25,39,201409,2014),('2014-09-26',201439,9,2014,26,39,201409,2014),('2014-09-27',201439,9,2014,27,39,201409,2014),('2014-09-28',201440,9,2014,28,40,201409,2014),('2014-09-29',201440,9,2014,29,40,201409,2014),('2014-09-30',201440,9,2014,30,40,201409,2014),('2014-10-01',201440,10,2014,1,40,201410,2014),('2014-10-02',201440,10,2014,2,40,201410,2014),('2014-10-03',201440,10,2014,3,40,201410,2014),('2014-10-04',201440,10,2014,4,40,201410,2014),('2014-10-05',201441,10,2014,5,41,201410,2014),('2014-10-06',201441,10,2014,6,41,201410,2014),('2014-10-07',201441,10,2014,7,41,201410,2014),('2014-10-08',201441,10,2014,8,41,201410,2014),('2014-10-09',201441,10,2014,9,41,201410,2014),('2014-10-10',201441,10,2014,10,41,201410,2014),('2014-10-11',201441,10,2014,11,41,201410,2014),('2014-10-12',201442,10,2014,12,42,201410,2014),('2014-10-13',201442,10,2014,13,42,201410,2014),('2014-10-14',201442,10,2014,14,42,201410,2014),('2014-10-15',201442,10,2014,15,42,201410,2014),('2014-10-16',201442,10,2014,16,42,201410,2014),('2014-10-17',201442,10,2014,17,42,201410,2014),('2014-10-18',201442,10,2014,18,42,201410,2014),('2014-10-19',201443,10,2014,19,43,201410,2014),('2014-10-20',201443,10,2014,20,43,201410,2014),('2014-10-21',201443,10,2014,21,43,201410,2014),('2014-10-22',201443,10,2014,22,43,201410,2014),('2014-10-23',201443,10,2014,23,43,201410,2014),('2014-10-24',201443,10,2014,24,43,201410,2014),('2014-10-25',201443,10,2014,25,43,201410,2014),('2014-10-26',201444,10,2014,26,44,201410,2014),('2014-10-27',201444,10,2014,27,44,201410,2014),('2014-10-28',201444,10,2014,28,44,201410,2014),('2014-10-29',201444,10,2014,29,44,201410,2014),('2014-10-30',201444,10,2014,30,44,201410,2014),('2014-10-31',201444,10,2014,31,44,201410,2014),('2014-11-01',201444,11,2014,1,44,201411,2014),('2014-11-02',201445,11,2014,2,45,201411,2014),('2014-11-03',201445,11,2014,3,45,201411,2014),('2014-11-04',201445,11,2014,4,45,201411,2014),('2014-11-05',201445,11,2014,5,45,201411,2014),('2014-11-06',201445,11,2014,6,45,201411,2014),('2014-11-07',201445,11,2014,7,45,201411,2014),('2014-11-08',201445,11,2014,8,45,201411,2014),('2014-11-09',201446,11,2014,9,46,201411,2014),('2014-11-10',201446,11,2014,10,46,201411,2014),('2014-11-11',201446,11,2014,11,46,201411,2014),('2014-11-12',201446,11,2014,12,46,201411,2014),('2014-11-13',201446,11,2014,13,46,201411,2014),('2014-11-14',201446,11,2014,14,46,201411,2014),('2014-11-15',201446,11,2014,15,46,201411,2014),('2014-11-16',201447,11,2014,16,47,201411,2014),('2014-11-17',201447,11,2014,17,47,201411,2014),('2014-11-18',201447,11,2014,18,47,201411,2014),('2014-11-19',201447,11,2014,19,47,201411,2014),('2014-11-20',201447,11,2014,20,47,201411,2014),('2014-11-21',201447,11,2014,21,47,201411,2014),('2014-11-22',201447,11,2014,22,47,201411,2014),('2014-11-23',201448,11,2014,23,48,201411,2014),('2014-11-24',201448,11,2014,24,48,201411,2014),('2014-11-25',201448,11,2014,25,48,201411,2014),('2014-11-26',201448,11,2014,26,48,201411,2014),('2014-11-27',201448,11,2014,27,48,201411,2014),('2014-11-28',201448,11,2014,28,48,201411,2014),('2014-11-29',201448,11,2014,29,48,201411,2014),('2014-11-30',201449,11,2014,30,49,201411,2014),('2014-12-01',201449,12,2014,1,49,201412,2015),('2014-12-02',201449,12,2014,2,49,201412,2015),('2014-12-03',201449,12,2014,3,49,201412,2015),('2014-12-04',201449,12,2014,4,49,201412,2015),('2014-12-05',201449,12,2014,5,49,201412,2015),('2014-12-06',201449,12,2014,6,49,201412,2015),('2014-12-07',201450,12,2014,7,50,201412,2015),('2014-12-08',201450,12,2014,8,50,201412,2015),('2014-12-09',201450,12,2014,9,50,201412,2015),('2014-12-10',201450,12,2014,10,50,201412,2015),('2014-12-11',201450,12,2014,11,50,201412,2015),('2014-12-12',201450,12,2014,12,50,201412,2015),('2014-12-13',201450,12,2014,13,50,201412,2015),('2014-12-14',201451,12,2014,14,51,201412,2015),('2014-12-15',201451,12,2014,15,51,201412,2015),('2014-12-16',201451,12,2014,16,51,201412,2015),('2014-12-17',201451,12,2014,17,51,201412,2015),('2014-12-18',201451,12,2014,18,51,201412,2015),('2014-12-19',201451,12,2014,19,51,201412,2015),('2014-12-20',201451,12,2014,20,51,201412,2015),('2014-12-21',201452,12,2014,21,52,201412,2015),('2014-12-22',201452,12,2014,22,52,201412,2015),('2014-12-23',201452,12,2014,23,52,201412,2015),('2014-12-24',201452,12,2014,24,52,201412,2015),('2014-12-25',201452,12,2014,25,52,201412,2015),('2014-12-26',201452,12,2014,26,52,201412,2015),('2014-12-27',201452,12,2014,27,52,201412,2015),('2014-12-28',201453,12,2014,28,53,201412,2015),('2014-12-29',201453,12,2014,29,53,201412,2015),('2014-12-30',201453,12,2014,30,53,201412,2015),('2014-12-31',201453,12,2014,31,53,201412,2015),('2015-01-01',201453,1,2015,1,53,201501,2015),('2015-01-02',201453,1,2015,2,53,201501,2015),('2015-01-03',201453,1,2015,3,53,201501,2015),('2015-01-04',201501,1,2015,4,1,201501,2015),('2015-01-05',201501,1,2015,5,1,201501,2015),('2015-01-06',201501,1,2015,6,1,201501,2015),('2015-01-07',201501,1,2015,7,1,201501,2015),('2015-01-08',201501,1,2015,8,1,201501,2015),('2015-01-09',201501,1,2015,9,1,201501,2015),('2015-01-10',201501,1,2015,10,1,201501,2015),('2015-01-11',201502,1,2015,11,2,201501,2015),('2015-01-12',201502,1,2015,12,2,201501,2015),('2015-01-13',201502,1,2015,13,2,201501,2015),('2015-01-14',201502,1,2015,14,2,201501,2015),('2015-01-15',201502,1,2015,15,2,201501,2015),('2015-01-16',201502,1,2015,16,2,201501,2015),('2015-01-17',201502,1,2015,17,2,201501,2015),('2015-01-18',201503,1,2015,18,3,201501,2015),('2015-01-19',201503,1,2015,19,3,201501,2015),('2015-01-20',201503,1,2015,20,3,201501,2015),('2015-01-21',201503,1,2015,21,3,201501,2015),('2015-01-22',201503,1,2015,22,3,201501,2015),('2015-01-23',201503,1,2015,23,3,201501,2015),('2015-01-24',201503,1,2015,24,3,201501,2015),('2015-01-25',201504,1,2015,25,4,201501,2015),('2015-01-26',201504,1,2015,26,4,201501,2015),('2015-01-27',201504,1,2015,27,4,201501,2015),('2015-01-28',201504,1,2015,28,4,201501,2015),('2015-01-29',201504,1,2015,29,4,201501,2015),('2015-01-30',201504,1,2015,30,4,201501,2015),('2015-01-31',201504,1,2015,31,4,201501,2015),('2015-02-01',201505,2,2015,1,5,201502,2015),('2015-02-02',201505,2,2015,2,5,201502,2015),('2015-02-03',201505,2,2015,3,5,201502,2015),('2015-02-04',201505,2,2015,4,5,201502,2015),('2015-02-05',201505,2,2015,5,5,201502,2015),('2015-02-06',201505,2,2015,6,5,201502,2015),('2015-02-07',201505,2,2015,7,5,201502,2015),('2015-02-08',201506,2,2015,8,6,201502,2015),('2015-02-09',201506,2,2015,9,6,201502,2015),('2015-02-10',201506,2,2015,10,6,201502,2015),('2015-02-11',201506,2,2015,11,6,201502,2015),('2015-02-12',201506,2,2015,12,6,201502,2015),('2015-02-13',201506,2,2015,13,6,201502,2015),('2015-02-14',201506,2,2015,14,6,201502,2015),('2015-02-15',201507,2,2015,15,7,201502,2015),('2015-02-16',201507,2,2015,16,7,201502,2015),('2015-02-17',201507,2,2015,17,7,201502,2015),('2015-02-18',201507,2,2015,18,7,201502,2015),('2015-02-19',201507,2,2015,19,7,201502,2015),('2015-02-20',201507,2,2015,20,7,201502,2015),('2015-02-21',201507,2,2015,21,7,201502,2015),('2015-02-22',201508,2,2015,22,8,201502,2015),('2015-02-23',201508,2,2015,23,8,201502,2015),('2015-02-24',201508,2,2015,24,8,201502,2015),('2015-02-25',201508,2,2015,25,8,201502,2015),('2015-02-26',201508,2,2015,26,8,201502,2015),('2015-02-27',201508,2,2015,27,8,201502,2015),('2015-02-28',201508,2,2015,28,8,201502,2015),('2015-03-01',201509,3,2015,1,9,201503,2015),('2015-03-02',201509,3,2015,2,9,201503,2015),('2015-03-03',201509,3,2015,3,9,201503,2015),('2015-03-04',201509,3,2015,4,9,201503,2015),('2015-03-05',201509,3,2015,5,9,201503,2015),('2015-03-06',201509,3,2015,6,9,201503,2015),('2015-03-07',201509,3,2015,7,9,201503,2015),('2015-03-08',201510,3,2015,8,10,201503,2015),('2015-03-09',201510,3,2015,9,10,201503,2015),('2015-03-10',201510,3,2015,10,10,201503,2015),('2015-03-11',201510,3,2015,11,10,201503,2015),('2015-03-12',201510,3,2015,12,10,201503,2015),('2015-03-13',201510,3,2015,13,10,201503,2015),('2015-03-14',201510,3,2015,14,10,201503,2015),('2015-03-15',201511,3,2015,15,11,201503,2015),('2015-03-16',201511,3,2015,16,11,201503,2015),('2015-03-17',201511,3,2015,17,11,201503,2015),('2015-03-18',201511,3,2015,18,11,201503,2015),('2015-03-19',201511,3,2015,19,11,201503,2015),('2015-03-20',201511,3,2015,20,11,201503,2015),('2015-03-21',201511,3,2015,21,11,201503,2015),('2015-03-22',201512,3,2015,22,12,201503,2015),('2015-03-23',201512,3,2015,23,12,201503,2015),('2015-03-24',201512,3,2015,24,12,201503,2015),('2015-03-25',201512,3,2015,25,12,201503,2015),('2015-03-26',201512,3,2015,26,12,201503,2015),('2015-03-27',201512,3,2015,27,12,201503,2015),('2015-03-28',201512,3,2015,28,12,201503,2015),('2015-03-29',201513,3,2015,29,13,201503,2015),('2015-03-30',201513,3,2015,30,13,201503,2015),('2015-03-31',201513,3,2015,31,13,201503,2015),('2015-04-01',201513,4,2015,1,13,201504,2015),('2015-04-02',201513,4,2015,2,13,201504,2015),('2015-04-03',201513,4,2015,3,13,201504,2015),('2015-04-04',201513,4,2015,4,13,201504,2015),('2015-04-05',201514,4,2015,5,14,201504,2015),('2015-04-06',201514,4,2015,6,14,201504,2015),('2015-04-07',201514,4,2015,7,14,201504,2015),('2015-04-08',201514,4,2015,8,14,201504,2015),('2015-04-09',201514,4,2015,9,14,201504,2015),('2015-04-10',201514,4,2015,10,14,201504,2015),('2015-04-11',201514,4,2015,11,14,201504,2015),('2015-04-12',201515,4,2015,12,15,201504,2015),('2015-04-13',201515,4,2015,13,15,201504,2015),('2015-04-14',201515,4,2015,14,15,201504,2015),('2015-04-15',201515,4,2015,15,15,201504,2015),('2015-04-16',201515,4,2015,16,15,201504,2015),('2015-04-17',201515,4,2015,17,15,201504,2015),('2015-04-18',201515,4,2015,18,15,201504,2015),('2015-04-19',201516,4,2015,19,16,201504,2015),('2015-04-20',201516,4,2015,20,16,201504,2015),('2015-04-21',201516,4,2015,21,16,201504,2015),('2015-04-22',201516,4,2015,22,16,201504,2015),('2015-04-23',201516,4,2015,23,16,201504,2015),('2015-04-24',201516,4,2015,24,16,201504,2015),('2015-04-25',201516,4,2015,25,16,201504,2015),('2015-04-26',201517,4,2015,26,17,201504,2015),('2015-04-27',201517,4,2015,27,17,201504,2015),('2015-04-28',201517,4,2015,28,17,201504,2015),('2015-04-29',201517,4,2015,29,17,201504,2015),('2015-04-30',201517,4,2015,30,17,201504,2015),('2015-05-01',201517,5,2015,1,17,201505,2015),('2015-05-02',201517,5,2015,2,17,201505,2015),('2015-05-03',201518,5,2015,3,18,201505,2015),('2015-05-04',201518,5,2015,4,18,201505,2015),('2015-05-05',201518,5,2015,5,18,201505,2015),('2015-05-06',201518,5,2015,6,18,201505,2015),('2015-05-07',201518,5,2015,7,18,201505,2015),('2015-05-08',201518,5,2015,8,18,201505,2015),('2015-05-09',201518,5,2015,9,18,201505,2015),('2015-05-10',201519,5,2015,10,19,201505,2015),('2015-05-11',201519,5,2015,11,19,201505,2015),('2015-05-12',201519,5,2015,12,19,201505,2015),('2015-05-13',201519,5,2015,13,19,201505,2015),('2015-05-14',201519,5,2015,14,19,201505,2015),('2015-05-15',201519,5,2015,15,19,201505,2015),('2015-05-16',201519,5,2015,16,19,201505,2015),('2015-05-17',201520,5,2015,17,20,201505,2015),('2015-05-18',201520,5,2015,18,20,201505,2015),('2015-05-19',201520,5,2015,19,20,201505,2015),('2015-05-20',201520,5,2015,20,20,201505,2015),('2015-05-21',201520,5,2015,21,20,201505,2015),('2015-05-22',201520,5,2015,22,20,201505,2015),('2015-05-23',201520,5,2015,23,20,201505,2015),('2015-05-24',201521,5,2015,24,21,201505,2015),('2015-05-25',201521,5,2015,25,21,201505,2015),('2015-05-26',201521,5,2015,26,21,201505,2015),('2015-05-27',201521,5,2015,27,21,201505,2015),('2015-05-28',201521,5,2015,28,21,201505,2015),('2015-05-29',201521,5,2015,29,21,201505,2015),('2015-05-30',201521,5,2015,30,21,201505,2015),('2015-05-31',201522,5,2015,31,22,201505,2015),('2015-06-01',201522,6,2015,1,22,201506,2015),('2015-06-02',201522,6,2015,2,22,201506,2015),('2015-06-03',201522,6,2015,3,22,201506,2015),('2015-06-04',201522,6,2015,4,22,201506,2015),('2015-06-05',201522,6,2015,5,22,201506,2015),('2015-06-06',201522,6,2015,6,22,201506,2015),('2015-06-07',201523,6,2015,7,23,201506,2015),('2015-06-08',201523,6,2015,8,23,201506,2015),('2015-06-09',201523,6,2015,9,23,201506,2015),('2015-06-10',201523,6,2015,10,23,201506,2015),('2015-06-11',201523,6,2015,11,23,201506,2015),('2015-06-12',201523,6,2015,12,23,201506,2015),('2015-06-13',201523,6,2015,13,23,201506,2015),('2015-06-14',201524,6,2015,14,24,201506,2015),('2015-06-15',201524,6,2015,15,24,201506,2015),('2015-06-16',201524,6,2015,16,24,201506,2015),('2015-06-17',201524,6,2015,17,24,201506,2015),('2015-06-18',201524,6,2015,18,24,201506,2015),('2015-06-19',201524,6,2015,19,24,201506,2015),('2015-06-20',201524,6,2015,20,24,201506,2015),('2015-06-21',201525,6,2015,21,25,201506,2015),('2015-06-22',201525,6,2015,22,25,201506,2015),('2015-06-23',201525,6,2015,23,25,201506,2015),('2015-06-24',201525,6,2015,24,25,201506,2015),('2015-06-25',201525,6,2015,25,25,201506,2015),('2015-06-26',201525,6,2015,26,25,201506,2015),('2015-06-27',201525,6,2015,27,25,201506,2015),('2015-06-28',201526,6,2015,28,26,201506,2015),('2015-06-29',201526,6,2015,29,26,201506,2015),('2015-06-30',201526,6,2015,30,26,201506,2015),('2015-07-01',201526,7,2015,1,26,201507,2015),('2015-07-02',201526,7,2015,2,26,201507,2015),('2015-07-03',201526,7,2015,3,26,201507,2015),('2015-07-04',201526,7,2015,4,26,201507,2015),('2015-07-05',201527,7,2015,5,27,201507,2015),('2015-07-06',201527,7,2015,6,27,201507,2015),('2015-07-07',201527,7,2015,7,27,201507,2015),('2015-07-08',201527,7,2015,8,27,201507,2015),('2015-07-09',201527,7,2015,9,27,201507,2015),('2015-07-10',201527,7,2015,10,27,201507,2015),('2015-07-11',201527,7,2015,11,27,201507,2015),('2015-07-12',201528,7,2015,12,28,201507,2015),('2015-07-13',201528,7,2015,13,28,201507,2015),('2015-07-14',201528,7,2015,14,28,201507,2015),('2015-07-15',201528,7,2015,15,28,201507,2015),('2015-07-16',201528,7,2015,16,28,201507,2015),('2015-07-17',201528,7,2015,17,28,201507,2015),('2015-07-18',201528,7,2015,18,28,201507,2015),('2015-07-19',201529,7,2015,19,29,201507,2015),('2015-07-20',201529,7,2015,20,29,201507,2015),('2015-07-21',201529,7,2015,21,29,201507,2015),('2015-07-22',201529,7,2015,22,29,201507,2015),('2015-07-23',201529,7,2015,23,29,201507,2015),('2015-07-24',201529,7,2015,24,29,201507,2015),('2015-07-25',201529,7,2015,25,29,201507,2015),('2015-07-26',201530,7,2015,26,30,201507,2015),('2015-07-27',201530,7,2015,27,30,201507,2015),('2015-07-28',201530,7,2015,28,30,201507,2015),('2015-07-29',201530,7,2015,29,30,201507,2015),('2015-07-30',201530,7,2015,30,30,201507,2015),('2015-07-31',201530,7,2015,31,30,201507,2015),('2015-08-01',201530,8,2015,1,30,201508,2015),('2015-08-02',201531,8,2015,2,31,201508,2015),('2015-08-03',201531,8,2015,3,31,201508,2015),('2015-08-04',201531,8,2015,4,31,201508,2015),('2015-08-05',201531,8,2015,5,31,201508,2015),('2015-08-06',201531,8,2015,6,31,201508,2015),('2015-08-07',201531,8,2015,7,31,201508,2015),('2015-08-08',201531,8,2015,8,31,201508,2015),('2015-08-09',201532,8,2015,9,32,201508,2015),('2015-08-10',201532,8,2015,10,32,201508,2015),('2015-08-11',201532,8,2015,11,32,201508,2015),('2015-08-12',201532,8,2015,12,32,201508,2015),('2015-08-13',201532,8,2015,13,32,201508,2015),('2015-08-14',201532,8,2015,14,32,201508,2015),('2015-08-15',201532,8,2015,15,32,201508,2015),('2015-08-16',201533,8,2015,16,33,201508,2015),('2015-08-17',201533,8,2015,17,33,201508,2015),('2015-08-18',201533,8,2015,18,33,201508,2015),('2015-08-19',201533,8,2015,19,33,201508,2015),('2015-08-20',201533,8,2015,20,33,201508,2015),('2015-08-21',201533,8,2015,21,33,201508,2015),('2015-08-22',201533,8,2015,22,33,201508,2015),('2015-08-23',201534,8,2015,23,34,201508,2015),('2015-08-24',201534,8,2015,24,34,201508,2015),('2015-08-25',201534,8,2015,25,34,201508,2015),('2015-08-26',201534,8,2015,26,34,201508,2015),('2015-08-27',201534,8,2015,27,34,201508,2015),('2015-08-28',201534,8,2015,28,34,201508,2015),('2015-08-29',201534,8,2015,29,34,201508,2015),('2015-08-30',201535,8,2015,30,35,201508,2015),('2015-08-31',201535,8,2015,31,35,201508,2015),('2015-09-01',201535,9,2015,1,35,201509,2015),('2015-09-02',201535,9,2015,2,35,201509,2015),('2015-09-03',201535,9,2015,3,35,201509,2015),('2015-09-04',201535,9,2015,4,35,201509,2015),('2015-09-05',201535,9,2015,5,35,201509,2015),('2015-09-06',201536,9,2015,6,36,201509,2015),('2015-09-07',201536,9,2015,7,36,201509,2015),('2015-09-08',201536,9,2015,8,36,201509,2015),('2015-09-09',201536,9,2015,9,36,201509,2015),('2015-09-10',201536,9,2015,10,36,201509,2015),('2015-09-11',201536,9,2015,11,36,201509,2015),('2015-09-12',201536,9,2015,12,36,201509,2015),('2015-09-13',201537,9,2015,13,37,201509,2015),('2015-09-14',201537,9,2015,14,37,201509,2015),('2015-09-15',201537,9,2015,15,37,201509,2015),('2015-09-16',201537,9,2015,16,37,201509,2015),('2015-09-17',201537,9,2015,17,37,201509,2015),('2015-09-18',201537,9,2015,18,37,201509,2015),('2015-09-19',201537,9,2015,19,37,201509,2015),('2015-09-20',201538,9,2015,20,38,201509,2015),('2015-09-21',201538,9,2015,21,38,201509,2015),('2015-09-22',201538,9,2015,22,38,201509,2015),('2015-09-23',201538,9,2015,23,38,201509,2015),('2015-09-24',201538,9,2015,24,38,201509,2015),('2015-09-25',201538,9,2015,25,38,201509,2015),('2015-09-26',201538,9,2015,26,38,201509,2015),('2015-09-27',201539,9,2015,27,39,201509,2015),('2015-09-28',201539,9,2015,28,39,201509,2015),('2015-09-29',201539,9,2015,29,39,201509,2015),('2015-09-30',201539,9,2015,30,39,201509,2015),('2015-10-01',201539,10,2015,1,39,201510,2015),('2015-10-02',201539,10,2015,2,39,201510,2015),('2015-10-03',201539,10,2015,3,39,201510,2015),('2015-10-04',201540,10,2015,4,40,201510,2015),('2015-10-05',201540,10,2015,5,40,201510,2015),('2015-10-06',201540,10,2015,6,40,201510,2015),('2015-10-07',201540,10,2015,7,40,201510,2015),('2015-10-08',201540,10,2015,8,40,201510,2015),('2015-10-09',201540,10,2015,9,40,201510,2015),('2015-10-10',201540,10,2015,10,40,201510,2015),('2015-10-11',201541,10,2015,11,41,201510,2015),('2015-10-12',201541,10,2015,12,41,201510,2015),('2015-10-13',201541,10,2015,13,41,201510,2015),('2015-10-14',201541,10,2015,14,41,201510,2015),('2015-10-15',201541,10,2015,15,41,201510,2015),('2015-10-16',201541,10,2015,16,41,201510,2015),('2015-10-17',201541,10,2015,17,41,201510,2015),('2015-10-18',201542,10,2015,18,42,201510,2015),('2015-10-19',201542,10,2015,19,42,201510,2015),('2015-10-20',201542,10,2015,20,42,201510,2015),('2015-10-21',201542,10,2015,21,42,201510,2015),('2015-10-22',201542,10,2015,22,42,201510,2015),('2015-10-23',201542,10,2015,23,42,201510,2015),('2015-10-24',201542,10,2015,24,42,201510,2015),('2015-10-25',201543,10,2015,25,43,201510,2015),('2015-10-26',201543,10,2015,26,43,201510,2015),('2015-10-27',201543,10,2015,27,43,201510,2015),('2015-10-28',201543,10,2015,28,43,201510,2015),('2015-10-29',201543,10,2015,29,43,201510,2015),('2015-10-30',201543,10,2015,30,43,201510,2015),('2015-10-31',201543,10,2015,31,43,201510,2015),('2015-11-01',201544,11,2015,1,44,201511,2015),('2015-11-02',201544,11,2015,2,44,201511,2015),('2015-11-03',201544,11,2015,3,44,201511,2015),('2015-11-04',201544,11,2015,4,44,201511,2015),('2015-11-05',201544,11,2015,5,44,201511,2015),('2015-11-06',201544,11,2015,6,44,201511,2015),('2015-11-07',201544,11,2015,7,44,201511,2015),('2015-11-08',201545,11,2015,8,45,201511,2015),('2015-11-09',201545,11,2015,9,45,201511,2015),('2015-11-10',201545,11,2015,10,45,201511,2015),('2015-11-11',201545,11,2015,11,45,201511,2015),('2015-11-12',201545,11,2015,12,45,201511,2015),('2015-11-13',201545,11,2015,13,45,201511,2015),('2015-11-14',201545,11,2015,14,45,201511,2015),('2015-11-15',201546,11,2015,15,46,201511,2015),('2015-11-16',201546,11,2015,16,46,201511,2015),('2015-11-17',201546,11,2015,17,46,201511,2015),('2015-11-18',201546,11,2015,18,46,201511,2015),('2015-11-19',201546,11,2015,19,46,201511,2015),('2015-11-20',201546,11,2015,20,46,201511,2015),('2015-11-21',201546,11,2015,21,46,201511,2015),('2015-11-22',201547,11,2015,22,47,201511,2015),('2015-11-23',201547,11,2015,23,47,201511,2015),('2015-11-24',201547,11,2015,24,47,201511,2015),('2015-11-25',201547,11,2015,25,47,201511,2015),('2015-11-26',201547,11,2015,26,47,201511,2015),('2015-11-27',201547,11,2015,27,47,201511,2015),('2015-11-28',201547,11,2015,28,47,201511,2015),('2015-11-29',201548,11,2015,29,48,201511,2015),('2015-11-30',201548,11,2015,30,48,201511,2015),('2015-12-01',201548,12,2015,1,48,201512,2016),('2015-12-02',201548,12,2015,2,48,201512,2016),('2015-12-03',201548,12,2015,3,48,201512,2016),('2015-12-04',201548,12,2015,4,48,201512,2016),('2015-12-05',201548,12,2015,5,48,201512,2016),('2015-12-06',201549,12,2015,6,49,201512,2016),('2015-12-07',201549,12,2015,7,49,201512,2016),('2015-12-08',201549,12,2015,8,49,201512,2016),('2015-12-09',201549,12,2015,9,49,201512,2016),('2015-12-10',201549,12,2015,10,49,201512,2016),('2015-12-11',201549,12,2015,11,49,201512,2016),('2015-12-12',201549,12,2015,12,49,201512,2016),('2015-12-13',201550,12,2015,13,50,201512,2016),('2015-12-14',201550,12,2015,14,50,201512,2016),('2015-12-15',201550,12,2015,15,50,201512,2016),('2015-12-16',201550,12,2015,16,50,201512,2016),('2015-12-17',201550,12,2015,17,50,201512,2016),('2015-12-18',201550,12,2015,18,50,201512,2016),('2015-12-19',201550,12,2015,19,50,201512,2016),('2015-12-20',201551,12,2015,20,51,201512,2016),('2015-12-21',201551,12,2015,21,51,201512,2016),('2015-12-22',201551,12,2015,22,51,201512,2016),('2015-12-23',201551,12,2015,23,51,201512,2016),('2015-12-24',201551,12,2015,24,51,201512,2016),('2015-12-25',201551,12,2015,25,51,201512,2016),('2015-12-26',201551,12,2015,26,51,201512,2016),('2015-12-27',201552,12,2015,27,52,201512,2016),('2015-12-28',201552,12,2015,28,52,201512,2016),('2015-12-29',201552,12,2015,29,52,201512,2016),('2015-12-30',201552,12,2015,30,52,201512,2016),('2015-12-31',201552,12,2015,31,52,201512,2016),('2016-01-01',201552,1,2016,1,1,201601,2016),('2016-01-02',201552,1,2016,2,1,201601,2016),('2016-01-03',201601,1,2016,3,1,201601,2016),('2016-01-04',201601,1,2016,4,1,201601,2016),('2016-01-05',201601,1,2016,5,1,201601,2016),('2016-01-06',201601,1,2016,6,1,201601,2016),('2016-01-07',201601,1,2016,7,1,201601,2016),('2016-01-08',201601,1,2016,8,1,201601,2016),('2016-01-09',201601,1,2016,9,1,201601,2016),('2016-01-10',201602,1,2016,10,2,201601,2016),('2016-01-11',201602,1,2016,11,2,201601,2016),('2016-01-12',201602,1,2016,12,2,201601,2016),('2016-01-13',201602,1,2016,13,2,201601,2016),('2016-01-14',201602,1,2016,14,2,201601,2016),('2016-01-15',201602,1,2016,15,2,201601,2016),('2016-01-16',201602,1,2016,16,2,201601,2016),('2016-01-17',201603,1,2016,17,3,201601,2016),('2016-01-18',201603,1,2016,18,3,201601,2016),('2016-01-19',201603,1,2016,19,3,201601,2016),('2016-01-20',201603,1,2016,20,3,201601,2016),('2016-01-21',201603,1,2016,21,3,201601,2016),('2016-01-22',201603,1,2016,22,3,201601,2016),('2016-01-23',201603,1,2016,23,3,201601,2016),('2016-01-24',201604,1,2016,24,4,201601,2016),('2016-01-25',201604,1,2016,25,4,201601,2016),('2016-01-26',201604,1,2016,26,4,201601,2016),('2016-01-27',201604,1,2016,27,4,201601,2016),('2016-01-28',201604,1,2016,28,4,201601,2016),('2016-01-29',201604,1,2016,29,4,201601,2016),('2016-01-30',201604,1,2016,30,4,201601,2016),('2016-01-31',201605,1,2016,31,5,201601,2016),('2016-02-01',201605,2,2016,1,5,201602,2016),('2016-02-02',201605,2,2016,2,5,201602,2016),('2016-02-03',201605,2,2016,3,5,201602,2016),('2016-02-04',201605,2,2016,4,5,201602,2016),('2016-02-05',201605,2,2016,5,5,201602,2016),('2016-02-06',201605,2,2016,6,5,201602,2016),('2016-02-07',201606,2,2016,7,6,201602,2016),('2016-02-08',201606,2,2016,8,6,201602,2016),('2016-02-09',201606,2,2016,9,6,201602,2016),('2016-02-10',201606,2,2016,10,6,201602,2016),('2016-02-11',201606,2,2016,11,6,201602,2016),('2016-02-12',201606,2,2016,12,6,201602,2016),('2016-02-13',201606,2,2016,13,6,201602,2016),('2016-02-14',201607,2,2016,14,7,201602,2016),('2016-02-15',201607,2,2016,15,7,201602,2016),('2016-02-16',201607,2,2016,16,7,201602,2016),('2016-02-17',201607,2,2016,17,7,201602,2016),('2016-02-18',201607,2,2016,18,7,201602,2016),('2016-02-19',201607,2,2016,19,7,201602,2016),('2016-02-20',201607,2,2016,20,7,201602,2016),('2016-02-21',201608,2,2016,21,8,201602,2016),('2016-02-22',201608,2,2016,22,8,201602,2016),('2016-02-23',201608,2,2016,23,8,201602,2016),('2016-02-24',201608,2,2016,24,8,201602,2016),('2016-02-25',201608,2,2016,25,8,201602,2016),('2016-02-26',201608,2,2016,26,8,201602,2016),('2016-02-27',201608,2,2016,27,8,201602,2016),('2016-02-28',201609,2,2016,28,9,201602,2016),('2016-02-29',201609,2,2016,29,9,201602,2016),('2016-03-01',201609,3,2016,1,9,201603,2016),('2016-03-02',201609,3,2016,2,9,201603,2016),('2016-03-03',201609,3,2016,3,9,201603,2016),('2016-03-04',201609,3,2016,4,9,201603,2016),('2016-03-05',201609,3,2016,5,9,201603,2016),('2016-03-06',201610,3,2016,6,10,201603,2016),('2016-03-07',201610,3,2016,7,10,201603,2016),('2016-03-08',201610,3,2016,8,10,201603,2016),('2016-03-09',201610,3,2016,9,10,201603,2016),('2016-03-10',201610,3,2016,10,10,201603,2016),('2016-03-11',201610,3,2016,11,10,201603,2016),('2016-03-12',201610,3,2016,12,10,201603,2016),('2016-03-13',201611,3,2016,13,11,201603,2016),('2016-03-14',201611,3,2016,14,11,201603,2016),('2016-03-15',201611,3,2016,15,11,201603,2016),('2016-03-16',201611,3,2016,16,11,201603,2016),('2016-03-17',201611,3,2016,17,11,201603,2016),('2016-03-18',201611,3,2016,18,11,201603,2016),('2016-03-19',201611,3,2016,19,11,201603,2016),('2016-03-20',201612,3,2016,20,12,201603,2016),('2016-03-21',201612,3,2016,21,12,201603,2016),('2016-03-22',201612,3,2016,22,12,201603,2016),('2016-03-23',201612,3,2016,23,12,201603,2016),('2016-03-24',201612,3,2016,24,12,201603,2016),('2016-03-25',201612,3,2016,25,12,201603,2016),('2016-03-26',201612,3,2016,26,12,201603,2016),('2016-03-27',201613,3,2016,27,13,201603,2016),('2016-03-28',201613,3,2016,28,13,201603,2016),('2016-03-29',201613,3,2016,29,13,201603,2016),('2016-03-30',201613,3,2016,30,13,201603,2016),('2016-03-31',201613,3,2016,31,13,201603,2016),('2016-04-01',201613,4,2016,1,13,201604,2016),('2016-04-02',201613,4,2016,2,13,201604,2016),('2016-04-03',201614,4,2016,3,14,201604,2016),('2016-04-04',201614,4,2016,4,14,201604,2016),('2016-04-05',201614,4,2016,5,14,201604,2016),('2016-04-06',201614,4,2016,6,14,201604,2016),('2016-04-07',201614,4,2016,7,14,201604,2016),('2016-04-08',201614,4,2016,8,14,201604,2016),('2016-04-09',201614,4,2016,9,14,201604,2016),('2016-04-10',201615,4,2016,10,15,201604,2016),('2016-04-11',201615,4,2016,11,15,201604,2016),('2016-04-12',201615,4,2016,12,15,201604,2016),('2016-04-13',201615,4,2016,13,15,201604,2016),('2016-04-14',201615,4,2016,14,15,201604,2016),('2016-04-15',201615,4,2016,15,15,201604,2016),('2016-04-16',201615,4,2016,16,15,201604,2016),('2016-04-17',201616,4,2016,17,16,201604,2016),('2016-04-18',201616,4,2016,18,16,201604,2016),('2016-04-19',201616,4,2016,19,16,201604,2016),('2016-04-20',201616,4,2016,20,16,201604,2016),('2016-04-21',201616,4,2016,21,16,201604,2016),('2016-04-22',201616,4,2016,22,16,201604,2016),('2016-04-23',201616,4,2016,23,16,201604,2016),('2016-04-24',201617,4,2016,24,17,201604,2016),('2016-04-25',201617,4,2016,25,17,201604,2016),('2016-04-26',201617,4,2016,26,17,201604,2016),('2016-04-27',201617,4,2016,27,17,201604,2016),('2016-04-28',201617,4,2016,28,17,201604,2016),('2016-04-29',201617,4,2016,29,17,201604,2016),('2016-04-30',201617,4,2016,30,17,201604,2016),('2016-05-01',201618,5,2016,1,18,201605,2016),('2016-05-02',201618,5,2016,2,18,201605,2016),('2016-05-03',201618,5,2016,3,18,201605,2016),('2016-05-04',201618,5,2016,4,18,201605,2016),('2016-05-05',201618,5,2016,5,18,201605,2016),('2016-05-06',201618,5,2016,6,18,201605,2016),('2016-05-07',201618,5,2016,7,18,201605,2016),('2016-05-08',201619,5,2016,8,19,201605,2016),('2016-05-09',201619,5,2016,9,19,201605,2016),('2016-05-10',201619,5,2016,10,19,201605,2016),('2016-05-11',201619,5,2016,11,19,201605,2016),('2016-05-12',201619,5,2016,12,19,201605,2016),('2016-05-13',201619,5,2016,13,19,201605,2016),('2016-05-14',201619,5,2016,14,19,201605,2016),('2016-05-15',201620,5,2016,15,20,201605,2016),('2016-05-16',201620,5,2016,16,20,201605,2016),('2016-05-17',201620,5,2016,17,20,201605,2016),('2016-05-18',201620,5,2016,18,20,201605,2016),('2016-05-19',201620,5,2016,19,20,201605,2016),('2016-05-20',201620,5,2016,20,20,201605,2016),('2016-05-21',201620,5,2016,21,20,201605,2016),('2016-05-22',201621,5,2016,22,21,201605,2016),('2016-05-23',201621,5,2016,23,21,201605,2016),('2016-05-24',201621,5,2016,24,21,201605,2016),('2016-05-25',201621,5,2016,25,21,201605,2016),('2016-05-26',201621,5,2016,26,21,201605,2016),('2016-05-27',201621,5,2016,27,21,201605,2016),('2016-05-28',201621,5,2016,28,21,201605,2016),('2016-05-29',201622,5,2016,29,22,201605,2016),('2016-05-30',201622,5,2016,30,22,201605,2016),('2016-05-31',201622,5,2016,31,22,201605,2016),('2016-06-01',201622,6,2016,1,22,201606,2016),('2016-06-02',201622,6,2016,2,22,201606,2016),('2016-06-03',201622,6,2016,3,22,201606,2016),('2016-06-04',201622,6,2016,4,22,201606,2016),('2016-06-05',201623,6,2016,5,23,201606,2016),('2016-06-06',201623,6,2016,6,23,201606,2016),('2016-06-07',201623,6,2016,7,23,201606,2016),('2016-06-08',201623,6,2016,8,23,201606,2016),('2016-06-09',201623,6,2016,9,23,201606,2016),('2016-06-10',201623,6,2016,10,23,201606,2016),('2016-06-11',201623,6,2016,11,23,201606,2016),('2016-06-12',201624,6,2016,12,24,201606,2016),('2016-06-13',201624,6,2016,13,24,201606,2016),('2016-06-14',201624,6,2016,14,24,201606,2016),('2016-06-15',201624,6,2016,15,24,201606,2016),('2016-06-16',201624,6,2016,16,24,201606,2016),('2016-06-17',201624,6,2016,17,24,201606,2016),('2016-06-18',201624,6,2016,18,24,201606,2016),('2016-06-19',201625,6,2016,19,25,201606,2016),('2016-06-20',201625,6,2016,20,25,201606,2016),('2016-06-21',201625,6,2016,21,25,201606,2016),('2016-06-22',201625,6,2016,22,25,201606,2016),('2016-06-23',201625,6,2016,23,25,201606,2016),('2016-06-24',201625,6,2016,24,25,201606,2016),('2016-06-25',201625,6,2016,25,25,201606,2016),('2016-06-26',201626,6,2016,26,26,201606,2016),('2016-06-27',201626,6,2016,27,26,201606,2016),('2016-06-28',201626,6,2016,28,26,201606,2016),('2016-06-29',201626,6,2016,29,26,201606,2016),('2016-06-30',201626,6,2016,30,26,201606,2016),('2016-07-01',201626,7,2016,1,26,201607,2016),('2016-07-02',201626,7,2016,2,26,201607,2016),('2016-07-03',201627,7,2016,3,27,201607,2016),('2016-07-04',201627,7,2016,4,27,201607,2016),('2016-07-05',201627,7,2016,5,27,201607,2016),('2016-07-06',201627,7,2016,6,27,201607,2016),('2016-07-07',201627,7,2016,7,27,201607,2016),('2016-07-08',201627,7,2016,8,27,201607,2016),('2016-07-09',201627,7,2016,9,27,201607,2016),('2016-07-10',201628,7,2016,10,28,201607,2016),('2016-07-11',201628,7,2016,11,28,201607,2016),('2016-07-12',201628,7,2016,12,28,201607,2016),('2016-07-13',201628,7,2016,13,28,201607,2016),('2016-07-14',201628,7,2016,14,28,201607,2016),('2016-07-15',201628,7,2016,15,28,201607,2016),('2016-07-16',201628,7,2016,16,28,201607,2016),('2016-07-17',201629,7,2016,17,29,201607,2016),('2016-07-18',201629,7,2016,18,29,201607,2016),('2016-07-19',201629,7,2016,19,29,201607,2016),('2016-07-20',201629,7,2016,20,29,201607,2016),('2016-07-21',201629,7,2016,21,29,201607,2016),('2016-07-22',201629,7,2016,22,29,201607,2016),('2016-07-23',201629,7,2016,23,29,201607,2016),('2016-07-24',201630,7,2016,24,30,201607,2016),('2016-07-25',201630,7,2016,25,30,201607,2016),('2016-07-26',201630,7,2016,26,30,201607,2016),('2016-07-27',201630,7,2016,27,30,201607,2016),('2016-07-28',201630,7,2016,28,30,201607,2016),('2016-07-29',201630,7,2016,29,30,201607,2016),('2016-07-30',201630,7,2016,30,30,201607,2016),('2016-07-31',201631,7,2016,31,31,201607,2016),('2016-08-01',201631,8,2016,1,31,201608,2016),('2016-08-02',201631,8,2016,2,31,201608,2016),('2016-08-03',201631,8,2016,3,31,201608,2016),('2016-08-04',201631,8,2016,4,31,201608,2016),('2016-08-05',201631,8,2016,5,31,201608,2016),('2016-08-06',201631,8,2016,6,31,201608,2016),('2016-08-07',201632,8,2016,7,32,201608,2016),('2016-08-08',201632,8,2016,8,32,201608,2016),('2016-08-09',201632,8,2016,9,32,201608,2016),('2016-08-10',201632,8,2016,10,32,201608,2016),('2016-08-11',201632,8,2016,11,32,201608,2016),('2016-08-12',201632,8,2016,12,32,201608,2016),('2016-08-13',201632,8,2016,13,32,201608,2016),('2016-08-14',201633,8,2016,14,33,201608,2016),('2016-08-15',201633,8,2016,15,33,201608,2016),('2016-08-16',201633,8,2016,16,33,201608,2016),('2016-08-17',201633,8,2016,17,33,201608,2016),('2016-08-18',201633,8,2016,18,33,201608,2016),('2016-08-19',201633,8,2016,19,33,201608,2016),('2016-08-20',201633,8,2016,20,33,201608,2016),('2016-08-21',201634,8,2016,21,34,201608,2016),('2016-08-22',201634,8,2016,22,34,201608,2016),('2016-08-23',201634,8,2016,23,34,201608,2016),('2016-08-24',201634,8,2016,24,34,201608,2016),('2016-08-25',201634,8,2016,25,34,201608,2016),('2016-08-26',201634,8,2016,26,34,201608,2016),('2016-08-27',201634,8,2016,27,34,201608,2016),('2016-08-28',201635,8,2016,28,35,201608,2016),('2016-08-29',201635,8,2016,29,35,201608,2016),('2016-08-30',201635,8,2016,30,35,201608,2016),('2016-08-31',201635,8,2016,31,35,201608,2016),('2016-09-01',201635,9,2016,1,35,201609,2016),('2016-09-02',201635,9,2016,2,35,201609,2016),('2016-09-03',201635,9,2016,3,35,201609,2016),('2016-09-04',201636,9,2016,4,36,201609,2016),('2016-09-05',201636,9,2016,5,36,201609,2016),('2016-09-06',201636,9,2016,6,36,201609,2016),('2016-09-07',201636,9,2016,7,36,201609,2016),('2016-09-08',201636,9,2016,8,36,201609,2016),('2016-09-09',201636,9,2016,9,36,201609,2016),('2016-09-10',201636,9,2016,10,36,201609,2016),('2016-09-11',201637,9,2016,11,37,201609,2016),('2016-09-12',201637,9,2016,12,37,201609,2016),('2016-09-13',201637,9,2016,13,37,201609,2016),('2016-09-14',201637,9,2016,14,37,201609,2016),('2016-09-15',201637,9,2016,15,37,201609,2016),('2016-09-16',201637,9,2016,16,37,201609,2016),('2016-09-17',201637,9,2016,17,37,201609,2016),('2016-09-18',201638,9,2016,18,38,201609,2016),('2016-09-19',201638,9,2016,19,38,201609,2016),('2016-09-20',201638,9,2016,20,38,201609,2016),('2016-09-21',201638,9,2016,21,38,201609,2016),('2016-09-22',201638,9,2016,22,38,201609,2016),('2016-09-23',201638,9,2016,23,38,201609,2016),('2016-09-24',201638,9,2016,24,38,201609,2016),('2016-09-25',201639,9,2016,25,39,201609,2016),('2016-09-26',201639,9,2016,26,39,201609,2016),('2016-09-27',201639,9,2016,27,39,201609,2016),('2016-09-28',201639,9,2016,28,39,201609,2016),('2016-09-29',201639,9,2016,29,39,201609,2016),('2016-09-30',201639,9,2016,30,39,201609,2016),('2016-10-01',201639,10,2016,1,39,201610,2016),('2016-10-02',201640,10,2016,2,40,201610,2016),('2016-10-03',201640,10,2016,3,40,201610,2016),('2016-10-04',201640,10,2016,4,40,201610,2016),('2016-10-05',201640,10,2016,5,40,201610,2016),('2016-10-06',201640,10,2016,6,40,201610,2016),('2016-10-07',201640,10,2016,7,40,201610,2016),('2016-10-08',201640,10,2016,8,40,201610,2016),('2016-10-09',201641,10,2016,9,41,201610,2016),('2016-10-10',201641,10,2016,10,41,201610,2016),('2016-10-11',201641,10,2016,11,41,201610,2016),('2016-10-12',201641,10,2016,12,41,201610,2016),('2016-10-13',201641,10,2016,13,41,201610,2016),('2016-10-14',201641,10,2016,14,41,201610,2016),('2016-10-15',201641,10,2016,15,41,201610,2016),('2016-10-16',201642,10,2016,16,42,201610,2016),('2016-10-17',201642,10,2016,17,42,201610,2016),('2016-10-18',201642,10,2016,18,42,201610,2016),('2016-10-19',201642,10,2016,19,42,201610,2016),('2016-10-20',201642,10,2016,20,42,201610,2016),('2016-10-21',201642,10,2016,21,42,201610,2016),('2016-10-22',201642,10,2016,22,42,201610,2016),('2016-10-23',201643,10,2016,23,43,201610,2016),('2016-10-24',201643,10,2016,24,43,201610,2016),('2016-10-25',201643,10,2016,25,43,201610,2016),('2016-10-26',201643,10,2016,26,43,201610,2016),('2016-10-27',201643,10,2016,27,43,201610,2016),('2016-10-28',201643,10,2016,28,43,201610,2016),('2016-10-29',201643,10,2016,29,43,201610,2016),('2016-10-30',201644,10,2016,30,44,201610,2016),('2016-10-31',201644,10,2016,31,44,201610,2016),('2016-11-01',201644,11,2016,1,44,201611,2016),('2016-11-02',201644,11,2016,2,44,201611,2016),('2016-11-03',201644,11,2016,3,44,201611,2016),('2016-11-04',201644,11,2016,4,44,201611,2016),('2016-11-05',201644,11,2016,5,44,201611,2016),('2016-11-06',201645,11,2016,6,45,201611,2016),('2016-11-07',201645,11,2016,7,45,201611,2016),('2016-11-08',201645,11,2016,8,45,201611,2016),('2016-11-09',201645,11,2016,9,45,201611,2016),('2016-11-10',201645,11,2016,10,45,201611,2016),('2016-11-11',201645,11,2016,11,45,201611,2016),('2016-11-12',201645,11,2016,12,45,201611,2016),('2016-11-13',201646,11,2016,13,46,201611,2016),('2016-11-14',201646,11,2016,14,46,201611,2016),('2016-11-15',201646,11,2016,15,46,201611,2016),('2016-11-16',201646,11,2016,16,46,201611,2016),('2016-11-17',201646,11,2016,17,46,201611,2016),('2016-11-18',201646,11,2016,18,46,201611,2016),('2016-11-19',201646,11,2016,19,46,201611,2016),('2016-11-20',201647,11,2016,20,47,201611,2016),('2016-11-21',201647,11,2016,21,47,201611,2016),('2016-11-22',201647,11,2016,22,47,201611,2016),('2016-11-23',201647,11,2016,23,47,201611,2016),('2016-11-24',201647,11,2016,24,47,201611,2016),('2016-11-25',201647,11,2016,25,47,201611,2016),('2016-11-26',201647,11,2016,26,47,201611,2016),('2016-11-27',201648,11,2016,27,48,201611,2016),('2016-11-28',201648,11,2016,28,48,201611,2016),('2016-11-29',201648,11,2016,29,48,201611,2016),('2016-11-30',201648,11,2016,30,48,201611,2016),('2016-12-01',201648,12,2016,1,48,201612,2017),('2016-12-02',201648,12,2016,2,48,201612,2017),('2016-12-03',201648,12,2016,3,48,201612,2017),('2016-12-04',201649,12,2016,4,49,201612,2017),('2016-12-05',201649,12,2016,5,49,201612,2017),('2016-12-06',201649,12,2016,6,49,201612,2017),('2016-12-07',201649,12,2016,7,49,201612,2017),('2016-12-08',201649,12,2016,8,49,201612,2017),('2016-12-09',201649,12,2016,9,49,201612,2017),('2016-12-10',201649,12,2016,10,49,201612,2017),('2016-12-11',201650,12,2016,11,50,201612,2017),('2016-12-12',201650,12,2016,12,50,201612,2017),('2016-12-13',201650,12,2016,13,50,201612,2017),('2016-12-14',201650,12,2016,14,50,201612,2017),('2016-12-15',201650,12,2016,15,50,201612,2017),('2016-12-16',201650,12,2016,16,50,201612,2017),('2016-12-17',201650,12,2016,17,50,201612,2017),('2016-12-18',201651,12,2016,18,51,201612,2017),('2016-12-19',201651,12,2016,19,51,201612,2017),('2016-12-20',201651,12,2016,20,51,201612,2017),('2016-12-21',201651,12,2016,21,51,201612,2017),('2016-12-22',201651,12,2016,22,51,201612,2017),('2016-12-23',201651,12,2016,23,51,201612,2017),('2016-12-24',201651,12,2016,24,51,201612,2017),('2016-12-25',201652,12,2016,25,52,201612,2017),('2016-12-26',201652,12,2016,26,52,201612,2017),('2016-12-27',201652,12,2016,27,52,201612,2017),('2016-12-28',201652,12,2016,28,52,201612,2017),('2016-12-29',201652,12,2016,29,52,201612,2017),('2016-12-30',201652,12,2016,30,52,201612,2017),('2016-12-31',201652,12,2016,31,52,201612,2017),('2017-01-01',201701,1,2017,1,1,201701,2017),('2017-01-02',201701,1,2017,2,1,201701,2017),('2017-01-03',201701,1,2017,3,1,201701,2017),('2017-01-04',201701,1,2017,4,1,201701,2017),('2017-01-05',201701,1,2017,5,1,201701,2017),('2017-01-06',201701,1,2017,6,1,201701,2017),('2017-01-07',201701,1,2017,7,1,201701,2017),('2017-01-08',201702,1,2017,8,2,201701,2017),('2017-01-09',201702,1,2017,9,2,201701,2017),('2017-01-10',201702,1,2017,10,2,201701,2017),('2017-01-11',201702,1,2017,11,2,201701,2017),('2017-01-12',201702,1,2017,12,2,201701,2017),('2017-01-13',201702,1,2017,13,2,201701,2017),('2017-01-14',201702,1,2017,14,2,201701,2017),('2017-01-15',201703,1,2017,15,3,201701,2017),('2017-01-16',201703,1,2017,16,3,201701,2017),('2017-01-17',201703,1,2017,17,3,201701,2017),('2017-01-18',201703,1,2017,18,3,201701,2017),('2017-01-19',201703,1,2017,19,3,201701,2017),('2017-01-20',201703,1,2017,20,3,201701,2017),('2017-01-21',201703,1,2017,21,3,201701,2017),('2017-01-22',201704,1,2017,22,4,201701,2017),('2017-01-23',201704,1,2017,23,4,201701,2017),('2017-01-24',201704,1,2017,24,4,201701,2017),('2017-01-25',201704,1,2017,25,4,201701,2017),('2017-01-26',201704,1,2017,26,4,201701,2017),('2017-01-27',201704,1,2017,27,4,201701,2017),('2017-01-28',201704,1,2017,28,4,201701,2017),('2017-01-29',201705,1,2017,29,5,201701,2017),('2017-01-30',201705,1,2017,30,5,201701,2017),('2017-01-31',201705,1,2017,31,5,201701,2017),('2017-02-01',201705,2,2017,1,5,201702,2017),('2017-02-02',201705,2,2017,2,5,201702,2017),('2017-02-03',201705,2,2017,3,5,201702,2017),('2017-02-04',201705,2,2017,4,5,201702,2017),('2017-02-05',201706,2,2017,5,6,201702,2017),('2017-02-06',201706,2,2017,6,6,201702,2017),('2017-02-07',201706,2,2017,7,6,201702,2017),('2017-02-08',201706,2,2017,8,6,201702,2017),('2017-02-09',201706,2,2017,9,6,201702,2017),('2017-02-10',201706,2,2017,10,6,201702,2017),('2017-02-11',201706,2,2017,11,6,201702,2017),('2017-02-12',201707,2,2017,12,7,201702,2017),('2017-02-13',201707,2,2017,13,7,201702,2017),('2017-02-14',201707,2,2017,14,7,201702,2017),('2017-02-15',201707,2,2017,15,7,201702,2017),('2017-02-16',201707,2,2017,16,7,201702,2017),('2017-02-17',201707,2,2017,17,7,201702,2017),('2017-02-18',201707,2,2017,18,7,201702,2017),('2017-02-19',201708,2,2017,19,8,201702,2017),('2017-02-20',201708,2,2017,20,8,201702,2017),('2017-02-21',201708,2,2017,21,8,201702,2017),('2017-02-22',201708,2,2017,22,8,201702,2017),('2017-02-23',201708,2,2017,23,8,201702,2017),('2017-02-24',201708,2,2017,24,8,201702,2017),('2017-02-25',201708,2,2017,25,8,201702,2017),('2017-02-26',201709,2,2017,26,9,201702,2017),('2017-02-27',201709,2,2017,27,9,201702,2017),('2017-02-28',201709,2,2017,28,9,201702,2017),('2017-03-01',201709,3,2017,1,9,201703,2017),('2017-03-02',201709,3,2017,2,9,201703,2017),('2017-03-03',201709,3,2017,3,9,201703,2017),('2017-03-04',201709,3,2017,4,9,201703,2017),('2017-03-05',201710,3,2017,5,10,201703,2017),('2017-03-06',201710,3,2017,6,10,201703,2017),('2017-03-07',201710,3,2017,7,10,201703,2017),('2017-03-08',201710,3,2017,8,10,201703,2017),('2017-03-09',201710,3,2017,9,10,201703,2017),('2017-03-10',201710,3,2017,10,10,201703,2017),('2017-03-11',201710,3,2017,11,10,201703,2017),('2017-03-12',201711,3,2017,12,11,201703,2017),('2017-03-13',201711,3,2017,13,11,201703,2017),('2017-03-14',201711,3,2017,14,11,201703,2017),('2017-03-15',201711,3,2017,15,11,201703,2017),('2017-03-16',201711,3,2017,16,11,201703,2017),('2017-03-17',201711,3,2017,17,11,201703,2017),('2017-03-18',201711,3,2017,18,11,201703,2017),('2017-03-19',201712,3,2017,19,12,201703,2017),('2017-03-20',201712,3,2017,20,12,201703,2017),('2017-03-21',201712,3,2017,21,12,201703,2017),('2017-03-22',201712,3,2017,22,12,201703,2017),('2017-03-23',201712,3,2017,23,12,201703,2017),('2017-03-24',201712,3,2017,24,12,201703,2017),('2017-03-25',201712,3,2017,25,12,201703,2017),('2017-03-26',201713,3,2017,26,13,201703,2017),('2017-03-27',201713,3,2017,27,13,201703,2017),('2017-03-28',201713,3,2017,28,13,201703,2017),('2017-03-29',201713,3,2017,29,13,201703,2017),('2017-03-30',201713,3,2017,30,13,201703,2017),('2017-03-31',201713,3,2017,31,13,201703,2017),('2017-04-01',201713,4,2017,1,13,201704,2017),('2017-04-02',201714,4,2017,2,14,201704,2017),('2017-04-03',201714,4,2017,3,14,201704,2017),('2017-04-04',201714,4,2017,4,14,201704,2017),('2017-04-05',201714,4,2017,5,14,201704,2017),('2017-04-06',201714,4,2017,6,14,201704,2017),('2017-04-07',201714,4,2017,7,14,201704,2017),('2017-04-08',201714,4,2017,8,14,201704,2017),('2017-04-09',201715,4,2017,9,15,201704,2017),('2017-04-10',201715,4,2017,10,15,201704,2017),('2017-04-11',201715,4,2017,11,15,201704,2017),('2017-04-12',201715,4,2017,12,15,201704,2017),('2017-04-13',201715,4,2017,13,15,201704,2017),('2017-04-14',201715,4,2017,14,15,201704,2017),('2017-04-15',201715,4,2017,15,15,201704,2017),('2017-04-16',201716,4,2017,16,16,201704,2017),('2017-04-17',201716,4,2017,17,16,201704,2017),('2017-04-18',201716,4,2017,18,16,201704,2017),('2017-04-19',201716,4,2017,19,16,201704,2017),('2017-04-20',201716,4,2017,20,16,201704,2017),('2017-04-21',201716,4,2017,21,16,201704,2017),('2017-04-22',201716,4,2017,22,16,201704,2017),('2017-04-23',201717,4,2017,23,17,201704,2017),('2017-04-24',201717,4,2017,24,17,201704,2017),('2017-04-25',201717,4,2017,25,17,201704,2017),('2017-04-26',201717,4,2017,26,17,201704,2017),('2017-04-27',201717,4,2017,27,17,201704,2017),('2017-04-28',201717,4,2017,28,17,201704,2017),('2017-04-29',201717,4,2017,29,17,201704,2017),('2017-04-30',201718,4,2017,30,18,201704,2017),('2017-05-01',201718,5,2017,1,18,201705,2017),('2017-05-02',201718,5,2017,2,18,201705,2017),('2017-05-03',201718,5,2017,3,18,201705,2017),('2017-05-04',201718,5,2017,4,18,201705,2017),('2017-05-05',201718,5,2017,5,18,201705,2017),('2017-05-06',201718,5,2017,6,18,201705,2017),('2017-05-07',201719,5,2017,7,19,201705,2017),('2017-05-08',201719,5,2017,8,19,201705,2017),('2017-05-09',201719,5,2017,9,19,201705,2017),('2017-05-10',201719,5,2017,10,19,201705,2017),('2017-05-11',201719,5,2017,11,19,201705,2017),('2017-05-12',201719,5,2017,12,19,201705,2017),('2017-05-13',201719,5,2017,13,19,201705,2017),('2017-05-14',201720,5,2017,14,20,201705,2017),('2017-05-15',201720,5,2017,15,20,201705,2017),('2017-05-16',201720,5,2017,16,20,201705,2017),('2017-05-17',201720,5,2017,17,20,201705,2017),('2017-05-18',201720,5,2017,18,20,201705,2017),('2017-05-19',201720,5,2017,19,20,201705,2017),('2017-05-20',201720,5,2017,20,20,201705,2017),('2017-05-21',201721,5,2017,21,21,201705,2017),('2017-05-22',201721,5,2017,22,21,201705,2017),('2017-05-23',201721,5,2017,23,21,201705,2017),('2017-05-24',201721,5,2017,24,21,201705,2017),('2017-05-25',201721,5,2017,25,21,201705,2017),('2017-05-26',201721,5,2017,26,21,201705,2017),('2017-05-27',201721,5,2017,27,21,201705,2017),('2017-05-28',201722,5,2017,28,22,201705,2017),('2017-05-29',201722,5,2017,29,22,201705,2017),('2017-05-30',201722,5,2017,30,22,201705,2017),('2017-05-31',201722,5,2017,31,22,201705,2017),('2017-06-01',201722,6,2017,1,22,201706,2017),('2017-06-02',201722,6,2017,2,22,201706,2017),('2017-06-03',201722,6,2017,3,22,201706,2017),('2017-06-04',201723,6,2017,4,23,201706,2017),('2017-06-05',201723,6,2017,5,23,201706,2017),('2017-06-06',201723,6,2017,6,23,201706,2017),('2017-06-07',201723,6,2017,7,23,201706,2017),('2017-06-08',201723,6,2017,8,23,201706,2017),('2017-06-09',201723,6,2017,9,23,201706,2017),('2017-06-10',201723,6,2017,10,23,201706,2017),('2017-06-11',201724,6,2017,11,24,201706,2017),('2017-06-12',201724,6,2017,12,24,201706,2017),('2017-06-13',201724,6,2017,13,24,201706,2017),('2017-06-14',201724,6,2017,14,24,201706,2017),('2017-06-15',201724,6,2017,15,24,201706,2017),('2017-06-16',201724,6,2017,16,24,201706,2017),('2017-06-17',201724,6,2017,17,24,201706,2017),('2017-06-18',201725,6,2017,18,25,201706,2017),('2017-06-19',201725,6,2017,19,25,201706,2017),('2017-06-20',201725,6,2017,20,25,201706,2017),('2017-06-21',201725,6,2017,21,25,201706,2017),('2017-06-22',201725,6,2017,22,25,201706,2017),('2017-06-23',201725,6,2017,23,25,201706,2017),('2017-06-24',201725,6,2017,24,25,201706,2017),('2017-06-25',201726,6,2017,25,26,201706,2017),('2017-06-26',201726,6,2017,26,26,201706,2017),('2017-06-27',201726,6,2017,27,26,201706,2017),('2017-06-28',201726,6,2017,28,26,201706,2017),('2017-06-29',201726,6,2017,29,26,201706,2017),('2017-06-30',201726,6,2017,30,26,201706,2017),('2017-07-01',201726,7,2017,1,26,201707,2017),('2017-07-02',201727,7,2017,2,27,201707,2017),('2017-07-03',201727,7,2017,3,27,201707,2017),('2017-07-04',201727,7,2017,4,27,201707,2017),('2017-07-05',201727,7,2017,5,27,201707,2017),('2017-07-06',201727,7,2017,6,27,201707,2017),('2017-07-07',201727,7,2017,7,27,201707,2017),('2017-07-08',201727,7,2017,8,27,201707,2017),('2017-07-09',201728,7,2017,9,28,201707,2017),('2017-07-10',201728,7,2017,10,28,201707,2017),('2017-07-11',201728,7,2017,11,28,201707,2017),('2017-07-12',201728,7,2017,12,28,201707,2017),('2017-07-13',201728,7,2017,13,28,201707,2017),('2017-07-14',201728,7,2017,14,28,201707,2017),('2017-07-15',201728,7,2017,15,28,201707,2017),('2017-07-16',201729,7,2017,16,29,201707,2017),('2017-07-17',201729,7,2017,17,29,201707,2017),('2017-07-18',201729,7,2017,18,29,201707,2017),('2017-07-19',201729,7,2017,19,29,201707,2017),('2017-07-20',201729,7,2017,20,29,201707,2017),('2017-07-21',201729,7,2017,21,29,201707,2017),('2017-07-22',201729,7,2017,22,29,201707,2017),('2017-07-23',201730,7,2017,23,30,201707,2017),('2017-07-24',201730,7,2017,24,30,201707,2017),('2017-07-25',201730,7,2017,25,30,201707,2017),('2017-07-26',201730,7,2017,26,30,201707,2017),('2017-07-27',201730,7,2017,27,30,201707,2017),('2017-07-28',201730,7,2017,28,30,201707,2017),('2017-07-29',201730,7,2017,29,30,201707,2017),('2017-07-30',201731,7,2017,30,31,201707,2017),('2017-07-31',201731,7,2017,31,31,201707,2017),('2017-08-01',201731,8,2017,1,31,201708,2017),('2017-08-02',201731,8,2017,2,31,201708,2017),('2017-08-03',201731,8,2017,3,31,201708,2017),('2017-08-04',201731,8,2017,4,31,201708,2017),('2017-08-05',201731,8,2017,5,31,201708,2017),('2017-08-06',201732,8,2017,6,32,201708,2017),('2017-08-07',201732,8,2017,7,32,201708,2017),('2017-08-08',201732,8,2017,8,32,201708,2017),('2017-08-09',201732,8,2017,9,32,201708,2017),('2017-08-10',201732,8,2017,10,32,201708,2017),('2017-08-11',201732,8,2017,11,32,201708,2017),('2017-08-12',201732,8,2017,12,32,201708,2017),('2017-08-13',201733,8,2017,13,33,201708,2017),('2017-08-14',201733,8,2017,14,33,201708,2017),('2017-08-15',201733,8,2017,15,33,201708,2017),('2017-08-16',201733,8,2017,16,33,201708,2017),('2017-08-17',201733,8,2017,17,33,201708,2017),('2017-08-18',201733,8,2017,18,33,201708,2017),('2017-08-19',201733,8,2017,19,33,201708,2017),('2017-08-20',201734,8,2017,20,34,201708,2017),('2017-08-21',201734,8,2017,21,34,201708,2017),('2017-08-22',201734,8,2017,22,34,201708,2017),('2017-08-23',201734,8,2017,23,34,201708,2017),('2017-08-24',201734,8,2017,24,34,201708,2017),('2017-08-25',201734,8,2017,25,34,201708,2017),('2017-08-26',201734,8,2017,26,34,201708,2017),('2017-08-27',201735,8,2017,27,35,201708,2017),('2017-08-28',201735,8,2017,28,35,201708,2017),('2017-08-29',201735,8,2017,29,35,201708,2017),('2017-08-30',201735,8,2017,30,35,201708,2017),('2017-08-31',201735,8,2017,31,35,201708,2017),('2017-09-01',201735,9,2017,1,35,201709,2017),('2017-09-02',201735,9,2017,2,35,201709,2017),('2017-09-03',201736,9,2017,3,36,201709,2017),('2017-09-04',201736,9,2017,4,36,201709,2017),('2017-09-05',201736,9,2017,5,36,201709,2017),('2017-09-06',201736,9,2017,6,36,201709,2017),('2017-09-07',201736,9,2017,7,36,201709,2017),('2017-09-08',201736,9,2017,8,36,201709,2017),('2017-09-09',201736,9,2017,9,36,201709,2017),('2017-09-10',201737,9,2017,10,37,201709,2017),('2017-09-11',201737,9,2017,11,37,201709,2017),('2017-09-12',201737,9,2017,12,37,201709,2017),('2017-09-13',201737,9,2017,13,37,201709,2017),('2017-09-14',201737,9,2017,14,37,201709,2017),('2017-09-15',201737,9,2017,15,37,201709,2017),('2017-09-16',201737,9,2017,16,37,201709,2017),('2017-09-17',201738,9,2017,17,38,201709,2017),('2017-09-18',201738,9,2017,18,38,201709,2017),('2017-09-19',201738,9,2017,19,38,201709,2017),('2017-09-20',201738,9,2017,20,38,201709,2017),('2017-09-21',201738,9,2017,21,38,201709,2017),('2017-09-22',201738,9,2017,22,38,201709,2017),('2017-09-23',201738,9,2017,23,38,201709,2017),('2017-09-24',201739,9,2017,24,39,201709,2017),('2017-09-25',201739,9,2017,25,39,201709,2017),('2017-09-26',201739,9,2017,26,39,201709,2017),('2017-09-27',201739,9,2017,27,39,201709,2017),('2017-09-28',201739,9,2017,28,39,201709,2017),('2017-09-29',201739,9,2017,29,39,201709,2017),('2017-09-30',201739,9,2017,30,39,201709,2017),('2017-10-01',201740,10,2017,1,40,201710,2017),('2017-10-02',201740,10,2017,2,40,201710,2017),('2017-10-03',201740,10,2017,3,40,201710,2017),('2017-10-04',201740,10,2017,4,40,201710,2017),('2017-10-05',201740,10,2017,5,40,201710,2017),('2017-10-06',201740,10,2017,6,40,201710,2017),('2017-10-07',201740,10,2017,7,40,201710,2017),('2017-10-08',201741,10,2017,8,41,201710,2017),('2017-10-09',201741,10,2017,9,41,201710,2017),('2017-10-10',201741,10,2017,10,41,201710,2017),('2017-10-11',201741,10,2017,11,41,201710,2017),('2017-10-12',201741,10,2017,12,41,201710,2017),('2017-10-13',201741,10,2017,13,41,201710,2017),('2017-10-14',201741,10,2017,14,41,201710,2017),('2017-10-15',201742,10,2017,15,42,201710,2017),('2017-10-16',201742,10,2017,16,42,201710,2017),('2017-10-17',201742,10,2017,17,42,201710,2017),('2017-10-18',201742,10,2017,18,42,201710,2017),('2017-10-19',201742,10,2017,19,42,201710,2017),('2017-10-20',201742,10,2017,20,42,201710,2017),('2017-10-21',201742,10,2017,21,42,201710,2017),('2017-10-22',201743,10,2017,22,43,201710,2017),('2017-10-23',201743,10,2017,23,43,201710,2017),('2017-10-24',201743,10,2017,24,43,201710,2017),('2017-10-25',201743,10,2017,25,43,201710,2017),('2017-10-26',201743,10,2017,26,43,201710,2017),('2017-10-27',201743,10,2017,27,43,201710,2017),('2017-10-28',201743,10,2017,28,43,201710,2017),('2017-10-29',201744,10,2017,29,44,201710,2017),('2017-10-30',201744,10,2017,30,44,201710,2017),('2017-10-31',201744,10,2017,31,44,201710,2017),('2017-11-01',201744,11,2017,1,44,201711,2017),('2017-11-02',201744,11,2017,2,44,201711,2017),('2017-11-03',201744,11,2017,3,44,201711,2017),('2017-11-04',201744,11,2017,4,44,201711,2017),('2017-11-05',201745,11,2017,5,45,201711,2017),('2017-11-06',201745,11,2017,6,45,201711,2017),('2017-11-07',201745,11,2017,7,45,201711,2017),('2017-11-08',201745,11,2017,8,45,201711,2017),('2017-11-09',201745,11,2017,9,45,201711,2017),('2017-11-10',201745,11,2017,10,45,201711,2017),('2017-11-11',201745,11,2017,11,45,201711,2017),('2017-11-12',201746,11,2017,12,46,201711,2017),('2017-11-13',201746,11,2017,13,46,201711,2017),('2017-11-14',201746,11,2017,14,46,201711,2017),('2017-11-15',201746,11,2017,15,46,201711,2017),('2017-11-16',201746,11,2017,16,46,201711,2017),('2017-11-17',201746,11,2017,17,46,201711,2017),('2017-11-18',201746,11,2017,18,46,201711,2017),('2017-11-19',201747,11,2017,19,47,201711,2017),('2017-11-20',201747,11,2017,20,47,201711,2017),('2017-11-21',201747,11,2017,21,47,201711,2017),('2017-11-22',201747,11,2017,22,47,201711,2017),('2017-11-23',201747,11,2017,23,47,201711,2017),('2017-11-24',201747,11,2017,24,47,201711,2017),('2017-11-25',201747,11,2017,25,47,201711,2017),('2017-11-26',201748,11,2017,26,48,201711,2017),('2017-11-27',201748,11,2017,27,48,201711,2017),('2017-11-28',201748,11,2017,28,48,201711,2017),('2017-11-29',201748,11,2017,29,48,201711,2017),('2017-11-30',201748,11,2017,30,48,201711,2017),('2017-12-01',201748,12,2017,1,48,201712,2018),('2017-12-02',201748,12,2017,2,48,201712,2018),('2017-12-03',201749,12,2017,3,49,201712,2018),('2017-12-04',201749,12,2017,4,49,201712,2018),('2017-12-05',201749,12,2017,5,49,201712,2018),('2017-12-06',201749,12,2017,6,49,201712,2018),('2017-12-07',201749,12,2017,7,49,201712,2018),('2017-12-08',201749,12,2017,8,49,201712,2018),('2017-12-09',201749,12,2017,9,49,201712,2018),('2017-12-10',201750,12,2017,10,50,201712,2018),('2017-12-11',201750,12,2017,11,50,201712,2018),('2017-12-12',201750,12,2017,12,50,201712,2018),('2017-12-13',201750,12,2017,13,50,201712,2018),('2017-12-14',201750,12,2017,14,50,201712,2018),('2017-12-15',201750,12,2017,15,50,201712,2018),('2017-12-16',201750,12,2017,16,50,201712,2018),('2017-12-17',201751,12,2017,17,51,201712,2018),('2017-12-18',201751,12,2017,18,51,201712,2018),('2017-12-19',201751,12,2017,19,51,201712,2018),('2017-12-20',201751,12,2017,20,51,201712,2018),('2017-12-21',201751,12,2017,21,51,201712,2018),('2017-12-22',201751,12,2017,22,51,201712,2018),('2017-12-23',201751,12,2017,23,51,201712,2018),('2017-12-24',201752,12,2017,24,52,201712,2018),('2017-12-25',201752,12,2017,25,52,201712,2018),('2017-12-26',201752,12,2017,26,52,201712,2018),('2017-12-27',201752,12,2017,27,52,201712,2018),('2017-12-28',201752,12,2017,28,52,201712,2018),('2017-12-29',201752,12,2017,29,52,201712,2018),('2017-12-30',201752,12,2017,30,52,201712,2018),('2017-12-31',201801,12,2017,31,1,201712,2018),('2018-01-01',201801,1,2018,1,1,201801,2018),('2018-01-02',201801,1,2018,2,1,201801,2018),('2018-01-03',201801,1,2018,3,1,201801,2018),('2018-01-04',201801,1,2018,4,1,201801,2018),('2018-01-05',201801,1,2018,5,1,201801,2018),('2018-01-06',201801,1,2018,6,1,201801,2018),('2018-01-07',201802,1,2018,7,2,201801,2018),('2018-01-08',201802,1,2018,8,2,201801,2018),('2018-01-09',201802,1,2018,9,2,201801,2018),('2018-01-10',201802,1,2018,10,2,201801,2018),('2018-01-11',201802,1,2018,11,2,201801,2018),('2018-01-12',201802,1,2018,12,2,201801,2018),('2018-01-13',201802,1,2018,13,2,201801,2018),('2018-01-14',201803,1,2018,14,3,201801,2018),('2018-01-15',201803,1,2018,15,3,201801,2018),('2018-01-16',201803,1,2018,16,3,201801,2018),('2018-01-17',201803,1,2018,17,3,201801,2018),('2018-01-18',201803,1,2018,18,3,201801,2018),('2018-01-19',201803,1,2018,19,3,201801,2018),('2018-01-20',201803,1,2018,20,3,201801,2018),('2018-01-21',201804,1,2018,21,4,201801,2018),('2018-01-22',201804,1,2018,22,4,201801,2018),('2018-01-23',201804,1,2018,23,4,201801,2018),('2018-01-24',201804,1,2018,24,4,201801,2018),('2018-01-25',201804,1,2018,25,4,201801,2018),('2018-01-26',201804,1,2018,26,4,201801,2018),('2018-01-27',201804,1,2018,27,4,201801,2018),('2018-01-28',201805,1,2018,28,5,201801,2018),('2018-01-29',201805,1,2018,29,5,201801,2018),('2018-01-30',201805,1,2018,30,5,201801,2018),('2018-01-31',201805,1,2018,31,5,201801,2018),('2018-02-01',201805,2,2018,1,5,201802,2018),('2018-02-02',201805,2,2018,2,5,201802,2018),('2018-02-03',201805,2,2018,3,5,201802,2018),('2018-02-04',201806,2,2018,4,6,201802,2018),('2018-02-05',201806,2,2018,5,6,201802,2018),('2018-02-06',201806,2,2018,6,6,201802,2018),('2018-02-07',201806,2,2018,7,6,201802,2018),('2018-02-08',201806,2,2018,8,6,201802,2018),('2018-02-09',201806,2,2018,9,6,201802,2018),('2018-02-10',201806,2,2018,10,6,201802,2018),('2018-02-11',201807,2,2018,11,7,201802,2018),('2018-02-12',201807,2,2018,12,7,201802,2018),('2018-02-13',201807,2,2018,13,7,201802,2018),('2018-02-14',201807,2,2018,14,7,201802,2018),('2018-02-15',201807,2,2018,15,7,201802,2018),('2018-02-16',201807,2,2018,16,7,201802,2018),('2018-02-17',201807,2,2018,17,7,201802,2018),('2018-02-18',201808,2,2018,18,8,201802,2018),('2018-02-19',201808,2,2018,19,8,201802,2018),('2018-02-20',201808,2,2018,20,8,201802,2018),('2018-02-21',201808,2,2018,21,8,201802,2018),('2018-02-22',201808,2,2018,22,8,201802,2018),('2018-02-23',201808,2,2018,23,8,201802,2018),('2018-02-24',201808,2,2018,24,8,201802,2018),('2018-02-25',201809,2,2018,25,9,201802,2018),('2018-02-26',201809,2,2018,26,9,201802,2018),('2018-02-27',201809,2,2018,27,9,201802,2018),('2018-02-28',201809,2,2018,28,9,201802,2018),('2018-03-01',201809,3,2018,1,9,201803,2018),('2018-03-02',201809,3,2018,2,9,201803,2018),('2018-03-03',201809,3,2018,3,9,201803,2018),('2018-03-04',201810,3,2018,4,10,201803,2018),('2018-03-05',201810,3,2018,5,10,201803,2018),('2018-03-06',201810,3,2018,6,10,201803,2018),('2018-03-07',201810,3,2018,7,10,201803,2018),('2018-03-08',201810,3,2018,8,10,201803,2018),('2018-03-09',201810,3,2018,9,10,201803,2018),('2018-03-10',201810,3,2018,10,10,201803,2018),('2018-03-11',201811,3,2018,11,11,201803,2018),('2018-03-12',201811,3,2018,12,11,201803,2018),('2018-03-13',201811,3,2018,13,11,201803,2018),('2018-03-14',201811,3,2018,14,11,201803,2018),('2018-03-15',201811,3,2018,15,11,201803,2018),('2018-03-16',201811,3,2018,16,11,201803,2018),('2018-03-17',201811,3,2018,17,11,201803,2018),('2018-03-18',201812,3,2018,18,12,201803,2018),('2018-03-19',201812,3,2018,19,12,201803,2018),('2018-03-20',201812,3,2018,20,12,201803,2018),('2018-03-21',201812,3,2018,21,12,201803,2018),('2018-03-22',201812,3,2018,22,12,201803,2018),('2018-03-23',201812,3,2018,23,12,201803,2018),('2018-03-24',201812,3,2018,24,12,201803,2018),('2018-03-25',201813,3,2018,25,13,201803,2018),('2018-03-26',201813,3,2018,26,13,201803,2018),('2018-03-27',201813,3,2018,27,13,201803,2018),('2018-03-28',201813,3,2018,28,13,201803,2018),('2018-03-29',201813,3,2018,29,13,201803,2018),('2018-03-30',201813,3,2018,30,13,201803,2018),('2018-03-31',201813,3,2018,31,13,201803,2018),('2018-04-01',201814,4,2018,1,14,201804,2018),('2018-04-02',201814,4,2018,2,14,201804,2018),('2018-04-03',201814,4,2018,3,14,201804,2018),('2018-04-04',201814,4,2018,4,14,201804,2018),('2018-04-05',201814,4,2018,5,14,201804,2018),('2018-04-06',201814,4,2018,6,14,201804,2018),('2018-04-07',201814,4,2018,7,14,201804,2018),('2018-04-08',201815,4,2018,8,15,201804,2018),('2018-04-09',201815,4,2018,9,15,201804,2018),('2018-04-10',201815,4,2018,10,15,201804,2018),('2018-04-11',201815,4,2018,11,15,201804,2018),('2018-04-12',201815,4,2018,12,15,201804,2018),('2018-04-13',201815,4,2018,13,15,201804,2018),('2018-04-14',201815,4,2018,14,15,201804,2018),('2018-04-15',201816,4,2018,15,16,201804,2018),('2018-04-16',201816,4,2018,16,16,201804,2018),('2018-04-17',201816,4,2018,17,16,201804,2018),('2018-04-18',201816,4,2018,18,16,201804,2018),('2018-04-19',201816,4,2018,19,16,201804,2018),('2018-04-20',201816,4,2018,20,16,201804,2018),('2018-04-21',201816,4,2018,21,16,201804,2018),('2018-04-22',201817,4,2018,22,17,201804,2018),('2018-04-23',201817,4,2018,23,17,201804,2018),('2018-04-24',201817,4,2018,24,17,201804,2018),('2018-04-25',201817,4,2018,25,17,201804,2018),('2018-04-26',201817,4,2018,26,17,201804,2018),('2018-04-27',201817,4,2018,27,17,201804,2018),('2018-04-28',201817,4,2018,28,17,201804,2018),('2018-04-29',201818,4,2018,29,18,201804,2018),('2018-04-30',201818,4,2018,30,18,201804,2018),('2018-05-01',201818,5,2018,1,18,201805,2018),('2018-05-02',201818,5,2018,2,18,201805,2018),('2018-05-03',201818,5,2018,3,18,201805,2018),('2018-05-04',201818,5,2018,4,18,201805,2018),('2018-05-05',201818,5,2018,5,18,201805,2018),('2018-05-06',201819,5,2018,6,19,201805,2018),('2018-05-07',201819,5,2018,7,19,201805,2018),('2018-05-08',201819,5,2018,8,19,201805,2018),('2018-05-09',201819,5,2018,9,19,201805,2018),('2018-05-10',201819,5,2018,10,19,201805,2018),('2018-05-11',201819,5,2018,11,19,201805,2018),('2018-05-12',201819,5,2018,12,19,201805,2018),('2018-05-13',201820,5,2018,13,20,201805,2018),('2018-05-14',201820,5,2018,14,20,201805,2018),('2018-05-15',201820,5,2018,15,20,201805,2018),('2018-05-16',201820,5,2018,16,20,201805,2018),('2018-05-17',201820,5,2018,17,20,201805,2018),('2018-05-18',201820,5,2018,18,20,201805,2018),('2018-05-19',201820,5,2018,19,20,201805,2018),('2018-05-20',201821,5,2018,20,21,201805,2018),('2018-05-21',201821,5,2018,21,21,201805,2018),('2018-05-22',201821,5,2018,22,21,201805,2018),('2018-05-23',201821,5,2018,23,21,201805,2018),('2018-05-24',201821,5,2018,24,21,201805,2018),('2018-05-25',201821,5,2018,25,21,201805,2018),('2018-05-26',201821,5,2018,26,21,201805,2018),('2018-05-27',201822,5,2018,27,22,201805,2018),('2018-05-28',201822,5,2018,28,22,201805,2018),('2018-05-29',201822,5,2018,29,22,201805,2018),('2018-05-30',201822,5,2018,30,22,201805,2018),('2018-05-31',201822,5,2018,31,22,201805,2018),('2018-06-01',201822,6,2018,1,22,201806,2018),('2018-06-02',201822,6,2018,2,22,201806,2018),('2018-06-03',201823,6,2018,3,23,201806,2018),('2018-06-04',201823,6,2018,4,23,201806,2018),('2018-06-05',201823,6,2018,5,23,201806,2018),('2018-06-06',201823,6,2018,6,23,201806,2018),('2018-06-07',201823,6,2018,7,23,201806,2018),('2018-06-08',201823,6,2018,8,23,201806,2018),('2018-06-09',201823,6,2018,9,23,201806,2018),('2018-06-10',201824,6,2018,10,24,201806,2018),('2018-06-11',201824,6,2018,11,24,201806,2018),('2018-06-12',201824,6,2018,12,24,201806,2018),('2018-06-13',201824,6,2018,13,24,201806,2018),('2018-06-14',201824,6,2018,14,24,201806,2018),('2018-06-15',201824,6,2018,15,24,201806,2018),('2018-06-16',201824,6,2018,16,24,201806,2018),('2018-06-17',201825,6,2018,17,25,201806,2018),('2018-06-18',201825,6,2018,18,25,201806,2018),('2018-06-19',201825,6,2018,19,25,201806,2018),('2018-06-20',201825,6,2018,20,25,201806,2018),('2018-06-21',201825,6,2018,21,25,201806,2018),('2018-06-22',201825,6,2018,22,25,201806,2018),('2018-06-23',201825,6,2018,23,25,201806,2018),('2018-06-24',201826,6,2018,24,26,201806,2018),('2018-06-25',201826,6,2018,25,26,201806,2018),('2018-06-26',201826,6,2018,26,26,201806,2018),('2018-06-27',201826,6,2018,27,26,201806,2018),('2018-06-28',201826,6,2018,28,26,201806,2018),('2018-06-29',201826,6,2018,29,26,201806,2018),('2018-06-30',201826,6,2018,30,26,201806,2018),('2018-07-01',201827,7,2018,1,27,201807,2018),('2018-07-02',201827,7,2018,2,27,201807,2018),('2018-07-03',201827,7,2018,3,27,201807,2018),('2018-07-04',201827,7,2018,4,27,201807,2018),('2018-07-05',201827,7,2018,5,27,201807,2018),('2018-07-06',201827,7,2018,6,27,201807,2018),('2018-07-07',201827,7,2018,7,27,201807,2018),('2018-07-08',201828,7,2018,8,28,201807,2018),('2018-07-09',201828,7,2018,9,28,201807,2018),('2018-07-10',201828,7,2018,10,28,201807,2018),('2018-07-11',201828,7,2018,11,28,201807,2018),('2018-07-12',201828,7,2018,12,28,201807,2018),('2018-07-13',201828,7,2018,13,28,201807,2018),('2018-07-14',201828,7,2018,14,28,201807,2018),('2018-07-15',201829,7,2018,15,29,201807,2018),('2018-07-16',201829,7,2018,16,29,201807,2018),('2018-07-17',201829,7,2018,17,29,201807,2018),('2018-07-18',201829,7,2018,18,29,201807,2018),('2018-07-19',201829,7,2018,19,29,201807,2018),('2018-07-20',201829,7,2018,20,29,201807,2018),('2018-07-21',201829,7,2018,21,29,201807,2018),('2018-07-22',201830,7,2018,22,30,201807,2018),('2018-07-23',201830,7,2018,23,30,201807,2018),('2018-07-24',201830,7,2018,24,30,201807,2018),('2018-07-25',201830,7,2018,25,30,201807,2018),('2018-07-26',201830,7,2018,26,30,201807,2018),('2018-07-27',201830,7,2018,27,30,201807,2018),('2018-07-28',201830,7,2018,28,30,201807,2018),('2018-07-29',201831,7,2018,29,31,201807,2018),('2018-07-30',201831,7,2018,30,31,201807,2018),('2018-07-31',201831,7,2018,31,31,201807,2018),('2018-08-01',201831,8,2018,1,31,201808,2018),('2018-08-02',201831,8,2018,2,31,201808,2018),('2018-08-03',201831,8,2018,3,31,201808,2018),('2018-08-04',201831,8,2018,4,31,201808,2018),('2018-08-05',201832,8,2018,5,32,201808,2018),('2018-08-06',201832,8,2018,6,32,201808,2018),('2018-08-07',201832,8,2018,7,32,201808,2018),('2018-08-08',201832,8,2018,8,32,201808,2018),('2018-08-09',201832,8,2018,9,32,201808,2018),('2018-08-10',201832,8,2018,10,32,201808,2018),('2018-08-11',201832,8,2018,11,32,201808,2018),('2018-08-12',201833,8,2018,12,33,201808,2018),('2018-08-13',201833,8,2018,13,33,201808,2018),('2018-08-14',201833,8,2018,14,33,201808,2018),('2018-08-15',201833,8,2018,15,33,201808,2018),('2018-08-16',201833,8,2018,16,33,201808,2018),('2018-08-17',201833,8,2018,17,33,201808,2018),('2018-08-18',201833,8,2018,18,33,201808,2018),('2018-08-19',201834,8,2018,19,34,201808,2018),('2018-08-20',201834,8,2018,20,34,201808,2018),('2018-08-21',201834,8,2018,21,34,201808,2018),('2018-08-22',201834,8,2018,22,34,201808,2018),('2018-08-23',201834,8,2018,23,34,201808,2018),('2018-08-24',201834,8,2018,24,34,201808,2018),('2018-08-25',201834,8,2018,25,34,201808,2018),('2018-08-26',201835,8,2018,26,35,201808,2018),('2018-08-27',201835,8,2018,27,35,201808,2018),('2018-08-28',201835,8,2018,28,35,201808,2018),('2018-08-29',201835,8,2018,29,35,201808,2018),('2018-08-30',201835,8,2018,30,35,201808,2018),('2018-08-31',201835,8,2018,31,35,201808,2018),('2018-09-01',201835,9,2018,1,35,201809,2018),('2018-09-02',201836,9,2018,2,36,201809,2018),('2018-09-03',201836,9,2018,3,36,201809,2018),('2018-09-04',201836,9,2018,4,36,201809,2018),('2018-09-05',201836,9,2018,5,36,201809,2018),('2018-09-06',201836,9,2018,6,36,201809,2018),('2018-09-07',201836,9,2018,7,36,201809,2018),('2018-09-08',201836,9,2018,8,36,201809,2018),('2018-09-09',201837,9,2018,9,37,201809,2018),('2018-09-10',201837,9,2018,10,37,201809,2018),('2018-09-11',201837,9,2018,11,37,201809,2018),('2018-09-12',201837,9,2018,12,37,201809,2018),('2018-09-13',201837,9,2018,13,37,201809,2018),('2018-09-14',201837,9,2018,14,37,201809,2018),('2018-09-15',201837,9,2018,15,37,201809,2018),('2018-09-16',201838,9,2018,16,38,201809,2018),('2018-09-17',201838,9,2018,17,38,201809,2018),('2018-09-18',201838,9,2018,18,38,201809,2018),('2018-09-19',201838,9,2018,19,38,201809,2018),('2018-09-20',201838,9,2018,20,38,201809,2018),('2018-09-21',201838,9,2018,21,38,201809,2018),('2018-09-22',201838,9,2018,22,38,201809,2018),('2018-09-23',201839,9,2018,23,39,201809,2018),('2018-09-24',201839,9,2018,24,39,201809,2018),('2018-09-25',201839,9,2018,25,39,201809,2018),('2018-09-26',201839,9,2018,26,39,201809,2018),('2018-09-27',201839,9,2018,27,39,201809,2018),('2018-09-28',201839,9,2018,28,39,201809,2018),('2018-09-29',201839,9,2018,29,39,201809,2018),('2018-09-30',201840,9,2018,30,40,201809,2018),('2018-10-01',201840,10,2018,1,40,201810,2018),('2018-10-02',201840,10,2018,2,40,201810,2018),('2018-10-03',201840,10,2018,3,40,201810,2018),('2018-10-04',201840,10,2018,4,40,201810,2018),('2018-10-05',201840,10,2018,5,40,201810,2018),('2018-10-06',201840,10,2018,6,40,201810,2018),('2018-10-07',201841,10,2018,7,41,201810,2018),('2018-10-08',201841,10,2018,8,41,201810,2018),('2018-10-09',201841,10,2018,9,41,201810,2018),('2018-10-10',201841,10,2018,10,41,201810,2018),('2018-10-11',201841,10,2018,11,41,201810,2018),('2018-10-12',201841,10,2018,12,41,201810,2018),('2018-10-13',201841,10,2018,13,41,201810,2018),('2018-10-14',201842,10,2018,14,42,201810,2018),('2018-10-15',201842,10,2018,15,42,201810,2018),('2018-10-16',201842,10,2018,16,42,201810,2018),('2018-10-17',201842,10,2018,17,42,201810,2018),('2018-10-18',201842,10,2018,18,42,201810,2018),('2018-10-19',201842,10,2018,19,42,201810,2018),('2018-10-20',201842,10,2018,20,42,201810,2018),('2018-10-21',201843,10,2018,21,43,201810,2018),('2018-10-22',201843,10,2018,22,43,201810,2018),('2018-10-23',201843,10,2018,23,43,201810,2018),('2018-10-24',201843,10,2018,24,43,201810,2018),('2018-10-25',201843,10,2018,25,43,201810,2018),('2018-10-26',201843,10,2018,26,43,201810,2018),('2018-10-27',201843,10,2018,27,43,201810,2018),('2018-10-28',201844,10,2018,28,44,201810,2018),('2018-10-29',201844,10,2018,29,44,201810,2018),('2018-10-30',201844,10,2018,30,44,201810,2018),('2018-10-31',201844,10,2018,31,44,201810,2018),('2018-11-01',201844,11,2018,1,44,201811,2018),('2018-11-02',201844,11,2018,2,44,201811,2018),('2018-11-03',201844,11,2018,3,44,201811,2018),('2018-11-04',201845,11,2018,4,45,201811,2018),('2018-11-05',201845,11,2018,5,45,201811,2018),('2018-11-06',201845,11,2018,6,45,201811,2018),('2018-11-07',201845,11,2018,7,45,201811,2018),('2018-11-08',201845,11,2018,8,45,201811,2018),('2018-11-09',201845,11,2018,9,45,201811,2018),('2018-11-10',201845,11,2018,10,45,201811,2018),('2018-11-11',201846,11,2018,11,46,201811,2018),('2018-11-12',201846,11,2018,12,46,201811,2018),('2018-11-13',201846,11,2018,13,46,201811,2018),('2018-11-14',201846,11,2018,14,46,201811,2018),('2018-11-15',201846,11,2018,15,46,201811,2018),('2018-11-16',201846,11,2018,16,46,201811,2018),('2018-11-17',201846,11,2018,17,46,201811,2018),('2018-11-18',201847,11,2018,18,47,201811,2018),('2018-11-19',201847,11,2018,19,47,201811,2018),('2018-11-20',201847,11,2018,20,47,201811,2018),('2018-11-21',201847,11,2018,21,47,201811,2018),('2018-11-22',201847,11,2018,22,47,201811,2018),('2018-11-23',201847,11,2018,23,47,201811,2018),('2018-11-24',201847,11,2018,24,47,201811,2018),('2018-11-25',201848,11,2018,25,48,201811,2018),('2018-11-26',201848,11,2018,26,48,201811,2018),('2018-11-27',201848,11,2018,27,48,201811,2018),('2018-11-28',201848,11,2018,28,48,201811,2018),('2018-11-29',201848,11,2018,29,48,201811,2018),('2018-11-30',201848,11,2018,30,48,201811,2018),('2018-12-01',201848,12,2018,1,48,201812,2019),('2018-12-02',201849,12,2018,2,49,201812,2019),('2018-12-03',201849,12,2018,3,49,201812,2019),('2018-12-04',201849,12,2018,4,49,201812,2019),('2018-12-05',201849,12,2018,5,49,201812,2019),('2018-12-06',201849,12,2018,6,49,201812,2019),('2018-12-07',201849,12,2018,7,49,201812,2019),('2018-12-08',201849,12,2018,8,49,201812,2019),('2018-12-09',201850,12,2018,9,50,201812,2019),('2018-12-10',201850,12,2018,10,50,201812,2019),('2018-12-11',201850,12,2018,11,50,201812,2019),('2018-12-12',201850,12,2018,12,50,201812,2019),('2018-12-13',201850,12,2018,13,50,201812,2019),('2018-12-14',201850,12,2018,14,50,201812,2019),('2018-12-15',201850,12,2018,15,50,201812,2019),('2018-12-16',201851,12,2018,16,51,201812,2019),('2018-12-17',201851,12,2018,17,51,201812,2019),('2018-12-18',201851,12,2018,18,51,201812,2019),('2018-12-19',201851,12,2018,19,51,201812,2019),('2018-12-20',201851,12,2018,20,51,201812,2019),('2018-12-21',201851,12,2018,21,51,201812,2019),('2018-12-22',201851,12,2018,22,51,201812,2019),('2018-12-23',201852,12,2018,23,52,201812,2019),('2018-12-24',201852,12,2018,24,52,201812,2019),('2018-12-25',201852,12,2018,25,52,201812,2019),('2018-12-26',201852,12,2018,26,52,201812,2019),('2018-12-27',201852,12,2018,27,52,201812,2019),('2018-12-28',201852,12,2018,28,52,201812,2019),('2018-12-29',201852,12,2018,29,52,201812,2019),('2018-12-30',201901,12,2018,30,1,201812,2019),('2018-12-31',201901,12,2018,31,1,201812,2019),('2019-01-01',201901,1,2019,1,1,201901,2019),('2019-01-02',201901,1,2019,2,1,201901,2019),('2019-01-03',201901,1,2019,3,1,201901,2019),('2019-01-04',201901,1,2019,4,1,201901,2019),('2019-01-05',201901,1,2019,5,1,201901,2019),('2019-01-06',201902,1,2019,6,2,201901,2019),('2019-01-07',201902,1,2019,7,2,201901,2019),('2019-01-08',201902,1,2019,8,2,201901,2019),('2019-01-09',201902,1,2019,9,2,201901,2019),('2019-01-10',201902,1,2019,10,2,201901,2019),('2019-01-11',201902,1,2019,11,2,201901,2019),('2019-01-12',201902,1,2019,12,2,201901,2019),('2019-01-13',201903,1,2019,13,3,201901,2019),('2019-01-14',201903,1,2019,14,3,201901,2019),('2019-01-15',201903,1,2019,15,3,201901,2019),('2019-01-16',201903,1,2019,16,3,201901,2019),('2019-01-17',201903,1,2019,17,3,201901,2019),('2019-01-18',201903,1,2019,18,3,201901,2019),('2019-01-19',201903,1,2019,19,3,201901,2019),('2019-01-20',201904,1,2019,20,4,201901,2019),('2019-01-21',201904,1,2019,21,4,201901,2019),('2019-01-22',201904,1,2019,22,4,201901,2019),('2019-01-23',201904,1,2019,23,4,201901,2019),('2019-01-24',201904,1,2019,24,4,201901,2019),('2019-01-25',201904,1,2019,25,4,201901,2019),('2019-01-26',201904,1,2019,26,4,201901,2019),('2019-01-27',201905,1,2019,27,5,201901,2019),('2019-01-28',201905,1,2019,28,5,201901,2019),('2019-01-29',201905,1,2019,29,5,201901,2019),('2019-01-30',201905,1,2019,30,5,201901,2019),('2019-01-31',201905,1,2019,31,5,201901,2019),('2019-02-01',201905,2,2019,1,5,201902,2019),('2019-02-02',201905,2,2019,2,5,201902,2019),('2019-02-03',201906,2,2019,3,6,201902,2019),('2019-02-04',201906,2,2019,4,6,201902,2019),('2019-02-05',201906,2,2019,5,6,201902,2019),('2019-02-06',201906,2,2019,6,6,201902,2019),('2019-02-07',201906,2,2019,7,6,201902,2019),('2019-02-08',201906,2,2019,8,6,201902,2019),('2019-02-09',201906,2,2019,9,6,201902,2019),('2019-02-10',201907,2,2019,10,7,201902,2019),('2019-02-11',201907,2,2019,11,7,201902,2019),('2019-02-12',201907,2,2019,12,7,201902,2019),('2019-02-13',201907,2,2019,13,7,201902,2019),('2019-02-14',201907,2,2019,14,7,201902,2019),('2019-02-15',201907,2,2019,15,7,201902,2019),('2019-02-16',201907,2,2019,16,7,201902,2019),('2019-02-17',201908,2,2019,17,8,201902,2019),('2019-02-18',201908,2,2019,18,8,201902,2019),('2019-02-19',201908,2,2019,19,8,201902,2019),('2019-02-20',201908,2,2019,20,8,201902,2019),('2019-02-21',201908,2,2019,21,8,201902,2019),('2019-02-22',201908,2,2019,22,8,201902,2019),('2019-02-23',201908,2,2019,23,8,201902,2019),('2019-02-24',201909,2,2019,24,9,201902,2019),('2019-02-25',201909,2,2019,25,9,201902,2019),('2019-02-26',201909,2,2019,26,9,201902,2019),('2019-02-27',201909,2,2019,27,9,201902,2019),('2019-02-28',201909,2,2019,28,9,201902,2019),('2019-03-01',201909,3,2019,1,9,201903,2019),('2019-03-02',201909,3,2019,2,9,201903,2019),('2019-03-03',201910,3,2019,3,10,201903,2019),('2019-03-04',201910,3,2019,4,10,201903,2019),('2019-03-05',201910,3,2019,5,10,201903,2019),('2019-03-06',201910,3,2019,6,10,201903,2019),('2019-03-07',201910,3,2019,7,10,201903,2019),('2019-03-08',201910,3,2019,8,10,201903,2019),('2019-03-09',201910,3,2019,9,10,201903,2019),('2019-03-10',201911,3,2019,10,11,201903,2019),('2019-03-11',201911,3,2019,11,11,201903,2019),('2019-03-12',201911,3,2019,12,11,201903,2019),('2019-03-13',201911,3,2019,13,11,201903,2019),('2019-03-14',201911,3,2019,14,11,201903,2019),('2019-03-15',201911,3,2019,15,11,201903,2019),('2019-03-16',201911,3,2019,16,11,201903,2019),('2019-03-17',201912,3,2019,17,12,201903,2019),('2019-03-18',201912,3,2019,18,12,201903,2019),('2019-03-19',201912,3,2019,19,12,201903,2019),('2019-03-20',201912,3,2019,20,12,201903,2019),('2019-03-21',201912,3,2019,21,12,201903,2019),('2019-03-22',201912,3,2019,22,12,201903,2019),('2019-03-23',201912,3,2019,23,12,201903,2019),('2019-03-24',201913,3,2019,24,13,201903,2019),('2019-03-25',201913,3,2019,25,13,201903,2019),('2019-03-26',201913,3,2019,26,13,201903,2019),('2019-03-27',201913,3,2019,27,13,201903,2019),('2019-03-28',201913,3,2019,28,13,201903,2019),('2019-03-29',201913,3,2019,29,13,201903,2019),('2019-03-30',201913,3,2019,30,13,201903,2019),('2019-03-31',201914,3,2019,31,14,201903,2019),('2019-04-01',201914,4,2019,1,14,201904,2019),('2019-04-02',201914,4,2019,2,14,201904,2019),('2019-04-03',201914,4,2019,3,14,201904,2019),('2019-04-04',201914,4,2019,4,14,201904,2019),('2019-04-05',201914,4,2019,5,14,201904,2019),('2019-04-06',201914,4,2019,6,14,201904,2019),('2019-04-07',201915,4,2019,7,15,201904,2019),('2019-04-08',201915,4,2019,8,15,201904,2019),('2019-04-09',201915,4,2019,9,15,201904,2019),('2019-04-10',201915,4,2019,10,15,201904,2019),('2019-04-11',201915,4,2019,11,15,201904,2019),('2019-04-12',201915,4,2019,12,15,201904,2019),('2019-04-13',201915,4,2019,13,15,201904,2019),('2019-04-14',201916,4,2019,14,16,201904,2019),('2019-04-15',201916,4,2019,15,16,201904,2019),('2019-04-16',201916,4,2019,16,16,201904,2019),('2019-04-17',201916,4,2019,17,16,201904,2019),('2019-04-18',201916,4,2019,18,16,201904,2019),('2019-04-19',201916,4,2019,19,16,201904,2019),('2019-04-20',201916,4,2019,20,16,201904,2019),('2019-04-21',201917,4,2019,21,17,201904,2019),('2019-04-22',201917,4,2019,22,17,201904,2019),('2019-04-23',201917,4,2019,23,17,201904,2019),('2019-04-24',201917,4,2019,24,17,201904,2019),('2019-04-25',201917,4,2019,25,17,201904,2019),('2019-04-26',201917,4,2019,26,17,201904,2019),('2019-04-27',201917,4,2019,27,17,201904,2019),('2019-04-28',201918,4,2019,28,18,201904,2019),('2019-04-29',201918,4,2019,29,18,201904,2019),('2019-04-30',201918,4,2019,30,18,201904,2019),('2019-05-01',201918,5,2019,1,18,201905,2019),('2019-05-02',201918,5,2019,2,18,201905,2019),('2019-05-03',201918,5,2019,3,18,201905,2019),('2019-05-04',201918,5,2019,4,18,201905,2019),('2019-05-05',201919,5,2019,5,19,201905,2019),('2019-05-06',201919,5,2019,6,19,201905,2019),('2019-05-07',201919,5,2019,7,19,201905,2019),('2019-05-08',201919,5,2019,8,19,201905,2019),('2019-05-09',201919,5,2019,9,19,201905,2019),('2019-05-10',201919,5,2019,10,19,201905,2019),('2019-05-11',201919,5,2019,11,19,201905,2019),('2019-05-12',201920,5,2019,12,20,201905,2019),('2019-05-13',201920,5,2019,13,20,201905,2019),('2019-05-14',201920,5,2019,14,20,201905,2019),('2019-05-15',201920,5,2019,15,20,201905,2019),('2019-05-16',201920,5,2019,16,20,201905,2019),('2019-05-17',201920,5,2019,17,20,201905,2019),('2019-05-18',201920,5,2019,18,20,201905,2019),('2019-05-19',201921,5,2019,19,21,201905,2019),('2019-05-20',201921,5,2019,20,21,201905,2019),('2019-05-21',201921,5,2019,21,21,201905,2019),('2019-05-22',201921,5,2019,22,21,201905,2019),('2019-05-23',201921,5,2019,23,21,201905,2019),('2019-05-24',201921,5,2019,24,21,201905,2019),('2019-05-25',201921,5,2019,25,21,201905,2019),('2019-05-26',201922,5,2019,26,22,201905,2019),('2019-05-27',201922,5,2019,27,22,201905,2019),('2019-05-28',201922,5,2019,28,22,201905,2019),('2019-05-29',201922,5,2019,29,22,201905,2019),('2019-05-30',201922,5,2019,30,22,201905,2019),('2019-05-31',201922,5,2019,31,22,201905,2019),('2019-06-01',201922,6,2019,1,22,201906,2019),('2019-06-02',201923,6,2019,2,23,201906,2019),('2019-06-03',201923,6,2019,3,23,201906,2019),('2019-06-04',201923,6,2019,4,23,201906,2019),('2019-06-05',201923,6,2019,5,23,201906,2019),('2019-06-06',201923,6,2019,6,23,201906,2019),('2019-06-07',201923,6,2019,7,23,201906,2019),('2019-06-08',201923,6,2019,8,23,201906,2019),('2019-06-09',201924,6,2019,9,24,201906,2019),('2019-06-10',201924,6,2019,10,24,201906,2019),('2019-06-11',201924,6,2019,11,24,201906,2019),('2019-06-12',201924,6,2019,12,24,201906,2019),('2019-06-13',201924,6,2019,13,24,201906,2019),('2019-06-14',201924,6,2019,14,24,201906,2019),('2019-06-15',201924,6,2019,15,24,201906,2019),('2019-06-16',201925,6,2019,16,25,201906,2019),('2019-06-17',201925,6,2019,17,25,201906,2019),('2019-06-18',201925,6,2019,18,25,201906,2019),('2019-06-19',201925,6,2019,19,25,201906,2019),('2019-06-20',201925,6,2019,20,25,201906,2019),('2019-06-21',201925,6,2019,21,25,201906,2019),('2019-06-22',201925,6,2019,22,25,201906,2019),('2019-06-23',201926,6,2019,23,26,201906,2019),('2019-06-24',201926,6,2019,24,26,201906,2019),('2019-06-25',201926,6,2019,25,26,201906,2019),('2019-06-26',201926,6,2019,26,26,201906,2019),('2019-06-27',201926,6,2019,27,26,201906,2019),('2019-06-28',201926,6,2019,28,26,201906,2019),('2019-06-29',201926,6,2019,29,26,201906,2019),('2019-06-30',201927,6,2019,30,27,201906,2019),('2019-07-01',201927,7,2019,1,27,201907,2019),('2019-07-02',201927,7,2019,2,27,201907,2019),('2019-07-03',201927,7,2019,3,27,201907,2019),('2019-07-04',201927,7,2019,4,27,201907,2019),('2019-07-05',201927,7,2019,5,27,201907,2019),('2019-07-06',201927,7,2019,6,27,201907,2019),('2019-07-07',201928,7,2019,7,28,201907,2019),('2019-07-08',201928,7,2019,8,28,201907,2019),('2019-07-09',201928,7,2019,9,28,201907,2019),('2019-07-10',201928,7,2019,10,28,201907,2019),('2019-07-11',201928,7,2019,11,28,201907,2019),('2019-07-12',201928,7,2019,12,28,201907,2019),('2019-07-13',201928,7,2019,13,28,201907,2019),('2019-07-14',201929,7,2019,14,29,201907,2019),('2019-07-15',201929,7,2019,15,29,201907,2019),('2019-07-16',201929,7,2019,16,29,201907,2019),('2019-07-17',201929,7,2019,17,29,201907,2019),('2019-07-18',201929,7,2019,18,29,201907,2019),('2019-07-19',201929,7,2019,19,29,201907,2019),('2019-07-20',201929,7,2019,20,29,201907,2019),('2019-07-21',201930,7,2019,21,30,201907,2019),('2019-07-22',201930,7,2019,22,30,201907,2019),('2019-07-23',201930,7,2019,23,30,201907,2019),('2019-07-24',201930,7,2019,24,30,201907,2019),('2019-07-25',201930,7,2019,25,30,201907,2019),('2019-07-26',201930,7,2019,26,30,201907,2019),('2019-07-27',201930,7,2019,27,30,201907,2019),('2019-07-28',201931,7,2019,28,31,201907,2019),('2019-07-29',201931,7,2019,29,31,201907,2019),('2019-07-30',201931,7,2019,30,31,201907,2019),('2019-07-31',201931,7,2019,31,31,201907,2019),('2019-08-01',201931,8,2019,1,31,201908,2019),('2019-08-02',201931,8,2019,2,31,201908,2019),('2019-08-03',201931,8,2019,3,31,201908,2019),('2019-08-04',201932,8,2019,4,32,201908,2019),('2019-08-05',201932,8,2019,5,32,201908,2019),('2019-08-06',201932,8,2019,6,32,201908,2019),('2019-08-07',201932,8,2019,7,32,201908,2019),('2019-08-08',201932,8,2019,8,32,201908,2019),('2019-08-09',201932,8,2019,9,32,201908,2019),('2019-08-10',201932,8,2019,10,32,201908,2019),('2019-08-11',201933,8,2019,11,33,201908,2019),('2019-08-12',201933,8,2019,12,33,201908,2019),('2019-08-13',201933,8,2019,13,33,201908,2019),('2019-08-14',201933,8,2019,14,33,201908,2019),('2019-08-15',201933,8,2019,15,33,201908,2019),('2019-08-16',201933,8,2019,16,33,201908,2019),('2019-08-17',201933,8,2019,17,33,201908,2019),('2019-08-18',201934,8,2019,18,34,201908,2019),('2019-08-19',201934,8,2019,19,34,201908,2019),('2019-08-20',201934,8,2019,20,34,201908,2019),('2019-08-21',201934,8,2019,21,34,201908,2019),('2019-08-22',201934,8,2019,22,34,201908,2019),('2019-08-23',201934,8,2019,23,34,201908,2019),('2019-08-24',201934,8,2019,24,34,201908,2019),('2019-08-25',201935,8,2019,25,35,201908,2019),('2019-08-26',201935,8,2019,26,35,201908,2019),('2019-08-27',201935,8,2019,27,35,201908,2019),('2019-08-28',201935,8,2019,28,35,201908,2019),('2019-08-29',201935,8,2019,29,35,201908,2019),('2019-08-30',201935,8,2019,30,35,201908,2019),('2019-08-31',201935,8,2019,31,35,201908,2019),('2019-09-01',201936,9,2019,1,36,201909,2019),('2019-09-02',201936,9,2019,2,36,201909,2019),('2019-09-03',201936,9,2019,3,36,201909,2019),('2019-09-04',201936,9,2019,4,36,201909,2019),('2019-09-05',201936,9,2019,5,36,201909,2019),('2019-09-06',201936,9,2019,6,36,201909,2019),('2019-09-07',201936,9,2019,7,36,201909,2019),('2019-09-08',201937,9,2019,8,37,201909,2019),('2019-09-09',201937,9,2019,9,37,201909,2019),('2019-09-10',201937,9,2019,10,37,201909,2019),('2019-09-11',201937,9,2019,11,37,201909,2019),('2019-09-12',201937,9,2019,12,37,201909,2019),('2019-09-13',201937,9,2019,13,37,201909,2019),('2019-09-14',201937,9,2019,14,37,201909,2019),('2019-09-15',201938,9,2019,15,38,201909,2019),('2019-09-16',201938,9,2019,16,38,201909,2019),('2019-09-17',201938,9,2019,17,38,201909,2019),('2019-09-18',201938,9,2019,18,38,201909,2019),('2019-09-19',201938,9,2019,19,38,201909,2019),('2019-09-20',201938,9,2019,20,38,201909,2019),('2019-09-21',201938,9,2019,21,38,201909,2019),('2019-09-22',201939,9,2019,22,39,201909,2019),('2019-09-23',201939,9,2019,23,39,201909,2019),('2019-09-24',201939,9,2019,24,39,201909,2019),('2019-09-25',201939,9,2019,25,39,201909,2019),('2019-09-26',201939,9,2019,26,39,201909,2019),('2019-09-27',201939,9,2019,27,39,201909,2019),('2019-09-28',201939,9,2019,28,39,201909,2019),('2019-09-29',201940,9,2019,29,40,201909,2019),('2019-09-30',201940,9,2019,30,40,201909,2019),('2019-10-01',201940,10,2019,1,40,201910,2019),('2019-10-02',201940,10,2019,2,40,201910,2019),('2019-10-03',201940,10,2019,3,40,201910,2019),('2019-10-04',201940,10,2019,4,40,201910,2019),('2019-10-05',201940,10,2019,5,40,201910,2019),('2019-10-06',201941,10,2019,6,41,201910,2019),('2019-10-07',201941,10,2019,7,41,201910,2019),('2019-10-08',201941,10,2019,8,41,201910,2019),('2019-10-09',201941,10,2019,9,41,201910,2019),('2019-10-10',201941,10,2019,10,41,201910,2019),('2019-10-11',201941,10,2019,11,41,201910,2019),('2019-10-12',201941,10,2019,12,41,201910,2019),('2019-10-13',201942,10,2019,13,42,201910,2019),('2019-10-14',201942,10,2019,14,42,201910,2019),('2019-10-15',201942,10,2019,15,42,201910,2019),('2019-10-16',201942,10,2019,16,42,201910,2019),('2019-10-17',201942,10,2019,17,42,201910,2019),('2019-10-18',201942,10,2019,18,42,201910,2019),('2019-10-19',201942,10,2019,19,42,201910,2019),('2019-10-20',201943,10,2019,20,43,201910,2019),('2019-10-21',201943,10,2019,21,43,201910,2019),('2019-10-22',201943,10,2019,22,43,201910,2019),('2019-10-23',201943,10,2019,23,43,201910,2019),('2019-10-24',201943,10,2019,24,43,201910,2019),('2019-10-25',201943,10,2019,25,43,201910,2019),('2019-10-26',201943,10,2019,26,43,201910,2019),('2019-10-27',201944,10,2019,27,44,201910,2019),('2019-10-28',201944,10,2019,28,44,201910,2019),('2019-10-29',201944,10,2019,29,44,201910,2019),('2019-10-30',201944,10,2019,30,44,201910,2019),('2019-10-31',201944,10,2019,31,44,201910,2019),('2019-11-01',201944,11,2019,1,44,201911,2019),('2019-11-02',201944,11,2019,2,44,201911,2019),('2019-11-03',201945,11,2019,3,45,201911,2019),('2019-11-04',201945,11,2019,4,45,201911,2019),('2019-11-05',201945,11,2019,5,45,201911,2019),('2019-11-06',201945,11,2019,6,45,201911,2019),('2019-11-07',201945,11,2019,7,45,201911,2019),('2019-11-08',201945,11,2019,8,45,201911,2019),('2019-11-09',201945,11,2019,9,45,201911,2019),('2019-11-10',201946,11,2019,10,46,201911,2019),('2019-11-11',201946,11,2019,11,46,201911,2019),('2019-11-12',201946,11,2019,12,46,201911,2019),('2019-11-13',201946,11,2019,13,46,201911,2019),('2019-11-14',201946,11,2019,14,46,201911,2019),('2019-11-15',201946,11,2019,15,46,201911,2019),('2019-11-16',201946,11,2019,16,46,201911,2019),('2019-11-17',201947,11,2019,17,47,201911,2019),('2019-11-18',201947,11,2019,18,47,201911,2019),('2019-11-19',201947,11,2019,19,47,201911,2019),('2019-11-20',201947,11,2019,20,47,201911,2019),('2019-11-21',201947,11,2019,21,47,201911,2019),('2019-11-22',201947,11,2019,22,47,201911,2019),('2019-11-23',201947,11,2019,23,47,201911,2019),('2019-11-24',201948,11,2019,24,48,201911,2019),('2019-11-25',201948,11,2019,25,48,201911,2019),('2019-11-26',201948,11,2019,26,48,201911,2019),('2019-11-27',201948,11,2019,27,48,201911,2019),('2019-11-28',201948,11,2019,28,48,201911,2019),('2019-11-29',201948,11,2019,29,48,201911,2019),('2019-11-30',201948,11,2019,30,48,201911,2019),('2019-12-01',201949,12,2019,1,49,201912,2020),('2019-12-02',201949,12,2019,2,49,201912,2020),('2019-12-03',201949,12,2019,3,49,201912,2020),('2019-12-04',201949,12,2019,4,49,201912,2020),('2019-12-05',201949,12,2019,5,49,201912,2020),('2019-12-06',201949,12,2019,6,49,201912,2020),('2019-12-07',201949,12,2019,7,49,201912,2020),('2019-12-08',201950,12,2019,8,50,201912,2020),('2019-12-09',201950,12,2019,9,50,201912,2020),('2019-12-10',201950,12,2019,10,50,201912,2020),('2019-12-11',201950,12,2019,11,50,201912,2020),('2019-12-12',201950,12,2019,12,50,201912,2020),('2019-12-13',201950,12,2019,13,50,201912,2020),('2019-12-14',201950,12,2019,14,50,201912,2020),('2019-12-15',201951,12,2019,15,51,201912,2020),('2019-12-16',201951,12,2019,16,51,201912,2020),('2019-12-17',201951,12,2019,17,51,201912,2020),('2019-12-18',201951,12,2019,18,51,201912,2020),('2019-12-19',201951,12,2019,19,51,201912,2020),('2019-12-20',201951,12,2019,20,51,201912,2020),('2019-12-21',201951,12,2019,21,51,201912,2020),('2019-12-22',201952,12,2019,22,52,201912,2020),('2019-12-23',201952,12,2019,23,52,201912,2020),('2019-12-24',201952,12,2019,24,52,201912,2020),('2019-12-25',201952,12,2019,25,52,201912,2020),('2019-12-26',201952,12,2019,26,52,201912,2020),('2019-12-27',201952,12,2019,27,52,201912,2020),('2019-12-28',201952,12,2019,28,52,201912,2020),('2019-12-29',201953,12,2019,29,1,201912,2020),('2019-12-30',201953,12,2019,30,1,201912,2020),('2019-12-31',201953,12,2019,31,1,201912,2020),('2020-01-01',201953,1,2020,1,1,202001,2020),('2020-01-02',201953,1,2020,2,1,202001,2020),('2020-01-03',201953,1,2020,3,1,202001,2020),('2020-01-04',201953,1,2020,4,1,202001,2020),('2020-01-05',202001,1,2020,5,2,202001,2020),('2020-01-06',202001,1,2020,6,2,202001,2020),('2020-01-07',202001,1,2020,7,2,202001,2020),('2020-01-08',202001,1,2020,8,2,202001,2020),('2020-01-09',202001,1,2020,9,2,202001,2020),('2020-01-10',202001,1,2020,10,2,202001,2020),('2020-01-11',202001,1,2020,11,2,202001,2020),('2020-01-12',202002,1,2020,12,3,202001,2020),('2020-01-13',202002,1,2020,13,3,202001,2020),('2020-01-14',202002,1,2020,14,3,202001,2020),('2020-01-15',202002,1,2020,15,3,202001,2020),('2020-01-16',202002,1,2020,16,3,202001,2020),('2020-01-17',202002,1,2020,17,3,202001,2020),('2020-01-18',202002,1,2020,18,3,202001,2020),('2020-01-19',202003,1,2020,19,4,202001,2020),('2020-01-20',202003,1,2020,20,4,202001,2020),('2020-01-21',202003,1,2020,21,4,202001,2020),('2020-01-22',202003,1,2020,22,4,202001,2020),('2020-01-23',202003,1,2020,23,4,202001,2020),('2020-01-24',202003,1,2020,24,4,202001,2020),('2020-01-25',202003,1,2020,25,4,202001,2020),('2020-01-26',202004,1,2020,26,5,202001,2020),('2020-01-27',202004,1,2020,27,5,202001,2020),('2020-01-28',202004,1,2020,28,5,202001,2020),('2020-01-29',202004,1,2020,29,5,202001,2020),('2020-01-30',202004,1,2020,30,5,202001,2020),('2020-01-31',202004,1,2020,31,5,202001,2020),('2020-02-01',202004,2,2020,1,5,202002,2020),('2020-02-02',202005,2,2020,2,6,202002,2020),('2020-02-03',202005,2,2020,3,6,202002,2020),('2020-02-04',202005,2,2020,4,6,202002,2020),('2020-02-05',202005,2,2020,5,6,202002,2020),('2020-02-06',202005,2,2020,6,6,202002,2020),('2020-02-07',202005,2,2020,7,6,202002,2020),('2020-02-08',202005,2,2020,8,6,202002,2020),('2020-02-09',202006,2,2020,9,7,202002,2020),('2020-02-10',202006,2,2020,10,7,202002,2020),('2020-02-11',202006,2,2020,11,7,202002,2020),('2020-02-12',202006,2,2020,12,7,202002,2020),('2020-02-13',202006,2,2020,13,7,202002,2020),('2020-02-14',202006,2,2020,14,7,202002,2020),('2020-02-15',202006,2,2020,15,7,202002,2020),('2020-02-16',202007,2,2020,16,8,202002,2020),('2020-02-17',202007,2,2020,17,8,202002,2020),('2020-02-18',202007,2,2020,18,8,202002,2020),('2020-02-19',202007,2,2020,19,8,202002,2020),('2020-02-20',202007,2,2020,20,8,202002,2020),('2020-02-21',202007,2,2020,21,8,202002,2020),('2020-02-22',202007,2,2020,22,8,202002,2020),('2020-02-23',202008,2,2020,23,9,202002,2020),('2020-02-24',202008,2,2020,24,9,202002,2020),('2020-02-25',202008,2,2020,25,9,202002,2020),('2020-02-26',202008,2,2020,26,9,202002,2020),('2020-02-27',202008,2,2020,27,9,202002,2020),('2020-02-28',202008,2,2020,28,9,202002,2020),('2020-02-29',202008,2,2020,29,9,202002,2020),('2020-03-01',202009,3,2020,1,10,202003,2020),('2020-03-02',202009,3,2020,2,10,202003,2020),('2020-03-03',202009,3,2020,3,10,202003,2020),('2020-03-04',202009,3,2020,4,10,202003,2020),('2020-03-05',202009,3,2020,5,10,202003,2020),('2020-03-06',202009,3,2020,6,10,202003,2020),('2020-03-07',202009,3,2020,7,10,202003,2020),('2020-03-08',202010,3,2020,8,11,202003,2020),('2020-03-09',202010,3,2020,9,11,202003,2020),('2020-03-10',202010,3,2020,10,11,202003,2020),('2020-03-11',202010,3,2020,11,11,202003,2020),('2020-03-12',202010,3,2020,12,11,202003,2020),('2020-03-13',202010,3,2020,13,11,202003,2020),('2020-03-14',202010,3,2020,14,11,202003,2020),('2020-03-15',202011,3,2020,15,12,202003,2020),('2020-03-16',202011,3,2020,16,12,202003,2020),('2020-03-17',202011,3,2020,17,12,202003,2020),('2020-03-18',202011,3,2020,18,12,202003,2020),('2020-03-19',202011,3,2020,19,12,202003,2020),('2020-03-20',202011,3,2020,20,12,202003,2020),('2020-03-21',202011,3,2020,21,12,202003,2020),('2020-03-22',202012,3,2020,22,13,202003,2020),('2020-03-23',202012,3,2020,23,13,202003,2020),('2020-03-24',202012,3,2020,24,13,202003,2020),('2020-03-25',202012,3,2020,25,13,202003,2020),('2020-03-26',202012,3,2020,26,13,202003,2020),('2020-03-27',202012,3,2020,27,13,202003,2020),('2020-03-28',202012,3,2020,28,13,202003,2020),('2020-03-29',202013,3,2020,29,14,202003,2020),('2020-03-30',202013,3,2020,30,14,202003,2020),('2020-03-31',202013,3,2020,31,14,202003,2020),('2020-04-01',202013,4,2020,1,14,202004,2020),('2020-04-02',202013,4,2020,2,14,202004,2020),('2020-04-03',202013,4,2020,3,14,202004,2020),('2020-04-04',202013,4,2020,4,14,202004,2020),('2020-04-05',202014,4,2020,5,15,202004,2020),('2020-04-06',202014,4,2020,6,15,202004,2020),('2020-04-07',202014,4,2020,7,15,202004,2020),('2020-04-08',202014,4,2020,8,15,202004,2020),('2020-04-09',202014,4,2020,9,15,202004,2020),('2020-04-10',202014,4,2020,10,15,202004,2020),('2020-04-11',202014,4,2020,11,15,202004,2020),('2020-04-12',202015,4,2020,12,16,202004,2020),('2020-04-13',202015,4,2020,13,16,202004,2020),('2020-04-14',202015,4,2020,14,16,202004,2020),('2020-04-15',202015,4,2020,15,16,202004,2020),('2020-04-16',202015,4,2020,16,16,202004,2020),('2020-04-17',202015,4,2020,17,16,202004,2020),('2020-04-18',202015,4,2020,18,16,202004,2020),('2020-04-19',202016,4,2020,19,17,202004,2020),('2020-04-20',202016,4,2020,20,17,202004,2020),('2020-04-21',202016,4,2020,21,17,202004,2020),('2020-04-22',202016,4,2020,22,17,202004,2020),('2020-04-23',202016,4,2020,23,17,202004,2020),('2020-04-24',202016,4,2020,24,17,202004,2020),('2020-04-25',202016,4,2020,25,17,202004,2020),('2020-04-26',202017,4,2020,26,18,202004,2020),('2020-04-27',202017,4,2020,27,18,202004,2020),('2020-04-28',202017,4,2020,28,18,202004,2020),('2020-04-29',202017,4,2020,29,18,202004,2020),('2020-04-30',202017,4,2020,30,18,202004,2020),('2020-05-01',202017,5,2020,1,18,202005,2020),('2020-05-02',202017,5,2020,2,18,202005,2020),('2020-05-03',202018,5,2020,3,19,202005,2020),('2020-05-04',202018,5,2020,4,19,202005,2020),('2020-05-05',202018,5,2020,5,19,202005,2020),('2020-05-06',202018,5,2020,6,19,202005,2020),('2020-05-07',202018,5,2020,7,19,202005,2020),('2020-05-08',202018,5,2020,8,19,202005,2020),('2020-05-09',202018,5,2020,9,19,202005,2020),('2020-05-10',202019,5,2020,10,20,202005,2020),('2020-05-11',202019,5,2020,11,20,202005,2020),('2020-05-12',202019,5,2020,12,20,202005,2020),('2020-05-13',202019,5,2020,13,20,202005,2020),('2020-05-14',202019,5,2020,14,20,202005,2020),('2020-05-15',202019,5,2020,15,20,202005,2020),('2020-05-16',202019,5,2020,16,20,202005,2020),('2020-05-17',202020,5,2020,17,21,202005,2020),('2020-05-18',202020,5,2020,18,21,202005,2020),('2020-05-19',202020,5,2020,19,21,202005,2020),('2020-05-20',202020,5,2020,20,21,202005,2020),('2020-05-21',202020,5,2020,21,21,202005,2020),('2020-05-22',202020,5,2020,22,21,202005,2020),('2020-05-23',202020,5,2020,23,21,202005,2020),('2020-05-24',202021,5,2020,24,22,202005,2020),('2020-05-25',202021,5,2020,25,22,202005,2020),('2020-05-26',202021,5,2020,26,22,202005,2020),('2020-05-27',202021,5,2020,27,22,202005,2020),('2020-05-28',202021,5,2020,28,22,202005,2020),('2020-05-29',202021,5,2020,29,22,202005,2020),('2020-05-30',202021,5,2020,30,22,202005,2020),('2020-05-31',202022,5,2020,31,23,202005,2020),('2020-06-01',202022,6,2020,1,23,202006,2020),('2020-06-02',202022,6,2020,2,23,202006,2020),('2020-06-03',202022,6,2020,3,23,202006,2020),('2020-06-04',202022,6,2020,4,23,202006,2020),('2020-06-05',202022,6,2020,5,23,202006,2020),('2020-06-06',202022,6,2020,6,23,202006,2020),('2020-06-07',202023,6,2020,7,24,202006,2020),('2020-06-08',202023,6,2020,8,24,202006,2020),('2020-06-09',202023,6,2020,9,24,202006,2020),('2020-06-10',202023,6,2020,10,24,202006,2020),('2020-06-11',202023,6,2020,11,24,202006,2020),('2020-06-12',202023,6,2020,12,24,202006,2020),('2020-06-13',202023,6,2020,13,24,202006,2020),('2020-06-14',202024,6,2020,14,25,202006,2020),('2020-06-15',202024,6,2020,15,25,202006,2020),('2020-06-16',202024,6,2020,16,25,202006,2020),('2020-06-17',202024,6,2020,17,25,202006,2020),('2020-06-18',202024,6,2020,18,25,202006,2020),('2020-06-19',202024,6,2020,19,25,202006,2020),('2020-06-20',202024,6,2020,20,25,202006,2020),('2020-06-21',202025,6,2020,21,26,202006,2020),('2020-06-22',202025,6,2020,22,26,202006,2020),('2020-06-23',202025,6,2020,23,26,202006,2020),('2020-06-24',202025,6,2020,24,26,202006,2020),('2020-06-25',202025,6,2020,25,26,202006,2020),('2020-06-26',202025,6,2020,26,26,202006,2020),('2020-06-27',202025,6,2020,27,26,202006,2020),('2020-06-28',202026,6,2020,28,27,202006,2020),('2020-06-29',202026,6,2020,29,27,202006,2020),('2020-06-30',202026,6,2020,30,27,202006,2020),('2020-07-01',202026,7,2020,1,27,202007,2020),('2020-07-02',202026,7,2020,2,27,202007,2020),('2020-07-03',202026,7,2020,3,27,202007,2020),('2020-07-04',202026,7,2020,4,27,202007,2020),('2020-07-05',202027,7,2020,5,28,202007,2020),('2020-07-06',202027,7,2020,6,28,202007,2020),('2020-07-07',202027,7,2020,7,28,202007,2020),('2020-07-08',202027,7,2020,8,28,202007,2020),('2020-07-09',202027,7,2020,9,28,202007,2020),('2020-07-10',202027,7,2020,10,28,202007,2020),('2020-07-11',202027,7,2020,11,28,202007,2020),('2020-07-12',202028,7,2020,12,29,202007,2020),('2020-07-13',202028,7,2020,13,29,202007,2020),('2020-07-14',202028,7,2020,14,29,202007,2020),('2020-07-15',202028,7,2020,15,29,202007,2020),('2020-07-16',202028,7,2020,16,29,202007,2020),('2020-07-17',202028,7,2020,17,29,202007,2020),('2020-07-18',202028,7,2020,18,29,202007,2020),('2020-07-19',202029,7,2020,19,30,202007,2020),('2020-07-20',202029,7,2020,20,30,202007,2020),('2020-07-21',202029,7,2020,21,30,202007,2020),('2020-07-22',202029,7,2020,22,30,202007,2020),('2020-07-23',202029,7,2020,23,30,202007,2020),('2020-07-24',202029,7,2020,24,30,202007,2020),('2020-07-25',202029,7,2020,25,30,202007,2020),('2020-07-26',202030,7,2020,26,31,202007,2020),('2020-07-27',202030,7,2020,27,31,202007,2020),('2020-07-28',202030,7,2020,28,31,202007,2020),('2020-07-29',202030,7,2020,29,31,202007,2020),('2020-07-30',202030,7,2020,30,31,202007,2020),('2020-07-31',202030,7,2020,31,31,202007,2020),('2020-08-01',202030,8,2020,1,31,202008,2020),('2020-08-02',202031,8,2020,2,32,202008,2020),('2020-08-03',202031,8,2020,3,32,202008,2020),('2020-08-04',202031,8,2020,4,32,202008,2020),('2020-08-05',202031,8,2020,5,32,202008,2020),('2020-08-06',202031,8,2020,6,32,202008,2020),('2020-08-07',202031,8,2020,7,32,202008,2020),('2020-08-08',202031,8,2020,8,32,202008,2020),('2020-08-09',202032,8,2020,9,33,202008,2020),('2020-08-10',202032,8,2020,10,33,202008,2020),('2020-08-11',202032,8,2020,11,33,202008,2020),('2020-08-12',202032,8,2020,12,33,202008,2020),('2020-08-13',202032,8,2020,13,33,202008,2020),('2020-08-14',202032,8,2020,14,33,202008,2020),('2020-08-15',202032,8,2020,15,33,202008,2020),('2020-08-16',202033,8,2020,16,34,202008,2020),('2020-08-17',202033,8,2020,17,34,202008,2020),('2020-08-18',202033,8,2020,18,34,202008,2020),('2020-08-19',202033,8,2020,19,34,202008,2020),('2020-08-20',202033,8,2020,20,34,202008,2020),('2020-08-21',202033,8,2020,21,34,202008,2020),('2020-08-22',202033,8,2020,22,34,202008,2020),('2020-08-23',202034,8,2020,23,35,202008,2020),('2020-08-24',202034,8,2020,24,35,202008,2020),('2020-08-25',202034,8,2020,25,35,202008,2020),('2020-08-26',202034,8,2020,26,35,202008,2020),('2020-08-27',202034,8,2020,27,35,202008,2020),('2020-08-28',202034,8,2020,28,35,202008,2020),('2020-08-29',202034,8,2020,29,35,202008,2020),('2020-08-30',202035,8,2020,30,36,202008,2020),('2020-08-31',202035,8,2020,31,36,202008,2020),('2020-09-01',202035,9,2020,1,36,202009,2020),('2020-09-02',202035,9,2020,2,36,202009,2020),('2020-09-03',202035,9,2020,3,36,202009,2020),('2020-09-04',202035,9,2020,4,36,202009,2020),('2020-09-05',202035,9,2020,5,36,202009,2020),('2020-09-06',202036,9,2020,6,37,202009,2020),('2020-09-07',202036,9,2020,7,37,202009,2020),('2020-09-08',202036,9,2020,8,37,202009,2020),('2020-09-09',202036,9,2020,9,37,202009,2020),('2020-09-10',202036,9,2020,10,37,202009,2020),('2020-09-11',202036,9,2020,11,37,202009,2020),('2020-09-12',202036,9,2020,12,37,202009,2020),('2020-09-13',202037,9,2020,13,38,202009,2020),('2020-09-14',202037,9,2020,14,38,202009,2020),('2020-09-15',202037,9,2020,15,38,202009,2020),('2020-09-16',202037,9,2020,16,38,202009,2020),('2020-09-17',202037,9,2020,17,38,202009,2020),('2020-09-18',202037,9,2020,18,38,202009,2020),('2020-09-19',202037,9,2020,19,38,202009,2020),('2020-09-20',202038,9,2020,20,39,202009,2020),('2020-09-21',202038,9,2020,21,39,202009,2020),('2020-09-22',202038,9,2020,22,39,202009,2020),('2020-09-23',202038,9,2020,23,39,202009,2020),('2020-09-24',202038,9,2020,24,39,202009,2020),('2020-09-25',202038,9,2020,25,39,202009,2020),('2020-09-26',202038,9,2020,26,39,202009,2020),('2020-09-27',202039,9,2020,27,40,202009,2020),('2020-09-28',202039,9,2020,28,40,202009,2020),('2020-09-29',202039,9,2020,29,40,202009,2020),('2020-09-30',202039,9,2020,30,40,202009,2020),('2020-10-01',202039,10,2020,1,40,202010,2020),('2020-10-02',202039,10,2020,2,40,202010,2020),('2020-10-03',202039,10,2020,3,40,202010,2020),('2020-10-04',202040,10,2020,4,41,202010,2020),('2020-10-05',202040,10,2020,5,41,202010,2020),('2020-10-06',202040,10,2020,6,41,202010,2020),('2020-10-07',202040,10,2020,7,41,202010,2020),('2020-10-08',202040,10,2020,8,41,202010,2020),('2020-10-09',202040,10,2020,9,41,202010,2020),('2020-10-10',202040,10,2020,10,41,202010,2020),('2020-10-11',202041,10,2020,11,42,202010,2020),('2020-10-12',202041,10,2020,12,42,202010,2020),('2020-10-13',202041,10,2020,13,42,202010,2020),('2020-10-14',202041,10,2020,14,42,202010,2020),('2020-10-15',202041,10,2020,15,42,202010,2020),('2020-10-16',202041,10,2020,16,42,202010,2020),('2020-10-17',202041,10,2020,17,42,202010,2020),('2020-10-18',202042,10,2020,18,43,202010,2020),('2020-10-19',202042,10,2020,19,43,202010,2020),('2020-10-20',202042,10,2020,20,43,202010,2020),('2020-10-21',202042,10,2020,21,43,202010,2020),('2020-10-22',202042,10,2020,22,43,202010,2020),('2020-10-23',202042,10,2020,23,43,202010,2020),('2020-10-24',202042,10,2020,24,43,202010,2020),('2020-10-25',202043,10,2020,25,44,202010,2020),('2020-10-26',202043,10,2020,26,44,202010,2020),('2020-10-27',202043,10,2020,27,44,202010,2020),('2020-10-28',202043,10,2020,28,44,202010,2020),('2020-10-29',202043,10,2020,29,44,202010,2020),('2020-10-30',202043,10,2020,30,44,202010,2020),('2020-10-31',202043,10,2020,31,44,202010,2020),('2020-11-01',202044,11,2020,1,45,202011,2020),('2020-11-02',202044,11,2020,2,45,202011,2020),('2020-11-03',202044,11,2020,3,45,202011,2020),('2020-11-04',202044,11,2020,4,45,202011,2020),('2020-11-05',202044,11,2020,5,45,202011,2020),('2020-11-06',202044,11,2020,6,45,202011,2020),('2020-11-07',202044,11,2020,7,45,202011,2020),('2020-11-08',202045,11,2020,8,46,202011,2020),('2020-11-09',202045,11,2020,9,46,202011,2020),('2020-11-10',202045,11,2020,10,46,202011,2020),('2020-11-11',202045,11,2020,11,46,202011,2020),('2020-11-12',202045,11,2020,12,46,202011,2020),('2020-11-13',202045,11,2020,13,46,202011,2020),('2020-11-14',202045,11,2020,14,46,202011,2020),('2020-11-15',202046,11,2020,15,47,202011,2020),('2020-11-16',202046,11,2020,16,47,202011,2020),('2020-11-17',202046,11,2020,17,47,202011,2020),('2020-11-18',202046,11,2020,18,47,202011,2020),('2020-11-19',202046,11,2020,19,47,202011,2020),('2020-11-20',202046,11,2020,20,47,202011,2020),('2020-11-21',202046,11,2020,21,47,202011,2020),('2020-11-22',202047,11,2020,22,48,202011,2020),('2020-11-23',202047,11,2020,23,48,202011,2020),('2020-11-24',202047,11,2020,24,48,202011,2020),('2020-11-25',202047,11,2020,25,48,202011,2020),('2020-11-26',202047,11,2020,26,48,202011,2020),('2020-11-27',202047,11,2020,27,48,202011,2020),('2020-11-28',202047,11,2020,28,48,202011,2020),('2020-11-29',202048,11,2020,29,49,202011,2020),('2020-11-30',202048,11,2020,30,49,202011,2020),('2020-12-01',202048,12,2020,1,49,202012,2021),('2020-12-02',202048,12,2020,2,49,202012,2021),('2020-12-03',202048,12,2020,3,49,202012,2021),('2020-12-04',202048,12,2020,4,49,202012,2021),('2020-12-05',202048,12,2020,5,49,202012,2021),('2020-12-06',202049,12,2020,6,50,202012,2021),('2020-12-07',202049,12,2020,7,50,202012,2021),('2020-12-08',202049,12,2020,8,50,202012,2021),('2020-12-09',202049,12,2020,9,50,202012,2021),('2020-12-10',202049,12,2020,10,50,202012,2021),('2020-12-11',202049,12,2020,11,50,202012,2021),('2020-12-12',202049,12,2020,12,50,202012,2021),('2020-12-13',202050,12,2020,13,51,202012,2021),('2020-12-14',202050,12,2020,14,51,202012,2021),('2020-12-15',202050,12,2020,15,51,202012,2021),('2020-12-16',202050,12,2020,16,51,202012,2021),('2020-12-17',202050,12,2020,17,51,202012,2021),('2020-12-18',202050,12,2020,18,51,202012,2021),('2020-12-19',202050,12,2020,19,51,202012,2021),('2020-12-20',202051,12,2020,20,52,202012,2021),('2020-12-21',202051,12,2020,21,52,202012,2021),('2020-12-22',202051,12,2020,22,52,202012,2021),('2020-12-23',202051,12,2020,23,52,202012,2021),('2020-12-24',202051,12,2020,24,52,202012,2021),('2020-12-25',202051,12,2020,25,52,202012,2021),('2020-12-26',202051,12,2020,26,52,202012,2021),('2020-12-27',202052,12,2020,27,53,202012,2021),('2020-12-28',202052,12,2020,28,53,202012,2021),('2020-12-29',202052,12,2020,29,53,202012,2021),('2020-12-30',202052,12,2020,30,53,202012,2021),('2020-12-31',202052,12,2020,31,53,202012,2021),('2021-01-01',202101,1,2021,1,1,202101,2021),('2021-01-02',202101,1,2021,2,1,202101,2021),('2021-01-03',202101,1,2021,3,1,202101,2021),('2021-01-04',202101,1,2021,4,1,202101,2021),('2021-01-05',202101,1,2021,5,1,202101,2021),('2021-01-06',202101,1,2021,6,1,202101,2021),('2021-01-07',202101,1,2021,7,1,202101,2021),('2021-01-08',202101,1,2021,8,1,202101,2021),('2021-01-09',202101,1,2021,9,1,202101,2021),('2021-01-10',202102,1,2021,10,2,202101,2021),('2021-01-11',202102,1,2021,11,2,202101,2021),('2021-01-12',202102,1,2021,12,2,202101,2021),('2021-01-13',202102,1,2021,13,2,202101,2021),('2021-01-14',202102,1,2021,14,2,202101,2021),('2021-01-15',202102,1,2021,15,2,202101,2021),('2021-01-16',202102,1,2021,16,2,202101,2021),('2021-01-17',202103,1,2021,17,3,202101,2021),('2021-01-18',202103,1,2021,18,3,202101,2021),('2021-01-19',202103,1,2021,19,3,202101,2021),('2021-01-20',202103,1,2021,20,3,202101,2021),('2021-01-21',202103,1,2021,21,3,202101,2021),('2021-01-22',202103,1,2021,22,3,202101,2021),('2021-01-23',202103,1,2021,23,3,202101,2021),('2021-01-24',202104,1,2021,24,4,202101,2021),('2021-01-25',202104,1,2021,25,4,202101,2021),('2021-01-26',202104,1,2021,26,4,202101,2021),('2021-01-27',202104,1,2021,27,4,202101,2021),('2021-01-28',202104,1,2021,28,4,202101,2021),('2021-01-29',202104,1,2021,29,4,202101,2021),('2021-01-30',202104,1,2021,30,4,202101,2021),('2021-01-31',202105,1,2021,31,5,202101,2021),('2021-02-01',202105,2,2021,1,5,202102,2021),('2021-02-02',202105,2,2021,2,5,202102,2021),('2021-02-03',202105,2,2021,3,5,202102,2021),('2021-02-04',202105,2,2021,4,5,202102,2021),('2021-02-05',202105,2,2021,5,5,202102,2021),('2021-02-06',202105,2,2021,6,5,202102,2021),('2021-02-07',202106,2,2021,7,6,202102,2021),('2021-02-08',202106,2,2021,8,6,202102,2021),('2021-02-09',202106,2,2021,9,6,202102,2021),('2021-02-10',202106,2,2021,10,6,202102,2021),('2021-02-11',202106,2,2021,11,6,202102,2021),('2021-02-12',202106,2,2021,12,6,202102,2021),('2021-02-13',202106,2,2021,13,6,202102,2021),('2021-02-14',202107,2,2021,14,7,202102,2021),('2021-02-15',202107,2,2021,15,7,202102,2021),('2021-02-16',202107,2,2021,16,7,202102,2021),('2021-02-17',202107,2,2021,17,7,202102,2021),('2021-02-18',202107,2,2021,18,7,202102,2021),('2021-02-19',202107,2,2021,19,7,202102,2021),('2021-02-20',202107,2,2021,20,7,202102,2021),('2021-02-21',202108,2,2021,21,8,202102,2021),('2021-02-22',202108,2,2021,22,8,202102,2021),('2021-02-23',202108,2,2021,23,8,202102,2021),('2021-02-24',202108,2,2021,24,8,202102,2021),('2021-02-25',202108,2,2021,25,8,202102,2021),('2021-02-26',202108,2,2021,26,8,202102,2021),('2021-02-27',202108,2,2021,27,8,202102,2021),('2021-02-28',202109,2,2021,28,9,202102,2021),('2021-03-01',202109,3,2021,1,9,202103,2021),('2021-03-02',202109,3,2021,2,9,202103,2021),('2021-03-03',202109,3,2021,3,9,202103,2021),('2021-03-04',202109,3,2021,4,9,202103,2021),('2021-03-05',202109,3,2021,5,9,202103,2021),('2021-03-06',202109,3,2021,6,9,202103,2021),('2021-03-07',202110,3,2021,7,10,202103,2021),('2021-03-08',202110,3,2021,8,10,202103,2021),('2021-03-09',202110,3,2021,9,10,202103,2021),('2021-03-10',202110,3,2021,10,10,202103,2021),('2021-03-11',202110,3,2021,11,10,202103,2021),('2021-03-12',202110,3,2021,12,10,202103,2021),('2021-03-13',202110,3,2021,13,10,202103,2021),('2021-03-14',202111,3,2021,14,11,202103,2021),('2021-03-15',202111,3,2021,15,11,202103,2021),('2021-03-16',202111,3,2021,16,11,202103,2021),('2021-03-17',202111,3,2021,17,11,202103,2021),('2021-03-18',202111,3,2021,18,11,202103,2021),('2021-03-19',202111,3,2021,19,11,202103,2021),('2021-03-20',202111,3,2021,20,11,202103,2021),('2021-03-21',202112,3,2021,21,12,202103,2021),('2021-03-22',202112,3,2021,22,12,202103,2021),('2021-03-23',202112,3,2021,23,12,202103,2021),('2021-03-24',202112,3,2021,24,12,202103,2021),('2021-03-25',202112,3,2021,25,12,202103,2021),('2021-03-26',202112,3,2021,26,12,202103,2021),('2021-03-27',202112,3,2021,27,12,202103,2021),('2021-03-28',202113,3,2021,28,13,202103,2021),('2021-03-29',202113,3,2021,29,13,202103,2021),('2021-03-30',202113,3,2021,30,13,202103,2021),('2021-03-31',202113,3,2021,31,13,202103,2021),('2021-04-01',202113,4,2021,1,13,202104,2021),('2021-04-02',202113,4,2021,2,13,202104,2021),('2021-04-03',202113,4,2021,3,13,202104,2021),('2021-04-04',202114,4,2021,4,14,202104,2021),('2021-04-05',202114,4,2021,5,14,202104,2021),('2021-04-06',202114,4,2021,6,14,202104,2021),('2021-04-07',202114,4,2021,7,14,202104,2021),('2021-04-08',202114,4,2021,8,14,202104,2021),('2021-04-09',202114,4,2021,9,14,202104,2021),('2021-04-10',202114,4,2021,10,14,202104,2021),('2021-04-11',202115,4,2021,11,15,202104,2021),('2021-04-12',202115,4,2021,12,15,202104,2021),('2021-04-13',202115,4,2021,13,15,202104,2021),('2021-04-14',202115,4,2021,14,15,202104,2021),('2021-04-15',202115,4,2021,15,15,202104,2021),('2021-04-16',202115,4,2021,16,15,202104,2021),('2021-04-17',202115,4,2021,17,15,202104,2021),('2021-04-18',202116,4,2021,18,16,202104,2021),('2021-04-19',202116,4,2021,19,16,202104,2021),('2021-04-20',202116,4,2021,20,16,202104,2021),('2021-04-21',202116,4,2021,21,16,202104,2021),('2021-04-22',202116,4,2021,22,16,202104,2021),('2021-04-23',202116,4,2021,23,16,202104,2021),('2021-04-24',202116,4,2021,24,16,202104,2021),('2021-04-25',202117,4,2021,25,17,202104,2021),('2021-04-26',202117,4,2021,26,17,202104,2021),('2021-04-27',202117,4,2021,27,17,202104,2021),('2021-04-28',202117,4,2021,28,17,202104,2021),('2021-04-29',202117,4,2021,29,17,202104,2021),('2021-04-30',202117,4,2021,30,17,202104,2021),('2021-05-01',202117,5,2021,1,17,202105,2021),('2021-05-02',202118,5,2021,2,18,202105,2021),('2021-05-03',202118,5,2021,3,18,202105,2021),('2021-05-04',202118,5,2021,4,18,202105,2021),('2021-05-05',202118,5,2021,5,18,202105,2021),('2021-05-06',202118,5,2021,6,18,202105,2021),('2021-05-07',202118,5,2021,7,18,202105,2021),('2021-05-08',202118,5,2021,8,18,202105,2021),('2021-05-09',202119,5,2021,9,19,202105,2021),('2021-05-10',202119,5,2021,10,19,202105,2021),('2021-05-11',202119,5,2021,11,19,202105,2021),('2021-05-12',202119,5,2021,12,19,202105,2021),('2021-05-13',202119,5,2021,13,19,202105,2021),('2021-05-14',202119,5,2021,14,19,202105,2021),('2021-05-15',202119,5,2021,15,19,202105,2021),('2021-05-16',202120,5,2021,16,20,202105,2021),('2021-05-17',202120,5,2021,17,20,202105,2021),('2021-05-18',202120,5,2021,18,20,202105,2021),('2021-05-19',202120,5,2021,19,20,202105,2021),('2021-05-20',202120,5,2021,20,20,202105,2021),('2021-05-21',202120,5,2021,21,20,202105,2021),('2021-05-22',202120,5,2021,22,20,202105,2021),('2021-05-23',202121,5,2021,23,21,202105,2021),('2021-05-24',202121,5,2021,24,21,202105,2021),('2021-05-25',202121,5,2021,25,21,202105,2021),('2021-05-26',202121,5,2021,26,21,202105,2021),('2021-05-27',202121,5,2021,27,21,202105,2021),('2021-05-28',202121,5,2021,28,21,202105,2021),('2021-05-29',202121,5,2021,29,21,202105,2021),('2021-05-30',202122,5,2021,30,22,202105,2021),('2021-05-31',202122,5,2021,31,22,202105,2021),('2021-06-01',202122,6,2021,1,22,202106,2021),('2021-06-02',202122,6,2021,2,22,202106,2021),('2021-06-03',202122,6,2021,3,22,202106,2021),('2021-06-04',202122,6,2021,4,22,202106,2021),('2021-06-05',202122,6,2021,5,22,202106,2021),('2021-06-06',202123,6,2021,6,23,202106,2021),('2021-06-07',202123,6,2021,7,23,202106,2021),('2021-06-08',202123,6,2021,8,23,202106,2021),('2021-06-09',202123,6,2021,9,23,202106,2021),('2021-06-10',202123,6,2021,10,23,202106,2021),('2021-06-11',202123,6,2021,11,23,202106,2021),('2021-06-12',202123,6,2021,12,23,202106,2021),('2021-06-13',202124,6,2021,13,24,202106,2021),('2021-06-14',202124,6,2021,14,24,202106,2021),('2021-06-15',202124,6,2021,15,24,202106,2021),('2021-06-16',202124,6,2021,16,24,202106,2021),('2021-06-17',202124,6,2021,17,24,202106,2021),('2021-06-18',202124,6,2021,18,24,202106,2021),('2021-06-19',202124,6,2021,19,24,202106,2021),('2021-06-20',202125,6,2021,20,25,202106,2021),('2021-06-21',202125,6,2021,21,25,202106,2021),('2021-06-22',202125,6,2021,22,25,202106,2021),('2021-06-23',202125,6,2021,23,25,202106,2021),('2021-06-24',202125,6,2021,24,25,202106,2021),('2021-06-25',202125,6,2021,25,25,202106,2021),('2021-06-26',202125,6,2021,26,25,202106,2021),('2021-06-27',202126,6,2021,27,26,202106,2021),('2021-06-28',202126,6,2021,28,26,202106,2021),('2021-06-29',202126,6,2021,29,26,202106,2021),('2021-06-30',202126,6,2021,30,26,202106,2021),('2021-07-01',202126,7,2021,1,26,202107,2021),('2021-07-02',202126,7,2021,2,26,202107,2021),('2021-07-03',202126,7,2021,3,26,202107,2021),('2021-07-04',202127,7,2021,4,27,202107,2021),('2021-07-05',202127,7,2021,5,27,202107,2021),('2021-07-06',202127,7,2021,6,27,202107,2021),('2021-07-07',202127,7,2021,7,27,202107,2021),('2021-07-08',202127,7,2021,8,27,202107,2021),('2021-07-09',202127,7,2021,9,27,202107,2021),('2021-07-10',202127,7,2021,10,27,202107,2021),('2021-07-11',202128,7,2021,11,28,202107,2021),('2021-07-12',202128,7,2021,12,28,202107,2021),('2021-07-13',202128,7,2021,13,28,202107,2021),('2021-07-14',202128,7,2021,14,28,202107,2021),('2021-07-15',202128,7,2021,15,28,202107,2021),('2021-07-16',202128,7,2021,16,28,202107,2021),('2021-07-17',202128,7,2021,17,28,202107,2021),('2021-07-18',202129,7,2021,18,29,202107,2021),('2021-07-19',202129,7,2021,19,29,202107,2021),('2021-07-20',202129,7,2021,20,29,202107,2021),('2021-07-21',202129,7,2021,21,29,202107,2021),('2021-07-22',202129,7,2021,22,29,202107,2021),('2021-07-23',202129,7,2021,23,29,202107,2021),('2021-07-24',202129,7,2021,24,29,202107,2021),('2021-07-25',202130,7,2021,25,30,202107,2021),('2021-07-26',202130,7,2021,26,30,202107,2021),('2021-07-27',202130,7,2021,27,30,202107,2021),('2021-07-28',202130,7,2021,28,30,202107,2021),('2021-07-29',202130,7,2021,29,30,202107,2021),('2021-07-30',202130,7,2021,30,30,202107,2021),('2021-07-31',202130,7,2021,31,30,202107,2021),('2021-08-01',202131,8,2021,1,31,202108,2021),('2021-08-02',202131,8,2021,2,31,202108,2021),('2021-08-03',202131,8,2021,3,31,202108,2021),('2021-08-04',202131,8,2021,4,31,202108,2021),('2021-08-05',202131,8,2021,5,31,202108,2021),('2021-08-06',202131,8,2021,6,31,202108,2021),('2021-08-07',202131,8,2021,7,31,202108,2021),('2021-08-08',202132,8,2021,8,32,202108,2021),('2021-08-09',202132,8,2021,9,32,202108,2021),('2021-08-10',202132,8,2021,10,32,202108,2021),('2021-08-11',202132,8,2021,11,32,202108,2021),('2021-08-12',202132,8,2021,12,32,202108,2021),('2021-08-13',202132,8,2021,13,32,202108,2021),('2021-08-14',202132,8,2021,14,32,202108,2021),('2021-08-15',202133,8,2021,15,33,202108,2021),('2021-08-16',202133,8,2021,16,33,202108,2021),('2021-08-17',202133,8,2021,17,33,202108,2021),('2021-08-18',202133,8,2021,18,33,202108,2021),('2021-08-19',202133,8,2021,19,33,202108,2021),('2021-08-20',202133,8,2021,20,33,202108,2021),('2021-08-21',202133,8,2021,21,33,202108,2021),('2021-08-22',202134,8,2021,22,34,202108,2021),('2021-08-23',202134,8,2021,23,34,202108,2021),('2021-08-24',202134,8,2021,24,34,202108,2021),('2021-08-25',202134,8,2021,25,34,202108,2021),('2021-08-26',202134,8,2021,26,34,202108,2021),('2021-08-27',202134,8,2021,27,34,202108,2021),('2021-08-28',202134,8,2021,28,34,202108,2021),('2021-08-29',202135,8,2021,29,35,202108,2021),('2021-08-30',202135,8,2021,30,35,202108,2021),('2021-08-31',202135,8,2021,31,35,202108,2021),('2021-09-01',202135,9,2021,1,35,202109,2021),('2021-09-02',202135,9,2021,2,35,202109,2021),('2021-09-03',202135,9,2021,3,35,202109,2021),('2021-09-04',202135,9,2021,4,35,202109,2021),('2021-09-05',202136,9,2021,5,36,202109,2021),('2021-09-06',202136,9,2021,6,36,202109,2021),('2021-09-07',202136,9,2021,7,36,202109,2021),('2021-09-08',202136,9,2021,8,36,202109,2021),('2021-09-09',202136,9,2021,9,36,202109,2021),('2021-09-10',202136,9,2021,10,36,202109,2021),('2021-09-11',202136,9,2021,11,36,202109,2021),('2021-09-12',202137,9,2021,12,37,202109,2021),('2021-09-13',202137,9,2021,13,37,202109,2021),('2021-09-14',202137,9,2021,14,37,202109,2021),('2021-09-15',202137,9,2021,15,37,202109,2021),('2021-09-16',202137,9,2021,16,37,202109,2021),('2021-09-17',202137,9,2021,17,37,202109,2021),('2021-09-18',202137,9,2021,18,37,202109,2021),('2021-09-19',202138,9,2021,19,38,202109,2021),('2021-09-20',202138,9,2021,20,38,202109,2021),('2021-09-21',202138,9,2021,21,38,202109,2021),('2021-09-22',202138,9,2021,22,38,202109,2021),('2021-09-23',202138,9,2021,23,38,202109,2021),('2021-09-24',202138,9,2021,24,38,202109,2021),('2021-09-25',202138,9,2021,25,38,202109,2021),('2021-09-26',202139,9,2021,26,39,202109,2021),('2021-09-27',202139,9,2021,27,39,202109,2021),('2021-09-28',202139,9,2021,28,39,202109,2021),('2021-09-29',202139,9,2021,29,39,202109,2021),('2021-09-30',202139,9,2021,30,39,202109,2021),('2021-10-01',202139,10,2021,1,39,202110,2021),('2021-10-02',202139,10,2021,2,39,202110,2021),('2021-10-03',202140,10,2021,3,40,202110,2021),('2021-10-04',202140,10,2021,4,40,202110,2021),('2021-10-05',202140,10,2021,5,40,202110,2021),('2021-10-06',202140,10,2021,6,40,202110,2021),('2021-10-07',202140,10,2021,7,40,202110,2021),('2021-10-08',202140,10,2021,8,40,202110,2021),('2021-10-09',202140,10,2021,9,40,202110,2021),('2021-10-10',202141,10,2021,10,41,202110,2021),('2021-10-11',202141,10,2021,11,41,202110,2021),('2021-10-12',202141,10,2021,12,41,202110,2021),('2021-10-13',202141,10,2021,13,41,202110,2021),('2021-10-14',202141,10,2021,14,41,202110,2021),('2021-10-15',202141,10,2021,15,41,202110,2021),('2021-10-16',202141,10,2021,16,41,202110,2021),('2021-10-17',202142,10,2021,17,42,202110,2021),('2021-10-18',202142,10,2021,18,42,202110,2021),('2021-10-19',202142,10,2021,19,42,202110,2021),('2021-10-20',202142,10,2021,20,42,202110,2021),('2021-10-21',202142,10,2021,21,42,202110,2021),('2021-10-22',202142,10,2021,22,42,202110,2021),('2021-10-23',202142,10,2021,23,42,202110,2021),('2021-10-24',202143,10,2021,24,43,202110,2021),('2021-10-25',202143,10,2021,25,43,202110,2021),('2021-10-26',202143,10,2021,26,43,202110,2021),('2021-10-27',202143,10,2021,27,43,202110,2021),('2021-10-28',202143,10,2021,28,43,202110,2021),('2021-10-29',202143,10,2021,29,43,202110,2021),('2021-10-30',202143,10,2021,30,43,202110,2021),('2021-10-31',202144,10,2021,31,44,202110,2021),('2021-11-01',202144,11,2021,1,44,202111,2021),('2021-11-02',202144,11,2021,2,44,202111,2021),('2021-11-03',202144,11,2021,3,44,202111,2021),('2021-11-04',202144,11,2021,4,44,202111,2021),('2021-11-05',202144,11,2021,5,44,202111,2021),('2021-11-06',202144,11,2021,6,44,202111,2021),('2021-11-07',202145,11,2021,7,45,202111,2021),('2021-11-08',202145,11,2021,8,45,202111,2021),('2021-11-09',202145,11,2021,9,45,202111,2021),('2021-11-10',202145,11,2021,10,45,202111,2021),('2021-11-11',202145,11,2021,11,45,202111,2021),('2021-11-12',202145,11,2021,12,45,202111,2021),('2021-11-13',202145,11,2021,13,45,202111,2021),('2021-11-14',202146,11,2021,14,46,202111,2021),('2021-11-15',202146,11,2021,15,46,202111,2021),('2021-11-16',202146,11,2021,16,46,202111,2021),('2021-11-17',202146,11,2021,17,46,202111,2021),('2021-11-18',202146,11,2021,18,46,202111,2021),('2021-11-19',202146,11,2021,19,46,202111,2021),('2021-11-20',202146,11,2021,20,46,202111,2021),('2021-11-21',202147,11,2021,21,47,202111,2021),('2021-11-22',202147,11,2021,22,47,202111,2021),('2021-11-23',202147,11,2021,23,47,202111,2021),('2021-11-24',202147,11,2021,24,47,202111,2021),('2021-11-25',202147,11,2021,25,47,202111,2021),('2021-11-26',202147,11,2021,26,47,202111,2021),('2021-11-27',202147,11,2021,27,47,202111,2021),('2021-11-28',202148,11,2021,28,48,202111,2021),('2021-11-29',202148,11,2021,29,48,202111,2021),('2021-11-30',202148,11,2021,30,48,202111,2021),('2021-12-01',202148,12,2021,1,48,202112,2022),('2021-12-02',202148,12,2021,2,48,202112,2022),('2021-12-03',202148,12,2021,3,48,202112,2022),('2021-12-04',202148,12,2021,4,48,202112,2022),('2021-12-05',202149,12,2021,5,49,202112,2022),('2021-12-06',202149,12,2021,6,49,202112,2022),('2021-12-07',202149,12,2021,7,49,202112,2022),('2021-12-08',202149,12,2021,8,49,202112,2022),('2021-12-09',202149,12,2021,9,49,202112,2022),('2021-12-10',202149,12,2021,10,49,202112,2022),('2021-12-11',202149,12,2021,11,49,202112,2022),('2021-12-12',202150,12,2021,12,50,202112,2022),('2021-12-13',202150,12,2021,13,50,202112,2022),('2021-12-14',202150,12,2021,14,50,202112,2022),('2021-12-15',202150,12,2021,15,50,202112,2022),('2021-12-16',202150,12,2021,16,50,202112,2022),('2021-12-17',202150,12,2021,17,50,202112,2022),('2021-12-18',202150,12,2021,18,50,202112,2022),('2021-12-19',202151,12,2021,19,51,202112,2022),('2021-12-20',202151,12,2021,20,51,202112,2022),('2021-12-21',202151,12,2021,21,51,202112,2022),('2021-12-22',202151,12,2021,22,51,202112,2022),('2021-12-23',202151,12,2021,23,51,202112,2022),('2021-12-24',202151,12,2021,24,51,202112,2022),('2021-12-25',202151,12,2021,25,51,202112,2022),('2021-12-26',202152,12,2021,26,52,202112,2022),('2021-12-27',202152,12,2021,27,52,202112,2022),('2021-12-28',202152,12,2021,28,52,202112,2022),('2021-12-29',202152,12,2021,29,52,202112,2022),('2021-12-30',202152,12,2021,30,52,202112,2022),('2021-12-31',202152,12,2021,31,52,202112,2022),('2022-01-01',202152,1,2022,1,52,202201,2022),('2022-01-02',202201,1,2022,2,1,202201,2022),('2022-01-03',202201,1,2022,3,1,202201,2022),('2022-01-04',202201,1,2022,4,1,202201,2022),('2022-01-05',202201,1,2022,5,1,202201,2022),('2022-01-06',202201,1,2022,6,1,202201,2022),('2022-01-07',202201,1,2022,7,1,202201,2022),('2022-01-08',202201,1,2022,8,1,202201,2022),('2022-01-09',202202,1,2022,9,2,202201,2022),('2022-01-10',202202,1,2022,10,2,202201,2022),('2022-01-11',202202,1,2022,11,2,202201,2022),('2022-01-12',202202,1,2022,12,2,202201,2022),('2022-01-13',202202,1,2022,13,2,202201,2022),('2022-01-14',202202,1,2022,14,2,202201,2022),('2022-01-15',202202,1,2022,15,2,202201,2022),('2022-01-16',202203,1,2022,16,3,202201,2022),('2022-01-17',202203,1,2022,17,3,202201,2022),('2022-01-18',202203,1,2022,18,3,202201,2022),('2022-01-19',202203,1,2022,19,3,202201,2022),('2022-01-20',202203,1,2022,20,3,202201,2022),('2022-01-21',202203,1,2022,21,3,202201,2022),('2022-01-22',202203,1,2022,22,3,202201,2022),('2022-01-23',202204,1,2022,23,4,202201,2022),('2022-01-24',202204,1,2022,24,4,202201,2022),('2022-01-25',202204,1,2022,25,4,202201,2022),('2022-01-26',202204,1,2022,26,4,202201,2022),('2022-01-27',202204,1,2022,27,4,202201,2022),('2022-01-28',202204,1,2022,28,4,202201,2022),('2022-01-29',202204,1,2022,29,4,202201,2022),('2022-01-30',202205,1,2022,30,5,202201,2022),('2022-01-31',202205,1,2022,31,5,202201,2022),('2022-02-01',202205,2,2022,1,5,202202,2022),('2022-02-02',202205,2,2022,2,5,202202,2022),('2022-02-03',202205,2,2022,3,5,202202,2022),('2022-02-04',202205,2,2022,4,5,202202,2022),('2022-02-05',202205,2,2022,5,5,202202,2022),('2022-02-06',202206,2,2022,6,6,202202,2022),('2022-02-07',202206,2,2022,7,6,202202,2022),('2022-02-08',202206,2,2022,8,6,202202,2022),('2022-02-09',202206,2,2022,9,6,202202,2022),('2022-02-10',202206,2,2022,10,6,202202,2022),('2022-02-11',202206,2,2022,11,6,202202,2022),('2022-02-12',202206,2,2022,12,6,202202,2022),('2022-02-13',202207,2,2022,13,7,202202,2022),('2022-02-14',202207,2,2022,14,7,202202,2022),('2022-02-15',202207,2,2022,15,7,202202,2022),('2022-02-16',202207,2,2022,16,7,202202,2022),('2022-02-17',202207,2,2022,17,7,202202,2022),('2022-02-18',202207,2,2022,18,7,202202,2022),('2022-02-19',202207,2,2022,19,7,202202,2022),('2022-02-20',202208,2,2022,20,8,202202,2022),('2022-02-21',202208,2,2022,21,8,202202,2022),('2022-02-22',202208,2,2022,22,8,202202,2022),('2022-02-23',202208,2,2022,23,8,202202,2022),('2022-02-24',202208,2,2022,24,8,202202,2022),('2022-02-25',202208,2,2022,25,8,202202,2022),('2022-02-26',202208,2,2022,26,8,202202,2022),('2022-02-27',202209,2,2022,27,9,202202,2022),('2022-02-28',202209,2,2022,28,9,202202,2022),('2022-03-01',202209,3,2022,1,9,202203,2022),('2022-03-02',202209,3,2022,2,9,202203,2022),('2022-03-03',202209,3,2022,3,9,202203,2022),('2022-03-04',202209,3,2022,4,9,202203,2022),('2022-03-05',202209,3,2022,5,9,202203,2022),('2022-03-06',202210,3,2022,6,10,202203,2022),('2022-03-07',202210,3,2022,7,10,202203,2022),('2022-03-08',202210,3,2022,8,10,202203,2022),('2022-03-09',202210,3,2022,9,10,202203,2022),('2022-03-10',202210,3,2022,10,10,202203,2022),('2022-03-11',202210,3,2022,11,10,202203,2022),('2022-03-12',202210,3,2022,12,10,202203,2022),('2022-03-13',202211,3,2022,13,11,202203,2022),('2022-03-14',202211,3,2022,14,11,202203,2022),('2022-03-15',202211,3,2022,15,11,202203,2022),('2022-03-16',202211,3,2022,16,11,202203,2022),('2022-03-17',202211,3,2022,17,11,202203,2022),('2022-03-18',202211,3,2022,18,11,202203,2022),('2022-03-19',202211,3,2022,19,11,202203,2022),('2022-03-20',202212,3,2022,20,12,202203,2022),('2022-03-21',202212,3,2022,21,12,202203,2022),('2022-03-22',202212,3,2022,22,12,202203,2022),('2022-03-23',202212,3,2022,23,12,202203,2022),('2022-03-24',202212,3,2022,24,12,202203,2022),('2022-03-25',202212,3,2022,25,12,202203,2022),('2022-03-26',202212,3,2022,26,12,202203,2022),('2022-03-27',202213,3,2022,27,13,202203,2022),('2022-03-28',202213,3,2022,28,13,202203,2022),('2022-03-29',202213,3,2022,29,13,202203,2022),('2022-03-30',202213,3,2022,30,13,202203,2022),('2022-03-31',202213,3,2022,31,13,202203,2022),('2022-04-01',202213,4,2022,1,13,202204,2022),('2022-04-02',202213,4,2022,2,13,202204,2022),('2022-04-03',202214,4,2022,3,14,202204,2022),('2022-04-04',202214,4,2022,4,14,202204,2022),('2022-04-05',202214,4,2022,5,14,202204,2022),('2022-04-06',202214,4,2022,6,14,202204,2022),('2022-04-07',202214,4,2022,7,14,202204,2022),('2022-04-08',202214,4,2022,8,14,202204,2022),('2022-04-09',202214,4,2022,9,14,202204,2022),('2022-04-10',202215,4,2022,10,15,202204,2022),('2022-04-11',202215,4,2022,11,15,202204,2022),('2022-04-12',202215,4,2022,12,15,202204,2022),('2022-04-13',202215,4,2022,13,15,202204,2022),('2022-04-14',202215,4,2022,14,15,202204,2022),('2022-04-15',202215,4,2022,15,15,202204,2022),('2022-04-16',202215,4,2022,16,15,202204,2022),('2022-04-17',202216,4,2022,17,16,202204,2022),('2022-04-18',202216,4,2022,18,16,202204,2022),('2022-04-19',202216,4,2022,19,16,202204,2022),('2022-04-20',202216,4,2022,20,16,202204,2022),('2022-04-21',202216,4,2022,21,16,202204,2022),('2022-04-22',202216,4,2022,22,16,202204,2022),('2022-04-23',202216,4,2022,23,16,202204,2022),('2022-04-24',202217,4,2022,24,17,202204,2022),('2022-04-25',202217,4,2022,25,17,202204,2022),('2022-04-26',202217,4,2022,26,17,202204,2022),('2022-04-27',202217,4,2022,27,17,202204,2022),('2022-04-28',202217,4,2022,28,17,202204,2022),('2022-04-29',202217,4,2022,29,17,202204,2022),('2022-04-30',202217,4,2022,30,17,202204,2022),('2022-05-01',202218,5,2022,1,18,202205,2022),('2022-05-02',202218,5,2022,2,18,202205,2022),('2022-05-03',202218,5,2022,3,18,202205,2022),('2022-05-04',202218,5,2022,4,18,202205,2022),('2022-05-05',202218,5,2022,5,18,202205,2022),('2022-05-06',202218,5,2022,6,18,202205,2022),('2022-05-07',202218,5,2022,7,18,202205,2022),('2022-05-08',202219,5,2022,8,19,202205,2022),('2022-05-09',202219,5,2022,9,19,202205,2022),('2022-05-10',202219,5,2022,10,19,202205,2022),('2022-05-11',202219,5,2022,11,19,202205,2022),('2022-05-12',202219,5,2022,12,19,202205,2022),('2022-05-13',202219,5,2022,13,19,202205,2022),('2022-05-14',202219,5,2022,14,19,202205,2022),('2022-05-15',202220,5,2022,15,20,202205,2022),('2022-05-16',202220,5,2022,16,20,202205,2022),('2022-05-17',202220,5,2022,17,20,202205,2022),('2022-05-18',202220,5,2022,18,20,202205,2022),('2022-05-19',202220,5,2022,19,20,202205,2022),('2022-05-20',202220,5,2022,20,20,202205,2022),('2022-05-21',202220,5,2022,21,20,202205,2022),('2022-05-22',202221,5,2022,22,21,202205,2022),('2022-05-23',202221,5,2022,23,21,202205,2022),('2022-05-24',202221,5,2022,24,21,202205,2022),('2022-05-25',202221,5,2022,25,21,202205,2022),('2022-05-26',202221,5,2022,26,21,202205,2022),('2022-05-27',202221,5,2022,27,21,202205,2022),('2022-05-28',202221,5,2022,28,21,202205,2022),('2022-05-29',202222,5,2022,29,22,202205,2022),('2022-05-30',202222,5,2022,30,22,202205,2022),('2022-05-31',202222,5,2022,31,22,202205,2022),('2022-06-01',202222,6,2022,1,22,202206,2022),('2022-06-02',202222,6,2022,2,22,202206,2022),('2022-06-03',202222,6,2022,3,22,202206,2022),('2022-06-04',202222,6,2022,4,22,202206,2022),('2022-06-05',202223,6,2022,5,23,202206,2022),('2022-06-06',202223,6,2022,6,23,202206,2022),('2022-06-07',202223,6,2022,7,23,202206,2022),('2022-06-08',202223,6,2022,8,23,202206,2022),('2022-06-09',202223,6,2022,9,23,202206,2022),('2022-06-10',202223,6,2022,10,23,202206,2022),('2022-06-11',202223,6,2022,11,23,202206,2022),('2022-06-12',202224,6,2022,12,24,202206,2022),('2022-06-13',202224,6,2022,13,24,202206,2022),('2022-06-14',202224,6,2022,14,24,202206,2022),('2022-06-15',202224,6,2022,15,24,202206,2022),('2022-06-16',202224,6,2022,16,24,202206,2022),('2022-06-17',202224,6,2022,17,24,202206,2022),('2022-06-18',202224,6,2022,18,24,202206,2022),('2022-06-19',202225,6,2022,19,25,202206,2022),('2022-06-20',202225,6,2022,20,25,202206,2022),('2022-06-21',202225,6,2022,21,25,202206,2022),('2022-06-22',202225,6,2022,22,25,202206,2022),('2022-06-23',202225,6,2022,23,25,202206,2022),('2022-06-24',202225,6,2022,24,25,202206,2022),('2022-06-25',202225,6,2022,25,25,202206,2022),('2022-06-26',202226,6,2022,26,26,202206,2022),('2022-06-27',202226,6,2022,27,26,202206,2022),('2022-06-28',202226,6,2022,28,26,202206,2022),('2022-06-29',202226,6,2022,29,26,202206,2022),('2022-06-30',202226,6,2022,30,26,202206,2022),('2022-07-01',202226,7,2022,1,26,202207,2022),('2022-07-02',202226,7,2022,2,26,202207,2022),('2022-07-03',202227,7,2022,3,27,202207,2022),('2022-07-04',202227,7,2022,4,27,202207,2022),('2022-07-05',202227,7,2022,5,27,202207,2022),('2022-07-06',202227,7,2022,6,27,202207,2022),('2022-07-07',202227,7,2022,7,27,202207,2022),('2022-07-08',202227,7,2022,8,27,202207,2022),('2022-07-09',202227,7,2022,9,27,202207,2022),('2022-07-10',202228,7,2022,10,28,202207,2022),('2022-07-11',202228,7,2022,11,28,202207,2022),('2022-07-12',202228,7,2022,12,28,202207,2022),('2022-07-13',202228,7,2022,13,28,202207,2022),('2022-07-14',202228,7,2022,14,28,202207,2022),('2022-07-15',202228,7,2022,15,28,202207,2022),('2022-07-16',202228,7,2022,16,28,202207,2022),('2022-07-17',202229,7,2022,17,29,202207,2022),('2022-07-18',202229,7,2022,18,29,202207,2022),('2022-07-19',202229,7,2022,19,29,202207,2022),('2022-07-20',202229,7,2022,20,29,202207,2022),('2022-07-21',202229,7,2022,21,29,202207,2022),('2022-07-22',202229,7,2022,22,29,202207,2022),('2022-07-23',202229,7,2022,23,29,202207,2022),('2022-07-24',202230,7,2022,24,30,202207,2022),('2022-07-25',202230,7,2022,25,30,202207,2022),('2022-07-26',202230,7,2022,26,30,202207,2022),('2022-07-27',202230,7,2022,27,30,202207,2022),('2022-07-28',202230,7,2022,28,30,202207,2022),('2022-07-29',202230,7,2022,29,30,202207,2022),('2022-07-30',202230,7,2022,30,30,202207,2022),('2022-07-31',202231,7,2022,31,31,202207,2022),('2022-08-01',202231,8,2022,1,31,202208,2022),('2022-08-02',202231,8,2022,2,31,202208,2022),('2022-08-03',202231,8,2022,3,31,202208,2022),('2022-08-04',202231,8,2022,4,31,202208,2022),('2022-08-05',202231,8,2022,5,31,202208,2022),('2022-08-06',202231,8,2022,6,31,202208,2022),('2022-08-07',202232,8,2022,7,32,202208,2022),('2022-08-08',202232,8,2022,8,32,202208,2022),('2022-08-09',202232,8,2022,9,32,202208,2022),('2022-08-10',202232,8,2022,10,32,202208,2022),('2022-08-11',202232,8,2022,11,32,202208,2022),('2022-08-12',202232,8,2022,12,32,202208,2022),('2022-08-13',202232,8,2022,13,32,202208,2022),('2022-08-14',202233,8,2022,14,33,202208,2022),('2022-08-15',202233,8,2022,15,33,202208,2022),('2022-08-16',202233,8,2022,16,33,202208,2022),('2022-08-17',202233,8,2022,17,33,202208,2022),('2022-08-18',202233,8,2022,18,33,202208,2022),('2022-08-19',202233,8,2022,19,33,202208,2022),('2022-08-20',202233,8,2022,20,33,202208,2022),('2022-08-21',202234,8,2022,21,34,202208,2022),('2022-08-22',202234,8,2022,22,34,202208,2022),('2022-08-23',202234,8,2022,23,34,202208,2022),('2022-08-24',202234,8,2022,24,34,202208,2022),('2022-08-25',202234,8,2022,25,34,202208,2022),('2022-08-26',202234,8,2022,26,34,202208,2022),('2022-08-27',202234,8,2022,27,34,202208,2022),('2022-08-28',202235,8,2022,28,35,202208,2022),('2022-08-29',202235,8,2022,29,35,202208,2022),('2022-08-30',202235,8,2022,30,35,202208,2022),('2022-08-31',202235,8,2022,31,35,202208,2022),('2022-09-01',202235,9,2022,1,35,202209,2022),('2022-09-02',202235,9,2022,2,35,202209,2022),('2022-09-03',202235,9,2022,3,35,202209,2022),('2022-09-04',202236,9,2022,4,36,202209,2022),('2022-09-05',202236,9,2022,5,36,202209,2022),('2022-09-06',202236,9,2022,6,36,202209,2022),('2022-09-07',202236,9,2022,7,36,202209,2022),('2022-09-08',202236,9,2022,8,36,202209,2022),('2022-09-09',202236,9,2022,9,36,202209,2022),('2022-09-10',202236,9,2022,10,36,202209,2022),('2022-09-11',202237,9,2022,11,37,202209,2022),('2022-09-12',202237,9,2022,12,37,202209,2022),('2022-09-13',202237,9,2022,13,37,202209,2022),('2022-09-14',202237,9,2022,14,37,202209,2022),('2022-09-15',202237,9,2022,15,37,202209,2022),('2022-09-16',202237,9,2022,16,37,202209,2022),('2022-09-17',202237,9,2022,17,37,202209,2022),('2022-09-18',202238,9,2022,18,38,202209,2022),('2022-09-19',202238,9,2022,19,38,202209,2022),('2022-09-20',202238,9,2022,20,38,202209,2022),('2022-09-21',202238,9,2022,21,38,202209,2022),('2022-09-22',202238,9,2022,22,38,202209,2022),('2022-09-23',202238,9,2022,23,38,202209,2022),('2022-09-24',202238,9,2022,24,38,202209,2022),('2022-09-25',202239,9,2022,25,39,202209,2022),('2022-09-26',202239,9,2022,26,39,202209,2022),('2022-09-27',202239,9,2022,27,39,202209,2022),('2022-09-28',202239,9,2022,28,39,202209,2022),('2022-09-29',202239,9,2022,29,39,202209,2022),('2022-09-30',202239,9,2022,30,39,202209,2022),('2022-10-01',202239,10,2022,1,39,202210,2022),('2022-10-02',202240,10,2022,2,40,202210,2022),('2022-10-03',202240,10,2022,3,40,202210,2022),('2022-10-04',202240,10,2022,4,40,202210,2022),('2022-10-05',202240,10,2022,5,40,202210,2022),('2022-10-06',202240,10,2022,6,40,202210,2022),('2022-10-07',202240,10,2022,7,40,202210,2022),('2022-10-08',202240,10,2022,8,40,202210,2022),('2022-10-09',202241,10,2022,9,41,202210,2022),('2022-10-10',202241,10,2022,10,41,202210,2022),('2022-10-11',202241,10,2022,11,41,202210,2022),('2022-10-12',202241,10,2022,12,41,202210,2022),('2022-10-13',202241,10,2022,13,41,202210,2022),('2022-10-14',202241,10,2022,14,41,202210,2022),('2022-10-15',202241,10,2022,15,41,202210,2022),('2022-10-16',202242,10,2022,16,42,202210,2022),('2022-10-17',202242,10,2022,17,42,202210,2022),('2022-10-18',202242,10,2022,18,42,202210,2022),('2022-10-19',202242,10,2022,19,42,202210,2022),('2022-10-20',202242,10,2022,20,42,202210,2022),('2022-10-21',202242,10,2022,21,42,202210,2022),('2022-10-22',202242,10,2022,22,42,202210,2022),('2022-10-23',202243,10,2022,23,43,202210,2022),('2022-10-24',202243,10,2022,24,43,202210,2022),('2022-10-25',202243,10,2022,25,43,202210,2022),('2022-10-26',202243,10,2022,26,43,202210,2022),('2022-10-27',202243,10,2022,27,43,202210,2022),('2022-10-28',202243,10,2022,28,43,202210,2022),('2022-10-29',202243,10,2022,29,43,202210,2022),('2022-10-30',202244,10,2022,30,44,202210,2022),('2022-10-31',202244,10,2022,31,44,202210,2022),('2022-11-01',202244,11,2022,1,44,202211,2022),('2022-11-02',202244,11,2022,2,44,202211,2022),('2022-11-03',202244,11,2022,3,44,202211,2022),('2022-11-04',202244,11,2022,4,44,202211,2022),('2022-11-05',202244,11,2022,5,44,202211,2022),('2022-11-06',202245,11,2022,6,45,202211,2022),('2022-11-07',202245,11,2022,7,45,202211,2022),('2022-11-08',202245,11,2022,8,45,202211,2022),('2022-11-09',202245,11,2022,9,45,202211,2022),('2022-11-10',202245,11,2022,10,45,202211,2022),('2022-11-11',202245,11,2022,11,45,202211,2022),('2022-11-12',202245,11,2022,12,45,202211,2022),('2022-11-13',202246,11,2022,13,46,202211,2022),('2022-11-14',202246,11,2022,14,46,202211,2022),('2022-11-15',202246,11,2022,15,46,202211,2022),('2022-11-16',202246,11,2022,16,46,202211,2022),('2022-11-17',202246,11,2022,17,46,202211,2022),('2022-11-18',202246,11,2022,18,46,202211,2022),('2022-11-19',202246,11,2022,19,46,202211,2022),('2022-11-20',202247,11,2022,20,47,202211,2022),('2022-11-21',202247,11,2022,21,47,202211,2022),('2022-11-22',202247,11,2022,22,47,202211,2022),('2022-11-23',202247,11,2022,23,47,202211,2022),('2022-11-24',202247,11,2022,24,47,202211,2022),('2022-11-25',202247,11,2022,25,47,202211,2022),('2022-11-26',202247,11,2022,26,47,202211,2022),('2022-11-27',202248,11,2022,27,48,202211,2022),('2022-11-28',202248,11,2022,28,48,202211,2022),('2022-11-29',202248,11,2022,29,48,202211,2022),('2022-11-30',202248,11,2022,30,48,202211,2022),('2022-12-01',202248,12,2022,1,48,202212,2023),('2022-12-02',202248,12,2022,2,48,202212,2023),('2022-12-03',202248,12,2022,3,48,202212,2023),('2022-12-04',202249,12,2022,4,49,202212,2023),('2022-12-05',202249,12,2022,5,49,202212,2023),('2022-12-06',202249,12,2022,6,49,202212,2023),('2022-12-07',202249,12,2022,7,49,202212,2023),('2022-12-08',202249,12,2022,8,49,202212,2023),('2022-12-09',202249,12,2022,9,49,202212,2023),('2022-12-10',202249,12,2022,10,49,202212,2023),('2022-12-11',202250,12,2022,11,50,202212,2023),('2022-12-12',202250,12,2022,12,50,202212,2023),('2022-12-13',202250,12,2022,13,50,202212,2023),('2022-12-14',202250,12,2022,14,50,202212,2023),('2022-12-15',202250,12,2022,15,50,202212,2023),('2022-12-16',202250,12,2022,16,50,202212,2023),('2022-12-17',202250,12,2022,17,50,202212,2023),('2022-12-18',202251,12,2022,18,51,202212,2023),('2022-12-19',202251,12,2022,19,51,202212,2023),('2022-12-20',202251,12,2022,20,51,202212,2023),('2022-12-21',202251,12,2022,21,51,202212,2023),('2022-12-22',202251,12,2022,22,51,202212,2023),('2022-12-23',202251,12,2022,23,51,202212,2023),('2022-12-24',202251,12,2022,24,51,202212,2023),('2022-12-25',202252,12,2022,25,52,202212,2023),('2022-12-26',202252,12,2022,26,52,202212,2023),('2022-12-27',202252,12,2022,27,52,202212,2023),('2022-12-28',202252,12,2022,28,52,202212,2023),('2022-12-29',202252,12,2022,29,52,202212,2023),('2022-12-30',202252,12,2022,30,52,202212,2023),('2022-12-31',202252,12,2022,31,52,202212,2023),('2023-01-01',202301,1,2023,1,1,202301,2023),('2023-01-02',202301,1,2023,2,1,202301,2023),('2023-01-03',202301,1,2023,3,1,202301,2023),('2023-01-04',202301,1,2023,4,1,202301,2023),('2023-01-05',202301,1,2023,5,1,202301,2023),('2023-01-06',202301,1,2023,6,1,202301,2023),('2023-01-07',202301,1,2023,7,1,202301,2023),('2023-01-08',202302,1,2023,8,2,202301,2023),('2023-01-09',202302,1,2023,9,2,202301,2023),('2023-01-10',202302,1,2023,10,2,202301,2023),('2023-01-11',202302,1,2023,11,2,202301,2023),('2023-01-12',202302,1,2023,12,2,202301,2023),('2023-01-13',202302,1,2023,13,2,202301,2023),('2023-01-14',202302,1,2023,14,2,202301,2023),('2023-01-15',202303,1,2023,15,3,202301,2023),('2023-01-16',202303,1,2023,16,3,202301,2023),('2023-01-17',202303,1,2023,17,3,202301,2023),('2023-01-18',202303,1,2023,18,3,202301,2023),('2023-01-19',202303,1,2023,19,3,202301,2023),('2023-01-20',202303,1,2023,20,3,202301,2023),('2023-01-21',202303,1,2023,21,3,202301,2023),('2023-01-22',202304,1,2023,22,4,202301,2023),('2023-01-23',202304,1,2023,23,4,202301,2023),('2023-01-24',202304,1,2023,24,4,202301,2023),('2023-01-25',202304,1,2023,25,4,202301,2023),('2023-01-26',202304,1,2023,26,4,202301,2023),('2023-01-27',202304,1,2023,27,4,202301,2023),('2023-01-28',202304,1,2023,28,4,202301,2023),('2023-01-29',202305,1,2023,29,5,202301,2023),('2023-01-30',202305,1,2023,30,5,202301,2023),('2023-01-31',202305,1,2023,31,5,202301,2023),('2023-02-01',202305,2,2023,1,5,202302,2023),('2023-02-02',202305,2,2023,2,5,202302,2023),('2023-02-03',202305,2,2023,3,5,202302,2023),('2023-02-04',202305,2,2023,4,5,202302,2023),('2023-02-05',202306,2,2023,5,6,202302,2023),('2023-02-06',202306,2,2023,6,6,202302,2023),('2023-02-07',202306,2,2023,7,6,202302,2023),('2023-02-08',202306,2,2023,8,6,202302,2023),('2023-02-09',202306,2,2023,9,6,202302,2023),('2023-02-10',202306,2,2023,10,6,202302,2023),('2023-02-11',202306,2,2023,11,6,202302,2023),('2023-02-12',202307,2,2023,12,7,202302,2023),('2023-02-13',202307,2,2023,13,7,202302,2023),('2023-02-14',202307,2,2023,14,7,202302,2023),('2023-02-15',202307,2,2023,15,7,202302,2023),('2023-02-16',202307,2,2023,16,7,202302,2023),('2023-02-17',202307,2,2023,17,7,202302,2023),('2023-02-18',202307,2,2023,18,7,202302,2023),('2023-02-19',202308,2,2023,19,8,202302,2023),('2023-02-20',202308,2,2023,20,8,202302,2023),('2023-02-21',202308,2,2023,21,8,202302,2023),('2023-02-22',202308,2,2023,22,8,202302,2023),('2023-02-23',202308,2,2023,23,8,202302,2023),('2023-02-24',202308,2,2023,24,8,202302,2023),('2023-02-25',202308,2,2023,25,8,202302,2023),('2023-02-26',202309,2,2023,26,9,202302,2023),('2023-02-27',202309,2,2023,27,9,202302,2023),('2023-02-28',202309,2,2023,28,9,202302,2023),('2023-03-01',202309,3,2023,1,9,202303,2023),('2023-03-02',202309,3,2023,2,9,202303,2023),('2023-03-03',202309,3,2023,3,9,202303,2023),('2023-03-04',202309,3,2023,4,9,202303,2023),('2023-03-05',202310,3,2023,5,10,202303,2023),('2023-03-06',202310,3,2023,6,10,202303,2023),('2023-03-07',202310,3,2023,7,10,202303,2023),('2023-03-08',202310,3,2023,8,10,202303,2023),('2023-03-09',202310,3,2023,9,10,202303,2023),('2023-03-10',202310,3,2023,10,10,202303,2023),('2023-03-11',202310,3,2023,11,10,202303,2023),('2023-03-12',202311,3,2023,12,11,202303,2023),('2023-03-13',202311,3,2023,13,11,202303,2023),('2023-03-14',202311,3,2023,14,11,202303,2023),('2023-03-15',202311,3,2023,15,11,202303,2023),('2023-03-16',202311,3,2023,16,11,202303,2023),('2023-03-17',202311,3,2023,17,11,202303,2023),('2023-03-18',202311,3,2023,18,11,202303,2023),('2023-03-19',202312,3,2023,19,12,202303,2023),('2023-03-20',202312,3,2023,20,12,202303,2023),('2023-03-21',202312,3,2023,21,12,202303,2023),('2023-03-22',202312,3,2023,22,12,202303,2023),('2023-03-23',202312,3,2023,23,12,202303,2023),('2023-03-24',202312,3,2023,24,12,202303,2023),('2023-03-25',202312,3,2023,25,12,202303,2023),('2023-03-26',202313,3,2023,26,13,202303,2023),('2023-03-27',202313,3,2023,27,13,202303,2023),('2023-03-28',202313,3,2023,28,13,202303,2023),('2023-03-29',202313,3,2023,29,13,202303,2023),('2023-03-30',202313,3,2023,30,13,202303,2023),('2023-03-31',202313,3,2023,31,13,202303,2023),('2023-04-01',202313,4,2023,1,13,202304,2023),('2023-04-02',202314,4,2023,2,14,202304,2023),('2023-04-03',202314,4,2023,3,14,202304,2023),('2023-04-04',202314,4,2023,4,14,202304,2023),('2023-04-05',202314,4,2023,5,14,202304,2023),('2023-04-06',202314,4,2023,6,14,202304,2023),('2023-04-07',202314,4,2023,7,14,202304,2023),('2023-04-08',202314,4,2023,8,14,202304,2023),('2023-04-09',202315,4,2023,9,15,202304,2023),('2023-04-10',202315,4,2023,10,15,202304,2023),('2023-04-11',202315,4,2023,11,15,202304,2023),('2023-04-12',202315,4,2023,12,15,202304,2023),('2023-04-13',202315,4,2023,13,15,202304,2023),('2023-04-14',202315,4,2023,14,15,202304,2023),('2023-04-15',202315,4,2023,15,15,202304,2023),('2023-04-16',202316,4,2023,16,16,202304,2023),('2023-04-17',202316,4,2023,17,16,202304,2023),('2023-04-18',202316,4,2023,18,16,202304,2023),('2023-04-19',202316,4,2023,19,16,202304,2023),('2023-04-20',202316,4,2023,20,16,202304,2023),('2023-04-21',202316,4,2023,21,16,202304,2023),('2023-04-22',202316,4,2023,22,16,202304,2023),('2023-04-23',202317,4,2023,23,17,202304,2023),('2023-04-24',202317,4,2023,24,17,202304,2023),('2023-04-25',202317,4,2023,25,17,202304,2023),('2023-04-26',202317,4,2023,26,17,202304,2023),('2023-04-27',202317,4,2023,27,17,202304,2023),('2023-04-28',202317,4,2023,28,17,202304,2023),('2023-04-29',202317,4,2023,29,17,202304,2023),('2023-04-30',202318,4,2023,30,18,202304,2023),('2023-05-01',202318,5,2023,1,18,202305,2023),('2023-05-02',202318,5,2023,2,18,202305,2023),('2023-05-03',202318,5,2023,3,18,202305,2023),('2023-05-04',202318,5,2023,4,18,202305,2023),('2023-05-05',202318,5,2023,5,18,202305,2023),('2023-05-06',202318,5,2023,6,18,202305,2023),('2023-05-07',202319,5,2023,7,19,202305,2023),('2023-05-08',202319,5,2023,8,19,202305,2023),('2023-05-09',202319,5,2023,9,19,202305,2023),('2023-05-10',202319,5,2023,10,19,202305,2023),('2023-05-11',202319,5,2023,11,19,202305,2023),('2023-05-12',202319,5,2023,12,19,202305,2023),('2023-05-13',202319,5,2023,13,19,202305,2023),('2023-05-14',202320,5,2023,14,20,202305,2023),('2023-05-15',202320,5,2023,15,20,202305,2023),('2023-05-16',202320,5,2023,16,20,202305,2023),('2023-05-17',202320,5,2023,17,20,202305,2023),('2023-05-18',202320,5,2023,18,20,202305,2023),('2023-05-19',202320,5,2023,19,20,202305,2023),('2023-05-20',202320,5,2023,20,20,202305,2023),('2023-05-21',202321,5,2023,21,21,202305,2023),('2023-05-22',202321,5,2023,22,21,202305,2023),('2023-05-23',202321,5,2023,23,21,202305,2023),('2023-05-24',202321,5,2023,24,21,202305,2023),('2023-05-25',202321,5,2023,25,21,202305,2023),('2023-05-26',202321,5,2023,26,21,202305,2023),('2023-05-27',202321,5,2023,27,21,202305,2023),('2023-05-28',202322,5,2023,28,22,202305,2023),('2023-05-29',202322,5,2023,29,22,202305,2023),('2023-05-30',202322,5,2023,30,22,202305,2023),('2023-05-31',202322,5,2023,31,22,202305,2023),('2023-06-01',202322,6,2023,1,22,202306,2023),('2023-06-02',202322,6,2023,2,22,202306,2023),('2023-06-03',202322,6,2023,3,22,202306,2023),('2023-06-04',202323,6,2023,4,23,202306,2023),('2023-06-05',202323,6,2023,5,23,202306,2023),('2023-06-06',202323,6,2023,6,23,202306,2023),('2023-06-07',202323,6,2023,7,23,202306,2023),('2023-06-08',202323,6,2023,8,23,202306,2023),('2023-06-09',202323,6,2023,9,23,202306,2023),('2023-06-10',202323,6,2023,10,23,202306,2023),('2023-06-11',202324,6,2023,11,24,202306,2023),('2023-06-12',202324,6,2023,12,24,202306,2023),('2023-06-13',202324,6,2023,13,24,202306,2023),('2023-06-14',202324,6,2023,14,24,202306,2023),('2023-06-15',202324,6,2023,15,24,202306,2023),('2023-06-16',202324,6,2023,16,24,202306,2023),('2023-06-17',202324,6,2023,17,24,202306,2023),('2023-06-18',202325,6,2023,18,25,202306,2023),('2023-06-19',202325,6,2023,19,25,202306,2023),('2023-06-20',202325,6,2023,20,25,202306,2023),('2023-06-21',202325,6,2023,21,25,202306,2023),('2023-06-22',202325,6,2023,22,25,202306,2023),('2023-06-23',202325,6,2023,23,25,202306,2023),('2023-06-24',202325,6,2023,24,25,202306,2023),('2023-06-25',202326,6,2023,25,26,202306,2023),('2023-06-26',202326,6,2023,26,26,202306,2023),('2023-06-27',202326,6,2023,27,26,202306,2023),('2023-06-28',202326,6,2023,28,26,202306,2023),('2023-06-29',202326,6,2023,29,26,202306,2023),('2023-06-30',202326,6,2023,30,26,202306,2023),('2023-07-01',202326,7,2023,1,26,202307,2023),('2023-07-02',202327,7,2023,2,27,202307,2023),('2023-07-03',202327,7,2023,3,27,202307,2023),('2023-07-04',202327,7,2023,4,27,202307,2023),('2023-07-05',202327,7,2023,5,27,202307,2023),('2023-07-06',202327,7,2023,6,27,202307,2023),('2023-07-07',202327,7,2023,7,27,202307,2023),('2023-07-08',202327,7,2023,8,27,202307,2023),('2023-07-09',202328,7,2023,9,28,202307,2023),('2023-07-10',202328,7,2023,10,28,202307,2023),('2023-07-11',202328,7,2023,11,28,202307,2023),('2023-07-12',202328,7,2023,12,28,202307,2023),('2023-07-13',202328,7,2023,13,28,202307,2023),('2023-07-14',202328,7,2023,14,28,202307,2023),('2023-07-15',202328,7,2023,15,28,202307,2023),('2023-07-16',202329,7,2023,16,29,202307,2023),('2023-07-17',202329,7,2023,17,29,202307,2023),('2023-07-18',202329,7,2023,18,29,202307,2023),('2023-07-19',202329,7,2023,19,29,202307,2023),('2023-07-20',202329,7,2023,20,29,202307,2023),('2023-07-21',202329,7,2023,21,29,202307,2023),('2023-07-22',202329,7,2023,22,29,202307,2023),('2023-07-23',202330,7,2023,23,30,202307,2023),('2023-07-24',202330,7,2023,24,30,202307,2023),('2023-07-25',202330,7,2023,25,30,202307,2023),('2023-07-26',202330,7,2023,26,30,202307,2023),('2023-07-27',202330,7,2023,27,30,202307,2023),('2023-07-28',202330,7,2023,28,30,202307,2023),('2023-07-29',202330,7,2023,29,30,202307,2023),('2023-07-30',202331,7,2023,30,31,202307,2023),('2023-07-31',202331,7,2023,31,31,202307,2023),('2023-08-01',202331,8,2023,1,31,202308,2023),('2023-08-02',202331,8,2023,2,31,202308,2023),('2023-08-03',202331,8,2023,3,31,202308,2023),('2023-08-04',202331,8,2023,4,31,202308,2023),('2023-08-05',202331,8,2023,5,31,202308,2023),('2023-08-06',202332,8,2023,6,32,202308,2023),('2023-08-07',202332,8,2023,7,32,202308,2023),('2023-08-08',202332,8,2023,8,32,202308,2023),('2023-08-09',202332,8,2023,9,32,202308,2023),('2023-08-10',202332,8,2023,10,32,202308,2023),('2023-08-11',202332,8,2023,11,32,202308,2023),('2023-08-12',202332,8,2023,12,32,202308,2023),('2023-08-13',202333,8,2023,13,33,202308,2023),('2023-08-14',202333,8,2023,14,33,202308,2023),('2023-08-15',202333,8,2023,15,33,202308,2023),('2023-08-16',202333,8,2023,16,33,202308,2023),('2023-08-17',202333,8,2023,17,33,202308,2023),('2023-08-18',202333,8,2023,18,33,202308,2023),('2023-08-19',202333,8,2023,19,33,202308,2023),('2023-08-20',202334,8,2023,20,34,202308,2023),('2023-08-21',202334,8,2023,21,34,202308,2023),('2023-08-22',202334,8,2023,22,34,202308,2023),('2023-08-23',202334,8,2023,23,34,202308,2023),('2023-08-24',202334,8,2023,24,34,202308,2023),('2023-08-25',202334,8,2023,25,34,202308,2023),('2023-08-26',202334,8,2023,26,34,202308,2023),('2023-08-27',202335,8,2023,27,35,202308,2023),('2023-08-28',202335,8,2023,28,35,202308,2023),('2023-08-29',202335,8,2023,29,35,202308,2023),('2023-08-30',202335,8,2023,30,35,202308,2023),('2023-08-31',202335,8,2023,31,35,202308,2023),('2023-09-01',202335,9,2023,1,35,202309,2023),('2023-09-02',202335,9,2023,2,35,202309,2023),('2023-09-03',202336,9,2023,3,36,202309,2023),('2023-09-04',202336,9,2023,4,36,202309,2023),('2023-09-05',202336,9,2023,5,36,202309,2023),('2023-09-06',202336,9,2023,6,36,202309,2023),('2023-09-07',202336,9,2023,7,36,202309,2023),('2023-09-08',202336,9,2023,8,36,202309,2023),('2023-09-09',202336,9,2023,9,36,202309,2023),('2023-09-10',202337,9,2023,10,37,202309,2023),('2023-09-11',202337,9,2023,11,37,202309,2023),('2023-09-12',202337,9,2023,12,37,202309,2023),('2023-09-13',202337,9,2023,13,37,202309,2023),('2023-09-14',202337,9,2023,14,37,202309,2023),('2023-09-15',202337,9,2023,15,37,202309,2023),('2023-09-16',202337,9,2023,16,37,202309,2023),('2023-09-17',202338,9,2023,17,38,202309,2023),('2023-09-18',202338,9,2023,18,38,202309,2023),('2023-09-19',202338,9,2023,19,38,202309,2023),('2023-09-20',202338,9,2023,20,38,202309,2023),('2023-09-21',202338,9,2023,21,38,202309,2023),('2023-09-22',202338,9,2023,22,38,202309,2023),('2023-09-23',202338,9,2023,23,38,202309,2023),('2023-09-24',202339,9,2023,24,39,202309,2023),('2023-09-25',202339,9,2023,25,39,202309,2023),('2023-09-26',202339,9,2023,26,39,202309,2023),('2023-09-27',202339,9,2023,27,39,202309,2023),('2023-09-28',202339,9,2023,28,39,202309,2023),('2023-09-29',202339,9,2023,29,39,202309,2023),('2023-09-30',202339,9,2023,30,39,202309,2023),('2023-10-01',202340,10,2023,1,40,202310,2023),('2023-10-02',202340,10,2023,2,40,202310,2023),('2023-10-03',202340,10,2023,3,40,202310,2023),('2023-10-04',202340,10,2023,4,40,202310,2023),('2023-10-05',202340,10,2023,5,40,202310,2023),('2023-10-06',202340,10,2023,6,40,202310,2023),('2023-10-07',202340,10,2023,7,40,202310,2023),('2023-10-08',202341,10,2023,8,41,202310,2023),('2023-10-09',202341,10,2023,9,41,202310,2023),('2023-10-10',202341,10,2023,10,41,202310,2023),('2023-10-11',202341,10,2023,11,41,202310,2023),('2023-10-12',202341,10,2023,12,41,202310,2023),('2023-10-13',202341,10,2023,13,41,202310,2023),('2023-10-14',202341,10,2023,14,41,202310,2023),('2023-10-15',202342,10,2023,15,42,202310,2023),('2023-10-16',202342,10,2023,16,42,202310,2023),('2023-10-17',202342,10,2023,17,42,202310,2023),('2023-10-18',202342,10,2023,18,42,202310,2023),('2023-10-19',202342,10,2023,19,42,202310,2023),('2023-10-20',202342,10,2023,20,42,202310,2023),('2023-10-21',202342,10,2023,21,42,202310,2023),('2023-10-22',202343,10,2023,22,43,202310,2023),('2023-10-23',202343,10,2023,23,43,202310,2023),('2023-10-24',202343,10,2023,24,43,202310,2023),('2023-10-25',202343,10,2023,25,43,202310,2023),('2023-10-26',202343,10,2023,26,43,202310,2023),('2023-10-27',202343,10,2023,27,43,202310,2023),('2023-10-28',202343,10,2023,28,43,202310,2023),('2023-10-29',202344,10,2023,29,44,202310,2023),('2023-10-30',202344,10,2023,30,44,202310,2023),('2023-10-31',202344,10,2023,31,44,202310,2023),('2023-11-01',202344,11,2023,1,44,202311,2023),('2023-11-02',202344,11,2023,2,44,202311,2023),('2023-11-03',202344,11,2023,3,44,202311,2023),('2023-11-04',202344,11,2023,4,44,202311,2023),('2023-11-05',202345,11,2023,5,45,202311,2023),('2023-11-06',202345,11,2023,6,45,202311,2023),('2023-11-07',202345,11,2023,7,45,202311,2023),('2023-11-08',202345,11,2023,8,45,202311,2023),('2023-11-09',202345,11,2023,9,45,202311,2023),('2023-11-10',202345,11,2023,10,45,202311,2023),('2023-11-11',202345,11,2023,11,45,202311,2023),('2023-11-12',202346,11,2023,12,46,202311,2023),('2023-11-13',202346,11,2023,13,46,202311,2023),('2023-11-14',202346,11,2023,14,46,202311,2023),('2023-11-15',202346,11,2023,15,46,202311,2023),('2023-11-16',202346,11,2023,16,46,202311,2023),('2023-11-17',202346,11,2023,17,46,202311,2023),('2023-11-18',202346,11,2023,18,46,202311,2023),('2023-11-19',202347,11,2023,19,47,202311,2023),('2023-11-20',202347,11,2023,20,47,202311,2023),('2023-11-21',202347,11,2023,21,47,202311,2023),('2023-11-22',202347,11,2023,22,47,202311,2023),('2023-11-23',202347,11,2023,23,47,202311,2023),('2023-11-24',202347,11,2023,24,47,202311,2023),('2023-11-25',202347,11,2023,25,47,202311,2023),('2023-11-26',202348,11,2023,26,48,202311,2023),('2023-11-27',202348,11,2023,27,48,202311,2023),('2023-11-28',202348,11,2023,28,48,202311,2023),('2023-11-29',202348,11,2023,29,48,202311,2023),('2023-11-30',202348,11,2023,30,48,202311,2023),('2023-12-01',202348,12,2023,1,48,202312,2024),('2023-12-02',202348,12,2023,2,48,202312,2024),('2023-12-03',202349,12,2023,3,49,202312,2024),('2023-12-04',202349,12,2023,4,49,202312,2024),('2023-12-05',202349,12,2023,5,49,202312,2024),('2023-12-06',202349,12,2023,6,49,202312,2024),('2023-12-07',202349,12,2023,7,49,202312,2024),('2023-12-08',202349,12,2023,8,49,202312,2024),('2023-12-09',202349,12,2023,9,49,202312,2024),('2023-12-10',202350,12,2023,10,50,202312,2024),('2023-12-11',202350,12,2023,11,50,202312,2024),('2023-12-12',202350,12,2023,12,50,202312,2024),('2023-12-13',202350,12,2023,13,50,202312,2024),('2023-12-14',202350,12,2023,14,50,202312,2024),('2023-12-15',202350,12,2023,15,50,202312,2024),('2023-12-16',202350,12,2023,16,50,202312,2024),('2023-12-17',202351,12,2023,17,51,202312,2024),('2023-12-18',202351,12,2023,18,51,202312,2024),('2023-12-19',202351,12,2023,19,51,202312,2024),('2023-12-20',202351,12,2023,20,51,202312,2024),('2023-12-21',202351,12,2023,21,51,202312,2024),('2023-12-22',202351,12,2023,22,51,202312,2024),('2023-12-23',202351,12,2023,23,51,202312,2024),('2023-12-24',202352,12,2023,24,52,202312,2024),('2023-12-25',202352,12,2023,25,52,202312,2024),('2023-12-26',202352,12,2023,26,52,202312,2024),('2023-12-27',202352,12,2023,27,52,202312,2024),('2023-12-28',202352,12,2023,28,52,202312,2024),('2023-12-29',202352,12,2023,29,52,202312,2024),('2023-12-30',202352,12,2023,30,52,202312,2024),('2023-12-31',202353,12,2023,31,53,202312,2024),('2024-01-01',202401,1,2024,1,1,202401,2024),('2024-01-02',202401,1,2024,2,1,202401,2024),('2024-01-03',202401,1,2024,3,1,202401,2024),('2024-01-04',202401,1,2024,4,1,202401,2024),('2024-01-05',202401,1,2024,5,1,202401,2024),('2024-01-06',202401,1,2024,6,1,202401,2024),('2024-01-07',202402,1,2024,7,2,202401,2024),('2024-01-08',202402,1,2024,8,2,202401,2024),('2024-01-09',202402,1,2024,9,2,202401,2024),('2024-01-10',202402,1,2024,10,2,202401,2024),('2024-01-11',202402,1,2024,11,2,202401,2024),('2024-01-12',202402,1,2024,12,2,202401,2024),('2024-01-13',202402,1,2024,13,2,202401,2024),('2024-01-14',202403,1,2024,14,3,202401,2024),('2024-01-15',202403,1,2024,15,3,202401,2024),('2024-01-16',202403,1,2024,16,3,202401,2024),('2024-01-17',202403,1,2024,17,3,202401,2024),('2024-01-18',202403,1,2024,18,3,202401,2024),('2024-01-19',202403,1,2024,19,3,202401,2024),('2024-01-20',202403,1,2024,20,3,202401,2024),('2024-01-21',202404,1,2024,21,4,202401,2024),('2024-01-22',202404,1,2024,22,4,202401,2024),('2024-01-23',202404,1,2024,23,4,202401,2024),('2024-01-24',202404,1,2024,24,4,202401,2024),('2024-01-25',202404,1,2024,25,4,202401,2024),('2024-01-26',202404,1,2024,26,4,202401,2024),('2024-01-27',202404,1,2024,27,4,202401,2024),('2024-01-28',202405,1,2024,28,5,202401,2024),('2024-01-29',202405,1,2024,29,5,202401,2024),('2024-01-30',202405,1,2024,30,5,202401,2024),('2024-01-31',202405,1,2024,31,5,202401,2024),('2024-02-01',202405,2,2024,1,5,202402,2024),('2024-02-02',202405,2,2024,2,5,202402,2024),('2024-02-03',202405,2,2024,3,5,202402,2024),('2024-02-04',202406,2,2024,4,6,202402,2024),('2024-02-05',202406,2,2024,5,6,202402,2024),('2024-02-06',202406,2,2024,6,6,202402,2024),('2024-02-07',202406,2,2024,7,6,202402,2024),('2024-02-08',202406,2,2024,8,6,202402,2024),('2024-02-09',202406,2,2024,9,6,202402,2024),('2024-02-10',202406,2,2024,10,6,202402,2024),('2024-02-11',202407,2,2024,11,7,202402,2024),('2024-02-12',202407,2,2024,12,7,202402,2024),('2024-02-13',202407,2,2024,13,7,202402,2024),('2024-02-14',202407,2,2024,14,7,202402,2024),('2024-02-15',202407,2,2024,15,7,202402,2024),('2024-02-16',202407,2,2024,16,7,202402,2024),('2024-02-17',202407,2,2024,17,7,202402,2024),('2024-02-18',202408,2,2024,18,8,202402,2024),('2024-02-19',202408,2,2024,19,8,202402,2024),('2024-02-20',202408,2,2024,20,8,202402,2024),('2024-02-21',202408,2,2024,21,8,202402,2024),('2024-02-22',202408,2,2024,22,8,202402,2024),('2024-02-23',202408,2,2024,23,8,202402,2024),('2024-02-24',202408,2,2024,24,8,202402,2024),('2024-02-25',202409,2,2024,25,9,202402,2024),('2024-02-26',202409,2,2024,26,9,202402,2024),('2024-02-27',202409,2,2024,27,9,202402,2024),('2024-02-28',202409,2,2024,28,9,202402,2024),('2024-02-29',202409,2,2024,29,9,202402,2024),('2024-03-01',202409,3,2024,1,9,202403,2024),('2024-03-02',202409,3,2024,2,9,202403,2024),('2024-03-03',202410,3,2024,3,10,202403,2024),('2024-03-04',202410,3,2024,4,10,202403,2024),('2024-03-05',202410,3,2024,5,10,202403,2024),('2024-03-06',202410,3,2024,6,10,202403,2024),('2024-03-07',202410,3,2024,7,10,202403,2024),('2024-03-08',202410,3,2024,8,10,202403,2024),('2024-03-09',202410,3,2024,9,10,202403,2024),('2024-03-10',202411,3,2024,10,11,202403,2024),('2024-03-11',202411,3,2024,11,11,202403,2024),('2024-03-12',202411,3,2024,12,11,202403,2024),('2024-03-13',202411,3,2024,13,11,202403,2024),('2024-03-14',202411,3,2024,14,11,202403,2024),('2024-03-15',202411,3,2024,15,11,202403,2024),('2024-03-16',202411,3,2024,16,11,202403,2024),('2024-03-17',202412,3,2024,17,12,202403,2024),('2024-03-18',202412,3,2024,18,12,202403,2024),('2024-03-19',202412,3,2024,19,12,202403,2024),('2024-03-20',202412,3,2024,20,12,202403,2024),('2024-03-21',202412,3,2024,21,12,202403,2024),('2024-03-22',202412,3,2024,22,12,202403,2024),('2024-03-23',202412,3,2024,23,12,202403,2024),('2024-03-24',202413,3,2024,24,13,202403,2024),('2024-03-25',202413,3,2024,25,13,202403,2024),('2024-03-26',202413,3,2024,26,13,202403,2024),('2024-03-27',202413,3,2024,27,13,202403,2024),('2024-03-28',202413,3,2024,28,13,202403,2024),('2024-03-29',202413,3,2024,29,13,202403,2024),('2024-03-30',202413,3,2024,30,13,202403,2024),('2024-03-31',202414,3,2024,31,14,202403,2024),('2024-04-01',202414,4,2024,1,14,202404,2024),('2024-04-02',202414,4,2024,2,14,202404,2024),('2024-04-03',202414,4,2024,3,14,202404,2024),('2024-04-04',202414,4,2024,4,14,202404,2024),('2024-04-05',202414,4,2024,5,14,202404,2024),('2024-04-06',202414,4,2024,6,14,202404,2024),('2024-04-07',202415,4,2024,7,15,202404,2024),('2024-04-08',202415,4,2024,8,15,202404,2024),('2024-04-09',202415,4,2024,9,15,202404,2024),('2024-04-10',202415,4,2024,10,15,202404,2024),('2024-04-11',202415,4,2024,11,15,202404,2024),('2024-04-12',202415,4,2024,12,15,202404,2024),('2024-04-13',202415,4,2024,13,15,202404,2024),('2024-04-14',202416,4,2024,14,16,202404,2024),('2024-04-15',202416,4,2024,15,16,202404,2024),('2024-04-16',202416,4,2024,16,16,202404,2024),('2024-04-17',202416,4,2024,17,16,202404,2024),('2024-04-18',202416,4,2024,18,16,202404,2024),('2024-04-19',202416,4,2024,19,16,202404,2024),('2024-04-20',202416,4,2024,20,16,202404,2024),('2024-04-21',202417,4,2024,21,17,202404,2024),('2024-04-22',202417,4,2024,22,17,202404,2024),('2024-04-23',202417,4,2024,23,17,202404,2024),('2024-04-24',202417,4,2024,24,17,202404,2024),('2024-04-25',202417,4,2024,25,17,202404,2024),('2024-04-26',202417,4,2024,26,17,202404,2024),('2024-04-27',202417,4,2024,27,17,202404,2024),('2024-04-28',202418,4,2024,28,18,202404,2024),('2024-04-29',202418,4,2024,29,18,202404,2024),('2024-04-30',202418,4,2024,30,18,202404,2024),('2024-05-01',202418,5,2024,1,18,202405,2024),('2024-05-02',202418,5,2024,2,18,202405,2024),('2024-05-03',202418,5,2024,3,18,202405,2024),('2024-05-04',202418,5,2024,4,18,202405,2024),('2024-05-05',202419,5,2024,5,19,202405,2024),('2024-05-06',202419,5,2024,6,19,202405,2024),('2024-05-07',202419,5,2024,7,19,202405,2024),('2024-05-08',202419,5,2024,8,19,202405,2024),('2024-05-09',202419,5,2024,9,19,202405,2024),('2024-05-10',202419,5,2024,10,19,202405,2024),('2024-05-11',202419,5,2024,11,19,202405,2024),('2024-05-12',202420,5,2024,12,20,202405,2024),('2024-05-13',202420,5,2024,13,20,202405,2024),('2024-05-14',202420,5,2024,14,20,202405,2024),('2024-05-15',202420,5,2024,15,20,202405,2024),('2024-05-16',202420,5,2024,16,20,202405,2024),('2024-05-17',202420,5,2024,17,20,202405,2024),('2024-05-18',202420,5,2024,18,20,202405,2024),('2024-05-19',202421,5,2024,19,21,202405,2024),('2024-05-20',202421,5,2024,20,21,202405,2024),('2024-05-21',202421,5,2024,21,21,202405,2024),('2024-05-22',202421,5,2024,22,21,202405,2024),('2024-05-23',202421,5,2024,23,21,202405,2024),('2024-05-24',202421,5,2024,24,21,202405,2024),('2024-05-25',202421,5,2024,25,21,202405,2024),('2024-05-26',202422,5,2024,26,22,202405,2024),('2024-05-27',202422,5,2024,27,22,202405,2024),('2024-05-28',202422,5,2024,28,22,202405,2024),('2024-05-29',202422,5,2024,29,22,202405,2024),('2024-05-30',202422,5,2024,30,22,202405,2024),('2024-05-31',202422,5,2024,31,22,202405,2024),('2024-06-01',202422,6,2024,1,22,202406,2024),('2024-06-02',202423,6,2024,2,23,202406,2024),('2024-06-03',202423,6,2024,3,23,202406,2024),('2024-06-04',202423,6,2024,4,23,202406,2024),('2024-06-05',202423,6,2024,5,23,202406,2024),('2024-06-06',202423,6,2024,6,23,202406,2024),('2024-06-07',202423,6,2024,7,23,202406,2024),('2024-06-08',202423,6,2024,8,23,202406,2024),('2024-06-09',202424,6,2024,9,24,202406,2024),('2024-06-10',202424,6,2024,10,24,202406,2024),('2024-06-11',202424,6,2024,11,24,202406,2024),('2024-06-12',202424,6,2024,12,24,202406,2024),('2024-06-13',202424,6,2024,13,24,202406,2024),('2024-06-14',202424,6,2024,14,24,202406,2024),('2024-06-15',202424,6,2024,15,24,202406,2024),('2024-06-16',202425,6,2024,16,25,202406,2024),('2024-06-17',202425,6,2024,17,25,202406,2024),('2024-06-18',202425,6,2024,18,25,202406,2024),('2024-06-19',202425,6,2024,19,25,202406,2024),('2024-06-20',202425,6,2024,20,25,202406,2024),('2024-06-21',202425,6,2024,21,25,202406,2024),('2024-06-22',202425,6,2024,22,25,202406,2024),('2024-06-23',202426,6,2024,23,26,202406,2024),('2024-06-24',202426,6,2024,24,26,202406,2024),('2024-06-25',202426,6,2024,25,26,202406,2024),('2024-06-26',202426,6,2024,26,26,202406,2024),('2024-06-27',202426,6,2024,27,26,202406,2024),('2024-06-28',202426,6,2024,28,26,202406,2024),('2024-06-29',202426,6,2024,29,26,202406,2024),('2024-06-30',202427,6,2024,30,27,202406,2024),('2024-07-01',202427,7,2024,1,27,202407,2024),('2024-07-02',202427,7,2024,2,27,202407,2024),('2024-07-03',202427,7,2024,3,27,202407,2024),('2024-07-04',202427,7,2024,4,27,202407,2024),('2024-07-05',202427,7,2024,5,27,202407,2024),('2024-07-06',202427,7,2024,6,27,202407,2024),('2024-07-07',202428,7,2024,7,28,202407,2024),('2024-07-08',202428,7,2024,8,28,202407,2024),('2024-07-09',202428,7,2024,9,28,202407,2024),('2024-07-10',202428,7,2024,10,28,202407,2024),('2024-07-11',202428,7,2024,11,28,202407,2024),('2024-07-12',202428,7,2024,12,28,202407,2024),('2024-07-13',202428,7,2024,13,28,202407,2024),('2024-07-14',202429,7,2024,14,29,202407,2024),('2024-07-15',202429,7,2024,15,29,202407,2024),('2024-07-16',202429,7,2024,16,29,202407,2024),('2024-07-17',202429,7,2024,17,29,202407,2024),('2024-07-18',202429,7,2024,18,29,202407,2024),('2024-07-19',202429,7,2024,19,29,202407,2024),('2024-07-20',202429,7,2024,20,29,202407,2024),('2024-07-21',202430,7,2024,21,30,202407,2024),('2024-07-22',202430,7,2024,22,30,202407,2024),('2024-07-23',202430,7,2024,23,30,202407,2024),('2024-07-24',202430,7,2024,24,30,202407,2024),('2024-07-25',202430,7,2024,25,30,202407,2024),('2024-07-26',202430,7,2024,26,30,202407,2024),('2024-07-27',202430,7,2024,27,30,202407,2024),('2024-07-28',202431,7,2024,28,31,202407,2024),('2024-07-29',202431,7,2024,29,31,202407,2024),('2024-07-30',202431,7,2024,30,31,202407,2024),('2024-07-31',202431,7,2024,31,31,202407,2024),('2024-08-01',202431,8,2024,1,31,202408,2024),('2024-08-02',202431,8,2024,2,31,202408,2024),('2024-08-03',202431,8,2024,3,31,202408,2024),('2024-08-04',202432,8,2024,4,32,202408,2024),('2024-08-05',202432,8,2024,5,32,202408,2024),('2024-08-06',202432,8,2024,6,32,202408,2024),('2024-08-07',202432,8,2024,7,32,202408,2024),('2024-08-08',202432,8,2024,8,32,202408,2024),('2024-08-09',202432,8,2024,9,32,202408,2024),('2024-08-10',202432,8,2024,10,32,202408,2024),('2024-08-11',202433,8,2024,11,33,202408,2024),('2024-08-12',202433,8,2024,12,33,202408,2024),('2024-08-13',202433,8,2024,13,33,202408,2024),('2024-08-14',202433,8,2024,14,33,202408,2024),('2024-08-15',202433,8,2024,15,33,202408,2024),('2024-08-16',202433,8,2024,16,33,202408,2024),('2024-08-17',202433,8,2024,17,33,202408,2024),('2024-08-18',202434,8,2024,18,34,202408,2024),('2024-08-19',202434,8,2024,19,34,202408,2024),('2024-08-20',202434,8,2024,20,34,202408,2024),('2024-08-21',202434,8,2024,21,34,202408,2024),('2024-08-22',202434,8,2024,22,34,202408,2024),('2024-08-23',202434,8,2024,23,34,202408,2024),('2024-08-24',202434,8,2024,24,34,202408,2024),('2024-08-25',202435,8,2024,25,35,202408,2024),('2024-08-26',202435,8,2024,26,35,202408,2024),('2024-08-27',202435,8,2024,27,35,202408,2024),('2024-08-28',202435,8,2024,28,35,202408,2024),('2024-08-29',202435,8,2024,29,35,202408,2024),('2024-08-30',202435,8,2024,30,35,202408,2024),('2024-08-31',202435,8,2024,31,35,202408,2024),('2024-09-01',202436,9,2024,1,36,202409,2024),('2024-09-02',202436,9,2024,2,36,202409,2024),('2024-09-03',202436,9,2024,3,36,202409,2024),('2024-09-04',202436,9,2024,4,36,202409,2024),('2024-09-05',202436,9,2024,5,36,202409,2024),('2024-09-06',202436,9,2024,6,36,202409,2024),('2024-09-07',202436,9,2024,7,36,202409,2024),('2024-09-08',202437,9,2024,8,37,202409,2024),('2024-09-09',202437,9,2024,9,37,202409,2024),('2024-09-10',202437,9,2024,10,37,202409,2024),('2024-09-11',202437,9,2024,11,37,202409,2024),('2024-09-12',202437,9,2024,12,37,202409,2024),('2024-09-13',202437,9,2024,13,37,202409,2024),('2024-09-14',202437,9,2024,14,37,202409,2024),('2024-09-15',202438,9,2024,15,38,202409,2024),('2024-09-16',202438,9,2024,16,38,202409,2024),('2024-09-17',202438,9,2024,17,38,202409,2024),('2024-09-18',202438,9,2024,18,38,202409,2024),('2024-09-19',202438,9,2024,19,38,202409,2024),('2024-09-20',202438,9,2024,20,38,202409,2024),('2024-09-21',202438,9,2024,21,38,202409,2024),('2024-09-22',202439,9,2024,22,39,202409,2024),('2024-09-23',202439,9,2024,23,39,202409,2024),('2024-09-24',202439,9,2024,24,39,202409,2024),('2024-09-25',202439,9,2024,25,39,202409,2024),('2024-09-26',202439,9,2024,26,39,202409,2024),('2024-09-27',202439,9,2024,27,39,202409,2024),('2024-09-28',202439,9,2024,28,39,202409,2024),('2024-09-29',202440,9,2024,29,40,202409,2024),('2024-09-30',202440,9,2024,30,40,202409,2024),('2024-10-01',202440,10,2024,1,40,202410,2024),('2024-10-02',202440,10,2024,2,40,202410,2024),('2024-10-03',202440,10,2024,3,40,202410,2024),('2024-10-04',202440,10,2024,4,40,202410,2024),('2024-10-05',202440,10,2024,5,40,202410,2024),('2024-10-06',202441,10,2024,6,41,202410,2024),('2024-10-07',202441,10,2024,7,41,202410,2024),('2024-10-08',202441,10,2024,8,41,202410,2024),('2024-10-09',202441,10,2024,9,41,202410,2024),('2024-10-10',202441,10,2024,10,41,202410,2024),('2024-10-11',202441,10,2024,11,41,202410,2024),('2024-10-12',202441,10,2024,12,41,202410,2024),('2024-10-13',202442,10,2024,13,42,202410,2024),('2024-10-14',202442,10,2024,14,42,202410,2024),('2024-10-15',202442,10,2024,15,42,202410,2024),('2024-10-16',202442,10,2024,16,42,202410,2024),('2024-10-17',202442,10,2024,17,42,202410,2024),('2024-10-18',202442,10,2024,18,42,202410,2024),('2024-10-19',202442,10,2024,19,42,202410,2024),('2024-10-20',202443,10,2024,20,43,202410,2024),('2024-10-21',202443,10,2024,21,43,202410,2024),('2024-10-22',202443,10,2024,22,43,202410,2024),('2024-10-23',202443,10,2024,23,43,202410,2024),('2024-10-24',202443,10,2024,24,43,202410,2024),('2024-10-25',202443,10,2024,25,43,202410,2024),('2024-10-26',202443,10,2024,26,43,202410,2024),('2024-10-27',202444,10,2024,27,44,202410,2024),('2024-10-28',202444,10,2024,28,44,202410,2024),('2024-10-29',202444,10,2024,29,44,202410,2024),('2024-10-30',202444,10,2024,30,44,202410,2024),('2024-10-31',202444,10,2024,31,44,202410,2024),('2024-11-01',202444,11,2024,1,44,202411,2024),('2024-11-02',202444,11,2024,2,44,202411,2024),('2024-11-03',202445,11,2024,3,45,202411,2024),('2024-11-04',202445,11,2024,4,45,202411,2024),('2024-11-05',202445,11,2024,5,45,202411,2024),('2024-11-06',202445,11,2024,6,45,202411,2024),('2024-11-07',202445,11,2024,7,45,202411,2024),('2024-11-08',202445,11,2024,8,45,202411,2024),('2024-11-09',202445,11,2024,9,45,202411,2024),('2024-11-10',202446,11,2024,10,46,202411,2024),('2024-11-11',202446,11,2024,11,46,202411,2024),('2024-11-12',202446,11,2024,12,46,202411,2024),('2024-11-13',202446,11,2024,13,46,202411,2024),('2024-11-14',202446,11,2024,14,46,202411,2024),('2024-11-15',202446,11,2024,15,46,202411,2024),('2024-11-16',202446,11,2024,16,46,202411,2024),('2024-11-17',202447,11,2024,17,47,202411,2024),('2024-11-18',202447,11,2024,18,47,202411,2024),('2024-11-19',202447,11,2024,19,47,202411,2024),('2024-11-20',202447,11,2024,20,47,202411,2024),('2024-11-21',202447,11,2024,21,47,202411,2024),('2024-11-22',202447,11,2024,22,47,202411,2024),('2024-11-23',202447,11,2024,23,47,202411,2024),('2024-11-24',202448,11,2024,24,48,202411,2024),('2024-11-25',202448,11,2024,25,48,202411,2024),('2024-11-26',202448,11,2024,26,48,202411,2024),('2024-11-27',202448,11,2024,27,48,202411,2024),('2024-11-28',202448,11,2024,28,48,202411,2024),('2024-11-29',202448,11,2024,29,48,202411,2024),('2024-11-30',202448,11,2024,30,48,202411,2024),('2024-12-01',202449,12,2024,1,49,202412,2025),('2024-12-02',202449,12,2024,2,49,202412,2025),('2024-12-03',202449,12,2024,3,49,202412,2025),('2024-12-04',202449,12,2024,4,49,202412,2025),('2024-12-05',202449,12,2024,5,49,202412,2025),('2024-12-06',202449,12,2024,6,49,202412,2025),('2024-12-07',202449,12,2024,7,49,202412,2025),('2024-12-08',202450,12,2024,8,50,202412,2025),('2024-12-09',202450,12,2024,9,50,202412,2025),('2024-12-10',202450,12,2024,10,50,202412,2025),('2024-12-11',202450,12,2024,11,50,202412,2025),('2024-12-12',202450,12,2024,12,50,202412,2025),('2024-12-13',202450,12,2024,13,50,202412,2025),('2024-12-14',202450,12,2024,14,50,202412,2025),('2024-12-15',202451,12,2024,15,51,202412,2025),('2024-12-16',202451,12,2024,16,51,202412,2025),('2024-12-17',202451,12,2024,17,51,202412,2025),('2024-12-18',202451,12,2024,18,51,202412,2025),('2024-12-19',202451,12,2024,19,51,202412,2025),('2024-12-20',202451,12,2024,20,51,202412,2025),('2024-12-21',202451,12,2024,21,51,202412,2025),('2024-12-22',202452,12,2024,22,52,202412,2025),('2024-12-23',202452,12,2024,23,52,202412,2025),('2024-12-24',202452,12,2024,24,52,202412,2025),('2024-12-25',202452,12,2024,25,52,202412,2025),('2024-12-26',202452,12,2024,26,52,202412,2025),('2024-12-27',202452,12,2024,27,52,202412,2025),('2024-12-28',202452,12,2024,28,52,202412,2025),('2024-12-29',202453,12,2024,29,1,202412,2025),('2024-12-30',202401,12,2024,30,1,202412,2025),('2024-12-31',202401,12,2024,31,1,202412,2025),('2025-01-01',202501,1,2025,1,1,202501,2025),('2025-01-02',202501,1,2025,2,1,202501,2025),('2025-01-03',202501,1,2025,3,1,202501,2025),('2025-01-04',202501,1,2025,4,1,202501,2025),('2025-01-05',202502,1,2025,5,2,202501,2025),('2025-01-06',202502,1,2025,6,2,202501,2025),('2025-01-07',202502,1,2025,7,2,202501,2025),('2025-01-08',202502,1,2025,8,2,202501,2025),('2025-01-09',202502,1,2025,9,2,202501,2025),('2025-01-10',202502,1,2025,10,2,202501,2025),('2025-01-11',202502,1,2025,11,2,202501,2025),('2025-01-12',202503,1,2025,12,3,202501,2025),('2025-01-13',202503,1,2025,13,3,202501,2025),('2025-01-14',202503,1,2025,14,3,202501,2025),('2025-01-15',202503,1,2025,15,3,202501,2025),('2025-01-16',202503,1,2025,16,3,202501,2025),('2025-01-17',202503,1,2025,17,3,202501,2025),('2025-01-18',202503,1,2025,18,3,202501,2025),('2025-01-19',202504,1,2025,19,4,202501,2025),('2025-01-20',202504,1,2025,20,4,202501,2025),('2025-01-21',202504,1,2025,21,4,202501,2025),('2025-01-22',202504,1,2025,22,4,202501,2025),('2025-01-23',202504,1,2025,23,4,202501,2025),('2025-01-24',202504,1,2025,24,4,202501,2025),('2025-01-25',202504,1,2025,25,4,202501,2025),('2025-01-26',202505,1,2025,26,5,202501,2025),('2025-01-27',202505,1,2025,27,5,202501,2025),('2025-01-28',202505,1,2025,28,5,202501,2025),('2025-01-29',202505,1,2025,29,5,202501,2025),('2025-01-30',202505,1,2025,30,5,202501,2025),('2025-01-31',202505,1,2025,31,5,202501,2025),('2025-02-01',202505,2,2025,1,5,202502,2025),('2025-02-02',202506,2,2025,2,6,202502,2025),('2025-02-03',202506,2,2025,3,6,202502,2025),('2025-02-04',202506,2,2025,4,6,202502,2025),('2025-02-05',202506,2,2025,5,6,202502,2025),('2025-02-06',202506,2,2025,6,6,202502,2025),('2025-02-07',202506,2,2025,7,6,202502,2025),('2025-02-08',202506,2,2025,8,6,202502,2025),('2025-02-09',202507,2,2025,9,7,202502,2025),('2025-02-10',202507,2,2025,10,7,202502,2025),('2025-02-11',202507,2,2025,11,7,202502,2025),('2025-02-12',202507,2,2025,12,7,202502,2025),('2025-02-13',202507,2,2025,13,7,202502,2025),('2025-02-14',202507,2,2025,14,7,202502,2025),('2025-02-15',202507,2,2025,15,7,202502,2025),('2025-02-16',202508,2,2025,16,8,202502,2025),('2025-02-17',202508,2,2025,17,8,202502,2025),('2025-02-18',202508,2,2025,18,8,202502,2025),('2025-02-19',202508,2,2025,19,8,202502,2025),('2025-02-20',202508,2,2025,20,8,202502,2025),('2025-02-21',202508,2,2025,21,8,202502,2025),('2025-02-22',202508,2,2025,22,8,202502,2025),('2025-02-23',202509,2,2025,23,9,202502,2025),('2025-02-24',202509,2,2025,24,9,202502,2025),('2025-02-25',202509,2,2025,25,9,202502,2025),('2025-02-26',202509,2,2025,26,9,202502,2025),('2025-02-27',202509,2,2025,27,9,202502,2025),('2025-02-28',202509,2,2025,28,9,202502,2025),('2025-03-01',202509,3,2025,1,9,202503,2025),('2025-03-02',202510,3,2025,2,10,202503,2025),('2025-03-03',202510,3,2025,3,10,202503,2025),('2025-03-04',202510,3,2025,4,10,202503,2025),('2025-03-05',202510,3,2025,5,10,202503,2025),('2025-03-06',202510,3,2025,6,10,202503,2025),('2025-03-07',202510,3,2025,7,10,202503,2025),('2025-03-08',202510,3,2025,8,10,202503,2025),('2025-03-09',202511,3,2025,9,11,202503,2025),('2025-03-10',202511,3,2025,10,11,202503,2025),('2025-03-11',202511,3,2025,11,11,202503,2025),('2025-03-12',202511,3,2025,12,11,202503,2025),('2025-03-13',202511,3,2025,13,11,202503,2025),('2025-03-14',202511,3,2025,14,11,202503,2025),('2025-03-15',202511,3,2025,15,11,202503,2025),('2025-03-16',202512,3,2025,16,12,202503,2025),('2025-03-17',202512,3,2025,17,12,202503,2025),('2025-03-18',202512,3,2025,18,12,202503,2025),('2025-03-19',202512,3,2025,19,12,202503,2025),('2025-03-20',202512,3,2025,20,12,202503,2025),('2025-03-21',202512,3,2025,21,12,202503,2025),('2025-03-22',202512,3,2025,22,12,202503,2025),('2025-03-23',202513,3,2025,23,13,202503,2025),('2025-03-24',202513,3,2025,24,13,202503,2025),('2025-03-25',202513,3,2025,25,13,202503,2025),('2025-03-26',202513,3,2025,26,13,202503,2025),('2025-03-27',202513,3,2025,27,13,202503,2025),('2025-03-28',202513,3,2025,28,13,202503,2025),('2025-03-29',202513,3,2025,29,13,202503,2025),('2025-03-30',202514,3,2025,30,14,202503,2025),('2025-03-31',202514,3,2025,31,14,202503,2025),('2025-04-01',202514,4,2025,1,14,202504,2025),('2025-04-02',202514,4,2025,2,14,202504,2025),('2025-04-03',202514,4,2025,3,14,202504,2025),('2025-04-04',202514,4,2025,4,14,202504,2025),('2025-04-05',202514,4,2025,5,14,202504,2025),('2025-04-06',202515,4,2025,6,15,202504,2025),('2025-04-07',202515,4,2025,7,15,202504,2025),('2025-04-08',202515,4,2025,8,15,202504,2025),('2025-04-09',202515,4,2025,9,15,202504,2025),('2025-04-10',202515,4,2025,10,15,202504,2025),('2025-04-11',202515,4,2025,11,15,202504,2025),('2025-04-12',202515,4,2025,12,15,202504,2025),('2025-04-13',202516,4,2025,13,16,202504,2025),('2025-04-14',202516,4,2025,14,16,202504,2025),('2025-04-15',202516,4,2025,15,16,202504,2025),('2025-04-16',202516,4,2025,16,16,202504,2025),('2025-04-17',202516,4,2025,17,16,202504,2025),('2025-04-18',202516,4,2025,18,16,202504,2025),('2025-04-19',202516,4,2025,19,16,202504,2025),('2025-04-20',202517,4,2025,20,17,202504,2025),('2025-04-21',202517,4,2025,21,17,202504,2025),('2025-04-22',202517,4,2025,22,17,202504,2025),('2025-04-23',202517,4,2025,23,17,202504,2025),('2025-04-24',202517,4,2025,24,17,202504,2025),('2025-04-25',202517,4,2025,25,17,202504,2025),('2025-04-26',202517,4,2025,26,17,202504,2025),('2025-04-27',202518,4,2025,27,18,202504,2025),('2025-04-28',202518,4,2025,28,18,202504,2025),('2025-04-29',202518,4,2025,29,18,202504,2025),('2025-04-30',202518,4,2025,30,18,202504,2025),('2025-05-01',202518,5,2025,1,18,202505,2025),('2025-05-02',202518,5,2025,2,18,202505,2025),('2025-05-03',202518,5,2025,3,18,202505,2025),('2025-05-04',202519,5,2025,4,19,202505,2025),('2025-05-05',202519,5,2025,5,19,202505,2025),('2025-05-06',202519,5,2025,6,19,202505,2025),('2025-05-07',202519,5,2025,7,19,202505,2025),('2025-05-08',202519,5,2025,8,19,202505,2025),('2025-05-09',202519,5,2025,9,19,202505,2025),('2025-05-10',202519,5,2025,10,19,202505,2025),('2025-05-11',202520,5,2025,11,20,202505,2025),('2025-05-12',202520,5,2025,12,20,202505,2025),('2025-05-13',202520,5,2025,13,20,202505,2025),('2025-05-14',202520,5,2025,14,20,202505,2025),('2025-05-15',202520,5,2025,15,20,202505,2025),('2025-05-16',202520,5,2025,16,20,202505,2025),('2025-05-17',202520,5,2025,17,20,202505,2025),('2025-05-18',202521,5,2025,18,21,202505,2025),('2025-05-19',202521,5,2025,19,21,202505,2025),('2025-05-20',202521,5,2025,20,21,202505,2025),('2025-05-21',202521,5,2025,21,21,202505,2025),('2025-05-22',202521,5,2025,22,21,202505,2025),('2025-05-23',202521,5,2025,23,21,202505,2025),('2025-05-24',202521,5,2025,24,21,202505,2025),('2025-05-25',202522,5,2025,25,22,202505,2025),('2025-05-26',202522,5,2025,26,22,202505,2025),('2025-05-27',202522,5,2025,27,22,202505,2025),('2025-05-28',202522,5,2025,28,22,202505,2025),('2025-05-29',202522,5,2025,29,22,202505,2025),('2025-05-30',202522,5,2025,30,22,202505,2025),('2025-05-31',202522,5,2025,31,22,202505,2025),('2025-06-01',202523,6,2025,1,23,202506,2025),('2025-06-02',202523,6,2025,2,23,202506,2025),('2025-06-03',202523,6,2025,3,23,202506,2025),('2025-06-04',202523,6,2025,4,23,202506,2025),('2025-06-05',202523,6,2025,5,23,202506,2025),('2025-06-06',202523,6,2025,6,23,202506,2025),('2025-06-07',202523,6,2025,7,23,202506,2025),('2025-06-08',202524,6,2025,8,24,202506,2025),('2025-06-09',202524,6,2025,9,24,202506,2025),('2025-06-10',202524,6,2025,10,24,202506,2025),('2025-06-11',202524,6,2025,11,24,202506,2025),('2025-06-12',202524,6,2025,12,24,202506,2025),('2025-06-13',202524,6,2025,13,24,202506,2025),('2025-06-14',202524,6,2025,14,24,202506,2025),('2025-06-15',202525,6,2025,15,25,202506,2025),('2025-06-16',202525,6,2025,16,25,202506,2025),('2025-06-17',202525,6,2025,17,25,202506,2025),('2025-06-18',202525,6,2025,18,25,202506,2025),('2025-06-19',202525,6,2025,19,25,202506,2025),('2025-06-20',202525,6,2025,20,25,202506,2025),('2025-06-21',202525,6,2025,21,25,202506,2025),('2025-06-22',202526,6,2025,22,26,202506,2025),('2025-06-23',202526,6,2025,23,26,202506,2025),('2025-06-24',202526,6,2025,24,26,202506,2025),('2025-06-25',202526,6,2025,25,26,202506,2025),('2025-06-26',202526,6,2025,26,26,202506,2025),('2025-06-27',202526,6,2025,27,26,202506,2025),('2025-06-28',202526,6,2025,28,26,202506,2025),('2025-06-29',202527,6,2025,29,27,202506,2025),('2025-06-30',202527,6,2025,30,27,202506,2025),('2025-07-01',202527,7,2025,1,27,202507,2025),('2025-07-02',202527,7,2025,2,27,202507,2025),('2025-07-03',202527,7,2025,3,27,202507,2025),('2025-07-04',202527,7,2025,4,27,202507,2025),('2025-07-05',202527,7,2025,5,27,202507,2025),('2025-07-06',202528,7,2025,6,28,202507,2025),('2025-07-07',202528,7,2025,7,28,202507,2025),('2025-07-08',202528,7,2025,8,28,202507,2025),('2025-07-09',202528,7,2025,9,28,202507,2025),('2025-07-10',202528,7,2025,10,28,202507,2025),('2025-07-11',202528,7,2025,11,28,202507,2025),('2025-07-12',202528,7,2025,12,28,202507,2025),('2025-07-13',202529,7,2025,13,29,202507,2025),('2025-07-14',202529,7,2025,14,29,202507,2025),('2025-07-15',202529,7,2025,15,29,202507,2025),('2025-07-16',202529,7,2025,16,29,202507,2025),('2025-07-17',202529,7,2025,17,29,202507,2025),('2025-07-18',202529,7,2025,18,29,202507,2025),('2025-07-19',202529,7,2025,19,29,202507,2025),('2025-07-20',202530,7,2025,20,30,202507,2025),('2025-07-21',202530,7,2025,21,30,202507,2025),('2025-07-22',202530,7,2025,22,30,202507,2025),('2025-07-23',202530,7,2025,23,30,202507,2025),('2025-07-24',202530,7,2025,24,30,202507,2025),('2025-07-25',202530,7,2025,25,30,202507,2025),('2025-07-26',202530,7,2025,26,30,202507,2025),('2025-07-27',202531,7,2025,27,31,202507,2025),('2025-07-28',202531,7,2025,28,31,202507,2025),('2025-07-29',202531,7,2025,29,31,202507,2025),('2025-07-30',202531,7,2025,30,31,202507,2025),('2025-07-31',202531,7,2025,31,31,202507,2025),('2025-08-01',202531,8,2025,1,31,202508,2025),('2025-08-02',202531,8,2025,2,31,202508,2025),('2025-08-03',202532,8,2025,3,32,202508,2025),('2025-08-04',202532,8,2025,4,32,202508,2025),('2025-08-05',202532,8,2025,5,32,202508,2025),('2025-08-06',202532,8,2025,6,32,202508,2025),('2025-08-07',202532,8,2025,7,32,202508,2025),('2025-08-08',202532,8,2025,8,32,202508,2025),('2025-08-09',202532,8,2025,9,32,202508,2025),('2025-08-10',202533,8,2025,10,33,202508,2025),('2025-08-11',202533,8,2025,11,33,202508,2025),('2025-08-12',202533,8,2025,12,33,202508,2025),('2025-08-13',202533,8,2025,13,33,202508,2025),('2025-08-14',202533,8,2025,14,33,202508,2025),('2025-08-15',202533,8,2025,15,33,202508,2025),('2025-08-16',202533,8,2025,16,33,202508,2025),('2025-08-17',202534,8,2025,17,34,202508,2025),('2025-08-18',202534,8,2025,18,34,202508,2025),('2025-08-19',202534,8,2025,19,34,202508,2025),('2025-08-20',202534,8,2025,20,34,202508,2025),('2025-08-21',202534,8,2025,21,34,202508,2025),('2025-08-22',202534,8,2025,22,34,202508,2025),('2025-08-23',202534,8,2025,23,34,202508,2025),('2025-08-24',202535,8,2025,24,35,202508,2025),('2025-08-25',202535,8,2025,25,35,202508,2025),('2025-08-26',202535,8,2025,26,35,202508,2025),('2025-08-27',202535,8,2025,27,35,202508,2025),('2025-08-28',202535,8,2025,28,35,202508,2025),('2025-08-29',202535,8,2025,29,35,202508,2025),('2025-08-30',202535,8,2025,30,35,202508,2025),('2025-08-31',202536,8,2025,31,36,202508,2025),('2025-09-01',202536,9,2025,1,36,202509,2025),('2025-09-02',202536,9,2025,2,36,202509,2025),('2025-09-03',202536,9,2025,3,36,202509,2025),('2025-09-04',202536,9,2025,4,36,202509,2025),('2025-09-05',202536,9,2025,5,36,202509,2025),('2025-09-06',202536,9,2025,6,36,202509,2025),('2025-09-07',202537,9,2025,7,37,202509,2025),('2025-09-08',202537,9,2025,8,37,202509,2025),('2025-09-09',202537,9,2025,9,37,202509,2025),('2025-09-10',202537,9,2025,10,37,202509,2025),('2025-09-11',202537,9,2025,11,37,202509,2025),('2025-09-12',202537,9,2025,12,37,202509,2025),('2025-09-13',202537,9,2025,13,37,202509,2025),('2025-09-14',202538,9,2025,14,38,202509,2025),('2025-09-15',202538,9,2025,15,38,202509,2025),('2025-09-16',202538,9,2025,16,38,202509,2025),('2025-09-17',202538,9,2025,17,38,202509,2025),('2025-09-18',202538,9,2025,18,38,202509,2025),('2025-09-19',202538,9,2025,19,38,202509,2025),('2025-09-20',202538,9,2025,20,38,202509,2025),('2025-09-21',202539,9,2025,21,39,202509,2025),('2025-09-22',202539,9,2025,22,39,202509,2025),('2025-09-23',202539,9,2025,23,39,202509,2025),('2025-09-24',202539,9,2025,24,39,202509,2025),('2025-09-25',202539,9,2025,25,39,202509,2025),('2025-09-26',202539,9,2025,26,39,202509,2025),('2025-09-27',202539,9,2025,27,39,202509,2025),('2025-09-28',202540,9,2025,28,40,202509,2025),('2025-09-29',202540,9,2025,29,40,202509,2025),('2025-09-30',202540,9,2025,30,40,202509,2025),('2025-10-01',202540,10,2025,1,40,202510,2025),('2025-10-02',202540,10,2025,2,40,202510,2025),('2025-10-03',202540,10,2025,3,40,202510,2025),('2025-10-04',202540,10,2025,4,40,202510,2025),('2025-10-05',202541,10,2025,5,41,202510,2025),('2025-10-06',202541,10,2025,6,41,202510,2025),('2025-10-07',202541,10,2025,7,41,202510,2025),('2025-10-08',202541,10,2025,8,41,202510,2025),('2025-10-09',202541,10,2025,9,41,202510,2025),('2025-10-10',202541,10,2025,10,41,202510,2025),('2025-10-11',202541,10,2025,11,41,202510,2025),('2025-10-12',202542,10,2025,12,42,202510,2025),('2025-10-13',202542,10,2025,13,42,202510,2025),('2025-10-14',202542,10,2025,14,42,202510,2025),('2025-10-15',202542,10,2025,15,42,202510,2025),('2025-10-16',202542,10,2025,16,42,202510,2025),('2025-10-17',202542,10,2025,17,42,202510,2025),('2025-10-18',202542,10,2025,18,42,202510,2025),('2025-10-19',202543,10,2025,19,43,202510,2025),('2025-10-20',202543,10,2025,20,43,202510,2025),('2025-10-21',202543,10,2025,21,43,202510,2025),('2025-10-22',202543,10,2025,22,43,202510,2025),('2025-10-23',202543,10,2025,23,43,202510,2025),('2025-10-24',202543,10,2025,24,43,202510,2025),('2025-10-25',202543,10,2025,25,43,202510,2025),('2025-10-26',202544,10,2025,26,44,202510,2025),('2025-10-27',202544,10,2025,27,44,202510,2025),('2025-10-28',202544,10,2025,28,44,202510,2025),('2025-10-29',202544,10,2025,29,44,202510,2025),('2025-10-30',202544,10,2025,30,44,202510,2025),('2025-10-31',202544,10,2025,31,44,202510,2025),('2025-11-01',202544,11,2025,1,44,202511,2025),('2025-11-02',202545,11,2025,2,45,202511,2025),('2025-11-03',202545,11,2025,3,45,202511,2025),('2025-11-04',202545,11,2025,4,45,202511,2025),('2025-11-05',202545,11,2025,5,45,202511,2025),('2025-11-06',202545,11,2025,6,45,202511,2025),('2025-11-07',202545,11,2025,7,45,202511,2025),('2025-11-08',202545,11,2025,8,45,202511,2025),('2025-11-09',202546,11,2025,9,46,202511,2025),('2025-11-10',202546,11,2025,10,46,202511,2025),('2025-11-11',202546,11,2025,11,46,202511,2025),('2025-11-12',202546,11,2025,12,46,202511,2025),('2025-11-13',202546,11,2025,13,46,202511,2025),('2025-11-14',202546,11,2025,14,46,202511,2025),('2025-11-15',202546,11,2025,15,46,202511,2025),('2025-11-16',202547,11,2025,16,47,202511,2025),('2025-11-17',202547,11,2025,17,47,202511,2025),('2025-11-18',202547,11,2025,18,47,202511,2025),('2025-11-19',202547,11,2025,19,47,202511,2025),('2025-11-20',202547,11,2025,20,47,202511,2025),('2025-11-21',202547,11,2025,21,47,202511,2025),('2025-11-22',202547,11,2025,22,47,202511,2025),('2025-11-23',202548,11,2025,23,48,202511,2025),('2025-11-24',202548,11,2025,24,48,202511,2025),('2025-11-25',202548,11,2025,25,48,202511,2025),('2025-11-26',202548,11,2025,26,48,202511,2025),('2025-11-27',202548,11,2025,27,48,202511,2025),('2025-11-28',202548,11,2025,28,48,202511,2025),('2025-11-29',202548,11,2025,29,48,202511,2025),('2025-11-30',202549,11,2025,30,49,202511,2025),('2025-12-01',202549,12,2025,1,49,202512,2026),('2025-12-02',202549,12,2025,2,49,202512,2026),('2025-12-03',202549,12,2025,3,49,202512,2026),('2025-12-04',202549,12,2025,4,49,202512,2026),('2025-12-05',202549,12,2025,5,49,202512,2026),('2025-12-06',202549,12,2025,6,49,202512,2026),('2025-12-07',202550,12,2025,7,50,202512,2026),('2025-12-08',202550,12,2025,8,50,202512,2026),('2025-12-09',202550,12,2025,9,50,202512,2026),('2025-12-10',202550,12,2025,10,50,202512,2026),('2025-12-11',202550,12,2025,11,50,202512,2026),('2025-12-12',202550,12,2025,12,50,202512,2026),('2025-12-13',202550,12,2025,13,50,202512,2026),('2025-12-14',202551,12,2025,14,51,202512,2026),('2025-12-15',202551,12,2025,15,51,202512,2026),('2025-12-16',202551,12,2025,16,51,202512,2026),('2025-12-17',202551,12,2025,17,51,202512,2026),('2025-12-18',202551,12,2025,18,51,202512,2026),('2025-12-19',202551,12,2025,19,51,202512,2026),('2025-12-20',202551,12,2025,20,51,202512,2026),('2025-12-21',202552,12,2025,21,52,202512,2026),('2025-12-22',202552,12,2025,22,52,202512,2026),('2025-12-23',202552,12,2025,23,52,202512,2026),('2025-12-24',202552,12,2025,24,52,202512,2026),('2025-12-25',202552,12,2025,25,52,202512,2026),('2025-12-26',202552,12,2025,26,52,202512,2026),('2025-12-27',202552,12,2025,27,52,202512,2026),('2025-12-28',202553,12,2025,28,53,202512,2026),('2025-12-29',202501,12,2025,29,53,202512,2026),('2025-12-30',202501,12,2025,30,53,202512,2026),('2025-12-31',202501,12,2025,31,53,202512,2026),('2026-01-01',202601,1,2026,1,53,202601,2026),('2026-01-02',202601,1,2026,2,53,202601,2026),('2026-01-03',202601,1,2026,3,53,202601,2026),('2026-01-04',202602,1,2026,4,1,202601,2026),('2026-01-05',202602,1,2026,5,1,202601,2026),('2026-01-06',202602,1,2026,6,1,202601,2026),('2026-01-07',202602,1,2026,7,1,202601,2026),('2026-01-08',202602,1,2026,8,1,202601,2026),('2026-01-09',202602,1,2026,9,1,202601,2026),('2026-01-10',202602,1,2026,10,1,202601,2026),('2026-01-11',202603,1,2026,11,2,202601,2026),('2026-01-12',202603,1,2026,12,2,202601,2026),('2026-01-13',202603,1,2026,13,2,202601,2026),('2026-01-14',202603,1,2026,14,2,202601,2026),('2026-01-15',202603,1,2026,15,2,202601,2026),('2026-01-16',202603,1,2026,16,2,202601,2026),('2026-01-17',202603,1,2026,17,2,202601,2026),('2026-01-18',202604,1,2026,18,3,202601,2026),('2026-01-19',202604,1,2026,19,3,202601,2026),('2026-01-20',202604,1,2026,20,3,202601,2026),('2026-01-21',202604,1,2026,21,3,202601,2026),('2026-01-22',202604,1,2026,22,3,202601,2026),('2026-01-23',202604,1,2026,23,3,202601,2026),('2026-01-24',202604,1,2026,24,3,202601,2026),('2026-01-25',202605,1,2026,25,4,202601,2026),('2026-01-26',202605,1,2026,26,4,202601,2026),('2026-01-27',202605,1,2026,27,4,202601,2026),('2026-01-28',202605,1,2026,28,4,202601,2026),('2026-01-29',202605,1,2026,29,4,202601,2026),('2026-01-30',202605,1,2026,30,4,202601,2026),('2026-01-31',202605,1,2026,31,4,202601,2026),('2026-02-01',202606,2,2026,1,5,202602,2026),('2026-02-02',202606,2,2026,2,5,202602,2026),('2026-02-03',202606,2,2026,3,5,202602,2026),('2026-02-04',202606,2,2026,4,5,202602,2026),('2026-02-05',202606,2,2026,5,5,202602,2026),('2026-02-06',202606,2,2026,6,5,202602,2026),('2026-02-07',202606,2,2026,7,5,202602,2026),('2026-02-08',202607,2,2026,8,6,202602,2026),('2026-02-09',202607,2,2026,9,6,202602,2026),('2026-02-10',202607,2,2026,10,6,202602,2026),('2026-02-11',202607,2,2026,11,6,202602,2026),('2026-02-12',202607,2,2026,12,6,202602,2026),('2026-02-13',202607,2,2026,13,6,202602,2026),('2026-02-14',202607,2,2026,14,6,202602,2026),('2026-02-15',202608,2,2026,15,7,202602,2026),('2026-02-16',202608,2,2026,16,7,202602,2026),('2026-02-17',202608,2,2026,17,7,202602,2026),('2026-02-18',202608,2,2026,18,7,202602,2026),('2026-02-19',202608,2,2026,19,7,202602,2026),('2026-02-20',202608,2,2026,20,7,202602,2026),('2026-02-21',202608,2,2026,21,7,202602,2026),('2026-02-22',202609,2,2026,22,8,202602,2026),('2026-02-23',202609,2,2026,23,8,202602,2026),('2026-02-24',202609,2,2026,24,8,202602,2026),('2026-02-25',202609,2,2026,25,8,202602,2026),('2026-02-26',202609,2,2026,26,8,202602,2026),('2026-02-27',202609,2,2026,27,8,202602,2026),('2026-02-28',202609,2,2026,28,8,202602,2026),('2026-03-01',202610,3,2026,1,9,202603,2026),('2026-03-02',202610,3,2026,2,9,202603,2026),('2026-03-03',202610,3,2026,3,9,202603,2026),('2026-03-04',202610,3,2026,4,9,202603,2026),('2026-03-05',202610,3,2026,5,9,202603,2026),('2026-03-06',202610,3,2026,6,9,202603,2026),('2026-03-07',202610,3,2026,7,9,202603,2026),('2026-03-08',202611,3,2026,8,10,202603,2026),('2026-03-09',202611,3,2026,9,10,202603,2026),('2026-03-10',202611,3,2026,10,10,202603,2026),('2026-03-11',202611,3,2026,11,10,202603,2026),('2026-03-12',202611,3,2026,12,10,202603,2026),('2026-03-13',202611,3,2026,13,10,202603,2026),('2026-03-14',202611,3,2026,14,10,202603,2026),('2026-03-15',202612,3,2026,15,11,202603,2026),('2026-03-16',202612,3,2026,16,11,202603,2026),('2026-03-17',202612,3,2026,17,11,202603,2026),('2026-03-18',202612,3,2026,18,11,202603,2026),('2026-03-19',202612,3,2026,19,11,202603,2026),('2026-03-20',202612,3,2026,20,11,202603,2026),('2026-03-21',202612,3,2026,21,11,202603,2026),('2026-03-22',202613,3,2026,22,12,202603,2026),('2026-03-23',202613,3,2026,23,12,202603,2026),('2026-03-24',202613,3,2026,24,12,202603,2026),('2026-03-25',202613,3,2026,25,12,202603,2026),('2026-03-26',202613,3,2026,26,12,202603,2026),('2026-03-27',202613,3,2026,27,12,202603,2026),('2026-03-28',202613,3,2026,28,12,202603,2026),('2026-03-29',202614,3,2026,29,13,202603,2026),('2026-03-30',202614,3,2026,30,13,202603,2026),('2026-03-31',202614,3,2026,31,13,202603,2026),('2026-04-01',202614,4,2026,1,13,202604,2026),('2026-04-02',202614,4,2026,2,13,202604,2026),('2026-04-03',202614,4,2026,3,13,202604,2026),('2026-04-04',202614,4,2026,4,13,202604,2026),('2026-04-05',202615,4,2026,5,14,202604,2026),('2026-04-06',202615,4,2026,6,14,202604,2026),('2026-04-07',202615,4,2026,7,14,202604,2026),('2026-04-08',202615,4,2026,8,14,202604,2026),('2026-04-09',202615,4,2026,9,14,202604,2026),('2026-04-10',202615,4,2026,10,14,202604,2026),('2026-04-11',202615,4,2026,11,14,202604,2026),('2026-04-12',202616,4,2026,12,15,202604,2026),('2026-04-13',202616,4,2026,13,15,202604,2026),('2026-04-14',202616,4,2026,14,15,202604,2026),('2026-04-15',202616,4,2026,15,15,202604,2026),('2026-04-16',202616,4,2026,16,15,202604,2026),('2026-04-17',202616,4,2026,17,15,202604,2026),('2026-04-18',202616,4,2026,18,15,202604,2026),('2026-04-19',202617,4,2026,19,16,202604,2026),('2026-04-20',202617,4,2026,20,16,202604,2026),('2026-04-21',202617,4,2026,21,16,202604,2026),('2026-04-22',202617,4,2026,22,16,202604,2026),('2026-04-23',202617,4,2026,23,16,202604,2026),('2026-04-24',202617,4,2026,24,16,202604,2026),('2026-04-25',202617,4,2026,25,16,202604,2026),('2026-04-26',202618,4,2026,26,17,202604,2026),('2026-04-27',202618,4,2026,27,17,202604,2026),('2026-04-28',202618,4,2026,28,17,202604,2026),('2026-04-29',202618,4,2026,29,17,202604,2026),('2026-04-30',202618,4,2026,30,17,202604,2026),('2026-05-01',202618,5,2026,1,17,202605,2026),('2026-05-02',202618,5,2026,2,17,202605,2026),('2026-05-03',202619,5,2026,3,18,202605,2026),('2026-05-04',202619,5,2026,4,18,202605,2026),('2026-05-05',202619,5,2026,5,18,202605,2026),('2026-05-06',202619,5,2026,6,18,202605,2026),('2026-05-07',202619,5,2026,7,18,202605,2026),('2026-05-08',202619,5,2026,8,18,202605,2026),('2026-05-09',202619,5,2026,9,18,202605,2026),('2026-05-10',202620,5,2026,10,19,202605,2026),('2026-05-11',202620,5,2026,11,19,202605,2026),('2026-05-12',202620,5,2026,12,19,202605,2026),('2026-05-13',202620,5,2026,13,19,202605,2026),('2026-05-14',202620,5,2026,14,19,202605,2026),('2026-05-15',202620,5,2026,15,19,202605,2026),('2026-05-16',202620,5,2026,16,19,202605,2026),('2026-05-17',202621,5,2026,17,20,202605,2026),('2026-05-18',202621,5,2026,18,20,202605,2026),('2026-05-19',202621,5,2026,19,20,202605,2026),('2026-05-20',202621,5,2026,20,20,202605,2026),('2026-05-21',202621,5,2026,21,20,202605,2026),('2026-05-22',202621,5,2026,22,20,202605,2026),('2026-05-23',202621,5,2026,23,20,202605,2026),('2026-05-24',202622,5,2026,24,21,202605,2026),('2026-05-25',202622,5,2026,25,21,202605,2026),('2026-05-26',202622,5,2026,26,21,202605,2026),('2026-05-27',202622,5,2026,27,21,202605,2026),('2026-05-28',202622,5,2026,28,21,202605,2026),('2026-05-29',202622,5,2026,29,21,202605,2026),('2026-05-30',202622,5,2026,30,21,202605,2026),('2026-05-31',202623,5,2026,31,22,202605,2026),('2026-06-01',202623,6,2026,1,22,202606,2026),('2026-06-02',202623,6,2026,2,22,202606,2026),('2026-06-03',202623,6,2026,3,22,202606,2026),('2026-06-04',202623,6,2026,4,22,202606,2026),('2026-06-05',202623,6,2026,5,22,202606,2026),('2026-06-06',202623,6,2026,6,22,202606,2026),('2026-06-07',202624,6,2026,7,23,202606,2026),('2026-06-08',202624,6,2026,8,23,202606,2026),('2026-06-09',202624,6,2026,9,23,202606,2026),('2026-06-10',202624,6,2026,10,23,202606,2026),('2026-06-11',202624,6,2026,11,23,202606,2026),('2026-06-12',202624,6,2026,12,23,202606,2026),('2026-06-13',202624,6,2026,13,23,202606,2026),('2026-06-14',202625,6,2026,14,24,202606,2026),('2026-06-15',202625,6,2026,15,24,202606,2026),('2026-06-16',202625,6,2026,16,24,202606,2026),('2026-06-17',202625,6,2026,17,24,202606,2026),('2026-06-18',202625,6,2026,18,24,202606,2026),('2026-06-19',202625,6,2026,19,24,202606,2026),('2026-06-20',202625,6,2026,20,24,202606,2026),('2026-06-21',202626,6,2026,21,25,202606,2026),('2026-06-22',202626,6,2026,22,25,202606,2026),('2026-06-23',202626,6,2026,23,25,202606,2026),('2026-06-24',202626,6,2026,24,25,202606,2026),('2026-06-25',202626,6,2026,25,25,202606,2026),('2026-06-26',202626,6,2026,26,25,202606,2026),('2026-06-27',202626,6,2026,27,25,202606,2026),('2026-06-28',202627,6,2026,28,26,202606,2026),('2026-06-29',202627,6,2026,29,26,202606,2026),('2026-06-30',202627,6,2026,30,26,202606,2026),('2026-07-01',202627,7,2026,1,26,202607,2026),('2026-07-02',202627,7,2026,2,26,202607,2026),('2026-07-03',202627,7,2026,3,26,202607,2026),('2026-07-04',202627,7,2026,4,26,202607,2026),('2026-07-05',202628,7,2026,5,27,202607,2026),('2026-07-06',202628,7,2026,6,27,202607,2026),('2026-07-07',202628,7,2026,7,27,202607,2026),('2026-07-08',202628,7,2026,8,27,202607,2026),('2026-07-09',202628,7,2026,9,27,202607,2026),('2026-07-10',202628,7,2026,10,27,202607,2026),('2026-07-11',202628,7,2026,11,27,202607,2026),('2026-07-12',202629,7,2026,12,28,202607,2026),('2026-07-13',202629,7,2026,13,28,202607,2026),('2026-07-14',202629,7,2026,14,28,202607,2026),('2026-07-15',202629,7,2026,15,28,202607,2026),('2026-07-16',202629,7,2026,16,28,202607,2026),('2026-07-17',202629,7,2026,17,28,202607,2026),('2026-07-18',202629,7,2026,18,28,202607,2026),('2026-07-19',202630,7,2026,19,29,202607,2026),('2026-07-20',202630,7,2026,20,29,202607,2026),('2026-07-21',202630,7,2026,21,29,202607,2026),('2026-07-22',202630,7,2026,22,29,202607,2026),('2026-07-23',202630,7,2026,23,29,202607,2026),('2026-07-24',202630,7,2026,24,29,202607,2026),('2026-07-25',202630,7,2026,25,29,202607,2026),('2026-07-26',202631,7,2026,26,30,202607,2026),('2026-07-27',202631,7,2026,27,30,202607,2026),('2026-07-28',202631,7,2026,28,30,202607,2026),('2026-07-29',202631,7,2026,29,30,202607,2026),('2026-07-30',202631,7,2026,30,30,202607,2026),('2026-07-31',202631,7,2026,31,30,202607,2026),('2026-08-01',202631,8,2026,1,30,202608,2026),('2026-08-02',202632,8,2026,2,31,202608,2026),('2026-08-03',202632,8,2026,3,31,202608,2026),('2026-08-04',202632,8,2026,4,31,202608,2026),('2026-08-05',202632,8,2026,5,31,202608,2026),('2026-08-06',202632,8,2026,6,31,202608,2026),('2026-08-07',202632,8,2026,7,31,202608,2026),('2026-08-08',202632,8,2026,8,31,202608,2026),('2026-08-09',202633,8,2026,9,32,202608,2026),('2026-08-10',202633,8,2026,10,32,202608,2026),('2026-08-11',202633,8,2026,11,32,202608,2026),('2026-08-12',202633,8,2026,12,32,202608,2026),('2026-08-13',202633,8,2026,13,32,202608,2026),('2026-08-14',202633,8,2026,14,32,202608,2026),('2026-08-15',202633,8,2026,15,32,202608,2026),('2026-08-16',202634,8,2026,16,33,202608,2026),('2026-08-17',202634,8,2026,17,33,202608,2026),('2026-08-18',202634,8,2026,18,33,202608,2026),('2026-08-19',202634,8,2026,19,33,202608,2026),('2026-08-20',202634,8,2026,20,33,202608,2026),('2026-08-21',202634,8,2026,21,33,202608,2026),('2026-08-22',202634,8,2026,22,33,202608,2026),('2026-08-23',202635,8,2026,23,34,202608,2026),('2026-08-24',202635,8,2026,24,34,202608,2026),('2026-08-25',202635,8,2026,25,34,202608,2026),('2026-08-26',202635,8,2026,26,34,202608,2026),('2026-08-27',202635,8,2026,27,34,202608,2026),('2026-08-28',202635,8,2026,28,34,202608,2026),('2026-08-29',202635,8,2026,29,34,202608,2026),('2026-08-30',202636,8,2026,30,35,202608,2026),('2026-08-31',202636,8,2026,31,35,202608,2026),('2026-09-01',202636,9,2026,1,35,202609,2026),('2026-09-02',202636,9,2026,2,35,202609,2026),('2026-09-03',202636,9,2026,3,35,202609,2026),('2026-09-04',202636,9,2026,4,35,202609,2026),('2026-09-05',202636,9,2026,5,35,202609,2026),('2026-09-06',202637,9,2026,6,36,202609,2026),('2026-09-07',202637,9,2026,7,36,202609,2026),('2026-09-08',202637,9,2026,8,36,202609,2026),('2026-09-09',202637,9,2026,9,36,202609,2026),('2026-09-10',202637,9,2026,10,36,202609,2026),('2026-09-11',202637,9,2026,11,36,202609,2026),('2026-09-12',202637,9,2026,12,36,202609,2026),('2026-09-13',202638,9,2026,13,37,202609,2026),('2026-09-14',202638,9,2026,14,37,202609,2026),('2026-09-15',202638,9,2026,15,37,202609,2026),('2026-09-16',202638,9,2026,16,37,202609,2026),('2026-09-17',202638,9,2026,17,37,202609,2026),('2026-09-18',202638,9,2026,18,37,202609,2026),('2026-09-19',202638,9,2026,19,37,202609,2026),('2026-09-20',202639,9,2026,20,38,202609,2026),('2026-09-21',202639,9,2026,21,38,202609,2026),('2026-09-22',202639,9,2026,22,38,202609,2026),('2026-09-23',202639,9,2026,23,38,202609,2026),('2026-09-24',202639,9,2026,24,38,202609,2026),('2026-09-25',202639,9,2026,25,38,202609,2026),('2026-09-26',202639,9,2026,26,38,202609,2026),('2026-09-27',202640,9,2026,27,39,202609,2026),('2026-09-28',202640,9,2026,28,39,202609,2026),('2026-09-29',202640,9,2026,29,39,202609,2026),('2026-09-30',202640,9,2026,30,39,202609,2026),('2026-10-01',202640,10,2026,1,39,202610,2026),('2026-10-02',202640,10,2026,2,39,202610,2026),('2026-10-03',202640,10,2026,3,39,202610,2026),('2026-10-04',202641,10,2026,4,40,202610,2026),('2026-10-05',202641,10,2026,5,40,202610,2026),('2026-10-06',202641,10,2026,6,40,202610,2026),('2026-10-07',202641,10,2026,7,40,202610,2026),('2026-10-08',202641,10,2026,8,40,202610,2026),('2026-10-09',202641,10,2026,9,40,202610,2026),('2026-10-10',202641,10,2026,10,40,202610,2026),('2026-10-11',202642,10,2026,11,41,202610,2026),('2026-10-12',202642,10,2026,12,41,202610,2026),('2026-10-13',202642,10,2026,13,41,202610,2026),('2026-10-14',202642,10,2026,14,41,202610,2026),('2026-10-15',202642,10,2026,15,41,202610,2026),('2026-10-16',202642,10,2026,16,41,202610,2026),('2026-10-17',202642,10,2026,17,41,202610,2026),('2026-10-18',202643,10,2026,18,42,202610,2026),('2026-10-19',202643,10,2026,19,42,202610,2026),('2026-10-20',202643,10,2026,20,42,202610,2026),('2026-10-21',202643,10,2026,21,42,202610,2026),('2026-10-22',202643,10,2026,22,42,202610,2026),('2026-10-23',202643,10,2026,23,42,202610,2026),('2026-10-24',202643,10,2026,24,42,202610,2026),('2026-10-25',202644,10,2026,25,43,202610,2026),('2026-10-26',202644,10,2026,26,43,202610,2026),('2026-10-27',202644,10,2026,27,43,202610,2026),('2026-10-28',202644,10,2026,28,43,202610,2026),('2026-10-29',202644,10,2026,29,43,202610,2026),('2026-10-30',202644,10,2026,30,43,202610,2026),('2026-10-31',202644,10,2026,31,43,202610,2026),('2026-11-01',202645,11,2026,1,44,202611,2026),('2026-11-02',202645,11,2026,2,44,202611,2026),('2026-11-03',202645,11,2026,3,44,202611,2026),('2026-11-04',202645,11,2026,4,44,202611,2026),('2026-11-05',202645,11,2026,5,44,202611,2026),('2026-11-06',202645,11,2026,6,44,202611,2026),('2026-11-07',202645,11,2026,7,44,202611,2026),('2026-11-08',202646,11,2026,8,45,202611,2026),('2026-11-09',202646,11,2026,9,45,202611,2026),('2026-11-10',202646,11,2026,10,45,202611,2026),('2026-11-11',202646,11,2026,11,45,202611,2026),('2026-11-12',202646,11,2026,12,45,202611,2026),('2026-11-13',202646,11,2026,13,45,202611,2026),('2026-11-14',202646,11,2026,14,45,202611,2026),('2026-11-15',202647,11,2026,15,46,202611,2026),('2026-11-16',202647,11,2026,16,46,202611,2026),('2026-11-17',202647,11,2026,17,46,202611,2026),('2026-11-18',202647,11,2026,18,46,202611,2026),('2026-11-19',202647,11,2026,19,46,202611,2026),('2026-11-20',202647,11,2026,20,46,202611,2026),('2026-11-21',202647,11,2026,21,46,202611,2026),('2026-11-22',202648,11,2026,22,47,202611,2026),('2026-11-23',202648,11,2026,23,47,202611,2026),('2026-11-24',202648,11,2026,24,47,202611,2026),('2026-11-25',202648,11,2026,25,47,202611,2026),('2026-11-26',202648,11,2026,26,47,202611,2026),('2026-11-27',202648,11,2026,27,47,202611,2026),('2026-11-28',202648,11,2026,28,47,202611,2026),('2026-11-29',202649,11,2026,29,48,202611,2026),('2026-11-30',202649,11,2026,30,48,202611,2026),('2026-12-01',202649,12,2026,1,48,202612,2027),('2026-12-02',202649,12,2026,2,48,202612,2027),('2026-12-03',202649,12,2026,3,48,202612,2027),('2026-12-04',202649,12,2026,4,48,202612,2027),('2026-12-05',202649,12,2026,5,48,202612,2027),('2026-12-06',202650,12,2026,6,49,202612,2027),('2026-12-07',202650,12,2026,7,49,202612,2027),('2026-12-08',202650,12,2026,8,49,202612,2027),('2026-12-09',202650,12,2026,9,49,202612,2027),('2026-12-10',202650,12,2026,10,49,202612,2027),('2026-12-11',202650,12,2026,11,49,202612,2027),('2026-12-12',202650,12,2026,12,49,202612,2027),('2026-12-13',202651,12,2026,13,50,202612,2027),('2026-12-14',202651,12,2026,14,50,202612,2027),('2026-12-15',202651,12,2026,15,50,202612,2027),('2026-12-16',202651,12,2026,16,50,202612,2027),('2026-12-17',202651,12,2026,17,50,202612,2027),('2026-12-18',202651,12,2026,18,50,202612,2027),('2026-12-19',202651,12,2026,19,50,202612,2027),('2026-12-20',202652,12,2026,20,51,202612,2027),('2026-12-21',202652,12,2026,21,51,202612,2027),('2026-12-22',202652,12,2026,22,51,202612,2027),('2026-12-23',202652,12,2026,23,51,202612,2027),('2026-12-24',202652,12,2026,24,51,202612,2027),('2026-12-25',202652,12,2026,25,51,202612,2027),('2026-12-26',202652,12,2026,26,51,202612,2027),('2026-12-27',202653,12,2026,27,52,202612,2027),('2026-12-28',202653,12,2026,28,52,202612,2027),('2026-12-29',202653,12,2026,29,52,202612,2027),('2026-12-30',202653,12,2026,30,52,202612,2027),('2026-12-31',202653,12,2026,31,52,202612,2027),('2027-01-01',202753,1,2027,1,52,202701,2027),('2027-01-02',202753,1,2027,2,52,202701,2027),('2027-01-03',202754,1,2027,3,1,202701,2027),('2027-01-04',202701,1,2027,4,1,202701,2027),('2027-01-05',202701,1,2027,5,1,202701,2027),('2027-01-06',202701,1,2027,6,1,202701,2027),('2027-01-07',202701,1,2027,7,1,202701,2027),('2027-01-08',202701,1,2027,8,1,202701,2027),('2027-01-09',202701,1,2027,9,1,202701,2027),('2027-01-10',202702,1,2027,10,2,202701,2027),('2027-01-11',202702,1,2027,11,2,202701,2027),('2027-01-12',202702,1,2027,12,2,202701,2027),('2027-01-13',202702,1,2027,13,2,202701,2027),('2027-01-14',202702,1,2027,14,2,202701,2027),('2027-01-15',202702,1,2027,15,2,202701,2027),('2027-01-16',202702,1,2027,16,2,202701,2027),('2027-01-17',202703,1,2027,17,3,202701,2027),('2027-01-18',202703,1,2027,18,3,202701,2027),('2027-01-19',202703,1,2027,19,3,202701,2027),('2027-01-20',202703,1,2027,20,3,202701,2027),('2027-01-21',202703,1,2027,21,3,202701,2027),('2027-01-22',202703,1,2027,22,3,202701,2027),('2027-01-23',202703,1,2027,23,3,202701,2027),('2027-01-24',202704,1,2027,24,4,202701,2027),('2027-01-25',202704,1,2027,25,4,202701,2027),('2027-01-26',202704,1,2027,26,4,202701,2027),('2027-01-27',202704,1,2027,27,4,202701,2027),('2027-01-28',202704,1,2027,28,4,202701,2027),('2027-01-29',202704,1,2027,29,4,202701,2027),('2027-01-30',202704,1,2027,30,4,202701,2027),('2027-01-31',202705,1,2027,31,5,202701,2027),('2027-02-01',202705,2,2027,1,5,202702,2027),('2027-02-02',202705,2,2027,2,5,202702,2027),('2027-02-03',202705,2,2027,3,5,202702,2027),('2027-02-04',202705,2,2027,4,5,202702,2027),('2027-02-05',202705,2,2027,5,5,202702,2027),('2027-02-06',202705,2,2027,6,5,202702,2027),('2027-02-07',202706,2,2027,7,6,202702,2027),('2027-02-08',202706,2,2027,8,6,202702,2027),('2027-02-09',202706,2,2027,9,6,202702,2027),('2027-02-10',202706,2,2027,10,6,202702,2027),('2027-02-11',202706,2,2027,11,6,202702,2027),('2027-02-12',202706,2,2027,12,6,202702,2027),('2027-02-13',202706,2,2027,13,6,202702,2027),('2027-02-14',202707,2,2027,14,7,202702,2027),('2027-02-15',202707,2,2027,15,7,202702,2027),('2027-02-16',202707,2,2027,16,7,202702,2027),('2027-02-17',202707,2,2027,17,7,202702,2027),('2027-02-18',202707,2,2027,18,7,202702,2027),('2027-02-19',202707,2,2027,19,7,202702,2027),('2027-02-20',202707,2,2027,20,7,202702,2027),('2027-02-21',202708,2,2027,21,8,202702,2027),('2027-02-22',202708,2,2027,22,8,202702,2027),('2027-02-23',202708,2,2027,23,8,202702,2027),('2027-02-24',202708,2,2027,24,8,202702,2027),('2027-02-25',202708,2,2027,25,8,202702,2027),('2027-02-26',202708,2,2027,26,8,202702,2027),('2027-02-27',202708,2,2027,27,8,202702,2027),('2027-02-28',202709,2,2027,28,9,202702,2027),('2027-03-01',202709,3,2027,1,9,202703,2027),('2027-03-02',202709,3,2027,2,9,202703,2027),('2027-03-03',202709,3,2027,3,9,202703,2027),('2027-03-04',202709,3,2027,4,9,202703,2027),('2027-03-05',202709,3,2027,5,9,202703,2027),('2027-03-06',202709,3,2027,6,9,202703,2027),('2027-03-07',202710,3,2027,7,10,202703,2027),('2027-03-08',202710,3,2027,8,10,202703,2027),('2027-03-09',202710,3,2027,9,10,202703,2027),('2027-03-10',202710,3,2027,10,10,202703,2027),('2027-03-11',202710,3,2027,11,10,202703,2027),('2027-03-12',202710,3,2027,12,10,202703,2027),('2027-03-13',202710,3,2027,13,10,202703,2027),('2027-03-14',202711,3,2027,14,11,202703,2027),('2027-03-15',202711,3,2027,15,11,202703,2027),('2027-03-16',202711,3,2027,16,11,202703,2027),('2027-03-17',202711,3,2027,17,11,202703,2027),('2027-03-18',202711,3,2027,18,11,202703,2027),('2027-03-19',202711,3,2027,19,11,202703,2027),('2027-03-20',202711,3,2027,20,11,202703,2027),('2027-03-21',202712,3,2027,21,12,202703,2027),('2027-03-22',202712,3,2027,22,12,202703,2027),('2027-03-23',202712,3,2027,23,12,202703,2027),('2027-03-24',202712,3,2027,24,12,202703,2027),('2027-03-25',202712,3,2027,25,12,202703,2027),('2027-03-26',202712,3,2027,26,12,202703,2027),('2027-03-27',202712,3,2027,27,12,202703,2027),('2027-03-28',202713,3,2027,28,13,202703,2027),('2027-03-29',202713,3,2027,29,13,202703,2027),('2027-03-30',202713,3,2027,30,13,202703,2027),('2027-03-31',202713,3,2027,31,13,202703,2027),('2027-04-01',202713,4,2027,1,13,202704,2027),('2027-04-02',202713,4,2027,2,13,202704,2027),('2027-04-03',202713,4,2027,3,13,202704,2027),('2027-04-04',202714,4,2027,4,14,202704,2027),('2027-04-05',202714,4,2027,5,14,202704,2027),('2027-04-06',202714,4,2027,6,14,202704,2027),('2027-04-07',202714,4,2027,7,14,202704,2027),('2027-04-08',202714,4,2027,8,14,202704,2027),('2027-04-09',202714,4,2027,9,14,202704,2027),('2027-04-10',202714,4,2027,10,14,202704,2027),('2027-04-11',202715,4,2027,11,15,202704,2027),('2027-04-12',202715,4,2027,12,15,202704,2027),('2027-04-13',202715,4,2027,13,15,202704,2027),('2027-04-14',202715,4,2027,14,15,202704,2027),('2027-04-15',202715,4,2027,15,15,202704,2027),('2027-04-16',202715,4,2027,16,15,202704,2027),('2027-04-17',202715,4,2027,17,15,202704,2027),('2027-04-18',202716,4,2027,18,16,202704,2027),('2027-04-19',202716,4,2027,19,16,202704,2027),('2027-04-20',202716,4,2027,20,16,202704,2027),('2027-04-21',202716,4,2027,21,16,202704,2027),('2027-04-22',202716,4,2027,22,16,202704,2027),('2027-04-23',202716,4,2027,23,16,202704,2027),('2027-04-24',202716,4,2027,24,16,202704,2027),('2027-04-25',202717,4,2027,25,17,202704,2027),('2027-04-26',202717,4,2027,26,17,202704,2027),('2027-04-27',202717,4,2027,27,17,202704,2027),('2027-04-28',202717,4,2027,28,17,202704,2027),('2027-04-29',202717,4,2027,29,17,202704,2027),('2027-04-30',202717,4,2027,30,17,202704,2027),('2027-05-01',202717,5,2027,1,17,202705,2027),('2027-05-02',202718,5,2027,2,18,202705,2027),('2027-05-03',202718,5,2027,3,18,202705,2027),('2027-05-04',202718,5,2027,4,18,202705,2027),('2027-05-05',202718,5,2027,5,18,202705,2027),('2027-05-06',202718,5,2027,6,18,202705,2027),('2027-05-07',202718,5,2027,7,18,202705,2027),('2027-05-08',202718,5,2027,8,18,202705,2027),('2027-05-09',202719,5,2027,9,19,202705,2027),('2027-05-10',202719,5,2027,10,19,202705,2027),('2027-05-11',202719,5,2027,11,19,202705,2027),('2027-05-12',202719,5,2027,12,19,202705,2027),('2027-05-13',202719,5,2027,13,19,202705,2027),('2027-05-14',202719,5,2027,14,19,202705,2027),('2027-05-15',202719,5,2027,15,19,202705,2027),('2027-05-16',202720,5,2027,16,20,202705,2027),('2027-05-17',202720,5,2027,17,20,202705,2027),('2027-05-18',202720,5,2027,18,20,202705,2027),('2027-05-19',202720,5,2027,19,20,202705,2027),('2027-05-20',202720,5,2027,20,20,202705,2027),('2027-05-21',202720,5,2027,21,20,202705,2027),('2027-05-22',202720,5,2027,22,20,202705,2027),('2027-05-23',202721,5,2027,23,21,202705,2027),('2027-05-24',202721,5,2027,24,21,202705,2027),('2027-05-25',202721,5,2027,25,21,202705,2027),('2027-05-26',202721,5,2027,26,21,202705,2027),('2027-05-27',202721,5,2027,27,21,202705,2027),('2027-05-28',202721,5,2027,28,21,202705,2027),('2027-05-29',202721,5,2027,29,21,202705,2027),('2027-05-30',202722,5,2027,30,22,202705,2027),('2027-05-31',202722,5,2027,31,22,202705,2027),('2027-06-01',202722,6,2027,1,22,202706,2027),('2027-06-02',202722,6,2027,2,22,202706,2027),('2027-06-03',202722,6,2027,3,22,202706,2027),('2027-06-04',202722,6,2027,4,22,202706,2027),('2027-06-05',202722,6,2027,5,22,202706,2027),('2027-06-06',202723,6,2027,6,23,202706,2027),('2027-06-07',202723,6,2027,7,23,202706,2027),('2027-06-08',202723,6,2027,8,23,202706,2027),('2027-06-09',202723,6,2027,9,23,202706,2027),('2027-06-10',202723,6,2027,10,23,202706,2027),('2027-06-11',202723,6,2027,11,23,202706,2027),('2027-06-12',202723,6,2027,12,23,202706,2027),('2027-06-13',202724,6,2027,13,24,202706,2027),('2027-06-14',202724,6,2027,14,24,202706,2027),('2027-06-15',202724,6,2027,15,24,202706,2027),('2027-06-16',202724,6,2027,16,24,202706,2027),('2027-06-17',202724,6,2027,17,24,202706,2027),('2027-06-18',202724,6,2027,18,24,202706,2027),('2027-06-19',202724,6,2027,19,24,202706,2027),('2027-06-20',202725,6,2027,20,25,202706,2027),('2027-06-21',202725,6,2027,21,25,202706,2027),('2027-06-22',202725,6,2027,22,25,202706,2027),('2027-06-23',202725,6,2027,23,25,202706,2027),('2027-06-24',202725,6,2027,24,25,202706,2027),('2027-06-25',202725,6,2027,25,25,202706,2027),('2027-06-26',202725,6,2027,26,25,202706,2027),('2027-06-27',202726,6,2027,27,26,202706,2027),('2027-06-28',202726,6,2027,28,26,202706,2027),('2027-06-29',202726,6,2027,29,26,202706,2027),('2027-06-30',202726,6,2027,30,26,202706,2027),('2027-07-01',202726,7,2027,1,26,202707,2027),('2027-07-02',202726,7,2027,2,26,202707,2027),('2027-07-03',202726,7,2027,3,26,202707,2027),('2027-07-04',202727,7,2027,4,27,202707,2027),('2027-07-05',202727,7,2027,5,27,202707,2027),('2027-07-06',202727,7,2027,6,27,202707,2027),('2027-07-07',202727,7,2027,7,27,202707,2027),('2027-07-08',202727,7,2027,8,27,202707,2027),('2027-07-09',202727,7,2027,9,27,202707,2027),('2027-07-10',202727,7,2027,10,27,202707,2027),('2027-07-11',202728,7,2027,11,28,202707,2027),('2027-07-12',202728,7,2027,12,28,202707,2027),('2027-07-13',202728,7,2027,13,28,202707,2027),('2027-07-14',202728,7,2027,14,28,202707,2027),('2027-07-15',202728,7,2027,15,28,202707,2027),('2027-07-16',202728,7,2027,16,28,202707,2027),('2027-07-17',202728,7,2027,17,28,202707,2027),('2027-07-18',202729,7,2027,18,29,202707,2027),('2027-07-19',202729,7,2027,19,29,202707,2027),('2027-07-20',202729,7,2027,20,29,202707,2027),('2027-07-21',202729,7,2027,21,29,202707,2027),('2027-07-22',202729,7,2027,22,29,202707,2027),('2027-07-23',202729,7,2027,23,29,202707,2027),('2027-07-24',202729,7,2027,24,29,202707,2027),('2027-07-25',202730,7,2027,25,30,202707,2027),('2027-07-26',202730,7,2027,26,30,202707,2027),('2027-07-27',202730,7,2027,27,30,202707,2027),('2027-07-28',202730,7,2027,28,30,202707,2027),('2027-07-29',202730,7,2027,29,30,202707,2027),('2027-07-30',202730,7,2027,30,30,202707,2027),('2027-07-31',202730,7,2027,31,30,202707,2027),('2027-08-01',202731,8,2027,1,31,202708,2027),('2027-08-02',202731,8,2027,2,31,202708,2027),('2027-08-03',202731,8,2027,3,31,202708,2027),('2027-08-04',202731,8,2027,4,31,202708,2027),('2027-08-05',202731,8,2027,5,31,202708,2027),('2027-08-06',202731,8,2027,6,31,202708,2027),('2027-08-07',202731,8,2027,7,31,202708,2027),('2027-08-08',202732,8,2027,8,32,202708,2027),('2027-08-09',202732,8,2027,9,32,202708,2027),('2027-08-10',202732,8,2027,10,32,202708,2027),('2027-08-11',202732,8,2027,11,32,202708,2027),('2027-08-12',202732,8,2027,12,32,202708,2027),('2027-08-13',202732,8,2027,13,32,202708,2027),('2027-08-14',202732,8,2027,14,32,202708,2027),('2027-08-15',202733,8,2027,15,33,202708,2027),('2027-08-16',202733,8,2027,16,33,202708,2027),('2027-08-17',202733,8,2027,17,33,202708,2027),('2027-08-18',202733,8,2027,18,33,202708,2027),('2027-08-19',202733,8,2027,19,33,202708,2027),('2027-08-20',202733,8,2027,20,33,202708,2027),('2027-08-21',202733,8,2027,21,33,202708,2027),('2027-08-22',202734,8,2027,22,34,202708,2027),('2027-08-23',202734,8,2027,23,34,202708,2027),('2027-08-24',202734,8,2027,24,34,202708,2027),('2027-08-25',202734,8,2027,25,34,202708,2027),('2027-08-26',202734,8,2027,26,34,202708,2027),('2027-08-27',202734,8,2027,27,34,202708,2027),('2027-08-28',202734,8,2027,28,34,202708,2027),('2027-08-29',202735,8,2027,29,35,202708,2027),('2027-08-30',202735,8,2027,30,35,202708,2027),('2027-08-31',202735,8,2027,31,35,202708,2027),('2027-09-01',202735,9,2027,1,35,202709,2027),('2027-09-02',202735,9,2027,2,35,202709,2027),('2027-09-03',202735,9,2027,3,35,202709,2027),('2027-09-04',202735,9,2027,4,35,202709,2027),('2027-09-05',202736,9,2027,5,36,202709,2027),('2027-09-06',202736,9,2027,6,36,202709,2027),('2027-09-07',202736,9,2027,7,36,202709,2027),('2027-09-08',202736,9,2027,8,36,202709,2027),('2027-09-09',202736,9,2027,9,36,202709,2027),('2027-09-10',202736,9,2027,10,36,202709,2027),('2027-09-11',202736,9,2027,11,36,202709,2027),('2027-09-12',202737,9,2027,12,37,202709,2027),('2027-09-13',202737,9,2027,13,37,202709,2027),('2027-09-14',202737,9,2027,14,37,202709,2027),('2027-09-15',202737,9,2027,15,37,202709,2027),('2027-09-16',202737,9,2027,16,37,202709,2027),('2027-09-17',202737,9,2027,17,37,202709,2027),('2027-09-18',202737,9,2027,18,37,202709,2027),('2027-09-19',202738,9,2027,19,38,202709,2027),('2027-09-20',202738,9,2027,20,38,202709,2027),('2027-09-21',202738,9,2027,21,38,202709,2027),('2027-09-22',202738,9,2027,22,38,202709,2027),('2027-09-23',202738,9,2027,23,38,202709,2027),('2027-09-24',202738,9,2027,24,38,202709,2027),('2027-09-25',202738,9,2027,25,38,202709,2027),('2027-09-26',202739,9,2027,26,39,202709,2027),('2027-09-27',202739,9,2027,27,39,202709,2027),('2027-09-28',202739,9,2027,28,39,202709,2027),('2027-09-29',202739,9,2027,29,39,202709,2027),('2027-09-30',202739,9,2027,30,39,202709,2027),('2027-10-01',202739,10,2027,1,39,202710,2027),('2027-10-02',202739,10,2027,2,39,202710,2027),('2027-10-03',202740,10,2027,3,40,202710,2027),('2027-10-04',202740,10,2027,4,40,202710,2027),('2027-10-05',202740,10,2027,5,40,202710,2027),('2027-10-06',202740,10,2027,6,40,202710,2027),('2027-10-07',202740,10,2027,7,40,202710,2027),('2027-10-08',202740,10,2027,8,40,202710,2027),('2027-10-09',202740,10,2027,9,40,202710,2027),('2027-10-10',202741,10,2027,10,41,202710,2027),('2027-10-11',202741,10,2027,11,41,202710,2027),('2027-10-12',202741,10,2027,12,41,202710,2027),('2027-10-13',202741,10,2027,13,41,202710,2027),('2027-10-14',202741,10,2027,14,41,202710,2027),('2027-10-15',202741,10,2027,15,41,202710,2027),('2027-10-16',202741,10,2027,16,41,202710,2027),('2027-10-17',202742,10,2027,17,42,202710,2027),('2027-10-18',202742,10,2027,18,42,202710,2027),('2027-10-19',202742,10,2027,19,42,202710,2027),('2027-10-20',202742,10,2027,20,42,202710,2027),('2027-10-21',202742,10,2027,21,42,202710,2027),('2027-10-22',202742,10,2027,22,42,202710,2027),('2027-10-23',202742,10,2027,23,42,202710,2027),('2027-10-24',202743,10,2027,24,43,202710,2027),('2027-10-25',202743,10,2027,25,43,202710,2027),('2027-10-26',202743,10,2027,26,43,202710,2027),('2027-10-27',202743,10,2027,27,43,202710,2027),('2027-10-28',202743,10,2027,28,43,202710,2027),('2027-10-29',202743,10,2027,29,43,202710,2027),('2027-10-30',202743,10,2027,30,43,202710,2027),('2027-10-31',202744,10,2027,31,44,202710,2027),('2027-11-01',202744,11,2027,1,44,202711,2027),('2027-11-02',202744,11,2027,2,44,202711,2027),('2027-11-03',202744,11,2027,3,44,202711,2027),('2027-11-04',202744,11,2027,4,44,202711,2027),('2027-11-05',202744,11,2027,5,44,202711,2027),('2027-11-06',202744,11,2027,6,44,202711,2027),('2027-11-07',202745,11,2027,7,45,202711,2027),('2027-11-08',202745,11,2027,8,45,202711,2027),('2027-11-09',202745,11,2027,9,45,202711,2027),('2027-11-10',202745,11,2027,10,45,202711,2027),('2027-11-11',202745,11,2027,11,45,202711,2027),('2027-11-12',202745,11,2027,12,45,202711,2027),('2027-11-13',202745,11,2027,13,45,202711,2027),('2027-11-14',202746,11,2027,14,46,202711,2027),('2027-11-15',202746,11,2027,15,46,202711,2027),('2027-11-16',202746,11,2027,16,46,202711,2027),('2027-11-17',202746,11,2027,17,46,202711,2027),('2027-11-18',202746,11,2027,18,46,202711,2027),('2027-11-19',202746,11,2027,19,46,202711,2027),('2027-11-20',202746,11,2027,20,46,202711,2027),('2027-11-21',202747,11,2027,21,47,202711,2027),('2027-11-22',202747,11,2027,22,47,202711,2027),('2027-11-23',202747,11,2027,23,47,202711,2027),('2027-11-24',202747,11,2027,24,47,202711,2027),('2027-11-25',202747,11,2027,25,47,202711,2027),('2027-11-26',202747,11,2027,26,47,202711,2027),('2027-11-27',202747,11,2027,27,47,202711,2027),('2027-11-28',202748,11,2027,28,48,202711,2027),('2027-11-29',202748,11,2027,29,48,202711,2027),('2027-11-30',202748,11,2027,30,48,202711,2027),('2027-12-01',202748,12,2027,1,48,202712,2028),('2027-12-02',202748,12,2027,2,48,202712,2028),('2027-12-03',202748,12,2027,3,48,202712,2028),('2027-12-04',202748,12,2027,4,48,202712,2028),('2027-12-05',202749,12,2027,5,49,202712,2028),('2027-12-06',202749,12,2027,6,49,202712,2028),('2027-12-07',202749,12,2027,7,49,202712,2028),('2027-12-08',202749,12,2027,8,49,202712,2028),('2027-12-09',202749,12,2027,9,49,202712,2028),('2027-12-10',202749,12,2027,10,49,202712,2028),('2027-12-11',202749,12,2027,11,49,202712,2028),('2027-12-12',202750,12,2027,12,50,202712,2028),('2027-12-13',202750,12,2027,13,50,202712,2028),('2027-12-14',202750,12,2027,14,50,202712,2028),('2027-12-15',202750,12,2027,15,50,202712,2028),('2027-12-16',202750,12,2027,16,50,202712,2028),('2027-12-17',202750,12,2027,17,50,202712,2028),('2027-12-18',202750,12,2027,18,50,202712,2028),('2027-12-19',202751,12,2027,19,51,202712,2028),('2027-12-20',202751,12,2027,20,51,202712,2028),('2027-12-21',202751,12,2027,21,51,202712,2028),('2027-12-22',202751,12,2027,22,51,202712,2028),('2027-12-23',202751,12,2027,23,51,202712,2028),('2027-12-24',202751,12,2027,24,51,202712,2028),('2027-12-25',202751,12,2027,25,51,202712,2028),('2027-12-26',202752,12,2027,26,52,202712,2028),('2027-12-27',202752,12,2027,27,52,202712,2028),('2027-12-28',202752,12,2027,28,52,202712,2028),('2027-12-29',202752,12,2027,29,52,202712,2028),('2027-12-30',202752,12,2027,30,52,202712,2028),('2027-12-31',202752,12,2027,31,52,202712,2028),('2028-01-01',202852,1,2028,1,52,202801,2028),('2028-01-02',202853,1,2028,2,1,202801,2028),('2028-01-03',202801,1,2028,3,1,202801,2028),('2028-01-04',202801,1,2028,4,1,202801,2028),('2028-01-05',202801,1,2028,5,1,202801,2028),('2028-01-06',202801,1,2028,6,1,202801,2028),('2028-01-07',202801,1,2028,7,1,202801,2028),('2028-01-08',202801,1,2028,8,1,202801,2028),('2028-01-09',202802,1,2028,9,2,202801,2028),('2028-01-10',202802,1,2028,10,2,202801,2028),('2028-01-11',202802,1,2028,11,2,202801,2028),('2028-01-12',202802,1,2028,12,2,202801,2028),('2028-01-13',202802,1,2028,13,2,202801,2028),('2028-01-14',202802,1,2028,14,2,202801,2028),('2028-01-15',202802,1,2028,15,2,202801,2028),('2028-01-16',202803,1,2028,16,3,202801,2028),('2028-01-17',202803,1,2028,17,3,202801,2028),('2028-01-18',202803,1,2028,18,3,202801,2028),('2028-01-19',202803,1,2028,19,3,202801,2028),('2028-01-20',202803,1,2028,20,3,202801,2028),('2028-01-21',202803,1,2028,21,3,202801,2028),('2028-01-22',202803,1,2028,22,3,202801,2028),('2028-01-23',202804,1,2028,23,4,202801,2028),('2028-01-24',202804,1,2028,24,4,202801,2028),('2028-01-25',202804,1,2028,25,4,202801,2028),('2028-01-26',202804,1,2028,26,4,202801,2028),('2028-01-27',202804,1,2028,27,4,202801,2028),('2028-01-28',202804,1,2028,28,4,202801,2028),('2028-01-29',202804,1,2028,29,4,202801,2028),('2028-01-30',202805,1,2028,30,5,202801,2028),('2028-01-31',202805,1,2028,31,5,202801,2028),('2028-02-01',202805,2,2028,1,5,202802,2028),('2028-02-02',202805,2,2028,2,5,202802,2028),('2028-02-03',202805,2,2028,3,5,202802,2028),('2028-02-04',202805,2,2028,4,5,202802,2028),('2028-02-05',202805,2,2028,5,5,202802,2028),('2028-02-06',202806,2,2028,6,6,202802,2028),('2028-02-07',202806,2,2028,7,6,202802,2028),('2028-02-08',202806,2,2028,8,6,202802,2028),('2028-02-09',202806,2,2028,9,6,202802,2028),('2028-02-10',202806,2,2028,10,6,202802,2028),('2028-02-11',202806,2,2028,11,6,202802,2028),('2028-02-12',202806,2,2028,12,6,202802,2028),('2028-02-13',202807,2,2028,13,7,202802,2028),('2028-02-14',202807,2,2028,14,7,202802,2028),('2028-02-15',202807,2,2028,15,7,202802,2028),('2028-02-16',202807,2,2028,16,7,202802,2028),('2028-02-17',202807,2,2028,17,7,202802,2028),('2028-02-18',202807,2,2028,18,7,202802,2028),('2028-02-19',202807,2,2028,19,7,202802,2028),('2028-02-20',202808,2,2028,20,8,202802,2028),('2028-02-21',202808,2,2028,21,8,202802,2028),('2028-02-22',202808,2,2028,22,8,202802,2028),('2028-02-23',202808,2,2028,23,8,202802,2028),('2028-02-24',202808,2,2028,24,8,202802,2028),('2028-02-25',202808,2,2028,25,8,202802,2028),('2028-02-26',202808,2,2028,26,8,202802,2028),('2028-02-27',202809,2,2028,27,9,202802,2028),('2028-02-28',202809,2,2028,28,9,202802,2028),('2028-02-29',202809,2,2028,29,9,202802,2028),('2028-03-01',202809,3,2028,1,9,202803,2028),('2028-03-02',202809,3,2028,2,9,202803,2028),('2028-03-03',202809,3,2028,3,9,202803,2028),('2028-03-04',202809,3,2028,4,9,202803,2028),('2028-03-05',202810,3,2028,5,10,202803,2028),('2028-03-06',202810,3,2028,6,10,202803,2028),('2028-03-07',202810,3,2028,7,10,202803,2028),('2028-03-08',202810,3,2028,8,10,202803,2028),('2028-03-09',202810,3,2028,9,10,202803,2028),('2028-03-10',202810,3,2028,10,10,202803,2028),('2028-03-11',202810,3,2028,11,10,202803,2028),('2028-03-12',202811,3,2028,12,11,202803,2028),('2028-03-13',202811,3,2028,13,11,202803,2028),('2028-03-14',202811,3,2028,14,11,202803,2028),('2028-03-15',202811,3,2028,15,11,202803,2028),('2028-03-16',202811,3,2028,16,11,202803,2028),('2028-03-17',202811,3,2028,17,11,202803,2028),('2028-03-18',202811,3,2028,18,11,202803,2028),('2028-03-19',202812,3,2028,19,12,202803,2028),('2028-03-20',202812,3,2028,20,12,202803,2028),('2028-03-21',202812,3,2028,21,12,202803,2028),('2028-03-22',202812,3,2028,22,12,202803,2028),('2028-03-23',202812,3,2028,23,12,202803,2028),('2028-03-24',202812,3,2028,24,12,202803,2028),('2028-03-25',202812,3,2028,25,12,202803,2028),('2028-03-26',202813,3,2028,26,13,202803,2028),('2028-03-27',202813,3,2028,27,13,202803,2028),('2028-03-28',202813,3,2028,28,13,202803,2028),('2028-03-29',202813,3,2028,29,13,202803,2028),('2028-03-30',202813,3,2028,30,13,202803,2028),('2028-03-31',202813,3,2028,31,13,202803,2028),('2028-04-01',202813,4,2028,1,13,202804,2028),('2028-04-02',202814,4,2028,2,14,202804,2028),('2028-04-03',202814,4,2028,3,14,202804,2028),('2028-04-04',202814,4,2028,4,14,202804,2028),('2028-04-05',202814,4,2028,5,14,202804,2028),('2028-04-06',202814,4,2028,6,14,202804,2028),('2028-04-07',202814,4,2028,7,14,202804,2028),('2028-04-08',202814,4,2028,8,14,202804,2028),('2028-04-09',202815,4,2028,9,15,202804,2028),('2028-04-10',202815,4,2028,10,15,202804,2028),('2028-04-11',202815,4,2028,11,15,202804,2028),('2028-04-12',202815,4,2028,12,15,202804,2028),('2028-04-13',202815,4,2028,13,15,202804,2028),('2028-04-14',202815,4,2028,14,15,202804,2028),('2028-04-15',202815,4,2028,15,15,202804,2028),('2028-04-16',202816,4,2028,16,16,202804,2028),('2028-04-17',202816,4,2028,17,16,202804,2028),('2028-04-18',202816,4,2028,18,16,202804,2028),('2028-04-19',202816,4,2028,19,16,202804,2028),('2028-04-20',202816,4,2028,20,16,202804,2028),('2028-04-21',202816,4,2028,21,16,202804,2028),('2028-04-22',202816,4,2028,22,16,202804,2028),('2028-04-23',202817,4,2028,23,17,202804,2028),('2028-04-24',202817,4,2028,24,17,202804,2028),('2028-04-25',202817,4,2028,25,17,202804,2028),('2028-04-26',202817,4,2028,26,17,202804,2028),('2028-04-27',202817,4,2028,27,17,202804,2028),('2028-04-28',202817,4,2028,28,17,202804,2028),('2028-04-29',202817,4,2028,29,17,202804,2028),('2028-04-30',202818,4,2028,30,18,202804,2028),('2028-05-01',202818,5,2028,1,18,202805,2028),('2028-05-02',202818,5,2028,2,18,202805,2028),('2028-05-03',202818,5,2028,3,18,202805,2028),('2028-05-04',202818,5,2028,4,18,202805,2028),('2028-05-05',202818,5,2028,5,18,202805,2028),('2028-05-06',202818,5,2028,6,18,202805,2028),('2028-05-07',202819,5,2028,7,19,202805,2028),('2028-05-08',202819,5,2028,8,19,202805,2028),('2028-05-09',202819,5,2028,9,19,202805,2028),('2028-05-10',202819,5,2028,10,19,202805,2028),('2028-05-11',202819,5,2028,11,19,202805,2028),('2028-05-12',202819,5,2028,12,19,202805,2028),('2028-05-13',202819,5,2028,13,19,202805,2028),('2028-05-14',202820,5,2028,14,20,202805,2028),('2028-05-15',202820,5,2028,15,20,202805,2028),('2028-05-16',202820,5,2028,16,20,202805,2028),('2028-05-17',202820,5,2028,17,20,202805,2028),('2028-05-18',202820,5,2028,18,20,202805,2028),('2028-05-19',202820,5,2028,19,20,202805,2028),('2028-05-20',202820,5,2028,20,20,202805,2028),('2028-05-21',202821,5,2028,21,21,202805,2028),('2028-05-22',202821,5,2028,22,21,202805,2028),('2028-05-23',202821,5,2028,23,21,202805,2028),('2028-05-24',202821,5,2028,24,21,202805,2028),('2028-05-25',202821,5,2028,25,21,202805,2028),('2028-05-26',202821,5,2028,26,21,202805,2028),('2028-05-27',202821,5,2028,27,21,202805,2028),('2028-05-28',202822,5,2028,28,22,202805,2028),('2028-05-29',202822,5,2028,29,22,202805,2028),('2028-05-30',202822,5,2028,30,22,202805,2028),('2028-05-31',202822,5,2028,31,22,202805,2028),('2028-06-01',202822,6,2028,1,22,202806,2028),('2028-06-02',202822,6,2028,2,22,202806,2028),('2028-06-03',202822,6,2028,3,22,202806,2028),('2028-06-04',202823,6,2028,4,23,202806,2028),('2028-06-05',202823,6,2028,5,23,202806,2028),('2028-06-06',202823,6,2028,6,23,202806,2028),('2028-06-07',202823,6,2028,7,23,202806,2028),('2028-06-08',202823,6,2028,8,23,202806,2028),('2028-06-09',202823,6,2028,9,23,202806,2028),('2028-06-10',202823,6,2028,10,23,202806,2028),('2028-06-11',202824,6,2028,11,24,202806,2028),('2028-06-12',202824,6,2028,12,24,202806,2028),('2028-06-13',202824,6,2028,13,24,202806,2028),('2028-06-14',202824,6,2028,14,24,202806,2028),('2028-06-15',202824,6,2028,15,24,202806,2028),('2028-06-16',202824,6,2028,16,24,202806,2028),('2028-06-17',202824,6,2028,17,24,202806,2028),('2028-06-18',202825,6,2028,18,25,202806,2028),('2028-06-19',202825,6,2028,19,25,202806,2028),('2028-06-20',202825,6,2028,20,25,202806,2028),('2028-06-21',202825,6,2028,21,25,202806,2028),('2028-06-22',202825,6,2028,22,25,202806,2028),('2028-06-23',202825,6,2028,23,25,202806,2028),('2028-06-24',202825,6,2028,24,25,202806,2028),('2028-06-25',202826,6,2028,25,26,202806,2028),('2028-06-26',202826,6,2028,26,26,202806,2028),('2028-06-27',202826,6,2028,27,26,202806,2028),('2028-06-28',202826,6,2028,28,26,202806,2028),('2028-06-29',202826,6,2028,29,26,202806,2028),('2028-06-30',202826,6,2028,30,26,202806,2028),('2028-07-01',202826,7,2028,1,26,202807,2028),('2028-07-02',202827,7,2028,2,27,202807,2028),('2028-07-03',202827,7,2028,3,27,202807,2028),('2028-07-04',202827,7,2028,4,27,202807,2028),('2028-07-05',202827,7,2028,5,27,202807,2028),('2028-07-06',202827,7,2028,6,27,202807,2028),('2028-07-07',202827,7,2028,7,27,202807,2028),('2028-07-08',202827,7,2028,8,27,202807,2028),('2028-07-09',202828,7,2028,9,28,202807,2028),('2028-07-10',202828,7,2028,10,28,202807,2028),('2028-07-11',202828,7,2028,11,28,202807,2028),('2028-07-12',202828,7,2028,12,28,202807,2028),('2028-07-13',202828,7,2028,13,28,202807,2028),('2028-07-14',202828,7,2028,14,28,202807,2028),('2028-07-15',202828,7,2028,15,28,202807,2028),('2028-07-16',202829,7,2028,16,29,202807,2028),('2028-07-17',202829,7,2028,17,29,202807,2028),('2028-07-18',202829,7,2028,18,29,202807,2028),('2028-07-19',202829,7,2028,19,29,202807,2028),('2028-07-20',202829,7,2028,20,29,202807,2028),('2028-07-21',202829,7,2028,21,29,202807,2028),('2028-07-22',202829,7,2028,22,29,202807,2028),('2028-07-23',202830,7,2028,23,30,202807,2028),('2028-07-24',202830,7,2028,24,30,202807,2028),('2028-07-25',202830,7,2028,25,30,202807,2028),('2028-07-26',202830,7,2028,26,30,202807,2028),('2028-07-27',202830,7,2028,27,30,202807,2028),('2028-07-28',202830,7,2028,28,30,202807,2028),('2028-07-29',202830,7,2028,29,30,202807,2028),('2028-07-30',202831,7,2028,30,31,202807,2028),('2028-07-31',202831,7,2028,31,31,202807,2028),('2028-08-01',202831,8,2028,1,31,202808,2028),('2028-08-02',202831,8,2028,2,31,202808,2028),('2028-08-03',202831,8,2028,3,31,202808,2028),('2028-08-04',202831,8,2028,4,31,202808,2028),('2028-08-05',202831,8,2028,5,31,202808,2028),('2028-08-06',202832,8,2028,6,32,202808,2028),('2028-08-07',202832,8,2028,7,32,202808,2028),('2028-08-08',202832,8,2028,8,32,202808,2028),('2028-08-09',202832,8,2028,9,32,202808,2028),('2028-08-10',202832,8,2028,10,32,202808,2028),('2028-08-11',202832,8,2028,11,32,202808,2028),('2028-08-12',202832,8,2028,12,32,202808,2028),('2028-08-13',202833,8,2028,13,33,202808,2028),('2028-08-14',202833,8,2028,14,33,202808,2028),('2028-08-15',202833,8,2028,15,33,202808,2028),('2028-08-16',202833,8,2028,16,33,202808,2028),('2028-08-17',202833,8,2028,17,33,202808,2028),('2028-08-18',202833,8,2028,18,33,202808,2028),('2028-08-19',202833,8,2028,19,33,202808,2028),('2028-08-20',202834,8,2028,20,34,202808,2028),('2028-08-21',202834,8,2028,21,34,202808,2028),('2028-08-22',202834,8,2028,22,34,202808,2028),('2028-08-23',202834,8,2028,23,34,202808,2028),('2028-08-24',202834,8,2028,24,34,202808,2028),('2028-08-25',202834,8,2028,25,34,202808,2028),('2028-08-26',202834,8,2028,26,34,202808,2028),('2028-08-27',202835,8,2028,27,35,202808,2028),('2028-08-28',202835,8,2028,28,35,202808,2028),('2028-08-29',202835,8,2028,29,35,202808,2028),('2028-08-30',202835,8,2028,30,35,202808,2028),('2028-08-31',202835,8,2028,31,35,202808,2028),('2028-09-01',202835,9,2028,1,35,202809,2028),('2028-09-02',202835,9,2028,2,35,202809,2028),('2028-09-03',202836,9,2028,3,36,202809,2028),('2028-09-04',202836,9,2028,4,36,202809,2028),('2028-09-05',202836,9,2028,5,36,202809,2028),('2028-09-06',202836,9,2028,6,36,202809,2028),('2028-09-07',202836,9,2028,7,36,202809,2028),('2028-09-08',202836,9,2028,8,36,202809,2028),('2028-09-09',202836,9,2028,9,36,202809,2028),('2028-09-10',202837,9,2028,10,37,202809,2028),('2028-09-11',202837,9,2028,11,37,202809,2028),('2028-09-12',202837,9,2028,12,37,202809,2028),('2028-09-13',202837,9,2028,13,37,202809,2028),('2028-09-14',202837,9,2028,14,37,202809,2028),('2028-09-15',202837,9,2028,15,37,202809,2028),('2028-09-16',202837,9,2028,16,37,202809,2028),('2028-09-17',202838,9,2028,17,38,202809,2028),('2028-09-18',202838,9,2028,18,38,202809,2028),('2028-09-19',202838,9,2028,19,38,202809,2028),('2028-09-20',202838,9,2028,20,38,202809,2028),('2028-09-21',202838,9,2028,21,38,202809,2028),('2028-09-22',202838,9,2028,22,38,202809,2028),('2028-09-23',202838,9,2028,23,38,202809,2028),('2028-09-24',202839,9,2028,24,39,202809,2028),('2028-09-25',202839,9,2028,25,39,202809,2028),('2028-09-26',202839,9,2028,26,39,202809,2028),('2028-09-27',202839,9,2028,27,39,202809,2028),('2028-09-28',202839,9,2028,28,39,202809,2028),('2028-09-29',202839,9,2028,29,39,202809,2028),('2028-09-30',202839,9,2028,30,39,202809,2028),('2028-10-01',202840,10,2028,1,40,202810,2028),('2028-10-02',202840,10,2028,2,40,202810,2028),('2028-10-03',202840,10,2028,3,40,202810,2028),('2028-10-04',202840,10,2028,4,40,202810,2028),('2028-10-05',202840,10,2028,5,40,202810,2028),('2028-10-06',202840,10,2028,6,40,202810,2028),('2028-10-07',202840,10,2028,7,40,202810,2028),('2028-10-08',202841,10,2028,8,41,202810,2028),('2028-10-09',202841,10,2028,9,41,202810,2028),('2028-10-10',202841,10,2028,10,41,202810,2028),('2028-10-11',202841,10,2028,11,41,202810,2028),('2028-10-12',202841,10,2028,12,41,202810,2028),('2028-10-13',202841,10,2028,13,41,202810,2028),('2028-10-14',202841,10,2028,14,41,202810,2028),('2028-10-15',202842,10,2028,15,42,202810,2028),('2028-10-16',202842,10,2028,16,42,202810,2028),('2028-10-17',202842,10,2028,17,42,202810,2028),('2028-10-18',202842,10,2028,18,42,202810,2028),('2028-10-19',202842,10,2028,19,42,202810,2028),('2028-10-20',202842,10,2028,20,42,202810,2028),('2028-10-21',202842,10,2028,21,42,202810,2028),('2028-10-22',202843,10,2028,22,43,202810,2028),('2028-10-23',202843,10,2028,23,43,202810,2028),('2028-10-24',202843,10,2028,24,43,202810,2028),('2028-10-25',202843,10,2028,25,43,202810,2028),('2028-10-26',202843,10,2028,26,43,202810,2028),('2028-10-27',202843,10,2028,27,43,202810,2028),('2028-10-28',202843,10,2028,28,43,202810,2028),('2028-10-29',202844,10,2028,29,44,202810,2028),('2028-10-30',202844,10,2028,30,44,202810,2028),('2028-10-31',202844,10,2028,31,44,202810,2028),('2028-11-01',202844,11,2028,1,44,202811,2028),('2028-11-02',202844,11,2028,2,44,202811,2028),('2028-11-03',202844,11,2028,3,44,202811,2028),('2028-11-04',202844,11,2028,4,44,202811,2028),('2028-11-05',202845,11,2028,5,45,202811,2028),('2028-11-06',202845,11,2028,6,45,202811,2028),('2028-11-07',202845,11,2028,7,45,202811,2028),('2028-11-08',202845,11,2028,8,45,202811,2028),('2028-11-09',202845,11,2028,9,45,202811,2028),('2028-11-10',202845,11,2028,10,45,202811,2028),('2028-11-11',202845,11,2028,11,45,202811,2028),('2028-11-12',202846,11,2028,12,46,202811,2028),('2028-11-13',202846,11,2028,13,46,202811,2028),('2028-11-14',202846,11,2028,14,46,202811,2028),('2028-11-15',202846,11,2028,15,46,202811,2028),('2028-11-16',202846,11,2028,16,46,202811,2028),('2028-11-17',202846,11,2028,17,46,202811,2028),('2028-11-18',202846,11,2028,18,46,202811,2028),('2028-11-19',202847,11,2028,19,47,202811,2028),('2028-11-20',202847,11,2028,20,47,202811,2028),('2028-11-21',202847,11,2028,21,47,202811,2028),('2028-11-22',202847,11,2028,22,47,202811,2028),('2028-11-23',202847,11,2028,23,47,202811,2028),('2028-11-24',202847,11,2028,24,47,202811,2028),('2028-11-25',202847,11,2028,25,47,202811,2028),('2028-11-26',202848,11,2028,26,48,202811,2028),('2028-11-27',202848,11,2028,27,48,202811,2028),('2028-11-28',202848,11,2028,28,48,202811,2028),('2028-11-29',202848,11,2028,29,48,202811,2028),('2028-11-30',202848,11,2028,30,48,202811,2028),('2028-12-01',202848,12,2028,1,48,202812,2029),('2028-12-02',202848,12,2028,2,48,202812,2029),('2028-12-03',202849,12,2028,3,49,202812,2029),('2028-12-04',202849,12,2028,4,49,202812,2029),('2028-12-05',202849,12,2028,5,49,202812,2029),('2028-12-06',202849,12,2028,6,49,202812,2029),('2028-12-07',202849,12,2028,7,49,202812,2029),('2028-12-08',202849,12,2028,8,49,202812,2029),('2028-12-09',202849,12,2028,9,49,202812,2029),('2028-12-10',202850,12,2028,10,50,202812,2029),('2028-12-11',202850,12,2028,11,50,202812,2029),('2028-12-12',202850,12,2028,12,50,202812,2029),('2028-12-13',202850,12,2028,13,50,202812,2029),('2028-12-14',202850,12,2028,14,50,202812,2029),('2028-12-15',202850,12,2028,15,50,202812,2029),('2028-12-16',202850,12,2028,16,50,202812,2029),('2028-12-17',202851,12,2028,17,51,202812,2029),('2028-12-18',202851,12,2028,18,51,202812,2029),('2028-12-19',202851,12,2028,19,51,202812,2029),('2028-12-20',202851,12,2028,20,51,202812,2029),('2028-12-21',202851,12,2028,21,51,202812,2029),('2028-12-22',202851,12,2028,22,51,202812,2029),('2028-12-23',202851,12,2028,23,51,202812,2029),('2028-12-24',202852,12,2028,24,52,202812,2029),('2028-12-25',202852,12,2028,25,52,202812,2029),('2028-12-26',202852,12,2028,26,52,202812,2029),('2028-12-27',202852,12,2028,27,52,202812,2029),('2028-12-28',202852,12,2028,28,52,202812,2029),('2028-12-29',202852,12,2028,29,52,202812,2029),('2028-12-30',202852,12,2028,30,52,202812,2029),('2028-12-31',202853,12,2028,31,1,202812,2029),('2029-01-01',202901,1,2029,1,1,202901,2029),('2029-01-02',202901,1,2029,2,1,202901,2029),('2029-01-03',202901,1,2029,3,1,202901,2029),('2029-01-04',202901,1,2029,4,1,202901,2029),('2029-01-05',202901,1,2029,5,1,202901,2029),('2029-01-06',202901,1,2029,6,1,202901,2029),('2029-01-07',202902,1,2029,7,2,202901,2029),('2029-01-08',202902,1,2029,8,2,202901,2029),('2029-01-09',202902,1,2029,9,2,202901,2029),('2029-01-10',202902,1,2029,10,2,202901,2029),('2029-01-11',202902,1,2029,11,2,202901,2029),('2029-01-12',202902,1,2029,12,2,202901,2029),('2029-01-13',202902,1,2029,13,2,202901,2029),('2029-01-14',202903,1,2029,14,3,202901,2029),('2029-01-15',202903,1,2029,15,3,202901,2029),('2029-01-16',202903,1,2029,16,3,202901,2029),('2029-01-17',202903,1,2029,17,3,202901,2029),('2029-01-18',202903,1,2029,18,3,202901,2029),('2029-01-19',202903,1,2029,19,3,202901,2029),('2029-01-20',202903,1,2029,20,3,202901,2029),('2029-01-21',202904,1,2029,21,4,202901,2029),('2029-01-22',202904,1,2029,22,4,202901,2029),('2029-01-23',202904,1,2029,23,4,202901,2029),('2029-01-24',202904,1,2029,24,4,202901,2029),('2029-01-25',202904,1,2029,25,4,202901,2029),('2029-01-26',202904,1,2029,26,4,202901,2029),('2029-01-27',202904,1,2029,27,4,202901,2029),('2029-01-28',202905,1,2029,28,5,202901,2029),('2029-01-29',202905,1,2029,29,5,202901,2029),('2029-01-30',202905,1,2029,30,5,202901,2029),('2029-01-31',202905,1,2029,31,5,202901,2029),('2029-02-01',202905,2,2029,1,5,202902,2029),('2029-02-02',202905,2,2029,2,5,202902,2029),('2029-02-03',202905,2,2029,3,5,202902,2029),('2029-02-04',202906,2,2029,4,6,202902,2029),('2029-02-05',202906,2,2029,5,6,202902,2029),('2029-02-06',202906,2,2029,6,6,202902,2029),('2029-02-07',202906,2,2029,7,6,202902,2029),('2029-02-08',202906,2,2029,8,6,202902,2029),('2029-02-09',202906,2,2029,9,6,202902,2029),('2029-02-10',202906,2,2029,10,6,202902,2029),('2029-02-11',202907,2,2029,11,7,202902,2029),('2029-02-12',202907,2,2029,12,7,202902,2029),('2029-02-13',202907,2,2029,13,7,202902,2029),('2029-02-14',202907,2,2029,14,7,202902,2029),('2029-02-15',202907,2,2029,15,7,202902,2029),('2029-02-16',202907,2,2029,16,7,202902,2029),('2029-02-17',202907,2,2029,17,7,202902,2029),('2029-02-18',202908,2,2029,18,8,202902,2029),('2029-02-19',202908,2,2029,19,8,202902,2029),('2029-02-20',202908,2,2029,20,8,202902,2029),('2029-02-21',202908,2,2029,21,8,202902,2029),('2029-02-22',202908,2,2029,22,8,202902,2029),('2029-02-23',202908,2,2029,23,8,202902,2029),('2029-02-24',202908,2,2029,24,8,202902,2029),('2029-02-25',202909,2,2029,25,9,202902,2029),('2029-02-26',202909,2,2029,26,9,202902,2029),('2029-02-27',202909,2,2029,27,9,202902,2029),('2029-02-28',202909,2,2029,28,9,202902,2029),('2029-03-01',202909,3,2029,1,9,202903,2029),('2029-03-02',202909,3,2029,2,9,202903,2029),('2029-03-03',202909,3,2029,3,9,202903,2029),('2029-03-04',202910,3,2029,4,10,202903,2029),('2029-03-05',202910,3,2029,5,10,202903,2029),('2029-03-06',202910,3,2029,6,10,202903,2029),('2029-03-07',202910,3,2029,7,10,202903,2029),('2029-03-08',202910,3,2029,8,10,202903,2029),('2029-03-09',202910,3,2029,9,10,202903,2029),('2029-03-10',202910,3,2029,10,10,202903,2029),('2029-03-11',202911,3,2029,11,11,202903,2029),('2029-03-12',202911,3,2029,12,11,202903,2029),('2029-03-13',202911,3,2029,13,11,202903,2029),('2029-03-14',202911,3,2029,14,11,202903,2029),('2029-03-15',202911,3,2029,15,11,202903,2029),('2029-03-16',202911,3,2029,16,11,202903,2029),('2029-03-17',202911,3,2029,17,11,202903,2029),('2029-03-18',202912,3,2029,18,12,202903,2029),('2029-03-19',202912,3,2029,19,12,202903,2029),('2029-03-20',202912,3,2029,20,12,202903,2029),('2029-03-21',202912,3,2029,21,12,202903,2029),('2029-03-22',202912,3,2029,22,12,202903,2029),('2029-03-23',202912,3,2029,23,12,202903,2029),('2029-03-24',202912,3,2029,24,12,202903,2029),('2029-03-25',202913,3,2029,25,13,202903,2029),('2029-03-26',202913,3,2029,26,13,202903,2029),('2029-03-27',202913,3,2029,27,13,202903,2029),('2029-03-28',202913,3,2029,28,13,202903,2029),('2029-03-29',202913,3,2029,29,13,202903,2029),('2029-03-30',202913,3,2029,30,13,202903,2029),('2029-03-31',202913,3,2029,31,13,202903,2029),('2029-04-01',202914,4,2029,1,14,202904,2029),('2029-04-02',202914,4,2029,2,14,202904,2029),('2029-04-03',202914,4,2029,3,14,202904,2029),('2029-04-04',202914,4,2029,4,14,202904,2029),('2029-04-05',202914,4,2029,5,14,202904,2029),('2029-04-06',202914,4,2029,6,14,202904,2029),('2029-04-07',202914,4,2029,7,14,202904,2029),('2029-04-08',202915,4,2029,8,15,202904,2029),('2029-04-09',202915,4,2029,9,15,202904,2029),('2029-04-10',202915,4,2029,10,15,202904,2029),('2029-04-11',202915,4,2029,11,15,202904,2029),('2029-04-12',202915,4,2029,12,15,202904,2029),('2029-04-13',202915,4,2029,13,15,202904,2029),('2029-04-14',202915,4,2029,14,15,202904,2029),('2029-04-15',202916,4,2029,15,16,202904,2029),('2029-04-16',202916,4,2029,16,16,202904,2029),('2029-04-17',202916,4,2029,17,16,202904,2029),('2029-04-18',202916,4,2029,18,16,202904,2029),('2029-04-19',202916,4,2029,19,16,202904,2029),('2029-04-20',202916,4,2029,20,16,202904,2029),('2029-04-21',202916,4,2029,21,16,202904,2029),('2029-04-22',202917,4,2029,22,17,202904,2029),('2029-04-23',202917,4,2029,23,17,202904,2029),('2029-04-24',202917,4,2029,24,17,202904,2029),('2029-04-25',202917,4,2029,25,17,202904,2029),('2029-04-26',202917,4,2029,26,17,202904,2029),('2029-04-27',202917,4,2029,27,17,202904,2029),('2029-04-28',202917,4,2029,28,17,202904,2029),('2029-04-29',202918,4,2029,29,18,202904,2029),('2029-04-30',202918,4,2029,30,18,202904,2029),('2029-05-01',202918,5,2029,1,18,202905,2029),('2029-05-02',202918,5,2029,2,18,202905,2029),('2029-05-03',202918,5,2029,3,18,202905,2029),('2029-05-04',202918,5,2029,4,18,202905,2029),('2029-05-05',202918,5,2029,5,18,202905,2029),('2029-05-06',202919,5,2029,6,19,202905,2029),('2029-05-07',202919,5,2029,7,19,202905,2029),('2029-05-08',202919,5,2029,8,19,202905,2029),('2029-05-09',202919,5,2029,9,19,202905,2029),('2029-05-10',202919,5,2029,10,19,202905,2029),('2029-05-11',202919,5,2029,11,19,202905,2029),('2029-05-12',202919,5,2029,12,19,202905,2029),('2029-05-13',202920,5,2029,13,20,202905,2029),('2029-05-14',202920,5,2029,14,20,202905,2029),('2029-05-15',202920,5,2029,15,20,202905,2029),('2029-05-16',202920,5,2029,16,20,202905,2029),('2029-05-17',202920,5,2029,17,20,202905,2029),('2029-05-18',202920,5,2029,18,20,202905,2029),('2029-05-19',202920,5,2029,19,20,202905,2029),('2029-05-20',202921,5,2029,20,21,202905,2029),('2029-05-21',202921,5,2029,21,21,202905,2029),('2029-05-22',202921,5,2029,22,21,202905,2029),('2029-05-23',202921,5,2029,23,21,202905,2029),('2029-05-24',202921,5,2029,24,21,202905,2029),('2029-05-25',202921,5,2029,25,21,202905,2029),('2029-05-26',202921,5,2029,26,21,202905,2029),('2029-05-27',202922,5,2029,27,22,202905,2029),('2029-05-28',202922,5,2029,28,22,202905,2029),('2029-05-29',202922,5,2029,29,22,202905,2029),('2029-05-30',202922,5,2029,30,22,202905,2029),('2029-05-31',202922,5,2029,31,22,202905,2029),('2029-06-01',202922,6,2029,1,22,202906,2029),('2029-06-02',202922,6,2029,2,22,202906,2029),('2029-06-03',202923,6,2029,3,23,202906,2029),('2029-06-04',202923,6,2029,4,23,202906,2029),('2029-06-05',202923,6,2029,5,23,202906,2029),('2029-06-06',202923,6,2029,6,23,202906,2029),('2029-06-07',202923,6,2029,7,23,202906,2029),('2029-06-08',202923,6,2029,8,23,202906,2029),('2029-06-09',202923,6,2029,9,23,202906,2029),('2029-06-10',202924,6,2029,10,24,202906,2029),('2029-06-11',202924,6,2029,11,24,202906,2029),('2029-06-12',202924,6,2029,12,24,202906,2029),('2029-06-13',202924,6,2029,13,24,202906,2029),('2029-06-14',202924,6,2029,14,24,202906,2029),('2029-06-15',202924,6,2029,15,24,202906,2029),('2029-06-16',202924,6,2029,16,24,202906,2029),('2029-06-17',202925,6,2029,17,25,202906,2029),('2029-06-18',202925,6,2029,18,25,202906,2029),('2029-06-19',202925,6,2029,19,25,202906,2029),('2029-06-20',202925,6,2029,20,25,202906,2029),('2029-06-21',202925,6,2029,21,25,202906,2029),('2029-06-22',202925,6,2029,22,25,202906,2029),('2029-06-23',202925,6,2029,23,25,202906,2029),('2029-06-24',202926,6,2029,24,26,202906,2029),('2029-06-25',202926,6,2029,25,26,202906,2029),('2029-06-26',202926,6,2029,26,26,202906,2029),('2029-06-27',202926,6,2029,27,26,202906,2029),('2029-06-28',202926,6,2029,28,26,202906,2029),('2029-06-29',202926,6,2029,29,26,202906,2029),('2029-06-30',202926,6,2029,30,26,202906,2029),('2029-07-01',202927,7,2029,1,27,202907,2029),('2029-07-02',202927,7,2029,2,27,202907,2029),('2029-07-03',202927,7,2029,3,27,202907,2029),('2029-07-04',202927,7,2029,4,27,202907,2029),('2029-07-05',202927,7,2029,5,27,202907,2029),('2029-07-06',202927,7,2029,6,27,202907,2029),('2029-07-07',202927,7,2029,7,27,202907,2029),('2029-07-08',202928,7,2029,8,28,202907,2029),('2029-07-09',202928,7,2029,9,28,202907,2029),('2029-07-10',202928,7,2029,10,28,202907,2029),('2029-07-11',202928,7,2029,11,28,202907,2029),('2029-07-12',202928,7,2029,12,28,202907,2029),('2029-07-13',202928,7,2029,13,28,202907,2029),('2029-07-14',202928,7,2029,14,28,202907,2029),('2029-07-15',202929,7,2029,15,29,202907,2029),('2029-07-16',202929,7,2029,16,29,202907,2029),('2029-07-17',202929,7,2029,17,29,202907,2029),('2029-07-18',202929,7,2029,18,29,202907,2029),('2029-07-19',202929,7,2029,19,29,202907,2029),('2029-07-20',202929,7,2029,20,29,202907,2029),('2029-07-21',202929,7,2029,21,29,202907,2029),('2029-07-22',202930,7,2029,22,30,202907,2029),('2029-07-23',202930,7,2029,23,30,202907,2029),('2029-07-24',202930,7,2029,24,30,202907,2029),('2029-07-25',202930,7,2029,25,30,202907,2029),('2029-07-26',202930,7,2029,26,30,202907,2029),('2029-07-27',202930,7,2029,27,30,202907,2029),('2029-07-28',202930,7,2029,28,30,202907,2029),('2029-07-29',202931,7,2029,29,31,202907,2029),('2029-07-30',202931,7,2029,30,31,202907,2029),('2029-07-31',202931,7,2029,31,31,202907,2029),('2029-08-01',202931,8,2029,1,31,202908,2029),('2029-08-02',202931,8,2029,2,31,202908,2029),('2029-08-03',202931,8,2029,3,31,202908,2029),('2029-08-04',202931,8,2029,4,31,202908,2029),('2029-08-05',202932,8,2029,5,32,202908,2029),('2029-08-06',202932,8,2029,6,32,202908,2029),('2029-08-07',202932,8,2029,7,32,202908,2029),('2029-08-08',202932,8,2029,8,32,202908,2029),('2029-08-09',202932,8,2029,9,32,202908,2029),('2029-08-10',202932,8,2029,10,32,202908,2029),('2029-08-11',202932,8,2029,11,32,202908,2029),('2029-08-12',202933,8,2029,12,33,202908,2029),('2029-08-13',202933,8,2029,13,33,202908,2029),('2029-08-14',202933,8,2029,14,33,202908,2029),('2029-08-15',202933,8,2029,15,33,202908,2029),('2029-08-16',202933,8,2029,16,33,202908,2029),('2029-08-17',202933,8,2029,17,33,202908,2029),('2029-08-18',202933,8,2029,18,33,202908,2029),('2029-08-19',202934,8,2029,19,34,202908,2029),('2029-08-20',202934,8,2029,20,34,202908,2029),('2029-08-21',202934,8,2029,21,34,202908,2029),('2029-08-22',202934,8,2029,22,34,202908,2029),('2029-08-23',202934,8,2029,23,34,202908,2029),('2029-08-24',202934,8,2029,24,34,202908,2029),('2029-08-25',202934,8,2029,25,34,202908,2029),('2029-08-26',202935,8,2029,26,35,202908,2029),('2029-08-27',202935,8,2029,27,35,202908,2029),('2029-08-28',202935,8,2029,28,35,202908,2029),('2029-08-29',202935,8,2029,29,35,202908,2029),('2029-08-30',202935,8,2029,30,35,202908,2029),('2029-08-31',202935,8,2029,31,35,202908,2029),('2029-09-01',202935,9,2029,1,35,202909,2029),('2029-09-02',202936,9,2029,2,36,202909,2029),('2029-09-03',202936,9,2029,3,36,202909,2029),('2029-09-04',202936,9,2029,4,36,202909,2029),('2029-09-05',202936,9,2029,5,36,202909,2029),('2029-09-06',202936,9,2029,6,36,202909,2029),('2029-09-07',202936,9,2029,7,36,202909,2029),('2029-09-08',202936,9,2029,8,36,202909,2029),('2029-09-09',202937,9,2029,9,37,202909,2029),('2029-09-10',202937,9,2029,10,37,202909,2029),('2029-09-11',202937,9,2029,11,37,202909,2029),('2029-09-12',202937,9,2029,12,37,202909,2029),('2029-09-13',202937,9,2029,13,37,202909,2029),('2029-09-14',202937,9,2029,14,37,202909,2029),('2029-09-15',202937,9,2029,15,37,202909,2029),('2029-09-16',202938,9,2029,16,38,202909,2029),('2029-09-17',202938,9,2029,17,38,202909,2029),('2029-09-18',202938,9,2029,18,38,202909,2029),('2029-09-19',202938,9,2029,19,38,202909,2029),('2029-09-20',202938,9,2029,20,38,202909,2029),('2029-09-21',202938,9,2029,21,38,202909,2029),('2029-09-22',202938,9,2029,22,38,202909,2029),('2029-09-23',202939,9,2029,23,39,202909,2029),('2029-09-24',202939,9,2029,24,39,202909,2029),('2029-09-25',202939,9,2029,25,39,202909,2029),('2029-09-26',202939,9,2029,26,39,202909,2029),('2029-09-27',202939,9,2029,27,39,202909,2029),('2029-09-28',202939,9,2029,28,39,202909,2029),('2029-09-29',202939,9,2029,29,39,202909,2029),('2029-09-30',202940,9,2029,30,40,202909,2029),('2029-10-01',202940,10,2029,1,40,202910,2029),('2029-10-02',202940,10,2029,2,40,202910,2029),('2029-10-03',202940,10,2029,3,40,202910,2029),('2029-10-04',202940,10,2029,4,40,202910,2029),('2029-10-05',202940,10,2029,5,40,202910,2029),('2029-10-06',202940,10,2029,6,40,202910,2029),('2029-10-07',202941,10,2029,7,41,202910,2029),('2029-10-08',202941,10,2029,8,41,202910,2029),('2029-10-09',202941,10,2029,9,41,202910,2029),('2029-10-10',202941,10,2029,10,41,202910,2029),('2029-10-11',202941,10,2029,11,41,202910,2029),('2029-10-12',202941,10,2029,12,41,202910,2029),('2029-10-13',202941,10,2029,13,41,202910,2029),('2029-10-14',202942,10,2029,14,42,202910,2029),('2029-10-15',202942,10,2029,15,42,202910,2029),('2029-10-16',202942,10,2029,16,42,202910,2029),('2029-10-17',202942,10,2029,17,42,202910,2029),('2029-10-18',202942,10,2029,18,42,202910,2029),('2029-10-19',202942,10,2029,19,42,202910,2029),('2029-10-20',202942,10,2029,20,42,202910,2029),('2029-10-21',202943,10,2029,21,43,202910,2029),('2029-10-22',202943,10,2029,22,43,202910,2029),('2029-10-23',202943,10,2029,23,43,202910,2029),('2029-10-24',202943,10,2029,24,43,202910,2029),('2029-10-25',202943,10,2029,25,43,202910,2029),('2029-10-26',202943,10,2029,26,43,202910,2029),('2029-10-27',202943,10,2029,27,43,202910,2029),('2029-10-28',202944,10,2029,28,44,202910,2029),('2029-10-29',202944,10,2029,29,44,202910,2029),('2029-10-30',202944,10,2029,30,44,202910,2029),('2029-10-31',202944,10,2029,31,44,202910,2029),('2029-11-01',202944,11,2029,1,44,202911,2029),('2029-11-02',202944,11,2029,2,44,202911,2029),('2029-11-03',202944,11,2029,3,44,202911,2029),('2029-11-04',202945,11,2029,4,45,202911,2029),('2029-11-05',202945,11,2029,5,45,202911,2029),('2029-11-06',202945,11,2029,6,45,202911,2029),('2029-11-07',202945,11,2029,7,45,202911,2029),('2029-11-08',202945,11,2029,8,45,202911,2029),('2029-11-09',202945,11,2029,9,45,202911,2029),('2029-11-10',202945,11,2029,10,45,202911,2029),('2029-11-11',202946,11,2029,11,46,202911,2029),('2029-11-12',202946,11,2029,12,46,202911,2029),('2029-11-13',202946,11,2029,13,46,202911,2029),('2029-11-14',202946,11,2029,14,46,202911,2029),('2029-11-15',202946,11,2029,15,46,202911,2029),('2029-11-16',202946,11,2029,16,46,202911,2029),('2029-11-17',202946,11,2029,17,46,202911,2029),('2029-11-18',202947,11,2029,18,47,202911,2029),('2029-11-19',202947,11,2029,19,47,202911,2029),('2029-11-20',202947,11,2029,20,47,202911,2029),('2029-11-21',202947,11,2029,21,47,202911,2029),('2029-11-22',202947,11,2029,22,47,202911,2029),('2029-11-23',202947,11,2029,23,47,202911,2029),('2029-11-24',202947,11,2029,24,47,202911,2029),('2029-11-25',202948,11,2029,25,48,202911,2029),('2029-11-26',202948,11,2029,26,48,202911,2029),('2029-11-27',202948,11,2029,27,48,202911,2029),('2029-11-28',202948,11,2029,28,48,202911,2029),('2029-11-29',202948,11,2029,29,48,202911,2029),('2029-11-30',202948,11,2029,30,48,202911,2029),('2029-12-01',202948,12,2029,1,48,202912,2030),('2029-12-02',202949,12,2029,2,49,202912,2030),('2029-12-03',202949,12,2029,3,49,202912,2030),('2029-12-04',202949,12,2029,4,49,202912,2030),('2029-12-05',202949,12,2029,5,49,202912,2030),('2029-12-06',202949,12,2029,6,49,202912,2030),('2029-12-07',202949,12,2029,7,49,202912,2030),('2029-12-08',202949,12,2029,8,49,202912,2030),('2029-12-09',202950,12,2029,9,50,202912,2030),('2029-12-10',202950,12,2029,10,50,202912,2030),('2029-12-11',202950,12,2029,11,50,202912,2030),('2029-12-12',202950,12,2029,12,50,202912,2030),('2029-12-13',202950,12,2029,13,50,202912,2030),('2029-12-14',202950,12,2029,14,50,202912,2030),('2029-12-15',202950,12,2029,15,50,202912,2030),('2029-12-16',202951,12,2029,16,51,202912,2030),('2029-12-17',202951,12,2029,17,51,202912,2030),('2029-12-18',202951,12,2029,18,51,202912,2030),('2029-12-19',202951,12,2029,19,51,202912,2030),('2029-12-20',202951,12,2029,20,51,202912,2030),('2029-12-21',202951,12,2029,21,51,202912,2030),('2029-12-22',202951,12,2029,22,51,202912,2030),('2029-12-23',202952,12,2029,23,52,202912,2030),('2029-12-24',202952,12,2029,24,52,202912,2030),('2029-12-25',202952,12,2029,25,52,202912,2030),('2029-12-26',202952,12,2029,26,52,202912,2030),('2029-12-27',202952,12,2029,27,52,202912,2030),('2029-12-28',202952,12,2029,28,52,202912,2030),('2029-12-29',202952,12,2029,29,52,202912,2030),('2029-12-30',202953,12,2029,30,1,202912,2030),('2029-12-31',202901,12,2029,31,1,202912,2030),('2030-01-01',203001,1,2030,1,1,203001,2030),('2030-01-02',203001,1,2030,2,1,203001,2030),('2030-01-03',203001,1,2030,3,1,203001,2030),('2030-01-04',203001,1,2030,4,1,203001,2030),('2030-01-05',203001,1,2030,5,1,203001,2030),('2030-01-06',203002,1,2030,6,2,203001,2030),('2030-01-07',203002,1,2030,7,2,203001,2030),('2030-01-08',203002,1,2030,8,2,203001,2030),('2030-01-09',203002,1,2030,9,2,203001,2030),('2030-01-10',203002,1,2030,10,2,203001,2030),('2030-01-11',203002,1,2030,11,2,203001,2030),('2030-01-12',203002,1,2030,12,2,203001,2030),('2030-01-13',203003,1,2030,13,3,203001,2030),('2030-01-14',203003,1,2030,14,3,203001,2030),('2030-01-15',203003,1,2030,15,3,203001,2030),('2030-01-16',203003,1,2030,16,3,203001,2030),('2030-01-17',203003,1,2030,17,3,203001,2030),('2030-01-18',203003,1,2030,18,3,203001,2030),('2030-01-19',203003,1,2030,19,3,203001,2030),('2030-01-20',203004,1,2030,20,4,203001,2030),('2030-01-21',203004,1,2030,21,4,203001,2030),('2030-01-22',203004,1,2030,22,4,203001,2030),('2030-01-23',203004,1,2030,23,4,203001,2030),('2030-01-24',203004,1,2030,24,4,203001,2030),('2030-01-25',203004,1,2030,25,4,203001,2030),('2030-01-26',203004,1,2030,26,4,203001,2030),('2030-01-27',203005,1,2030,27,5,203001,2030),('2030-01-28',203005,1,2030,28,5,203001,2030),('2030-01-29',203005,1,2030,29,5,203001,2030),('2030-01-30',203005,1,2030,30,5,203001,2030),('2030-01-31',203005,1,2030,31,5,203001,2030),('2030-02-01',203005,2,2030,1,5,203002,2030),('2030-02-02',203005,2,2030,2,5,203002,2030),('2030-02-03',203006,2,2030,3,6,203002,2030),('2030-02-04',203006,2,2030,4,6,203002,2030),('2030-02-05',203006,2,2030,5,6,203002,2030),('2030-02-06',203006,2,2030,6,6,203002,2030),('2030-02-07',203006,2,2030,7,6,203002,2030),('2030-02-08',203006,2,2030,8,6,203002,2030),('2030-02-09',203006,2,2030,9,6,203002,2030),('2030-02-10',203007,2,2030,10,7,203002,2030),('2030-02-11',203007,2,2030,11,7,203002,2030),('2030-02-12',203007,2,2030,12,7,203002,2030),('2030-02-13',203007,2,2030,13,7,203002,2030),('2030-02-14',203007,2,2030,14,7,203002,2030),('2030-02-15',203007,2,2030,15,7,203002,2030),('2030-02-16',203007,2,2030,16,7,203002,2030),('2030-02-17',203008,2,2030,17,8,203002,2030),('2030-02-18',203008,2,2030,18,8,203002,2030),('2030-02-19',203008,2,2030,19,8,203002,2030),('2030-02-20',203008,2,2030,20,8,203002,2030),('2030-02-21',203008,2,2030,21,8,203002,2030),('2030-02-22',203008,2,2030,22,8,203002,2030),('2030-02-23',203008,2,2030,23,8,203002,2030),('2030-02-24',203009,2,2030,24,9,203002,2030),('2030-02-25',203009,2,2030,25,9,203002,2030),('2030-02-26',203009,2,2030,26,9,203002,2030),('2030-02-27',203009,2,2030,27,9,203002,2030),('2030-02-28',203009,2,2030,28,9,203002,2030),('2030-03-01',203009,3,2030,1,9,203003,2030),('2030-03-02',203009,3,2030,2,9,203003,2030),('2030-03-03',203010,3,2030,3,10,203003,2030),('2030-03-04',203010,3,2030,4,10,203003,2030),('2030-03-05',203010,3,2030,5,10,203003,2030),('2030-03-06',203010,3,2030,6,10,203003,2030),('2030-03-07',203010,3,2030,7,10,203003,2030),('2030-03-08',203010,3,2030,8,10,203003,2030),('2030-03-09',203010,3,2030,9,10,203003,2030),('2030-03-10',203011,3,2030,10,11,203003,2030),('2030-03-11',203011,3,2030,11,11,203003,2030),('2030-03-12',203011,3,2030,12,11,203003,2030),('2030-03-13',203011,3,2030,13,11,203003,2030),('2030-03-14',203011,3,2030,14,11,203003,2030),('2030-03-15',203011,3,2030,15,11,203003,2030),('2030-03-16',203011,3,2030,16,11,203003,2030),('2030-03-17',203012,3,2030,17,12,203003,2030),('2030-03-18',203012,3,2030,18,12,203003,2030),('2030-03-19',203012,3,2030,19,12,203003,2030),('2030-03-20',203012,3,2030,20,12,203003,2030),('2030-03-21',203012,3,2030,21,12,203003,2030),('2030-03-22',203012,3,2030,22,12,203003,2030),('2030-03-23',203012,3,2030,23,12,203003,2030),('2030-03-24',203013,3,2030,24,13,203003,2030),('2030-03-25',203013,3,2030,25,13,203003,2030),('2030-03-26',203013,3,2030,26,13,203003,2030),('2030-03-27',203013,3,2030,27,13,203003,2030),('2030-03-28',203013,3,2030,28,13,203003,2030),('2030-03-29',203013,3,2030,29,13,203003,2030),('2030-03-30',203013,3,2030,30,13,203003,2030),('2030-03-31',203014,3,2030,31,14,203003,2030),('2030-04-01',203014,4,2030,1,14,203004,2030),('2030-04-02',203014,4,2030,2,14,203004,2030),('2030-04-03',203014,4,2030,3,14,203004,2030),('2030-04-04',203014,4,2030,4,14,203004,2030),('2030-04-05',203014,4,2030,5,14,203004,2030),('2030-04-06',203014,4,2030,6,14,203004,2030),('2030-04-07',203015,4,2030,7,15,203004,2030),('2030-04-08',203015,4,2030,8,15,203004,2030),('2030-04-09',203015,4,2030,9,15,203004,2030),('2030-04-10',203015,4,2030,10,15,203004,2030),('2030-04-11',203015,4,2030,11,15,203004,2030),('2030-04-12',203015,4,2030,12,15,203004,2030),('2030-04-13',203015,4,2030,13,15,203004,2030),('2030-04-14',203016,4,2030,14,16,203004,2030),('2030-04-15',203016,4,2030,15,16,203004,2030),('2030-04-16',203016,4,2030,16,16,203004,2030),('2030-04-17',203016,4,2030,17,16,203004,2030),('2030-04-18',203016,4,2030,18,16,203004,2030),('2030-04-19',203016,4,2030,19,16,203004,2030),('2030-04-20',203016,4,2030,20,16,203004,2030),('2030-04-21',203017,4,2030,21,17,203004,2030),('2030-04-22',203017,4,2030,22,17,203004,2030),('2030-04-23',203017,4,2030,23,17,203004,2030),('2030-04-24',203017,4,2030,24,17,203004,2030),('2030-04-25',203017,4,2030,25,17,203004,2030),('2030-04-26',203017,4,2030,26,17,203004,2030),('2030-04-27',203017,4,2030,27,17,203004,2030),('2030-04-28',203018,4,2030,28,18,203004,2030),('2030-04-29',203018,4,2030,29,18,203004,2030),('2030-04-30',203018,4,2030,30,18,203004,2030),('2030-05-01',203018,5,2030,1,18,203005,2030),('2030-05-02',203018,5,2030,2,18,203005,2030),('2030-05-03',203018,5,2030,3,18,203005,2030),('2030-05-04',203018,5,2030,4,18,203005,2030),('2030-05-05',203019,5,2030,5,19,203005,2030),('2030-05-06',203019,5,2030,6,19,203005,2030),('2030-05-07',203019,5,2030,7,19,203005,2030),('2030-05-08',203019,5,2030,8,19,203005,2030),('2030-05-09',203019,5,2030,9,19,203005,2030),('2030-05-10',203019,5,2030,10,19,203005,2030),('2030-05-11',203019,5,2030,11,19,203005,2030),('2030-05-12',203020,5,2030,12,20,203005,2030),('2030-05-13',203020,5,2030,13,20,203005,2030),('2030-05-14',203020,5,2030,14,20,203005,2030),('2030-05-15',203020,5,2030,15,20,203005,2030),('2030-05-16',203020,5,2030,16,20,203005,2030),('2030-05-17',203020,5,2030,17,20,203005,2030),('2030-05-18',203020,5,2030,18,20,203005,2030),('2030-05-19',203021,5,2030,19,21,203005,2030),('2030-05-20',203021,5,2030,20,21,203005,2030),('2030-05-21',203021,5,2030,21,21,203005,2030),('2030-05-22',203021,5,2030,22,21,203005,2030),('2030-05-23',203021,5,2030,23,21,203005,2030),('2030-05-24',203021,5,2030,24,21,203005,2030),('2030-05-25',203021,5,2030,25,21,203005,2030),('2030-05-26',203022,5,2030,26,22,203005,2030),('2030-05-27',203022,5,2030,27,22,203005,2030),('2030-05-28',203022,5,2030,28,22,203005,2030),('2030-05-29',203022,5,2030,29,22,203005,2030),('2030-05-30',203022,5,2030,30,22,203005,2030),('2030-05-31',203022,5,2030,31,22,203005,2030),('2030-06-01',203022,6,2030,1,22,203006,2030),('2030-06-02',203023,6,2030,2,23,203006,2030),('2030-06-03',203023,6,2030,3,23,203006,2030),('2030-06-04',203023,6,2030,4,23,203006,2030),('2030-06-05',203023,6,2030,5,23,203006,2030),('2030-06-06',203023,6,2030,6,23,203006,2030),('2030-06-07',203023,6,2030,7,23,203006,2030),('2030-06-08',203023,6,2030,8,23,203006,2030),('2030-06-09',203024,6,2030,9,24,203006,2030),('2030-06-10',203024,6,2030,10,24,203006,2030),('2030-06-11',203024,6,2030,11,24,203006,2030),('2030-06-12',203024,6,2030,12,24,203006,2030),('2030-06-13',203024,6,2030,13,24,203006,2030),('2030-06-14',203024,6,2030,14,24,203006,2030),('2030-06-15',203024,6,2030,15,24,203006,2030),('2030-06-16',203025,6,2030,16,25,203006,2030),('2030-06-17',203025,6,2030,17,25,203006,2030),('2030-06-18',203025,6,2030,18,25,203006,2030),('2030-06-19',203025,6,2030,19,25,203006,2030),('2030-06-20',203025,6,2030,20,25,203006,2030),('2030-06-21',203025,6,2030,21,25,203006,2030),('2030-06-22',203025,6,2030,22,25,203006,2030),('2030-06-23',203026,6,2030,23,26,203006,2030),('2030-06-24',203026,6,2030,24,26,203006,2030),('2030-06-25',203026,6,2030,25,26,203006,2030),('2030-06-26',203026,6,2030,26,26,203006,2030),('2030-06-27',203026,6,2030,27,26,203006,2030),('2030-06-28',203026,6,2030,28,26,203006,2030),('2030-06-29',203026,6,2030,29,26,203006,2030),('2030-06-30',203027,6,2030,30,27,203006,2030),('2030-07-01',203027,7,2030,1,27,203007,2030),('2030-07-02',203027,7,2030,2,27,203007,2030),('2030-07-03',203027,7,2030,3,27,203007,2030),('2030-07-04',203027,7,2030,4,27,203007,2030),('2030-07-05',203027,7,2030,5,27,203007,2030),('2030-07-06',203027,7,2030,6,27,203007,2030),('2030-07-07',203028,7,2030,7,28,203007,2030),('2030-07-08',203028,7,2030,8,28,203007,2030),('2030-07-09',203028,7,2030,9,28,203007,2030),('2030-07-10',203028,7,2030,10,28,203007,2030),('2030-07-11',203028,7,2030,11,28,203007,2030),('2030-07-12',203028,7,2030,12,28,203007,2030),('2030-07-13',203028,7,2030,13,28,203007,2030),('2030-07-14',203029,7,2030,14,29,203007,2030),('2030-07-15',203029,7,2030,15,29,203007,2030),('2030-07-16',203029,7,2030,16,29,203007,2030),('2030-07-17',203029,7,2030,17,29,203007,2030),('2030-07-18',203029,7,2030,18,29,203007,2030),('2030-07-19',203029,7,2030,19,29,203007,2030),('2030-07-20',203029,7,2030,20,29,203007,2030),('2030-07-21',203030,7,2030,21,30,203007,2030),('2030-07-22',203030,7,2030,22,30,203007,2030),('2030-07-23',203030,7,2030,23,30,203007,2030),('2030-07-24',203030,7,2030,24,30,203007,2030),('2030-07-25',203030,7,2030,25,30,203007,2030),('2030-07-26',203030,7,2030,26,30,203007,2030),('2030-07-27',203030,7,2030,27,30,203007,2030),('2030-07-28',203031,7,2030,28,31,203007,2030),('2030-07-29',203031,7,2030,29,31,203007,2030),('2030-07-30',203031,7,2030,30,31,203007,2030),('2030-07-31',203031,7,2030,31,31,203007,2030),('2030-08-01',203031,8,2030,1,31,203008,2030),('2030-08-02',203031,8,2030,2,31,203008,2030),('2030-08-03',203031,8,2030,3,31,203008,2030),('2030-08-04',203032,8,2030,4,32,203008,2030),('2030-08-05',203032,8,2030,5,32,203008,2030),('2030-08-06',203032,8,2030,6,32,203008,2030),('2030-08-07',203032,8,2030,7,32,203008,2030),('2030-08-08',203032,8,2030,8,32,203008,2030),('2030-08-09',203032,8,2030,9,32,203008,2030),('2030-08-10',203032,8,2030,10,32,203008,2030),('2030-08-11',203033,8,2030,11,33,203008,2030),('2030-08-12',203033,8,2030,12,33,203008,2030),('2030-08-13',203033,8,2030,13,33,203008,2030),('2030-08-14',203033,8,2030,14,33,203008,2030),('2030-08-15',203033,8,2030,15,33,203008,2030),('2030-08-16',203033,8,2030,16,33,203008,2030),('2030-08-17',203033,8,2030,17,33,203008,2030),('2030-08-18',203034,8,2030,18,34,203008,2030),('2030-08-19',203034,8,2030,19,34,203008,2030),('2030-08-20',203034,8,2030,20,34,203008,2030),('2030-08-21',203034,8,2030,21,34,203008,2030),('2030-08-22',203034,8,2030,22,34,203008,2030),('2030-08-23',203034,8,2030,23,34,203008,2030),('2030-08-24',203034,8,2030,24,34,203008,2030),('2030-08-25',203035,8,2030,25,35,203008,2030),('2030-08-26',203035,8,2030,26,35,203008,2030),('2030-08-27',203035,8,2030,27,35,203008,2030),('2030-08-28',203035,8,2030,28,35,203008,2030),('2030-08-29',203035,8,2030,29,35,203008,2030),('2030-08-30',203035,8,2030,30,35,203008,2030),('2030-08-31',203035,8,2030,31,35,203008,2030),('2030-09-01',203036,9,2030,1,36,203009,2030),('2030-09-02',203036,9,2030,2,36,203009,2030),('2030-09-03',203036,9,2030,3,36,203009,2030),('2030-09-04',203036,9,2030,4,36,203009,2030),('2030-09-05',203036,9,2030,5,36,203009,2030),('2030-09-06',203036,9,2030,6,36,203009,2030),('2030-09-07',203036,9,2030,7,36,203009,2030),('2030-09-08',203037,9,2030,8,37,203009,2030),('2030-09-09',203037,9,2030,9,37,203009,2030),('2030-09-10',203037,9,2030,10,37,203009,2030),('2030-09-11',203037,9,2030,11,37,203009,2030),('2030-09-12',203037,9,2030,12,37,203009,2030),('2030-09-13',203037,9,2030,13,37,203009,2030),('2030-09-14',203037,9,2030,14,37,203009,2030),('2030-09-15',203038,9,2030,15,38,203009,2030),('2030-09-16',203038,9,2030,16,38,203009,2030),('2030-09-17',203038,9,2030,17,38,203009,2030),('2030-09-18',203038,9,2030,18,38,203009,2030),('2030-09-19',203038,9,2030,19,38,203009,2030),('2030-09-20',203038,9,2030,20,38,203009,2030),('2030-09-21',203038,9,2030,21,38,203009,2030),('2030-09-22',203039,9,2030,22,39,203009,2030),('2030-09-23',203039,9,2030,23,39,203009,2030),('2030-09-24',203039,9,2030,24,39,203009,2030),('2030-09-25',203039,9,2030,25,39,203009,2030),('2030-09-26',203039,9,2030,26,39,203009,2030),('2030-09-27',203039,9,2030,27,39,203009,2030),('2030-09-28',203039,9,2030,28,39,203009,2030),('2030-09-29',203040,9,2030,29,40,203009,2030),('2030-09-30',203040,9,2030,30,40,203009,2030),('2030-10-01',203040,10,2030,1,40,203010,2030),('2030-10-02',203040,10,2030,2,40,203010,2030),('2030-10-03',203040,10,2030,3,40,203010,2030),('2030-10-04',203040,10,2030,4,40,203010,2030),('2030-10-05',203040,10,2030,5,40,203010,2030),('2030-10-06',203041,10,2030,6,41,203010,2030),('2030-10-07',203041,10,2030,7,41,203010,2030),('2030-10-08',203041,10,2030,8,41,203010,2030),('2030-10-09',203041,10,2030,9,41,203010,2030),('2030-10-10',203041,10,2030,10,41,203010,2030),('2030-10-11',203041,10,2030,11,41,203010,2030),('2030-10-12',203041,10,2030,12,41,203010,2030),('2030-10-13',203042,10,2030,13,42,203010,2030),('2030-10-14',203042,10,2030,14,42,203010,2030),('2030-10-15',203042,10,2030,15,42,203010,2030),('2030-10-16',203042,10,2030,16,42,203010,2030),('2030-10-17',203042,10,2030,17,42,203010,2030),('2030-10-18',203042,10,2030,18,42,203010,2030),('2030-10-19',203042,10,2030,19,42,203010,2030),('2030-10-20',203043,10,2030,20,43,203010,2030),('2030-10-21',203043,10,2030,21,43,203010,2030),('2030-10-22',203043,10,2030,22,43,203010,2030),('2030-10-23',203043,10,2030,23,43,203010,2030),('2030-10-24',203043,10,2030,24,43,203010,2030),('2030-10-25',203043,10,2030,25,43,203010,2030),('2030-10-26',203043,10,2030,26,43,203010,2030),('2030-10-27',203044,10,2030,27,44,203010,2030),('2030-10-28',203044,10,2030,28,44,203010,2030),('2030-10-29',203044,10,2030,29,44,203010,2030),('2030-10-30',203044,10,2030,30,44,203010,2030),('2030-10-31',203044,10,2030,31,44,203010,2030),('2030-11-01',203044,11,2030,1,44,203011,2030),('2030-11-02',203044,11,2030,2,44,203011,2030),('2030-11-03',203045,11,2030,3,45,203011,2030),('2030-11-04',203045,11,2030,4,45,203011,2030),('2030-11-05',203045,11,2030,5,45,203011,2030),('2030-11-06',203045,11,2030,6,45,203011,2030),('2030-11-07',203045,11,2030,7,45,203011,2030),('2030-11-08',203045,11,2030,8,45,203011,2030),('2030-11-09',203045,11,2030,9,45,203011,2030),('2030-11-10',203046,11,2030,10,46,203011,2030),('2030-11-11',203046,11,2030,11,46,203011,2030),('2030-11-12',203046,11,2030,12,46,203011,2030),('2030-11-13',203046,11,2030,13,46,203011,2030),('2030-11-14',203046,11,2030,14,46,203011,2030),('2030-11-15',203046,11,2030,15,46,203011,2030),('2030-11-16',203046,11,2030,16,46,203011,2030),('2030-11-17',203047,11,2030,17,47,203011,2030),('2030-11-18',203047,11,2030,18,47,203011,2030),('2030-11-19',203047,11,2030,19,47,203011,2030),('2030-11-20',203047,11,2030,20,47,203011,2030),('2030-11-21',203047,11,2030,21,47,203011,2030),('2030-11-22',203047,11,2030,22,47,203011,2030),('2030-11-23',203047,11,2030,23,47,203011,2030),('2030-11-24',203048,11,2030,24,48,203011,2030),('2030-11-25',203048,11,2030,25,48,203011,2030),('2030-11-26',203048,11,2030,26,48,203011,2030),('2030-11-27',203048,11,2030,27,48,203011,2030),('2030-11-28',203048,11,2030,28,48,203011,2030),('2030-11-29',203048,11,2030,29,48,203011,2030),('2030-11-30',203048,11,2030,30,48,203011,2030),('2030-12-01',203049,12,2030,1,49,203012,2031),('2030-12-02',203049,12,2030,2,49,203012,2031),('2030-12-03',203049,12,2030,3,49,203012,2031),('2030-12-04',203049,12,2030,4,49,203012,2031),('2030-12-05',203049,12,2030,5,49,203012,2031),('2030-12-06',203049,12,2030,6,49,203012,2031),('2030-12-07',203049,12,2030,7,49,203012,2031),('2030-12-08',203050,12,2030,8,50,203012,2031),('2030-12-09',203050,12,2030,9,50,203012,2031),('2030-12-10',203050,12,2030,10,50,203012,2031),('2030-12-11',203050,12,2030,11,50,203012,2031),('2030-12-12',203050,12,2030,12,50,203012,2031),('2030-12-13',203050,12,2030,13,50,203012,2031),('2030-12-14',203050,12,2030,14,50,203012,2031),('2030-12-15',203051,12,2030,15,51,203012,2031),('2030-12-16',203051,12,2030,16,51,203012,2031),('2030-12-17',203051,12,2030,17,51,203012,2031),('2030-12-18',203051,12,2030,18,51,203012,2031),('2030-12-19',203051,12,2030,19,51,203012,2031),('2030-12-20',203051,12,2030,20,51,203012,2031),('2030-12-21',203051,12,2030,21,51,203012,2031),('2030-12-22',203052,12,2030,22,52,203012,2031),('2030-12-23',203052,12,2030,23,52,203012,2031),('2030-12-24',203052,12,2030,24,52,203012,2031),('2030-12-25',203052,12,2030,25,52,203012,2031),('2030-12-26',203052,12,2030,26,52,203012,2031),('2030-12-27',203052,12,2030,27,52,203012,2031),('2030-12-28',203052,12,2030,28,52,203012,2031),('2030-12-29',203053,12,2030,29,1,203012,2031),('2030-12-30',203001,12,2030,30,1,203012,2031),('2030-12-31',203001,12,2030,31,1,203012,2031),('2031-01-01',203101,1,2031,1,1,203101,2031),('2031-01-02',203101,1,2031,2,1,203101,2031),('2031-01-03',203101,1,2031,3,1,203101,2031),('2031-01-04',203101,1,2031,4,1,203101,2031),('2031-01-05',203102,1,2031,5,2,203101,2031),('2031-01-06',203102,1,2031,6,2,203101,2031),('2031-01-07',203102,1,2031,7,2,203101,2031),('2031-01-08',203102,1,2031,8,2,203101,2031),('2031-01-09',203102,1,2031,9,2,203101,2031),('2031-01-10',203102,1,2031,10,2,203101,2031),('2031-01-11',203102,1,2031,11,2,203101,2031),('2031-01-12',203103,1,2031,12,3,203101,2031),('2031-01-13',203103,1,2031,13,3,203101,2031),('2031-01-14',203103,1,2031,14,3,203101,2031),('2031-01-15',203103,1,2031,15,3,203101,2031),('2031-01-16',203103,1,2031,16,3,203101,2031),('2031-01-17',203103,1,2031,17,3,203101,2031),('2031-01-18',203103,1,2031,18,3,203101,2031),('2031-01-19',203104,1,2031,19,4,203101,2031),('2031-01-20',203104,1,2031,20,4,203101,2031),('2031-01-21',203104,1,2031,21,4,203101,2031),('2031-01-22',203104,1,2031,22,4,203101,2031),('2031-01-23',203104,1,2031,23,4,203101,2031),('2031-01-24',203104,1,2031,24,4,203101,2031),('2031-01-25',203104,1,2031,25,4,203101,2031),('2031-01-26',203105,1,2031,26,5,203101,2031),('2031-01-27',203105,1,2031,27,5,203101,2031),('2031-01-28',203105,1,2031,28,5,203101,2031),('2031-01-29',203105,1,2031,29,5,203101,2031),('2031-01-30',203105,1,2031,30,5,203101,2031),('2031-01-31',203105,1,2031,31,5,203101,2031),('2031-02-01',203105,2,2031,1,5,203102,2031),('2031-02-02',203106,2,2031,2,6,203102,2031),('2031-02-03',203106,2,2031,3,6,203102,2031),('2031-02-04',203106,2,2031,4,6,203102,2031),('2031-02-05',203106,2,2031,5,6,203102,2031),('2031-02-06',203106,2,2031,6,6,203102,2031),('2031-02-07',203106,2,2031,7,6,203102,2031),('2031-02-08',203106,2,2031,8,6,203102,2031),('2031-02-09',203107,2,2031,9,7,203102,2031),('2031-02-10',203107,2,2031,10,7,203102,2031),('2031-02-11',203107,2,2031,11,7,203102,2031),('2031-02-12',203107,2,2031,12,7,203102,2031),('2031-02-13',203107,2,2031,13,7,203102,2031),('2031-02-14',203107,2,2031,14,7,203102,2031),('2031-02-15',203107,2,2031,15,7,203102,2031),('2031-02-16',203108,2,2031,16,8,203102,2031),('2031-02-17',203108,2,2031,17,8,203102,2031),('2031-02-18',203108,2,2031,18,8,203102,2031),('2031-02-19',203108,2,2031,19,8,203102,2031),('2031-02-20',203108,2,2031,20,8,203102,2031),('2031-02-21',203108,2,2031,21,8,203102,2031),('2031-02-22',203108,2,2031,22,8,203102,2031),('2031-02-23',203109,2,2031,23,9,203102,2031),('2031-02-24',203109,2,2031,24,9,203102,2031),('2031-02-25',203109,2,2031,25,9,203102,2031),('2031-02-26',203109,2,2031,26,9,203102,2031),('2031-02-27',203109,2,2031,27,9,203102,2031),('2031-02-28',203109,2,2031,28,9,203102,2031),('2031-03-01',203109,3,2031,1,9,203103,2031),('2031-03-02',203110,3,2031,2,10,203103,2031),('2031-03-03',203110,3,2031,3,10,203103,2031),('2031-03-04',203110,3,2031,4,10,203103,2031),('2031-03-05',203110,3,2031,5,10,203103,2031),('2031-03-06',203110,3,2031,6,10,203103,2031),('2031-03-07',203110,3,2031,7,10,203103,2031),('2031-03-08',203110,3,2031,8,10,203103,2031),('2031-03-09',203111,3,2031,9,11,203103,2031),('2031-03-10',203111,3,2031,10,11,203103,2031),('2031-03-11',203111,3,2031,11,11,203103,2031),('2031-03-12',203111,3,2031,12,11,203103,2031),('2031-03-13',203111,3,2031,13,11,203103,2031),('2031-03-14',203111,3,2031,14,11,203103,2031),('2031-03-15',203111,3,2031,15,11,203103,2031),('2031-03-16',203112,3,2031,16,12,203103,2031),('2031-03-17',203112,3,2031,17,12,203103,2031),('2031-03-18',203112,3,2031,18,12,203103,2031),('2031-03-19',203112,3,2031,19,12,203103,2031),('2031-03-20',203112,3,2031,20,12,203103,2031),('2031-03-21',203112,3,2031,21,12,203103,2031),('2031-03-22',203112,3,2031,22,12,203103,2031),('2031-03-23',203113,3,2031,23,13,203103,2031),('2031-03-24',203113,3,2031,24,13,203103,2031),('2031-03-25',203113,3,2031,25,13,203103,2031),('2031-03-26',203113,3,2031,26,13,203103,2031),('2031-03-27',203113,3,2031,27,13,203103,2031),('2031-03-28',203113,3,2031,28,13,203103,2031),('2031-03-29',203113,3,2031,29,13,203103,2031),('2031-03-30',203114,3,2031,30,14,203103,2031),('2031-03-31',203114,3,2031,31,14,203103,2031),('2031-04-01',203114,4,2031,1,14,203104,2031),('2031-04-02',203114,4,2031,2,14,203104,2031),('2031-04-03',203114,4,2031,3,14,203104,2031),('2031-04-04',203114,4,2031,4,14,203104,2031),('2031-04-05',203114,4,2031,5,14,203104,2031),('2031-04-06',203115,4,2031,6,15,203104,2031),('2031-04-07',203115,4,2031,7,15,203104,2031),('2031-04-08',203115,4,2031,8,15,203104,2031),('2031-04-09',203115,4,2031,9,15,203104,2031),('2031-04-10',203115,4,2031,10,15,203104,2031),('2031-04-11',203115,4,2031,11,15,203104,2031),('2031-04-12',203115,4,2031,12,15,203104,2031),('2031-04-13',203116,4,2031,13,16,203104,2031),('2031-04-14',203116,4,2031,14,16,203104,2031),('2031-04-15',203116,4,2031,15,16,203104,2031),('2031-04-16',203116,4,2031,16,16,203104,2031),('2031-04-17',203116,4,2031,17,16,203104,2031),('2031-04-18',203116,4,2031,18,16,203104,2031),('2031-04-19',203116,4,2031,19,16,203104,2031),('2031-04-20',203117,4,2031,20,17,203104,2031),('2031-04-21',203117,4,2031,21,17,203104,2031),('2031-04-22',203117,4,2031,22,17,203104,2031),('2031-04-23',203117,4,2031,23,17,203104,2031),('2031-04-24',203117,4,2031,24,17,203104,2031),('2031-04-25',203117,4,2031,25,17,203104,2031),('2031-04-26',203117,4,2031,26,17,203104,2031),('2031-04-27',203118,4,2031,27,18,203104,2031),('2031-04-28',203118,4,2031,28,18,203104,2031),('2031-04-29',203118,4,2031,29,18,203104,2031),('2031-04-30',203118,4,2031,30,18,203104,2031),('2031-05-01',203118,5,2031,1,18,203105,2031),('2031-05-02',203118,5,2031,2,18,203105,2031),('2031-05-03',203118,5,2031,3,18,203105,2031),('2031-05-04',203119,5,2031,4,19,203105,2031),('2031-05-05',203119,5,2031,5,19,203105,2031),('2031-05-06',203119,5,2031,6,19,203105,2031),('2031-05-07',203119,5,2031,7,19,203105,2031),('2031-05-08',203119,5,2031,8,19,203105,2031),('2031-05-09',203119,5,2031,9,19,203105,2031),('2031-05-10',203119,5,2031,10,19,203105,2031),('2031-05-11',203120,5,2031,11,20,203105,2031),('2031-05-12',203120,5,2031,12,20,203105,2031),('2031-05-13',203120,5,2031,13,20,203105,2031),('2031-05-14',203120,5,2031,14,20,203105,2031),('2031-05-15',203120,5,2031,15,20,203105,2031),('2031-05-16',203120,5,2031,16,20,203105,2031),('2031-05-17',203120,5,2031,17,20,203105,2031),('2031-05-18',203121,5,2031,18,21,203105,2031),('2031-05-19',203121,5,2031,19,21,203105,2031),('2031-05-20',203121,5,2031,20,21,203105,2031),('2031-05-21',203121,5,2031,21,21,203105,2031),('2031-05-22',203121,5,2031,22,21,203105,2031),('2031-05-23',203121,5,2031,23,21,203105,2031),('2031-05-24',203121,5,2031,24,21,203105,2031),('2031-05-25',203122,5,2031,25,22,203105,2031),('2031-05-26',203122,5,2031,26,22,203105,2031),('2031-05-27',203122,5,2031,27,22,203105,2031),('2031-05-28',203122,5,2031,28,22,203105,2031),('2031-05-29',203122,5,2031,29,22,203105,2031),('2031-05-30',203122,5,2031,30,22,203105,2031),('2031-05-31',203122,5,2031,31,22,203105,2031),('2031-06-01',203123,6,2031,1,23,203106,2031),('2031-06-02',203123,6,2031,2,23,203106,2031),('2031-06-03',203123,6,2031,3,23,203106,2031),('2031-06-04',203123,6,2031,4,23,203106,2031),('2031-06-05',203123,6,2031,5,23,203106,2031),('2031-06-06',203123,6,2031,6,23,203106,2031),('2031-06-07',203123,6,2031,7,23,203106,2031),('2031-06-08',203124,6,2031,8,24,203106,2031),('2031-06-09',203124,6,2031,9,24,203106,2031),('2031-06-10',203124,6,2031,10,24,203106,2031),('2031-06-11',203124,6,2031,11,24,203106,2031),('2031-06-12',203124,6,2031,12,24,203106,2031),('2031-06-13',203124,6,2031,13,24,203106,2031),('2031-06-14',203124,6,2031,14,24,203106,2031),('2031-06-15',203125,6,2031,15,25,203106,2031),('2031-06-16',203125,6,2031,16,25,203106,2031),('2031-06-17',203125,6,2031,17,25,203106,2031),('2031-06-18',203125,6,2031,18,25,203106,2031),('2031-06-19',203125,6,2031,19,25,203106,2031),('2031-06-20',203125,6,2031,20,25,203106,2031),('2031-06-21',203125,6,2031,21,25,203106,2031),('2031-06-22',203126,6,2031,22,26,203106,2031),('2031-06-23',203126,6,2031,23,26,203106,2031),('2031-06-24',203126,6,2031,24,26,203106,2031),('2031-06-25',203126,6,2031,25,26,203106,2031),('2031-06-26',203126,6,2031,26,26,203106,2031),('2031-06-27',203126,6,2031,27,26,203106,2031),('2031-06-28',203126,6,2031,28,26,203106,2031),('2031-06-29',203127,6,2031,29,27,203106,2031),('2031-06-30',203127,6,2031,30,27,203106,2031),('2031-07-01',203127,7,2031,1,27,203107,2031),('2031-07-02',203127,7,2031,2,27,203107,2031),('2031-07-03',203127,7,2031,3,27,203107,2031),('2031-07-04',203127,7,2031,4,27,203107,2031),('2031-07-05',203127,7,2031,5,27,203107,2031),('2031-07-06',203128,7,2031,6,28,203107,2031),('2031-07-07',203128,7,2031,7,28,203107,2031),('2031-07-08',203128,7,2031,8,28,203107,2031),('2031-07-09',203128,7,2031,9,28,203107,2031),('2031-07-10',203128,7,2031,10,28,203107,2031),('2031-07-11',203128,7,2031,11,28,203107,2031),('2031-07-12',203128,7,2031,12,28,203107,2031),('2031-07-13',203129,7,2031,13,29,203107,2031),('2031-07-14',203129,7,2031,14,29,203107,2031),('2031-07-15',203129,7,2031,15,29,203107,2031),('2031-07-16',203129,7,2031,16,29,203107,2031),('2031-07-17',203129,7,2031,17,29,203107,2031),('2031-07-18',203129,7,2031,18,29,203107,2031),('2031-07-19',203129,7,2031,19,29,203107,2031),('2031-07-20',203130,7,2031,20,30,203107,2031),('2031-07-21',203130,7,2031,21,30,203107,2031),('2031-07-22',203130,7,2031,22,30,203107,2031),('2031-07-23',203130,7,2031,23,30,203107,2031),('2031-07-24',203130,7,2031,24,30,203107,2031),('2031-07-25',203130,7,2031,25,30,203107,2031),('2031-07-26',203130,7,2031,26,30,203107,2031),('2031-07-27',203131,7,2031,27,31,203107,2031),('2031-07-28',203131,7,2031,28,31,203107,2031),('2031-07-29',203131,7,2031,29,31,203107,2031),('2031-07-30',203131,7,2031,30,31,203107,2031),('2031-07-31',203131,7,2031,31,31,203107,2031),('2031-08-01',203131,8,2031,1,31,203108,2031),('2031-08-02',203131,8,2031,2,31,203108,2031),('2031-08-03',203132,8,2031,3,32,203108,2031),('2031-08-04',203132,8,2031,4,32,203108,2031),('2031-08-05',203132,8,2031,5,32,203108,2031),('2031-08-06',203132,8,2031,6,32,203108,2031),('2031-08-07',203132,8,2031,7,32,203108,2031),('2031-08-08',203132,8,2031,8,32,203108,2031),('2031-08-09',203132,8,2031,9,32,203108,2031),('2031-08-10',203133,8,2031,10,33,203108,2031),('2031-08-11',203133,8,2031,11,33,203108,2031),('2031-08-12',203133,8,2031,12,33,203108,2031),('2031-08-13',203133,8,2031,13,33,203108,2031),('2031-08-14',203133,8,2031,14,33,203108,2031),('2031-08-15',203133,8,2031,15,33,203108,2031),('2031-08-16',203133,8,2031,16,33,203108,2031),('2031-08-17',203134,8,2031,17,34,203108,2031),('2031-08-18',203134,8,2031,18,34,203108,2031),('2031-08-19',203134,8,2031,19,34,203108,2031),('2031-08-20',203134,8,2031,20,34,203108,2031),('2031-08-21',203134,8,2031,21,34,203108,2031),('2031-08-22',203134,8,2031,22,34,203108,2031),('2031-08-23',203134,8,2031,23,34,203108,2031),('2031-08-24',203135,8,2031,24,35,203108,2031),('2031-08-25',203135,8,2031,25,35,203108,2031),('2031-08-26',203135,8,2031,26,35,203108,2031),('2031-08-27',203135,8,2031,27,35,203108,2031),('2031-08-28',203135,8,2031,28,35,203108,2031),('2031-08-29',203135,8,2031,29,35,203108,2031),('2031-08-30',203135,8,2031,30,35,203108,2031),('2031-08-31',203136,8,2031,31,36,203108,2031),('2031-09-01',203136,9,2031,1,36,203109,2031),('2031-09-02',203136,9,2031,2,36,203109,2031),('2031-09-03',203136,9,2031,3,36,203109,2031),('2031-09-04',203136,9,2031,4,36,203109,2031),('2031-09-05',203136,9,2031,5,36,203109,2031),('2031-09-06',203136,9,2031,6,36,203109,2031),('2031-09-07',203137,9,2031,7,37,203109,2031),('2031-09-08',203137,9,2031,8,37,203109,2031),('2031-09-09',203137,9,2031,9,37,203109,2031),('2031-09-10',203137,9,2031,10,37,203109,2031),('2031-09-11',203137,9,2031,11,37,203109,2031),('2031-09-12',203137,9,2031,12,37,203109,2031),('2031-09-13',203137,9,2031,13,37,203109,2031),('2031-09-14',203138,9,2031,14,38,203109,2031),('2031-09-15',203138,9,2031,15,38,203109,2031),('2031-09-16',203138,9,2031,16,38,203109,2031),('2031-09-17',203138,9,2031,17,38,203109,2031),('2031-09-18',203138,9,2031,18,38,203109,2031),('2031-09-19',203138,9,2031,19,38,203109,2031),('2031-09-20',203138,9,2031,20,38,203109,2031),('2031-09-21',203139,9,2031,21,39,203109,2031),('2031-09-22',203139,9,2031,22,39,203109,2031),('2031-09-23',203139,9,2031,23,39,203109,2031),('2031-09-24',203139,9,2031,24,39,203109,2031),('2031-09-25',203139,9,2031,25,39,203109,2031),('2031-09-26',203139,9,2031,26,39,203109,2031),('2031-09-27',203139,9,2031,27,39,203109,2031),('2031-09-28',203140,9,2031,28,40,203109,2031),('2031-09-29',203140,9,2031,29,40,203109,2031),('2031-09-30',203140,9,2031,30,40,203109,2031),('2031-10-01',203140,10,2031,1,40,203110,2031),('2031-10-02',203140,10,2031,2,40,203110,2031),('2031-10-03',203140,10,2031,3,40,203110,2031),('2031-10-04',203140,10,2031,4,40,203110,2031),('2031-10-05',203141,10,2031,5,41,203110,2031),('2031-10-06',203141,10,2031,6,41,203110,2031),('2031-10-07',203141,10,2031,7,41,203110,2031),('2031-10-08',203141,10,2031,8,41,203110,2031),('2031-10-09',203141,10,2031,9,41,203110,2031),('2031-10-10',203141,10,2031,10,41,203110,2031),('2031-10-11',203141,10,2031,11,41,203110,2031),('2031-10-12',203142,10,2031,12,42,203110,2031),('2031-10-13',203142,10,2031,13,42,203110,2031),('2031-10-14',203142,10,2031,14,42,203110,2031),('2031-10-15',203142,10,2031,15,42,203110,2031),('2031-10-16',203142,10,2031,16,42,203110,2031),('2031-10-17',203142,10,2031,17,42,203110,2031),('2031-10-18',203142,10,2031,18,42,203110,2031),('2031-10-19',203143,10,2031,19,43,203110,2031),('2031-10-20',203143,10,2031,20,43,203110,2031),('2031-10-21',203143,10,2031,21,43,203110,2031),('2031-10-22',203143,10,2031,22,43,203110,2031),('2031-10-23',203143,10,2031,23,43,203110,2031),('2031-10-24',203143,10,2031,24,43,203110,2031),('2031-10-25',203143,10,2031,25,43,203110,2031),('2031-10-26',203144,10,2031,26,44,203110,2031),('2031-10-27',203144,10,2031,27,44,203110,2031),('2031-10-28',203144,10,2031,28,44,203110,2031),('2031-10-29',203144,10,2031,29,44,203110,2031),('2031-10-30',203144,10,2031,30,44,203110,2031),('2031-10-31',203144,10,2031,31,44,203110,2031),('2031-11-01',203144,11,2031,1,44,203111,2031),('2031-11-02',203145,11,2031,2,45,203111,2031),('2031-11-03',203145,11,2031,3,45,203111,2031),('2031-11-04',203145,11,2031,4,45,203111,2031),('2031-11-05',203145,11,2031,5,45,203111,2031),('2031-11-06',203145,11,2031,6,45,203111,2031),('2031-11-07',203145,11,2031,7,45,203111,2031),('2031-11-08',203145,11,2031,8,45,203111,2031),('2031-11-09',203146,11,2031,9,46,203111,2031),('2031-11-10',203146,11,2031,10,46,203111,2031),('2031-11-11',203146,11,2031,11,46,203111,2031),('2031-11-12',203146,11,2031,12,46,203111,2031),('2031-11-13',203146,11,2031,13,46,203111,2031),('2031-11-14',203146,11,2031,14,46,203111,2031),('2031-11-15',203146,11,2031,15,46,203111,2031),('2031-11-16',203147,11,2031,16,47,203111,2031),('2031-11-17',203147,11,2031,17,47,203111,2031),('2031-11-18',203147,11,2031,18,47,203111,2031),('2031-11-19',203147,11,2031,19,47,203111,2031),('2031-11-20',203147,11,2031,20,47,203111,2031),('2031-11-21',203147,11,2031,21,47,203111,2031),('2031-11-22',203147,11,2031,22,47,203111,2031),('2031-11-23',203148,11,2031,23,48,203111,2031),('2031-11-24',203148,11,2031,24,48,203111,2031),('2031-11-25',203148,11,2031,25,48,203111,2031),('2031-11-26',203148,11,2031,26,48,203111,2031),('2031-11-27',203148,11,2031,27,48,203111,2031),('2031-11-28',203148,11,2031,28,48,203111,2031),('2031-11-29',203148,11,2031,29,48,203111,2031),('2031-11-30',203149,11,2031,30,49,203111,2031),('2031-12-01',203149,12,2031,1,49,203112,2032),('2031-12-02',203149,12,2031,2,49,203112,2032),('2031-12-03',203149,12,2031,3,49,203112,2032),('2031-12-04',203149,12,2031,4,49,203112,2032),('2031-12-05',203149,12,2031,5,49,203112,2032),('2031-12-06',203149,12,2031,6,49,203112,2032),('2031-12-07',203150,12,2031,7,50,203112,2032),('2031-12-08',203150,12,2031,8,50,203112,2032),('2031-12-09',203150,12,2031,9,50,203112,2032),('2031-12-10',203150,12,2031,10,50,203112,2032),('2031-12-11',203150,12,2031,11,50,203112,2032),('2031-12-12',203150,12,2031,12,50,203112,2032),('2031-12-13',203150,12,2031,13,50,203112,2032),('2031-12-14',203151,12,2031,14,51,203112,2032),('2031-12-15',203151,12,2031,15,51,203112,2032),('2031-12-16',203151,12,2031,16,51,203112,2032),('2031-12-17',203151,12,2031,17,51,203112,2032),('2031-12-18',203151,12,2031,18,51,203112,2032),('2031-12-19',203151,12,2031,19,51,203112,2032),('2031-12-20',203151,12,2031,20,51,203112,2032),('2031-12-21',203152,12,2031,21,52,203112,2032),('2031-12-22',203152,12,2031,22,52,203112,2032),('2031-12-23',203152,12,2031,23,52,203112,2032),('2031-12-24',203152,12,2031,24,52,203112,2032),('2031-12-25',203152,12,2031,25,52,203112,2032),('2031-12-26',203152,12,2031,26,52,203112,2032),('2031-12-27',203152,12,2031,27,52,203112,2032),('2031-12-28',203153,12,2031,28,53,203112,2032),('2031-12-29',203101,12,2031,29,53,203112,2032),('2031-12-30',203101,12,2031,30,53,203112,2032),('2031-12-31',203101,12,2031,31,53,203112,2032),('2032-01-01',203201,1,2032,1,53,203201,2032),('2032-01-02',203201,1,2032,2,53,203201,2032),('2032-01-03',203201,1,2032,3,53,203201,2032),('2032-01-04',203202,1,2032,4,1,203201,2032),('2032-01-05',203202,1,2032,5,1,203201,2032),('2032-01-06',203202,1,2032,6,1,203201,2032),('2032-01-07',203202,1,2032,7,1,203201,2032),('2032-01-08',203202,1,2032,8,1,203201,2032),('2032-01-09',203202,1,2032,9,1,203201,2032),('2032-01-10',203202,1,2032,10,1,203201,2032),('2032-01-11',203203,1,2032,11,2,203201,2032),('2032-01-12',203203,1,2032,12,2,203201,2032),('2032-01-13',203203,1,2032,13,2,203201,2032),('2032-01-14',203203,1,2032,14,2,203201,2032),('2032-01-15',203203,1,2032,15,2,203201,2032),('2032-01-16',203203,1,2032,16,2,203201,2032),('2032-01-17',203203,1,2032,17,2,203201,2032),('2032-01-18',203204,1,2032,18,3,203201,2032),('2032-01-19',203204,1,2032,19,3,203201,2032),('2032-01-20',203204,1,2032,20,3,203201,2032),('2032-01-21',203204,1,2032,21,3,203201,2032),('2032-01-22',203204,1,2032,22,3,203201,2032),('2032-01-23',203204,1,2032,23,3,203201,2032),('2032-01-24',203204,1,2032,24,3,203201,2032),('2032-01-25',203205,1,2032,25,4,203201,2032),('2032-01-26',203205,1,2032,26,4,203201,2032),('2032-01-27',203205,1,2032,27,4,203201,2032),('2032-01-28',203205,1,2032,28,4,203201,2032),('2032-01-29',203205,1,2032,29,4,203201,2032),('2032-01-30',203205,1,2032,30,4,203201,2032),('2032-01-31',203205,1,2032,31,4,203201,2032),('2032-02-01',203206,2,2032,1,5,203202,2032),('2032-02-02',203206,2,2032,2,5,203202,2032),('2032-02-03',203206,2,2032,3,5,203202,2032),('2032-02-04',203206,2,2032,4,5,203202,2032),('2032-02-05',203206,2,2032,5,5,203202,2032),('2032-02-06',203206,2,2032,6,5,203202,2032),('2032-02-07',203206,2,2032,7,5,203202,2032),('2032-02-08',203207,2,2032,8,6,203202,2032),('2032-02-09',203207,2,2032,9,6,203202,2032),('2032-02-10',203207,2,2032,10,6,203202,2032),('2032-02-11',203207,2,2032,11,6,203202,2032),('2032-02-12',203207,2,2032,12,6,203202,2032),('2032-02-13',203207,2,2032,13,6,203202,2032),('2032-02-14',203207,2,2032,14,6,203202,2032),('2032-02-15',203208,2,2032,15,7,203202,2032),('2032-02-16',203208,2,2032,16,7,203202,2032),('2032-02-17',203208,2,2032,17,7,203202,2032),('2032-02-18',203208,2,2032,18,7,203202,2032),('2032-02-19',203208,2,2032,19,7,203202,2032),('2032-02-20',203208,2,2032,20,7,203202,2032),('2032-02-21',203208,2,2032,21,7,203202,2032),('2032-02-22',203209,2,2032,22,8,203202,2032),('2032-02-23',203209,2,2032,23,8,203202,2032),('2032-02-24',203209,2,2032,24,8,203202,2032),('2032-02-25',203209,2,2032,25,8,203202,2032),('2032-02-26',203209,2,2032,26,8,203202,2032),('2032-02-27',203209,2,2032,27,8,203202,2032),('2032-02-28',203209,2,2032,28,8,203202,2032),('2032-02-29',203210,2,2032,29,9,203202,2032),('2032-03-01',203210,3,2032,1,9,203203,2032),('2032-03-02',203210,3,2032,2,9,203203,2032),('2032-03-03',203210,3,2032,3,9,203203,2032),('2032-03-04',203210,3,2032,4,9,203203,2032),('2032-03-05',203210,3,2032,5,9,203203,2032),('2032-03-06',203210,3,2032,6,9,203203,2032),('2032-03-07',203211,3,2032,7,10,203203,2032),('2032-03-08',203211,3,2032,8,10,203203,2032),('2032-03-09',203211,3,2032,9,10,203203,2032),('2032-03-10',203211,3,2032,10,10,203203,2032),('2032-03-11',203211,3,2032,11,10,203203,2032),('2032-03-12',203211,3,2032,12,10,203203,2032),('2032-03-13',203211,3,2032,13,10,203203,2032),('2032-03-14',203212,3,2032,14,11,203203,2032),('2032-03-15',203212,3,2032,15,11,203203,2032),('2032-03-16',203212,3,2032,16,11,203203,2032),('2032-03-17',203212,3,2032,17,11,203203,2032),('2032-03-18',203212,3,2032,18,11,203203,2032),('2032-03-19',203212,3,2032,19,11,203203,2032),('2032-03-20',203212,3,2032,20,11,203203,2032),('2032-03-21',203213,3,2032,21,12,203203,2032),('2032-03-22',203213,3,2032,22,12,203203,2032),('2032-03-23',203213,3,2032,23,12,203203,2032),('2032-03-24',203213,3,2032,24,12,203203,2032),('2032-03-25',203213,3,2032,25,12,203203,2032),('2032-03-26',203213,3,2032,26,12,203203,2032),('2032-03-27',203213,3,2032,27,12,203203,2032),('2032-03-28',203214,3,2032,28,13,203203,2032),('2032-03-29',203214,3,2032,29,13,203203,2032),('2032-03-30',203214,3,2032,30,13,203203,2032),('2032-03-31',203214,3,2032,31,13,203203,2032),('2032-04-01',203214,4,2032,1,13,203204,2032),('2032-04-02',203214,4,2032,2,13,203204,2032),('2032-04-03',203214,4,2032,3,13,203204,2032),('2032-04-04',203215,4,2032,4,14,203204,2032),('2032-04-05',203215,4,2032,5,14,203204,2032),('2032-04-06',203215,4,2032,6,14,203204,2032),('2032-04-07',203215,4,2032,7,14,203204,2032),('2032-04-08',203215,4,2032,8,14,203204,2032),('2032-04-09',203215,4,2032,9,14,203204,2032),('2032-04-10',203215,4,2032,10,14,203204,2032),('2032-04-11',203216,4,2032,11,15,203204,2032),('2032-04-12',203216,4,2032,12,15,203204,2032),('2032-04-13',203216,4,2032,13,15,203204,2032),('2032-04-14',203216,4,2032,14,15,203204,2032),('2032-04-15',203216,4,2032,15,15,203204,2032),('2032-04-16',203216,4,2032,16,15,203204,2032),('2032-04-17',203216,4,2032,17,15,203204,2032),('2032-04-18',203217,4,2032,18,16,203204,2032),('2032-04-19',203217,4,2032,19,16,203204,2032),('2032-04-20',203217,4,2032,20,16,203204,2032),('2032-04-21',203217,4,2032,21,16,203204,2032),('2032-04-22',203217,4,2032,22,16,203204,2032),('2032-04-23',203217,4,2032,23,16,203204,2032),('2032-04-24',203217,4,2032,24,16,203204,2032),('2032-04-25',203218,4,2032,25,17,203204,2032),('2032-04-26',203218,4,2032,26,17,203204,2032),('2032-04-27',203218,4,2032,27,17,203204,2032),('2032-04-28',203218,4,2032,28,17,203204,2032),('2032-04-29',203218,4,2032,29,17,203204,2032),('2032-04-30',203218,4,2032,30,17,203204,2032),('2032-05-01',203218,5,2032,1,17,203205,2032),('2032-05-02',203219,5,2032,2,18,203205,2032),('2032-05-03',203219,5,2032,3,18,203205,2032),('2032-05-04',203219,5,2032,4,18,203205,2032),('2032-05-05',203219,5,2032,5,18,203205,2032),('2032-05-06',203219,5,2032,6,18,203205,2032),('2032-05-07',203219,5,2032,7,18,203205,2032),('2032-05-08',203219,5,2032,8,18,203205,2032),('2032-05-09',203220,5,2032,9,19,203205,2032),('2032-05-10',203220,5,2032,10,19,203205,2032),('2032-05-11',203220,5,2032,11,19,203205,2032),('2032-05-12',203220,5,2032,12,19,203205,2032),('2032-05-13',203220,5,2032,13,19,203205,2032),('2032-05-14',203220,5,2032,14,19,203205,2032),('2032-05-15',203220,5,2032,15,19,203205,2032),('2032-05-16',203221,5,2032,16,20,203205,2032),('2032-05-17',203221,5,2032,17,20,203205,2032),('2032-05-18',203221,5,2032,18,20,203205,2032),('2032-05-19',203221,5,2032,19,20,203205,2032),('2032-05-20',203221,5,2032,20,20,203205,2032),('2032-05-21',203221,5,2032,21,20,203205,2032),('2032-05-22',203221,5,2032,22,20,203205,2032),('2032-05-23',203222,5,2032,23,21,203205,2032),('2032-05-24',203222,5,2032,24,21,203205,2032),('2032-05-25',203222,5,2032,25,21,203205,2032),('2032-05-26',203222,5,2032,26,21,203205,2032),('2032-05-27',203222,5,2032,27,21,203205,2032),('2032-05-28',203222,5,2032,28,21,203205,2032),('2032-05-29',203222,5,2032,29,21,203205,2032),('2032-05-30',203223,5,2032,30,22,203205,2032),('2032-05-31',203223,5,2032,31,22,203205,2032),('2032-06-01',203223,6,2032,1,22,203206,2032),('2032-06-02',203223,6,2032,2,22,203206,2032),('2032-06-03',203223,6,2032,3,22,203206,2032),('2032-06-04',203223,6,2032,4,22,203206,2032),('2032-06-05',203223,6,2032,5,22,203206,2032),('2032-06-06',203224,6,2032,6,23,203206,2032),('2032-06-07',203224,6,2032,7,23,203206,2032),('2032-06-08',203224,6,2032,8,23,203206,2032),('2032-06-09',203224,6,2032,9,23,203206,2032),('2032-06-10',203224,6,2032,10,23,203206,2032),('2032-06-11',203224,6,2032,11,23,203206,2032),('2032-06-12',203224,6,2032,12,23,203206,2032),('2032-06-13',203225,6,2032,13,24,203206,2032),('2032-06-14',203225,6,2032,14,24,203206,2032),('2032-06-15',203225,6,2032,15,24,203206,2032),('2032-06-16',203225,6,2032,16,24,203206,2032),('2032-06-17',203225,6,2032,17,24,203206,2032),('2032-06-18',203225,6,2032,18,24,203206,2032),('2032-06-19',203225,6,2032,19,24,203206,2032),('2032-06-20',203226,6,2032,20,25,203206,2032),('2032-06-21',203226,6,2032,21,25,203206,2032),('2032-06-22',203226,6,2032,22,25,203206,2032),('2032-06-23',203226,6,2032,23,25,203206,2032),('2032-06-24',203226,6,2032,24,25,203206,2032),('2032-06-25',203226,6,2032,25,25,203206,2032),('2032-06-26',203226,6,2032,26,25,203206,2032),('2032-06-27',203227,6,2032,27,26,203206,2032),('2032-06-28',203227,6,2032,28,26,203206,2032),('2032-06-29',203227,6,2032,29,26,203206,2032),('2032-06-30',203227,6,2032,30,26,203206,2032),('2032-07-01',203227,7,2032,1,26,203207,2032),('2032-07-02',203227,7,2032,2,26,203207,2032),('2032-07-03',203227,7,2032,3,26,203207,2032),('2032-07-04',203228,7,2032,4,27,203207,2032),('2032-07-05',203228,7,2032,5,27,203207,2032),('2032-07-06',203228,7,2032,6,27,203207,2032),('2032-07-07',203228,7,2032,7,27,203207,2032),('2032-07-08',203228,7,2032,8,27,203207,2032),('2032-07-09',203228,7,2032,9,27,203207,2032),('2032-07-10',203228,7,2032,10,27,203207,2032),('2032-07-11',203229,7,2032,11,28,203207,2032),('2032-07-12',203229,7,2032,12,28,203207,2032),('2032-07-13',203229,7,2032,13,28,203207,2032),('2032-07-14',203229,7,2032,14,28,203207,2032),('2032-07-15',203229,7,2032,15,28,203207,2032),('2032-07-16',203229,7,2032,16,28,203207,2032),('2032-07-17',203229,7,2032,17,28,203207,2032),('2032-07-18',203230,7,2032,18,29,203207,2032),('2032-07-19',203230,7,2032,19,29,203207,2032),('2032-07-20',203230,7,2032,20,29,203207,2032),('2032-07-21',203230,7,2032,21,29,203207,2032),('2032-07-22',203230,7,2032,22,29,203207,2032),('2032-07-23',203230,7,2032,23,29,203207,2032),('2032-07-24',203230,7,2032,24,29,203207,2032),('2032-07-25',203231,7,2032,25,30,203207,2032),('2032-07-26',203231,7,2032,26,30,203207,2032),('2032-07-27',203231,7,2032,27,30,203207,2032),('2032-07-28',203231,7,2032,28,30,203207,2032),('2032-07-29',203231,7,2032,29,30,203207,2032),('2032-07-30',203231,7,2032,30,30,203207,2032),('2032-07-31',203231,7,2032,31,30,203207,2032),('2032-08-01',203232,8,2032,1,31,203208,2032),('2032-08-02',203232,8,2032,2,31,203208,2032),('2032-08-03',203232,8,2032,3,31,203208,2032),('2032-08-04',203232,8,2032,4,31,203208,2032),('2032-08-05',203232,8,2032,5,31,203208,2032),('2032-08-06',203232,8,2032,6,31,203208,2032),('2032-08-07',203232,8,2032,7,31,203208,2032),('2032-08-08',203233,8,2032,8,32,203208,2032),('2032-08-09',203233,8,2032,9,32,203208,2032),('2032-08-10',203233,8,2032,10,32,203208,2032),('2032-08-11',203233,8,2032,11,32,203208,2032),('2032-08-12',203233,8,2032,12,32,203208,2032),('2032-08-13',203233,8,2032,13,32,203208,2032),('2032-08-14',203233,8,2032,14,32,203208,2032),('2032-08-15',203234,8,2032,15,33,203208,2032),('2032-08-16',203234,8,2032,16,33,203208,2032),('2032-08-17',203234,8,2032,17,33,203208,2032),('2032-08-18',203234,8,2032,18,33,203208,2032),('2032-08-19',203234,8,2032,19,33,203208,2032),('2032-08-20',203234,8,2032,20,33,203208,2032),('2032-08-21',203234,8,2032,21,33,203208,2032),('2032-08-22',203235,8,2032,22,34,203208,2032),('2032-08-23',203235,8,2032,23,34,203208,2032),('2032-08-24',203235,8,2032,24,34,203208,2032),('2032-08-25',203235,8,2032,25,34,203208,2032),('2032-08-26',203235,8,2032,26,34,203208,2032),('2032-08-27',203235,8,2032,27,34,203208,2032),('2032-08-28',203235,8,2032,28,34,203208,2032),('2032-08-29',203236,8,2032,29,35,203208,2032),('2032-08-30',203236,8,2032,30,35,203208,2032),('2032-08-31',203236,8,2032,31,35,203208,2032),('2032-09-01',203236,9,2032,1,35,203209,2032),('2032-09-02',203236,9,2032,2,35,203209,2032),('2032-09-03',203236,9,2032,3,35,203209,2032),('2032-09-04',203236,9,2032,4,35,203209,2032),('2032-09-05',203237,9,2032,5,36,203209,2032),('2032-09-06',203237,9,2032,6,36,203209,2032),('2032-09-07',203237,9,2032,7,36,203209,2032),('2032-09-08',203237,9,2032,8,36,203209,2032),('2032-09-09',203237,9,2032,9,36,203209,2032),('2032-09-10',203237,9,2032,10,36,203209,2032),('2032-09-11',203237,9,2032,11,36,203209,2032),('2032-09-12',203238,9,2032,12,37,203209,2032),('2032-09-13',203238,9,2032,13,37,203209,2032),('2032-09-14',203238,9,2032,14,37,203209,2032),('2032-09-15',203238,9,2032,15,37,203209,2032),('2032-09-16',203238,9,2032,16,37,203209,2032),('2032-09-17',203238,9,2032,17,37,203209,2032),('2032-09-18',203238,9,2032,18,37,203209,2032),('2032-09-19',203239,9,2032,19,38,203209,2032),('2032-09-20',203239,9,2032,20,38,203209,2032),('2032-09-21',203239,9,2032,21,38,203209,2032),('2032-09-22',203239,9,2032,22,38,203209,2032),('2032-09-23',203239,9,2032,23,38,203209,2032),('2032-09-24',203239,9,2032,24,38,203209,2032),('2032-09-25',203239,9,2032,25,38,203209,2032),('2032-09-26',203240,9,2032,26,39,203209,2032),('2032-09-27',203240,9,2032,27,39,203209,2032),('2032-09-28',203240,9,2032,28,39,203209,2032),('2032-09-29',203240,9,2032,29,39,203209,2032),('2032-09-30',203240,9,2032,30,39,203209,2032),('2032-10-01',203240,10,2032,1,39,203210,2032),('2032-10-02',203240,10,2032,2,39,203210,2032),('2032-10-03',203241,10,2032,3,40,203210,2032),('2032-10-04',203241,10,2032,4,40,203210,2032),('2032-10-05',203241,10,2032,5,40,203210,2032),('2032-10-06',203241,10,2032,6,40,203210,2032),('2032-10-07',203241,10,2032,7,40,203210,2032),('2032-10-08',203241,10,2032,8,40,203210,2032),('2032-10-09',203241,10,2032,9,40,203210,2032),('2032-10-10',203242,10,2032,10,41,203210,2032),('2032-10-11',203242,10,2032,11,41,203210,2032),('2032-10-12',203242,10,2032,12,41,203210,2032),('2032-10-13',203242,10,2032,13,41,203210,2032),('2032-10-14',203242,10,2032,14,41,203210,2032),('2032-10-15',203242,10,2032,15,41,203210,2032),('2032-10-16',203242,10,2032,16,41,203210,2032),('2032-10-17',203243,10,2032,17,42,203210,2032),('2032-10-18',203243,10,2032,18,42,203210,2032),('2032-10-19',203243,10,2032,19,42,203210,2032),('2032-10-20',203243,10,2032,20,42,203210,2032),('2032-10-21',203243,10,2032,21,42,203210,2032),('2032-10-22',203243,10,2032,22,42,203210,2032),('2032-10-23',203243,10,2032,23,42,203210,2032),('2032-10-24',203244,10,2032,24,43,203210,2032),('2032-10-25',203244,10,2032,25,43,203210,2032),('2032-10-26',203244,10,2032,26,43,203210,2032),('2032-10-27',203244,10,2032,27,43,203210,2032),('2032-10-28',203244,10,2032,28,43,203210,2032),('2032-10-29',203244,10,2032,29,43,203210,2032),('2032-10-30',203244,10,2032,30,43,203210,2032),('2032-10-31',203245,10,2032,31,44,203210,2032),('2032-11-01',203245,11,2032,1,44,203211,2032),('2032-11-02',203245,11,2032,2,44,203211,2032),('2032-11-03',203245,11,2032,3,44,203211,2032),('2032-11-04',203245,11,2032,4,44,203211,2032),('2032-11-05',203245,11,2032,5,44,203211,2032),('2032-11-06',203245,11,2032,6,44,203211,2032),('2032-11-07',203246,11,2032,7,45,203211,2032),('2032-11-08',203246,11,2032,8,45,203211,2032),('2032-11-09',203246,11,2032,9,45,203211,2032),('2032-11-10',203246,11,2032,10,45,203211,2032),('2032-11-11',203246,11,2032,11,45,203211,2032),('2032-11-12',203246,11,2032,12,45,203211,2032),('2032-11-13',203246,11,2032,13,45,203211,2032),('2032-11-14',203247,11,2032,14,46,203211,2032),('2032-11-15',203247,11,2032,15,46,203211,2032),('2032-11-16',203247,11,2032,16,46,203211,2032),('2032-11-17',203247,11,2032,17,46,203211,2032),('2032-11-18',203247,11,2032,18,46,203211,2032),('2032-11-19',203247,11,2032,19,46,203211,2032),('2032-11-20',203247,11,2032,20,46,203211,2032),('2032-11-21',203248,11,2032,21,47,203211,2032),('2032-11-22',203248,11,2032,22,47,203211,2032),('2032-11-23',203248,11,2032,23,47,203211,2032),('2032-11-24',203248,11,2032,24,47,203211,2032),('2032-11-25',203248,11,2032,25,47,203211,2032),('2032-11-26',203248,11,2032,26,47,203211,2032),('2032-11-27',203248,11,2032,27,47,203211,2032),('2032-11-28',203249,11,2032,28,48,203211,2032),('2032-11-29',203249,11,2032,29,48,203211,2032),('2032-11-30',203249,11,2032,30,48,203211,2032),('2032-12-01',203249,12,2032,1,48,203212,2033),('2032-12-02',203249,12,2032,2,48,203212,2033),('2032-12-03',203249,12,2032,3,48,203212,2033),('2032-12-04',203249,12,2032,4,48,203212,2033),('2032-12-05',203250,12,2032,5,49,203212,2033),('2032-12-06',203250,12,2032,6,49,203212,2033),('2032-12-07',203250,12,2032,7,49,203212,2033),('2032-12-08',203250,12,2032,8,49,203212,2033),('2032-12-09',203250,12,2032,9,49,203212,2033),('2032-12-10',203250,12,2032,10,49,203212,2033),('2032-12-11',203250,12,2032,11,49,203212,2033),('2032-12-12',203251,12,2032,12,50,203212,2033),('2032-12-13',203251,12,2032,13,50,203212,2033),('2032-12-14',203251,12,2032,14,50,203212,2033),('2032-12-15',203251,12,2032,15,50,203212,2033),('2032-12-16',203251,12,2032,16,50,203212,2033),('2032-12-17',203251,12,2032,17,50,203212,2033),('2032-12-18',203251,12,2032,18,50,203212,2033),('2032-12-19',203252,12,2032,19,51,203212,2033),('2032-12-20',203252,12,2032,20,51,203212,2033),('2032-12-21',203252,12,2032,21,51,203212,2033),('2032-12-22',203252,12,2032,22,51,203212,2033),('2032-12-23',203252,12,2032,23,51,203212,2033),('2032-12-24',203252,12,2032,24,51,203212,2033),('2032-12-25',203252,12,2032,25,51,203212,2033),('2032-12-26',203253,12,2032,26,52,203212,2033),('2032-12-27',203253,12,2032,27,52,203212,2033),('2032-12-28',203253,12,2032,28,52,203212,2033),('2032-12-29',203253,12,2032,29,52,203212,2033),('2032-12-30',203253,12,2032,30,52,203212,2033),('2032-12-31',203253,12,2032,31,52,203212,2033),('2033-01-01',203353,1,2033,1,52,203301,2033),('2033-01-02',203354,1,2033,2,1,203301,2033),('2033-01-03',203301,1,2033,3,1,203301,2033),('2033-01-04',203301,1,2033,4,1,203301,2033),('2033-01-05',203301,1,2033,5,1,203301,2033),('2033-01-06',203301,1,2033,6,1,203301,2033),('2033-01-07',203301,1,2033,7,1,203301,2033),('2033-01-08',203301,1,2033,8,1,203301,2033),('2033-01-09',203302,1,2033,9,2,203301,2033),('2033-01-10',203302,1,2033,10,2,203301,2033),('2033-01-11',203302,1,2033,11,2,203301,2033),('2033-01-12',203302,1,2033,12,2,203301,2033),('2033-01-13',203302,1,2033,13,2,203301,2033),('2033-01-14',203302,1,2033,14,2,203301,2033),('2033-01-15',203302,1,2033,15,2,203301,2033),('2033-01-16',203303,1,2033,16,3,203301,2033),('2033-01-17',203303,1,2033,17,3,203301,2033),('2033-01-18',203303,1,2033,18,3,203301,2033),('2033-01-19',203303,1,2033,19,3,203301,2033),('2033-01-20',203303,1,2033,20,3,203301,2033),('2033-01-21',203303,1,2033,21,3,203301,2033),('2033-01-22',203303,1,2033,22,3,203301,2033),('2033-01-23',203304,1,2033,23,4,203301,2033),('2033-01-24',203304,1,2033,24,4,203301,2033),('2033-01-25',203304,1,2033,25,4,203301,2033),('2033-01-26',203304,1,2033,26,4,203301,2033),('2033-01-27',203304,1,2033,27,4,203301,2033),('2033-01-28',203304,1,2033,28,4,203301,2033),('2033-01-29',203304,1,2033,29,4,203301,2033),('2033-01-30',203305,1,2033,30,5,203301,2033),('2033-01-31',203305,1,2033,31,5,203301,2033),('2033-02-01',203305,2,2033,1,5,203302,2033),('2033-02-02',203305,2,2033,2,5,203302,2033),('2033-02-03',203305,2,2033,3,5,203302,2033),('2033-02-04',203305,2,2033,4,5,203302,2033),('2033-02-05',203305,2,2033,5,5,203302,2033),('2033-02-06',203306,2,2033,6,6,203302,2033),('2033-02-07',203306,2,2033,7,6,203302,2033),('2033-02-08',203306,2,2033,8,6,203302,2033),('2033-02-09',203306,2,2033,9,6,203302,2033),('2033-02-10',203306,2,2033,10,6,203302,2033),('2033-02-11',203306,2,2033,11,6,203302,2033),('2033-02-12',203306,2,2033,12,6,203302,2033),('2033-02-13',203307,2,2033,13,7,203302,2033),('2033-02-14',203307,2,2033,14,7,203302,2033),('2033-02-15',203307,2,2033,15,7,203302,2033),('2033-02-16',203307,2,2033,16,7,203302,2033),('2033-02-17',203307,2,2033,17,7,203302,2033),('2033-02-18',203307,2,2033,18,7,203302,2033),('2033-02-19',203307,2,2033,19,7,203302,2033),('2033-02-20',203308,2,2033,20,8,203302,2033),('2033-02-21',203308,2,2033,21,8,203302,2033),('2033-02-22',203308,2,2033,22,8,203302,2033),('2033-02-23',203308,2,2033,23,8,203302,2033),('2033-02-24',203308,2,2033,24,8,203302,2033),('2033-02-25',203308,2,2033,25,8,203302,2033),('2033-02-26',203308,2,2033,26,8,203302,2033),('2033-02-27',203309,2,2033,27,9,203302,2033),('2033-02-28',203309,2,2033,28,9,203302,2033),('2033-03-01',203309,3,2033,1,9,203303,2033),('2033-03-02',203309,3,2033,2,9,203303,2033),('2033-03-03',203309,3,2033,3,9,203303,2033),('2033-03-04',203309,3,2033,4,9,203303,2033),('2033-03-05',203309,3,2033,5,9,203303,2033),('2033-03-06',203310,3,2033,6,10,203303,2033),('2033-03-07',203310,3,2033,7,10,203303,2033),('2033-03-08',203310,3,2033,8,10,203303,2033),('2033-03-09',203310,3,2033,9,10,203303,2033),('2033-03-10',203310,3,2033,10,10,203303,2033),('2033-03-11',203310,3,2033,11,10,203303,2033),('2033-03-12',203310,3,2033,12,10,203303,2033),('2033-03-13',203311,3,2033,13,11,203303,2033),('2033-03-14',203311,3,2033,14,11,203303,2033),('2033-03-15',203311,3,2033,15,11,203303,2033),('2033-03-16',203311,3,2033,16,11,203303,2033),('2033-03-17',203311,3,2033,17,11,203303,2033),('2033-03-18',203311,3,2033,18,11,203303,2033),('2033-03-19',203311,3,2033,19,11,203303,2033),('2033-03-20',203312,3,2033,20,12,203303,2033),('2033-03-21',203312,3,2033,21,12,203303,2033),('2033-03-22',203312,3,2033,22,12,203303,2033),('2033-03-23',203312,3,2033,23,12,203303,2033),('2033-03-24',203312,3,2033,24,12,203303,2033),('2033-03-25',203312,3,2033,25,12,203303,2033),('2033-03-26',203312,3,2033,26,12,203303,2033),('2033-03-27',203313,3,2033,27,13,203303,2033),('2033-03-28',203313,3,2033,28,13,203303,2033),('2033-03-29',203313,3,2033,29,13,203303,2033),('2033-03-30',203313,3,2033,30,13,203303,2033),('2033-03-31',203313,3,2033,31,13,203303,2033),('2033-04-01',203313,4,2033,1,13,203304,2033),('2033-04-02',203313,4,2033,2,13,203304,2033),('2033-04-03',203314,4,2033,3,14,203304,2033),('2033-04-04',203314,4,2033,4,14,203304,2033),('2033-04-05',203314,4,2033,5,14,203304,2033),('2033-04-06',203314,4,2033,6,14,203304,2033),('2033-04-07',203314,4,2033,7,14,203304,2033),('2033-04-08',203314,4,2033,8,14,203304,2033),('2033-04-09',203314,4,2033,9,14,203304,2033),('2033-04-10',203315,4,2033,10,15,203304,2033),('2033-04-11',203315,4,2033,11,15,203304,2033),('2033-04-12',203315,4,2033,12,15,203304,2033),('2033-04-13',203315,4,2033,13,15,203304,2033),('2033-04-14',203315,4,2033,14,15,203304,2033),('2033-04-15',203315,4,2033,15,15,203304,2033),('2033-04-16',203315,4,2033,16,15,203304,2033),('2033-04-17',203316,4,2033,17,16,203304,2033),('2033-04-18',203316,4,2033,18,16,203304,2033),('2033-04-19',203316,4,2033,19,16,203304,2033),('2033-04-20',203316,4,2033,20,16,203304,2033),('2033-04-21',203316,4,2033,21,16,203304,2033),('2033-04-22',203316,4,2033,22,16,203304,2033),('2033-04-23',203316,4,2033,23,16,203304,2033),('2033-04-24',203317,4,2033,24,17,203304,2033),('2033-04-25',203317,4,2033,25,17,203304,2033),('2033-04-26',203317,4,2033,26,17,203304,2033),('2033-04-27',203317,4,2033,27,17,203304,2033),('2033-04-28',203317,4,2033,28,17,203304,2033),('2033-04-29',203317,4,2033,29,17,203304,2033),('2033-04-30',203317,4,2033,30,17,203304,2033),('2033-05-01',203318,5,2033,1,18,203305,2033),('2033-05-02',203318,5,2033,2,18,203305,2033),('2033-05-03',203318,5,2033,3,18,203305,2033),('2033-05-04',203318,5,2033,4,18,203305,2033),('2033-05-05',203318,5,2033,5,18,203305,2033),('2033-05-06',203318,5,2033,6,18,203305,2033),('2033-05-07',203318,5,2033,7,18,203305,2033),('2033-05-08',203319,5,2033,8,19,203305,2033),('2033-05-09',203319,5,2033,9,19,203305,2033),('2033-05-10',203319,5,2033,10,19,203305,2033),('2033-05-11',203319,5,2033,11,19,203305,2033),('2033-05-12',203319,5,2033,12,19,203305,2033),('2033-05-13',203319,5,2033,13,19,203305,2033),('2033-05-14',203319,5,2033,14,19,203305,2033),('2033-05-15',203320,5,2033,15,20,203305,2033),('2033-05-16',203320,5,2033,16,20,203305,2033),('2033-05-17',203320,5,2033,17,20,203305,2033),('2033-05-18',203320,5,2033,18,20,203305,2033),('2033-05-19',203320,5,2033,19,20,203305,2033),('2033-05-20',203320,5,2033,20,20,203305,2033),('2033-05-21',203320,5,2033,21,20,203305,2033),('2033-05-22',203321,5,2033,22,21,203305,2033),('2033-05-23',203321,5,2033,23,21,203305,2033),('2033-05-24',203321,5,2033,24,21,203305,2033),('2033-05-25',203321,5,2033,25,21,203305,2033),('2033-05-26',203321,5,2033,26,21,203305,2033),('2033-05-27',203321,5,2033,27,21,203305,2033),('2033-05-28',203321,5,2033,28,21,203305,2033),('2033-05-29',203322,5,2033,29,22,203305,2033),('2033-05-30',203322,5,2033,30,22,203305,2033),('2033-05-31',203322,5,2033,31,22,203305,2033),('2033-06-01',203322,6,2033,1,22,203306,2033),('2033-06-02',203322,6,2033,2,22,203306,2033),('2033-06-03',203322,6,2033,3,22,203306,2033),('2033-06-04',203322,6,2033,4,22,203306,2033),('2033-06-05',203323,6,2033,5,23,203306,2033),('2033-06-06',203323,6,2033,6,23,203306,2033),('2033-06-07',203323,6,2033,7,23,203306,2033),('2033-06-08',203323,6,2033,8,23,203306,2033),('2033-06-09',203323,6,2033,9,23,203306,2033),('2033-06-10',203323,6,2033,10,23,203306,2033),('2033-06-11',203323,6,2033,11,23,203306,2033),('2033-06-12',203324,6,2033,12,24,203306,2033),('2033-06-13',203324,6,2033,13,24,203306,2033),('2033-06-14',203324,6,2033,14,24,203306,2033),('2033-06-15',203324,6,2033,15,24,203306,2033),('2033-06-16',203324,6,2033,16,24,203306,2033),('2033-06-17',203324,6,2033,17,24,203306,2033),('2033-06-18',203324,6,2033,18,24,203306,2033),('2033-06-19',203325,6,2033,19,25,203306,2033),('2033-06-20',203325,6,2033,20,25,203306,2033),('2033-06-21',203325,6,2033,21,25,203306,2033),('2033-06-22',203325,6,2033,22,25,203306,2033),('2033-06-23',203325,6,2033,23,25,203306,2033),('2033-06-24',203325,6,2033,24,25,203306,2033),('2033-06-25',203325,6,2033,25,25,203306,2033),('2033-06-26',203326,6,2033,26,26,203306,2033),('2033-06-27',203326,6,2033,27,26,203306,2033),('2033-06-28',203326,6,2033,28,26,203306,2033),('2033-06-29',203326,6,2033,29,26,203306,2033),('2033-06-30',203326,6,2033,30,26,203306,2033),('2033-07-01',203326,7,2033,1,26,203307,2033),('2033-07-02',203326,7,2033,2,26,203307,2033),('2033-07-03',203327,7,2033,3,27,203307,2033),('2033-07-04',203327,7,2033,4,27,203307,2033),('2033-07-05',203327,7,2033,5,27,203307,2033),('2033-07-06',203327,7,2033,6,27,203307,2033),('2033-07-07',203327,7,2033,7,27,203307,2033),('2033-07-08',203327,7,2033,8,27,203307,2033),('2033-07-09',203327,7,2033,9,27,203307,2033),('2033-07-10',203328,7,2033,10,28,203307,2033),('2033-07-11',203328,7,2033,11,28,203307,2033),('2033-07-12',203328,7,2033,12,28,203307,2033),('2033-07-13',203328,7,2033,13,28,203307,2033),('2033-07-14',203328,7,2033,14,28,203307,2033),('2033-07-15',203328,7,2033,15,28,203307,2033),('2033-07-16',203328,7,2033,16,28,203307,2033),('2033-07-17',203329,7,2033,17,29,203307,2033),('2033-07-18',203329,7,2033,18,29,203307,2033),('2033-07-19',203329,7,2033,19,29,203307,2033),('2033-07-20',203329,7,2033,20,29,203307,2033),('2033-07-21',203329,7,2033,21,29,203307,2033),('2033-07-22',203329,7,2033,22,29,203307,2033),('2033-07-23',203329,7,2033,23,29,203307,2033),('2033-07-24',203330,7,2033,24,30,203307,2033),('2033-07-25',203330,7,2033,25,30,203307,2033),('2033-07-26',203330,7,2033,26,30,203307,2033),('2033-07-27',203330,7,2033,27,30,203307,2033),('2033-07-28',203330,7,2033,28,30,203307,2033),('2033-07-29',203330,7,2033,29,30,203307,2033),('2033-07-30',203330,7,2033,30,30,203307,2033),('2033-07-31',203331,7,2033,31,31,203307,2033),('2033-08-01',203331,8,2033,1,31,203308,2033),('2033-08-02',203331,8,2033,2,31,203308,2033),('2033-08-03',203331,8,2033,3,31,203308,2033),('2033-08-04',203331,8,2033,4,31,203308,2033),('2033-08-05',203331,8,2033,5,31,203308,2033),('2033-08-06',203331,8,2033,6,31,203308,2033),('2033-08-07',203332,8,2033,7,32,203308,2033),('2033-08-08',203332,8,2033,8,32,203308,2033),('2033-08-09',203332,8,2033,9,32,203308,2033),('2033-08-10',203332,8,2033,10,32,203308,2033),('2033-08-11',203332,8,2033,11,32,203308,2033),('2033-08-12',203332,8,2033,12,32,203308,2033),('2033-08-13',203332,8,2033,13,32,203308,2033),('2033-08-14',203333,8,2033,14,33,203308,2033),('2033-08-15',203333,8,2033,15,33,203308,2033),('2033-08-16',203333,8,2033,16,33,203308,2033),('2033-08-17',203333,8,2033,17,33,203308,2033),('2033-08-18',203333,8,2033,18,33,203308,2033),('2033-08-19',203333,8,2033,19,33,203308,2033),('2033-08-20',203333,8,2033,20,33,203308,2033),('2033-08-21',203334,8,2033,21,34,203308,2033),('2033-08-22',203334,8,2033,22,34,203308,2033),('2033-08-23',203334,8,2033,23,34,203308,2033),('2033-08-24',203334,8,2033,24,34,203308,2033),('2033-08-25',203334,8,2033,25,34,203308,2033),('2033-08-26',203334,8,2033,26,34,203308,2033),('2033-08-27',203334,8,2033,27,34,203308,2033),('2033-08-28',203335,8,2033,28,35,203308,2033),('2033-08-29',203335,8,2033,29,35,203308,2033),('2033-08-30',203335,8,2033,30,35,203308,2033),('2033-08-31',203335,8,2033,31,35,203308,2033),('2033-09-01',203335,9,2033,1,35,203309,2033),('2033-09-02',203335,9,2033,2,35,203309,2033),('2033-09-03',203335,9,2033,3,35,203309,2033),('2033-09-04',203336,9,2033,4,36,203309,2033),('2033-09-05',203336,9,2033,5,36,203309,2033),('2033-09-06',203336,9,2033,6,36,203309,2033),('2033-09-07',203336,9,2033,7,36,203309,2033),('2033-09-08',203336,9,2033,8,36,203309,2033),('2033-09-09',203336,9,2033,9,36,203309,2033),('2033-09-10',203336,9,2033,10,36,203309,2033),('2033-09-11',203337,9,2033,11,37,203309,2033),('2033-09-12',203337,9,2033,12,37,203309,2033),('2033-09-13',203337,9,2033,13,37,203309,2033),('2033-09-14',203337,9,2033,14,37,203309,2033),('2033-09-15',203337,9,2033,15,37,203309,2033),('2033-09-16',203337,9,2033,16,37,203309,2033),('2033-09-17',203337,9,2033,17,37,203309,2033),('2033-09-18',203338,9,2033,18,38,203309,2033),('2033-09-19',203338,9,2033,19,38,203309,2033),('2033-09-20',203338,9,2033,20,38,203309,2033),('2033-09-21',203338,9,2033,21,38,203309,2033),('2033-09-22',203338,9,2033,22,38,203309,2033),('2033-09-23',203338,9,2033,23,38,203309,2033),('2033-09-24',203338,9,2033,24,38,203309,2033),('2033-09-25',203339,9,2033,25,39,203309,2033),('2033-09-26',203339,9,2033,26,39,203309,2033),('2033-09-27',203339,9,2033,27,39,203309,2033),('2033-09-28',203339,9,2033,28,39,203309,2033),('2033-09-29',203339,9,2033,29,39,203309,2033),('2033-09-30',203339,9,2033,30,39,203309,2033),('2033-10-01',203339,10,2033,1,39,203310,2033),('2033-10-02',203340,10,2033,2,40,203310,2033),('2033-10-03',203340,10,2033,3,40,203310,2033),('2033-10-04',203340,10,2033,4,40,203310,2033),('2033-10-05',203340,10,2033,5,40,203310,2033),('2033-10-06',203340,10,2033,6,40,203310,2033),('2033-10-07',203340,10,2033,7,40,203310,2033),('2033-10-08',203340,10,2033,8,40,203310,2033),('2033-10-09',203341,10,2033,9,41,203310,2033),('2033-10-10',203341,10,2033,10,41,203310,2033),('2033-10-11',203341,10,2033,11,41,203310,2033),('2033-10-12',203341,10,2033,12,41,203310,2033),('2033-10-13',203341,10,2033,13,41,203310,2033),('2033-10-14',203341,10,2033,14,41,203310,2033),('2033-10-15',203341,10,2033,15,41,203310,2033),('2033-10-16',203342,10,2033,16,42,203310,2033),('2033-10-17',203342,10,2033,17,42,203310,2033),('2033-10-18',203342,10,2033,18,42,203310,2033),('2033-10-19',203342,10,2033,19,42,203310,2033),('2033-10-20',203342,10,2033,20,42,203310,2033),('2033-10-21',203342,10,2033,21,42,203310,2033),('2033-10-22',203342,10,2033,22,42,203310,2033),('2033-10-23',203343,10,2033,23,43,203310,2033),('2033-10-24',203343,10,2033,24,43,203310,2033),('2033-10-25',203343,10,2033,25,43,203310,2033),('2033-10-26',203343,10,2033,26,43,203310,2033),('2033-10-27',203343,10,2033,27,43,203310,2033),('2033-10-28',203343,10,2033,28,43,203310,2033),('2033-10-29',203343,10,2033,29,43,203310,2033),('2033-10-30',203344,10,2033,30,44,203310,2033),('2033-10-31',203344,10,2033,31,44,203310,2033),('2033-11-01',203344,11,2033,1,44,203311,2033),('2033-11-02',203344,11,2033,2,44,203311,2033),('2033-11-03',203344,11,2033,3,44,203311,2033),('2033-11-04',203344,11,2033,4,44,203311,2033),('2033-11-05',203344,11,2033,5,44,203311,2033),('2033-11-06',203345,11,2033,6,45,203311,2033),('2033-11-07',203345,11,2033,7,45,203311,2033),('2033-11-08',203345,11,2033,8,45,203311,2033),('2033-11-09',203345,11,2033,9,45,203311,2033),('2033-11-10',203345,11,2033,10,45,203311,2033),('2033-11-11',203345,11,2033,11,45,203311,2033),('2033-11-12',203345,11,2033,12,45,203311,2033),('2033-11-13',203346,11,2033,13,46,203311,2033),('2033-11-14',203346,11,2033,14,46,203311,2033),('2033-11-15',203346,11,2033,15,46,203311,2033),('2033-11-16',203346,11,2033,16,46,203311,2033),('2033-11-17',203346,11,2033,17,46,203311,2033),('2033-11-18',203346,11,2033,18,46,203311,2033),('2033-11-19',203346,11,2033,19,46,203311,2033),('2033-11-20',203347,11,2033,20,47,203311,2033),('2033-11-21',203347,11,2033,21,47,203311,2033),('2033-11-22',203347,11,2033,22,47,203311,2033),('2033-11-23',203347,11,2033,23,47,203311,2033),('2033-11-24',203347,11,2033,24,47,203311,2033),('2033-11-25',203347,11,2033,25,47,203311,2033),('2033-11-26',203347,11,2033,26,47,203311,2033),('2033-11-27',203348,11,2033,27,48,203311,2033),('2033-11-28',203348,11,2033,28,48,203311,2033),('2033-11-29',203348,11,2033,29,48,203311,2033),('2033-11-30',203348,11,2033,30,48,203311,2033),('2033-12-01',203348,12,2033,1,48,203312,2034),('2033-12-02',203348,12,2033,2,48,203312,2034),('2033-12-03',203348,12,2033,3,48,203312,2034),('2033-12-04',203349,12,2033,4,49,203312,2034),('2033-12-05',203349,12,2033,5,49,203312,2034),('2033-12-06',203349,12,2033,6,49,203312,2034),('2033-12-07',203349,12,2033,7,49,203312,2034),('2033-12-08',203349,12,2033,8,49,203312,2034),('2033-12-09',203349,12,2033,9,49,203312,2034),('2033-12-10',203349,12,2033,10,49,203312,2034),('2033-12-11',203350,12,2033,11,50,203312,2034),('2033-12-12',203350,12,2033,12,50,203312,2034),('2033-12-13',203350,12,2033,13,50,203312,2034),('2033-12-14',203350,12,2033,14,50,203312,2034),('2033-12-15',203350,12,2033,15,50,203312,2034),('2033-12-16',203350,12,2033,16,50,203312,2034),('2033-12-17',203350,12,2033,17,50,203312,2034),('2033-12-18',203351,12,2033,18,51,203312,2034),('2033-12-19',203351,12,2033,19,51,203312,2034),('2033-12-20',203351,12,2033,20,51,203312,2034),('2033-12-21',203351,12,2033,21,51,203312,2034),('2033-12-22',203351,12,2033,22,51,203312,2034),('2033-12-23',203351,12,2033,23,51,203312,2034),('2033-12-24',203351,12,2033,24,51,203312,2034),('2033-12-25',203352,12,2033,25,52,203312,2034),('2033-12-26',203352,12,2033,26,52,203312,2034),('2033-12-27',203352,12,2033,27,52,203312,2034),('2033-12-28',203352,12,2033,28,52,203312,2034),('2033-12-29',203352,12,2033,29,52,203312,2034),('2033-12-30',203352,12,2033,30,52,203312,2034),('2033-12-31',203352,12,2033,31,52,203312,2034),('2034-01-01',203453,1,2034,1,1,203401,2034),('2034-01-02',203401,1,2034,2,1,203401,2034),('2034-01-03',203401,1,2034,3,1,203401,2034),('2034-01-04',203401,1,2034,4,1,203401,2034),('2034-01-05',203401,1,2034,5,1,203401,2034),('2034-01-06',203401,1,2034,6,1,203401,2034),('2034-01-07',203401,1,2034,7,1,203401,2034),('2034-01-08',203402,1,2034,8,2,203401,2034),('2034-01-09',203402,1,2034,9,2,203401,2034),('2034-01-10',203402,1,2034,10,2,203401,2034),('2034-01-11',203402,1,2034,11,2,203401,2034),('2034-01-12',203402,1,2034,12,2,203401,2034),('2034-01-13',203402,1,2034,13,2,203401,2034),('2034-01-14',203402,1,2034,14,2,203401,2034),('2034-01-15',203403,1,2034,15,3,203401,2034),('2034-01-16',203403,1,2034,16,3,203401,2034),('2034-01-17',203403,1,2034,17,3,203401,2034),('2034-01-18',203403,1,2034,18,3,203401,2034),('2034-01-19',203403,1,2034,19,3,203401,2034),('2034-01-20',203403,1,2034,20,3,203401,2034),('2034-01-21',203403,1,2034,21,3,203401,2034),('2034-01-22',203404,1,2034,22,4,203401,2034),('2034-01-23',203404,1,2034,23,4,203401,2034),('2034-01-24',203404,1,2034,24,4,203401,2034),('2034-01-25',203404,1,2034,25,4,203401,2034),('2034-01-26',203404,1,2034,26,4,203401,2034),('2034-01-27',203404,1,2034,27,4,203401,2034),('2034-01-28',203404,1,2034,28,4,203401,2034),('2034-01-29',203405,1,2034,29,5,203401,2034),('2034-01-30',203405,1,2034,30,5,203401,2034),('2034-01-31',203405,1,2034,31,5,203401,2034),('2034-02-01',203405,2,2034,1,5,203402,2034),('2034-02-02',203405,2,2034,2,5,203402,2034),('2034-02-03',203405,2,2034,3,5,203402,2034),('2034-02-04',203405,2,2034,4,5,203402,2034),('2034-02-05',203406,2,2034,5,6,203402,2034),('2034-02-06',203406,2,2034,6,6,203402,2034),('2034-02-07',203406,2,2034,7,6,203402,2034),('2034-02-08',203406,2,2034,8,6,203402,2034),('2034-02-09',203406,2,2034,9,6,203402,2034),('2034-02-10',203406,2,2034,10,6,203402,2034),('2034-02-11',203406,2,2034,11,6,203402,2034),('2034-02-12',203407,2,2034,12,7,203402,2034),('2034-02-13',203407,2,2034,13,7,203402,2034),('2034-02-14',203407,2,2034,14,7,203402,2034),('2034-02-15',203407,2,2034,15,7,203402,2034),('2034-02-16',203407,2,2034,16,7,203402,2034),('2034-02-17',203407,2,2034,17,7,203402,2034),('2034-02-18',203407,2,2034,18,7,203402,2034),('2034-02-19',203408,2,2034,19,8,203402,2034),('2034-02-20',203408,2,2034,20,8,203402,2034),('2034-02-21',203408,2,2034,21,8,203402,2034),('2034-02-22',203408,2,2034,22,8,203402,2034),('2034-02-23',203408,2,2034,23,8,203402,2034),('2034-02-24',203408,2,2034,24,8,203402,2034),('2034-02-25',203408,2,2034,25,8,203402,2034),('2034-02-26',203409,2,2034,26,9,203402,2034),('2034-02-27',203409,2,2034,27,9,203402,2034),('2034-02-28',203409,2,2034,28,9,203402,2034),('2034-03-01',203409,3,2034,1,9,203403,2034),('2034-03-02',203409,3,2034,2,9,203403,2034),('2034-03-03',203409,3,2034,3,9,203403,2034),('2034-03-04',203409,3,2034,4,9,203403,2034),('2034-03-05',203410,3,2034,5,10,203403,2034),('2034-03-06',203410,3,2034,6,10,203403,2034),('2034-03-07',203410,3,2034,7,10,203403,2034),('2034-03-08',203410,3,2034,8,10,203403,2034),('2034-03-09',203410,3,2034,9,10,203403,2034),('2034-03-10',203410,3,2034,10,10,203403,2034),('2034-03-11',203410,3,2034,11,10,203403,2034),('2034-03-12',203411,3,2034,12,11,203403,2034),('2034-03-13',203411,3,2034,13,11,203403,2034),('2034-03-14',203411,3,2034,14,11,203403,2034),('2034-03-15',203411,3,2034,15,11,203403,2034),('2034-03-16',203411,3,2034,16,11,203403,2034),('2034-03-17',203411,3,2034,17,11,203403,2034),('2034-03-18',203411,3,2034,18,11,203403,2034),('2034-03-19',203412,3,2034,19,12,203403,2034),('2034-03-20',203412,3,2034,20,12,203403,2034),('2034-03-21',203412,3,2034,21,12,203403,2034),('2034-03-22',203412,3,2034,22,12,203403,2034),('2034-03-23',203412,3,2034,23,12,203403,2034),('2034-03-24',203412,3,2034,24,12,203403,2034),('2034-03-25',203412,3,2034,25,12,203403,2034),('2034-03-26',203413,3,2034,26,13,203403,2034),('2034-03-27',203413,3,2034,27,13,203403,2034),('2034-03-28',203413,3,2034,28,13,203403,2034),('2034-03-29',203413,3,2034,29,13,203403,2034),('2034-03-30',203413,3,2034,30,13,203403,2034),('2034-03-31',203413,3,2034,31,13,203403,2034),('2034-04-01',203413,4,2034,1,13,203404,2034),('2034-04-02',203414,4,2034,2,14,203404,2034),('2034-04-03',203414,4,2034,3,14,203404,2034),('2034-04-04',203414,4,2034,4,14,203404,2034),('2034-04-05',203414,4,2034,5,14,203404,2034),('2034-04-06',203414,4,2034,6,14,203404,2034),('2034-04-07',203414,4,2034,7,14,203404,2034),('2034-04-08',203414,4,2034,8,14,203404,2034),('2034-04-09',203415,4,2034,9,15,203404,2034),('2034-04-10',203415,4,2034,10,15,203404,2034),('2034-04-11',203415,4,2034,11,15,203404,2034),('2034-04-12',203415,4,2034,12,15,203404,2034),('2034-04-13',203415,4,2034,13,15,203404,2034),('2034-04-14',203415,4,2034,14,15,203404,2034),('2034-04-15',203415,4,2034,15,15,203404,2034),('2034-04-16',203416,4,2034,16,16,203404,2034),('2034-04-17',203416,4,2034,17,16,203404,2034),('2034-04-18',203416,4,2034,18,16,203404,2034),('2034-04-19',203416,4,2034,19,16,203404,2034),('2034-04-20',203416,4,2034,20,16,203404,2034),('2034-04-21',203416,4,2034,21,16,203404,2034),('2034-04-22',203416,4,2034,22,16,203404,2034),('2034-04-23',203417,4,2034,23,17,203404,2034),('2034-04-24',203417,4,2034,24,17,203404,2034),('2034-04-25',203417,4,2034,25,17,203404,2034),('2034-04-26',203417,4,2034,26,17,203404,2034),('2034-04-27',203417,4,2034,27,17,203404,2034),('2034-04-28',203417,4,2034,28,17,203404,2034),('2034-04-29',203417,4,2034,29,17,203404,2034),('2034-04-30',203418,4,2034,30,18,203404,2034),('2034-05-01',203418,5,2034,1,18,203405,2034),('2034-05-02',203418,5,2034,2,18,203405,2034),('2034-05-03',203418,5,2034,3,18,203405,2034),('2034-05-04',203418,5,2034,4,18,203405,2034),('2034-05-05',203418,5,2034,5,18,203405,2034),('2034-05-06',203418,5,2034,6,18,203405,2034),('2034-05-07',203419,5,2034,7,19,203405,2034),('2034-05-08',203419,5,2034,8,19,203405,2034),('2034-05-09',203419,5,2034,9,19,203405,2034),('2034-05-10',203419,5,2034,10,19,203405,2034),('2034-05-11',203419,5,2034,11,19,203405,2034),('2034-05-12',203419,5,2034,12,19,203405,2034),('2034-05-13',203419,5,2034,13,19,203405,2034),('2034-05-14',203420,5,2034,14,20,203405,2034),('2034-05-15',203420,5,2034,15,20,203405,2034),('2034-05-16',203420,5,2034,16,20,203405,2034),('2034-05-17',203420,5,2034,17,20,203405,2034),('2034-05-18',203420,5,2034,18,20,203405,2034),('2034-05-19',203420,5,2034,19,20,203405,2034),('2034-05-20',203420,5,2034,20,20,203405,2034),('2034-05-21',203421,5,2034,21,21,203405,2034),('2034-05-22',203421,5,2034,22,21,203405,2034),('2034-05-23',203421,5,2034,23,21,203405,2034),('2034-05-24',203421,5,2034,24,21,203405,2034),('2034-05-25',203421,5,2034,25,21,203405,2034),('2034-05-26',203421,5,2034,26,21,203405,2034),('2034-05-27',203421,5,2034,27,21,203405,2034),('2034-05-28',203422,5,2034,28,22,203405,2034),('2034-05-29',203422,5,2034,29,22,203405,2034),('2034-05-30',203422,5,2034,30,22,203405,2034),('2034-05-31',203422,5,2034,31,22,203405,2034),('2034-06-01',203422,6,2034,1,22,203406,2034),('2034-06-02',203422,6,2034,2,22,203406,2034),('2034-06-03',203422,6,2034,3,22,203406,2034),('2034-06-04',203423,6,2034,4,23,203406,2034),('2034-06-05',203423,6,2034,5,23,203406,2034),('2034-06-06',203423,6,2034,6,23,203406,2034),('2034-06-07',203423,6,2034,7,23,203406,2034),('2034-06-08',203423,6,2034,8,23,203406,2034),('2034-06-09',203423,6,2034,9,23,203406,2034),('2034-06-10',203423,6,2034,10,23,203406,2034),('2034-06-11',203424,6,2034,11,24,203406,2034),('2034-06-12',203424,6,2034,12,24,203406,2034),('2034-06-13',203424,6,2034,13,24,203406,2034),('2034-06-14',203424,6,2034,14,24,203406,2034),('2034-06-15',203424,6,2034,15,24,203406,2034),('2034-06-16',203424,6,2034,16,24,203406,2034),('2034-06-17',203424,6,2034,17,24,203406,2034),('2034-06-18',203425,6,2034,18,25,203406,2034),('2034-06-19',203425,6,2034,19,25,203406,2034),('2034-06-20',203425,6,2034,20,25,203406,2034),('2034-06-21',203425,6,2034,21,25,203406,2034),('2034-06-22',203425,6,2034,22,25,203406,2034),('2034-06-23',203425,6,2034,23,25,203406,2034),('2034-06-24',203425,6,2034,24,25,203406,2034),('2034-06-25',203426,6,2034,25,26,203406,2034),('2034-06-26',203426,6,2034,26,26,203406,2034),('2034-06-27',203426,6,2034,27,26,203406,2034),('2034-06-28',203426,6,2034,28,26,203406,2034),('2034-06-29',203426,6,2034,29,26,203406,2034),('2034-06-30',203426,6,2034,30,26,203406,2034),('2034-07-01',203426,7,2034,1,26,203407,2034),('2034-07-02',203427,7,2034,2,27,203407,2034),('2034-07-03',203427,7,2034,3,27,203407,2034),('2034-07-04',203427,7,2034,4,27,203407,2034),('2034-07-05',203427,7,2034,5,27,203407,2034),('2034-07-06',203427,7,2034,6,27,203407,2034),('2034-07-07',203427,7,2034,7,27,203407,2034),('2034-07-08',203427,7,2034,8,27,203407,2034),('2034-07-09',203428,7,2034,9,28,203407,2034),('2034-07-10',203428,7,2034,10,28,203407,2034),('2034-07-11',203428,7,2034,11,28,203407,2034),('2034-07-12',203428,7,2034,12,28,203407,2034),('2034-07-13',203428,7,2034,13,28,203407,2034),('2034-07-14',203428,7,2034,14,28,203407,2034),('2034-07-15',203428,7,2034,15,28,203407,2034),('2034-07-16',203429,7,2034,16,29,203407,2034),('2034-07-17',203429,7,2034,17,29,203407,2034),('2034-07-18',203429,7,2034,18,29,203407,2034),('2034-07-19',203429,7,2034,19,29,203407,2034),('2034-07-20',203429,7,2034,20,29,203407,2034),('2034-07-21',203429,7,2034,21,29,203407,2034),('2034-07-22',203429,7,2034,22,29,203407,2034),('2034-07-23',203430,7,2034,23,30,203407,2034),('2034-07-24',203430,7,2034,24,30,203407,2034),('2034-07-25',203430,7,2034,25,30,203407,2034),('2034-07-26',203430,7,2034,26,30,203407,2034),('2034-07-27',203430,7,2034,27,30,203407,2034),('2034-07-28',203430,7,2034,28,30,203407,2034),('2034-07-29',203430,7,2034,29,30,203407,2034),('2034-07-30',203431,7,2034,30,31,203407,2034),('2034-07-31',203431,7,2034,31,31,203407,2034),('2034-08-01',203431,8,2034,1,31,203408,2034),('2034-08-02',203431,8,2034,2,31,203408,2034),('2034-08-03',203431,8,2034,3,31,203408,2034),('2034-08-04',203431,8,2034,4,31,203408,2034),('2034-08-05',203431,8,2034,5,31,203408,2034),('2034-08-06',203432,8,2034,6,32,203408,2034),('2034-08-07',203432,8,2034,7,32,203408,2034),('2034-08-08',203432,8,2034,8,32,203408,2034),('2034-08-09',203432,8,2034,9,32,203408,2034),('2034-08-10',203432,8,2034,10,32,203408,2034),('2034-08-11',203432,8,2034,11,32,203408,2034),('2034-08-12',203432,8,2034,12,32,203408,2034),('2034-08-13',203433,8,2034,13,33,203408,2034),('2034-08-14',203433,8,2034,14,33,203408,2034),('2034-08-15',203433,8,2034,15,33,203408,2034),('2034-08-16',203433,8,2034,16,33,203408,2034),('2034-08-17',203433,8,2034,17,33,203408,2034),('2034-08-18',203433,8,2034,18,33,203408,2034),('2034-08-19',203433,8,2034,19,33,203408,2034),('2034-08-20',203434,8,2034,20,34,203408,2034),('2034-08-21',203434,8,2034,21,34,203408,2034),('2034-08-22',203434,8,2034,22,34,203408,2034),('2034-08-23',203434,8,2034,23,34,203408,2034),('2034-08-24',203434,8,2034,24,34,203408,2034),('2034-08-25',203434,8,2034,25,34,203408,2034),('2034-08-26',203434,8,2034,26,34,203408,2034),('2034-08-27',203435,8,2034,27,35,203408,2034),('2034-08-28',203435,8,2034,28,35,203408,2034),('2034-08-29',203435,8,2034,29,35,203408,2034),('2034-08-30',203435,8,2034,30,35,203408,2034),('2034-08-31',203435,8,2034,31,35,203408,2034),('2034-09-01',203435,9,2034,1,35,203409,2034),('2034-09-02',203435,9,2034,2,35,203409,2034),('2034-09-03',203436,9,2034,3,36,203409,2034),('2034-09-04',203436,9,2034,4,36,203409,2034),('2034-09-05',203436,9,2034,5,36,203409,2034),('2034-09-06',203436,9,2034,6,36,203409,2034),('2034-09-07',203436,9,2034,7,36,203409,2034),('2034-09-08',203436,9,2034,8,36,203409,2034),('2034-09-09',203436,9,2034,9,36,203409,2034),('2034-09-10',203437,9,2034,10,37,203409,2034),('2034-09-11',203437,9,2034,11,37,203409,2034),('2034-09-12',203437,9,2034,12,37,203409,2034),('2034-09-13',203437,9,2034,13,37,203409,2034),('2034-09-14',203437,9,2034,14,37,203409,2034),('2034-09-15',203437,9,2034,15,37,203409,2034),('2034-09-16',203437,9,2034,16,37,203409,2034),('2034-09-17',203438,9,2034,17,38,203409,2034),('2034-09-18',203438,9,2034,18,38,203409,2034),('2034-09-19',203438,9,2034,19,38,203409,2034),('2034-09-20',203438,9,2034,20,38,203409,2034),('2034-09-21',203438,9,2034,21,38,203409,2034),('2034-09-22',203438,9,2034,22,38,203409,2034),('2034-09-23',203438,9,2034,23,38,203409,2034),('2034-09-24',203439,9,2034,24,39,203409,2034),('2034-09-25',203439,9,2034,25,39,203409,2034),('2034-09-26',203439,9,2034,26,39,203409,2034),('2034-09-27',203439,9,2034,27,39,203409,2034),('2034-09-28',203439,9,2034,28,39,203409,2034),('2034-09-29',203439,9,2034,29,39,203409,2034),('2034-09-30',203439,9,2034,30,39,203409,2034),('2034-10-01',203440,10,2034,1,40,203410,2034),('2034-10-02',203440,10,2034,2,40,203410,2034),('2034-10-03',203440,10,2034,3,40,203410,2034),('2034-10-04',203440,10,2034,4,40,203410,2034),('2034-10-05',203440,10,2034,5,40,203410,2034),('2034-10-06',203440,10,2034,6,40,203410,2034),('2034-10-07',203440,10,2034,7,40,203410,2034),('2034-10-08',203441,10,2034,8,41,203410,2034),('2034-10-09',203441,10,2034,9,41,203410,2034),('2034-10-10',203441,10,2034,10,41,203410,2034),('2034-10-11',203441,10,2034,11,41,203410,2034),('2034-10-12',203441,10,2034,12,41,203410,2034),('2034-10-13',203441,10,2034,13,41,203410,2034),('2034-10-14',203441,10,2034,14,41,203410,2034),('2034-10-15',203442,10,2034,15,42,203410,2034),('2034-10-16',203442,10,2034,16,42,203410,2034),('2034-10-17',203442,10,2034,17,42,203410,2034),('2034-10-18',203442,10,2034,18,42,203410,2034),('2034-10-19',203442,10,2034,19,42,203410,2034),('2034-10-20',203442,10,2034,20,42,203410,2034),('2034-10-21',203442,10,2034,21,42,203410,2034),('2034-10-22',203443,10,2034,22,43,203410,2034),('2034-10-23',203443,10,2034,23,43,203410,2034),('2034-10-24',203443,10,2034,24,43,203410,2034),('2034-10-25',203443,10,2034,25,43,203410,2034),('2034-10-26',203443,10,2034,26,43,203410,2034),('2034-10-27',203443,10,2034,27,43,203410,2034),('2034-10-28',203443,10,2034,28,43,203410,2034),('2034-10-29',203444,10,2034,29,44,203410,2034),('2034-10-30',203444,10,2034,30,44,203410,2034),('2034-10-31',203444,10,2034,31,44,203410,2034),('2034-11-01',203444,11,2034,1,44,203411,2034),('2034-11-02',203444,11,2034,2,44,203411,2034),('2034-11-03',203444,11,2034,3,44,203411,2034),('2034-11-04',203444,11,2034,4,44,203411,2034),('2034-11-05',203445,11,2034,5,45,203411,2034),('2034-11-06',203445,11,2034,6,45,203411,2034),('2034-11-07',203445,11,2034,7,45,203411,2034),('2034-11-08',203445,11,2034,8,45,203411,2034),('2034-11-09',203445,11,2034,9,45,203411,2034),('2034-11-10',203445,11,2034,10,45,203411,2034),('2034-11-11',203445,11,2034,11,45,203411,2034),('2034-11-12',203446,11,2034,12,46,203411,2034),('2034-11-13',203446,11,2034,13,46,203411,2034),('2034-11-14',203446,11,2034,14,46,203411,2034),('2034-11-15',203446,11,2034,15,46,203411,2034),('2034-11-16',203446,11,2034,16,46,203411,2034),('2034-11-17',203446,11,2034,17,46,203411,2034),('2034-11-18',203446,11,2034,18,46,203411,2034),('2034-11-19',203447,11,2034,19,47,203411,2034),('2034-11-20',203447,11,2034,20,47,203411,2034),('2034-11-21',203447,11,2034,21,47,203411,2034),('2034-11-22',203447,11,2034,22,47,203411,2034),('2034-11-23',203447,11,2034,23,47,203411,2034),('2034-11-24',203447,11,2034,24,47,203411,2034),('2034-11-25',203447,11,2034,25,47,203411,2034),('2034-11-26',203448,11,2034,26,48,203411,2034),('2034-11-27',203448,11,2034,27,48,203411,2034),('2034-11-28',203448,11,2034,28,48,203411,2034),('2034-11-29',203448,11,2034,29,48,203411,2034),('2034-11-30',203448,11,2034,30,48,203411,2034),('2034-12-01',203448,12,2034,1,48,203412,2035),('2034-12-02',203448,12,2034,2,48,203412,2035),('2034-12-03',203449,12,2034,3,49,203412,2035),('2034-12-04',203449,12,2034,4,49,203412,2035),('2034-12-05',203449,12,2034,5,49,203412,2035),('2034-12-06',203449,12,2034,6,49,203412,2035),('2034-12-07',203449,12,2034,7,49,203412,2035),('2034-12-08',203449,12,2034,8,49,203412,2035),('2034-12-09',203449,12,2034,9,49,203412,2035),('2034-12-10',203450,12,2034,10,50,203412,2035),('2034-12-11',203450,12,2034,11,50,203412,2035),('2034-12-12',203450,12,2034,12,50,203412,2035),('2034-12-13',203450,12,2034,13,50,203412,2035),('2034-12-14',203450,12,2034,14,50,203412,2035),('2034-12-15',203450,12,2034,15,50,203412,2035),('2034-12-16',203450,12,2034,16,50,203412,2035),('2034-12-17',203451,12,2034,17,51,203412,2035),('2034-12-18',203451,12,2034,18,51,203412,2035),('2034-12-19',203451,12,2034,19,51,203412,2035),('2034-12-20',203451,12,2034,20,51,203412,2035),('2034-12-21',203451,12,2034,21,51,203412,2035),('2034-12-22',203451,12,2034,22,51,203412,2035),('2034-12-23',203451,12,2034,23,51,203412,2035),('2034-12-24',203452,12,2034,24,52,203412,2035),('2034-12-25',203452,12,2034,25,52,203412,2035),('2034-12-26',203452,12,2034,26,52,203412,2035),('2034-12-27',203452,12,2034,27,52,203412,2035),('2034-12-28',203452,12,2034,28,52,203412,2035),('2034-12-29',203452,12,2034,29,52,203412,2035),('2034-12-30',203452,12,2034,30,52,203412,2035),('2034-12-31',203453,12,2034,31,1,203412,2035),('2035-01-01',203501,1,2035,1,1,203501,2035),('2035-01-02',203501,1,2035,2,1,203501,2035),('2035-01-03',203501,1,2035,3,1,203501,2035),('2035-01-04',203501,1,2035,4,1,203501,2035),('2035-01-05',203501,1,2035,5,1,203501,2035),('2035-01-06',203501,1,2035,6,1,203501,2035),('2035-01-07',203502,1,2035,7,2,203501,2035),('2035-01-08',203502,1,2035,8,2,203501,2035),('2035-01-09',203502,1,2035,9,2,203501,2035),('2035-01-10',203502,1,2035,10,2,203501,2035),('2035-01-11',203502,1,2035,11,2,203501,2035),('2035-01-12',203502,1,2035,12,2,203501,2035),('2035-01-13',203502,1,2035,13,2,203501,2035),('2035-01-14',203503,1,2035,14,3,203501,2035),('2035-01-15',203503,1,2035,15,3,203501,2035),('2035-01-16',203503,1,2035,16,3,203501,2035),('2035-01-17',203503,1,2035,17,3,203501,2035),('2035-01-18',203503,1,2035,18,3,203501,2035),('2035-01-19',203503,1,2035,19,3,203501,2035),('2035-01-20',203503,1,2035,20,3,203501,2035),('2035-01-21',203504,1,2035,21,4,203501,2035),('2035-01-22',203504,1,2035,22,4,203501,2035),('2035-01-23',203504,1,2035,23,4,203501,2035),('2035-01-24',203504,1,2035,24,4,203501,2035),('2035-01-25',203504,1,2035,25,4,203501,2035),('2035-01-26',203504,1,2035,26,4,203501,2035),('2035-01-27',203504,1,2035,27,4,203501,2035),('2035-01-28',203505,1,2035,28,5,203501,2035),('2035-01-29',203505,1,2035,29,5,203501,2035),('2035-01-30',203505,1,2035,30,5,203501,2035),('2035-01-31',203505,1,2035,31,5,203501,2035),('2035-02-01',203505,2,2035,1,5,203502,2035),('2035-02-02',203505,2,2035,2,5,203502,2035),('2035-02-03',203505,2,2035,3,5,203502,2035),('2035-02-04',203506,2,2035,4,6,203502,2035),('2035-02-05',203506,2,2035,5,6,203502,2035),('2035-02-06',203506,2,2035,6,6,203502,2035),('2035-02-07',203506,2,2035,7,6,203502,2035),('2035-02-08',203506,2,2035,8,6,203502,2035),('2035-02-09',203506,2,2035,9,6,203502,2035),('2035-02-10',203506,2,2035,10,6,203502,2035),('2035-02-11',203507,2,2035,11,7,203502,2035),('2035-02-12',203507,2,2035,12,7,203502,2035),('2035-02-13',203507,2,2035,13,7,203502,2035),('2035-02-14',203507,2,2035,14,7,203502,2035),('2035-02-15',203507,2,2035,15,7,203502,2035),('2035-02-16',203507,2,2035,16,7,203502,2035),('2035-02-17',203507,2,2035,17,7,203502,2035),('2035-02-18',203508,2,2035,18,8,203502,2035),('2035-02-19',203508,2,2035,19,8,203502,2035),('2035-02-20',203508,2,2035,20,8,203502,2035),('2035-02-21',203508,2,2035,21,8,203502,2035),('2035-02-22',203508,2,2035,22,8,203502,2035),('2035-02-23',203508,2,2035,23,8,203502,2035),('2035-02-24',203508,2,2035,24,8,203502,2035),('2035-02-25',203509,2,2035,25,9,203502,2035),('2035-02-26',203509,2,2035,26,9,203502,2035),('2035-02-27',203509,2,2035,27,9,203502,2035),('2035-02-28',203509,2,2035,28,9,203502,2035),('2035-03-01',203509,3,2035,1,9,203503,2035),('2035-03-02',203509,3,2035,2,9,203503,2035),('2035-03-03',203509,3,2035,3,9,203503,2035),('2035-03-04',203510,3,2035,4,10,203503,2035),('2035-03-05',203510,3,2035,5,10,203503,2035),('2035-03-06',203510,3,2035,6,10,203503,2035),('2035-03-07',203510,3,2035,7,10,203503,2035),('2035-03-08',203510,3,2035,8,10,203503,2035),('2035-03-09',203510,3,2035,9,10,203503,2035),('2035-03-10',203510,3,2035,10,10,203503,2035),('2035-03-11',203511,3,2035,11,11,203503,2035),('2035-03-12',203511,3,2035,12,11,203503,2035),('2035-03-13',203511,3,2035,13,11,203503,2035),('2035-03-14',203511,3,2035,14,11,203503,2035),('2035-03-15',203511,3,2035,15,11,203503,2035),('2035-03-16',203511,3,2035,16,11,203503,2035),('2035-03-17',203511,3,2035,17,11,203503,2035),('2035-03-18',203512,3,2035,18,12,203503,2035),('2035-03-19',203512,3,2035,19,12,203503,2035),('2035-03-20',203512,3,2035,20,12,203503,2035),('2035-03-21',203512,3,2035,21,12,203503,2035),('2035-03-22',203512,3,2035,22,12,203503,2035),('2035-03-23',203512,3,2035,23,12,203503,2035),('2035-03-24',203512,3,2035,24,12,203503,2035),('2035-03-25',203513,3,2035,25,13,203503,2035),('2035-03-26',203513,3,2035,26,13,203503,2035),('2035-03-27',203513,3,2035,27,13,203503,2035),('2035-03-28',203513,3,2035,28,13,203503,2035),('2035-03-29',203513,3,2035,29,13,203503,2035),('2035-03-30',203513,3,2035,30,13,203503,2035),('2035-03-31',203513,3,2035,31,13,203503,2035),('2035-04-01',203514,4,2035,1,14,203504,2035),('2035-04-02',203514,4,2035,2,14,203504,2035),('2035-04-03',203514,4,2035,3,14,203504,2035),('2035-04-04',203514,4,2035,4,14,203504,2035),('2035-04-05',203514,4,2035,5,14,203504,2035),('2035-04-06',203514,4,2035,6,14,203504,2035),('2035-04-07',203514,4,2035,7,14,203504,2035),('2035-04-08',203515,4,2035,8,15,203504,2035),('2035-04-09',203515,4,2035,9,15,203504,2035),('2035-04-10',203515,4,2035,10,15,203504,2035),('2035-04-11',203515,4,2035,11,15,203504,2035),('2035-04-12',203515,4,2035,12,15,203504,2035),('2035-04-13',203515,4,2035,13,15,203504,2035),('2035-04-14',203515,4,2035,14,15,203504,2035),('2035-04-15',203516,4,2035,15,16,203504,2035),('2035-04-16',203516,4,2035,16,16,203504,2035),('2035-04-17',203516,4,2035,17,16,203504,2035),('2035-04-18',203516,4,2035,18,16,203504,2035),('2035-04-19',203516,4,2035,19,16,203504,2035),('2035-04-20',203516,4,2035,20,16,203504,2035),('2035-04-21',203516,4,2035,21,16,203504,2035),('2035-04-22',203517,4,2035,22,17,203504,2035),('2035-04-23',203517,4,2035,23,17,203504,2035),('2035-04-24',203517,4,2035,24,17,203504,2035),('2035-04-25',203517,4,2035,25,17,203504,2035),('2035-04-26',203517,4,2035,26,17,203504,2035),('2035-04-27',203517,4,2035,27,17,203504,2035),('2035-04-28',203517,4,2035,28,17,203504,2035),('2035-04-29',203518,4,2035,29,18,203504,2035),('2035-04-30',203518,4,2035,30,18,203504,2035),('2035-05-01',203518,5,2035,1,18,203505,2035),('2035-05-02',203518,5,2035,2,18,203505,2035),('2035-05-03',203518,5,2035,3,18,203505,2035),('2035-05-04',203518,5,2035,4,18,203505,2035),('2035-05-05',203518,5,2035,5,18,203505,2035),('2035-05-06',203519,5,2035,6,19,203505,2035),('2035-05-07',203519,5,2035,7,19,203505,2035),('2035-05-08',203519,5,2035,8,19,203505,2035),('2035-05-09',203519,5,2035,9,19,203505,2035),('2035-05-10',203519,5,2035,10,19,203505,2035),('2035-05-11',203519,5,2035,11,19,203505,2035),('2035-05-12',203519,5,2035,12,19,203505,2035),('2035-05-13',203520,5,2035,13,20,203505,2035),('2035-05-14',203520,5,2035,14,20,203505,2035),('2035-05-15',203520,5,2035,15,20,203505,2035),('2035-05-16',203520,5,2035,16,20,203505,2035),('2035-05-17',203520,5,2035,17,20,203505,2035),('2035-05-18',203520,5,2035,18,20,203505,2035),('2035-05-19',203520,5,2035,19,20,203505,2035),('2035-05-20',203521,5,2035,20,21,203505,2035),('2035-05-21',203521,5,2035,21,21,203505,2035),('2035-05-22',203521,5,2035,22,21,203505,2035),('2035-05-23',203521,5,2035,23,21,203505,2035),('2035-05-24',203521,5,2035,24,21,203505,2035),('2035-05-25',203521,5,2035,25,21,203505,2035),('2035-05-26',203521,5,2035,26,21,203505,2035),('2035-05-27',203522,5,2035,27,22,203505,2035),('2035-05-28',203522,5,2035,28,22,203505,2035),('2035-05-29',203522,5,2035,29,22,203505,2035),('2035-05-30',203522,5,2035,30,22,203505,2035),('2035-05-31',203522,5,2035,31,22,203505,2035),('2035-06-01',203522,6,2035,1,22,203506,2035),('2035-06-02',203522,6,2035,2,22,203506,2035),('2035-06-03',203523,6,2035,3,23,203506,2035),('2035-06-04',203523,6,2035,4,23,203506,2035),('2035-06-05',203523,6,2035,5,23,203506,2035),('2035-06-06',203523,6,2035,6,23,203506,2035),('2035-06-07',203523,6,2035,7,23,203506,2035),('2035-06-08',203523,6,2035,8,23,203506,2035),('2035-06-09',203523,6,2035,9,23,203506,2035),('2035-06-10',203524,6,2035,10,24,203506,2035),('2035-06-11',203524,6,2035,11,24,203506,2035),('2035-06-12',203524,6,2035,12,24,203506,2035),('2035-06-13',203524,6,2035,13,24,203506,2035),('2035-06-14',203524,6,2035,14,24,203506,2035),('2035-06-15',203524,6,2035,15,24,203506,2035),('2035-06-16',203524,6,2035,16,24,203506,2035),('2035-06-17',203525,6,2035,17,25,203506,2035),('2035-06-18',203525,6,2035,18,25,203506,2035),('2035-06-19',203525,6,2035,19,25,203506,2035),('2035-06-20',203525,6,2035,20,25,203506,2035),('2035-06-21',203525,6,2035,21,25,203506,2035),('2035-06-22',203525,6,2035,22,25,203506,2035),('2035-06-23',203525,6,2035,23,25,203506,2035),('2035-06-24',203526,6,2035,24,26,203506,2035),('2035-06-25',203526,6,2035,25,26,203506,2035),('2035-06-26',203526,6,2035,26,26,203506,2035),('2035-06-27',203526,6,2035,27,26,203506,2035),('2035-06-28',203526,6,2035,28,26,203506,2035),('2035-06-29',203526,6,2035,29,26,203506,2035),('2035-06-30',203526,6,2035,30,26,203506,2035),('2035-07-01',203527,7,2035,1,27,203507,2035),('2035-07-02',203527,7,2035,2,27,203507,2035),('2035-07-03',203527,7,2035,3,27,203507,2035),('2035-07-04',203527,7,2035,4,27,203507,2035),('2035-07-05',203527,7,2035,5,27,203507,2035),('2035-07-06',203527,7,2035,6,27,203507,2035),('2035-07-07',203527,7,2035,7,27,203507,2035),('2035-07-08',203528,7,2035,8,28,203507,2035),('2035-07-09',203528,7,2035,9,28,203507,2035),('2035-07-10',203528,7,2035,10,28,203507,2035),('2035-07-11',203528,7,2035,11,28,203507,2035),('2035-07-12',203528,7,2035,12,28,203507,2035),('2035-07-13',203528,7,2035,13,28,203507,2035),('2035-07-14',203528,7,2035,14,28,203507,2035),('2035-07-15',203529,7,2035,15,29,203507,2035),('2035-07-16',203529,7,2035,16,29,203507,2035),('2035-07-17',203529,7,2035,17,29,203507,2035),('2035-07-18',203529,7,2035,18,29,203507,2035),('2035-07-19',203529,7,2035,19,29,203507,2035),('2035-07-20',203529,7,2035,20,29,203507,2035),('2035-07-21',203529,7,2035,21,29,203507,2035),('2035-07-22',203530,7,2035,22,30,203507,2035),('2035-07-23',203530,7,2035,23,30,203507,2035),('2035-07-24',203530,7,2035,24,30,203507,2035),('2035-07-25',203530,7,2035,25,30,203507,2035),('2035-07-26',203530,7,2035,26,30,203507,2035),('2035-07-27',203530,7,2035,27,30,203507,2035),('2035-07-28',203530,7,2035,28,30,203507,2035),('2035-07-29',203531,7,2035,29,31,203507,2035),('2035-07-30',203531,7,2035,30,31,203507,2035),('2035-07-31',203531,7,2035,31,31,203507,2035),('2035-08-01',203531,8,2035,1,31,203508,2035),('2035-08-02',203531,8,2035,2,31,203508,2035),('2035-08-03',203531,8,2035,3,31,203508,2035),('2035-08-04',203531,8,2035,4,31,203508,2035),('2035-08-05',203532,8,2035,5,32,203508,2035),('2035-08-06',203532,8,2035,6,32,203508,2035),('2035-08-07',203532,8,2035,7,32,203508,2035),('2035-08-08',203532,8,2035,8,32,203508,2035),('2035-08-09',203532,8,2035,9,32,203508,2035),('2035-08-10',203532,8,2035,10,32,203508,2035),('2035-08-11',203532,8,2035,11,32,203508,2035),('2035-08-12',203533,8,2035,12,33,203508,2035),('2035-08-13',203533,8,2035,13,33,203508,2035),('2035-08-14',203533,8,2035,14,33,203508,2035),('2035-08-15',203533,8,2035,15,33,203508,2035),('2035-08-16',203533,8,2035,16,33,203508,2035),('2035-08-17',203533,8,2035,17,33,203508,2035),('2035-08-18',203533,8,2035,18,33,203508,2035),('2035-08-19',203534,8,2035,19,34,203508,2035),('2035-08-20',203534,8,2035,20,34,203508,2035),('2035-08-21',203534,8,2035,21,34,203508,2035),('2035-08-22',203534,8,2035,22,34,203508,2035),('2035-08-23',203534,8,2035,23,34,203508,2035),('2035-08-24',203534,8,2035,24,34,203508,2035),('2035-08-25',203534,8,2035,25,34,203508,2035),('2035-08-26',203535,8,2035,26,35,203508,2035),('2035-08-27',203535,8,2035,27,35,203508,2035),('2035-08-28',203535,8,2035,28,35,203508,2035),('2035-08-29',203535,8,2035,29,35,203508,2035),('2035-08-30',203535,8,2035,30,35,203508,2035),('2035-08-31',203535,8,2035,31,35,203508,2035),('2035-09-01',203535,9,2035,1,35,203509,2035),('2035-09-02',203536,9,2035,2,36,203509,2035),('2035-09-03',203536,9,2035,3,36,203509,2035),('2035-09-04',203536,9,2035,4,36,203509,2035),('2035-09-05',203536,9,2035,5,36,203509,2035),('2035-09-06',203536,9,2035,6,36,203509,2035),('2035-09-07',203536,9,2035,7,36,203509,2035),('2035-09-08',203536,9,2035,8,36,203509,2035),('2035-09-09',203537,9,2035,9,37,203509,2035),('2035-09-10',203537,9,2035,10,37,203509,2035),('2035-09-11',203537,9,2035,11,37,203509,2035),('2035-09-12',203537,9,2035,12,37,203509,2035),('2035-09-13',203537,9,2035,13,37,203509,2035),('2035-09-14',203537,9,2035,14,37,203509,2035),('2035-09-15',203537,9,2035,15,37,203509,2035),('2035-09-16',203538,9,2035,16,38,203509,2035),('2035-09-17',203538,9,2035,17,38,203509,2035),('2035-09-18',203538,9,2035,18,38,203509,2035),('2035-09-19',203538,9,2035,19,38,203509,2035),('2035-09-20',203538,9,2035,20,38,203509,2035),('2035-09-21',203538,9,2035,21,38,203509,2035),('2035-09-22',203538,9,2035,22,38,203509,2035),('2035-09-23',203539,9,2035,23,39,203509,2035),('2035-09-24',203539,9,2035,24,39,203509,2035),('2035-09-25',203539,9,2035,25,39,203509,2035),('2035-09-26',203539,9,2035,26,39,203509,2035),('2035-09-27',203539,9,2035,27,39,203509,2035),('2035-09-28',203539,9,2035,28,39,203509,2035),('2035-09-29',203539,9,2035,29,39,203509,2035),('2035-09-30',203540,9,2035,30,40,203509,2035),('2035-10-01',203540,10,2035,1,40,203510,2035),('2035-10-02',203540,10,2035,2,40,203510,2035),('2035-10-03',203540,10,2035,3,40,203510,2035),('2035-10-04',203540,10,2035,4,40,203510,2035),('2035-10-05',203540,10,2035,5,40,203510,2035),('2035-10-06',203540,10,2035,6,40,203510,2035),('2035-10-07',203541,10,2035,7,41,203510,2035),('2035-10-08',203541,10,2035,8,41,203510,2035),('2035-10-09',203541,10,2035,9,41,203510,2035),('2035-10-10',203541,10,2035,10,41,203510,2035),('2035-10-11',203541,10,2035,11,41,203510,2035),('2035-10-12',203541,10,2035,12,41,203510,2035),('2035-10-13',203541,10,2035,13,41,203510,2035),('2035-10-14',203542,10,2035,14,42,203510,2035),('2035-10-15',203542,10,2035,15,42,203510,2035),('2035-10-16',203542,10,2035,16,42,203510,2035),('2035-10-17',203542,10,2035,17,42,203510,2035),('2035-10-18',203542,10,2035,18,42,203510,2035),('2035-10-19',203542,10,2035,19,42,203510,2035),('2035-10-20',203542,10,2035,20,42,203510,2035),('2035-10-21',203543,10,2035,21,43,203510,2035),('2035-10-22',203543,10,2035,22,43,203510,2035),('2035-10-23',203543,10,2035,23,43,203510,2035),('2035-10-24',203543,10,2035,24,43,203510,2035),('2035-10-25',203543,10,2035,25,43,203510,2035),('2035-10-26',203543,10,2035,26,43,203510,2035),('2035-10-27',203543,10,2035,27,43,203510,2035),('2035-10-28',203544,10,2035,28,44,203510,2035),('2035-10-29',203544,10,2035,29,44,203510,2035),('2035-10-30',203544,10,2035,30,44,203510,2035),('2035-10-31',203544,10,2035,31,44,203510,2035),('2035-11-01',203544,11,2035,1,44,203511,2035),('2035-11-02',203544,11,2035,2,44,203511,2035),('2035-11-03',203544,11,2035,3,44,203511,2035),('2035-11-04',203545,11,2035,4,45,203511,2035),('2035-11-05',203545,11,2035,5,45,203511,2035),('2035-11-06',203545,11,2035,6,45,203511,2035),('2035-11-07',203545,11,2035,7,45,203511,2035),('2035-11-08',203545,11,2035,8,45,203511,2035),('2035-11-09',203545,11,2035,9,45,203511,2035),('2035-11-10',203545,11,2035,10,45,203511,2035),('2035-11-11',203546,11,2035,11,46,203511,2035),('2035-11-12',203546,11,2035,12,46,203511,2035),('2035-11-13',203546,11,2035,13,46,203511,2035),('2035-11-14',203546,11,2035,14,46,203511,2035),('2035-11-15',203546,11,2035,15,46,203511,2035),('2035-11-16',203546,11,2035,16,46,203511,2035),('2035-11-17',203546,11,2035,17,46,203511,2035),('2035-11-18',203547,11,2035,18,47,203511,2035),('2035-11-19',203547,11,2035,19,47,203511,2035),('2035-11-20',203547,11,2035,20,47,203511,2035),('2035-11-21',203547,11,2035,21,47,203511,2035),('2035-11-22',203547,11,2035,22,47,203511,2035),('2035-11-23',203547,11,2035,23,47,203511,2035),('2035-11-24',203547,11,2035,24,47,203511,2035),('2035-11-25',203548,11,2035,25,48,203511,2035),('2035-11-26',203548,11,2035,26,48,203511,2035),('2035-11-27',203548,11,2035,27,48,203511,2035),('2035-11-28',203548,11,2035,28,48,203511,2035),('2035-11-29',203548,11,2035,29,48,203511,2035),('2035-11-30',203548,11,2035,30,48,203511,2035),('2035-12-01',203548,12,2035,1,48,203512,2036),('2035-12-02',203549,12,2035,2,49,203512,2036),('2035-12-03',203549,12,2035,3,49,203512,2036),('2035-12-04',203549,12,2035,4,49,203512,2036),('2035-12-05',203549,12,2035,5,49,203512,2036),('2035-12-06',203549,12,2035,6,49,203512,2036),('2035-12-07',203549,12,2035,7,49,203512,2036),('2035-12-08',203549,12,2035,8,49,203512,2036),('2035-12-09',203550,12,2035,9,50,203512,2036),('2035-12-10',203550,12,2035,10,50,203512,2036),('2035-12-11',203550,12,2035,11,50,203512,2036),('2035-12-12',203550,12,2035,12,50,203512,2036),('2035-12-13',203550,12,2035,13,50,203512,2036),('2035-12-14',203550,12,2035,14,50,203512,2036),('2035-12-15',203550,12,2035,15,50,203512,2036),('2035-12-16',203551,12,2035,16,51,203512,2036),('2035-12-17',203551,12,2035,17,51,203512,2036),('2035-12-18',203551,12,2035,18,51,203512,2036),('2035-12-19',203551,12,2035,19,51,203512,2036),('2035-12-20',203551,12,2035,20,51,203512,2036),('2035-12-21',203551,12,2035,21,51,203512,2036),('2035-12-22',203551,12,2035,22,51,203512,2036),('2035-12-23',203552,12,2035,23,52,203512,2036),('2035-12-24',203552,12,2035,24,52,203512,2036),('2035-12-25',203552,12,2035,25,52,203512,2036),('2035-12-26',203552,12,2035,26,52,203512,2036),('2035-12-27',203552,12,2035,27,52,203512,2036),('2035-12-28',203552,12,2035,28,52,203512,2036),('2035-12-29',203552,12,2035,29,52,203512,2036),('2035-12-30',203553,12,2035,30,1,203512,2036),('2035-12-31',203501,12,2035,31,1,203512,2036),('2036-01-01',203601,1,2036,1,1,203601,2036),('2036-01-02',203601,1,2036,2,1,203601,2036),('2036-01-03',203601,1,2036,3,1,203601,2036),('2036-01-04',203601,1,2036,4,1,203601,2036),('2036-01-05',203601,1,2036,5,1,203601,2036),('2036-01-06',203602,1,2036,6,2,203601,2036),('2036-01-07',203602,1,2036,7,2,203601,2036),('2036-01-08',203602,1,2036,8,2,203601,2036),('2036-01-09',203602,1,2036,9,2,203601,2036),('2036-01-10',203602,1,2036,10,2,203601,2036),('2036-01-11',203602,1,2036,11,2,203601,2036),('2036-01-12',203602,1,2036,12,2,203601,2036),('2036-01-13',203603,1,2036,13,3,203601,2036),('2036-01-14',203603,1,2036,14,3,203601,2036),('2036-01-15',203603,1,2036,15,3,203601,2036),('2036-01-16',203603,1,2036,16,3,203601,2036),('2036-01-17',203603,1,2036,17,3,203601,2036),('2036-01-18',203603,1,2036,18,3,203601,2036),('2036-01-19',203603,1,2036,19,3,203601,2036),('2036-01-20',203604,1,2036,20,4,203601,2036),('2036-01-21',203604,1,2036,21,4,203601,2036),('2036-01-22',203604,1,2036,22,4,203601,2036),('2036-01-23',203604,1,2036,23,4,203601,2036),('2036-01-24',203604,1,2036,24,4,203601,2036),('2036-01-25',203604,1,2036,25,4,203601,2036),('2036-01-26',203604,1,2036,26,4,203601,2036),('2036-01-27',203605,1,2036,27,5,203601,2036),('2036-01-28',203605,1,2036,28,5,203601,2036),('2036-01-29',203605,1,2036,29,5,203601,2036),('2036-01-30',203605,1,2036,30,5,203601,2036),('2036-01-31',203605,1,2036,31,5,203601,2036),('2036-02-01',203605,2,2036,1,5,203602,2036),('2036-02-02',203605,2,2036,2,5,203602,2036),('2036-02-03',203606,2,2036,3,6,203602,2036),('2036-02-04',203606,2,2036,4,6,203602,2036),('2036-02-05',203606,2,2036,5,6,203602,2036),('2036-02-06',203606,2,2036,6,6,203602,2036),('2036-02-07',203606,2,2036,7,6,203602,2036),('2036-02-08',203606,2,2036,8,6,203602,2036),('2036-02-09',203606,2,2036,9,6,203602,2036),('2036-02-10',203607,2,2036,10,7,203602,2036),('2036-02-11',203607,2,2036,11,7,203602,2036),('2036-02-12',203607,2,2036,12,7,203602,2036),('2036-02-13',203607,2,2036,13,7,203602,2036),('2036-02-14',203607,2,2036,14,7,203602,2036),('2036-02-15',203607,2,2036,15,7,203602,2036),('2036-02-16',203607,2,2036,16,7,203602,2036),('2036-02-17',203608,2,2036,17,8,203602,2036),('2036-02-18',203608,2,2036,18,8,203602,2036),('2036-02-19',203608,2,2036,19,8,203602,2036),('2036-02-20',203608,2,2036,20,8,203602,2036),('2036-02-21',203608,2,2036,21,8,203602,2036),('2036-02-22',203608,2,2036,22,8,203602,2036),('2036-02-23',203608,2,2036,23,8,203602,2036),('2036-02-24',203609,2,2036,24,9,203602,2036),('2036-02-25',203609,2,2036,25,9,203602,2036),('2036-02-26',203609,2,2036,26,9,203602,2036),('2036-02-27',203609,2,2036,27,9,203602,2036),('2036-02-28',203609,2,2036,28,9,203602,2036),('2036-02-29',203609,2,2036,29,9,203602,2036),('2036-03-01',203609,3,2036,1,9,203603,2036),('2036-03-02',203610,3,2036,2,10,203603,2036),('2036-03-03',203610,3,2036,3,10,203603,2036),('2036-03-04',203610,3,2036,4,10,203603,2036),('2036-03-05',203610,3,2036,5,10,203603,2036),('2036-03-06',203610,3,2036,6,10,203603,2036),('2036-03-07',203610,3,2036,7,10,203603,2036),('2036-03-08',203610,3,2036,8,10,203603,2036),('2036-03-09',203611,3,2036,9,11,203603,2036),('2036-03-10',203611,3,2036,10,11,203603,2036),('2036-03-11',203611,3,2036,11,11,203603,2036),('2036-03-12',203611,3,2036,12,11,203603,2036),('2036-03-13',203611,3,2036,13,11,203603,2036),('2036-03-14',203611,3,2036,14,11,203603,2036),('2036-03-15',203611,3,2036,15,11,203603,2036),('2036-03-16',203612,3,2036,16,12,203603,2036),('2036-03-17',203612,3,2036,17,12,203603,2036),('2036-03-18',203612,3,2036,18,12,203603,2036),('2036-03-19',203612,3,2036,19,12,203603,2036),('2036-03-20',203612,3,2036,20,12,203603,2036),('2036-03-21',203612,3,2036,21,12,203603,2036),('2036-03-22',203612,3,2036,22,12,203603,2036),('2036-03-23',203613,3,2036,23,13,203603,2036),('2036-03-24',203613,3,2036,24,13,203603,2036),('2036-03-25',203613,3,2036,25,13,203603,2036),('2036-03-26',203613,3,2036,26,13,203603,2036),('2036-03-27',203613,3,2036,27,13,203603,2036),('2036-03-28',203613,3,2036,28,13,203603,2036),('2036-03-29',203613,3,2036,29,13,203603,2036),('2036-03-30',203614,3,2036,30,14,203603,2036),('2036-03-31',203614,3,2036,31,14,203603,2036),('2036-04-01',203614,4,2036,1,14,203604,2036),('2036-04-02',203614,4,2036,2,14,203604,2036),('2036-04-03',203614,4,2036,3,14,203604,2036),('2036-04-04',203614,4,2036,4,14,203604,2036),('2036-04-05',203614,4,2036,5,14,203604,2036),('2036-04-06',203615,4,2036,6,15,203604,2036),('2036-04-07',203615,4,2036,7,15,203604,2036),('2036-04-08',203615,4,2036,8,15,203604,2036),('2036-04-09',203615,4,2036,9,15,203604,2036),('2036-04-10',203615,4,2036,10,15,203604,2036),('2036-04-11',203615,4,2036,11,15,203604,2036),('2036-04-12',203615,4,2036,12,15,203604,2036),('2036-04-13',203616,4,2036,13,16,203604,2036),('2036-04-14',203616,4,2036,14,16,203604,2036),('2036-04-15',203616,4,2036,15,16,203604,2036),('2036-04-16',203616,4,2036,16,16,203604,2036),('2036-04-17',203616,4,2036,17,16,203604,2036),('2036-04-18',203616,4,2036,18,16,203604,2036),('2036-04-19',203616,4,2036,19,16,203604,2036),('2036-04-20',203617,4,2036,20,17,203604,2036),('2036-04-21',203617,4,2036,21,17,203604,2036),('2036-04-22',203617,4,2036,22,17,203604,2036),('2036-04-23',203617,4,2036,23,17,203604,2036),('2036-04-24',203617,4,2036,24,17,203604,2036),('2036-04-25',203617,4,2036,25,17,203604,2036),('2036-04-26',203617,4,2036,26,17,203604,2036),('2036-04-27',203618,4,2036,27,18,203604,2036),('2036-04-28',203618,4,2036,28,18,203604,2036),('2036-04-29',203618,4,2036,29,18,203604,2036),('2036-04-30',203618,4,2036,30,18,203604,2036),('2036-05-01',203618,5,2036,1,18,203605,2036),('2036-05-02',203618,5,2036,2,18,203605,2036),('2036-05-03',203618,5,2036,3,18,203605,2036),('2036-05-04',203619,5,2036,4,19,203605,2036),('2036-05-05',203619,5,2036,5,19,203605,2036),('2036-05-06',203619,5,2036,6,19,203605,2036),('2036-05-07',203619,5,2036,7,19,203605,2036),('2036-05-08',203619,5,2036,8,19,203605,2036),('2036-05-09',203619,5,2036,9,19,203605,2036),('2036-05-10',203619,5,2036,10,19,203605,2036),('2036-05-11',203620,5,2036,11,20,203605,2036),('2036-05-12',203620,5,2036,12,20,203605,2036),('2036-05-13',203620,5,2036,13,20,203605,2036),('2036-05-14',203620,5,2036,14,20,203605,2036),('2036-05-15',203620,5,2036,15,20,203605,2036),('2036-05-16',203620,5,2036,16,20,203605,2036),('2036-05-17',203620,5,2036,17,20,203605,2036),('2036-05-18',203621,5,2036,18,21,203605,2036),('2036-05-19',203621,5,2036,19,21,203605,2036),('2036-05-20',203621,5,2036,20,21,203605,2036),('2036-05-21',203621,5,2036,21,21,203605,2036),('2036-05-22',203621,5,2036,22,21,203605,2036),('2036-05-23',203621,5,2036,23,21,203605,2036),('2036-05-24',203621,5,2036,24,21,203605,2036),('2036-05-25',203622,5,2036,25,22,203605,2036),('2036-05-26',203622,5,2036,26,22,203605,2036),('2036-05-27',203622,5,2036,27,22,203605,2036),('2036-05-28',203622,5,2036,28,22,203605,2036),('2036-05-29',203622,5,2036,29,22,203605,2036),('2036-05-30',203622,5,2036,30,22,203605,2036),('2036-05-31',203622,5,2036,31,22,203605,2036),('2036-06-01',203623,6,2036,1,23,203606,2036),('2036-06-02',203623,6,2036,2,23,203606,2036),('2036-06-03',203623,6,2036,3,23,203606,2036),('2036-06-04',203623,6,2036,4,23,203606,2036),('2036-06-05',203623,6,2036,5,23,203606,2036),('2036-06-06',203623,6,2036,6,23,203606,2036),('2036-06-07',203623,6,2036,7,23,203606,2036),('2036-06-08',203624,6,2036,8,24,203606,2036),('2036-06-09',203624,6,2036,9,24,203606,2036),('2036-06-10',203624,6,2036,10,24,203606,2036),('2036-06-11',203624,6,2036,11,24,203606,2036),('2036-06-12',203624,6,2036,12,24,203606,2036),('2036-06-13',203624,6,2036,13,24,203606,2036),('2036-06-14',203624,6,2036,14,24,203606,2036),('2036-06-15',203625,6,2036,15,25,203606,2036),('2036-06-16',203625,6,2036,16,25,203606,2036),('2036-06-17',203625,6,2036,17,25,203606,2036),('2036-06-18',203625,6,2036,18,25,203606,2036),('2036-06-19',203625,6,2036,19,25,203606,2036),('2036-06-20',203625,6,2036,20,25,203606,2036),('2036-06-21',203625,6,2036,21,25,203606,2036),('2036-06-22',203626,6,2036,22,26,203606,2036),('2036-06-23',203626,6,2036,23,26,203606,2036),('2036-06-24',203626,6,2036,24,26,203606,2036),('2036-06-25',203626,6,2036,25,26,203606,2036),('2036-06-26',203626,6,2036,26,26,203606,2036),('2036-06-27',203626,6,2036,27,26,203606,2036),('2036-06-28',203626,6,2036,28,26,203606,2036),('2036-06-29',203627,6,2036,29,27,203606,2036),('2036-06-30',203627,6,2036,30,27,203606,2036),('2036-07-01',203627,7,2036,1,27,203607,2036),('2036-07-02',203627,7,2036,2,27,203607,2036),('2036-07-03',203627,7,2036,3,27,203607,2036),('2036-07-04',203627,7,2036,4,27,203607,2036),('2036-07-05',203627,7,2036,5,27,203607,2036),('2036-07-06',203628,7,2036,6,28,203607,2036),('2036-07-07',203628,7,2036,7,28,203607,2036),('2036-07-08',203628,7,2036,8,28,203607,2036),('2036-07-09',203628,7,2036,9,28,203607,2036),('2036-07-10',203628,7,2036,10,28,203607,2036),('2036-07-11',203628,7,2036,11,28,203607,2036),('2036-07-12',203628,7,2036,12,28,203607,2036),('2036-07-13',203629,7,2036,13,29,203607,2036),('2036-07-14',203629,7,2036,14,29,203607,2036),('2036-07-15',203629,7,2036,15,29,203607,2036),('2036-07-16',203629,7,2036,16,29,203607,2036),('2036-07-17',203629,7,2036,17,29,203607,2036),('2036-07-18',203629,7,2036,18,29,203607,2036),('2036-07-19',203629,7,2036,19,29,203607,2036),('2036-07-20',203630,7,2036,20,30,203607,2036),('2036-07-21',203630,7,2036,21,30,203607,2036),('2036-07-22',203630,7,2036,22,30,203607,2036),('2036-07-23',203630,7,2036,23,30,203607,2036),('2036-07-24',203630,7,2036,24,30,203607,2036),('2036-07-25',203630,7,2036,25,30,203607,2036),('2036-07-26',203630,7,2036,26,30,203607,2036),('2036-07-27',203631,7,2036,27,31,203607,2036),('2036-07-28',203631,7,2036,28,31,203607,2036),('2036-07-29',203631,7,2036,29,31,203607,2036),('2036-07-30',203631,7,2036,30,31,203607,2036),('2036-07-31',203631,7,2036,31,31,203607,2036),('2036-08-01',203631,8,2036,1,31,203608,2036),('2036-08-02',203631,8,2036,2,31,203608,2036),('2036-08-03',203632,8,2036,3,32,203608,2036),('2036-08-04',203632,8,2036,4,32,203608,2036),('2036-08-05',203632,8,2036,5,32,203608,2036),('2036-08-06',203632,8,2036,6,32,203608,2036),('2036-08-07',203632,8,2036,7,32,203608,2036),('2036-08-08',203632,8,2036,8,32,203608,2036),('2036-08-09',203632,8,2036,9,32,203608,2036),('2036-08-10',203633,8,2036,10,33,203608,2036),('2036-08-11',203633,8,2036,11,33,203608,2036),('2036-08-12',203633,8,2036,12,33,203608,2036),('2036-08-13',203633,8,2036,13,33,203608,2036),('2036-08-14',203633,8,2036,14,33,203608,2036),('2036-08-15',203633,8,2036,15,33,203608,2036),('2036-08-16',203633,8,2036,16,33,203608,2036),('2036-08-17',203634,8,2036,17,34,203608,2036),('2036-08-18',203634,8,2036,18,34,203608,2036),('2036-08-19',203634,8,2036,19,34,203608,2036),('2036-08-20',203634,8,2036,20,34,203608,2036),('2036-08-21',203634,8,2036,21,34,203608,2036),('2036-08-22',203634,8,2036,22,34,203608,2036),('2036-08-23',203634,8,2036,23,34,203608,2036),('2036-08-24',203635,8,2036,24,35,203608,2036),('2036-08-25',203635,8,2036,25,35,203608,2036),('2036-08-26',203635,8,2036,26,35,203608,2036),('2036-08-27',203635,8,2036,27,35,203608,2036),('2036-08-28',203635,8,2036,28,35,203608,2036),('2036-08-29',203635,8,2036,29,35,203608,2036),('2036-08-30',203635,8,2036,30,35,203608,2036),('2036-08-31',203636,8,2036,31,36,203608,2036),('2036-09-01',203636,9,2036,1,36,203609,2036),('2036-09-02',203636,9,2036,2,36,203609,2036),('2036-09-03',203636,9,2036,3,36,203609,2036),('2036-09-04',203636,9,2036,4,36,203609,2036),('2036-09-05',203636,9,2036,5,36,203609,2036),('2036-09-06',203636,9,2036,6,36,203609,2036),('2036-09-07',203637,9,2036,7,37,203609,2036),('2036-09-08',203637,9,2036,8,37,203609,2036),('2036-09-09',203637,9,2036,9,37,203609,2036),('2036-09-10',203637,9,2036,10,37,203609,2036),('2036-09-11',203637,9,2036,11,37,203609,2036),('2036-09-12',203637,9,2036,12,37,203609,2036),('2036-09-13',203637,9,2036,13,37,203609,2036),('2036-09-14',203638,9,2036,14,38,203609,2036),('2036-09-15',203638,9,2036,15,38,203609,2036),('2036-09-16',203638,9,2036,16,38,203609,2036),('2036-09-17',203638,9,2036,17,38,203609,2036),('2036-09-18',203638,9,2036,18,38,203609,2036),('2036-09-19',203638,9,2036,19,38,203609,2036),('2036-09-20',203638,9,2036,20,38,203609,2036),('2036-09-21',203639,9,2036,21,39,203609,2036),('2036-09-22',203639,9,2036,22,39,203609,2036),('2036-09-23',203639,9,2036,23,39,203609,2036),('2036-09-24',203639,9,2036,24,39,203609,2036),('2036-09-25',203639,9,2036,25,39,203609,2036),('2036-09-26',203639,9,2036,26,39,203609,2036),('2036-09-27',203639,9,2036,27,39,203609,2036),('2036-09-28',203640,9,2036,28,40,203609,2036),('2036-09-29',203640,9,2036,29,40,203609,2036),('2036-09-30',203640,9,2036,30,40,203609,2036),('2036-10-01',203640,10,2036,1,40,203610,2036),('2036-10-02',203640,10,2036,2,40,203610,2036),('2036-10-03',203640,10,2036,3,40,203610,2036),('2036-10-04',203640,10,2036,4,40,203610,2036),('2036-10-05',203641,10,2036,5,41,203610,2036),('2036-10-06',203641,10,2036,6,41,203610,2036),('2036-10-07',203641,10,2036,7,41,203610,2036),('2036-10-08',203641,10,2036,8,41,203610,2036),('2036-10-09',203641,10,2036,9,41,203610,2036),('2036-10-10',203641,10,2036,10,41,203610,2036),('2036-10-11',203641,10,2036,11,41,203610,2036),('2036-10-12',203642,10,2036,12,42,203610,2036),('2036-10-13',203642,10,2036,13,42,203610,2036),('2036-10-14',203642,10,2036,14,42,203610,2036),('2036-10-15',203642,10,2036,15,42,203610,2036),('2036-10-16',203642,10,2036,16,42,203610,2036),('2036-10-17',203642,10,2036,17,42,203610,2036),('2036-10-18',203642,10,2036,18,42,203610,2036),('2036-10-19',203643,10,2036,19,43,203610,2036),('2036-10-20',203643,10,2036,20,43,203610,2036),('2036-10-21',203643,10,2036,21,43,203610,2036),('2036-10-22',203643,10,2036,22,43,203610,2036),('2036-10-23',203643,10,2036,23,43,203610,2036),('2036-10-24',203643,10,2036,24,43,203610,2036),('2036-10-25',203643,10,2036,25,43,203610,2036),('2036-10-26',203644,10,2036,26,44,203610,2036),('2036-10-27',203644,10,2036,27,44,203610,2036),('2036-10-28',203644,10,2036,28,44,203610,2036),('2036-10-29',203644,10,2036,29,44,203610,2036),('2036-10-30',203644,10,2036,30,44,203610,2036),('2036-10-31',203644,10,2036,31,44,203610,2036),('2036-11-01',203644,11,2036,1,44,203611,2036),('2036-11-02',203645,11,2036,2,45,203611,2036),('2036-11-03',203645,11,2036,3,45,203611,2036),('2036-11-04',203645,11,2036,4,45,203611,2036),('2036-11-05',203645,11,2036,5,45,203611,2036),('2036-11-06',203645,11,2036,6,45,203611,2036),('2036-11-07',203645,11,2036,7,45,203611,2036),('2036-11-08',203645,11,2036,8,45,203611,2036),('2036-11-09',203646,11,2036,9,46,203611,2036),('2036-11-10',203646,11,2036,10,46,203611,2036),('2036-11-11',203646,11,2036,11,46,203611,2036),('2036-11-12',203646,11,2036,12,46,203611,2036),('2036-11-13',203646,11,2036,13,46,203611,2036),('2036-11-14',203646,11,2036,14,46,203611,2036),('2036-11-15',203646,11,2036,15,46,203611,2036),('2036-11-16',203647,11,2036,16,47,203611,2036),('2036-11-17',203647,11,2036,17,47,203611,2036),('2036-11-18',203647,11,2036,18,47,203611,2036),('2036-11-19',203647,11,2036,19,47,203611,2036),('2036-11-20',203647,11,2036,20,47,203611,2036),('2036-11-21',203647,11,2036,21,47,203611,2036),('2036-11-22',203647,11,2036,22,47,203611,2036),('2036-11-23',203648,11,2036,23,48,203611,2036),('2036-11-24',203648,11,2036,24,48,203611,2036),('2036-11-25',203648,11,2036,25,48,203611,2036),('2036-11-26',203648,11,2036,26,48,203611,2036),('2036-11-27',203648,11,2036,27,48,203611,2036),('2036-11-28',203648,11,2036,28,48,203611,2036),('2036-11-29',203648,11,2036,29,48,203611,2036),('2036-11-30',203649,11,2036,30,49,203611,2036),('2036-12-01',203649,12,2036,1,49,203612,2037),('2036-12-02',203649,12,2036,2,49,203612,2037),('2036-12-03',203649,12,2036,3,49,203612,2037),('2036-12-04',203649,12,2036,4,49,203612,2037),('2036-12-05',203649,12,2036,5,49,203612,2037),('2036-12-06',203649,12,2036,6,49,203612,2037),('2036-12-07',203650,12,2036,7,50,203612,2037),('2036-12-08',203650,12,2036,8,50,203612,2037),('2036-12-09',203650,12,2036,9,50,203612,2037),('2036-12-10',203650,12,2036,10,50,203612,2037),('2036-12-11',203650,12,2036,11,50,203612,2037),('2036-12-12',203650,12,2036,12,50,203612,2037),('2036-12-13',203650,12,2036,13,50,203612,2037),('2036-12-14',203651,12,2036,14,51,203612,2037),('2036-12-15',203651,12,2036,15,51,203612,2037),('2036-12-16',203651,12,2036,16,51,203612,2037),('2036-12-17',203651,12,2036,17,51,203612,2037),('2036-12-18',203651,12,2036,18,51,203612,2037),('2036-12-19',203651,12,2036,19,51,203612,2037),('2036-12-20',203651,12,2036,20,51,203612,2037),('2036-12-21',203652,12,2036,21,52,203612,2037),('2036-12-22',203652,12,2036,22,52,203612,2037),('2036-12-23',203652,12,2036,23,52,203612,2037),('2036-12-24',203652,12,2036,24,52,203612,2037),('2036-12-25',203652,12,2036,25,52,203612,2037),('2036-12-26',203652,12,2036,26,52,203612,2037),('2036-12-27',203652,12,2036,27,52,203612,2037),('2036-12-28',203653,12,2036,28,53,203612,2037),('2036-12-29',203601,12,2036,29,53,203612,2037),('2036-12-30',203601,12,2036,30,53,203612,2037); /*!40000 ALTER TABLE `time` ENABLE KEYS */; UNLOCK TABLES; @@ -460,9 +480,19 @@ UNLOCK TABLES; LOCK TABLES `volumeConfig` WRITE; /*!40000 ALTER TABLE `volumeConfig` DISABLE KEYS */; -INSERT INTO `volumeConfig` VALUES (2.67,1.60,0.8,150,0.30,120,57,2.0,75,200,50); +INSERT INTO `volumeConfig` VALUES (2.67,1.60,0.8,150,0.30,120,57,2.0,0,200,0,167.0); /*!40000 ALTER TABLE `volumeConfig` ENABLE KEYS */; UNLOCK TABLES; + +-- +-- Dumping data for table `workCenter` +-- + +LOCK TABLES `workCenter` WRITE; +/*!40000 ALTER TABLE `workCenter` DISABLE KEYS */; +INSERT INTO `workCenter` VALUES (1,'Silla',20,859,1,'Av espioca 100',552703,NULL),(2,'Mercaflor',19,NULL,NULL,NULL,NULL,NULL),(3,'Marjales',26,20008,NULL,NULL,NULL,NULL),(4,'VNH',NULL,NULL,NULL,NULL,NULL,NULL),(5,'Madrid',28,2869,5,'Av constitución 3',554145,0.50),(6,'Vilassar',88,88038,NULL,'Cami del Crist, 33',556412,NULL),(7,'Tenerife',NULL,NULL,NULL,NULL,NULL,NULL),(8,'Silla-Agrario',26,NULL,NULL,NULL,NULL,NULL),(9,'Algemesi',20,1354,60,'Fenollars, 2',523549,NULL); +/*!40000 ALTER TABLE `workCenter` ENABLE KEYS */; +UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -472,18 +502,18 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 15:58:28 +-- Dump completed on 2023-02-20 14:45:54 USE `cache`; --- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.18-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: cache +-- Host: db-proxy.verdnatura.es Database: cache -- ------------------------------------------------------ --- Server version 5.6.25-4-log +-- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; +/*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; @@ -508,18 +538,18 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 15:58:28 +-- Dump completed on 2023-02-20 14:45:55 USE `hedera`; --- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.18-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: hedera +-- Host: db-proxy.verdnatura.es Database: hedera -- ------------------------------------------------------ --- Server version 5.6.25-4-log +-- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; +/*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; @@ -532,7 +562,7 @@ USE `hedera`; 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); +INSERT INTO `browser` VALUES ('Chrome',49),('Edge',79),('Firefox',69),('Opera',36),('Safari',11); /*!40000 ALTER TABLE `browser` ENABLE KEYS */; UNLOCK TABLES; @@ -552,7 +582,7 @@ UNLOCK TABLES; 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); +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),(16,1,500,500,1); /*!40000 ALTER TABLE `imageCollectionSize` ENABLE KEYS */; UNLOCK TABLES; @@ -572,7 +602,7 @@ UNLOCK TABLES; 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'); +INSERT INTO `link` VALUES (16,'Printing server','Manage the CUPS printing server','http://printnatura.verdnatura.es','printer'),(20,'Webmail','Verdnatura webmail','https://webmail.verdnatura.es/','mail'),(23,'Verdnatura Beta','Trial version of the web page','https://test-shop.verdnatura.es/','vn'),(25,'Shared folder','Shared folder','https://cdn.verdnatura.es/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','https://cdn.verdnatura.es/vn-access','access'),(37,'Jenkins','CI and CD system','https://jenkins.verdnatura.es','jenkins'),(38,'osTicket','User service center','https://cau.verdnatura.es','osticket'),(39,'Redmine','Flexible project management','https://redmine.verdnatura.es','redmine'),(40,'Grafana','Analytics & monitoring solution','https://grafana.verdnatura.es','grafana'),(41,'Rocket.Chat','Communications platform','https://chat.verdnatura.es','rocketchat'),(42,'Salix','ERP software','https://salix.verdnatura.es','salix'),(43,'Docker','Container management','https://docker.verdnatura.es','docker'),(44,'Proxmox','Virtual environment','https://proxmox.verdnatura.es','proxmox'),(45,'Shinobi','Network video recorder','https://shinobi.verdnatura.es','shinobi'),(46,'DokuWiki','Internal documentation','https://doku.verdnatura.es','dokuwiki'); /*!40000 ALTER TABLE `link` ENABLE KEYS */; UNLOCK TABLES; @@ -582,7 +612,7 @@ UNLOCK TABLES; 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'); +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','963 242 100',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; @@ -592,7 +622,7 @@ UNLOCK TABLES; 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); +INSERT INTO `menu` VALUES (1,'Home','cms/home',6,NULL,1),(2,'Orders',NULL,11,NULL,1),(3,'Catalog','ecomerce/catalog',6,NULL,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),(15,'Photos','admin/photos',1,7,3),(17,'Configuration',NULL,11,NULL,3),(19,'Control panel','admin/links',1,7,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),(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; @@ -632,7 +662,7 @@ UNLOCK TABLES; 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); +INSERT INTO `restPriv` VALUES (1,'tpv/transaction',2),(3,'image/upload',1),(5,'user/supplant',104),(10,'misc/captcha',NULL),(11,'core/log',NULL),(14,'core/query',NULL),(15,'user/recover-password',NULL),(16,'user/restore-password',NULL),(17,'dms/invoice',2),(18,'image/thumb',NULL),(19,'misc/contact',NULL),(20,'misc/production',NULL),(21,'tpv/confirm-post',NULL),(22,'tpv/confirm-soap',NULL),(23,'client/supplant',18),(24,'client/supplant',35); /*!40000 ALTER TABLE `restPriv` ENABLE KEYS */; UNLOCK TABLES; @@ -674,18 +704,18 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 15:58:28 +-- Dump completed on 2023-02-20 14:45:56 USE `postgresql`; --- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.18-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: postgresql +-- Host: db-proxy.verdnatura.es Database: postgresql -- ------------------------------------------------------ --- Server version 5.6.25-4-log +-- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; +/*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; @@ -741,16 +771,6 @@ LOCK TABLES `profile_type` WRITE; INSERT INTO `profile_type` VALUES (1,'Laboral'),(2,'Personal'),(3,'Cliente'),(4,'Proveedor'),(5,'Banco'),(6,'Patronal'); /*!40000 ALTER TABLE `profile_type` ENABLE KEYS */; UNLOCK TABLES; - --- --- Dumping data for table `workcenter` --- - -LOCK TABLES `workcenter` WRITE; -/*!40000 ALTER TABLE `workcenter` DISABLE KEYS */; -INSERT INTO `workcenter` VALUES (1,'Silla',20,NULL,1,'Av espioca 100',552703),(2,'Mercaflor',19,NULL,NULL,NULL,NULL),(3,'Marjales',26,20008,NULL,NULL,NULL),(4,'VNH',NULL,NULL,3,NULL,NULL),(5,'Madrid',28,2869,5,'Av constitución 3',554145),(6,'Vilassar',88,88038,2,'Cami del Crist, 33',556412),(7,'Tenerife',NULL,NULL,10,NULL,NULL),(8,NULL,NULL,NULL,NULL,NULL,NULL),(9,'Algemesi',20,1354,60,'Fenollars, 2',523549),(10,NULL,NULL,NULL,NULL,NULL,NULL); -/*!40000 ALTER TABLE `workcenter` ENABLE KEYS */; -UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -760,18 +780,18 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 15:58:28 +-- Dump completed on 2023-02-20 14:45:56 USE `sage`; --- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.18-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: db.verdnatura.es Database: sage +-- Host: db-proxy.verdnatura.es Database: sage -- ------------------------------------------------------ --- Server version 5.6.25-4-log +-- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; +/*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; @@ -784,7 +804,7 @@ USE `sage`; LOCK TABLES `TiposIva` WRITE; /*!40000 ALTER TABLE `TiposIva` DISABLE KEYS */; -INSERT INTO `TiposIva` VALUES (2,0,'Operaciones no sujetas',0.0000000000,0.0000000000,0.0000000000,'','4770000020','','','','','','','95B21A93-5910-489D-83BB-C32788C9B19D','','','','','','','','','',0,0),(4,0,'I.V.A. 4%',0.0000000000,4.0000000000,0.0000000000,'4720000004','4770000004','','6310000000','','','','','9E6160D5-984E-4643-ACBC-1EBC3BF73360','','','','','','','','','',0,0),(5,0,'I.V.A. 4% y R.E. 0.5%',0.0000000000,4.0000000000,0.5000000000,'','4770000504','4770000405','','','','','','DBEFA562-63FB-4FFC-8171-64F0C6F065FF','','','','','','','','','',0,0),(6,0,'H.P. IVA 4% CEE',0.0000000000,4.0000000000,0.0000000000,'4721000004','4771000004','','','','','','','DD0ECBA8-2EF5-425E-911B-623580BADA77','','','','','','','','','',0,1),(7,0,'H.P. IVA 10% CEE',0.0000000000,10.0000000000,0.0000000000,'4721000011','4771000010','','','','','','','593208CD-6F28-4489-B6EC-907AD689EAC9','','','','','','','','','',0,1),(8,0,'H.P. IVA 21% CEE',0.0000000000,21.0000000000,0.0000000000,'4721000021','4771000021','','','','','','','27061852-9BC1-4C4F-9B6E-69970E208F23','','','','','','','','','',0,1),(10,0,'I.V.A. 10% Nacional',0.0000000000,10.0000000000,0.0000000000,'4720000011','4770000010','','6290000553','','','','','828A9D6F-5C01-4C3A-918A-B2E4482830D3','','','','','','','','','',0,0),(11,0,'I.V.A. 10% y R.E. 1,4%',0.0000000000,10.0000000000,1.4000000000,'','4770000101','4770000110','','','','','','C1F2D910-83A1-4191-A76C-8B3D7AB98348','','','','','','','','','',0,0),(16,0,'I.V.A. Adqui. servicios CEE',0.0000000000,21.0000000000,0.0000000000,'4721000015','4771000016','','','','','','','E3EDE961-CE8F-41D4-9E6C-D8BCD32275A1','','','','','','','','','',0,1),(18,0,'H.P. Iva Importación 0% ISP',0.0000000000,0.0000000000,0.0000000000,'4720000005','4770000005','','','','','','','27AD4158-2349-49C2-B53A-A4E0EFAC5D09','','','','','','','','','',0,0),(20,0,'I.V.A 0% Nacional',0.0000000000,0.0000000000,0.0000000000,'4720000000','','','','','','','','B90B0FBD-E513-4F04-9721-C873504E08DF','','','','','','','','','',0,0),(21,0,'I.V.A. 21%',0.0000000000,21.0000000000,0.0000000000,'4720000021','4770000021','4770000000','','','','','','BA8C4E28-DCFA-4F7B-AE4F-CA044626B55E','','','','','','','','','',0,0),(22,0,'IVA 10% importaciones',0.0000000000,10.0000000000,0.0000000000,'4722000010','','','','','','','','540450A8-4B41-4607-96D1-E7F296FB6933','','','','','','','','','',0,0),(26,0,'I.V.A. 21% y R.E. 5,2%',0.0000000000,21.0000000000,5.2000000000,'4720000021','4770000215','4770000521','631000000','','','','','2BC0765F-7739-49AE-A5F0-28B648B81677','','','','','','','','','',0,0),(90,0,'IVA 21% importaciones',0.0000000000,21.0000000000,0.0000000000,'4722000021','','','','','','','','EB675F91-5FF2-4E26-A31E-EEB674125945','','','','','','','','','',0,0),(91,0,'IVA 0% importaciones',0.0000000000,0.0000000000,0.0000000000,'4723000000','','','','','','','','5E5EFA56-2A99-4D54-A16B-5D818274CA18','','','','','','','','','',0,0),(92,0,'8.5% comp. ganadera o pesquera',0.0000000000,8.5000000000,0.0000000000,'4720000000','4770000000','477000000','631000000','','','','','','','','','','','','','','',0,0),(93,0,'12% com. agrícola o forestal',0.0000000000,12.0000000000,0.0000000000,'4720000012','','','','','','','','267B1DDB-247F-4A71-AB95-3349FEFC5F92','','','','','','','','','',0,0),(94,0,'10,5% com. ganadera o pesquera',0.0000000000,10.5000000000,0.0000000000,'4770000000','4720000000','631000000','477000000','','','','','','','','','','','','','','',0,0),(108,0,'I.V.A. 8%',0.0000000000,8.0000000000,0.0000000000,'4720000000','4770000000','477000000','631000000','','','','','','','','','','','','','','',0,0),(109,0,'I.V.A. 8% y R.E. 1%',0.0000000000,8.0000000000,1.0000000000,'4720000000','4770000000','477000000','631000000','','','','','','','','','','','','','','',0,0),(110,0,'HP IVA Devengado Exento CEE',0.0000000000,0.0000000000,0.0000000000,'','4771000000','','','','','','','C605BC32-E161-42FD-83F3-3A66B1FBE399','','','','','','','','','',0,1),(111,0,'H.P. Iva Devengado Exento Ser',0.0000000000,0.0000000000,0.0000000000,'','4771000001','','','','','','','F1AEC4DC-AFE5-498E-A713-2648FFB6DA32','','','','','','','','','',0,0),(112,0,'H.P. IVA Devengado en exportac',0.0000000000,0.0000000000,0.0000000000,'','4770000002','','','','','','','F980AE74-BF75-4F4C-927F-0CCCE0DB8D15','','','','','','','','','',0,0),(113,0,'HP DEVENGADO 21 ISP ',0.0000000000,21.0000000000,0.0000000000,'4720000006','4770000006','','','','','','','728D7A76-E936-438C-AF05-3CA38FE16EA5','','','','','','','','','',0,0),(114,0,'HP.IVA NO DEDUCIBLE 10%',0.0000000000,0.0000000000,0.0000000000,'4720000026','','','','','','','','','','','','','','','','','',0,0),(115,0,'H.P. IVA Soportado Impor 4% ',0.0000000000,4.0000000000,0.0000000000,'4722000004','','','','','','','','','','','','','','','','','',0,0); +INSERT INTO `TiposIva` VALUES (2,0,'Operaciones no sujetas',0.0000000000,0.0000000000,0.0000000000,'','4770000020','','','','','','','95B21A93-5910-489D-83BB-C32788C9B19D','','','','','','','','','',0,0),(4,0,'I.V.A. 4%',0.0000000000,4.0000000000,0.0000000000,'4720000004','4770000004','','6310000000','','','','','9E6160D5-984E-4643-ACBC-1EBC3BF73360','','','','','','','','','',0,0),(5,0,'I.V.A. 4% y R.E. 0.5%',0.0000000000,4.0000000000,0.5000000000,'','4770000504','4770000405','','','','','','DBEFA562-63FB-4FFC-8171-64F0C6F065FF','','','','','','','','','',0,0),(6,0,'H.P. IVA 4% CEE',0.0000000000,4.0000000000,0.0000000000,'4721000004','4771000004','','','','','','','DD0ECBA8-2EF5-425E-911B-623580BADA77','','','','','','','','','',0,1),(7,0,'H.P. IVA 10% CEE',0.0000000000,10.0000000000,0.0000000000,'4721000011','4771000010','','','','','','','593208CD-6F28-4489-B6EC-907AD689EAC9','','','','','','','','','',0,1),(8,0,'H.P. IVA 21% CEE',0.0000000000,21.0000000000,0.0000000000,'4721000021','4771000021','','','','','','','27061852-9BC1-4C4F-9B6E-69970E208F23','','','','','','','','','',0,1),(10,0,'I.V.A. 10% Nacional',0.0000000000,10.0000000000,0.0000000000,'4720000011','4770000010','','6290000553','','','','','828A9D6F-5C01-4C3A-918A-B2E4482830D3','','','','','','','','','',0,0),(11,0,'I.V.A. 10% y R.E. 1,4%',0.0000000000,10.0000000000,1.4000000000,'','4770000101','4770000110','','','','','','C1F2D910-83A1-4191-A76C-8B3D7AB98348','','','','','','','','','',0,0),(16,0,'I.V.A. Adqui. servicios CEE',0.0000000000,21.0000000000,0.0000000000,'4721000015','4771000016','','','','','','','E3EDE961-CE8F-41D4-9E6C-D8BCD32275A1','','','','','','','','','',0,1),(18,0,'H.P. Iva Importación 0% ISP',0.0000000000,0.0000000000,0.0000000000,'4720000005','4770000005','','','','','','','27AD4158-2349-49C2-B53A-A4E0EFAC5D09','','','','','','','','','',0,0),(20,0,'I.V.A 0% Nacional',0.0000000000,0.0000000000,0.0000000000,'4720000000','','','','','','','','B90B0FBD-E513-4F04-9721-C873504E08DF','','','','','','','','','',0,0),(21,0,'I.V.A. 21%',0.0000000000,21.0000000000,0.0000000000,'4720000021','4770000021','4770000000','','','','','','BA8C4E28-DCFA-4F7B-AE4F-CA044626B55E','','','','','','','','','',0,0),(22,0,'IVA 10% importaciones',0.0000000000,10.0000000000,0.0000000000,'4722000010','','','','','','','','540450A8-4B41-4607-96D1-E7F296FB6933','','','','','','','','','',0,0),(26,0,'I.V.A. 21% y R.E. 5,2%',0.0000000000,21.0000000000,5.2000000000,'4720000021','4770000215','4770000521','631000000','','','','','2BC0765F-7739-49AE-A5F0-28B648B81677','','','','','','','','','',0,0),(90,0,'IVA 21% importaciones',0.0000000000,21.0000000000,0.0000000000,'4722000021','','','','','','','','EB675F91-5FF2-4E26-A31E-EEB674125945','','','','','','','','','',0,0),(91,0,'IVA 0% importaciones',0.0000000000,0.0000000000,0.0000000000,'4723000000','','','','','','','','5E5EFA56-2A99-4D54-A16B-5D818274CA18','','','','','','','','','',0,0),(92,0,'8.5% comp. ganadera o pesquera',0.0000000000,8.5000000000,0.0000000000,'4720000000','4770000000','477000000','631000000','','','','','','','','','','','','','','',0,0),(93,0,'12% com. agrícola o forestal',0.0000000000,12.0000000000,0.0000000000,'4720000012','','','','','','','','267B1DDB-247F-4A71-AB95-3349FEFC5F92','','','','','','','','','',0,0),(94,0,'10,5% com. ganadera o pesquera',0.0000000000,10.5000000000,0.0000000000,'4770000000','4720000000','631000000','477000000','','','','','','','','','','','','','','',0,0),(100,0,'HP IVA SOPORTADO 5%',0.0000000000,5.0000000000,0.0000000000,'4720000055','','','','','','','','3AD36CB2-4172-4CC9-9F87-2BF2B56AAC80','','','','','','','','','',0,0),(108,0,'I.V.A. 8%',0.0000000000,8.0000000000,0.0000000000,'4720000000','4770000000','477000000','631000000','','','','','','','','','','','','','','',0,0),(109,0,'I.V.A. 8% y R.E. 1%',0.0000000000,8.0000000000,1.0000000000,'4720000000','4770000000','477000000','631000000','','','','','','','','','','','','','','',0,0),(110,0,'HP IVA Devengado Exento CEE',0.0000000000,0.0000000000,0.0000000000,'','4771000000','','','','','','','C605BC32-E161-42FD-83F3-3A66B1FBE399','','','','','','','','','',0,1),(111,0,'H.P. Iva Devengado Exento Ser',0.0000000000,0.0000000000,0.0000000000,'','4771000001','','','','','','','F1AEC4DC-AFE5-498E-A713-2648FFB6DA32','','','','','','','','','',0,0),(112,0,'H.P. IVA Devengado en exportac',0.0000000000,0.0000000000,0.0000000000,'','4770000002','','','','','','','F980AE74-BF75-4F4C-927F-0CCCE0DB8D15','','','','','','','','','',0,0),(113,0,'HP DEVENGADO 21 ISP ',0.0000000000,21.0000000000,0.0000000000,'4720000006','4770000006','','','','','','','728D7A76-E936-438C-AF05-3CA38FE16EA5','','','','','','','','','',0,0),(114,0,'HP.IVA NO DEDUCIBLE 10%',0.0000000000,0.0000000000,0.0000000000,'4720000026','','','','','','','','','','','','','','','','','',0,0),(115,0,'H.P. IVA Soportado Impor 4% ',0.0000000000,4.0000000000,0.0000000000,'4722000004','','','','','','','','','','','','','','','','','',0,0); /*!40000 ALTER TABLE `TiposIva` ENABLE KEYS */; UNLOCK TABLES; @@ -816,4 +836,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 15:58:29 +-- Dump completed on 2023-02-20 14:45:57 diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 29d57073c..9006c6676 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1,19 +1,49 @@ CREATE SCHEMA IF NOT EXISTS `vn2008`; CREATE SCHEMA IF NOT EXISTS `tmp`; -UPDATE `util`.`config` - SET `environment`= 'test'; +UPDATE `util`.`config` + SET `environment`= 'development'; + +-- FOR MOCK vn.time + +DROP PROCEDURE IF EXISTS `vn`.`mockVnTime`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`mockVnTime`() +BEGIN + + DECLARE vDate DATE; + SET vDate = '2000-01-01'; + + WHILE ( YEAR(vDate) <= 2002 ) DO + INSERT IGNORE INTO vn.`time` (dated, period, `month`, `year`, `day`, week, yearMonth, salesYear) + VALUES (vDate, CONCAT(YEAR(vDate), (WEEK(vDate)+1)), MONTH(vDate), YEAR(vDate), DAY(vDate), WEEK(vDate)+1, CONCAT(YEAR(vDate), MONTH(vDate)), YEAR(vDate)); + + SET vDate = DATE_ADD(vDate, INTERVAL 1 DAY); + END WHILE; + +END$$ +DELIMITER ; + +CALL `vn`.`mockVnTime`(); +DROP PROCEDURE IF EXISTS `vn`.`mockVnTime`; +-- END MOCK vn.time ALTER TABLE `vn`.`itemTaxCountry` AUTO_INCREMENT = 1; ALTER TABLE `vn`.`address` AUTO_INCREMENT = 1; ALTER TABLE `vn`.`zoneGeo` AUTO_INCREMENT = 1; ALTER TABLE `vn`.`ticket` AUTO_INCREMENT = 1; -INSERT INTO `salix`.`AccessToken` (`id`, `ttl`, `created`, `userId`) - VALUES +INSERT INTO `salix`.`AccessToken` (`id`, `ttl`, `created`, `userId`) + VALUES ('DEFAULT_TOKEN', '1209600', util.VN_CURDATE(), 66); -INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`) +INSERT INTO `salix`.`printConfig` (`id`, `itRecipient`, `incidencesEmail`) + VALUES + (1, 'it@gotamcity.com', 'incidences@gotamcity.com'); + +INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`) VALUES ('1', '6'); @@ -22,11 +52,11 @@ INSERT INTO `vn`.`bionicConfig` (`generalInflationCoeficient`, `minimumDensityVo (1.30, 167.00, 138000, 71); INSERT INTO `vn`.`chatConfig` (`host`, `api`) - VALUES + VALUES ('https://chat.verdnatura.es', 'https://chat.verdnatura.es/api/v1'); -INSERT IGNORE INTO `vn`.`greugeConfig`(`id`, `freightPickUpPrice`) - VALUES +INSERT IGNORE INTO `vn`.`greugeConfig`(`id`, `freightPickUpPrice`) + VALUES ('1', '11'); INSERT INTO `vn`.`packagingConfig`(`upperGap`) @@ -41,8 +71,8 @@ INSERT INTO `account`.`roleConfig`(`id`, `mysqlPassword`, `rolePrefix`, `userPre CALL `account`.`role_sync`; -INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`, `lang`, `image`) - SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com'), 'en', '4fa3ada0-3ac4-11eb-9ab8-27f6fc3b85fd' +INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`, `lang`, `image`, `bcryptPassword`) + SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com'), 'en', '4fa3ada0-3ac4-11eb-9ab8-27f6fc3b85fd', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2' FROM `account`.`role` WHERE id <> 20 ORDER BY id; @@ -52,11 +82,11 @@ INSERT INTO `account`.`account`(`id`) INSERT INTO `vn`.`educationLevel` (`id`, `name`) VALUES (1, 'ESTUDIOS PRIMARIOS COMPLETOS'), - (2, 'ENSEÑANZAS DE BACHILLERATO'); + (2, 'ENSEÑANZAS DE BACHILLERATO'); INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `userFk`, `bossFk`) SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id, 9 - FROM `vn`.`user`; + FROM `account`.`user`; UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20; UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9; @@ -69,7 +99,7 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType` (1, 978, 1, 0, 2000, 9, 0); INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`, `image`) - VALUES + VALUES (1101, 'BruceWayne', 'Bruce Wayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'), (1102, 'PetterParker', 'Petter Parker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'), (1103, 'ClarkKent', 'Clark Kent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr', 'e7723f0b24ff05b32ed09d95196f2f29'), @@ -101,20 +131,8 @@ INSERT INTO `account`.`mailForward`(`account`, `forwardTo`) VALUES (1, 'employee@domain.local'); -INSERT INTO `vn`.`printer` (`id`, `name`, `path`, `isLabeler`) - VALUES - (1, 'printer1', 'path1', 0), - (2, 'printer2', 'path2', 1); -INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`, `sectorFk`, `labelerFk`) - VALUES - (1106, 'LGN', 'David Charles', 'Haller', 1106, 19, 432978106, NULL, NULL), - (1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107, NULL, 1), - (1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108, 1, NULL), - (1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109, 1, 2), - (1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110, 2, 1); - INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`) VALUES (1, 'EUR', 'Euro', 1), @@ -122,50 +140,85 @@ INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`) (3, 'GBP', 'Libra', 1), (4, 'JPY', 'Yen Japones', 1); -INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`) - VALUES - (1, 'España', 1, 'ES', 1, 24, 4, 0, 1), - (2, 'Italia', 1, 'IT', 1, 27, 4, 0, 1), - (3, 'Alemania', 1, 'DE', 1, 22, 4, 0, 1), - (4, 'Rumania', 1, 'RO', 1, 24, 4, 0, 1), - (5, 'Holanda', 1, 'NL', 1, 18, 4, 0, 1), - (8, 'Portugal', 1, 'PT', 1, 27, 4, 0, 1), - (13,'Ecuador', 0, 'EC', 1, 24, 2, 1, 2), - (19,'Francia', 1, 'FR', 1, 27, 4, 0, 1), - (30,'Canarias', 1, 'IC', 1, 24, 4, 1, 2); +INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`, `politicalCountryFk`) + VALUES + (1, 'España', 1, 'ES', 1, 24, 4, 0, 1, 1), + (2, 'Italia', 1, 'IT', 1, 27, 4, 0, 1, 2), + (3, 'Alemania', 1, 'DE', 1, 22, 4, 0, 1, 3), + (4, 'Rumania', 1, 'RO', 1, 24, 4, 0, 1, 4), + (5, 'Holanda', 1, 'NL', 1, 18, 4, 0, 1, 5), + (8, 'Portugal', 1, 'PT', 1, 27, 4, 0, 1, 8), + (13,'Ecuador', 0, 'EC', 1, 24, 2, 1, 2, 13), + (19,'Francia', 1, 'FR', 1, 27, 4, 0, 1, 19), + (30,'Canarias', 1, 'IC', 1, 24, 4, 1, 2, 30); INSERT INTO `vn`.`warehouseAlias`(`id`, `name`) VALUES (1, 'Main Warehouse'), - (2, 'Silla'); + (2, 'Gotham'); -INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasStowaway`, `hasDms`, `hasComission`, `aliasFk`, `countryFk`, `hasProduction`) +INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasDms`, `hasComission`, `aliasFk`, `countryFk`, `hasProduction`) VALUES - (1, 'Warehouse One', 'ALG', 1, 1, 1, 1, 1, 1, 1, 2, 1, 1), - (2, 'Warehouse Two', NULL, 1, 1, 1, 1, 0, 0, 1, 2, 13, 1), - (3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 0, 2, 1, 1), - (4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 0, 2, 1, 1), - (5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 0, 2, 1, 1), - (13, 'Inventory', NULL, 1, 1, 1, 0, 0, 0, 0, 2, 1, 0); + (1, 'Warehouse One', 'ALG', 1, 1, 1, 1, 1, 1, 2, 1, 1), + (2, 'Warehouse Two', NULL, 1, 1, 1, 1, 0, 1, 2, 13, 1), + (3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1), + (4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1), + (5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1), + (13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 2, 1, 0), + (60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 2, 1, 0); -INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPreparedByPacking`, `code`, `pickingPlacement`, `path`) + +INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPreparedByPacking`, `code`) VALUES - (1, 'First sector', 1, 1, 'FIRST', 999, 999), - (2, 'Second sector', 2, 0, 'SECOND', 100, 150); + (1, 'First sector', 1, 1, 'FIRST'), + (2, 'Second sector', 2, 0, 'SECOND'); -INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`) - VALUES - ('1', '700', '01', '1', '700-01', '70001'), - ('2', '700', '02', '2', '700-02', '70002'); +INSERT INTO `vn`.`operator` (`workerFk`, `numberOfWagons`, `trainFk`, `itemPackingTypeFk`, `warehouseFk`, `sectorFk`, `labelerFk`) + VALUES ('1106', '1', '1', 'H', '1', '1', '1'), + ('1107', '1', '1', 'V', '1', '2', '1'); -INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `parked`, `userFk`) - VALUES - ('GVC', 1, 0, 1, 0, 1106), - ('HEJ', 2, 0, 1, 0, 1106), - ('UXN', 1, 0, 1, 0, 1106); +INSERT INTO `vn`.`printer` (`id`, `name`, `path`, `isLabeler`, `sectorFk`, `ipAddress`) + VALUES + (1, 'printer1', 'path1', 0, 1 , NULL), + (2, 'printer2', 'path2', 1, 1 , NULL), + (4, 'printer4', 'path4', 0, NULL, '10.1.10.4'); + +INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`, `sectorFk`, `labelerFk`) + VALUES + (1106, 'LGN', 'David Charles', 'Haller', 1106, 19, 432978106, NULL, NULL), + (1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107, NULL, NULL), + (1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108, 1, NULL), + (1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109, 1, NULL), + (1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110, 2, NULL); + +INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`) + VALUES + ('1', 700, '01', 1, '700-01', 70001), + ('2', 700, '02', 2, '700-02', 70002), + ('3', 100, '01', 1, '100-01', 1), + (32397, 100, '02', 1, 'A-47-1', 1165), + (34831, 200, '01', 1, 'K-26-2', 20220), + (34965, 200, '02', 2, 'L-08-4', 21800), + (39096, 200, '03', 2, 'LR-02-3', 99999); + +INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `userFk`, `isRecyclable`) + VALUES + ('AA6', 34965, 1, 0, NULL, 0), + ('AA7', 34965, 1, 0, NULL, 0), + ('AA8', 34965, 1, 0, NULL, 0), + ('AA9', NULL, 1, 0, NULL, 0), + ('AAA', NULL, 0, 0, 1109, 1), + ('AAB', NULL, 0, 0, 1109, 1), + ('AAC', NULL, 1, 99, 1109, 1), + ('AAD', NULL, 0, 0, 1109, 1), + ('AAE', 39096, 1, 0, 1109, 1), + ('AAF', 34831, 1, 0, 1109, 1), + ('GVC', 1, 0, 1, 1106, 1), + ('HEJ', 2, 0, 1, 1106, 1), + ('UXN', 1, 0, 1, 1106, 1); INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`, `maxAmount`, `daysInFuture`) - VALUES + VALUES (1, 'CC and credit policies', 'Transfers', 'wireTransfer', NULL, 1), (2, 'Cash', 'Cash', 'cash', 1000, 0), (3, 'Credit card', 'Credit Card', 'creditCard', NULL, 0), @@ -174,15 +227,19 @@ INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`cod (6, 'Loans', NULL, NULL, NULL, 0), (7, 'Leasing', NULL, NULL, NULL, 0), (8, 'Compensations', 'Compensations', 'compensation', NULL, 0); - -INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`) - VALUES - (1, 'Pay on receipt', '5720000001', 3, 0, 1, 1), - (2, 'Cash', '5700000001', 2, 0, 1, 1), - (3, 'Compensation', '4000000000', 8, 0, 1, 1), - (4, 'Transfers', '4000000001', 1, 0, 1, 1), - (3117, 'Caixa Rural d''Algemesi', '5720000000', 8, 3117, 1, 1); +INSERT INTO `vn`.`bankEntity`(`id`, `countryFk`, `name`, `bic`) + VALUES + (128, 1, 'The Best Bank', 'BBKKESMMMMMM'), + (2100, 1, 'Caixa Bank', 'CAIXESBB'); + +INSERT INTO `vn`.`accounting`(`id`, `bank`, `account`, `accountingTypeFk`, `entityFk`, `isActive`, `currencyFk`, `code`) + VALUES + (1, 'Pay on receipt', '5720000001', 3, 128, 1, 1, 'payOnReceipt'), + (2, 'Cash', '5700000001', 2, 128, 1, 1, 'cash'), + (3, 'Compensation', '4000000000', 8, 128, 1, 1, 'compensation'), + (4, 'Transfers', '4000000001', 1, 128, 1, 1, 'transfers'), + (3117, 'Caixa Rural d''Algemesi', '5720000000', 8, 2100, 1, 1, 'cra'); INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`) VALUES @@ -191,18 +248,18 @@ INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`) (3, 'PICKUP', 'Recogida'), (4, 'OTHER', 'Otros'); -INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `isVolumetric`, `bankFk`, `warehouseAliasFk`) +INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `warehouseAliasFk`) VALUES - (1, 'inhouse pickup' , 1, 0, 1, 1), - (2, 'Super-Man delivery' , 1, 0, 1, 1), - (3, 'Teleportation device' , 1, 0, 1, 1), - (4, 'Entanglement' , 1, 0, 1, 1), - (5, 'Quantum break device' , 1, 0, 1, 1), - (6, 'Walking' , 1, 0, 1, 1), - (7, 'Silla247' , 1, 0, 1, 1), - (8, 'Silla247Expensive' , 1, 0, 1, 1), - (9, 'Refund' , 1, 0, 1, 1), - (10, 'Other agency' , 1, 0, 1, 1); + (1, 'inhouse pickup' , 1, 1), + (2, 'Super-Man delivery' , 1, 1), + (3, 'Teleportation device' , 1, 1), + (4, 'Entanglement' , 1, 1), + (5, 'Quantum break device' , 1, 1), + (6, 'Walking' , 1, 1), + (7, 'Gotham247' , 1, 1), + (8, 'Gotham247Expensive' , 1, 1), + (9, 'Refund' , 1, 1), + (10, 'Other agency' , 1, 1); UPDATE `vn`.`agencyMode` SET `id` = 1 WHERE `name` = 'inhouse pickup'; UPDATE `vn`.`agencyMode` SET `id` = 2 WHERE `name` = 'Super-Man delivery'; @@ -210,8 +267,8 @@ UPDATE `vn`.`agencyMode` SET `id` = 3 WHERE `name` = 'Teleportation device'; UPDATE `vn`.`agencyMode` SET `id` = 4 WHERE `name` = 'Entanglement'; UPDATE `vn`.`agencyMode` SET `id` = 5 WHERE `name` = 'Quantum break device'; UPDATE `vn`.`agencyMode` SET `id` = 6 WHERE `name` = 'Walking'; -UPDATE `vn`.`agencyMode` SET `id` = 7 WHERE `name` = 'Silla247'; -UPDATE `vn`.`agencyMode` SET `id` = 8 WHERE `name` = 'Silla247Expensive'; +UPDATE `vn`.`agencyMode` SET `id` = 7 WHERE `name` = 'Gotham247'; +UPDATE `vn`.`agencyMode` SET `id` = 8 WHERE `name` = 'Gotham247Expensive'; UPDATE `vn`.`agencyMode` SET `id` = 23 WHERE `name` = 'Refund'; UPDATE `vn`.`agencyMode` SET `id` = 10 WHERE `name` = 'Other agency'; @@ -231,7 +288,7 @@ UPDATE `vn`.`agencyMode` SET `web` = 1, `reportMail` = 'no-reply@gothamcity.com' UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23; INSERT INTO `vn`.`payMethod`(`id`,`code`, `name`, `graceDays`, `outstandingDebt`, `isIbanRequiredForClients`, `isIbanRequiredForSuppliers`, `hasVerified`) - VALUES + VALUES (1, NULL, 'PayMethod one', 0, 001, 0, 0, 0), (2, NULL, 'PayMethod two', 10, 001, 0, 0, 1), (3, 'compensation', 'PayMethod three', 0, 001, 0, 0, 0), @@ -240,9 +297,10 @@ INSERT INTO `vn`.`payMethod`(`id`,`code`, `name`, `graceDays`, `outstandingDebt (8,'wireTransfer', 'WireTransfer', 5, 001, 1, 1, 0); INSERT INTO `vn`.`payDem`(`id`, `payDem`) - VALUES + VALUES (1, 10), - (2, 20); + (2, 20), + (7, 0); INSERT INTO `vn`.`autonomy`(`id`, `name`, `countryFk`) VALUES @@ -263,13 +321,13 @@ INSERT INTO `vn`.`province`(`id`, `name`, `countryFk`, `autonomyFk`, `warehouseF INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`) VALUES (1, 'Valencia', 1), - (2, 'Silla', 1), + (2, 'Gotham', 1), (3, 'Algemesi', 1), (4, 'Alzira', 1), (5, 'Quito', 5); INSERT INTO `vn`.`postCode`(`code`, `townFk`, `geoFk`) - VALUES + VALUES ('46000', 1, 6), ('46460', 2, 6), ('46680', 3, 6), @@ -297,21 +355,21 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`) INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`) VALUES - (1101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street, Queens, USA', 'Silla', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street, Apartament 3-D', 'Silla', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point, 90265', 'Silla', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'), - (1106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'City of New York, New York, USA', 'Silla', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'), - (1107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill, San Francisco, California', 'Silla', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'), - (1108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist'), - (1109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist'), - (1110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist'), - (1111, 'Missing', NULL, 'Missing man', 'Anton', 'The space, Universe far away', 'Silla', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, NULL), - (1112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city, Underground', 'Silla', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, NULL); + (1101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street, Queens, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street, Apartament 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'), + (1106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'City of New York, New York, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'), + (1107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill, San Francisco, California', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'), + (1108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist'), + (1109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist'), + (1110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist'), + (1111, 'Missing', NULL, 'Missing man', 'Anton', 'The space, Universe far away', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'), + (1112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city, Underground', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'); INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`) - SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'SILLA', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1 + SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1 FROM `account`.`role` `r` WHERE `r`.`hasLogin` = 1; @@ -328,51 +386,51 @@ INSERT INTO `vn`.`clientConfig`(`riskTolerance`, `maxCreditRows`) INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`, `isDefaultAddress`) VALUES - (1, 'Bruce Wayne', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1101, 2, NULL, NULL, 0, 1), - (2, 'Petter Parker', '20 Ingram Street', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1102, 2, NULL, NULL, 0, 1), - (3, 'Clark Kent', '344 Clinton Street', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1103, 2, NULL, NULL, 0, 1), - (4, 'Tony Stark', '10880 Malibu Point', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1104, 2, NULL, NULL, 0, 1), - (5, 'Max Eisenhardt', 'Unknown Whereabouts', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1105, 2, NULL, NULL, 0, 1), - (6, 'DavidCharlesHaller', 'Evil hideout', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1106, 2, NULL, NULL, 0, 1), - (7, 'Hank Pym', 'Anthill', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1107, 2, NULL, NULL, 0, 1), - (8, 'Charles Xavier', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 1), - (9, 'Bruce Banner', 'Somewhere in New York', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 1), - (10, 'Jessica Jones', 'NYCC 2015 Poster', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1110, 2, NULL, NULL, 0, 1), - (11, 'Missing', 'The space', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1111, 10, NULL, NULL, 0, 1), - (12, 'Trash', 'New York city', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1112, 10, NULL, NULL, 0, 1), - (101, 'Somewhere in Thailand', 'address 01', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), - (102, 'Somewhere in Poland', 'address 02', 'Silla', 46460, 1, 3333333333, 444444444, 1, 1109, 2, NULL, NULL, 0, 0), - (103, 'Somewhere in Japan', 'address 03', 'Silla', 46460, 1, 3333333333, 444444444, 1, 1109, 2, NULL, NULL, 0, 0), - (104, 'Somewhere in Spain', 'address 04', 'Silla', 46460, 1, 3333333333, 444444444, 1, 1109, 2, NULL, NULL, 0, 0), - (105, 'Somewhere in Potugal', 'address 05', 'Silla', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0), - (106, 'Somewhere in UK', 'address 06', 'Silla', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0), - (107, 'Somewhere in Valencia', 'address 07', 'Silla', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0), - (108, 'Somewhere in Silla', 'address 08', 'Silla', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0), - (109, 'Somewhere in London', 'address 09', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), - (110, 'Somewhere in Algemesi', 'address 10', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), - (111, 'Somewhere in Carlet', 'address 11', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), - (112, 'Somewhere in Campanar', 'address 12', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), - (113, 'Somewhere in Malilla', 'address 13', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), - (114, 'Somewhere in France', 'address 14', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), - (115, 'Somewhere in Birmingham', 'address 15', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), - (116, 'Somewhere in Scotland', 'address 16', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), - (117, 'Somewhere in util.VN_NOWhere', 'address 17', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), - (118, 'Somewhere over the rainbow', 'address 18', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), - (119, 'Somewhere in Alberic', 'address 19', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), - (120, 'Somewhere in Montortal', 'address 20', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), - (121, 'the bat cave', 'address 21', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1101, 2, NULL, NULL, 0, 0), - (122, 'NY roofs', 'address 22', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1102, 2, NULL, NULL, 0, 0), - (123, 'The phone box', 'address 23', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1103, 2, NULL, NULL, 0, 0), - (124, 'Stark tower Silla', 'address 24', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1104, 2, NULL, NULL, 0, 0), - (125, 'The plastic cell', 'address 25', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1105, 2, NULL, NULL, 0, 0), - (126, 'Many places', 'address 26', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1106, 2, NULL, NULL, 0, 0), - (127, 'Your pocket', 'address 27', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1107, 2, NULL, NULL, 0, 0), - (128, 'Cerebro', 'address 28', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 0), - (129, 'Luke Cages Bar', 'address 29', 'Silla', 46460, 1, 1111111111, 222222222, 1, 1110, 2, NULL, NULL, 0, 0), - (130, 'Non valid address', 'address 30', 'Silla', 46460, 1, 1111111111, 222222222, 0, 1101, 2, NULL, NULL, 0, 0); + (1, 'Bruce Wayne', '1007 Mountain Drive, Gotham', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1101, 2, NULL, NULL, 0, 1), + (2, 'Petter Parker', '20 Ingram Street', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1102, 2, NULL, NULL, 0, 1), + (3, 'Clark Kent', '344 Clinton Street', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1103, 2, NULL, NULL, 0, 1), + (4, 'Tony Stark', '10880 Malibu Point', 'Gotham', 46460, 1, 1111111111, 222222222, 1 , 1104, 2, NULL, NULL, 0, 1), + (5, 'Max Eisenhardt', 'Unknown Whereabouts', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1105, 2, NULL, NULL, 0, 1), + (6, 'DavidCharlesHaller', 'Evil hideout', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1106, 2, NULL, NULL, 0, 1), + (7, 'Hank Pym', 'Anthill', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1107, 2, NULL, NULL, 0, 1), + (8, 'Charles Xavier', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 1), + (9, 'Bruce Banner', 'Somewhere in New York', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 1), + (10, 'Jessica Jones', 'NYCC 2015 Poster', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1110, 2, NULL, NULL, 0, 1), + (11, 'Missing', 'The space', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1111, 10, NULL, NULL, 0, 1), + (12, 'Trash', 'New York city', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1112, 10, NULL, NULL, 0, 1), + (101, 'Somewhere in Thailand', 'address 01', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), + (102, 'Somewhere in Poland', 'address 02', 'Gotham', 46460, 1, 3333333333, 444444444, 1, 1109, 2, NULL, NULL, 0, 0), + (103, 'Somewhere in Japan', 'address 03', 'Gotham', 46460, 1, 3333333333, 444444444, 1, 1109, 2, NULL, NULL, 0, 0), + (104, 'Somewhere in Spain', 'address 04', 'Gotham', 46460, 1, 3333333333, 444444444, 1, 1109, 2, NULL, NULL, 0, 0), + (105, 'Somewhere in Potugal', 'address 05', 'Gotham', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0), + (106, 'Somewhere in UK', 'address 06', 'Gotham', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0), + (107, 'Somewhere in Valencia', 'address 07', 'Gotham', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0), + (108, 'Somewhere in Gotham', 'address 08', 'Gotham', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0), + (109, 'Somewhere in London', 'address 09', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), + (110, 'Somewhere in Algemesi', 'address 10', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), + (111, 'Somewhere in Carlet', 'address 11', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), + (112, 'Somewhere in Campanar', 'address 12', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), + (113, 'Somewhere in Malilla', 'address 13', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), + (114, 'Somewhere in France', 'address 14', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), + (115, 'Somewhere in Birmingham', 'address 15', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), + (116, 'Somewhere in Scotland', 'address 16', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), + (117, 'Somewhere in nowhere', 'address 17', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), + (118, 'Somewhere over the rainbow', 'address 18', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), + (119, 'Somewhere in Alberic', 'address 19', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), + (120, 'Somewhere in Montortal', 'address 20', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0), + (121, 'the bat cave', 'address 21', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1101, 2, NULL, NULL, 0, 0), + (122, 'NY roofs', 'address 22', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1102, 2, NULL, NULL, 0, 0), + (123, 'The phone box', 'address 23', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1103, 2, NULL, NULL, 0, 0), + (124, 'Stark tower Gotham', 'address 24', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1104, 2, NULL, NULL, 0, 0), + (125, 'The plastic cell', 'address 25', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1105, 2, NULL, NULL, 0, 0), + (126, 'Many places', 'address 26', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1106, 2, NULL, NULL, 0, 0), + (127, 'Your pocket', 'address 27', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1107, 2, NULL, NULL, 0, 0), + (128, 'Cerebro', 'address 28', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 0), + (129, 'Luke Cages Bar', 'address 29', 'Gotham', 'EC170150', 1, 1111111111, 222222222, 1, 1110, 2, NULL, NULL, 0, 0), + (130, 'Non valid address', 'address 30', 'Gotham', 46460, 1, 1111111111, 222222222, 0, 1101, 2, NULL, NULL, 0, 0); INSERT INTO `vn`.`address`( `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `isActive`, `clientFk`, `agencyModeFk`, `isDefaultAddress`) - SELECT name, CONCAT(name, 'Street'), 'SILLA', 46460, 1, 1, id, 2, 1 + SELECT name, CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, 1, id, 2, 1 FROM `account`.`role` `r` WHERE `r`.`hasLogin` = 1; @@ -443,7 +501,8 @@ INSERT INTO `vn`.`observationType`(`id`,`description`, `code`) (3, 'Delivery', 'delivery'), (4, 'SalesPerson', 'salesPerson'), (5, 'Administrative', 'administrative'), - (6, 'Weight', 'weight'); + (6, 'Weight', 'weight'), + (7, 'InvoiceOut', 'invoiceOut'); INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`) VALUES @@ -470,11 +529,35 @@ INSERT INTO `vn`.`companyGroup`(`id`, `code`) VALUES (1, 'wayneIndustries'), (2, 'verdnatura'); - -INSERT INTO `vn`.`bankEntity`(`id`, `countryFk`, `name`, `bic`) + +INSERT INTO `vn`.`supplierActivity`(`code`, `name`) VALUES - (128, 1, 'The Best Bank', 'BBKKESMMMMMM'), - (2100, 1, 'Caixa Bank', 'CAIXESBB'); + ('animals', 'Food and complements for pets'), + ('complements', 'Other complements'), + ('flowerPlants', 'Wholesale of flowers and plants'), + ('vegetablesFruits', 'Fruit and vegetable trade'); + +INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`) + VALUES + (1, 1, 'Ace Chemicals', 'The Midtown', 1, '46000', 'Gotham', '111111111', '222222222'), + (2, 1, 'Arkham Asylum', 'Grand Avenue', 1, '46000', 'Gotham', '111111111', '222222222'), + (3, 2, 'Wayne Tower', 'Grand Avenue', 1, '46000', 'Gotham', '111111111', '222222222'), + (4, 2, 'Bank of Gotham', 'Founders Island', 1, '46000', 'Gotham', '111111111', '222222222'), + (5, 442, 'GCR building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222'), + (6, 442, 'The Gotham Tonight building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222'); + +INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`) + VALUES + (1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), + (2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), + (442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'); + +INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`) + VALUES + (1, 1, 123121212, 654789123, 'supplier1@email.es', 'observation1', 'the boss'), + (2, 1, 987456132, NULL, NULL, NULL, 'the salesperson'), + (3, 2, 321654987, NULL, 'supplier2@email.es', NULL, NULL), + (4, 442, 321654987, NULL, NULL, 'observation442', NULL); INSERT INTO `vn`.`supplierAccount`(`id`, `supplierFk`, `iban`, `bankEntityFk`) VALUES @@ -486,7 +569,7 @@ INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, (442 , 'VNL', 241, 30, 2 , 1, NULL, 2, 'VNL Company - Plant passport'), (567 , 'VNH', NULL, 30, NULL, 4, NULL, 1, 'VNH Company - Plant passport'), (791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30', 1, NULL), - (1381, 'ORN', NULL, 30, NULL, 7, NULL, 1, 'ORN Company - Plant passport'); + (1381, 'ORN', NULL, 30, NULL, 7, NULL, 1, 'ORN Company - Plant passport'); INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`) VALUES @@ -495,19 +578,18 @@ INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion` ('NATIONAL', 0, 1), ('WORLD', 2, 15); -INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaFk`, `isCEE`) +INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaFk`, `isCEE`, `type`) VALUES - ('A', 'Global nacional', 1, 'NATIONAL', 0), - ('T', 'Española rapida', 1, 'NATIONAL', 0), - ('V', 'Intracomunitaria global', 0, 'CEE', 1), - ('M', 'Múltiple nacional', 1, 'NATIONAL', 0), - ('E', 'Exportación rápida', 0, 'WORLD', 0); -; + ('A', 'Global nacional', 1, 'NATIONAL', 0, 'global'), + ('T', 'Española rapida', 1, 'NATIONAL', 0, 'quick'), + ('V', 'Intracomunitaria global', 0, 'CEE', 1, 'global'), + ('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'quick'), + ('E', 'Exportación rápida', 0, 'WORLD', 0, 'quick'); INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`) VALUES (1, 'T', 1014.24, util.VN_CURDATE(), 1101, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), - (2, 'T', 121.36, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), + (2, 'T', 121.36, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), (3, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), (4, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), (5, 'A', 8.88, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 0); @@ -519,7 +601,7 @@ UPDATE `vn`.`invoiceOut` SET ref = 'T4444444' WHERE id = 4; UPDATE `vn`.`invoiceOut` SET ref = 'A1111111' WHERE id = 5; INSERT INTO `vn`.`invoiceOutTax` (`invoiceOutFk`, `taxableBase`, `vat`, `pgcFk`) - VALUES + VALUES (1, 895.76, 89.58, 4722000010), (1, 33.80, 7.10, 4722000021), (2, 110.33, 11.03, 4770000010), @@ -527,20 +609,18 @@ INSERT INTO `vn`.`invoiceOutTax` (`invoiceOutFk`, `taxableBase`, `vat`, `pgcFk`) (4, 8.07, 0.81, 4770000010), (5, 8.07, 0.81, 4770000010); -INSERT INTO `vn`.`expence`(`id`, `taxTypeFk`, `name`, `isWithheld`) +INSERT INTO `vn`.`expence`(`id`, `name`, `isWithheld`) VALUES - (2000000000, 1, 'Inmovilizado pendiente', 0), - (2000000000, 3, 'Compra de bienes de inmovilizado', 0), - (4751000000, 0, 'Retenciones', 1), - (4751000000, 1, 'Retenciones', 1), - (4751000000, 6, 'Retencion', 0), - (6210000567, 0, 'Alquiler VNH', 0), - (6240000000, 1, 'Transportes de ventas rutas', 0), - (6240000000, 4, 'Transportes de ventas rutas', 0), - (7001000000, 1, 'Mercaderia', 0), - (7050000000, 1, 'Prestacion de servicios', 1); + (2000000000, 'Inmovilizado pendiente', 0), + (2000000001, 'Compra de bienes de inmovilizado', 0), + (4751000000, 'Retenciones', 1), + (4751000001, 'Retencion', 0), + (6210000567, 'Alquiler VNH', 0), + (6240000000, 'Transportes de ventas rutas', 0), + (7001000000, 'Mercaderia', 0), + (7050000000, 'Prestacion de servicios', 1); + - INSERT INTO `vn`.`invoiceOutExpence`(`id`, `invoiceOutFk`, `amount`, `expenceFk`, `created`) VALUES (1, 1, 813.06, 2000000000, util.VN_CURDATE()), @@ -552,7 +632,7 @@ INSERT INTO `vn`.`invoiceOutExpence`(`id`, `invoiceOutFk`, `amount`, `expenceFk` (7, 5, 8.07, 2000000000, util.VN_CURDATE()); INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, `price`, `bonus`, `itemMaxSize`) - VALUES + VALUES (1, 'Zone pickup A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100), (2, 'Zone pickup B', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100), (3, 'Zone 247 A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 7, 1, 2, 0, 100), @@ -568,7 +648,7 @@ INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, (13, 'Zone quantum break', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 5, 0, 0, 0, 100); INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`) - VALUES + VALUES (1, 1, 1), (2, 2, 2), (3, 3, 1), @@ -584,7 +664,7 @@ INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`) (13, 13, 5); INSERT INTO `vn`.`zoneClosure` (`zoneFk`, `dated`, `hour`) - VALUES + VALUES (1, util.VN_CURDATE(), '23:59'), (2, util.VN_CURDATE(), '23:59'), (3, util.VN_CURDATE(), '23:59'), @@ -639,7 +719,12 @@ INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeF (24 ,NULL, 8, 1, 7, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, util.VN_CURDATE()), (25 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE()), (26 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE()), - (27 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE()); + (27 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE()), + (28, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()), + (29, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()), + (30, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()), + (31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()), + (32, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()); INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`) VALUES @@ -654,10 +739,12 @@ INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `des (9, 23, 5, 'care with the dog'), (10, 23, 4, 'Reclama ticket: 8'), (11, 24, 4, 'Reclama ticket: 7'), - (12, 11, 3, 'Delivery after 10am'); + (12, 11, 3, 'Delivery after 10am'), + (13, 1, 7, 'observation of ticket one'), + (14, 2, 7, 'observation of ticket two'); --- FIX for state hours on local, inter_afterInsert -UPDATE vncontrol.inter SET odbc_date = DATE_ADD(util.VN_CURDATE(), INTERVAL -10 SECOND); +-- FIX for state hours on local, inter_afterInsert +-- UPDATE vncontrol.inter SET odbc_date = DATE_ADD(util.VN_CURDATE(), INTERVAL -10 SECOND); INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `workerFk`, `created`) VALUES @@ -686,13 +773,9 @@ INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `workerFk`, `created`) (23, 16, 21, util.VN_NOW()), (24, 16, 21, util.VN_NOW()); -INSERT INTO `vn`.`stowaway`(`id`, `shipFk`, `created`) - VALUES - (12, 13, util.VN_CURDATE()); - INSERT INTO `vn`.`deliveryPoint` (`id`, `name`, `ubication`) VALUES - (1, 'Silla','46460 Av Espioca 100-Silla'); + (1, 'Gotham','1007 Mountain Drive, Gotham'); INSERT INTO `vn`.`vehicle`(`id`, `numberPlate`, `tradeMark`, `model`, `companyFk`, `warehouseFk`, `description`, `m3`, `isActive`, `deliveryPointFk`) VALUES @@ -756,16 +839,16 @@ INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`, `icon`, `code` INSERT INTO `vn`.`temperature`(`code`, `name`, `description`) VALUES ('warm', 'Warm', 'Warm'), - ('cool', 'Cool', 'Cool'); + ('cool', 'Cool', 'Cool'); -INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `warehouseFk`, `life`,`workerFk`, `isPackaging`, `temperatureFk`) +INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`, `workerFk`, `isPackaging`, `temperatureFk`, `isFragile`) VALUES - (1, 'CRI', 'Crisantemo', 2, 1, 31, 35, 0, 'cool'), - (2, 'ITG', 'Anthurium', 1, 1, 31, 35, 0, 'cool'), - (3, 'WPN', 'Paniculata', 2, 1, 31, 35, 0, 'cool'), - (4, 'PRT', 'Delivery ports', 3, 1, NULL, 35, 1, 'warm'), - (5, 'CON', 'Container', 3, 1, NULL, 35, 1, 'warm'), - (6, 'ALS', 'Alstroemeria', 1, 1, 31, 16, 0, 'warm'); + (1, 'CRI', 'Crisantemo', 2, 31, 35, 0, 'cool', 0), + (2, 'ITG', 'Anthurium', 1, 31, 35, 0, 'cool', 1), + (3, 'WPN', 'Paniculata', 2, 31, 35, 0, 'cool', 0), + (4, 'PRT', 'Delivery ports', 3, NULL, 35, 1, 'warm', 0), + (5, 'CON', 'Container', 3, NULL, 35, 1, 'warm', 0), + (6, 'ALS', 'Alstroemeria', 1, 31, 16, 0, 'warm', 1); INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`) VALUES @@ -810,7 +893,7 @@ INSERT INTO `vn`.`taxClassCode`(`taxClassFk`, `effectived`, `taxCodeFk`) (1, util.VN_CURDATE(), 1), (1, util.VN_CURDATE(), 21), (2, util.VN_CURDATE(), 2); - + INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`) VALUES (05080000, 'Coral y materiales similares', 2, 2), @@ -822,26 +905,26 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`) ('SER', 'Services'), ('VT', 'Sales'); -INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`, - `comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`) +INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`, + `comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`, `weightByPiece`) VALUES - (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL, 'V', 0, 15), - (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0, 10), - (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, 5), - (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL), - (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL), - (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL), - (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL), - (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, NULL), - (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL), - (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL), - (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL), - (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL), - (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1, NULL), - (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL), - (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL), - (16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL), - (71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0, NULL); + (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL, 'V', 0, 15,3), + (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0, 10,2), + (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, 5,5), + (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL), + (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL), + (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1, NULL,NULL), + (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL), + (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL), + (16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL), + (71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL); -- Update the taxClass after insert of the items UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2 @@ -875,18 +958,21 @@ INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`) (3, 'Perdida', 'LOST'); -INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `checked`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`) +INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `freightItemFk`, `created`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`, `hostFk`) VALUES - (1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 15, 1, 1, 18, 'UR9000006041', 94, 1), - (2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 16, 2, 1, 18, 'UR9000006041', 94, 1), - (3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 3, 1, 18, 'UR9000006041', 94, 2), - (4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 4, 1, 18, 'UR9000006041', 94, 2), - (5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94, 3), - (6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 1, 1, 18, NULL, 94, 3), - (7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, 1, 1, 18, NULL, 94, NULL), - (8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, 1, 1, 18, NULL, 94, 1), - (9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94, 2), - (10, 7, 7, 71, NOW(), NULL, 1, 1, 18, NULL, 94, 3); + (1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, 'UR9000006041', 94, 1, 'pc1'), + (2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 18, 'UR9000006041', 94, 1, NULL), + (3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 18, 'UR9000006041', 94, 2, NULL), + (4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 18, 'UR9000006041', 94, 2, NULL), + (5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 3, NULL), + (6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 18, NULL, 94, 3, NULL), + (7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 1, 18, NULL, 94, NULL,NULL), + (8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 1, 18, NULL, 94, 1, NULL), + (9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 2, NULL), + (10, 7, 7, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL), + (11, 7, 8, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL), + (12, 7, 9, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL), + (13, 1, 10,71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL); INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`) @@ -938,12 +1024,13 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric (30, 4, 18, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), (31, 2, 23, 'Melee weapon combat fist 15cm', -5, 7.08, 0, 0, 0, util.VN_CURDATE()), (32, 1, 24, 'Ranged weapon longbow 2m', -1, 8.07, 0, 0, 0, util.VN_CURDATE()), - (33, 5, 14, 'Ranged weapon pistol 9mm', 50, 1.79, 0, 0, 0, util.VN_CURDATE()); - -INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`) - VALUES - (1, 0), - (2, 1); + (33, 5, 14, 'Ranged weapon pistol 9mm', 50, 1.79, 0, 0, 0, util.VN_CURDATE()), + (34, 4, 28, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (35, 4, 29, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (37, 4, 31, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (36, 4, 30, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()), + (38, 2, 32, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)), + (39, 1, 32, 'Ranged weapon longbow 2m', 2, 103.49, 0, 0, 0, util.VN_CURDATE()); INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) VALUES @@ -958,7 +1045,7 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) (3, 39, 0.994), (4, 28, 1.25), (4, 29, 0.42), - (4, 39, 0.017), + (4, 39, 0.017), (5, 17, 9.94), (5, 28, 50), (5, 29, 49.4), @@ -980,8 +1067,8 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) (9, 15, 3.0949), (9, 21, 0.001), (9, 28, 53), - (9, 29, 46.4), - (9, 39, 0.994), + (9, 29, 46.4), + (9, 39, 0.994), (10, 15, 0.0199), (10, 28, 7), (10, 29, 0), @@ -1080,30 +1167,26 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) (32, 36, -92.324), (32, 39, 0.994); -INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `shelve`, `visible`, `grouping`, `packing`, `userFk`) - VALUES - (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 - ('1', '1', '1', '', '1106'), - ('2', '2', '5', '', '1106'), - ('1', '7', '1', '', '1106'), - ('2', '8', '5', '', '1106'); - -INSERT INTO `vncontrol`.`accion`(`accion_id`, `accion`) +INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `visible`, `grouping`, `packing`, `userFk`) VALUES - (3, 'ACTION ONE'), - (4, 'ACTIOn TWO'); + (2, 'GVC', 1, 1, 1, 1106), + (4, 'HEJ', 1, 1, 1, 1106), + (1, 'UXN', 2, 12, 12, 1106); -INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`) +INSERT INTO `vn`.`itemShelvingSale` (`itemShelvingFk`, `saleFk`, `quantity`, `created`, `userFk`) VALUES - (1, 0, util.VN_CURDATE(), 5, 55, 3, 1, 14), - (1, 1, util.VN_CURDATE(), 5, 54, 3, 2, 8), - (2, 1, util.VN_CURDATE(), 10, 40, 4, 3, 8), - (3, 1, util.VN_CURDATE(), 2, 40, 4, 4, 8); + ('1', '1', '1', util.VN_CURDATE(), '1106'), + ('2', '2', '5', util.VN_CURDATE(), '1106'), + ('1', '7', '1', util.VN_CURDATE(), '1106'), + ('2', '8', '5', util.VN_CURDATE(), '1106'); + +INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `id`, `stateFk`) + VALUES + (1, 0, util.VN_CURDATE(), 5, 55, 1, 14), + (1, 1, util.VN_CURDATE(), 5, 54, 2, 8), + (2, 1, util.VN_CURDATE(), 10, 40, 3, 8), + (3, 1, util.VN_CURDATE(), 2, 40, 4, 8), + (31, 1, util.VN_CURDATE(), -5, 40, 5, 8); INSERT INTO `vn`.`itemBarcode`(`id`, `itemFk`, `code`) VALUES @@ -1111,13 +1194,6 @@ INSERT INTO `vn`.`itemBarcode`(`id`, `itemFk`, `code`) (2, 1, 2222222222), (3, 1, 3333333333), (4, 2, 4444444444); - -INSERT INTO `vn`.`itemPlacement`(`id`, `itemFk`, `warehouseFk`, `code`) - VALUES - (1, 1, 1, 'A11'), - (2, 1, 2, 'A22'), - (3, 1, 3, 'A33'), - (4, 2, 1, 'A44'); INSERT INTO `vn`.`train`(`id`, `name`) VALUES @@ -1136,10 +1212,6 @@ INSERT INTO `vn`.`ticketCollection`(`ticketFk`, `collectionFk`, `level`) (3, 2, NULL), (23, 1, NULL); -INSERT INTO `vn`.`parking` (`column`, `row`, `sectorFk`, `code`, `pickingOrder`) - VALUES - ('100', '01', 1, '100-01', 1); - INSERT INTO `vn`.`genus`(`id`, `name`) VALUES (1, 'Abelia'), @@ -1170,7 +1242,7 @@ INSERT INTO `vn`.`tag`(`id`, `code`, `name`, `isFree`, `isQuantitatif`, `sourceT (7, NULL, 'Ancho de la base', 1, 1, NULL, 'mm',NULL, NULL), (23, 'stems', 'Tallos', 1, 1, NULL, NULL, NULL, 'stems'), (27, NULL, 'Longitud(cm)', 1, 1, NULL, 'cm', NULL, NULL), - (36, NULL, 'Proveedor', 1, 0, NULL, NULL, NULL, NULL), + (36, 'producer', 'Proveedor', 1, 0, NULL, NULL, NULL, 'producer'), (56, NULL, 'Genero', 1, 0, NULL, NULL, NULL, NULL), (58, NULL, 'Variedad', 1, 0, NULL, NULL, NULL, NULL), (67, 'category', 'Categoria', 1, 0, NULL, NULL, NULL, NULL), @@ -1284,15 +1356,15 @@ INSERT INTO `vn`.`itemTypeTag`(`id`, `itemTypeFk`, `tagFk`, `priority`) VALUES (1, 1, 1, 0), (2, 2, 2, 0), - (3, 3, 3, 1), - (4, 1, 4, 1), - (5, 1, 5, 1); + (3, 3, 3, 0), + (4, 1, 4, 4), + (5, 1, 5, 5); CALL `vn`.`itemRefreshTags`(NULL); -INSERT INTO `vn`.`itemLog` (`id`, `originFk`, `userFk`, `action`, `description`) - VALUES - ('1', '1', '1', 'insert', 'We made a change!'); +INSERT INTO `vn`.`itemLog` (`id`, `originFk`, `userFk`, `action`, `description`, `changedModel`, `oldInstance`, `newInstance`, `changedModelId`, `changedModelValue`) + VALUES + ('1', '1', '1', 'insert', 'We made a change!', 'Item', '{}', '{}', 1, '1'); INSERT INTO `vn`.`recovery`(`id`, `clientFk`, `started`, `finished`, `amount`, `period`) VALUES @@ -1301,7 +1373,7 @@ INSERT INTO `vn`.`recovery`(`id`, `clientFk`, `started`, `finished`, `amount`, ` (3, 1102, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(),INTERVAL 1 MONTH), 50, 7), (4, 1103, util.VN_CURDATE(), NULL, 50, 7); -INSERT INTO `vn`.`annualAverageInvoiced`(`clientFk`, `invoiced`) +INSERT INTO `bs`.`clientAnnualConsumption`(`clientFk`, `invoiced`) VALUES (1101, 1500), (1102, 100), @@ -1309,35 +1381,6 @@ INSERT INTO `vn`.`annualAverageInvoiced`(`clientFk`, `invoiced`) (1104, 500), (1105, 5000); -INSERT INTO `vn`.`supplierActivity`(`code`, `name`) - VALUES - ('animals', 'Food and complements for pets'), - ('complements', 'Other complements'), - ('flowerPlants', 'Wholesale of flowers and plants'), - ('vegetablesFruits', 'Fruit and vegetable trade'); - -INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`) - VALUES - (1, 1, 'Ace Chemicals', 'The Midtown', 1, '46000', 'Gotham', '111111111', '222222222'), - (2, 1, 'Arkham Asylum', 'Grand Avenue', 1, '46000', 'Gotham', '111111111', '222222222'), - (3, 2, 'Wayne Tower', 'Grand Avenue', 1, '46000', 'Gotham', '111111111', '222222222'), - (4, 2, 'Bank of Gotham', 'Founders Island', 1, '46000', 'Gotham', '111111111', '222222222'), - (5, 442, 'GCR building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222'), - (6, 442, 'The Gotham Tonight building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222'); - -INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`) - VALUES - (1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), - (2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), - (442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'); - -INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`) - VALUES - (1, 1, 123121212, 654789123, 'supplier1@email.es', 'observation1', 'the boss'), - (2, 1, 987456132, NULL, NULL, NULL, 'the salesperson'), - (3, 2, 321654987, NULL, 'supplier2@email.es', NULL, NULL), - (4, 442, 321654987, NULL, NULL, 'observation442', NULL); - INSERT INTO `cache`.`cache_calc`(`id`, `cache_id`, `cacheName`, `params`, `last_refresh`, `expires`, `created`, `connection_id`) VALUES (1, 2, 'available', CONCAT_WS('/',1,util.VN_CURDATE()), util.VN_NOW(), DATE_ADD(util.VN_NOW(),INTERVAL 15 MINUTE), util.VN_CURDATE(), NULL), @@ -1350,9 +1393,10 @@ INSERT INTO `vn`.`ticketWeekly`(`ticketFk`, `weekDay`) (2, 1), (3, 2), (4, 4), - (5, 6); + (5, 6), + (15, 6); -INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`) +INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`) VALUES (1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1), (2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150, 2000, 'second travel', 2, 2), @@ -1363,23 +1407,16 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO (7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1), (8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2); -INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `ref`,`isInventory`, `isRaid`, `notes`, `evaNotes`) +INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `notes`, `evaNotes`) VALUES - (1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'Movement 1', 0, 0, '', ''), - (2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'Movement 2', 0, 0, 'this is the note two', 'observation two'), - (3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'Movement 3', 0, 0, 'this is the note three', 'observation three'), - (4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'Movement 4', 0, 0, 'this is the note four', 'observation four'), - (5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'Movement 5', 0, 0, 'this is the note five', 'observation five'), - (6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'Movement 6', 0, 0, 'this is the note six', 'observation six'), - (7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 7', 0, 0, 'this is the note seven', 'observation seven'), - (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 8', 1, 1, '', ''); - -INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`) - VALUES - (1101, 500, NULL, 0.00, 0.00, 1.00), - (1102, 1000, 2.00, 0.01, 0.05, 1.00), - (1103, 2000, 0.00, 0.00, 0.02, 1.00), - (1104, 2500, 150.00, 0.02, 0.10, 1.00); + (1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, 0, '', ''), + (2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 0, 'this is the note two', 'observation two'), + (3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 0, 'this is the note three', 'observation three'), + (4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 0, 'this is the note four', 'observation four'), + (5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'this is the note five', 'observation five'), + (6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'this is the note six', 'observation six'), + (7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'this is the note seven', 'observation seven'), + (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, '', ''); INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`) VALUES @@ -1399,23 +1436,23 @@ INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeF ('HankPym', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Miscellaneous Accessories', 6, 1, '186', '0', '0.0'), ('HankPym', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Adhesives', 7, 1, '277', '0', '0.0'); -INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packageFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`,`producer`,`printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`) +INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packageFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`, `printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`) VALUES - (1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)), - (2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), - (3, 3, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 0, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 1, util.VN_CURDATE()), - (4, 2, 2, 5, 450, 3, 1, 1.000, 1.000, 0.000, 10, 10, 0, NULL, 0.00, 7.30, 7.00, NULL, 0, 1, 0, 2.5, util.VN_CURDATE()), - (5, 3, 3, 55, 500, 5, 1, 1.000, 1.000, 0.000, 1, 1, 0, NULL, 0.00, 78.3, 75.6, NULL, 0, 1, 0, 2.5, util.VN_CURDATE()), - (6, 4, 8, 50, 1000, 4, 1, 1.000, 1.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 2.5, util.VN_CURDATE()), - (7, 4, 9, 20, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 30.50, 29.00, NULL, 0, 1, 0, 2.5, util.VN_CURDATE()), - (8, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 2.5, util.VN_CURDATE()), - (9, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, util.VN_CURDATE()), - (10, 5, 1, 50, 10, 4, 1, 2.500, 2.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 4, util.VN_CURDATE()), - (11, 5, 4, 1.25, 10, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, util.VN_CURDATE()), - (12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, util.VN_CURDATE()), - (13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 4, util.VN_CURDATE()), - (14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 7.30, 7.00, NULL, 0, 1, 0, 4, util.VN_CURDATE()), - (15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, util.VN_CURDATE()); + (1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)), + (2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)), + (3, 3, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 0, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE()), + (4, 2, 2, 5, 450, 3, 1, 1.000, 1.000, 0.000, 10, 10, 0, NULL, 0.00, 7.30, 7.00, 0, 1, 0, 2.5, util.VN_CURDATE()), + (5, 3, 3, 55, 500, 5, 1, 1.000, 1.000, 0.000, 1, 1, 0, NULL, 0.00, 78.3, 75.6, 0, 1, 0, 2.5, util.VN_CURDATE()), + (6, 4, 8, 50, 1000, 4, 1, 1.000, 1.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 2.5, util.VN_CURDATE()), + (7, 4, 9, 20, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 30.50, 29.00, 0, 1, 0, 2.5, util.VN_CURDATE()), + (8, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0, 1, 0, 2.5, util.VN_CURDATE()), + (9, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()), + (10, 5, 1, 50, 10, 4, 1, 2.500, 2.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 4, util.VN_CURDATE()), + (11, 5, 4, 1.25, 10, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()), + (12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()), + (13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 4, util.VN_CURDATE()), + (14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 7.30, 7.00, 0, 1, 0, 4, util.VN_CURDATE()), + (15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()); INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`) VALUES @@ -1496,8 +1533,8 @@ INSERT INTO `hedera`.`orderRowComponent`(`rowFk`, `componentFk`, `price`) (4, 21, -0.001), (4, 28, 20.72), (4, 29, -19.72), - (4, 37, 2), - (4, 39, 0.01), + (4, 37, 2), + (4, 39, 0.01), (5, 15, 0.58), (5, 23, 6.5), (5, 28, 20.72), @@ -1716,7 +1753,7 @@ INSERT INTO `vn`.`workerManaExcluded`(`workerFk`) La otra manera es poner el calculo con los 2 trabajadores que utilizamos ahora mismo para los tickets */ -call vn.manaSpellersRequery(19); +call vn.manaSpellersRequery(19); call vn.manaSpellersRequery(18); INSERT INTO `vn`.`clientSample`(`id`, `clientFk`, `typeFk`, `created`, `workerFk`, `userFk`, `companyFk`) @@ -1730,19 +1767,26 @@ INSERT INTO `vn`.`clientSample`(`id`, `clientFk`, `typeFk`, `created`, `workerFk INSERT INTO `vn`.`claimState`(`id`, `code`, `description`, `roleFk`, `priority`, `hasToNotify`) VALUES ( 1, 'pending', 'Pendiente', 1, 1, 0), - ( 2, 'managed', 'Gestionado', 1, 5, 0), + ( 2, 'managed', 'Gestionado', 72, 5, 0), ( 3, 'resolved', 'Resuelto', 72, 7, 0), ( 4, 'canceled', 'Anulado', 72, 6, 1), - ( 5, 'incomplete', 'Incompleta', 72, 3, 1), - ( 6, 'mana', 'Mana', 1, 4, 0), - ( 7, 'lack', 'Faltas', 1, 2, 0); + ( 5, 'incomplete', 'Incompleta', 1, 3, 1), + ( 6, 'mana', 'Mana', 72, 4, 0), + ( 7, 'lack', 'Faltas', 72, 2, 0); -INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `observation`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`) +INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`, `rma`) VALUES - (1, util.VN_CURDATE(), 1, 'Cu nam labores lobortis definiebas, ei aliquyam salutatus persequeris quo, cum eu nemore fierent dissentiunt. Per vero dolor id, vide democritum scribentur eu vim, pri erroribus temporibus ex.', 1101, 18, 3, 0, util.VN_CURDATE(), 0), - (2, util.VN_CURDATE(), 2, 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.', 1101, 18, 3, 0, util.VN_CURDATE(), 1), - (3, util.VN_CURDATE(), 3, 'An vim commodo dolorem volutpat, cu expetendis voluptatum usu, et mutat consul adversarium his. His natum numquam legimus an, diam fabulas mei ut. Melius fabellas sadipscing vel id. Partem diceret mandamus mea ne, has te tempor nostrud. Aeque nostro eum no.', 1101, 18, 1, 1, util.VN_CURDATE(), 5), - (4, util.VN_CURDATE(), 3, 'Wisi forensibus mnesarchum in cum. Per id impetus abhorreant, his no magna definiebas, inani rationibus in quo. Ut vidisse dolores est, ut quis nominavi mel. Ad pri quod apeirian concludaturque.', 1104, 18, 5, 0, util.VN_CURDATE(), 10); + (1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0, '02676A049183'), + (2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1, NULL), + (3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5, NULL), + (4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10, NULL); + +INSERT INTO `vn`.`claimObservation` (`claimFk`, `workerFk`, `text`, `created`) + VALUES + (1, 18, 'Cu nam labores lobortis definiebas, ei aliquyam salutatus persequeris quo, cum eu nemore fierent dissentiunt. Per vero dolor id, vide democritum scribentur eu vim, pri erroribus temporibus ex.', util.VN_CURDATE()), + (2, 18, 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.', util.VN_CURDATE()), + (3, 18, 'An vim commodo dolorem volutpat, cu expetendis voluptatum usu, et mutat consul adversarium his. His natum numquam legimus an, diam fabulas mei ut. Melius fabellas sadipscing vel id. Partem diceret mandamus mea ne, has te tempor nostrud. Aeque nostro eum no.', util.VN_CURDATE()), + (4, 18, 'Wisi forensibus mnesarchum in cum. Per id impetus abhorreant, his no magna definiebas, inani rationibus in quo. Ut vidisse dolores est, ut quis nominavi mel. Ad pri quod apeirian concludaturque.', util.VN_CURDATE()); INSERT INTO `vn`.`claimBeginning`(`id`, `claimFk`, `saleFk`, `quantity`) VALUES @@ -1762,7 +1806,7 @@ INSERT INTO `vn`.`claimDestination`(`id`, `description`, `addressFk`) INSERT INTO `vn`.`claimDevelopment`(`id`, `claimFk`, `claimResponsibleFk`, `workerFk`, `claimReasonFk`, `claimResultFk`, `claimRedeliveryFk`, `claimDestinationFk`) VALUES (1, 1, 1, 21, 1, 1, 2, 5), - (2, 1, 1, 21, 7, 2, 2, 5), + (2, 1, 2, 21, 7, 2, 2, 5), (3, 2, 7, 21, 9, 3, 2, 5), (4, 3, 7, 21, 15, 8, 2, 5), (5, 4, 7, 21, 7, 8, 2, 5); @@ -1772,13 +1816,40 @@ INSERT INTO `vn`.`claimEnd`(`id`, `saleFk`, `claimFk`, `workerFk`, `claimDestina (1, 31, 4, 21, 2), (2, 32, 3, 21, 3); +INSERT INTO `vn`.`claimConfig`(`id`, `maxResponsibility`) + VALUES + (1, 50), + (2, 30); + +INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`) + VALUES + (1101, 500, NULL, 0.00, 0.00, 1.00), + (1102, 1000, 2.00, 0.01, 0.05, 1.00), + (1103, 2000, 0.00, 0.00, 0.02, 1.00), + (1104, 2500, 150.00, 0.02, 0.10, 1.00); + +INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`) + VALUES + (1, '02676A049183', DEFAULT, 1106), + (2, '02676A049183', DEFAULT, 1106), + (3, '02676A049183', DEFAULT, 1107), + (4, '02676A049183', DEFAULT, 1107), + (5, '01837B023653', DEFAULT, 1106); + +INSERT INTO `vn`.`claimLog` (`originFk`, userFk, `action`, changedModel, oldInstance, newInstance, changedModelId, `description`) + VALUES + (1, 18, 'update', 'Claim', '{"hasToPickUp":false}', '{"hasToPickUp":true}', 1, NULL), + (1, 18, 'update', 'ClaimObservation', '{}', '{"claimFk":1,"text":"Waiting for customer"}', 1, NULL), + (1, 18, 'insert', 'ClaimBeginning', '{}', '{"claimFk":1,"saleFk":1,"quantity":10}', 1, NULL), + (1, 18, 'insert', 'ClaimDms', '{}', '{"claimFk":1,"dmsFk":1}', 1, NULL); + INSERT INTO `hedera`.`tpvMerchant`(`id`, `description`, `companyFk`, `bankFk`, `secretKey`) VALUES (1, 'Arkham Bank', 442, 1, 'h12387193H10238'), (2, 'NewYork Bank', 442, 1, '7981ugsgd1hsdad'); -INSERT INTO `hedera`.`tpvTransaction`(`id`,`merchantFk`, `clientFk`,`receiptFk`, `amount`, `response`, `errorCode`, `status`, `created`) - VALUES +INSERT INTO `hedera`.`tpvTransaction`(`id`,`merchantFk`, `clientFk`,`receiptFk`, `amount`, `response`, `errorCode`, `status`, `created`) + VALUES (1, 1, 1101, NULL, 2000, NULL, 'SIS0042', 'ok', util.VN_CURDATE()), (2, 1, 1101, NULL, 1000, NULL, 'SIS0051', 'started', util.VN_CURDATE()), (3, 2, 1101, NULL, 7268, NULL, NULL, 'ok', util.VN_CURDATE()), @@ -1792,38 +1863,39 @@ INSERT INTO `vn`.`orderTicket`(`orderFk`, `ticketFk`) (2, 2), (3, 3), (4, 4), - (5, 5), - (6, 6), - (7, 7), - (8, 8), - (9, 9), - (10, 10), - (11, 11), - (12, 12), - (13, 13), - (14, 14), + (5, 5), + (6, 6), + (7, 7), + (8, 8), + (9, 9), + (10, 10), + (11, 11), + (12, 12), + (13, 13), + (14, 14), (15, 15), (16, 16), (17, 17), (18, 18), (19, 19), - (20, 20), - (21, 21), + (20, 20), + (21, 21), (22, 22); -INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`) +INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`) VALUES (1, 1, 69), - (5, 1, 442), + (5, 1, 442), (9, 1, 442), (18, 3, 567); - + INSERT INTO `vn`.`receipt`(`id`, `invoiceFk`, `amountPaid`, `payed`, `workerFk`, `bankFk`, `clientFk`, `created`, `companyFk`, `isConciliate`) VALUES (1, 'Cobro web', 100.50, util.VN_CURDATE(), 9, 1, 1101, util.VN_CURDATE(), 442, 1), (2, 'Cobro web', 200.50, DATE_ADD(util.VN_CURDATE(), INTERVAL -5 DAY), 9, 1, 1101, DATE_ADD(util.VN_CURDATE(), INTERVAL -5 DAY), 442, 1), (3, 'Cobro en efectivo', 300.00, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), 9, 1, 1102, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), 442, 0), - (4, 'Cobro en efectivo', 400.00, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), 9, 1, 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), 442, 0); + (4, 'Cobro en efectivo', 400.00, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), 9, 1, 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), 442, 0), + (5, 'Compensación', 400.00, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), 9, 3, 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), 442, 0); INSERT INTO `vn`.`workerTeam`(`id`, `team`, `workerFk`) VALUES @@ -1866,79 +1938,47 @@ INSERT INTO `pbx`.`sip`(`user_id`, `extension`) (5, 1102), (9, 1201); -INSERT INTO `postgresql`.`person`(`person_id`, `name`, `nickname`, `nif`, `firstname`, `id_trabajador`) - SELECT w.id, w.lastName, u.nickname,CONCAT(RPAD(CONCAT(w.id,9),8,w.id),'A'),w.firstName,w.id - FROM `vn`.`worker` `w` - JOIN `account`.`user` `u` ON `u`.`id` = `w`.`userFk`; +DROP TEMPORARY TABLE IF EXISTS tmp.worker; +CREATE TEMPORARY TABLE tmp.worker + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT w.id, w.id as `workerFk`, 'VNL', CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)), '-12-25') as started, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR)), '-12-25') as ended, CONCAT('E-46-', RPAD(CONCAT(w.id, 9), 8, w.id)), NULL as `notes`, NULL as `departmentFk`, 23, 1 as `workerBusinessProfessionalCategoryFk`, 1 as `calendarTypeFk`, 1 as `isHourlyLabor`, 1 as `workerBusinessAgreementFk`, 1 as `workcenterFk` + FROM `vn`.`worker` `w`; -INSERT INTO `postgresql`.`person`(`person_id`, `name`, `nickname`, `nif`, `firstname`, `id_trabajador`) - VALUES - (1000, 'VERDNATURA LEVANTE SL', 'VNL', 'B78945612', NULL, NULL); +INSERT INTO `vn`.`business`(`id`, `workerFk`, `companyCodeFk`, `started`, `ended`, `workerBusiness`, `reasonEndFk`, `notes`, `departmentFk`, `workerBusinessProfessionalCategoryFk`, `calendarTypeFk`, `isHourlyLabor`, `workerBusinessAgreementFk`, `workcenterFk`) + SELECT * FROM tmp.worker; -INSERT INTO `postgresql`.`profile`(`profile_id`, `person_id`, `profile_type_id`) - SELECT p.person_id, p.person_id, 1 - FROM `postgresql`.`person` `p`; +DROP TEMPORARY TABLE IF EXISTS tmp.worker; +CREATE TEMPORARY TABLE tmp.worker + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT '1111' as 'id', w.id as `workerFk`, 'VNL', CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -2 YEAR)), '-12-25') as started, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)), '-12-24') as ended, CONCAT('E-46-', RPAD(CONCAT(w.id, 9), 8, w.id)), NULL as `notes`, NULL as `departmentFk`, 23, 1 as `workerBusinessProfessionalCategoryFk`, 1 as `calendarTypeFk`, 1 as `isHourlyLabor`, 1 as `workerBusinessAgreementFk`, 1 as `workcenterFk` + FROM `vn`.`worker` `w` + WHERE `w`.`id` = 1109; -INSERT INTO `postgresql`.`business`(`business_id`, `client_id`, `provider_id`, `date_start`, `date_end`, `workerBusiness`, `reasonEndFk`) - SELECT p.profile_id, p.profile_id, 1000, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR)), '-01-25'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL - FROM `postgresql`.`profile` `p`; +INSERT INTO `vn`.`business` (`id`, `workerFk`, `companyCodeFk`, `started`, `ended`, `workerBusiness`, `reasonEndFk`, `notes`, `departmentFk`, `workerBusinessProfessionalCategoryFk`, `calendarTypeFk`, `isHourlyLabor`, `workerBusinessAgreementFk`, `workcenterFk`) + SELECT * FROM tmp.worker; -INSERT INTO `postgresql`.`business_labour`(`business_id`, `notes`, `department_id`, `professional_category_id`, `incentivo`, `calendar_labour_type_id`, `porhoras`, `labour_agreement_id`, `workcenter_id`) - SELECT b.business_id, NULL, 23, 1, 0, 1, 1, 1, 1 - FROM `postgresql`.`business` `b`; +DROP TEMPORARY TABLE IF EXISTS tmp.worker; -INSERT INTO `postgresql`.`business` (`client_id`, `provider_id`, `date_start`, `date_end`, `workerBusiness`, `reasonEndFk`) - SELECT p.profile_id, 1000, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -2 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)), '-12-24'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL - FROM `postgresql`.`profile` `p` - WHERE `p`.`profile_id` = 1109; +UPDATE `vn`.`business` + SET `payedHolidays`= 8 + WHERE `id`= 1106; -INSERT INTO `postgresql`.`business_labour` (`business_id`, `notes`, `department_id`, `professional_category_id`, `incentivo`, `calendar_labour_type_id`, `porhoras`, `labour_agreement_id`, `workcenter_id`) - VALUES - (1111, NULL, 23, 1, 0.0, 1, 1, 1, 1); +UPDATE `vn`.`business` b + SET b.`workerBusinessProfessionalCategoryFk` = 31 + WHERE b.`workerFk` = 1110; -UPDATE `postgresql`.`business_labour` bl - JOIN `postgresql`.`business` b ON b.business_id = bl.business_id - JOIN `postgresql`.`profile` pr ON pr.profile_id = b.client_id - JOIN `postgresql`.`person` p ON p.person_id = pr.person_id - SET bl.`professional_category_id` = 31 - WHERE p.`Id_trabajador` = 1110; - -UPDATE `postgresql`.`business_labour` bl - SET bl.`department_id` = 43 -WHERE business_id IN(18, 19); - -INSERT INTO `postgresql`.`media`(`media_id`, `media_type_id`, `value`, `sort`) - VALUES - (1, 10, 600123321, 0), - (2, 10, 700987987, 0); - -INSERT INTO `postgresql`.`profile_media`(`profile_media_id`, `profile_id`, `media_id`) - VALUES - (1, 1106, 1), - (2, 1107, 2); - -INSERT INTO `vn`.`workCenter` (`id`, `name`, `warehouseFk`) - VALUES - ('1', 'Silla', '1'), - ('5', 'Madrid', '5'); +UPDATE `vn`.`business` b + SET b.`departmentFk` = 43 + WHERE b.id IN(18, 19); INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`) - VALUES - ('1', '27.5', YEAR(util.VN_CURDATE())), - ('5', '22', YEAR(util.VN_CURDATE())), - ('1', '24.5', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))), - ('5', '23', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))); - -INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`, `code`, `holidayEntitlementRate`, `discountRate`) - VALUES - (1, 'Holidays', '#FF4444', 'holiday', 0, 0), - (2, 'Leave of absence', '#C71585', 'absence', 0, 1), - (6, 'Half holiday', '#E65F00', 'halfHoliday', 0, 0.5), - (15, 'Half Paid Leave', '#5151c0', 'halfPaidLeave', 0, 1), - (20, 'Furlough', '#97B92F', 'furlough', 1, 1), - (21, 'Furlough half day', '#778899', 'halfFurlough', 0.5, 1); - -ALTER TABLE `postgresql`.`business_labour_payroll` DROP FOREIGN KEY `business_labour_payroll_cod_categoria`; + VALUES + ('1', '27.5', YEAR(util.VN_CURDATE())), + ('5', '22', YEAR(util.VN_CURDATE())), + ('1', '24.5', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))), + ('5', '23', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))); INSERT INTO `vn`.`workerBusinessType` (`id`, `name`, `isFullTime`, `isPermanent`, `hasHolidayEntitlement`) VALUES @@ -1946,15 +1986,41 @@ INSERT INTO `vn`.`workerBusinessType` (`id`, `name`, `isFullTime`, `isPermanent` (100, 'INDEFINIDO A TIEMPO COMPLETO', 1, 1, 1), (109, 'CONVERSION DE TEMPORAL EN INDEFINIDO T.COMPLETO', 1, 1, 1); -INSERT INTO `postgresql`.`business_labour_payroll` (`business_id`, `cod_tarifa`, `cod_categoria`, `cod_contrato`, `importepactado`) - VALUES - (1, 7, 12, 100, 900.50), - (1106, 7, 12, 100, 1263.03), - (1107, 7, 12, 100, 2000), - (1108, 7, 12, 100, 1500); +UPDATE `vn`.`business` b + SET `rate` = 7, + `workerBusinessTypeFk` = 100, + `amount` = 900.50 + WHERE b.id = 1; -INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`) - VALUES +UPDATE `vn`.`business` b + SET `rate` = 7, + `workerBusinessTypeFk` = 100, + `amount` = 1263.03 + WHERE b.id = 1106; + +UPDATE `vn`.`business` b + SET `rate` = 7, + `workerBusinessTypeFk` = 100, + `amount` = 2000 + WHERE b.id = 1107; + +UPDATE `vn`.`business` b + SET `rate` = 7, + `workerBusinessTypeFk` = 100, + `amount` = 1500 + WHERE b.id = 1108; + +INSERT INTO `vn`.`absenceType` (`id`, `name`, `rgb`, `code`, `holidayEntitlementRate`, `discountRate`) + VALUES + (1, 'Holidays', '#FF4444', 'holiday', 0, 0), + (2, 'Leave of absence', '#C71585', 'absence', 0, 1), + (6, 'Half holiday', '#E65F00', 'halfHoliday', 0, 0.5), + (15, 'Half Paid Leave', '#5151c0', 'halfPaidLeave', 0, 1), + (20, 'Furlough', '#97B92F', 'furlough', 1, 1), + (21, 'Furlough half day', '#778899', 'halfFurlough', 0.5, 1); + +INSERT INTO `vn`.`calendar` (`businessFk`, `dayOffTypeFk`, `dated`) + VALUES (1, 6, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))), (1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))), (1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -11 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 11 DAY))), @@ -1969,10 +2035,11 @@ INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id` (1107, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -20 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 20 DAY))), (1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -13 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 8 DAY))), (1107, 1, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -14 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 9 DAY))), - (1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 7 DAY))); + (1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 7 DAY))), + (1107, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL - 16 DAY)); -INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`, `apiKey`) - VALUES +INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`, `apiKey`) + VALUES ('1', 'https://api.gateway360.com/api/3.0/sms/send', 'Verdnatura', '5715476da95b46d686a5a255e6459523'); INSERT INTO `vn`.`sharingClient`(`id`, `workerFk`, `started`, `ended`, `clientFk`) @@ -1988,38 +2055,39 @@ CALL `vn`.zoneGeo_calcTree(); -- this is an auto calculate for table vn.zoneGeo, INSERT INTO `vn`.`zoneIncluded` (`zoneFk`, `geoFk`, `isIncluded`) VALUES - (1, 3, 0), - (1, 4, 0), - (1, 5, 0), + (1, 3, 0), + (1, 4, 0), + (1, 5, 0), (1, 1, 1), - (2, 3, 0), - (2, 4, 0), - (2, 5, 0), + (2, 3, 0), + (2, 4, 0), + (2, 5, 0), (2, 1, 1), - (3, 3, 0), - (3, 4, 0), - (3, 5, 0), + (3, 3, 0), + (3, 4, 0), + (3, 5, 0), (3, 1, 1), - (4, 3, 0), - (4, 4, 0), - (4, 5, 0), + (4, 3, 0), + (4, 4, 0), + (4, 5, 0), (4, 1, 1), - (5, 3, 1), - (5, 4, 0), - (5, 5, 1), + (5, 3, 1), + (5, 4, 0), + (5, 5, 1), (5, 1, 1), - (6, 3, 1), - (6, 4, 0), - (6, 5, 1), + (6, 3, 1), + (6, 4, 0), + (6, 5, 1), (6, 1, 1), - (7, 3, 0), - (7, 4, 0), - (7, 5, 0), + (7, 3, 0), + (7, 4, 0), + (7, 5, 0), (7, 1, 1), - (8, 3, 0), - (8, 4, 0), - (8, 5, 0), + (8, 3, 0), + (8, 4, 0), + (8, 5, 0), (8, 1, 1), + (9, 7, 1), (10, 14, 1); INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `dated`) @@ -2231,16 +2299,24 @@ INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `dated`) (7, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +6 DAY)); INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `weekDays`) - VALUES + VALUES (8, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun'), (10, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun'); -INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`) +INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `started`, `ended`) VALUES - (1106, CONCAT(util.VN_CURDATE(), ' 07:00'), TRUE, 'in'), - (1106, CONCAT(util.VN_CURDATE(), ' 10:00'), TRUE, 'middle'), - (1106, CONCAT(util.VN_CURDATE(), ' 10:10'), TRUE, 'middle'), - (1106, CONCAT(util.VN_CURDATE(), ' 15:00'), TRUE, 'out'); + (9, 'range', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR)); + +INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`, `isSendMail`) + VALUES + (1106, CONCAT(util.VN_CURDATE(), ' 07:00'), TRUE, 'in', 0), + (1106, CONCAT(util.VN_CURDATE(), ' 10:00'), TRUE, 'middle', 0), + (1106, CONCAT(util.VN_CURDATE(), ' 10:20'), TRUE, 'middle', 0), + (1106, CONCAT(util.VN_CURDATE(), ' 14:50'), TRUE, 'out', 0), + (1107, CONCAT(util.VN_CURDATE(), ' 07:00'), TRUE, 'in', 1), + (1107, CONCAT(util.VN_CURDATE(), ' 10:00'), TRUE, 'middle', 1), + (1107, CONCAT(util.VN_CURDATE(), ' 10:20'), TRUE, 'middle', 1), + (1107, CONCAT(util.VN_CURDATE(), ' 14:50'), TRUE, 'out', 1); INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `code`) VALUES @@ -2295,22 +2371,22 @@ INSERT INTO `vn`.`workerDocument`(`id`, `worker`, `document`,`isReadableByWorker (1, 1106, 4, TRUE), (2, 1107, 3, FALSE); -INSERT INTO `vn`.`device` (`sn`, `model`, `userFk`) - VALUES +INSERT INTO `vn`.`device` (`sn`, `model`, `userFk`) + VALUES ('aaa', 'android', '9'); -INSERT INTO `vn`.`queuePriority`(`id`, `priority`) +INSERT INTO `vn`.`queuePriority`(`id`, `priority`, `code`) VALUES - (1, 'Alta'), - (2, 'Normal'), - (3, 'Baja'); + (1, 'Alta', 'high'), + (2, 'Normal', 'normal'), + (3, 'Baja', 'low'); INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `weekScope`, `dayWorkMax`, `dayStayMax`, `weekMaxBreak`, `weekMaxScope`, `askInOut`) VALUES (1, 43200, 129600, 734400, 43200, 50400, 259200, 1296000, 36000); INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11'); - + INSERT INTO `vn`.`thermograph`(`id`, `model`) VALUES ('TMM190901395', 'TEMPMATE'), @@ -2328,21 +2404,21 @@ INSERT INTO `vn`.`travelThermograph`(`thermographFk`, `created`, `warehouseFk`, ('138350-0', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 'WARM', NULL, 5), ('138350-0', util.VN_CURDATE(), 1, NULL, 'COOL', NULL, NULL); -REPLACE INTO `vn`.`incoterms`(`code`, `name`) - VALUES +REPLACE INTO `vn`.`incoterms`(`code`, `name`) + VALUES ('FAS', 'Free Alongside Ship'); -REPLACE INTO `vn`.`customsAgent`(`id`, `fiscalName`, `street`, `nif`, `phone`, `email`) - VALUES +REPLACE INTO `vn`.`customsAgent`(`id`, `fiscalName`, `street`, `nif`, `phone`, `email`) + VALUES (1, 'Agent one', '1007 Mountain Drive, Gotham', 'N1111111111', '111111111', 'agentone@gotham.com'), (2, 'Agent two', '1007 Mountain Drive, Gotham', 'N2222222222', '222222222', 'agenttwo@gotham.com'); -INSERT INTO `vn`.`tablet`(`uuid`, `name`, `place`, `macwifi`) - VALUES +INSERT INTO `vn`.`tablet`(`uuid`, `name`, `place`, `macwifi`) + VALUES ('1', 'TEST', 'ON THE FIXTURES', '0'), ('2', 'DEV', 'OTHER TABLET', '0'); -INSERT INTO `vn`.`tabletDepartment`(`tabletFk`, `departmentFk`) +INSERT INTO `vn`.`tabletDepartment`(`tabletFk`, `departmentFk`) VALUES (1, 23), (2, 1); @@ -2375,8 +2451,8 @@ INSERT INTO `vn`.`rate`(`dated`, `warehouseFk`, `rate0`, `rate1`, `rate2`, `rate (DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), 1, 10, 15, 20, 25), (util.VN_CURDATE(), 1, 12, 17, 22, 27); -INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk) - VALUES +INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk) + VALUES (1, '07546501420', 67, 671, util.VN_CURDATE(), 1761, 1, 1), (2, '07546491421', 252, 2769, util.VN_CURDATE(), 5231, 1, 1), (3, '07546500823', 102, 1495, util.VN_CURDATE(), 3221, 1, 1), @@ -2388,8 +2464,8 @@ INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk (9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1), (10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1); -INSERT INTO `vn`.`dua` (id, code, awbFk, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk) - VALUES +INSERT INTO `vn`.`dua` (id, code, awbFk, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk) + VALUES (1, '19ES0028013A481523', 1, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 11276.95, 442), (2, '21ES00280136115760', 2, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1376.20, 442), (3, '19ES00280131956004', 3, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 3, 14268.50, 442), @@ -2414,6 +2490,10 @@ REPLACE INTO `vn`.`invoiceIn`(`id`, `serialNumber`,`serial`, `supplierFk`, `issu (9, 1009, 'R', 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1242, 1, 442, 1), (10, 1010, 'R', 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1243, 1, 442, 1); +INSERT INTO `vn`.`invoiceInConfig` (`id`, `retentionRate`, `retentionName`, `sageWithholdingFk`, `daysAgo`) + VALUES + (1, -2, '2% retention', 2, 45); + INSERT INTO `vn`.`invoiceInDueDay`(`invoiceInFk`, `dueDated`, `bankFk`, `amount`) VALUES (1, util.VN_CURDATE(), 1, 336.99), @@ -2436,25 +2516,25 @@ INSERT INTO `vn`.`duaInvoiceIn`(`id`, `duaFk`, `invoiceInFk`) (4, 4, 4), (5, 5, 5), (6, 6, 6), - (7, 7, 7), - (8, 8, 8), + (7, 7, 7), + (8, 8, 8), (9, 9, 9), (10, 10, 10); INSERT INTO `vn`.`invoiceInTax` (`invoiceInFk`, `taxableBase`, `expenceFk`, `foreignValue`, `taxTypeSageFk`, `transactionTypeSageFk`) VALUES - (1, 99.99, '2000000000', null, null, null), - (2, 999.99, '2000000000', null, null, null), - (3, 1000.50, '2000000000', null, null, null), - (4, 0.50, '2000000000', null, null, null), - (5, 150.50, '2000000000', null, null, null), - (1, 252.25, '4751000000', NULL, 7, 61), - (2, 223.17, '6210000567', NULL, 8, 20), - (3, 95.60, '7001000000', NULL, 8, 35), - (4, 446.63, '7001000000', NULL, 6, 61), - (5, 64.23, '6210000567', NULL, 8, 20), - (6, 29.95, '7001000000', NULL, 7, 20), - (7, 58.64, '6210000567', NULL, 8, 20); + (1, 99.99, '2000000000', NULL, NULL, NULL), + (2, 999.99, '2000000000', NULL, NULL, NULL), + (3, 1000.50, '2000000000', NULL, NULL, NULL), + (4, 0.50, '2000000000', NULL, NULL, NULL), + (5, 150.50, '2000000000', NULL, NULL, NULL), + (1, 252.25, '4751000000', NULL, 7, 61), + (2, 223.17, '6210000567', NULL, 8, 20), + (3, 95.60, '7001000000', NULL, 8, 35), + (4, 446.63, '7001000000', NULL, 6, 61), + (5, 64.23, '6210000567', NULL, 8, 20), + (6, 29.95, '7001000000', NULL, 7, 20), + (7, 58.64, '6210000567', NULL, 8, 20); INSERT INTO `vn`.`invoiceInIntrastat` (`invoiceInFk`, `net`, `intrastatFk`, `amount`, `stems`, `countryFk`) VALUES @@ -2462,10 +2542,10 @@ INSERT INTO `vn`.`invoiceInIntrastat` (`invoiceInFk`, `net`, `intrastatFk`, `amo (1, 10, 6021010, 20.00, 205, 5), (2, 13.20, 5080000, 15.00, 580, 5), (2, 16.10, 6021010, 25.00, 80, 5); - + INSERT INTO `vn`.`ticketRecalc`(`ticketFk`) - SELECT `id` - FROM `vn`.`ticket` t + SELECT t.id + FROM vn.ticket t LEFT JOIN vn.ticketRecalc tr ON tr.ticketFk = t.id WHERE tr.ticketFk IS NULL; @@ -2479,7 +2559,7 @@ INSERT INTO `vn`.`zoneAgencyMode`(`id`, `agencyModeFk`, `zoneFk`) (4, 7, 1); INSERT INTO `vn`.`expeditionTruck` (`id`, `ETD`, `description`) - VALUES + VALUES (1, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL +3 YEAR))), 'Best truck in fleet'); INSERT INTO `vn`.`expeditionPallet` (`id`, `truckFk`, `built`, `position`, `isPrint`) @@ -2487,7 +2567,7 @@ INSERT INTO `vn`.`expeditionPallet` (`id`, `truckFk`, `built`, `position`, `isPr (1, 1, util.VN_CURDATE(), 1, 1); INSERT INTO `vn`.`expeditionScan` (`id`, `expeditionFk`, `scanned`, `palletFk`) - VALUES + VALUES (1, 1, util.VN_CURDATE(), 1), (2, 2, util.VN_CURDATE(), 1), (3, 3, util.VN_CURDATE(), 1), @@ -2519,10 +2599,6 @@ UPDATE `vn`.`route` UPDATE `vn`.`route` SET `invoiceInFk`=2 WHERE `id`=2; -INSERT INTO `bs`.`salesPerson` (`workerFk`, `year`, `month`, `portfolioWeight`) - VALUES - (18, YEAR(util.VN_CURDATE()), MONTH(util.VN_CURDATE()), 807.23), - (19, YEAR(util.VN_CURDATE()), MONTH(util.VN_CURDATE()), 34.40); INSERT INTO `bs`.`sale` (`saleFk`, `amount`, `dated`, `typeFk`, `clientFk`) VALUES @@ -2532,13 +2608,9 @@ INSERT INTO `bs`.`sale` (`saleFk`, `amount`, `dated`, `typeFk`, `clientFk`) (4, 33.8, util.VN_CURDATE(), 1, 1101), (30, 34.4, util.VN_CURDATE(), 1, 1108); -INSERT INTO `vn`.`docuware` (`code`, `fileCabinetName`, `dialogName` , `find`) - VALUES - ('deliveryClient', 'deliveryClient', 'findTicket', 'word'); - INSERT INTO `vn`.`docuwareConfig` (`url`) VALUES - ('https://verdnatura.docuware.cloud/docuware/platform'); + ('http://docuware.url/'); INSERT INTO `vn`.`calendarHolidaysName` (`id`, `name`) VALUES @@ -2551,19 +2623,19 @@ INSERT INTO `vn`.`calendarHolidaysType` (`id`, `name`, `hexColour`) INSERT INTO `vn`.`calendarHolidays` (`id`, `calendarHolidaysTypeFk`, `dated`, `calendarHolidaysNameFk`, `workCenterFk`) VALUES (1, 1, CONCAT(YEAR(util.VN_CURDATE()), '-12-09'), 1, 1); - + INSERT INTO `vn`.`supplierAgencyTerm` (`agencyFk`, `supplierFk`, `minimumPackages`, `kmPrice`, `packagePrice`, `routePrice`, `minimumKm`, `minimumM3`, `m3Price`) VALUES (1, 1, 0, 0.00, 0.00, NULL, 0, 0.00, 23), (2, 1, 60, 0.00, 0.00, NULL, 0, 5.00, 33), (3, 2, 0, 15.00, 0.00, NULL, 0, 0.00, 0), (4, 2, 0, 20.00, 0.00, NULL, 0, 0.00, 0), - (5, 442, 0, 0.00, 3.05, NULL, 0, 0.00, 0); + (5, 442, 0, 0.00, 3.05, NULL, 0, 0.00, 0); INSERT INTO `vn`.`chat` (`senderFk`, `recipient`, `dated`, `checkUserStatus`, `message`, `status`, `attempts`) VALUES - (1101, '@PetterParker', CURDATE(), 1, 'First test message', 0, 0), - (1101, '@PetterParker', CURDATE(), 0, 'Second test message', 0, 0); + (1101, '@PetterParker', util.VN_CURDATE(), 1, 'First test message', 0, 'sent'), + (1101, '@PetterParker', util.VN_CURDATE(), 0, 'Second test message', 0, 'pending'); INSERT INTO `vn`.`mobileAppVersionControl` (`appName`, `version`, `isVersionCritical`) @@ -2583,6 +2655,15 @@ INSERT INTO `vn`.`machineWorker` (`workerFk`, `machineFk`, `inTimed`, `outTimed` (1106, 2, util.VN_CURDATE(), NULL), (1106, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY)); +INSERT INTO `vn`.`zoneExclusion` (`id`, `zoneFk`, `dated`, `created`, `userFk`) +VALUES + (1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=7, 7, 14) - DAYOFWEEK(util.VN_CURDATE())) DAY), util.VN_CURDATE(), 100), + (2, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=8, 8, 15) - DAYOFWEEK(util.VN_CURDATE())) DAY), util.VN_CURDATE(), 100); + +INSERT INTO `vn`.`zoneExclusionGeo` (`zoneExclusionFk`, `geoFk`) + VALUES + (2, 1); + INSERT INTO `vn`.`mdbBranch` (`name`) VALUES ('test'), @@ -2593,6 +2674,11 @@ INSERT INTO `vn`.`mdbVersion` (`app`, `branchFk`, `version`) ('tpv', 'test', '1'), ('lab', 'master', '1'); +INSERT INTO `vn`.`accountingConfig` (`id`, `minDate`, `maxDate`) + VALUES + (1, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)), '-01-01'), CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR)), '-01-01')); + + INSERT INTO `vn`.`saleGroup` (`userFk`, `parkingFk`, `sectorFk`) VALUES (1, 1, 1); @@ -2608,3 +2694,173 @@ INSERT INTO `vn`.`sectorCollection` (`userFk`, `sectorFk`) INSERT INTO `vn`.`sectorCollectionSaleGroup` (`sectorCollectionFk`, `saleGroupFk`) VALUES (1, 1); + +INSERT INTO `vn`.`workerTimeControlConfig` (`id`, `dayBreak`, `dayBreakDriver`, `shortWeekBreak`, `longWeekBreak`, `weekScope`, `mailPass`, `mailHost`, `mailSuccessFolder`, `mailErrorFolder`, `mailUser`, `minHoursToBreak`, `breakHours`, `hoursCompleteWeek`, `startNightlyHours`, `endNightlyHours`, `maxTimePerDay`, `breakTime`, `timeToBreakTime`, `dayMaxTime`, `shortWeekDays`, `longWeekDays`, `teleworkingStart`, `teleworkingStartBreakTime`) + VALUES + (1, 43200, 32400, 129600, 259200, 604800, '', '', 'Leidos.exito', 'Leidos.error', 'timeControl', 5.33, 0.33, 40, '22:00:00', '06:00:00', 57600, 1200, 18000, 57600, 6, 13, 28800, 32400); + +INSERT INTO `vn`.`host` (`id`, `code`, `description`, `warehouseFk`, `bankFk`) + VALUES + (1, 'pc1', 'pc host', 1, 1); + +INSERT INTO `vn`.`packingSite` (`id`, `code`, `hostFk`, `monitorId`) + VALUES + (1, 'h1', 1, ''); + +INSERT INTO `vn`.`packingSiteConfig` (`shinobiUrl`, `shinobiToken`, `shinobiGroupKey`, `avgBoxingTime`) + VALUES + ('', 'SHINNOBI_TOKEN', 'GROUP_TOKEN', 6000); +INSERT INTO `util`.`notificationConfig` + SET `cleanDays` = 90; + +INSERT INTO `util`.`notification` (`id`, `name`, `description`) + VALUES + (1, 'print-email', 'notification fixture one'), + (2, 'invoice-electronic', 'A electronic invoice has been generated'), + (4, 'supplier-pay-method-update', 'A supplier pay method has been updated'); + +INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`) + VALUES + (1, 9); + +INSERT INTO `util`.`notificationQueue` (`id`, `notificationFk`, `params`, `authorFk`, `status`, `created`) + VALUES + (1, 'print-email', '{"id": "1"}', 9, 'pending', util.VN_CURDATE()), + (2, 'print-email', '{"id": "2"}', null, 'pending', util.VN_CURDATE()), + (3, 'print-email', null, null, 'pending', util.VN_CURDATE()); + +INSERT INTO `util`.`notificationSubscription` (`notificationFk`, `userFk`) + VALUES + (1, 1109), + (1, 1110), + (2, 1109), + (1,9), + (1,3); + + +INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`) + VALUES + (1, 9); + +INSERT INTO `vn`.`productionConfig` (`isPreviousPreparationRequired`, `ticketPrintedMax`, `ticketTrolleyMax`, `rookieDays`, `notBuyingMonths`, `id`, `isZoneClosedByExpeditionActivated`, `maxNotReadyCollections`, `minTicketsToCloseZone`, `movingTicketDelRoute`, `defaultZone`, `defautlAgencyMode`, `hasUniqueCollectionTime`, `maxCollectionWithoutUser`, `pendingCollectionsOrder`, `pendingCollectionsAge`) + VALUES + (0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6); + +INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPackingTypeFk`, `saleTotalCount`, `salePickedCount`, `trainFk`, `sectorFk`, `wagons`) + VALUES + (3, util.VN_NOW(), 1107, 5, NULL, 0, 0, 1, NULL, NULL); + +INSERT INTO `vn`.`itemConfig` (`id`, `isItemTagTriggerDisabled`, `monthToDeactivate`, `wasteRecipients`, `validPriorities`, `defaultPriority`, `defaultTag`, `warehouseFk`) + VALUES + (0, 0, 24, '', '[1,2,3]', 2, 56, 60); + +INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `level`, `wagon`, `smartTagFk`, `usedShelves`, `itemCount`, `liters`) + VALUES + (9, 3, util.VN_NOW(), NULL, 0, NULL, NULL, NULL, NULL); + +INSERT INTO `vn`.`saleCloned` (`saleClonedFk`, `saleOriginalFk`) + VALUES + (29, 25); + +UPDATE `account`.`user` + SET `hasGrant` = 1 + WHERE `id` = 66; + +INSERT INTO `vn`.`ticketLog` (`originFk`, userFk, `action`, changedModel, oldInstance, newInstance, changedModelId, `description`) + VALUES + (7, 18, 'update', 'Sale', '{"quantity":1}', '{"quantity":10}', 1, NULL), + (7, 18, 'update', 'Ticket', '{"quantity":1,"concept":"Chest ammo box"}', '{"quantity":10,"concept":"Chest ammo box"}', 1, NULL), + (7, 18, 'update', 'Sale', '{"price":3}', '{"price":5}', 1, NULL), + (7, 18, 'update', NULL, NULL, NULL, NULL, "Cambio cantidad Melee weapon heavy shield 1x0.5m de '5' a '10'"); + +INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`) + VALUES + (0, 'http://localhost:56596/scp', 'ostadmin', 'Admin1', '1,6', 3, 60, 'Este CAU se ha cerrado automáticamente. Si el problema persiste responda a este mensaje.', 'localhost', 'osticket', 'osticket', 40003, 'reply', 1, 'all'); + +INSERT INTO `vn`.`mdbApp` (`app`, `baselineBranchFk`, `userFk`, `locked`) + VALUES + ('foo', 'master', NULL, NULL), + ('bar', 'test', 9, util.VN_NOW()); + +INSERT INTO `vn`.`profileType` (`id`, `name`) + VALUES + (1, 'working'); + +INSERT INTO `salix`.`url` (`appName`, `environment`, `url`) + VALUES + ('lilium', 'dev', 'http://localhost:8080/#/'), + ('salix', 'dev', 'http://localhost:5000/#!/'); + +INSERT INTO `vn`.`report` (`id`, `name`, `paperSizeFk`, `method`) + VALUES + (3, 'invoice', NULL, 'InvoiceOuts/{refFk}/invoice-out-pdf'); + +INSERT INTO `vn`.`payDemDetail` (`id`, `detail`) + VALUES + (1, 1); + +INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`) + VALUES + (1, NULL, 1); + +INSERT INTO `vn`.`ticketRefund`(`refundTicketFk`, `originalTicketFk`) + VALUES + (1, 12); + +INSERT INTO `vn`.`deviceProductionModels` (`code`) + VALUES + ('BLACKVIEW'), + ('DODGEE'), + ('ZEBRA'); + +INSERT INTO `vn`.`deviceProductionState` (`code`, `description`) + VALUES + ('active', 'activo'), + ('idle', 'inactivo'), + ('lost', 'perdida'), + ('repair', 'reparación'), + ('retired', 'retirada'); + +INSERT INTO `vn`.`deviceProduction` (`imei`, `modelFk`, `macWifi`, `serialNumber`, `android_id`, `purchased`, `stateFk`, `isInScalefusion`, `description`) + VALUES + ('ime1', 'BLACKVIEW', 'macWifi1', 'serialNumber1', 'android_id1', util.VN_NOW(), 'active', 0, NULL), + ('ime2', 'DODGEE', 'macWifi2', 'serialNumber2', 'android_id2', util.VN_NOW(), 'idle', 0, NULL), + ('ime3', 'ZEBRA', 'macWifi3', 'serialNumber3', 'android_id3', util.VN_NOW(), 'active', 0, NULL), + ('ime4', 'BLACKVIEW', 'macWifi4', 'serialNumber4', 'android_id4', util.VN_NOW(), 'idle', 0, NULL); + +INSERT INTO `vn`.`deviceProductionUser` (`deviceProductionFk`, `userFk`, `created`) + VALUES + (1, 1, util.VN_NOW()), + (3, 3, util.VN_NOW()); + +INSERT INTO `vn`.`workerTimeControlMail` (`id`, `workerFk`, `year`, `week`, `state`, `updated`, `sendedCounter`, `reason`) + VALUES + (1, 9, 2000, 49, 'REVISE', util.VN_NOW(), 1, 'test2'), + (2, 9, 2000, 50, 'SENDED', util.VN_NOW(), 1, NULL), + (3, 9, 2000, 51, 'CONFIRMED', util.VN_NOW(), 1, NULL), + (4, 9, 2001, 1, 'SENDED', util.VN_NOW(), 1, NULL); + +INSERT INTO `vn`.`wagonConfig` (`id`, `width`, `height`, `maxWagonHeight`, `minHeightBetweenTrays`, `maxTrays`) + VALUES + (1, 1350, 1900, 200, 50, 6); + +INSERT INTO `vn`.`wagonTypeColor` (`id`, `name`, `rgb`) + VALUES + (1, 'white', '#ffffff'), + (2, 'red', '#ff0000'), + (3, 'green', '#00ff00'), + (4, 'blue', '#0000ff'); + +INSERT INTO `vn`.`wagonType` (`id`, `name`, `divisible`) + VALUES + (1, 'Wagon Type #1', 1); + +INSERT INTO `vn`.`wagonTypeTray` (`id`, `typeFk`, `height`, `colorFk`) + VALUES + (1, 1, 100, 1), + (2, 1, 50, 2), + (3, 1, 0, 3); + + + + diff --git a/db/dump/mockDate.sql b/db/dump/mockDate.sql index c63c2d76c..937da071c 100644 --- a/db/dump/mockDate.sql +++ b/db/dump/mockDate.sql @@ -3,18 +3,17 @@ USE `util`; DELIMITER ;; DROP FUNCTION IF EXISTS `util`.`mockedDate`; -CREATE FUNCTION `util`.`mockedDate`() +CREATE FUNCTION `util`.`mockedDate`() RETURNS DATETIME DETERMINISTIC BEGIN - RETURN NOW(); - -- '2022-01-19 08:00:00' + RETURN CONVERT_TZ('2001-01-01 11:00:00', 'utc', 'Europe/Madrid'); END ;; DELIMITER ; DELIMITER ;; DROP FUNCTION IF EXISTS `util`.`VN_CURDATE`; -CREATE FUNCTION `util`.`VN_CURDATE`() +CREATE FUNCTION `util`.`VN_CURDATE`() RETURNS DATE DETERMINISTIC BEGIN @@ -24,7 +23,7 @@ DELIMITER ; DELIMITER ;; DROP FUNCTION IF EXISTS `util`.`VN_CURTIME`; -CREATE FUNCTION `util`.`VN_CURTIME`() +CREATE FUNCTION `util`.`VN_CURTIME`() RETURNS TIME DETERMINISTIC BEGIN @@ -34,10 +33,10 @@ DELIMITER ; DELIMITER ;; DROP FUNCTION IF EXISTS `util`.`VN_NOW`; -CREATE FUNCTION `util`.`VN_NOW`() +CREATE FUNCTION `util`.`VN_NOW`() RETURNS DATETIME DETERMINISTIC BEGIN - RETURN mockedDate(); + RETURN mockedDate(); END ;; -DELIMITER ; \ No newline at end of file +DELIMITER ; diff --git a/db/dump/structure.sql b/db/dump/structure.sql index cc0ee4785..90e4c4bc9 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -1,8 +1,8 @@ --- MariaDB dump 10.19 Distrib 10.5.12-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: 127.0.0.1 Database: account +-- Host: db.verdnatura.es Database: account -- ------------------------------------------------------ --- Server version 10.4.13-MariaDB-1:10.4.13+maria~focal +-- Server version 10.7.7-MariaDB-1:10.7.7+maria~deb11-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -19,7 +19,7 @@ -- Current Database: `account` -- -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `account` /*!40100 DEFAULT CHARACTER SET utf8 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `account` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */; USE `account`; @@ -34,7 +34,7 @@ CREATE TABLE `account` ( `id` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `account_ibfk_3` FOREIGN KEY (`id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Users allowed to have an account'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Users allowed to have an account'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -88,15 +88,15 @@ DROP TABLE IF EXISTS `accountConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `accountConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `homedir` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The base folder for users home directory', - `shell` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The default shell', + `homedir` varchar(50) NOT NULL COMMENT 'The base folder for users home directory', + `shell` varchar(50) NOT NULL COMMENT 'The default shell', `idBase` int(11) NOT NULL COMMENT 'Base id for Posix users and groups', `min` smallint(6) NOT NULL, `max` smallint(6) NOT NULL COMMENT 'Maximum password age (seconds)', `warn` smallint(6) NOT NULL COMMENT 'Warn to change password when elapsed (seconds)', `inact` smallint(6) NOT NULL COMMENT 'Maximum inactivity time (seconds)', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters for accounts'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration parameters for accounts'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -122,14 +122,14 @@ DROP TABLE IF EXISTS `accountLog`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `accountLog` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `msg` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `pid` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `user` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `host` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `rhost` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `time` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `msg` varchar(255) NOT NULL, + `pid` varchar(255) NOT NULL, + `user` varchar(255) NOT NULL, + `host` varchar(255) NOT NULL, + `rhost` varchar(255) NOT NULL, + `time` varchar(255) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -155,13 +155,13 @@ DROP TABLE IF EXISTS `ldapConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ldapConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `server` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The LDAP server access url', - `rdn` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The LDAP user', - `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The LDAP password', - `userDn` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The base DN for users', - `groupDn` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The base DN for groups', + `server` varchar(255) NOT NULL COMMENT 'The LDAP server access url', + `rdn` varchar(255) NOT NULL COMMENT 'The LDAP user', + `password` varchar(255) NOT NULL COMMENT 'The LDAP password', + `userDn` varchar(255) DEFAULT NULL COMMENT 'The base DN for users', + `groupDn` varchar(255) DEFAULT NULL COMMENT 'The base DN for groups', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='LDAP server configuration parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='LDAP server configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -173,12 +173,12 @@ DROP TABLE IF EXISTS `mailAlias`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `mailAlias` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `alias` varchar(50) CHARACTER SET utf8 NOT NULL, - `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `alias` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `description` varchar(255) DEFAULT NULL, `isPublic` tinyint(4) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `alias` (`alias`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Mail aliases'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Mail aliases'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -197,7 +197,7 @@ CREATE TABLE `mailAliasAccount` ( KEY `account` (`account`), CONSTRAINT `account` FOREIGN KEY (`account`) REFERENCES `account` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `mailAlias` FOREIGN KEY (`mailAlias`) REFERENCES `mailAlias` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Mail alias that is assigned to each account'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Mail alias that is assigned to each account'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -209,12 +209,12 @@ DROP TABLE IF EXISTS `mailClientAccess`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `mailClientAccess` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `client` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, - `action` set('OK','REJECT') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'REJECT', - `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `client` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL, + `action` set('OK','REJECT') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT 'REJECT', + `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `mailFrom` (`client`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -228,7 +228,7 @@ CREATE TABLE `mailConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `domain` varchar(255) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -240,10 +240,10 @@ DROP TABLE IF EXISTS `mailForward`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `mailForward` ( `account` int(10) unsigned NOT NULL, - `forwardTo` varchar(250) CHARACTER SET utf8 NOT NULL, + `forwardTo` varchar(250) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`account`), CONSTRAINT `mailForward_ibfk_1` FOREIGN KEY (`account`) REFERENCES `account` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Mail forwarding'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Mail forwarding'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -255,12 +255,12 @@ DROP TABLE IF EXISTS `mailSenderAccess`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `mailSenderAccess` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `sender` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, + `sender` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL, `action` set('OK','REJECT') NOT NULL DEFAULT 'REJECT', - `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `mailFrom` (`sender`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -305,14 +305,14 @@ DROP TABLE IF EXISTS `role`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `role` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(14) COLLATE utf8_unicode_ci NOT NULL COMMENT 'MySQL doesn''t support more than 14 chars for proxied user names', - `description` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `name` varchar(14) NOT NULL COMMENT 'MySQL doesn''t support more than 14 chars for proxied user names', + `description` varchar(100) DEFAULT NULL, `hasLogin` tinyint(3) unsigned NOT NULL DEFAULT 1, `created` timestamp NOT NULL DEFAULT current_timestamp(), `modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Roles'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Roles'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -372,7 +372,7 @@ CREATE TABLE `roleConfig` ( `userHost` varchar(255) NOT NULL, `tplUser` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COMMENT='Role configuration parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Role configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -391,7 +391,7 @@ CREATE TABLE `roleInherit` ( KEY `owner_id` (`inheritsFrom`), CONSTRAINT `roleInherit_ibfk_1` FOREIGN KEY (`role`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `roleInherit_ibfk_2` FOREIGN KEY (`inheritsFrom`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Role inheritance'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Role inheritance'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -407,7 +407,7 @@ CREATE TABLE `roleRole` ( `inheritsFrom` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `role` (`role`,`inheritsFrom`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Calculated role inheritance'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Calculated role inheritance'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -419,13 +419,13 @@ DROP TABLE IF EXISTS `sambaConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sambaConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `adDomain` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Active directory domain', - `adController` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The hosname of domain controller', - `adUser` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Active directory user', - `adPassword` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Active directory password', + `adDomain` varchar(255) NOT NULL COMMENT 'Active directory domain', + `adController` varchar(255) NOT NULL COMMENT 'The hosname of domain controller', + `adUser` varchar(255) DEFAULT NULL COMMENT 'Active directory user', + `adPassword` varchar(255) DEFAULT NULL COMMENT 'Active directory password', `verifyCert` tinyint(3) unsigned NOT NULL DEFAULT 1 COMMENT 'Whether to verify server certificate', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters for accounts'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration parameters for accounts'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -437,31 +437,33 @@ DROP TABLE IF EXISTS `user`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `user` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `realm` varchar(512) CHARACTER SET utf8 DEFAULT NULL, - `name` varchar(30) CHARACTER SET utf8 NOT NULL, - `nickname` varchar(127) COLLATE utf8_unicode_ci NOT NULL, - `bcryptPassword` varchar(512) COLLATE utf8_unicode_ci DEFAULT NULL, + `realm` varchar(512) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `name` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `nickname` varchar(127) NOT NULL, + `bcryptPassword` varchar(512) DEFAULT NULL, `role` int(10) unsigned NOT NULL DEFAULT 2, `active` tinyint(1) NOT NULL DEFAULT 1, - `email` varchar(255) CHARACTER SET utf8 DEFAULT NULL, + `email` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `emailVerified` tinyint(1) DEFAULT NULL, - `verificationToken` varchar(512) CHARACTER SET utf8 DEFAULT NULL, - `lang` char(2) CHARACTER SET utf8 DEFAULT NULL, + `verificationToken` varchar(512) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `lang` char(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `lastPassChange` datetime DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), `updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `password` char(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Deprecated', + `image` varchar(255) DEFAULT NULL, + `password` char(64) NOT NULL COMMENT 'Deprecated', `recoverPass` tinyint(3) unsigned NOT NULL DEFAULT 1 COMMENT 'Deprecated', `sync` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Deprecated', + `hasGrant` tinyint(1) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), + UNIQUE KEY `mail` (`email`), KEY `role` (`role`), KEY `email` (`email`), KEY `nickname` (`nickname`), KEY `lang` (`lang`), CONSTRAINT `user_ibfk_2` FOREIGN KEY (`role`) REFERENCES `role` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global users'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global users'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -501,7 +503,7 @@ DELIMITER ;; FOR EACH ROW BEGIN CALL hedera.image_ref('user', NEW.image); - + INSERT IGNORE INTO userSync SET `name` = NEW.`name`; END */;; DELIMITER ; @@ -566,7 +568,7 @@ BEGIN 'jgallego@verdnatura.es', 'Rol modificado', CONCAT( - myUserGetName(), + myUser_getName(), ' ha modificado el rol del usuario ', NEW.`name`, ' de ', OLD.role, ' a ', NEW.role) ); @@ -611,7 +613,7 @@ CREATE TABLE `userConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `loginKey` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -629,7 +631,7 @@ CREATE TABLE `userPassword` ( `nDigits` tinyint(3) unsigned NOT NULL COMMENT 'Minimum of digits', `nPunct` tinyint(3) unsigned NOT NULL COMMENT 'Minimum of symbols', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Restrictions on user passwords'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Restrictions on user passwords'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -642,7 +644,7 @@ DROP TABLE IF EXISTS `userSync`; CREATE TABLE `userSync` ( `name` varchar(30) NOT NULL COMMENT 'The user name', PRIMARY KEY (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Users pending to be synchronized'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Users pending to be synchronized'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -652,100 +654,6 @@ CREATE TABLE `userSync` ( -- -- Dumping routines for database 'account' -- -/*!50003 DROP FUNCTION IF EXISTS `myUserGetId` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = 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 `myUserGetId`() RETURNS int(11) - READS SQL DATA - DETERMINISTIC -BEGIN -/** - * @deprecated Use myUser_getId() - */ - RETURN 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 FUNCTION IF EXISTS `myUserGetName` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = 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 `myUserGetName`() RETURNS varchar(30) CHARSET utf8 - NO SQL - DETERMINISTIC -BEGIN -/** - * @deprecated Use myUser_getName() - */ - RETURN myUser_getName(); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 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 `myUserHasRole` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = 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 `myUserHasRole`(vRoleName VARCHAR(255)) RETURNS tinyint(1) - DETERMINISTIC -BEGIN -/** - * @deprecated Use myUser_hasRole() - */ - RETURN myUser_hasRole(vRoleName); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 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 `myUserHasRoleId` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = 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 `myUserHasRoleId`(vRoleId INT) RETURNS tinyint(1) - DETERMINISTIC -BEGIN -/** - * @deprecated Use myUser_hasRoleId() - */ - RETURN myUser_hasRoleId(vRoleId); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP FUNCTION IF EXISTS `myUser_checkLogin` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -776,7 +684,7 @@ BEGIN SET vSignature = util.hmacSha2(256, CONCAT_WS('/', @userId, @userName), vKey); RETURN vSignature = @userSignature; END IF; - + RETURN FALSE; END ;; @@ -805,7 +713,7 @@ BEGIN * @return The user id */ DECLARE vUser INT DEFAULT NULL; - + IF myUser_checkLogin() THEN SET vUser = @userId; @@ -813,7 +721,7 @@ BEGIN SELECT id INTO vUser FROM user WHERE name = LEFT(USER(), INSTR(USER(), '@') - 1); END IF; - + RETURN vUser; END ;; DELIMITER ; @@ -848,7 +756,7 @@ BEGIN ELSE SET vUser = LEFT(USER(), INSTR(USER(), '@') - 1); END IF; - + RETURN vUser; END ;; DELIMITER ; @@ -901,7 +809,7 @@ BEGIN * @param vRoleName Role id to check * @return %TRUE if it has role, %FALSE otherwise */ - RETURN user_hasRoleId(myUserGetName(), vRoleId); + RETURN user_hasRoleId(myUser_getName(), vRoleId); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -943,10 +851,10 @@ BEGIN DECLARE vDigitChars TEXT DEFAULT '1234567890'; DECLARE vPunctChars TEXT DEFAULT '!$%&()=.'; - SELECT length, nAlpha, nUpper, nDigits, nPunct + SELECT length, nAlpha, nUpper, nDigits, nPunct INTO vMinLength, vMinAlpha, vMinUpper, vMinDigits, vMinPunct FROM userPassword; - WHILE LENGTH(vPwd) < vMinLength OR vAlpha < vMinAlpha + WHILE LENGTH(vPwd) < vMinLength OR vAlpha < vMinAlpha OR vUpper < vMinUpper OR vDigits < vMinDigits OR vPunct < vMinPunct DO SET vRandIndex = FLOOR((RAND() * 4) + 1); @@ -998,100 +906,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 FUNCTION IF EXISTS `userGetId` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = 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 `userGetId`() RETURNS int(11) - READS SQL DATA - DETERMINISTIC -BEGIN -/** - * @deprecated Use myUser_getId() - */ - RETURN 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 FUNCTION IF EXISTS `userGetName` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = 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 `userGetName`() RETURNS varchar(30) CHARSET utf8 - NO SQL - DETERMINISTIC -BEGIN -/** - * @deprecated Use myUser_getName() - */ - RETURN myUser_getName(); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP FUNCTION IF EXISTS `userHasRole` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = 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 `userHasRole`(vUserName VARCHAR(255), vRoleName VARCHAR(255)) RETURNS tinyint(1) - DETERMINISTIC -BEGIN -/** - * @deprecated Use user_hasRole() - */ - RETURN user_hasRole(vUserName, vRoleName); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP FUNCTION IF EXISTS `userHasRoleId` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = 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 `userHasRoleId`(vUser VARCHAR(255), vRoleId INT) RETURNS tinyint(1) - DETERMINISTIC -BEGIN -/** - * @deprecated Use user_hasRoleId() - */ - RETURN user_hasRoleId(vUser, vRoleId); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP FUNCTION IF EXISTS `user_getMysqlRole` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1115,7 +929,7 @@ BEGIN DECLARE vRole VARCHAR(255); SELECT CONCAT(IF(r.hasLogin, c.rolePrefix, ''), r.name) INTO vRole - FROM role r + FROM role r JOIN user u ON u.role = r.id JOIN roleConfig c WHERE u.name = vUserName; @@ -1142,16 +956,16 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `user_getNameFromId`(vSelf INT) RETUR 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 + + SELECT `name` INTO vName + FROM user WHERE id = vSelf; - + RETURN vName; END ;; DELIMITER ; @@ -1223,7 +1037,7 @@ BEGIN JOIN role r ON r.id = rr.inheritsFrom WHERE u.`name` = vUser AND r.id = vRoleId; - + RETURN vHasRole; END ;; DELIMITER ; @@ -1231,28 +1045,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 `myUserLogout` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `myUserLogout`() -BEGIN -/** - * @deprecated Use myUser_Logout() - */ - CALL myUser_logout; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `myUser_changePassword` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1304,7 +1096,7 @@ BEGIN AND password = MD5(vPassword) AND active; - IF vAuthIsOk + IF vAuthIsOk THEN CALL myUser_loginWithName (vUserName); ELSE @@ -1365,7 +1157,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `myUser_loginWithName`(vUserName VAR BEGIN /** * Logs in using only the user name. This procedure is intended to be executed - * by users with a high level of privileges so that normal users should not have + * by users with a high level of privileges so that normal users should not have * execute permissions on it. * * @param vUserName The user name @@ -1401,7 +1193,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `myUser_logout`() BEGIN /** * Logouts the user. - */ + */ SET @userId = NULL; SET @userName = NULL; SET @userSignature = NULL; @@ -1524,9 +1316,9 @@ BEGIN SELECT COUNT(*) > 0 INTO vIsRoot FROM tmp.role t - JOIN role r ON r.id = t.id + JOIN role r ON r.id = t.id WHERE r.`name` = 'root'; - + IF vIsRoot THEN INSERT IGNORE INTO tmp.role (id) SELECT id FROM role; @@ -1610,53 +1402,48 @@ 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 character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `role_syncPrivileges`() BEGIN /** * Synchronizes permissions of MySQL role users based on role hierarchy. - * The computed role users of permission mix will be named according to - * pattern [vRolePrefix][roleName]. + * The computed role users of permission mix will be named according to + * pattern [vGenRolePrefix][roleName]. * - * If [vTplUser]@[vTplHost] user exists, it will be taken as a template for + * If [vTplUser]@[vRoleHost] user exists, it will be taken as a template for * basic attributes. * * Warning! This procedure should only be called when MySQL privileges * are modified. If role hierarchy is modified, you must call the role_sync() * procedure wich calls this internally. */ - DECLARE vIsMysql BOOL DEFAULT VERSION() NOT LIKE '%MariaDB%'; + DECLARE vIsMariaDb BOOL DEFAULT VERSION() LIKE '%MariaDB%'; DECLARE vVersion INT DEFAULT SUBSTRING_INDEX(VERSION(), '.', 1); DECLARE vTplUser VARCHAR(255); - DECLARE vTplHost VARCHAR(255); + DECLARE vRoleHost VARCHAR(255); DECLARE vUserPrefix VARCHAR(2); DECLARE vUserHost VARCHAR(255); - DECLARE vRolePrefix VARCHAR(2); - DECLARE vRoleHost VARCHAR(255); + DECLARE vGenRolePrefix VARCHAR(2); + DECLARE vGenRoleHost VARCHAR(255); DECLARE vPrefixedLike VARCHAR(255); DECLARE vPassword VARCHAR(255) DEFAULT ''; SELECT rolePrefix, userPrefix, userHost, tplUser - INTO vRolePrefix, vUserPrefix, vUserHost, vTplUser + INTO vGenRolePrefix, vUserPrefix, vUserHost, vTplUser FROM roleConfig; -- Deletes computed role users - SET vPrefixedLike = CONCAT(vRolePrefix, '%'); - SET vRoleHost = vUserHost; + SET vPrefixedLike = CONCAT(vGenRolePrefix, '%'); + SET vGenRoleHost = vUserHost; - IF vIsMysql THEN - SET vTplHost = 'localhost'; - - DELETE FROM mysql.user - WHERE `User` LIKE vPrefixedLike; - ELSE - SET vTplHost = ''; + IF vIsMariaDb THEN + SET vRoleHost = ''; DELETE FROM mysql.global_priv WHERE `User` LIKE vPrefixedLike; @@ -1667,6 +1454,11 @@ BEGIN `Role` LIKE vPrefixedLike AND (`User`, `Host`) = ('root', 'localhost') ); + ELSE + SET vRoleHost = 'localhost'; + + DELETE FROM mysql.user + WHERE `User` LIKE vPrefixedLike; END IF; DELETE FROM mysql.db @@ -1693,7 +1485,7 @@ BEGIN SELECT id, `name` `role`, - CONCAT(vRolePrefix, `name`) prefixedRole + CONCAT(vGenRolePrefix, `name`) prefixedRole FROM `role` WHERE hasLogin; @@ -1710,16 +1502,102 @@ BEGIN JOIN `roleRole` rr ON rr.role = r.id JOIN `role` ri ON ri.id = rr.inheritsFrom JOIN mysql.`user` u - ON u.`User` = ri.`name` AND u.`Host` = vTplHost; + ON u.`User` = ri.`name` AND u.`Host` = vRoleHost; -- Recreate role users - IF vIsMysql THEN + IF vIsMariaDb THEN + -- Roles + + INSERT INTO mysql.global_priv (`Host`, `User`, `Priv`) + SELECT vRoleHost, prefixedRole, + JSON_OBJECT( + 'is_role', TRUE, + 'access', 0 + ) + FROM tRole r + UNION + SELECT vRoleHost, CONCAT(vGenRolePrefix, 'root'), + JSON_OBJECT( + 'is_role', TRUE, + 'access', 0 + ); + + INSERT INTO mysql.roles_mapping (`Host`, `User`, `Role`, `Admin_option`) + SELECT vRoleHost, prefixedRole, inheritsFrom, 'N' + FROM tRoleInherit + UNION + SELECT vRoleHost, CONCAT(vGenRolePrefix, 'root'), prefixedRole, 'Y' + FROM tRole; + + INSERT INTO mysql.roles_mapping (`Host`, `User`, `Role`, `Admin_option`) + SELECT 'localhost', 'root', prefixedRole, 'Y' + FROM tRole + UNION + SELECT 'localhost', 'root', CONCAT(vGenRolePrefix, 'root'), 'Y'; + + -- Role users + + INSERT INTO mysql.global_priv ( + `User`, + `Host`, + `Priv` + ) + SELECT + r.prefixedRole, + vGenRoleHost, + JSON_MERGE_PATCH( + IFNULL(t.`Priv`, '{}'), + IFNULL(u.`Priv`, '{}'), + JSON_OBJECT( + 'mysql_old_password', JSON_VALUE(t.`Priv`, '$.mysql_old_password'), + 'mysql_native_password', JSON_VALUE(t.`Priv`, '$.mysql_native_password'), + 'authentication_string', JSON_VALUE(t.`Priv`, '$.authentication_string'), + 'ssl_type', JSON_VALUE(t.`Priv`, '$.ssl_type'), + 'default_role', r.prefixedRole, + 'access', 0, + 'is_role', FALSE + ) + ) + FROM tRole r + LEFT JOIN mysql.global_priv t + ON (t.`User`, t.Host) = (vTplUser, vRoleHost) + LEFT JOIN mysql.global_priv u + ON (u.`User`, u.Host) = (r.`role`, vRoleHost); + + INSERT INTO mysql.roles_mapping (`Host`, `User`, `Role`, `Admin_option`) + SELECT vGenRoleHost, prefixedRole, prefixedRole, 'N' + FROM tRole; + + -- Accounts + + DROP TEMPORARY TABLE IF EXISTS tAccounts; + CREATE TEMPORARY TABLE tAccounts + (INDEX (`name`)) + ENGINE = MEMORY + SELECT p.`User` `name`, r.prefixedRole + FROM mysql.global_priv p + JOIN `user` u ON u.`name` = p.`User` + JOIN tRole r ON r.`id` = u.`role` + WHERE JSON_EXTRACT(p.`Priv`, '$.autogenerated') = 'true'; + + UPDATE mysql.global_priv p + JOIN tAccounts c ON c.`name` = p.`User` + SET p.`Priv` = JSON_SET(p.`Priv`, '$.default_role', c.prefixedRole) + WHERE p.`Host` = vUserHost; + + UPDATE IGNORE mysql.roles_mapping m + JOIN tAccounts c ON c.`name` = m.`User` + SET m.`Role` = c.prefixedRole + WHERE m.`Host` = vUserHost; + + DROP TEMPORARY TABLE tAccounts; + ELSE DROP TEMPORARY TABLE IF EXISTS tUser; CREATE TEMPORARY TABLE tUser SELECT r.prefixedRole `User`, - vRoleHost `Host`, + vGenRoleHost `Host`, IFNULL(t.`authentication_string`, '') `authentication_string`, IFNULL(t.`plugin`, @@ -1751,16 +1629,16 @@ BEGIN FROM tRole r LEFT JOIN mysql.user t ON t.`User` = vTplUser - AND t.`Host` = vTplHost + AND t.`Host` = vRoleHost LEFT JOIN mysql.user u ON u.`User` = r.role - AND u.`Host` = vTplHost; + AND u.`Host` = vRoleHost; IF vVersion <= 5 THEN SELECT `Password` INTO vPassword FROM mysql.user WHERE `User` = vTplUser - AND `Host` = vTplHost; + AND `Host` = vRoleHost; INSERT INTO mysql.user ( `User`, @@ -1838,8 +1716,8 @@ BEGIN '', vUserHost, prefixedRole, - vRoleHost, - CONCAT(prefixedRole, '@', vRoleHost) + vGenRoleHost, + CONCAT(prefixedRole, '@', vGenRoleHost) FROM tRole; -- Global privileges @@ -1882,13 +1760,13 @@ BEGIN FROM tRoleInherit r JOIN mysql.user u ON u.`User` = r.inheritsFrom - AND u.`Host`= vTplHost + AND u.`Host`= vRoleHost GROUP BY r.prefixedRole; - + UPDATE mysql.user u JOIN tUserPriv t ON u.`User` = t.prefixedRole - AND u.`Host` = vRoleHost + AND u.`Host` = vGenRoleHost SET u.`Select_priv` = t.`Select_priv`, @@ -1979,7 +1857,7 @@ BEGIN ) SELECT r.prefixedRole, - vRoleHost, + vGenRoleHost, t.`Db`, MAX(t.`Select_priv`), MAX(t.`Insert_priv`), @@ -2003,7 +1881,7 @@ BEGIN FROM tRoleInherit r JOIN mysql.db t ON t.`User` = r.inheritsFrom - AND t.`Host`= vTplHost + AND t.`Host`= vRoleHost GROUP BY r.prefixedRole, t.`Db`; -- Table level privileges @@ -2020,7 +1898,7 @@ BEGIN ) SELECT r.prefixedRole, - vRoleHost, + vGenRoleHost, t.`Db`, t.`Table_name`, t.`Grantor`, @@ -2030,7 +1908,7 @@ BEGIN FROM tRoleInherit r JOIN mysql.tables_priv t ON t.`User` = r.inheritsFrom - AND t.`Host`= vTplHost + AND t.`Host`= vRoleHost GROUP BY r.prefixedRole, t.`Db`, t.`Table_name`; -- Column level privileges @@ -2046,7 +1924,7 @@ BEGIN ) SELECT r.prefixedRole, - vRoleHost, + vGenRoleHost, t.`Db`, t.`Table_name`, t.`Column_name`, @@ -2055,7 +1933,7 @@ BEGIN FROM tRoleInherit r JOIN mysql.columns_priv t ON t.`User` = r.inheritsFrom - AND t.`Host`= vTplHost + AND t.`Host`= vRoleHost GROUP BY r.prefixedRole, t.`Db`, t.`Table_name`, t.`Column_name`; -- Routine privileges @@ -2072,7 +1950,7 @@ BEGIN ) SELECT r.prefixedRole, - vRoleHost, + vGenRoleHost, t.`Db`, t.`Routine_name`, t.`Routine_type`, @@ -2082,94 +1960,7 @@ BEGIN FROM tRoleInherit r JOIN mysql.procs_priv t ON t.`User` = r.inheritsFrom - AND t.`Host`= vTplHost; - ELSE - -- Roles - - INSERT INTO mysql.global_priv (`Host`, `User`, `Priv`) - SELECT vTplHost, prefixedRole, - JSON_OBJECT( - 'is_role', TRUE, - 'access', 0 - ) - FROM tRole r - UNION - SELECT vTplHost, CONCAT(vRolePrefix, 'root'), - JSON_OBJECT( - 'is_role', TRUE, - 'access', 0 - ); - - INSERT INTO mysql.roles_mapping (`Host`, `User`, `Role`, `Admin_option`) - SELECT vTplHost, prefixedRole, inheritsFrom, 'N' - FROM tRoleInherit - UNION - SELECT vTplHost, CONCAT(vRolePrefix, 'root'), `User`, 'Y' - FROM mysql.global_priv - WHERE `User` LIKE vPrefixedLike AND `Host` = vTplHost; - - INSERT INTO mysql.roles_mapping (`Host`, `User`, `Role`, `Admin_option`) - SELECT 'localhost', 'root', prefixedRole, 'Y' - FROM tRole - UNION - SELECT 'localhost', 'root', CONCAT(vRolePrefix, 'root'), 'Y'; - - -- Role users - - INSERT INTO mysql.global_priv ( - `User`, - `Host`, - `Priv` - ) - SELECT - r.prefixedRole, - vRoleHost, - JSON_MERGE_PATCH( - IFNULL(t.`Priv`, '{}'), - IFNULL(u.`Priv`, '{}'), - JSON_OBJECT( - 'mysql_old_password', JSON_VALUE(t.`Priv`, '$.mysql_old_password'), - 'mysql_native_password', JSON_VALUE(t.`Priv`, '$.mysql_native_password'), - 'authentication_string', JSON_VALUE(t.`Priv`, '$.authentication_string'), - 'ssl_type', JSON_VALUE(t.`Priv`, '$.ssl_type'), - 'default_role', r.prefixedRole, - 'access', 0, - 'is_role', FALSE - ) - ) - FROM tRole r - LEFT JOIN mysql.global_priv t - ON (t.`User`, t.Host) = (vTplUser, vTplHost) - LEFT JOIN mysql.global_priv u - ON (u.`User`, u.Host) = (r.`role`, vTplHost); - - INSERT INTO mysql.roles_mapping (`Host`, `User`, `Role`, `Admin_option`) - SELECT vRoleHost, prefixedRole, prefixedRole, 'N' - FROM tRole; - - -- Accounts - - DROP TEMPORARY TABLE IF EXISTS tAccounts; - CREATE TEMPORARY TABLE tAccounts - (INDEX (`name`)) - ENGINE = MEMORY - SELECT p.`User` `name`, r.prefixedRole - FROM mysql.global_priv p - JOIN `user` u ON u.`name` = p.`User` - JOIN tRole r ON r.`id` = u.`role` - WHERE JSON_EXTRACT(p.`Priv`, '$.autogenerated') = 'true'; - - UPDATE mysql.global_priv p - JOIN tAccounts c ON c.`name` = p.`User` - SET p.`Priv` = JSON_SET(p.`Priv`, '$.default_role', c.prefixedRole) - WHERE p.`Host` = vUserHost; - - UPDATE IGNORE mysql.roles_mapping m - JOIN tAccounts c ON c.`name` = m.`User` - SET m.`Role` = c.prefixedRole - WHERE m.`Host` = vUserHost; - - DROP TEMPORARY TABLE tAccounts; + AND t.`Host`= vRoleHost; END IF; -- Cleanup @@ -2185,102 +1976,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 `userLogin` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `userLogin`(vUserName VARCHAR(255), vPassword VARCHAR(255)) - READS SQL DATA -BEGIN -/** - * @deprecated Use myUser_login() - */ - CALL myUser_login(vUserName, vPassword); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `userLoginWithKey` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `userLoginWithKey`(vUserName VARCHAR(255), vKey VARCHAR(255)) - READS SQL DATA -BEGIN -/** - * @deprecated Use myUser_loginWithKey() - */ - CALL myUser_loginWithKey(vUserName, vKey); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `userLoginWithName` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `userLoginWithName`(vUserName VARCHAR(255)) - READS SQL DATA -BEGIN -/** - * @deprecated Use myUser_loginWithName() - */ - CALL myUser_loginWithName(vUserName); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `userSetPassword` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `userSetPassword`(vUserName VARCHAR(255), vPassword VARCHAR(255)) -BEGIN -/** - * @deprecated Use user_setPassword() - */ - DECLARE vUserId INT; - - SELECT id INTO vUserId - FROM user WHERE `name` = vUserName; - - CALL user_setPassword(vUserId, vPassword); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `user_changePassword` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2306,7 +2001,7 @@ BEGIN SELECT `password` = MD5(vOldPassword), `name` INTO vPasswordOk, vUserName FROM user WHERE id = vSelf; - + IF NOT vPasswordOk THEN SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Invalid password'; @@ -2380,7 +2075,7 @@ BEGIN IF vChr REGEXP '[[:alpha:]]' THEN SET vNAlpha = vNAlpha+1; - + IF vChr REGEXP '[A-Z]' THEN SET vNUpper = vNUpper+1; @@ -2440,7 +2135,7 @@ BEGIN SELECT verificationToken = vVerificationToken, `name` INTO vTokenVerified, vUserName FROM user WHERE id = vSelf; - + IF NOT vTokenVerified THEN SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Invalid verification token'; @@ -2490,7 +2185,7 @@ DELIMITER ; -- Current Database: `bs` -- -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `bs` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `bs` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci */; USE `bs`; @@ -2505,7 +2200,7 @@ SET character_set_client = utf8; /*!50001 CREATE TABLE `bajasLaborales` ( `firstname` tinyint NOT NULL, `name` tinyint NOT NULL, - `business_id` tinyint NOT NULL, + `businessFk` tinyint NOT NULL, `lastDate` tinyint NOT NULL, `endContract` tinyint NOT NULL, `type` tinyint NOT NULL, @@ -2533,7 +2228,7 @@ CREATE TABLE `bancos_evolution` ( PRIMARY KEY (`Fecha`,`Id_Banco`), KEY `fk_banco_evolution_idx` (`Id_Banco`), CONSTRAINT `fk_banco_evolution` FOREIGN KEY (`Id_Banco`) REFERENCES `vn`.`accounting` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los saldos bancarios'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Almacena los saldos bancarios'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2544,12 +2239,12 @@ DROP TABLE IF EXISTS `carteras`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `carteras` ( - `CodigoTrabajador` varchar(3) CHARACTER SET latin1 NOT NULL, + `CodigoTrabajador` varchar(3) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL, `Año` int(11) NOT NULL, `Mes` int(11) NOT NULL, `Peso` decimal(10,2) DEFAULT NULL, PRIMARY KEY (`CodigoTrabajador`,`Año`,`Mes`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2564,7 +2259,7 @@ CREATE TABLE `clientAnnualConsumption` ( `invoiced` double(17,0) DEFAULT NULL, PRIMARY KEY (`clientFk`), CONSTRAINT `fmaId_Cliente` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2576,13 +2271,13 @@ DROP TABLE IF EXISTS `clientDied`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientDied` ( `id` int(11) NOT NULL DEFAULT 0, - `clientName` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `clientName` varchar(50) NOT NULL, `lastInvoiced` date DEFAULT NULL, - `workerCode` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `Boss` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `Aviso` varchar(13) CHARACTER SET utf8 DEFAULT NULL, + `workerCode` varchar(3) NOT NULL, + `Boss` varchar(3) NOT NULL, + `Aviso` varchar(13) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Clientes que no han comprado en los ultimos 3 meses, se actualiza con proceso nocturno el 3 de cada mes'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Clientes que no han comprado en los ultimos 3 meses, se actualiza con proceso nocturno el 3 de cada mes'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2600,7 +2295,7 @@ CREATE TABLE `clientNewBorn` ( `isRookie` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'define un cliente que ha de ser cuidado por ser nuevo o recuperado', PRIMARY KEY (`clientFk`), CONSTRAINT `clientNewBorn_fk1` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Listado de clientes que se consideran nuevos a efectos de cobrar la comision adicional del comercial'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Listado de clientes que se consideran nuevos a efectos de cobrar la comision adicional del comercial'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2626,20 +2321,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; --- --- Table structure for table `clientNewBorn__` --- - -DROP TABLE IF EXISTS `clientNewBorn__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `clientNewBorn__` ( - `clientFk` int(11) NOT NULL, - `shipped` date NOT NULL, - PRIMARY KEY (`clientFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Listado de clientes que se consideran nuevos a efectos de cobrar la comision adicional del comercial'; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `compradores` -- @@ -2655,7 +2336,7 @@ CREATE TABLE `compradores` ( `comision` decimal(10,2) DEFAULT NULL, PRIMARY KEY (`Id_Trabajador`,`año`,`semana`), CONSTRAINT `comprador_trabajador` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2671,7 +2352,7 @@ CREATE TABLE `compradores_evolution` ( `importe` decimal(10,0) DEFAULT NULL, PRIMARY KEY (`Id_Trabajador`,`fecha`), CONSTRAINT `evo_trabajador` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2685,7 +2366,7 @@ CREATE TABLE `customerEvolution` ( `dated` date NOT NULL, `quantity` int(11) NOT NULL, PRIMARY KEY (`dated`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2705,7 +2386,7 @@ CREATE TABLE `defaulter` ( PRIMARY KEY (`clientFk`,`created`), KEY `client` (`clientFk`), KEY `date` (`created`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2719,7 +2400,7 @@ CREATE TABLE `experienceIberflora2016` ( `Id_Cliente` int(11) NOT NULL, `isVisitor` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`Id_Cliente`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de clientes que participan en el estudio sobre la mejora del consumo tras la visita a las instalaciones de Silla'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Lista de clientes que participan en el estudio sobre la mejora del consumo tras la visita a las instalaciones de Silla'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2738,7 +2419,7 @@ CREATE TABLE `fondo_maniobra` ( `proveedores_pagos` double DEFAULT NULL, `fondo_medio` double DEFAULT NULL, PRIMARY KEY (`fecha`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2760,18 +2441,10 @@ CREATE TABLE `indicators` ( `lastMonthLostClients` int(11) DEFAULT NULL, `lastMonthNewClients` int(11) DEFAULT NULL, `lastMonthWebBuyingRate` decimal(5,4) DEFAULT NULL, - `productionHours__` decimal(10,1) DEFAULT NULL, - `dailyWorkersCost__` decimal(10,0) DEFAULT NULL, - `volumeM3__` decimal(10,0) DEFAULT NULL, - `salesValue__` decimal(10,0) DEFAULT NULL, - `valueM3__` decimal(10,0) DEFAULT NULL, - `hoursM3__` decimal(5,2) DEFAULT NULL, - `workerCostM3__` decimal(10,1) DEFAULT NULL, - `salesWorkersCostRate__` decimal(10,2) DEFAULT NULL, `thisWeekSales` decimal(10,2) DEFAULT NULL, `lastYearWeekSales` decimal(10,2) DEFAULT NULL, PRIMARY KEY (`updated`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los valores actuales para una consulta diaria rápida por los directivos.'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Almacena los valores actuales para una consulta diaria rápida por los directivos.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2784,16 +2457,16 @@ DROP TABLE IF EXISTS `inspeccionSS_2021`; CREATE TABLE `inspeccionSS_2021` ( `business_id` int(11) DEFAULT NULL, `id` int(11) NOT NULL DEFAULT 0, - `firstName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `lastName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `firstName` varchar(50) DEFAULT NULL, + `lastName` varchar(50) DEFAULT NULL, + `name` varchar(45) NOT NULL, `timed` datetime NOT NULL, `hours_week` smallint(6) DEFAULT NULL, `year` int(4) NOT NULL, `week` int(2) NOT NULL, `dated` date NOT NULL, `orden` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='bs.inspeccionSS_2021_add()'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='bs.inspeccionSS_2021_add()'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2826,14 +2499,6 @@ SET character_set_client = utf8; `incLastMonthNewClients` tinyint NOT NULL, `lastMonthWebBuyingRate` tinyint NOT NULL, `incLastMonthWebBuyingRate` tinyint NOT NULL, - `productionHours__` tinyint NOT NULL, - `dailyWorkersCost__` tinyint NOT NULL, - `volumeM3__` tinyint NOT NULL, - `salesValue__` tinyint NOT NULL, - `valueM3__` tinyint NOT NULL, - `hoursM3__` tinyint NOT NULL, - `workerCostM3__` tinyint NOT NULL, - `salesWorkersCostRate__` tinyint NOT NULL, `thisWeekSales` tinyint NOT NULL, `lastYearWeekSales` tinyint NOT NULL ) ENGINE=MyISAM */; @@ -2856,107 +2521,10 @@ CREATE TABLE `m3` ( `month` int(11) DEFAULT NULL, `week` int(11) DEFAULT NULL, `day` int(11) DEFAULT NULL, - `dayName` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL, + `dayName` varchar(12) DEFAULT NULL, `euros` decimal(10,2) DEFAULT 0.00, 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 `m3Silla__` --- - -DROP TABLE IF EXISTS `m3Silla__`; -/*!50001 DROP VIEW IF EXISTS `m3Silla__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `m3Silla__` ( - `fecha` tinyint NOT NULL, - `year` tinyint NOT NULL, - `month` tinyint NOT NULL, - `week` tinyint NOT NULL, - `day` tinyint NOT NULL, - `dayName` tinyint NOT NULL, - `Volumen` tinyint NOT NULL, - `Euros` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `manaCustomer` --- - -DROP TABLE IF EXISTS `manaCustomer`; -/*!50001 DROP VIEW IF EXISTS `manaCustomer`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `manaCustomer` ( - `Id_Cliente` tinyint NOT NULL, - `Mana` tinyint NOT NULL, - `dated` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `manaSpellersExcluded` --- - -DROP TABLE IF EXISTS `manaSpellersExcluded`; -/*!50001 DROP VIEW IF EXISTS `manaSpellersExcluded`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `manaSpellersExcluded` ( - `workerFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `mana_spellers` --- - -DROP TABLE IF EXISTS `mana_spellers`; -/*!50001 DROP VIEW IF EXISTS `mana_spellers`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `mana_spellers` ( - `Id_Trabajador` tinyint NOT NULL, - `size` tinyint NOT NULL, - `used` tinyint NOT NULL, - `prices_modifier_rate` tinyint NOT NULL, - `prices_modifier_activated` 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 `mana_spellers_excluded` --- - -DROP TABLE IF EXISTS `mana_spellers_excluded`; -/*!50001 DROP VIEW IF EXISTS `mana_spellers_excluded`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `mana_spellers_excluded` ( - `Id_Trabajador` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `mermasCache__` --- - -DROP TABLE IF EXISTS `mermasCache__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mermasCache__` ( - `Comprador` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `año` int(4) NOT NULL, - `Valor_Compra` decimal(10,0) DEFAULT NULL, - `Faltas` decimal(10,0) DEFAULT NULL, - `Basura` decimal(10,0) DEFAULT NULL, - PRIMARY KEY (`Comprador`,`año`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2972,12 +2540,12 @@ CREATE TABLE `nightTask` ( `finished` datetime DEFAULT NULL, `lastFinished` datetime DEFAULT NULL, `order` int(11) DEFAULT NULL, - `schema` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `procedure` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `error` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `errorCode` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `schema` varchar(45) NOT NULL, + `procedure` varchar(100) NOT NULL, + `error` varchar(255) DEFAULT NULL, + `errorCode` varchar(10) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -2996,7 +2564,7 @@ BEGIN IF NOT (NEW.`schema`REGEXP '^[0-9a-zA-Z_]+$') OR NOT (NEW.`procedure`REGEXP '^[0-9a-zA-Z_]+$') THEN CALL util.throw('ONLY_ALPHANUMERICS_ALLOWED'); - + END IF; END */;; @@ -3022,7 +2590,7 @@ BEGIN IF NOT (NEW.`schema`REGEXP '^[0-9a-zA-Z_]+$') OR NOT (NEW.`procedure`REGEXP '^[0-9a-zA-Z_]+$') THEN CALL util.throw('ONLY_ALPHANUMERICS_ALLOWED'); - + END IF; END */;; @@ -3041,9 +2609,9 @@ DROP TABLE IF EXISTS `nightTaskConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `nightTaskConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `logMail` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `logMail` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3081,7 +2649,7 @@ CREATE TABLE `payMethodClient` ( KEY `FkDateClientPayMethod` (`dated`,`clientFk`), CONSTRAINT `FkClientPayMethod` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FkPayMethodClient` FOREIGN KEY (`payMethodFk`) REFERENCES `vn`.`payMethod` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3094,28 +2662,12 @@ DROP TABLE IF EXISTS `payMethodClientEvolution`; CREATE TABLE `payMethodClientEvolution` ( `id` int(11) NOT NULL AUTO_INCREMENT, `dated` date NOT NULL, - `payMethodName` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `payMethodName` varchar(45) NOT NULL, `amountClient` int(11) NOT NULL, `amount` decimal(10,2) NOT NULL, `equalizationTax` decimal(10,2) 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 `produccion` --- - -DROP TABLE IF EXISTS `produccion`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `produccion` ( - `dated` date NOT NULL, - `m3` int(11) NOT NULL DEFAULT 0, - `cost` int(11) NOT NULL DEFAULT 0, - `eurosM3` decimal(10,2) NOT NULL DEFAULT 0.00, - PRIMARY KEY (`dated`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3184,45 +2736,40 @@ CREATE TABLE `sale` ( CONSTRAINT `sale_FK_1` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `sale_FK_2` FOREIGN KEY (`companyFk`) REFERENCES `vn`.`company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `sale_FK_3` FOREIGN KEY (`typeFk`) REFERENCES `vn`.`itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `salePersonEvolution__` +-- Table structure for table `salesByItemTypeDay` -- -DROP TABLE IF EXISTS `salePersonEvolution__`; +DROP TABLE IF EXISTS `salesByItemTypeDay`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `salePersonEvolution__` ( - `dated` date NOT NULL DEFAULT '0000-00-00', - `amount` decimal(10,2) NOT NULL DEFAULT 0.00, - `equalizationTax` decimal(10,2) NOT NULL DEFAULT 0.00, - `salesPersonFk` int(11) NOT NULL DEFAULT 0, - PRIMARY KEY (`dated`,`salesPersonFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TABLE `salesByItemTypeDay` ( + `itemTypeFk` smallint(5) unsigned NOT NULL, + `itemCategoryFk` int(10) unsigned NOT NULL, + `dated` date NOT NULL, + `netSale` int(11) NOT NULL DEFAULT 0, + `stems` int(11) NOT NULL DEFAULT 0, + `references` int(11) NOT NULL DEFAULT 0, + `trash` int(11) NOT NULL DEFAULT 0, + `faults` int(11) NOT NULL DEFAULT 0, + `claimed` decimal(10,2) NOT NULL DEFAULT 0.00, + `accepted` decimal(10,2) NOT NULL DEFAULT 0.00, + `sale` decimal(10,2) NOT NULL DEFAULT 0.00, + `buy` decimal(10,2) NOT NULL DEFAULT 0.00, + `saleComponent` decimal(10,2) NOT NULL DEFAULT 0.00, + `costComponent` decimal(10,2) NOT NULL DEFAULT 0.00, + `marginComponent` decimal(10,2) NOT NULL DEFAULT 0.00, + PRIMARY KEY (`itemTypeFk`,`dated`), + KEY `itemTypeSalesByweek_itemCategoryFk_idx` (`itemCategoryFk`), + KEY `itemTypeSalesByweek_period_idx` (`dated`), + CONSTRAINT `itemTypeSalesByweek_itemCategoryFk` FOREIGN KEY (`itemCategoryFk`) REFERENCES `vn`.`itemCategory` (`id`) ON UPDATE CASCADE, + CONSTRAINT `itemTypeSalesByweek_itemTypeFk` FOREIGN KEY (`itemTypeFk`) REFERENCES `vn`.`itemType` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Ventas diarias agrupadas por reino y familia'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `sale__` --- - -DROP TABLE IF EXISTS `sale__`; -/*!50001 DROP VIEW IF EXISTS `sale__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `sale__` ( - `saleFk` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `surcharge` tinyint NOT NULL, - `dated` tinyint NOT NULL, - `typeFk` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `companyFk` tinyint NOT NULL, - `margin` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `salesByWeek` -- @@ -3235,7 +2782,7 @@ CREATE TABLE `salesByWeek` ( `year` int(11) NOT NULL, `sales` double DEFAULT NULL, UNIQUE KEY `week` (`week`,`year`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3258,20 +2805,20 @@ CREATE TABLE `salesByclientSalesPerson` ( KEY `salesByclientSalesPerson_dated` (`dated`,`clientFk`,`amount`), CONSTRAINT `clientSalePersonEvolution_clientFk` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON UPDATE CASCADE, CONSTRAINT `salesByclientSalesPerson_salesPerson` FOREIGN KEY (`salesPersonFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Ventas diarias por cliente y comercial'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Ventas diarias por cliente y comercial'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `salesMonthlySnapshot` +-- Table structure for table `salesMonthlySnapshot___` -- -DROP TABLE IF EXISTS `salesMonthlySnapshot`; +DROP TABLE IF EXISTS `salesMonthlySnapshot___`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `salesMonthlySnapshot` ( +CREATE TABLE `salesMonthlySnapshot___` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `salesPersonName` varchar(100) COLLATE utf8_unicode_ci DEFAULT '', - `teamName` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `salesPersonName` varchar(100) DEFAULT '', + `teamName` varchar(100) DEFAULT NULL, `year` int(11) DEFAULT NULL, `month` int(11) DEFAULT NULL, `currentSale` decimal(10,3) DEFAULT NULL, @@ -3283,85 +2830,7 @@ CREATE TABLE `salesMonthlySnapshot` ( `newClientScore` decimal(10,3) DEFAULT NULL, `teamBossPlus` decimal(10,3) 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 `salesMonthlySnapshot__` --- - -DROP TABLE IF EXISTS `salesMonthlySnapshot__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `salesMonthlySnapshot__` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `workerFk` int(11) NOT NULL, - `year` int(4) NOT NULL, - `month` int(2) NOT NULL, - `departmentFk` int(11) NOT NULL, - `ownSalesAmount` decimal(10,2) DEFAULT 0.00, - `ownSalesPosition` int(11) DEFAULT NULL, - `ownSalesBonus` int(11) DEFAULT NULL, - `ownSalesScore` int(11) DEFAULT NULL, - `newClientsSalesAmount` decimal(10,2) DEFAULT NULL, - `newClientsSalesPosition` int(11) DEFAULT NULL, - `newClientsSalesBonus` int(11) DEFAULT NULL, - `newClientsScore` int(11) DEFAULT NULL, - `teamSalesAmount` decimal(10,2) DEFAULT NULL, - `teamSalesPosition` int(11) DEFAULT NULL, - `teamSalesBonus` int(11) DEFAULT NULL, - `teamSalesScore` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `workerFk_UNIQUE` (`workerFk`,`year`,`month`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='cada mes se guardan aqui los datos de forma estática, para consulta en grafana.'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `salesPerson` --- - -DROP TABLE IF EXISTS `salesPerson`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `salesPerson` ( - `workerFk` int(10) unsigned NOT NULL, - `year` int(4) NOT NULL, - `month` int(2) NOT NULL, - `amount` decimal(10,2) DEFAULT NULL, - `commission` decimal(10,2) DEFAULT NULL, - `leasedCommission` decimal(10,2) DEFAULT NULL COMMENT 'comision proveniente de clientes que han sido donados. Ver tabla Clientes_cedidos', - `cededCommission` decimal(10,2) DEFAULT NULL COMMENT 'comision generada por los clientes que han sido donados. Ver tabla Clientes_cedidos', - `newCommission` decimal(10,2) DEFAULT NULL, - `leasedReplacement` decimal(10,2) DEFAULT NULL, - `itemTypeBorrowed` decimal(10,2) DEFAULT NULL, - `portfolioWeight` decimal(10,2) DEFAULT NULL COMMENT 'Pero de la cartera del comercial a fecha vendedores.updated', - `updated` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - PRIMARY KEY (`workerFk`,`year`,`month`), - CONSTRAINT `salesPerson_FK` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`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 `salesPersonClient__` --- - -DROP TABLE IF EXISTS `salesPersonClient__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `salesPersonClient__` ( - `salesPersonFk` int(11) NOT NULL, - `clientFk` int(11) NOT NULL, - `year` int(4) NOT NULL, - `month` int(2) NOT NULL, - `amount` decimal(10,2) DEFAULT NULL, - `comission` decimal(10,2) DEFAULT NULL, - `comissionBorrowed` decimal(10,2) DEFAULT NULL, - `comissionLended` decimal(10,2) DEFAULT NULL, - `comissionNewClient` decimal(10,2) DEFAULT NULL, - `substitutionBorrowed` decimal(10,2) DEFAULT NULL, - `itemTypeBorrowed` decimal(10,2) DEFAULT NULL, - PRIMARY KEY (`salesPersonFk`,`clientFk`,`year`,`month`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Ventas por comercial por cliente'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='@deprecated 2022-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3381,72 +2850,49 @@ CREATE TABLE `salesPersonEvolution` ( PRIMARY KEY (`id`), KEY `salesPersonEvolution_salesPerson` (`salesPersonFk`), CONSTRAINT `salesPersonEvolution_salesPerson` FOREIGN KEY (`salesPersonFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Evolución Comerciales'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Evolución Comerciales'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `salesPerson__` +-- Table structure for table `salesPerson__` -- DROP TABLE IF EXISTS `salesPerson__`; -/*!50001 DROP VIEW IF EXISTS `salesPerson__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `salesPerson__` ( - `workerFk` tinyint NOT NULL, - `year` tinyint NOT NULL, - `month` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `commission` tinyint NOT NULL, - `leasedCommission` tinyint NOT NULL, - `cededCommission` tinyint NOT NULL, - `newCommission` tinyint NOT NULL, - `leasedReplacement` tinyint NOT NULL, - `itemTypeBorrowed` tinyint NOT NULL, - `portfolioWeight` tinyint NOT NULL, - `updated` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `vendedores` --- - -DROP TABLE IF EXISTS `vendedores`; -/*!50001 DROP VIEW IF EXISTS `vendedores`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `vendedores` ( - `Id_Trabajador` tinyint NOT NULL, - `año` tinyint NOT NULL, - `mes` tinyint NOT NULL, - `importe` tinyint NOT NULL, - `comision` tinyint NOT NULL, - `comisionArrendada` tinyint NOT NULL, - `comisionCedida` tinyint NOT NULL, - `comisionNuevos` tinyint NOT NULL, - `sustitucionArrendada` tinyint NOT NULL, - `itemTypeBorrowed` tinyint NOT NULL, - `portfolioWeight` tinyint NOT NULL, - `updated` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `vendedores_evolution` --- - -DROP TABLE IF EXISTS `vendedores_evolution`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `vendedores_evolution` ( +CREATE TABLE `salesPerson__` ( + `workerFk` int(10) unsigned NOT NULL, + `year` int(4) NOT NULL, + `month` int(2) NOT NULL, + `amount` decimal(10,2) DEFAULT NULL, + `commission` decimal(10,2) DEFAULT NULL, + `leasedCommission` decimal(10,2) DEFAULT NULL COMMENT 'comision proveniente de clientes que han sido donados. Ver tabla Clientes_cedidos', + `cededCommission` decimal(10,2) DEFAULT NULL COMMENT 'comision generada por los clientes que han sido donados. Ver tabla Clientes_cedidos', + `newCommission` decimal(10,2) DEFAULT NULL, + `leasedReplacement` decimal(10,2) DEFAULT NULL, + `itemTypeBorrowed` decimal(10,2) DEFAULT NULL, + `portfolioWeight` decimal(10,2) DEFAULT NULL COMMENT 'Pero de la cartera del comercial a fecha vendedores.updated', + `updated` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + PRIMARY KEY (`workerFk`,`year`,`month`), + CONSTRAINT `salesPerson_FK` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='@deprecated 2022-11'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vendedores_evolution__` +-- + +DROP TABLE IF EXISTS `vendedores_evolution__`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vendedores_evolution__` ( `workerFk` int(10) unsigned NOT NULL, `year` int(11) NOT NULL, `sales` decimal(10,2) DEFAULT NULL, `month` int(11) NOT NULL, PRIMARY KEY (`workerFk`,`year`,`month`), CONSTRAINT `evo_vendedor_trabajador` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='@deprecated 2022-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3484,9 +2930,9 @@ CREATE TABLE `ventas_contables` ( `reino_id` int(10) unsigned NOT NULL, `tipo_id` smallint(5) unsigned NOT NULL, `empresa_id` int(4) NOT NULL, - `gasto` varchar(10) CHARACTER SET latin1 NOT NULL, + `gasto` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL, PRIMARY KEY (`year`,`month`,`grupo`,`reino_id`,`tipo_id`,`empresa_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3497,10 +2943,10 @@ DROP TABLE IF EXISTS `waste`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `waste` ( - `buyer` varchar(30) CHARACTER SET utf8 NOT NULL, + `buyer` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `year` int(4) NOT NULL, `week` int(2) NOT NULL, - `family` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `family` varchar(30) NOT NULL, `itemFk` int(11) NOT NULL DEFAULT 0, `itemTypeFk` smallint(5) unsigned DEFAULT NULL, `saleTotal` decimal(16,0) DEFAULT NULL, @@ -3511,7 +2957,7 @@ CREATE TABLE `waste` ( KEY `waste_item_id` (`itemFk`), CONSTRAINT `waste_itemType_id` FOREIGN KEY (`itemTypeFk`) REFERENCES `vn`.`itemType` (`id`) ON UPDATE CASCADE, CONSTRAINT `waste_item_id` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3523,30 +2969,16 @@ DROP TABLE IF EXISTS `workerLabourDataByMonth`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerLabourDataByMonth` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `code` varchar(25) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(25) NOT NULL, `month` int(2) NOT NULL, `year` int(4) NOT NULL, `total` int(5) NOT NULL COMMENT 'Número de empleados', `permanent` int(5) NOT NULL COMMENT 'Número de empleados fijos', PRIMARY KEY (`id`), KEY `workerLabourDataByMonth_graph_idx` (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!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, - `amount` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `workerProductivity` -- @@ -3561,15 +2993,17 @@ CREATE TABLE `workerProductivity` ( `workerFk` int(10) unsigned NOT NULL, `volume` decimal(10,6) NOT NULL, `seconds` int(11) NOT NULL, - `actionFk` int(11) NOT NULL, + `actionFk` int(11) DEFAULT NULL, + `stateFk` tinyint(3) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `workerProductivity_warehouseFk_idx` (`warehouseFk`), KEY `workerProductivity_workerFk_idx` (`workerFk`), KEY `workerProductivity_roleFk_idx` (`actionFk`), - CONSTRAINT `workerProductivity_FK` FOREIGN KEY (`actionFk`) REFERENCES `vncontrol`.`accion` (`accion_id`) ON UPDATE CASCADE, + KEY `workerProductivity_FK_1` (`stateFk`), + CONSTRAINT `workerProductivity_FK_1` FOREIGN KEY (`stateFk`) REFERENCES `vn`.`state` (`id`) ON UPDATE CASCADE, CONSTRAINT `workerProductivity_warehouseFk` FOREIGN KEY (`warehouseFk`) REFERENCES `vn`.`warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `workerProductivity_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3584,57 +3018,7 @@ CREATE TABLE `workerProductivityConfig` ( `minSeconsPackager` int(11) DEFAULT NULL, `minSeconsItemPicker` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerSpeed__` --- - -DROP TABLE IF EXISTS `workerSpeed__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerSpeed__` ( - `workerCode` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `accion` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 1, - `LitrosMinuto` decimal(10,1) DEFAULT NULL, - `LitrosMinutoLastHour` decimal(10,1) DEFAULT NULL, - `lastUpdated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (`workerCode`,`warehouseFk`,`accion`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `zone_ETD__` --- - -DROP TABLE IF EXISTS `zone_ETD__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `zone_ETD__` ( - `zoneFk` int(11) DEFAULT NULL, - `totalVolume` decimal(5,1) DEFAULT NULL, - `remainingVolume` decimal(5,1) DEFAULT NULL, - `speed` decimal(10,2) NOT NULL DEFAULT 0.00, - `hourTheoretical` time DEFAULT NULL, - `hourPractical` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `zone_ETD_byTime` --- - -DROP TABLE IF EXISTS `zone_ETD_byTime`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `zone_ETD_byTime` ( - `theorical` time NOT NULL, - `practical` time NOT NULL DEFAULT '00:00:00', - `m3` decimal(10,1) NOT NULL DEFAULT 0.0, - PRIMARY KEY (`theorical`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3646,32 +3030,14 @@ 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 character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `nightTask_launchAll` ON SCHEDULE EVERY 1 DAY STARTS '2022-02-08 04:14:00' ON COMPLETION PRESERVE ENABLE DO CALL bs.nightTask_launchAll */ ;; -/*!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 `zone_ETD_byTime_Refresh` */;; -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 `zone_ETD_byTime_Refresh` ON SCHEDULE EVERY 5 MINUTE STARTS '2022-01-28 09:52:45' ON COMPLETION NOT PRESERVE ENABLE DO CALL bs.zone_ETD_byTime() */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `nightTask_launchAll` ON SCHEDULE EVERY 1 DAY STARTS '2022-02-08 04:14:00' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL bs.nightTask_launchAll */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -3687,9 +3053,9 @@ 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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -3699,67 +3065,16 @@ BEGIN DECLARE vTramo VARCHAR(20); DECLARE vHour INT; - + SET vHour = HOUR(vDateTime) ; - + SET vTramo = - CASE + CASE WHEN vHour BETWEEN 0 AND 14 THEN 'Mañana' WHEN vHour BETWEEN 15 AND 24 THEN 'Tarde' END ; RETURN vTramo; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `analisisComponentes__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `analisisComponentes__`() -BEGIN - -DECLARE vDateStart DATE DEFAULT '2016-01-01'; -DECLARE vDateEnd DATE DEFAULT '2016-11-30'; -DECLARE vDate DATE; - -SET vDate = vDateStart; - -DELETE FROM bs.ventasComponentes; - -WHILE vDate <= vDateEnd DO - - INSERT INTO bs.ventasComponentes - SELECT vDate as Fecha, mc.Id_Componente, cast(sum(m.Cantidad * mc.Valor) AS DECIMAL(10,2)) as Importe - FROM vn2008.Movimientos_componentes mc - JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento - JOIN bs.ventas v ON v.Id_Movimiento = mc.Id_Movimiento - WHERE v.fecha = vDate - AND empresa_id IN (442,567) - GROUP BY mc.Id_Componente; - - SET vDate = TIMESTAMPADD(DAY,1,vDate); - - IF DAY(vDate) MOD 28 = 0 THEN - - SELECT vDate; - - END IF; - -END WHILE; - - SELECT vDate; - - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -3782,7 +3097,7 @@ BEGIN * Inserta en la tabla bancos_evolution los saldos acumulados de cada banco * * @param vStartingDate Fecha desde la cual se recalculan la tabla bs.bancos_evolution - */ + */ DECLARE vCurrentDate DATE; DECLARE vMaxDate DATE DEFAULT TIMESTAMPADD(MONTH, 7, util.VN_CURDATE()); IF IFNULL(vStartingDate,0) < TIMESTAMPADD(YEAR, -5, util.VN_CURDATE()) THEN @@ -3796,49 +3111,49 @@ BEGIN SELECT vCurrentDate, Id_Banco, deuda FROM bs.bancos_evolution WHERE Fecha = TIMESTAMPADD(DAY,-1,vCurrentDate); - + WHILE vCurrentDate < vMaxDate DO -- insertar solo el dia de ayer INSERT INTO bs.bancos_evolution(Fecha ,Id_Banco, saldo) - SELECT vCurrentDate, Id_Banco, SUM(saldo) + SELECT vCurrentDate, Id_Banco, SUM(saldo) FROM ( SELECT Id_Banco ,saldo FROM bs.bancos_evolution WHERE Fecha = TIMESTAMPADD(DAY,-1,vCurrentDate) -- los saldos acumulados del dia anterior UNION ALL - + SELECT c.Id_Banco, IFNULL(SUM(Entrada),0) - IFNULL(SUM(Salida),0) as saldo FROM vn2008.Cajas c JOIN vn2008.Bancos b using(Id_Banco) -- saldos de las cajas - JOIN vn.accountingType at2 ON at2.id = b.cash + JOIN vn.accountingType at2 ON at2.id = b.cash WHERE at2.code IN ('wireTransfer','fundingLine') AND Cajafecha = vCurrentDate AND (Serie = 'MB' OR at2.code = 'fundingLine') GROUP BY Id_Banco - )sub + )sub GROUP BY Id_Banco ON DUPLICATE KEY UPDATE saldo = saldo + VALUES(saldo); - + SET vCurrentDate = TIMESTAMPADD(DAY,1,vCurrentDate); END WHILE; - -- Ahora actualizamos la quilla + -- Ahora actualizamos la quilla UPDATE bs.bancos_evolution be JOIN ( SELECT bp.Id_Banco, - sum(bp.importe) as quilla, t.dated - FROM vn.time t + FROM vn.time t JOIN vn2008.Bancos_poliza bp ON t.dated between apertura AND IFNULL(cierre, t.dated) WHERE t.dated BETWEEN vStartingDate AND vMaxDate GROUP BY Id_Banco, t.dated ) sub ON be.Id_Banco = sub.Id_Banco AND sub.dated = be.Fecha - SET be.quilla = sub.quilla; + SET be.quilla = sub.quilla; -- pagos futuros no concilidados INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo) SELECT t.dated, p.id_banco, - importe - FROM vn.time t + FROM vn.time t join vn2008.pago p ON p.fecha <= t.dated WHERE t.dated BETWEEN util.VN_CURDATE() AND vMaxDate AND p.fecha BETWEEN util.VN_CURDATE() AND vMaxDate @@ -3848,7 +3163,7 @@ BEGIN -- cobros futuros INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo) SELECT t.dated, r.Id_Banco, SUM(Entregado) - FROM vn.time t + FROM vn.time t JOIN vn2008.Recibos r ON r.Fechacobro <= t.dated WHERE r.Fechacobro > util.VN_CURDATE() AND r.Fechacobro <= vMaxDate AND t.dated BETWEEN util.VN_CURDATE() AND vMaxDate @@ -3858,10 +3173,10 @@ BEGIN -- saldos de la tabla prevision INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo) SELECT t.dated, sp.Id_Banco, SUM(Importe) - FROM vn.time t + FROM vn.time t JOIN vn2008.Saldos_Prevision sp ON sp.Fecha <= t.dated JOIN vn2008.Bancos b ON sp.Id_Banco = b.Id_Banco - JOIN vn.accountingType at2 ON at2.id = b.cash + JOIN vn.accountingType at2 ON at2.id = b.cash WHERE at2.code IN ('wireTransfer','fundingLine') AND t.dated BETWEEN vStartingDate AND vMaxDate GROUP BY t.dated, sp.Id_Banco @@ -3875,132 +3190,16 @@ BEGIN -- Deuda UPDATE bs.bancos_evolution be JOIN vn2008.Bancos b using(Id_Banco) - JOIN vn.accountingType at2 ON at2.id = b.cash + JOIN vn.accountingType at2 ON at2.id = b.cash SET be.deuda = IF(at2.code = 'fundingLine', be.saldo_aux, 0) , be.saldo = IF(at2.code = 'fundingLine', 0, be.saldo_aux) WHERE Fecha >= vStartingDate; - -- Liquidez + -- Liquidez update bs.bancos_evolution set liquidez = saldo - quilla + deuda WHERE Fecha >= vStartingDate; -- Disponibilidad update bs.bancos_evolution set `disponibilidad ajena` = - quilla + deuda WHERE Fecha >= vStartingDate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `bancos_evolution_add__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `bancos_evolution_add__`() -BEGIN -/** - * Inserta en la tabla bancos_evolution los saldos acumulados de cada banco - */ - DECLARE vCurrentDate DATE; - DECLARE vStartingDate DATE DEFAULT '2016-01-01'; - DECLARE vMaxDate DATE DEFAULT TIMESTAMPADD(MONTH, 7, util.VN_CURDATE()); - - DELETE FROM bs.bancos_evolution WHERE Fecha > vStartingDate; - - SET vCurrentDate = vStartingDate; - - WHILE vCurrentDate < vMaxDate DO - - REPLACE bs.bancos_evolution(Fecha ,Id_Banco, saldo) - - SELECT vCurrentDate - , Id_Banco - , sum(saldo) - - FROM - ( - SELECT Id_Banco ,saldo - FROM bs.bancos_evolution - WHERE Fecha = TIMESTAMPADD(DAY,-1,vCurrentDate) -- los saldos acumulados del dia anterior - - UNION ALL - - SELECT c.Id_Banco, IFNULL(sum(Entrada),0) - ifnull(sum(Salida),0) as saldo - FROM vn2008.Cajas c - JOIN vn2008.Bancos b using(Id_Banco) -- saldos de las cajas - WHERE cash IN (0,3) - AND Cajafecha = vCurrentDate - AND (Serie = 'MB' OR cash = 3) - GROUP BY Id_Banco - - )sub - GROUP BY Id_Banco; - - SET vCurrentDate = TIMESTAMPADD(DAY,1,vCurrentDate); - - END WHILE; - - -- Ahora actualizamos la quilla - UPDATE bs.bancos_evolution be - JOIN - ( - SELECT bp.Id_Banco, - sum(bp.importe) as quilla, t.dated - FROM vn.time t - JOIN vn2008.Bancos_poliza bp ON t.dated between apertura AND IFNULL(cierre, t.dated) - GROUP BY Id_Banco, t.dated - ) sub ON be.Id_Banco = sub.Id_Banco AND sub.dated = be.Fecha - SET be.quilla = sub.quilla; - - -- pagos futuros no concilidados - INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo) - SELECT t.dated, p.id_banco, - importe - FROM vn.time t - join vn2008.pago p ON p.fecha <= t.dated - WHERE p.fecha >= util.VN_CURDATE() - AND NOT conciliado - ON DUPLICATE KEY UPDATE saldo = saldo - VALUES(saldo); - - -- cobros futuros - INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo) - SELECT t.dated, r.Id_Banco, SUM(Entregado) - FROM vn.time t - JOIN vn2008.Recibos r ON r.Fechacobro <= t.dated - WHERE r.Fechacobro > util.VN_CURDATE() - GROUP BY t.dated, r.Id_Banco - ON DUPLICATE KEY UPDATE saldo = saldo + VALUES(saldo); - - -- saldos de la tabla prevision - INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo) - SELECT t.dated, sp.Id_Banco, SUM(Importe) - FROM vn.time t - JOIN vn2008.Saldos_Prevision sp ON sp.Fecha <= t.dated - JOIN vn2008.Bancos b ON sp.Id_Banco = b.Id_Banco - WHERE b.cash IN (0,3) - GROUP BY t.dated, sp.Id_Banco - ON DUPLICATE KEY UPDATE saldo = saldo + VALUES(saldo); - - -- Utilizamos el saldo_auxiliar para calcular lo dispuesto en las polizas - UPDATE bs.bancos_evolution be - SET saldo_aux = saldo; - - -- Deuda - UPDATE bs.bancos_evolution be - JOIN vn2008.Bancos using(Id_Banco) - SET be.deuda = IF(cash = 3, be.saldo_aux, 0) - , be.saldo = IF(cash = 3, 0, be.saldo_aux) - WHERE Fecha >= vStartingDate; - - -- Liquidez - update bs.bancos_evolution set liquidez = saldo - quilla + deuda WHERE Fecha >= vStartingDate; - - -- Disponibilidad - update bs.bancos_evolution set `disponibilidad ajena` = - quilla + deuda WHERE Fecha >= vStartingDate; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4019,14 +3218,14 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `campaignComparative`(vDateFrom DATE, vDateTo DATE) BEGIN - SELECT - workerName, - id, - name, - CAST(SUM(previousAmmount) AS DECIMAL(10, 0)) AS previousAmmount, - CAST(SUM(currentAmmount) AS DECIMAL(10, 0)) AS currentAmmount + SELECT + workerName, + id, + name, + CAST(SUM(previousAmmount) AS DECIMAL(10, 0)) AS previousAmmount, + CAST(SUM(currentAmmount) AS DECIMAL(10, 0)) AS currentAmmount FROM ( - (SELECT + (SELECT CONCAT(w.firstname, ' ', w.lastName) AS workerName, c.id, c.name, @@ -4035,11 +3234,11 @@ BEGIN FROM bs.ventas v INNER JOIN vn.`client` c ON v.Id_Cliente = c.id INNER JOIN vn.worker w ON c.salesPersonFk = w.id - WHERE v.fecha BETWEEN DATE_ADD(vDateFrom, INTERVAL - 1 YEAR) + WHERE v.fecha BETWEEN DATE_ADD(vDateFrom, INTERVAL - 1 YEAR) AND DATE_ADD(vDateTo, INTERVAL - 1 YEAR) GROUP BY w.id, v.Id_Cliente) UNION ALL - (SELECT + (SELECT CONCAT(w.firstname, ' ', w.lastName) AS workerName, c.id, c.name, @@ -4079,13 +3278,13 @@ BEGIN */ DELETE FROM bs.carteras WHERE Año >= YEAR(util.VN_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 + JOIN vn.worker w ON w.id = c.salesPersonFk WHERE t.year >= YEAR(util.VN_CURDATE()) - 1 GROUP BY w.code, t.year , t.month; END ;; @@ -4109,28 +3308,34 @@ BEGIN DECLARE vFourYearsAgo DATETIME; DECLARE vOneYearAgo DATETIME; DECLARE vTwoYearAgo DATETIME; + DECLARE vThreeYearAgo DATETIME; + SET vOneYearAgo = TIMESTAMPADD(YEAR, -1,util.VN_CURDATE()); SET vTwoYearAgo = TIMESTAMPADD(YEAR, -2,util.VN_CURDATE()); + SET vThreeYearAgo = TIMESTAMPADD(YEAR, -3,util.VN_CURDATE()); SET vFourYearsAgo = TIMESTAMPADD(YEAR, -4,util.VN_CURDATE()); DELETE FROM bs.clientNewBorn WHERE lastShipped < vOneYearAgo; - + DELETE FROM ventas WHERE fecha < vFourYearsAgo; - + DELETE FROM payMethodClient WHERE dated < vOneYearAgo; DELETE FROM payMethodClientEvolution WHERE dated < vFourYearsAgo; - DELETE FROM bs.salesByclientSalesPerson + DELETE FROM bs.salesByclientSalesPerson WHERE dated < vFourYearsAgo; - - DELETE FROM bs.m3 + + DELETE FROM bs.m3 WHERE fecha < vTwoYearAgo; + + DELETE FROM salesByItemTypeDay + WHERE dated < vThreeYearAgo; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4154,29 +3359,30 @@ BEGIN SET @tercerAviso := TIMESTAMPADD(MONTH,-3,util.VN_CURDATE()); TRUNCATE TABLE bs.clientDied; - + INSERT INTO bs.clientDied - SELECT c.id, - c.name as clientName, - maxIssued as lastInvoiced, - w.code AS workerCode, - b.code AS Boss, + SELECT c.id, + c.name clientName, + maxIssued lastInvoiced, + w.code workerCode, + b.code Boss, CASE - WHEN IFNULL(maxIssued,'2000-01-01') < @tercerAviso THEN 'Tercer Aviso' - WHEN maxIssued < @segundoAviso THEN 'Segundo Aviso' - WHEN maxIssued < @primerAviso THEN 'Primer Aviso' + WHEN IFNULL(maxIssued,'2000-01-01') < @tercerAviso THEN 'Tercer Aviso' + WHEN maxIssued < @segundoAviso THEN 'Segundo Aviso' + WHEN maxIssued < @primerAviso THEN 'Primer Aviso' END as Aviso FROM vn.client c JOIN vn.worker w ON w.id = c.salesPersonFk JOIN vn.worker b ON b.id = w.bossFk - JOIN bs.mana_spellers ms ON ms.Id_Trabajador = c.salesPersonFk + JOIN vn.workerMana wm ON wm.workerFk = c.salesPersonFk LEFT JOIN (SELECT clientFk, max(issued) as maxIssued FROM vn.invoiceOut GROUP BY clientFk) io ON io.clientFk = c.id WHERE (maxIssued IS NULL OR maxIssued < @primerAviso) AND c.created < @tercerAviso; DELETE cd.* FROM bs.clientDied cd JOIN vn.ticket t ON t.clientFk = cd.id - WHERE t.refFk IS NULL AND t.shipped >=TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()); + WHERE t.refFk IS NULL + AND t.shipped >=TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4197,16 +3403,16 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `clientNewBorn_recalc`() BLOCK1: BEGIN DECLARE vClientFk INT; - DECLARE vShipped DATE; + DECLARE vShipped DATE; DECLARE vPreviousShipped DATE; - DECLARE vDone boolean; - DECLARE cur cursor for - - SELECT clientFk, firstShipped - FROM bs.clientNewBorn; - - DECLARE continue HANDLER FOR NOT FOUND SET vDone = TRUE; - SET vDone := FALSE; + DECLARE vDone boolean; + DECLARE cur cursor for + + SELECT clientFk, firstShipped + FROM bs.clientNewBorn; + + DECLARE continue HANDLER FOR NOT FOUND SET vDone = TRUE; + SET vDone := FALSE; DELETE FROM bs.clientNewBorn WHERE isModified = FALSE; @@ -4218,7 +3424,7 @@ BLOCK1: BEGIN WHERE t.shipped BETWEEN TIMESTAMPADD(YEAR, -1, util.VN_CURDATE()) AND util.VN_CURDATE() AND cb.isModified is null GROUP BY c.id; OPEN cur; - + LOOP1: LOOP SET vDone := FALSE; FETCH cur INTO vClientFk, vShipped; @@ -4229,37 +3435,37 @@ BLOCK1: BEGIN END IF; BLOCK2: BEGIN - DECLARE vCurrentShipped DATE; - DECLARE vDone2 boolean; + DECLARE vCurrentShipped DATE; + DECLARE vDone2 boolean; DECLARE cur2 CURSOR FOR - SELECT shipped - FROM vn.ticket + SELECT shipped + FROM vn.ticket WHERE clientFk = vClientFk AND shipped <= util.VN_CURDATE() ORDER BY shipped DESC; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone2 = TRUE; SET vDone2 := FALSE; OPEN cur2; - + SET vPreviousShipped := vShipped; LOOP2: LOOP SET vDone2 := FALSE; FETCH cur2 INTO vCurrentShipped; - + IF DATEDIFF(vPreviousShipped,vCurrentShipped) > 365 THEN - UPDATE bs.clientNewBorn - SET firstShipped = vPreviousShipped + UPDATE bs.clientNewBorn + SET firstShipped = vPreviousShipped WHERE clientFk= vClientFk; - + CLOSE cur2; - LEAVE LOOP2; + LEAVE LOOP2; END IF; - + SET vPreviousShipped := vCurrentShipped; IF vDone2 THEN - UPDATE bs.clientNewBorn - SET firstShipped = vCurrentShipped + UPDATE bs.clientNewBorn + SET firstShipped = vCurrentShipped WHERE clientFk= vClientFk; CLOSE cur2; LEAVE LOOP2; @@ -4269,14 +3475,14 @@ BLOCK1: BEGIN END BLOCK2; END LOOP LOOP1; - UPDATE bs.clientNewBorn cnb + UPDATE bs.clientNewBorn cnb LEFT JOIN (SELECT DISTINCT t.clientFk FROM vn.ticket t JOIN vn.productionConfig pc WHERE t.shipped BETWEEN util.VN_CURDATE() + INTERVAL -(`notBuyingMonths`) MONTH AND util.VN_CURDATE() + INTERVAL -(`pc`.`rookieDays`) DAY) notRookie ON notRookie.clientFk = cnb.clientFk - SET cnd.isRookie = ISNULL(notRookie.clientFk); - + SET cnd.isRookie = ISNULL(notRookie.clientFk); + END BLOCK1 ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4297,141 +3503,16 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `comercialesCompleto`(IN vWorker INT BEGIN DECLARE vAYearAgoStarted DATE DEFAULT DATE_FORMAT(TIMESTAMPADD(YEAR, - 1, vDate), '%Y-%m-01'); DECLARE vAYearAgoEnded DATE DEFAULT TIMESTAMPADD(YEAR, - 1, LAST_DAY(vDate)); - - CALL vn.worker_GetHierarchy(vWorker); - - INSERT IGNORE INTO tmp.workerHierarchyList (workerFk) - SELECT wd2.workerFk - FROM vn.workerDepartment wd2 - WHERE wd2.workerFk = vWorker; - - -- Falta que en algunos casos solo tenga en cuenta los tipos afectados. - SELECT - c.Id_Cliente id_cliente, - c.calidad, - c.Cliente cliente, - cr.recobro * 100 tarifa, - c.Telefono telefono, - c.movil, - c.POBLACION poblacion, - p.`name` provincia, - vn2008.red(f.futur) futur, - c.Credito credito, - pm.`name` forma_pago, - vn2008.red(c365 / 12) consumo_medio365, - vn2008.red(c365) consumo365, - vn2008.red(CmLy.peso) peso_mes_año_pasado, - vn2008.red(CmLy.peso * 1.19) objetivo, - tr.CodigoTrabajador, - vn2008.red(mes_actual.consumo) consumoMes, - vn2008.red(IFNULL(mes_actual.consumo, 0) - IFNULL(CmLy.peso * 1.19, 0)) como_lo_llevo, - DATE(LastTicket) ultimo_ticket, - dead.muerto, - g.Greuge, - cr.recobro - FROM - vn2008.Clientes c - LEFT JOIN - (SELECT g.Id_Cliente, CAST( SUM(Importe) as DECIMAL(12,2)) AS Greuge - FROM vn2008.Greuges g - JOIN vn.`client` c ON c.id = g.Id_Cliente - LEFT JOIN vn.worker w ON c.salesPersonFk = w.id - WHERE (c.salesPersonFk = vWorker OR w.bossFk = vWorker) - GROUP BY Id_Cliente - ) g ON g.Id_Cliente = c.Id_Cliente - LEFT JOIN - vn2008.province p ON p.province_id = c.province_id - JOIN - vn2008.pay_met pm ON pm.id = c.pay_met_id - LEFT JOIN - vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador - LEFT JOIN - bi.claims_ratio cr on cr.Id_Cliente = c.Id_Cliente - LEFT JOIN - (SELECT v.Id_Cliente, SUM(importe) c365 -- optimizat de 6s /5.3s/ 4.7s a 0.3/0.4/0.3 - FROM bs.ventas v - JOIN vn2008.Clientes c ON c.Id_Cliente = v.Id_Cliente - WHERE v.fecha BETWEEN TIMESTAMPADD(YEAR, - 1, vDate) AND vDate - GROUP BY v.Id_Cliente) c365 ON c365.Id_Cliente = c.Id_Cliente - LEFT JOIN - (SELECT - Id_Cliente, SUM(importe) consumo - FROM - bs.ventas v - INNER JOIN vn2008.Clientes c USING (Id_Cliente) - LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador - WHERE - (c.Id_Trabajador = vWorker OR tr.boss = vWorker) - AND (v.fecha BETWEEN TIMESTAMPADD(DAY, - DAY(vDate) + 1, vDate) AND TIMESTAMPADD(DAY, - 1, vDate)) - GROUP BY Id_Cliente) mes_actual ON mes_actual.Id_Cliente = c.Id_Cliente - LEFT JOIN - (SELECT t.Id_Cliente, SUM(m.preu * m.Cantidad * (1 - m.Descuento / 100)) futur - FROM vn2008.Tickets t - JOIN vn2008.Clientes c ON c.Id_Cliente = t.Id_Cliente - JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket - LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador - WHERE - (c.Id_Trabajador = vWorker OR tr.boss = vWorker) - AND t.Fecha BETWEEN vDate AND util.dayEnd(LAST_DAY(vDate)) - GROUP BY Id_Cliente) f ON c.Id_Cliente = f.Id_Cliente - LEFT JOIN - (SELECT MAX(t.Fecha) LastTicket, c.Id_Cliente - FROM vn2008.Tickets t - JOIN vn2008.Clientes c ON c.Id_cliente = t.Id_Cliente - LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador - WHERE - (c.Id_Trabajador = vWorker OR tr.boss = vWorker) - GROUP BY t.Id_Cliente) LastTicket ON LastTicket.Id_Cliente = c.Id_Cliente - LEFT JOIN - ( - SELECT SUM(importe) peso, c.Id_Cliente - FROM bs.ventas v - JOIN vn2008.Clientes c ON c.Id_Cliente = v.Id_Cliente - LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador - WHERE fecha BETWEEN vAYearAgoStarted and vAYearAgoEnded - AND (c.Id_Trabajador = vWorker OR tr.boss = vWorker) - GROUP BY c.Id_Cliente) CmLy ON CmLy.Id_Cliente = c.Id_Cliente - LEFT JOIN - (SELECT c.Id_Cliente, - IF(MAX(Fecha) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto - FROM vn2008.Facturas f - JOIN vn2008.Clientes c ON c.Id_cliente = f.Id_Cliente - LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador - WHERE (c.Id_Trabajador = vWorker OR tr.boss = vWorker) - GROUP BY Id_Cliente) dead ON dead.Id_Cliente = c.Id_Cliente - JOIN tmp.workerHierarchyList s ON s.workerFk = c.Id_Trabajador; - DROP TEMPORARY TABLE tmp.workerHierarchyList; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `comercialesCompleto__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `comercialesCompleto__`(IN vWorker INT, vDate DATE) -BEGIN - DECLARE vAYearAgoStarted DATE DEFAULT DATE_FORMAT(TIMESTAMPADD(YEAR, - 1, vDate), '%Y-%m-01'); - DECLARE vAYearAgoEnded DATE DEFAULT TIMESTAMPADD(YEAR, - 1, LAST_DAY(vDate)); - CALL vn.worker_GetHierarchy(vWorker); - + INSERT IGNORE INTO tmp.workerHierarchyList (workerFk) SELECT wd2.workerFk FROM vn.workerDepartment wd2 WHERE wd2.workerFk = vWorker; - + -- Falta que en algunos casos solo tenga en cuenta los tipos afectados. - SELECT + SELECT c.Id_Cliente id_cliente, c.calidad, c.Cliente cliente, @@ -4457,7 +3538,7 @@ BEGIN FROM vn2008.Clientes c LEFT JOIN - (SELECT g.Id_Cliente, CAST( SUM(Importe) as DECIMAL(12,2)) AS Greuge + (SELECT g.Id_Cliente, CAST( SUM(Importe) as DECIMAL(12,2)) AS Greuge FROM vn2008.Greuges g JOIN vn.`client` c ON c.id = g.Id_Cliente LEFT JOIN vn.worker w ON c.salesPersonFk = w.id @@ -4479,15 +3560,15 @@ BEGIN WHERE v.fecha BETWEEN TIMESTAMPADD(YEAR, - 1, vDate) AND vDate GROUP BY v.Id_Cliente) c365 ON c365.Id_Cliente = c.Id_Cliente LEFT JOIN - (SELECT + (SELECT Id_Cliente, SUM(importe) consumo FROM bs.ventas v INNER JOIN vn2008.Clientes c USING (Id_Cliente) LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador WHERE - (c.Id_Trabajador = vWorker OR tr.boss = vWorker) - AND (v.fecha BETWEEN TIMESTAMPADD(DAY, - DAY(vDate) + 1, vDate) AND TIMESTAMPADD(DAY, - 1, vDate)) + (c.Id_Trabajador = vWorker OR tr.boss = vWorker) + AND (v.fecha BETWEEN TIMESTAMPADD(DAY, - DAY(vDate) + 1, vDate) AND TIMESTAMPADD(DAY, - 1, vDate)) GROUP BY Id_Cliente) mes_actual ON mes_actual.Id_Cliente = c.Id_Cliente LEFT JOIN (SELECT t.Id_Cliente, SUM(m.preu * m.Cantidad * (1 - m.Descuento / 100)) futur @@ -4547,17 +3628,17 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `compradores_add`(IN vYear INT, IN v BEGIN /** * Sustituye los registros de "bs.compradores". - * + * * @param vYear: año ventas * @param vWeekFrom: semana desde * @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 + SELECT it.workerFk AS Id_Trabajador, vYear AS año, tm.week AS semana, SUM(importe) AS importe, 0 AS comision FROM bs.ventas v JOIN vn.time tm ON tm.dated = v.fecha - JOIN vn.itemType it ON it.id = v.tipo_id - WHERE tm.year = vYear + JOIN vn.itemType it ON it.id = v.tipo_id + WHERE tm.year = vYear AND tm.week BETWEEN vWeekFrom AND vWeekTo AND it.categoryFk != 6 GROUP BY it.workerFk, tm.week; @@ -4583,21 +3664,22 @@ BEGIN DECLARE vYear INT; DECLARE vWeek INT; DECLARE done BOOL DEFAULT FALSE; - + DECLARE rs CURSOR FOR SELECT year, week FROM vn.time - WHERE (year = vYear AND week >= vWeek) - OR year > vYear; - + WHERE dated <= util.VN_CURDATE() + AND year = vYear + AND week >= vWeek; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - SELECT MAX(año) INTO vYear + + SELECT MAX(año) INTO vYear FROM compradores; - + SELECT MAX(semana) INTO vWeek - FROM compradores - WHERE año = vYear; + FROM compradores + WHERE año = vYear; OPEN rs; @@ -4606,7 +3688,7 @@ BEGIN WHILE NOT done DO CALL compradores_add(vYear, vWeek, vWeek); - + FETCH rs INTO vYear, vWeek; END WHILE; @@ -4614,7 +3696,7 @@ BEGIN CLOSE rs; CALL compradores_evolution_add; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4646,10 +3728,10 @@ DECLARE i INT DEFAULT 1; SELECT TIMESTAMPADD(DAY,1,MAX(fecha)) INTO datFEC FROM bs.compradores_evolution; IF ISNULL(datFEC) THEN - - SELECT min(fecha) INTO datFEC + + SELECT min(fecha) INTO datFEC FROM bs.ventas; - + INSERT INTO bs.compradores_evolution( Id_Trabajador , fecha , importe) @@ -4658,19 +3740,19 @@ SELECT TIMESTAMPADD(DAY,1,MAX(fecha)) INTO datFEC FROM bs.compradores_evolution; JOIN vn2008.Tipos tp using(tipo_id) WHERE fecha = datFEC GROUP BY Id_Trabajador; - + SET datFEC = TIMESTAMPADD(DAY, 1, datFEC); - + END IF; WHILE datFEC < util.VN_CURDATE() DO - - IF i mod 150 = 0 THEN + + IF i mod 150 = 0 THEN SELECT datFEC; END IF; - + SET i = i + 1; - + REPLACE bs.compradores_evolution( Id_Trabajador , fecha , importe) @@ -4678,7 +3760,7 @@ SELECT TIMESTAMPADD(DAY,1,MAX(fecha)) INTO datFEC FROM bs.compradores_evolution; SELECT Id_Trabajador , datFEC as fecha , sum(importe) as importe - + FROM ( @@ -4686,17 +3768,17 @@ SELECT TIMESTAMPADD(DAY,1,MAX(fecha)) INTO datFEC FROM bs.compradores_evolution; , importe FROM bs.compradores_evolution WHERE fecha = TIMESTAMPADD(DAY,-1,datFEC) -- las ventas acumuladas del dia anterior - + UNION ALL - + SELECT Id_Trabajador , importe * IF(v.fecha < datFEC,-1,1) -- se restan las ventas del año anterior y se suman las del actual FROM bs.ventas v JOIN vn2008.Tipos tp using(tipo_id) WHERE fecha IN (datFEC, TIMESTAMPADD(DAY,-365,datFEC)) AND reino_id != 6 - - )sub + + )sub GROUP BY Id_Trabajador; SET datFEC = TIMESTAMPADD(DAY,1,datFEC); @@ -4726,49 +3808,49 @@ 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 + + SELECT TIMESTAMPADD(DAY,1,MAX(fecha)) + INTO datFEC FROM bs.fondo_maniobra; - + WHILE datFEC < util.VN_CURDATE() DO - + IF DAY(datFEC) MOD 28 = 0 THEN -- esto solo sirve para no aburrirse mientras esperamos... 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(io.amount) AS Facturas FROM vn.invoiceOut io - JOIN vn.client c ON io.clientFk = c.id + JOIN vn.client c ON io.clientFk = c.id WHERE c.isRelevant - AND io.companyFk <> 1381 + AND io.companyFk <> 1381 AND io.issued BETWEEN '2011-01-01' AND datFEC ) fac JOIN ( SELECT - SUM(r.amountPaid) AS Cobros - FROM vn.receipt r - JOIN vn.client c ON r.clientFk = c.id - WHERE c.isRelevant + FROM vn.receipt r + JOIN vn.client c ON r.clientFk = c.id + WHERE c.isRelevant AND r.companyFk <> 1381 AND r.payed BETWEEN '2011-01-01' AND datFEC ) cob JOIN ( SELECT - SUM(id.amount) AS Recibidas - FROM vn.invoiceIn ii - JOIN vn.invoiceInDueDay id ON ii.id = id.invoiceInFk + FROM vn.invoiceIn ii + JOIN vn.invoiceInDueDay id ON ii.id = id.invoiceInFk WHERE ii.companyFk <> 1381 AND ii.issued BETWEEN '2015-01-01' AND datFEC ) rec JOIN ( SELECT SUM(p.amount) AS Pagos - FROM vn.payment p - WHERE p.companyFk <>1381 + FROM vn.payment p + WHERE p.companyFk <>1381 AND p.received BETWEEN '2015-01-01' AND datFEC ) pag; - + UPDATE bs.fondo_maniobra JOIN ( SELECT AVG(fondo) AS media @@ -4776,7 +3858,7 @@ BEGIN WHERE fecha <= datFEC ) sub SET fondo_medio = media WHERE fecha = datFEC; - + SET datFEC = TIMESTAMPADD(DAY,1,datFEC); END WHILE; @@ -4800,7 +3882,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `fruitsEvolution`() BEGIN -select Id_Cliente, +select Id_Cliente, Cliente, count(semana) as semanas, (w.code IS NOT NULL) isWorker from ( select distinct v.Id_Cliente, c.name as Cliente, week(fecha, 3) as semana @@ -4831,170 +3913,147 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `indicatorsUpdate`(vDated DATE) BEGIN - DECLARE oneYearBefore DATE DEFAULT TIMESTAMPADD(YEAR,-1,vDated); - DECLARE twoMonthsBefore DATE DEFAULT TIMESTAMPADD(DAY,-60,vDated); - DECLARE oneMonthBefore DATE DEFAULT TIMESTAMPADD(DAY,-30,vDated); - DECLARE vWeek INT; - - REPLACE indicators(updated) + DECLARE oneYearBefore DATE DEFAULT TIMESTAMPADD(YEAR,-1, vDated); + DECLARE twoMonthsBefore DATE DEFAULT TIMESTAMPADD(DAY,-60, vDated); + DECLARE oneMonthBefore DATE DEFAULT TIMESTAMPADD(DAY,-30, vDated); + DECLARE vWeek INT; + + REPLACE indicators(updated) VALUES(vDated); - - -- Ventas totales del ultimo año + + -- Ventas totales del ultimo año UPDATE indicators - SET lastYearSales = - ( - SELECT SUM(importe + recargo) - FROM bs.ventas v - JOIN vn2008.empresa e ON e.id = v.empresa_id - JOIN vn2008.empresa_grupo eg ON eg.empresa_grupo_id = e.empresa_grupo - WHERE fecha BETWEEN oneYearBefore AND vDated - AND eg.grupo = 'Verdnatura' - ) + SET lastYearSales = + (SELECT SUM(importe + recargo) + FROM ventas v + JOIN vn2008.empresa e ON e.id = v.empresa_id + JOIN vn2008.empresa_grupo eg ON eg.empresa_grupo_id = e.empresa_grupo + WHERE fecha BETWEEN oneYearBefore AND vDated + AND eg.grupo = 'Verdnatura' + ) WHERE updated = vDated; - - -- Greuge total acumulado + + -- Greuge total acumulado UPDATE indicators - SET totalGreuge = - ( - SELECT SUM(amount) - FROM vn.greuge - WHERE shipped <= vDated - ) + SET totalGreuge = + (SELECT SUM(amount) + FROM vn.greuge + WHERE shipped <= vDated + ) WHERE updated = vDated; - - -- Tasa de morosidad con respecto a las ventas del último mes + + -- Tasa de morosidad con respecto a las ventas del último mes UPDATE indicators - SET latePaymentRate = - (SELECT SUM(amount) FROM bi.defaulters WHERE date = vDated and amount > 0) - / - ( SELECT SUM(importe + recargo) FROM bs.ventas WHERE fecha BETWEEN oneMonthBefore AND vDated) + SET latePaymentRate = + (SELECT SUM(amount) + FROM bi.defaulters + WHERE date = vDated AND amount > 0) + / + (SELECT SUM(importe + recargo) + FROM ventas + WHERE fecha BETWEEN oneMonthBefore AND vDated) WHERE updated = vDated; - + -- Número de trabajadores activos - UPDATE indicators - SET countEmployee = - ( SELECT CAST(SUM(hours_week) / 40 AS DECIMAL (10 , 2 )) - FROM - postgresql.business AS b - JOIN postgresql.profile p ON p.profile_id = b.provider_id - JOIN postgresql.person pe ON pe.person_id = p.person_id - LEFT JOIN - postgresql.business_labour AS bl ON bl.business_id = b.business_id - LEFT JOIN - postgresql.calendar_labour_type AS cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id - WHERE - (vDated BETWEEN b.date_start AND b.date_end OR (b.date_end IS NULL AND b.date_start <= vDated)) - AND pe.name = 'VERDNATURA LEVANTE SL' + UPDATE indicators + SET countEmployee = + (SELECT CAST(SUM(cl.hours_week) / 40 AS DECIMAL (10, 2)) + FROM vn.business b + JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = b.calendarTypeFk + WHERE vDated BETWEEN b.started AND IFNULL(b.ended, vDated) + AND b.companyCodeFk = 'VNL' ) WHERE updated = vDated; -- Maná medio acumulado por comercial - UPDATE indicators - SET averageMana = - (SELECT avg(used) - FROM bs.mana_spellers + UPDATE indicators + SET averageMana = + (SELECT AVG(amount) + FROM vn.workerMana ) WHERE updated = vDated; - + -- Número de clientes que han comprado en los últimos 30 dias - UPDATE indicators - SET lastMonthActiveClients = + UPDATE indicators + SET lastMonthActiveClients = (SELECT COUNT(DISTINCT t.clientFk) FROM vn.ticket t WHERE t.shipped BETWEEN oneMonthBefore AND vDated ) - WHERE updated = vDated; - - -- Número de clientes que no han comprado en los últimos 30 dias, pero compraron en los 30 anteriores - UPDATE indicators - SET lastMonthLostClients = + WHERE updated = vDated; + + -- Número de clientes que no han comprado en los últimos 30 dias, pero compraron en los 30 anteriores + UPDATE indicators + SET lastMonthLostClients = (SELECT COUNT(lm.clientFk) - FROM - ( - SELECT DISTINCT t.clientFk + FROM + (SELECT DISTINCT t.clientFk FROM vn.ticket t WHERE t.shipped BETWEEN oneMonthBefore AND vDated ) cm RIGHT JOIN - ( - SELECT DISTINCT t.clientFk + (SELECT DISTINCT t.clientFk FROM vn.ticket t WHERE t.shipped >= twoMonthsBefore AND t.shipped < oneMonthBefore ) lm ON lm.clientFk = cm.clientFk - WHERE cm.clientFk IS NULL + WHERE cm.clientFk IS NULL ) - WHERE updated = vDated; - - -- Número de clientes que han comprado en los últimos 30 dias, pero no compraron en los 30 anteriores - UPDATE indicators - SET lastMonthNewClients = + WHERE updated = vDated; + + -- Número de clientes que han comprado en los últimos 30 dias, pero no compraron en los 30 anteriores + UPDATE indicators + SET lastMonthNewClients = (SELECT COUNT(cm.clientFk) - FROM - ( - SELECT DISTINCT t.clientFk + FROM + (SELECT DISTINCT t.clientFk FROM vn.ticket t WHERE t.shipped BETWEEN oneMonthBefore AND vDated ) cm LEFT JOIN - ( - SELECT DISTINCT t.clientFk + (SELECT DISTINCT t.clientFk FROM vn.ticket t WHERE t.shipped >= twoMonthsBefore AND t.shipped < oneMonthBefore ) lm ON lm.clientFk = cm.clientFk - WHERE lm.clientFk IS NULL + WHERE lm.clientFk IS NULL ) - WHERE updated = vDated; - - -- Porcentaje de autopedidos sobre los pedidos totales - UPDATE indicators - SET lastMonthWebBuyingRate = - ( SELECT (SUM(source_app != '') - SUM(source_app = 'TPV')) / SUM(source_app != '') - FROM hedera.`order` - WHERE date_send BETWEEN oneMonthBefore AND vDated - ) - WHERE updated = vDated; - - /* - -- Indicadores de producción - UPDATE indicators i - JOIN productionIndicators pi ON pi.dated = i.updated - SET i.productionHours = pi.productionHours, - i.dailyWorkersCost = pi.dailyWorkersCost, - i.volumeM3 = pi.volumeM3, - i.salesValue = pi.salesValue, - i.valueM3 = pi.valueM3, - i.hoursM3 = pi.hoursM3, - i.workerCostM3 = pi.workerCostM3, - i.salesWorkersCostRate = pi.salesWorkersCostRate - WHERE updated BETWEEN oneMonthBefore AND vDated; - */ + WHERE updated = vDated; - -- CAP Para el calculo de las ventas agrupado por semanas - - SELECT week - FROM vn.time - WHERE dated=vDated INTO vWeek; - - TRUNCATE `bs`.`salesByWeek`; - - INSERT INTO `bs`.`salesByWeek` (week,year,sales) - SELECT `t`.`week` AS `week`,`t`.`year` AS `year`, SUM(`v`.`importe` + `v`.`recargo`) AS `sales` - FROM `bs`.`ventas` `v` - LEFT JOIN `vn`.`time` `t` ON `t`.`dated` = fecha - GROUP BY `t`.`week` , `t`.`year` - ORDER BY `t`.`week` , `t`.`year`; - - -- CAP Indicador Ventas semana actual - UPDATE indicators i - JOIN `bs`.`salesByWeek` s ON s.week= vWeek AND s.year = YEAR(vDated) + -- Porcentaje de autopedidos sobre los pedidos totales + UPDATE indicators + SET lastMonthWebBuyingRate = + (SELECT (SUM(source_app != '') - SUM(source_app = 'TPV')) / SUM(source_app != '') + FROM hedera.`order` + WHERE date_send BETWEEN oneMonthBefore AND vDated + ) + WHERE updated = vDated; + + -- Cálculo de las ventas agrupado por semanas + SELECT week INTO vWeek + FROM vn.time + WHERE dated = vDated; + + TRUNCATE salesByWeek; + + INSERT INTO salesByWeek (week, year, sales) + SELECT t.week, t.year, SUM(v.importe + v.recargo) sales + FROM ventas v + LEFT JOIN vn.time t ON t.dated = fecha + GROUP BY t.week, t.year + ORDER BY t.week, t.year; + + -- Indicador Ventas semana actual + UPDATE indicators i + JOIN salesByWeek s ON s.week= vWeek + AND s.year = YEAR(vDated) SET i.thisWeekSales = s.sales - WHERE updated = vDated; - - -- CAP indicador ventas semana actual en el año pasado - UPDATE indicators i - JOIN `bs`.`salesByWeek` s ON s.week= vWeek AND s.year = YEAR(vDated)-1 + WHERE updated = vDated; + + -- Indicador ventas semana actual en el año pasado + UPDATE indicators i + JOIN salesByWeek s ON s.week = vWeek + AND s.year = YEAR(vDated)-1 SET i.lastYearWeekSales = s.sales WHERE updated = vDated; @@ -5022,15 +4081,15 @@ BEGIN SELECT IFNULL(TIMESTAMPADD(DAY,1,MAX(updated)), '2018-04-01') INTO vDated FROM bs.indicators; - + WHILE vDated < util.VN_CURDATE() DO - + CALL indicatorsUpdate(vDated); - + SELECT TIMESTAMPADD(DAY,1,MAX(updated)) INTO vDated FROM bs.indicators; - + END WHILE; END ;; @@ -5055,29 +4114,30 @@ BEGIN TRUNCATE bs.inspeccionSS_2021; INSERT INTO bs.inspeccionSS_2021 - SELECT wbd.business_id , - w.id, - w.firstName, - w.lastName, - d.name , - wtc.timed , - cl.hours_week , - t.`year` , - t.week , - t.dated , - 0 AS orden - FROM vn.workerTimeControl wtc - JOIN vn.worker w ON w.id = wtc.userFk - JOIN vn.workerBusinessDated wbd ON wbd.workerFk = wtc.userFk AND wbd.dated = date(wtc.timed) - JOIN vn.time t ON t.dated = wbd.dated - JOIN postgresql.business_labour bl ON bl.business_id = wbd.business_id - JOIN postgresql.calendar_labour_type AS cl ON bl.calendar_labour_type_id = cl.calendar_labour_type_id - JOIN vn.department d ON d.id = bl.department_id - JOIN vn.department d2 ON d2.id = d.parentFk AND d2.name = 'PRODUCCION' - WHERE wtc.timed BETWEEN '2020-10-01' AND '2021-04-19' - AND d.lft BETWEEN d2.lft AND d2.rgt - AND lastName NOT LIKE 'FERRER%'; - + SELECT wbd.businessFk , + w.id, + w.firstName, + w.lastName, + d.name , + wtc.timed , + cl.hours_week , + t.`year` , + t.week , + t.dated , + 0 AS orden + FROM vn.workerTimeControl wtc + JOIN vn.worker w ON w.id = wtc.userFk + JOIN vn.workerBusinessDated wbd ON wbd.workerFk = wtc.userFk + AND wbd.dated = date(wtc.timed) + JOIN vn.time t ON t.dated = wbd.dated + JOIN vn.business b ON b.id = wbd.businessFk + JOIN postgresql.calendar_labour_type AS cl ON b.calendarTypeFk = cl.calendar_labour_type_id + JOIN vn.department d ON d.id = b.departmentFk + JOIN vn.department d2 ON d2.id = d.parentFk AND d2.name = 'PRODUCCION' + WHERE wtc.timed BETWEEN '2020-10-01' AND '2021-04-19' + AND d.lft BETWEEN d2.lft AND d2.rgt + AND lastName NOT LIKE 'FERRER%'; + SET @orden := 1; SET @id := 0; SET @day := 0; @@ -5086,7 +4146,7 @@ BEGIN SET orden = IF(id = @id AND day(timed) = @day, @orden := @orden + 1, @orden := 1), id = @id := id + (0 * @day := day(timed)) ORDER BY id, timed; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -5108,15 +4168,15 @@ BEGIN DECLARE datSTART DATE; DECLARE datEND DATE; - + SELECT TIMESTAMPADD(WEEK, -1,MAX(fecha)) INTO datSTART FROM bs.m3; - + SET datEND = TIMESTAMPADD(DAY,-1,util.VN_CURDATE()); - - DELETE FROM bs.m3 + + DELETE FROM bs.m3 WHERE fecha >= datSTART; - + INSERT INTO bs.m3 (fecha, provinceFk, warehouseFk, m3, year, month, week, day, dayName, euros) SELECT v.fecha, a.provinceFk, t.warehouseFk, sum(s.quantity * ic.cm3delivery) / 1000000 AS m3, tm.year, tm.month, tm.week, tm.day, dayname(v.fecha), sum(importe) @@ -5159,51 +4219,51 @@ BEGIN DECLARE vManaBankId INT; DECLARE vManaGreugeTypeId INT; - SELECT id INTO vManaId + SELECT id INTO vManaId FROM vn.component WHERE code = 'mana'; - - SELECT id INTO vManaAutoId + + SELECT id INTO vManaAutoId FROM vn.component WHERE code = 'autoMana'; - + SELECT id INTO vClaimManaId FROM vn.component WHERE code = 'manaClaim'; - - SELECT id INTO vManaBankId + + SELECT id INTO vManaBankId FROM vn.bank WHERE code = 'mana'; - - SELECT id INTO vManaGreugeTypeId + + SELECT id INTO vManaGreugeTypeId FROM vn.greugeType WHERE code = 'mana'; SELECT IFNULL(MAX(dated), '2016-01-01') - INTO vFromDated + INTO vFromDated FROM vn.clientManaCache; - + DELETE FROM vn.clientManaCache WHERE dated = vFromDated; SELECT IFNULL(MAX(dated), '2016-01-01') - INTO vFromDated + INTO vFromDated FROM vn.clientManaCache; WHILE timestampadd(DAY,30,vFromDated) < util.VN_CURDATE() DO SELECT timestampadd(DAY,30,vFromDated), - timestampadd(DAY,-90,vFromDated) - INTO + timestampadd(DAY,-90,vFromDated) + INTO vToDated, vForDeleteDated; - + DELETE FROM vn.clientManaCache WHERE dated <= vForDeleteDated; INSERT INTO vn.clientManaCache(clientFk, mana, dated) - SELECT + SELECT Id_Cliente, cast(sum(mana) as decimal(10,2)) as mana, - vToDated as dated - FROM + vToDated as dated + FROM ( SELECT cs.Id_Cliente, Cantidad * Valor as mana FROM vn2008.Tickets t @@ -5211,20 +4271,20 @@ BEGIN 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, vClaimManaId) - AND t.Fecha > vFromDated + AND t.Fecha > vFromDated AND date(t.Fecha) <= vToDated UNION ALL SELECT r.Id_Cliente, - Entregado FROM vn2008.Recibos r WHERE Id_Banco = vManaBankId - AND Fechacobro > vFromDated + AND Fechacobro > vFromDated AND Fechacobro <= vToDated - + UNION ALL SELECT g.Id_Cliente, g.Importe FROM vn2008.Greuges g WHERE Greuges_type_id = vManaGreugeTypeId - AND Fecha > vFromDated + AND Fecha > vFromDated AND Fecha <= vToDated UNION ALL SELECT clientFk, mana @@ -5235,7 +4295,7 @@ BEGIN HAVING Id_Cliente; SET vFromDated = vToDated; - + END WHILE; END ;; @@ -5256,60 +4316,21 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `manaSpellers_actualize`() BEGIN - - /* PAK 2019/08/09 updated - * - * Recalcula el valor del campo con el modificador de precio para el componente de maná automático. - * La tabla mana_spellers es una caché - * - */ - - UPDATE mana_spellers me - JOIN - (SELECT Id_Trabajador, FLOOR(SUM(importe)/12) as pesoCarteraMensual - FROM bs.vendedores - WHERE año * 100 + mes >= (YEAR(util.VN_CURDATE()) -1) * 100 + MONTH(util.VN_CURDATE()) - GROUP BY Id_Trabajador - ) lastYearSales USING(Id_Trabajador) - SET me.prices_modifier_rate = GREATEST(me.minRate,LEAST(me.maxRate,ROUND(- me.used/lastYearSales.pesoCarteraMensual,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 `mermasCacheUpdate__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `mermasCacheUpdate__`() -BEGIN - - DECLARE vTimeRange INT DEFAULT 30; - DECLARE vCurYearStarted DATE DEFAULT TIMESTAMPADD(DAY, - vTimeRange, util.VN_CURDATE()); - DECLARE vCurYearFinished DATE DEFAULT util.VN_CURDATE(); - DECLARE vLastYearStarted DATE DEFAULT TIMESTAMPADD(YEAR, -1 , vCurYearStarted); - DECLARE vLastYearFinished DATE DEFAULT TIMESTAMPADD(YEAR, -1 , vCurYearFinished); - - REPLACE bs.mermasCache - SELECT Comprador, - IF(Fecha < vCurYearStarted, year(util.VN_CURDATE()) - 1,year(util.VN_CURDATE())) año, - CAST(sum(Importe) as DECIMAL(10,0)) as Valor_Compra, - CAST(sum(IF(Cliente LIKE 'FALTAS',Importe,0)) as DECIMAL(10,0)) as Faltas, - CAST(sum(IF(Cliente LIKE 'BASURA',Importe,0)) as DECIMAL(10,0)) as Basura - FROM bs.mermas - WHERE Fecha BETWEEN vCurYearStarted AND vCurYearFinished - OR Fecha BETWEEN vLastYearStarted AND vLastYearFinished - GROUP BY año, Comprador; - - +/** + * Recalcula el valor del campo con el modificador de precio + * para el componente de maná automático. + */ + UPDATE vn.workerMana wm + JOIN( + SELECT sb.salespersonFk, FLOOR(SUM(sb.amount) / 12) monthlyAmount + FROM salesByclientSalesPerson sb + JOIN vn.time t ON t.dated = sb.dated + WHERE t.year * 100 + t.month >= + (YEAR(util.VN_CURDATE()) - 1) * 100 + MONTH(util.VN_CURDATE()) + GROUP BY salespersonFk + ) lastYearSales ON wm.workerFk = lastYearSales.salespersonFk + SET pricesModifierRate = GREATEST(minRate, + LEAST(maxRate, ROUND( - amount / lastYearSales.monthlyAmount, 3))); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -5341,8 +4362,8 @@ BEGIN DECLARE vId INT; DECLARE rs CURSOR FOR - SELECT id, `schema`, `procedure` - FROM nightTask + SELECT id, `schema`, `procedure` + FROM nightTask WHERE finished <= util.VN_CURDATE() OR finished IS NULL ORDER BY `order`; @@ -5375,7 +4396,7 @@ BEGIN vError, vErrorCode ); - + IF vError IS NOT NULL THEN SET vNErrors = vNErrors + 1; @@ -5445,7 +4466,7 @@ BEGIN vError = MESSAGE_TEXT, vErrorCode = RETURNED_SQLSTATE; - CALL util.exec(CONCAT('CALL `', vSchema ,'`.`', vProcedure ,'`')); + CALL util.exec(CONCAT('CALL `', vSchema ,'`.`', vProcedure ,'`')); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -5464,214 +4485,22 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `payMethodClientAdd`() BEGIN - INSERT IGNORE INTO `bs`.`payMethodClient` (dated, payMethodFk, clientFk) + INSERT IGNORE INTO `bs`.`payMethodClient` (dated, payMethodFk, clientFk) SELECT util.VN_CURDATE(), c.payMethodFk, c.id - FROM vn.client c + FROM vn.client c JOIN vn.payMethod p ON c.payMethodFk = p.id; - + TRUNCATE `bs`.`payMethodClientEvolution` ; - + INSERT INTO `bs`.`payMethodClientEvolution` (dated, payMethodName, amountClient, amount, equalizationTax) - SELECT p.dated, pm.name, COUNT(p.clientFk), SUM(sub.importe) , SUM(sub.recargo) + SELECT p.dated, pm.name, COUNT(p.clientFk), SUM(sub.importe) , SUM(sub.recargo) FROM bs.payMethodClient p - JOIN (SELECT SUM(v.importe) AS importe, SUM(v.recargo) as recargo, v.fecha, v.Id_cliente + JOIN (SELECT SUM(v.importe) AS importe, SUM(v.recargo) as recargo, v.fecha, v.Id_cliente FROM bs.ventas v WHERE v.fecha>= (SELECT MIN(dated) FROM bs. payMethodClient) GROUP BY v.Id_cliente, v.fecha) sub ON sub.fecha = p.dated AND sub.Id_cliente = p.ClientFk JOIN vn.payMethod pm ON p.payMethodFk = pm.id - GROUP BY dated,payMethodFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `produccionAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `produccionAdd`(vDate DATE) -BEGIN - - DECLARE vDateStart DATETIME DEFAULT vDate; - DECLARE vDateEnd DATETIME DEFAULT util.dayEnd(vDate); - DECLARE myDepLft INT; - DECLARE myDepRgt INT; - - -- Trabajadores - CALL vn.dayMinuteWorker(vDateStart,vDateEnd); -- Genera la tabla tmp.dayMinuteWorker - CALL vn.workerDepartmentByDate(vDate); - - -- General - REPLACE bs.produccion(dated, cost) - SELECT vDate,sum(wdd.costeHora) / 60 as Bruto - FROM tmp.dayMinuteWorker dmw - JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk - WHERE warehouseName = 'Algemesi' - AND wdd.isProduction; - - UPDATE bs.produccion p - JOIN (SELECT sum(volume) as m3 - FROM vn.saleVolume sv - JOIN vn.ticket t ON sv.ticketFk = t.id - JOIN vn.warehouse w ON w.id = t.warehouseFk - WHERE t.shipped BETWEEN vDateStart AND vDateEnd - AND w.name = 'Algemesi' - ) sub - SET p.m3 = sub.m3, - p.eurosM3 = p.cost / sub.m3 - WHERE p.dated = vDate; - - DROP TEMPORARY TABLE tmp.dayMinuteWorker; - DROP TEMPORARY TABLE 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 `produccion_launcher` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `produccion_launcher`(vDateFrom DATE, vDateTo DATE) -BEGIN - - WHILE vDateFrom <= vDateTo DO - - CALL bs.produccionAdd(vDateFrom); - - SET vDateFrom = TIMESTAMPADD(DAY,1,vDateFrom); - - END WHILE; - -/* - -call bs.produccion_launcher('2018-01-01', '2018-02-01'); -call bs.produccion_launcher('2018-02-01', '2018-03-01'); -call bs.produccion_launcher('2018-03-01', '2018-04-01'); -call bs.produccion_launcher('2018-04-01', '2018-05-01'); -call bs.produccion_launcher('2018-05-01', '2018-06-01'); -call bs.produccion_launcher('2018-06-01', '2018-07-01'); -call bs.produccion_launcher('2018-07-01', '2018-08-01'); -call bs.produccion_launcher('2018-08-01', '2018-09-01'); -call bs.produccion_launcher('2018-09-01', '2018-10-01'); -call bs.produccion_launcher('2018-10-01', '2018-11-01'); -call bs.produccion_launcher('2018-11-01', '2018-12-01'); -call bs.produccion_launcher('2018-12-01', '2019-01-01'); - -call bs.produccion_launcher('2019-01-01', '2019-02-01'); -call bs.produccion_launcher('2019-02-01', '2019-03-01'); -call bs.produccion_launcher('2019-03-01', '2019-04-01'); -call bs.produccion_launcher('2019-04-01', '2019-05-01'); -call bs.produccion_launcher('2019-05-01', '2019-06-01'); -call bs.produccion_launcher('2019-06-01', '2019-07-01'); -call bs.produccion_launcher('2019-07-01', '2019-08-01'); -call bs.produccion_launcher('2019-08-01', '2019-09-01'); -call bs.produccion_launcher('2019-09-01', '2019-10-01'); -call bs.produccion_launcher('2019-10-01', '2019-11-01'); -call bs.produccion_launcher('2019-11-01', '2019-12-01'); -call bs.produccion_launcher('2019-12-01', '2020-01-01'); - -call bs.produccion_launcher('2020-01-01', '2020-02-01'); -call bs.produccion_launcher('2020-02-01', '2020-03-01'); -call bs.produccion_launcher('2020-03-01', '2020-04-01'); -call bs.produccion_launcher('2020-04-01', '2020-05-01'); -call bs.produccion_launcher('2020-05-01', '2020-06-01'); -call bs.produccion_launcher('2020-06-01', '2020-07-01'); -*/ -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `produccion_launcher_auto` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `produccion_launcher_auto`() -BEGIN - - DECLARE vDate DATE DEFAULT TIMESTAMPADD(WEEK, -1, util.VN_CURDATE()); - - WHILE vDate <= util.VN_CURDATE() DO - - CALL bs.produccionAdd(vDate); - - SET vDate = TIMESTAMPADD(DAY,1,vDate); - - END WHILE; - - SET vDate = TIMESTAMPADD(DAY,-372, util.VN_CURDATE()); - - WHILE vDate <= TIMESTAMPADD(YEAR,-1, util.VN_CURDATE()) DO - - CALL bs.produccionAdd(vDate); - - SET vDate = TIMESTAMPADD(DAY,1,vDate); - - 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 `pruebas` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `pruebas`(IN vDateStart DATE, IN vDateEnd DATE) -BEGIN - -WHILE vDateStart <> vDateEnd -DO - UPDATE indicators - SET countEmployee = - ( SELECT CAST(SUM(hours_week) / 40 AS DECIMAL (10 , 2 )) - FROM - postgresql.business AS b - JOIN postgresql.profile p ON p.profile_id = b.provider_id - JOIN postgresql.person pe ON pe.person_id = p.person_id - LEFT JOIN - postgresql.business_labour AS bl ON bl.business_id = b.business_id - LEFT JOIN - postgresql.calendar_labour_type AS cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id - WHERE - (vDateStart BETWEEN b.date_start AND b.date_end OR (b.date_end IS NULL AND b.date_start <= vDateStart)) - AND pe.name = 'VERDNATURA LEVANTE SL' - ) - WHERE updated = vDateStart; - SET vDateStart = DATE_ADD(vDateStart, INTERVAL 1 DAY); - -END WHILE; + GROUP BY dated,payMethodFk; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -5691,12 +4520,12 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleGraphic`(IN vItemFk INT, IN vTypeFk INT, IN vCategoryFk INT, IN vFromDate DATE, IN vToDate DATE, IN vProducerFk INT) BEGIN - + DECLARE vFromDateLastYear DATE; DECLARE vToDateLastYear DATE; DECLARE vFromDateTwoYearsAgo DATE; DECLARE vToDateTwoYearsAgo DATE; - + SET vItemFk = IFNULL(vItemFk,0); SET vTypeFk = IFNULL(vTypeFk, 0); SET vCategoryFk = IFNULL(vCategoryFk,0); @@ -5711,19 +4540,19 @@ BEGIN SELECT s.quantity, CAST(v.importe AS DECIMAL(10,0)) importe, v.fecha FROM bs.ventas v - JOIN vn.sale s ON s.id = v.Id_Movimiento - 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.sale s ON s.id = v.Id_Movimiento + 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 vItemFk IN (i.id, 0) AND vTypeFk IN (i.typeFk, 0) AND vCategoryFk IN (it.categoryFk, 0) AND vProducerFk IN (i.producerFk, 0) AND (v.fecha BETWEEN vFromDate AND vToDate OR v.fecha BETWEEN vFromDateLastYear AND vToDateLastYear - OR v.fecha BETWEEN vFromDateTwoYearsAgo AND vToDateTwoYearsAgo + OR v.fecha BETWEEN vFromDateTwoYearsAgo AND vToDateTwoYearsAgo ); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -5742,21 +4571,21 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `salePersonEvolutionAdd`(IN vDateStart DATETIME) BEGIN - DELETE FROM bs.salePersonEvolution + DELETE FROM bs.salePersonEvolution WHERE dated <= DATE_SUB(util.VN_CURDATE(), INTERVAL 1 YEAR); - - + + INSERT INTO bs.salePersonEvolution (dated, amount, equalizationTax, salesPersonFk) - SELECT fecha dated, - CAST(SUM(importe) AS DECIMAL(10,2) ) amount, + SELECT fecha dated, + CAST(SUM(importe) AS DECIMAL(10,2) ) amount, CAST(SUM(recargo) AS DECIMAL(10,2) ) equalizationTax , IFNULL(salesPersonFk,0) salesPersonFk FROM bs.ventas v - JOIN vn.client c ON v.Id_Cliente = c.id + JOIN vn.client c ON v.Id_Cliente = c.id JOIN vn.company co ON co.id = v.empresa_id WHERE co.code = "VNL" AND fecha >= vDateStart GROUP BY v.fecha,c.salesPersonFk - ORDER BY salesPersonFk,dated ASC; + ORDER BY salesPersonFk,dated ASC; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -5775,233 +4604,297 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `salesByclientSalesPerson_add`(vDatedFrom DATE) BEGIN +/** + * Agrupa las ventas por cliente/comercial/fecha en la tabla bs.salesByclientSalesPerson + * El asociación cliente/comercial/fecha, se mantiene correcta en el tiempo + * + * @param vDatedFrom el cálculo se realizará desde la fecha introducida hasta ayer + */ IF vDatedFrom IS NULL THEN - SELECT util.VN_CURDATE() - INTERVAL DAY(util.VN_CURDATE())-1 DAY - INTERVAL 1 MONTH INTO vDatedFrom; + SET vDatedFrom = util.VN_CURDATE() - INTERVAL 1 MONTH; END IF; - - INSERT INTO salesByclientSalesPerson( dated, salesPersonFk, clientFk, amount, equalizationTax) - SELECT v.fecha, + + UPDATE salesByclientSalesPerson + SET amount = 0, + equalizationTax = 0, + amountNewBorn = 0 + WHERE dated BETWEEN vDatedFrom AND util.yesterday(); + + INSERT INTO salesByclientSalesPerson( + dated, + salesPersonFk, + clientFk, + amount, + equalizationTax) + SELECT s.dated, c.salesPersonFk, - v.Id_Cliente, - SUM(v.importe) amount, - SUM(v.recargo) equalizationTax - FROM ventas v - JOIN vn.client c on v.Id_Cliente = c.id - WHERE v.fecha >= vDatedFrom - GROUP BY v.fecha,c.salesPersonFk,v.Id_Cliente - ON DUPLICATE KEY UPDATE amount= VALUES(amount), equalizationTax= VALUES(equalizationTax); - + s.clientFk, + SUM(s.amount), + SUM(s.surcharge) + FROM sale s + JOIN vn.client c on s.clientFk = c.id + WHERE s.dated BETWEEN vDatedFrom AND util.yesterday() + GROUP BY s.dated, c.salesPersonFk, s.clientFk + ON DUPLICATE KEY UPDATE amount= VALUES(amount), + equalizationTax= VALUES(equalizationTax); + UPDATE salesByclientSalesPerson s JOIN vn.newBornSales n ON n.dated = s.dated AND n.clientFk = s.clientFk SET s.amountNewBorn = n.amount - WHERE n.dated >= vDatedFrom; - + WHERE n.dated BETWEEN vDatedFrom AND 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 `salesMonthlySnapshot_add` */; +/*!50003 DROP PROCEDURE IF EXISTS `salesByItemTypeDay_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 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 `salesMonthlySnapshot_add`() +CREATE DEFINER=`root`@`localhost` PROCEDURE `salesByItemTypeDay_add`(vDateStart DATE, vDateEnd DATE) BEGIN - DECLARE vPlusNewClient INT DEFAULT 100; - DECLARE vScoreNewClient INT DEFAULT 100; - DECLARE vRowCount INT DEFAULT 1; - DECLARE vMaxRow INT; - - IF(DAY(util.VN_CURDATE()) = 5) THEN - -- COMERCIAL Y EQUIPO - DROP TEMPORARY TABLE IF EXISTS tmp.salesPersons; - CREATE TEMPORARY TABLE tmp.salesPersons +/** + * Almacena datos relativos a las ventas de artículos agrupados por reino y familia + * + * @param vDateStart + * @param vDateEnd + */ + + DELETE FROM bs.salesByItemTypeDay + WHERE dated BETWEEN vDateStart AND vDateEnd; + + INSERT INTO bs.salesByItemTypeDay (itemTypeFk, itemCategoryFk, dated) + SELECT id, categoryFk, dated + FROM vn.itemType + JOIN vn.`time` + WHERE dated BETWEEN vDateStart AND vDateEnd; + + UPDATE bs.salesByItemTypeDay it + JOIN (SELECT ic.id itemCategoryFk, + it.id itemTypeFk, + bs.dated, + SUM(bs.amount) netSale + FROM bs.sale bs + JOIN vn.itemType it ON it.id = bs.typeFk + JOIN vn .itemCategory ic ON ic.id = it.categoryFk + JOIN vn.client c on c.id = bs.clientFk + JOIN vn.sale s ON s.id = bs.saleFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.`time` ti ON ti.dated = bs.dated + WHERE ic.merchandise + AND bs.dated BETWEEN vDateStart AND vDateEnd + GROUP BY ic.id, it.id, bs.dated) sub ON sub.dated = it.dated AND sub.itemCategoryFk = it.itemCategoryFk AND sub.itemTypeFk = it.itemTypeFk + SET it.netSale = sub.netSale; + + + UPDATE bs.salesByItemTypeDay it + JOIN (SELECT ic.id AS itemCategoryFk, + it.id AS itemTypeFk, + bs.dated, + SUM(i.stems * s.quantity) stems + FROM bs.sale bs + JOIN vn.itemType it ON it.id = bs.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.sale s ON s.id = bs.saleFk + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.`time` tm ON tm.dated = bs.dated + WHERE ic.merchandise + AND bs.dated BETWEEN vDateStart AND vDateEnd + GROUP BY ic.id, it.id, bs.dated) sub ON sub.dated = it.dated AND sub.itemCategoryFk = it.itemCategoryFk AND sub.itemTypeFk = it.itemTypeFk + SET it.stems = sub.stems; + + + UPDATE bs.salesByItemTypeDay it + JOIN (SELECT ic.id AS itemCategoryFk, + it.id AS itemTypeFk, + DATE(t.shipped) dated, + COUNT(DISTINCT(i.id)) `references` + 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 + WHERE ic.merchandise + AND t.shipped BETWEEN vDateStart AND util.dayEnd(vDateEnd) + GROUP BY ic.id, it.id, dated) sub ON sub.dated = it.dated AND sub.itemCategoryFk = it.itemCategoryFk AND sub.itemTypeFk = it.itemTypeFk + SET it.`references` = sub.`references`; + + UPDATE bs.salesByItemTypeDay it + JOIN (SELECT ic.id AS itemCategoryFk, + it.id AS itemTypeFk, + DATE(t.shipped) dated, + SUM(i.stems*s.quantity) AS trash + 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 + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.client c ON c.id = t.clientFk + WHERE c.name = 'BASURA' + AND t.shipped BETWEEN vDateStart AND util.dayEnd(vDateEnd) + GROUP BY ic.id, it.id, dated) sub ON sub.dated = it.dated AND sub.itemCategoryFk = it.itemCategoryFk AND sub.itemTypeFk = it.itemTypeFk + SET it.trash = sub.trash; + + UPDATE bs.salesByItemTypeDay it + JOIN (SELECT ic.id AS itemCategoryFk, + it.id AS itemTypeFk, + DATE(t.shipped) dated, + SUM(IFNULL(i.stems, 1) * s.quantity) AS faults + 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 + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.client c ON c.id = t.clientFk + WHERE c.name = 'FALTAS' + AND t.shipped BETWEEN vDateStart AND util.dayEnd(vDateEnd) + GROUP BY ic.id, it.id, dated) sub ON sub.dated = it.dated AND sub.itemCategoryFk = it.itemCategoryFk AND sub.itemTypeFk = it.itemTypeFk + SET it.`faults` = sub.`faults`; + + UPDATE bs.salesByItemTypeDay it + JOIN (SELECT ic.id AS itemCategoryFk, + it.id AS itemTypeFk, + DATE(t.shipped) dated, + SUM((cb.quantity * s.price * (100 - s.discount) / 100) * ((cc.maxResponsibility - c.responsibility )/4 )) accepted, + SUM(cb.quantity * s.price * (100 - s.discount) / 100) claimed + FROM vn.claim c + JOIN vn.claimBeginning cb ON cb.claimFk = c.id + JOIN vn.sale s ON s.id = cb.saleFk + 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 + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.claimConfig cc + WHERE ic.merchandise + AND t.shipped BETWEEN vDateStart AND util.dayEnd(vDateEnd) + GROUP BY ic.id, it.id, dated) sub ON sub.dated = it.dated AND sub.itemCategoryFk = it.itemCategoryFk AND sub.itemTypeFk = it.itemTypeFk + SET it.accepted = sub.accepted, + it.claimed = sub.claimed; + + UPDATE bs.salesByItemTypeDay it + JOIN(SELECT itemCategoryFk, + itemTypeFk, + dated, + CAST(SUM(sale) AS DECIMAL(10,2)) sale, + CAST(SUM(buy) AS DECIMAL(10,2))buy + FROM(SELECT ic.id itemCategoryFk, + it.id itemTypeFk, + bs.dated, + SUM(bs.amount) sale, + 0 buy + FROM bs.sale bs + JOIN vn.itemType it ON it.id = bs.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.client c on c.id = bs.clientFk + JOIN vn.`time` tm ON tm.dated = bs.dated + JOIN vn.sale s ON s.id = bs.saleFk + JOIN vn.item i ON i.id = s.itemFk + WHERE ic.merchandise + AND bs.dated BETWEEN vDateStart AND vDateEnd + GROUP BY ic.id, it.id, bs.dated + UNION ALL + SELECT ic.id, + it.id, + t.landed, + 0 , + SUM(b.buyingValue * b.quantity) + FROM vn.entry e + JOIN vn.travel t ON t.id = e.travelFk + JOIN vn.buy b ON b.entryFk = e.id + 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 + WHERE ic.merchandise + AND t.landed BETWEEN vDateStart AND vDateEnd + GROUP BY ic.id, it.id, t.landed) sub + GROUP BY itemCategoryFk, itemTypeFk, dated) sub2 ON sub2.dated = it.dated AND sub2.itemCategoryFk = it.itemCategoryFk AND sub2.itemTypeFk = it.itemTypeFk + SET it.sale = sub2.sale, + it.buy = sub2.buy; + + DROP TEMPORARY TABLE IF EXISTS tmp.`component`; + CREATE TEMPORARY TABLE tmp.`component` + (PRIMARY KEY (`itemTypeFk`,`dated`), + KEY `salesByItemTypeDay_itemCategoryFk_idx` (`itemCategoryFk`), + KEY `salesByItemTypeDay_dated_idx` (`dated`)) ENGINE = MEMORY - SELECT u.id workerFk, - u.name salesPersonName, - d.name teamName - FROM vn.department d - JOIN vn.workerDepartment wd ON wd.departmentFk = d.id - JOIN account.user u ON u.id = wd.workerFk - WHERE d.name LIKE '%EQUIPO%'; - - -- VENTA, COMISIÓN - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - ENGINE = MEMORY - SELECT YEAR(s.dated) year, - MONTH(s.dated) month, - u.name, - SUM(s.amount) currentSale, - SUM(s.amount)*cc.rate commissionSale, - s.salesPersonFk workerFk, - cc.minimumSalesByQuarter/3 minimumSalesByMonth - FROM - bs.salesByclientSalesPerson s - JOIN vn.client c ON c.id = s.salesPersonFk - JOIN account.user u ON u.id = s.salesPersonFk - JOIN vn.commissionConfig cc - WHERE dated BETWEEN util.firstDayOfMonth(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND LAST_DAY(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) - GROUP BY year, month, workerFk; - - -- OBJETIVO EVALUABLE (GRUPO) Y OBJETIVO INCENTIVO (INDIVIDUAL) - DROP TEMPORARY TABLE IF EXISTS tmp.objectives; - CREATE TEMPORARY TABLE tmp.objectives - ENGINE = MEMORY - SELECT sg.rank, - sg.goal goalGroup, - sg2.goal goalIncentive, - sub.walletWeigth, - sub.walletWeigth*sg2.goal/100 AS incentiveObjective, - sub.walletWeigth*sg.goal/100 AS evaluableObjective, - sub.workerFk, - rb.bonus - FROM ( - SELECT - CASE - WHEN portfolioWeight >= sg1.walletWeightFrom - AND portfolioWeight <= sg1.walletWeightTo THEN 1 - WHEN portfolioWeight >= sg2.walletWeightFrom - AND portfolioWeight <= sg2.walletWeightTo THEN 2 - WHEN portfolioWeight >= sg3.walletWeightFrom - AND portfolioWeight <= sg3.walletWeightTo THEN 3 - WHEN portfolioWeight >= sg4.walletWeightFrom - AND portfolioWeight <= sg4.walletWeightTo THEN 4 - WHEN portfolioWeight >= sg5.walletWeightFrom - AND portfolioWeight <= sg5.walletWeightTo THEN 5 - END rank, - u.id workerFk, - IFNULL(v.portfolioWeight,0) AS walletWeigth - FROM bs.vendedores v - JOIN account.`user` u ON u.id = v.Id_Trabajador - JOIN vn.saleGoal sg1 ON sg1.`rank` = 1 AND sg1.`year` = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND sg1.`month` = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) - JOIN vn.saleGoal sg2 ON sg2.`rank` = 2 AND sg2.`year` = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND sg2.`month` = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) - JOIN vn.saleGoal sg3 ON sg3.`rank` = 3 AND sg3.`year` = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND sg3.`month` = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) - JOIN vn.saleGoal sg4 ON sg4.`rank` = 4 AND sg4.`year` = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND sg4.`month` = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) - JOIN vn.saleGoal sg5 ON sg5.`rank` = 5 AND sg5.`year` = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND sg5.`month` = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) - WHERE v.año = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH))-1 AND v.mes = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) - GROUP BY u.id - ) sub - JOIN vn.saleGoal sg ON sg.`rank` = sub.rank AND sg.goalType = 'grupo' AND sg.`year` = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND sg.`month` = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) - JOIN vn.saleGoal sg2 ON sg2.`rank` = sub.rank AND sg2.goalType = 'individual' AND sg2.`year` = YEAR(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) AND sg2.`month` = MONTH(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) - JOIN vn.rankBonus rb ON rb.`rank` = sub.`rank`; - - -- PUNTUACIÓN EQUIPO, PLUS OBJETIVO EQUIPO Y PLUS VARIABLE JEFE DE EQUIPO - DROP TEMPORARY TABLE IF EXISTS tmp.scoreTeam; - CREATE TEMPORARY TABLE tmp.scoreTeam - ENGINE = MEMORY - SELECT *, - IF(sub1.teamScore >= sub1.minScoreForPlusTeam, sub1.plusTeamValue, 0) teamPlus, - IF(sub1.teamScore >= sub1.minScoreForPlusBoss, countSalesPerson * sub1.plusBoss, 0) teamBossPlus - FROM ( - SELECT *, - (100/sub.countSalesPerson)*countGroupAchieved teamScore - FROM ( - SELECT COUNT(u.id) countSalesPerson, - u.id workerFk, - u.name salesPersonName, - d.name teamName, - cc.minScoreForPlusTeam, - cc.minScoreForPlusBoss, - cc.plusTeam plusTeamValue, - cc.plusBoss, - SUM(IF(s.currentSale > r.evaluableObjective, 1, 0)) countGroupAchieved - FROM vn.department d - JOIN vn.workerDepartment wd ON wd.departmentFk = d.id - JOIN account.user u ON u.id = wd.workerFk - JOIN tmp.sale s ON s.workerFk = wd.workerFk - JOIN tmp.objectives r ON r.workerFk = wd.workerFk - JOIN vn.commissionConfig cc - WHERE d.name LIKE '%EQUIPO%' - GROUP BY d.name - ) sub - ) sub1; - - -- PLUS CLIENTES NUEVOS - DROP TEMPORARY TABLE IF EXISTS tmp.newClients; - CREATE TEMPORARY TABLE tmp.newClients ( - id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - workerFk INTEGER(11), - name VARCHAR(30), - total DECIMAL(10,3), - newClientPlus INTEGER(11), - newClientScore INTEGER(11) - ); - - INSERT INTO tmp.newClients (workerFk, total, name, newClientPlus) - SELECT u.id workerFk, u.name, SUM(v.importe) total, vPlusNewClient - FROM bs.clientNewBorn cn - JOIN bs.ventas v ON DATE_ADD(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 vn.workerDepartment wd ON wd.workerFk = u.id - JOIN vn.department d On d.id = wd.departmentFk - WHERE v.fecha >= util.firstDayOfMonth(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) - AND cn.firstShipped >= util.firstDayOfMonth(DATE_ADD(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH), INTERVAL -1 year)) - AND d.name LIKE 'EQUIPO%' - GROUP BY u.id - ORDER BY total DESC; - - SET vMaxRow = ROW_COUNT(); - - my_loop: LOOP - UPDATE tmp.newClients SET newClientPlus = vPlusNewClient WHERE id = vRowCount; - UPDATE tmp.newClients SET newClientScore = vScoreNewClient WHERE id = vRowCount; - - IF (vRowCount <= 20) THEN - SET vPlusNewClient = vPlusNewClient - 5; - ELSE - SET vPlusNewClient = 0; - END IF; - - SET vScoreNewClient = vScoreNewClient - 1; - SET vRowCount = vRowCount + 1; - - IF vRowCount > vMaxRow THEN - LEAVE my_loop; - END IF; - END LOOP my_loop; - - INSERT INTO bs.salesMonthlySnapshot (salesPersonName, teamName, `year`, `month`, currentSale, commissionSale, individualPlus, teamPlus, teamScore, newClientPlus, newClientScore, teamBossPlus) - SELECT * - FROM ( - SELECT sp.salesPersonName, - sp.teamName, - s.`year`, - s.`month`, - s.currentSale, - s.commissionSale, - IF(s.currentSale > s.minimumSalesByMonth AND s.currentSale > r.incentiveObjective, r.bonus, 0) individualPlus, - np.teamPlus, - np.teamScore, - nc.newClientPlus, - nc.newClientScore, - np.teamBossPlus - FROM tmp.salesPersons sp - LEFT JOIN tmp.sale s ON s.workerFk = sp.workerFk - LEFT JOIN tmp.objectives r ON r.workerFk = sp.workerFk - LEFT JOIN tmp.scoreTeam np ON np.teamName = sp.teamName - LEFT JOIN tmp.newClients nc ON nc.workerFk = sp.workerFk - ) sub - ORDER BY salesPersonName; - - DROP TEMPORARY TABLE - tmp.salesPersons, - tmp.sale, - tmp.objectives, - tmp.scoreTeam, - tmp.newClients; - END IF; - + SELECT DATE(t.shipped) dated, + ic.id itemCategoryFk, + it.id itemTypeFk, + SUM(s.quantity * IF(c.code = 'purchaseValue', sc.value,0)) costComponent, + SUM(s.quantity * IF(ct.isMargin, sc.value,0)) marginComponent + FROM vn.ticket t + JOIN vn.sale s ON t.id = s.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.saleComponent sc ON sc.saleFk = s.id + STRAIGHT_JOIN vn.component c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk + WHERE t.shipped BETWEEN vDateStart AND util.dayEnd(vDateEnd) + GROUP BY ic.id, it.id, dated; + + UPDATE bs.salesByItemTypeDay it + JOIN tmp.`component` c ON c.dated = it.dated AND c.itemCategoryFk = it.itemCategoryFk AND c.itemTypeFk = it.itemTypeFk + SET it.costComponent = c.costComponent, + it.marginComponent = c.marginComponent, + it.saleComponent = c.costComponent + c.marginComponent; + + DROP TEMPORARY TABLE tmp.`component`; + +/* UPDATE bs.salesByItemTypeDay it + JOIN(SELECT DATE(t.shipped) dated, + ic.id itemCategoryFk, + it.id itemTypeFk, + SUM(s.quantity * IF(c.code = 'purchaseValue', sc.value,0)) costComponent, + SUM(s.quantity * IF(ct.isMargin, sc.value,0)) marginComponent + FROM vn.ticket t + JOIN vn.sale s ON t.id = s.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.saleComponent sc ON sc.saleFk = s.id + STRAIGHT_JOIN vn.component c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk + JOIN vn.`time` tm ON tm.dated = DATE(t.shipped) + WHERE t.shipped BETWEEN vDateStart AND util.dayEnd(vDateEnd) + GROUP BY ic.id, it.id, dated)sub ON sub.dated = it.dated AND sub.itemCategoryFk = it.itemCategoryFk AND sub.itemTypeFk = it.itemTypeFk + SET it.costComponent = sub.costComponent, + it.marginComponent = sub.marginComponent, + it.saleComponent = sub.costComponent + sub.marginComponent;*/ +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `salesByItemTypeDay_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 `salesByItemTypeDay_addLauncher`() +BEGIN + DECLARE vDateStart,vDateEnd INT; + + SELECT DATE_SUB(util.VN_CURDATE(), INTERVAL 30 DAY), util.VN_CURDATE() INTO vDateStart,vDateEnd; + CALL bs.salesByItemTypeDay_add(vDateStart, vDateEnd); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -6020,165 +4913,66 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `salesPersonEvolution_add`() BEGIN +/** + * Calcula los datos para los gráficos de evolución agrupado por salesPersonFk y día. + * Recalcula automáticamente los 3 últimos meses para comprobar si hay algún cambio. + */ DECLARE vDated DATE; DECLARE vCont INT DEFAULT 1; - SELECT TIMESTAMPADD(DAY,1,MAX(dated)) INTO vDated - FROM bs.salesPersonEvolution; + SELECT MAX(dated) - INTERVAL 3 MONTH INTO vDated + FROM salesPersonEvolution; + + DELETE FROM salesPersonEvolution + WHERE dated >= vDated; IF ISNULL(vDated) THEN - - SELECT MIN(dated) INTO vDated + SELECT MIN(dated) INTO vDated FROM salesByclientSalesPerson; - - INSERT INTO bs.salesPersonEvolution( salesPersonFk, dated, amount, equalizationTax, amountNewBorn ) - SELECT salesPersonFk, dated, amount, equalizationTax, amountNewBorn - FROM salesByclientSalesPerson + + INSERT INTO salesPersonEvolution( + salesPersonFk, + dated, + amount, + equalizationTax, + amountNewBorn + ) + SELECT salesPersonFk, + dated, + amount, + equalizationTax, + amountNewBorn + FROM salesByclientSalesPerson WHERE dated = vDated GROUP BY salesPersonFk; - - SET vDated = TIMESTAMPADD(DAY, 1, vDated); + + SET vDated = vDated + INTERVAL 1 DAY; END IF; - + WHILE vDated < util.VN_CURDATE() DO - - SET vCont = vCont + 1; - - REPLACE bs.salesPersonEvolution( salesPersonFk, dated, amount) - SELECT salesPersonFk, vDated, SUM(amount) - FROM(SELECT salesPersonFk, amount - FROM salesPersonEvolution - WHERE dated = TIMESTAMPADD(DAY,-1,vDated) -- amount acumulado día anterior - UNION ALL - SELECT salesPersonFk, amount * IF(dated < vDated,-1,1) -- suma amount año actual/ resta amount año anterior - FROM salesByclientSalesPerson - WHERE dated IN (vDated, TIMESTAMPADD(DAY,-365,vDated)) + + SET vCont = vCont + 1; + REPLACE salesPersonEvolution(salesPersonFk, dated, amount) + SELECT salesPersonFk, vDated, amount + FROM(SELECT salesPersonFk, SUM(amount) amount + FROM(SELECT salesPersonFk, amount + FROM salesPersonEvolution + WHERE dated = vDated - INTERVAL 1 DAY + UNION ALL + SELECT salesPersonFk, amount + FROM salesByclientSalesPerson + WHERE dated = vDated + UNION ALL + SELECT salesPersonFk, - amount + FROM salesByclientSalesPerson + WHERE dated = vDated - INTERVAL 1 YEAR + )sub + GROUP BY salesPersonFk )sub GROUP BY salesPersonFk; - - SET vDated = TIMESTAMPADD(DAY,1,vDated); - + + SET vDated = 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 `salesPerson_updatePortfolio` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!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 `salesPerson_updatePortfolio`() -BEGIN - /** - * Actualiza el campo portfolioWeight que indica el peso de la cartera del comercial - * - */ - DECLARE vStarted DATE DEFAULT DATE_FORMAT(DATE_ADD(util.VN_CURDATE(), INTERVAL -17 MONTH), '%Y-%m-01'); - - UPDATE vendedores v - JOIN vn.`time` t ON t.`year` = v.año AND t.`month` = v.mes - SET v.portfolioWeight = NULL - WHERE t.dated BETWEEN vStarted AND util.VN_CURDATE(); - - UPDATE vendedores v - JOIN ( - SELECT c.lastSalesPersonFk - , t.`year` - , t.`month` - , SUM(v.importe) importe - FROM vn.`time` t - STRAIGHT_JOIN bs.ventas v ON t.dated = v.fecha - JOIN vn.`client` c ON c.id = v.Id_Cliente - WHERE c.lastSalesPersonFk IS NOT NULL - AND v.fecha BETWEEN vStarted AND util.VN_CURDATE() - GROUP BY c.lastSalesPersonFk, t.`year`, t.`month` - ) sub ON sub.lastSalesPersonFk = v.Id_Trabajador AND sub.`year` = v.año AND sub.`month`= v.mes - SET v.portfolioWeight = sub.importe; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `vendedores_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 `vendedores_add`(intYEAR INT, vQuarter INT) -BEGIN - - DECLARE vCommissionRate DOUBLE; - - SELECT rate - INTO vCommissionRate - FROM vn.commissionConfig; - - -- vaciar tabla - DELETE v.* FROM vendedores v - JOIN vn.`time` t ON t.`year` = v.año AND t.`month` = v.mes - WHERE t.`year` = intYEAR AND QUARTER(t.dated) = vQuarter; - - REPLACE vendedores(Id_Trabajador, año, mes, importe, comision, portfolioWeight) - SELECT c.Id_Trabajador - , intYEAR - , MONTH(v.fecha) intMONTH - , sum(v.importe) - , sum(v.importe) * vCommissionRate - , sum(v.importe) - FROM ventas v - JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente - JOIN vn.`time` t on t.dated = v.fecha - WHERE c.Id_Trabajador is not null - AND t.`year` = intYEAR AND QUARTER(t.dated) = vQuarter - GROUP BY c.Id_Trabajador, t.`month`; - - -- Sustitucion cedidas - lended - INSERT INTO vendedores (Id_Trabajador, mes, año, importe, comision) - SELECT c.salesPersonFk - , t.`month` - , t.`year` - , - sum(importe) - , - sum(importe) * vCommissionRate as lended - FROM ventas v - JOIN vn.client c ON c.id = v.Id_Cliente - JOIN vn.sharingCartDaily scd on scd.ownerFk = c.salesPersonFk AND scd.dated = v.fecha - JOIN vn.`time` t ON t.dated = v.fecha - WHERE t.`year` = intYEAR AND QUARTER(t.dated) = vQuarter - GROUP BY c.salesPersonFk, t.`month` - ON DUPLICATE KEY UPDATE comision = comision + VALUES(comision), - importe = importe + VALUES(importe); - - -- Sustitucion arrendadas - borrowed - INSERT INTO vendedores (Id_Trabajador, mes, año, importe, comision) - SELECT scd.substituteFk - , t.`month` - , t.`year` - , sum(importe) - , sum(importe) * vCommissionRate as borrowed - FROM ventas v - JOIN vn.`client` c ON c.id = v.Id_Cliente - JOIN vn.sharingCartDaily scd on scd.ownerFk = c.salesPersonFk AND scd.dated = v.fecha - JOIN vn.`time` t ON t.dated = v.fecha - WHERE t.`year` = intYEAR AND QUARTER(t.dated) = vQuarter - GROUP BY scd.substituteFk, t.`month` - ON DUPLICATE KEY UPDATE comision = comision + VALUES(comision), - importe = importe + VALUES(importe); - - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -6196,99 +4990,9 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `vendedores_add_launcher`() -BEGIN - DECLARE vDatedFrom DATE; - - CALL bs.vendedores_add(YEAR(util.VN_CURDATE()),QUARTER(util.VN_CURDATE())); - CALL bs.vendedores_evolution_add; - SELECT util.firstDayOfMonth(util.VN_CURDATE())- INTERVAL 1 MONTH INTO vDatedFrom; - CALL bs.salesByclientSalesPerson_add(vDatedFrom); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `vendedores_add_launcher__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `vendedores_add_launcher__`() BEGIN - CALL bs.vendedores_add(YEAR(util.VN_CURDATE()),QUARTER(util.VN_CURDATE())); - CALL bs.vendedores_evolution_add; - CALL bs.salesPersonClient_add(YEAR(util.VN_CURDATE()), QUARTER(util.VN_CURDATE())); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `vendedores_evolution_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `vendedores_evolution_add`() -BEGIN -/* -Inserta en la tabla compradores_evolution las ventas acumuladas en el ultimo mes -*/ - - DECLARE vYear, vMonth INTEGER; - DECLARE vCurYear, vCurMonth INTEGER; - DECLARE vDateFrom DATE; - DECLARE vDateTo DATE; - - SET vCurYear = year(util.VN_CURDATE()); - SET vCurMonth = month(util.VN_CURDATE()); - - SELECT IFNULL(max(year),vCurYear-1), IFNULL(max(month),1) - INTO vYear, vMonth - FROM bs.vendedores_evolution; - - WHILE (vYear < vCurYear) OR (vYear = vCurYear AND vMonth < vCurMonth) DO - - SELECT max(dated), TIMESTAMPADD(DAY,-364,max(dated)) INTO vDateTo, vDateFrom - FROM vn.time - WHERE year = vYear - AND month = vMonth; - - REPLACE bs.vendedores_evolution( workerFk - , year - , month - , sales) - SELECT c.salesPersonFk - , vYear as year - , vMonth as month - , sum(v.importe) as sales - FROM bs.ventas v - JOIN vn.client c on c.id = v.Id_Cliente - WHERE v.fecha BETWEEN vDateFrom AND vDateTo - AND c.salesPersonFk is not null - GROUP BY c.salesPersonFk; - - SET vMonth = vMonth + 1; - - IF vMonth = 13 THEN - SET vMonth = 1; - SET vYear = vYear + 1; - END IF; - END WHILE; + CALL bs.salesByclientSalesPerson_add(util.VN_CURDATE()- INTERVAL 45 DAY); END ;; DELIMITER ; @@ -6306,77 +5010,76 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ventas_add`(IN datSTART DATETIME, IN datEND DATETIME) +CREATE DEFINER=`root`@`localhost` PROCEDURE `ventas_add`( + IN vStarted DATETIME, + IN vEnded DATETIME) BEGIN - - /** - * Añade las ventas que se realizaron de hace - * una semana hasta hoy - * - * @param datSTART Fecha de inicio - * @param datEND Fecha de finalizacion - * - **/ - +/** +* Añade las ventas que se realizaron de hace +* una semana hasta hoy +* +* @param vStarted Fecha de inicio +* @param vEnded Fecha de finalizacion +* +**/ DECLARE vStartingDate DATETIME; DECLARE vEndingDate DATETIME; - DECLARE TIPO_PATRIMONIAL INT DEFAULT 188; - IF datSTART < TIMESTAMPADD(YEAR,-5,util.VN_CURDATE()) - OR datEND < TIMESTAMPADD(YEAR,-5,util.VN_CURDATE()) THEN - CALL util.throw('fechaDemasiadoAntigua'); - END IF; - - SET datEND = util.dayEnd(datEND); - SET vStartingDate = datSTART; + IF vStarted < TIMESTAMPADD(YEAR,-5,util.VN_CURDATE()) + OR vEnded < TIMESTAMPADD(YEAR,-5,util.VN_CURDATE()) THEN + CALL util.throw('fechaDemasiadoAntigua'); + END IF; + + SET vEnded = util.dayEnd(vEnded); + SET vStartingDate = vStarted ; SET vEndingDate = vn2008.dayend(vStartingDate); - DELETE - FROM ventas - WHERE fecha BETWEEN vStartingDate AND datEND; + DELETE + FROM sale + WHERE dated BETWEEN vStartingDate AND vEnded; - WHILE vEndingDate <= datEND DO + WHILE vEndingDate <= vEnded DO REPLACE ventas(Id_Movimiento, importe, recargo, fecha, tipo_id, Id_Cliente, empresa_id) - SELECT Id_Movimiento, - SUM(IF(base, Cantidad * Valor, 0)) AS importe, - SUM(IF(base, 0, Cantidad * Valor)) AS recargo, - vStartingDate, - a.tipo_id, - cs.Id_Cliente, - t.empresa_id - FROM vn2008.Movimientos_componentes mc - JOIN bi.tarifa_componentes tc USING(Id_Componente) - JOIN bi.tarifa_componentes_series tcs USING(tarifa_componentes_series_id) - JOIN vn2008.Movimientos m USING(Id_Movimiento) - JOIN vn2008.Articles a USING(Id_Article) - JOIN vn2008.Tipos tp USING(tipo_id) - JOIN vn2008.reinos r ON r.id = tp.reino_id - JOIN vn2008.Tickets t USING(Id_Ticket) - JOIN vn2008.Consignatarios cs USING(Id_Consigna) - JOIN vn2008.Clientes c ON c.Id_Cliente = cs.Id_Cliente - WHERE t.Fecha BETWEEN vStartingDate AND vEndingDate - AND c.typeFk IN ('Normal','handMaking','internalUse') - AND m.Cantidad <> 0 - AND a.tipo_id != TIPO_PATRIMONIAL - AND m.Descuento <> 100 - AND (m.Id_Article = 98 OR m.Id_Article = 95 OR r.mercancia != 0) - GROUP BY mc.Id_Movimiento - HAVING IFNULL(importe,0) <> 0 OR IFNULL(recargo,0) <> 0; - - UPDATE bs.ventas v - JOIN ( - SELECT s.id, sum(s.quantity * sc.value ) AS margen, s.quantity * s.price * (100 - s.discount ) / 100 AS pvp - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.saleComponent sc ON sc.saleFk = s.id - JOIN vn.component c ON c.id = sc.componentFk - JOIN vn.componentType ct ON ct.id = c.typeFk + SELECT saleFk, + SUM(IF(ct.isBase, s.quantity * sc.value, 0)) importe, + SUM(IF(ct.isBase, 0, s.quantity * sc.value)) recargo, + vStartingDate, + i.typeFk, + a.clientFk, + t.companyFk + FROM vn.saleComponent sc + JOIN vn.component c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk + JOIN vn.sale s ON s.id = sc.saleFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.client cl ON cl.id = a.clientFk WHERE t.shipped BETWEEN vStartingDate AND vEndingDate - AND ct.isMargin = TRUE - GROUP BY s.id) sub ON sub.id = v.Id_Movimiento - - SET v.margen = sub.margen + v.importe + v.recargo - sub.pvp; + AND s.quantity <> 0 + AND s.discount <> 100 + AND ic.merchandise + GROUP BY sc.saleFk + HAVING IFNULL(importe,0) <> 0 OR IFNULL(recargo,0) <> 0; + + UPDATE sale s + JOIN ( + SELECT s.id, + SUM(s.quantity * sc.value ) margen, + s.quantity * s.price * (100 - s.discount ) / 100 pvp + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.saleComponent sc ON sc.saleFk = s.id + JOIN vn.component c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk + WHERE t.shipped BETWEEN vStartingDate AND vEndingDate + AND ct.isMargin = TRUE + GROUP BY s.id) sub ON sub.id = s.saleFk + SET s.margin = sub.margen + s.amount + s.surcharge - sub.pvp; + SET vStartingDate = TIMESTAMPADD(DAY,1, vStartingDate); SET vEndingDate = util.dayEnd(vStartingDate); @@ -6400,7 +5103,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ventas_add_launcher`() BEGIN - + /** * Añade las ventas que se realizaron de hace * una semana hasta hoy @@ -6427,7 +5130,7 @@ DELIMITER ; 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 @@ -6439,8 +5142,8 @@ BEGIN DECLARE TIPO_PATRIMONIAL INT DEFAULT 188; - DELETE FROM bs.ventas_contables - WHERE year = vYear + DELETE FROM bs.ventas_contables + WHERE year = vYear AND month = vMonth; DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; @@ -6451,7 +5154,7 @@ BEGIN FROM vn2008.Tickets t JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura WHERE year(f.Fecha) = vYear - AND month(f.Fecha) = vMonth; + AND month(f.Fecha) = vMonth; INSERT INTO bs.ventas_contables(year , month @@ -6461,7 +5164,7 @@ BEGIN , tipo_id , empresa_id , gasto) - + SELECT vYear , vMonth , round(sum(Cantidad * Preu * (100 - m.Descuento)/100)) @@ -6473,13 +5176,13 @@ BEGIN , tp.reino_id , a.tipo_id , t.empresa_id - , 7000000000 + , 7000000000 + IF(e.empresa_grupo = e2.empresa_grupo ,1 ,IF(e2.empresa_grupo,2,0) - ) * 1000000 + ) * 1000000 + tp.reino_id * 10000 as Gasto - FROM vn2008.Movimientos m + 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 @@ -6493,7 +5196,7 @@ BEGIN 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 @@ -6512,17 +5215,17 @@ BEGIN ) as grupo , NULL , NULL - , t.companyFk + , t.companyFk , 7050000000 - FROM vn.ticketService ts + 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 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 + JOIN vn.company c on c.id = t.companyFk LEFT JOIN vn.company c2 on c2.clientFk = cl.id - GROUP BY grupo, t.companyFk ; - + GROUP BY grupo, t.companyFk ; + DROP TEMPORARY TABLE tmp.ticket_list; END ;; DELIMITER ; @@ -6542,101 +5245,15 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ventas_contables_add_launcher`() BEGIN - + /** * Reemplaza las ventas contables del último año. * Es el origen de datos para el balance de Entradas * **/ - + CALL bs.ventas_contables_add(YEAR(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())), MONTH(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()))); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `ventas_contables_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 `ventas_contables_add__`(IN vYear INT, IN vMonth INT) -BEGIN -/** - * Reemplaza las ventas contables. 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)) - 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; - - -DROP TEMPORARY TABLE tmp.ticket_list; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -6655,12 +5272,12 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ventas_contables_por_cliente`(IN vYear INT, IN vMonth INT) BEGIN - + /** * Muestra las ventas (€) de cada cliente * dependiendo del año */ - + DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; CREATE TEMPORARY TABLE tmp.ticket_list @@ -6669,8 +5286,8 @@ BEGIN FROM vn2008.Tickets t JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura WHERE year(f.Fecha) = vYear - AND month(f.Fecha) = vMonth; - + AND month(f.Fecha) = vMonth; + SELECT vYear Año, vMonth Mes, t.Id_Cliente, @@ -6680,7 +5297,7 @@ BEGIN IF(e2.empresa_grupo,2,0)) AS grupo, t.empresa_id empresa - FROM vn2008.Movimientos m + 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 @@ -6694,9 +5311,9 @@ BEGIN AND m.Descuento <> 100 AND a.tipo_id != 188 GROUP BY t.Id_Cliente, grupo,t.empresa_id; - + DROP TEMPORARY TABLE tmp.ticket_list; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -6715,7 +5332,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `vivosMuertos`() BEGIN - + /** * Devuelve el número de clientes nuevos y muertos, * dependiendo de la fecha actual. @@ -6726,9 +5343,9 @@ BEGIN SET @datSTART = TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); SET @datEND = TIMESTAMPADD(DAY,-DAY(util.VN_CURDATE()),util.VN_CURDATE()); - + DROP TEMPORARY TABLE IF EXISTS tmp.VivosMuertos; - + CREATE TEMPORARY TABLE tmp.VivosMuertos SELECT c.Id_Cliente, tm.yearMonth, f.Compra, 0 as Nuevo, 0 as Muerto FROM vn2008.Clientes c @@ -6744,10 +5361,10 @@ BEGIN WHERE Fecha BETWEEN @datSTART AND @datEND) f ON f.yearMonth = tm.yearMonth AND f.Id_Cliente = c.Id_Cliente; - + UPDATE tmp.VivosMuertos vm JOIN - (SELECT MIN(tm.yearMonth) firstMonth, f.Id_Cliente + (SELECT MIN(tm.yearMonth) firstMonth, f.Id_Cliente FROM vn2008.Facturas f JOIN vn2008.time tm ON tm.date = f.Fecha WHERE Fecha BETWEEN @datSTART AND @datEND @@ -6755,9 +5372,9 @@ BEGIN AND fm.Id_Cliente = vm.Id_Cliente SET Nuevo = 1; - + SELECT max(yearMonth) INTO @lastYearMonth FROM tmp.VivosMuertos; - + UPDATE tmp.VivosMuertos vm JOIN ( SELECT MAX(tm.yearMonth) firstMonth, f.Id_Cliente @@ -6798,67 +5415,23 @@ BEGIN INTO vWeek, vYear FROM vn.time WHERE dated = util.VN_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 */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `waste_addSales_lastWeek__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!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, util.VN_CURDATE()); - REPLACE bs.waste SELECT *, 100 * mermas / total as porcentaje FROM ( - SELECT buyer, - year, + SELECT buyer, + year, week, family, itemFk, itemTypeFk, - floor(sum(value)) as total, + floor(sum(value)) as total, floor(sum(IF(clientTypeFk = 'loses', value, 0))) as mermas - FROM vn.saleValue + FROM vn.saleValue where year = vYear and week = vWeek - + GROUP BY family, itemFk - + ) sub ORDER BY mermas DESC; END ;; @@ -6873,16 +5446,15 @@ 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 `workerLabour_getData`() BEGIN /** * Carga los datos de la plantilla de trabajadores, altas y bajas en la tabla workerLabourDataByMonth para facilitar el cálculo del gráfico en grafana. * Se carga el día 21 de cada mes, elimina los registros del último año y los vuelve a calcular - * */ DECLARE vFristDay DATE; DECLARE vLastDay DATE; @@ -6891,217 +5463,91 @@ BEGIN DECLARE vDateEnded DATE; DECLARE vCursor CURSOR FOR - SELECT util.firstDayOfMonth(t.dated), LAST_DAY(t.dated) + SELECT util.firstDayOfMonth(t.dated), LAST_DAY(t.dated) FROM vn.time t WHERE t.dated BETWEEN vDateStarted AND vDateEnded - GROUP BY year,month; + GROUP BY year,month; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + IF DAY(util.VN_CURDATE()) = 21 THEN - + SELECT util.firstDayOfMonth(DATE_SUB(util.VN_CURDATE(), INTERVAL 12 MONTH)), LAST_DAY(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) - INTO vDateStarted, + INTO vDateStarted, vDateEnded; - - DELETE FROM workerLabourDataByMonth + + DELETE FROM workerLabourDataByMonth WHERE CONCAT(`year`, '-',`month`, '-01') BETWEEN vDateStarted AND vDateEnded; OPEN vCursor; l: LOOP SET vDone = FALSE; - + FETCH vCursor INTO vFristDay, vLastDay; - + IF vDone THEN LEAVE l; END IF; - + -- Altas periodo - INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) - SELECT 'hiring', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) - FROM vn.workerLabour w - JOIN postgresql.workcenter wc ON wc.workcenter_id = w.workCenterFk - JOIN postgresql.business_labour_payroll bl ON bl.business_id = w.businessFk - JOIN postgresql.person p ON p.id_trabajador = w.workerFk - LEFT JOIN vn.workerBusinessType wbt ON wbt.id = bl.cod_contrato - LEFT JOIN (SELECT w.workerFk - FROM vn.workerLabour w - LEFT JOIN (SELECT ended, workerFk FROM vn.workerLabour) wl ON wl.ended = DATE_SUB(w.started, INTERVAL 1 DAY) - AND wl.workerFk = w.workerFk - WHERE w.started BETWEEN vFristDay AND vLastDay AND wl.ended - )sub ON sub.workerFk = w.workerFk - WHERE wc.center_id IS NOT NULL - AND w.started BETWEEN vFristDay AND vLastDay + INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) + SELECT 'hiring', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) + FROM vn.business b + JOIN vn.workCenter wc ON wc.id = b.workCenterFk + JOIN vn.worker w ON w.id = b.workerFk + LEFT JOIN vn.workerBusinessType wbt ON wbt.id = b.workerBusinessTypeFk + LEFT JOIN (SELECT b.id, b.workerFk + FROM vn.business b + LEFT JOIN (SELECT ended, workerFk FROM vn.business) wl + ON wl.ended = DATE_SUB(b.started, INTERVAL 1 DAY) AND wl.workerFk = b.workerFk + WHERE b.started BETWEEN vFristDay AND vLastDay AND wl.ended + )sub ON sub.workerFk = b.workerFk + WHERE wc.payrollCenterFk IS NOT NULL + AND b.workCenterFk IS NOT NULL + AND b.started BETWEEN vFristDay AND vLastDay AND sub.workerFk IS NULL - AND NOT p.isFreelance; + AND NOT w.isFreelance; -- Bajas periodo - INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) - SELECT 'layoffs', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) - FROM vn.workerLabour w - JOIN postgresql.workcenter wc ON wc.workcenter_id = w.workCenterFk - JOIN postgresql.business_labour_payroll bl ON bl.business_id = w.businessFk - JOIN postgresql.person p ON p.id_trabajador = w.workerFk - LEFT JOIN vn.workerBusinessType wbt ON wbt.id = bl.cod_contrato - LEFT JOIN (SELECT started, workerFk FROM vn.workerLabour) wl ON wl.started >= w.ended - AND wl.workerFk = w.workerFk - WHERE wc.center_id IS NOT NULL - AND w.ended BETWEEN vFristDay AND vLastDay + INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) + SELECT 'layoffs', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) + FROM vn.business b + JOIN vn.worker w ON w.id = b.workerFk + JOIN vn.workCenter wc ON wc.id = b.workCenterFk + LEFT JOIN vn.workerBusinessType wbt ON wbt.id = b.workerBusinessTypeFk + LEFT JOIN (SELECT started, workerFk FROM vn.business) wl ON wl.started >= b.ended + AND wl.workerFk = b.workerFk + WHERE wc.payrollCenterFk IS NOT NULL + AND b.ended BETWEEN vFristDay AND vLastDay AND wl.started IS NULL - AND NOT p.isFreelance; - + AND NOT w.isFreelance; + -- Anterior al periodo SET vLastDay = LAST_DAY(DATE_SUB(vFristDay, INTERVAL 1 DAY)); - INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) - SELECT 'staff', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) - FROM vn.workerLabour w - JOIN postgresql.workcenter wc ON wc.workcenter_id = w.workCenterFk - JOIN postgresql.business_labour_payroll bl ON bl.business_id = w.businessFk - JOIN postgresql.person p ON p.id_trabajador = w.workerFk - LEFT JOIN vn.workerBusinessType wbt ON wbt.id = bl.cod_contrato - WHERE wc.center_id IS NOT NULL + INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) + SELECT 'staff', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) + FROM vn.business b + JOIN vn.worker w ON w.id = b.workerFk + JOIN vn.workCenter wc ON wc.id = b.workCenterFk + LEFT JOIN vn.workerBusinessType wbt ON wbt.id = b.workerBusinessTypeFk + WHERE wc.payrollCenterFk IS NOT NULL AND vLastDay BETWEEN started AND IFNULL(ended, vLastDay) - AND NOT p.isFreelance; + AND NOT w.isFreelance; -- Discapacidad - INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) - SELECT 'disabled', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) - FROM vn.workerLabour w - JOIN postgresql.workcenter wc ON wc.workcenter_id = w.workCenterFk - JOIN postgresql.business_labour_payroll bl ON bl.business_id = w.businessFk - JOIN postgresql.person p ON p.id_trabajador = w.workerFk - LEFT JOIN vn.workerBusinessType wbt ON wbt.id = bl.cod_contrato - WHERE wc.center_id IS NOT NULL + INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) + SELECT 'disabled', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(wbt.isPermanent) + FROM vn.business b + JOIN vn.worker w ON w.id = b.workerFk + JOIN vn.workCenter wc ON wc.id = b.workCenterFk + LEFT JOIN vn.workerBusinessType wbt ON wbt.id = b.workerBusinessTypeFk + WHERE wc.payrollCenterFk IS NOT NULL AND vLastDay BETWEEN started AND IFNULL(ended, vLastDay) - AND p.isDisable - AND NOT p.isFreelance; - - END LOOP; - CLOSE vCursor; - - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerLabour_getData__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerLabour_getData__`() -BEGIN -/** - * Carga los datos de la plantilla de trabajadores, altas y bajas en la tabla workerLabourDataByMonth para facilitar el cálculo del gráfico en grafana. - * Se carga el día 21 de cada mes, elimina los registros del último año y los vuelve a calcular - * - */ - DECLARE vFristDay DATE; - DECLARE vLastDay DATE; - DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vDateStarted DATE; - DECLARE vDateEnded DATE; - - DECLARE vCursor CURSOR FOR - SELECT util.firstDayOfMonth(t.dated), LAST_DAY(t.dated) - FROM vn.time t - WHERE t.dated BETWEEN vDateStarted AND vDateEnded - GROUP BY year,month; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - IF DAY(util.VN_CURDATE()) = 21 THEN - - SELECT util.firstDayOfMonth(DATE_SUB(util.VN_CURDATE(), INTERVAL 12 MONTH)), - LAST_DAY(DATE_SUB(util.VN_CURDATE(), INTERVAL 1 MONTH)) - INTO vDateStarted, - vDateEnded; - - DELETE FROM workerLabourDataByMonth - WHERE CONCAT(`year`, '-',`month`, '-01') BETWEEN vDateStarted AND vDateEnded; - - OPEN vCursor; - - l: LOOP - SET vDone = FALSE; - - FETCH vCursor INTO vFristDay, vLastDay; - - IF vDone THEN - LEAVE l; - END IF; - - -- Altas periodo - INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) - SELECT 'hiring', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(pc.isPermanent) - FROM vn.workerLabour w - JOIN postgresql.workcenter wc ON wc.workcenter_id = w.workCenterFk - JOIN postgresql.business_labour_payroll bl ON bl.business_id = w.businessFk - JOIN postgresql.person p ON p.id_trabajador = w.workerFk - LEFT JOIN vn2008.payroll_contratos pc ON pc.CodContrato = bl.cod_contrato - LEFT JOIN (SELECT w.workerFk - FROM vn.workerLabour w - LEFT JOIN (SELECT ended, workerFk FROM vn.workerLabour) wl ON wl.ended = DATE_SUB(w.started, INTERVAL 1 DAY) - AND wl.workerFk = w.workerFk - WHERE w.started BETWEEN vFristDay AND vLastDay AND wl.ended - )sub ON sub.workerFk = w.workerFk - WHERE wc.center_id IS NOT NULL - AND w.started BETWEEN vFristDay AND vLastDay - AND sub.workerFk IS NULL - AND NOT p.isFreelance; - - -- Bajas periodo - INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) - SELECT 'layoffs', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(pc.isPermanent) - FROM vn.workerLabour w - JOIN postgresql.workcenter wc ON wc.workcenter_id = w.workCenterFk - JOIN postgresql.business_labour_payroll bl ON bl.business_id = w.businessFk - JOIN postgresql.person p ON p.id_trabajador = w.workerFk - LEFT JOIN vn2008.payroll_contratos pc ON pc.CodContrato = bl.cod_contrato - LEFT JOIN (SELECT started, workerFk FROM vn.workerLabour) wl ON wl.started >= w.ended - AND wl.workerFk = w.workerFk - WHERE wc.center_id IS NOT NULL - AND w.ended BETWEEN vFristDay AND vLastDay - AND wl.started IS NULL - AND NOT p.isFreelance; - - -- Anterior al periodo - SET vLastDay = LAST_DAY(DATE_SUB(vFristDay, INTERVAL 1 DAY)); - - INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) - SELECT 'staff', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(pc.isPermanent) - FROM vn.workerLabour w - JOIN postgresql.workcenter wc ON wc.workcenter_id = w.workCenterFk - JOIN postgresql.business_labour_payroll bl ON bl.business_id = w.businessFk - JOIN postgresql.person p ON p.id_trabajador = w.workerFk - LEFT JOIN vn2008.payroll_contratos pc ON pc.CodContrato = bl.cod_contrato - WHERE wc.center_id IS NOT NULL - AND vLastDay BETWEEN started AND IFNULL(ended, vLastDay) - AND NOT p.isFreelance; - - -- Discapacidad - INSERT INTO workerLabourDataByMonth (code, month, year, total, permanent) - SELECT 'disabled', MONTH(vFristDay), YEAR(vFristDay), COUNT(*), SUM(pc.isPermanent) - FROM vn.workerLabour w - JOIN postgresql.workcenter wc ON wc.workcenter_id = w.workCenterFk - JOIN postgresql.business_labour_payroll bl ON bl.business_id = w.businessFk - JOIN postgresql.person p ON p.id_trabajador = w.workerFk - LEFT JOIN vn2008.payroll_contratos pc ON pc.CodContrato = bl.cod_contrato - WHERE wc.center_id IS NOT NULL - AND vLastDay BETWEEN started AND IFNULL(ended, vLastDay) - AND p.isDisable - AND NOT p.isFreelance; + AND w.isDisable + AND NOT w.isFreelance; END LOOP; CLOSE vCursor; @@ -7126,147 +5572,99 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerProductivity_add`() BEGIN DECLARE vDateFrom DATE; - SELECT DATE_SUB(util.VN_CURDATE(),INTERVAL 30 DAY) INTO vDateFrom; - - DELETE FROM workerProductivity + SELECT DATE_SUB(util.VN_CURDATE(), INTERVAL 30 DAY) INTO vDateFrom; + + DELETE FROM workerProductivity WHERE dated >= vDateFrom; - + -- SACADORES Y ARTIFICIAL - INSERT INTO workerProductivity(dated, wareHouseFk, workerFk, volume, seconds, actionFk) + INSERT INTO workerProductivity(dated, wareHouseFk, workerFk, volume, seconds, stateFk) SELECT sub.dated, sub.warehouseFk, sub.workerFk, SUM(sub.volume), - SUM(sub.seconds) , - sub.accion_id + SUM(sub.seconds), + sub.stateFk FROM(SELECT t.warehouseFk warehouseFk, st.workerFk, DATE(t.shipped) dated, SUM((ic.cm3delivery * s.quantity)/1000000) volume, - TIME_TO_SEC(TIMEDIFF( MAX(st.created),MIN(st.created))) + w.minSeconsItemPicker seconds, - a.accion_id + TIME_TO_SEC(TIMEDIFF( MAX(st.created),MIN(st.created))) + wc.minSeconsItemPicker seconds, + s2.id stateFk FROM vn.saleTracking st LEFT JOIN vn.salesPreviousPreparated sp ON sp.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 vncontrol.accion a ON a.accion_id = st.actionFk + JOIN vn.state s2 ON s2.id = st.stateFk LEFT JOIN vn.workerDepartment wd ON wd.workerFk = st.workerFk - JOIN workerProductivityConfig w ON TRUE - WHERE t.shipped >= vDateFrom - AND ISNULL(sp.saleFk) - AND (a.accion = 'SACAR' - OR a.accion = 'PRESACAR') + JOIN workerProductivityConfig wc ON TRUE + WHERE t.shipped >= vDateFrom + AND ISNULL(sp.saleFk) + AND (s2.code IN ('OK PREVIOUS', 'PREVIOUS_PREPARATION', 'PREPARED', 'OK')) GROUP BY t.id, t.warehouseFk, st.workerFk ) sub GROUP BY sub.warehouseFk, sub.workerFk, sub.dated; - + -- ENCAJADORES - INSERT INTO workerProductivity(dated, wareHouseFk, workerFk, volume, seconds, actionFk) + INSERT INTO workerProductivity(dated, wareHouseFk, workerFk, volume, seconds, stateFk) SELECT sub2.shipped, sub2.warehouseFk, - sub2.workerFK, - SUM(sub2.volume), + sub2.workerFK, + SUM(sub2.volume), SUM(sub2.seconds), - a.accion_id - FROM (SELECT t.warehouseFk, - SUM(s.volume) volume, - sub.workerFk, + s2.id stateFk + FROM (SELECT t.warehouseFk, + SUM(s.volume) volume, + sub.workerFk, DATE(t.shipped) shipped, sub.seconds + w.minSeconsPackager seconds, - s.saleFk - FROM vn.saleVolume s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN(SELECT e.workerFk, e.ticketFk,TIME_TO_SEC(TIMEDIFF( MAX(e.created), MIN(e.created))) seconds + s.saleFk + FROM vn.saleVolume s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN(SELECT e.workerFk, e.ticketFk,TIME_TO_SEC(TIMEDIFF( MAX(e.created), MIN(e.created))) seconds FROM vn.expedition e JOIN vn.ticket t ON t.id = e.ticketFk WHERE e.workerFk IS NOT NULL AND - t.shipped >= vDateFrom + t.shipped >= vDateFrom GROUP BY e.ticketFk )sub ON sub.ticketFk = t.id JOIN workerProductivityConfig w ON TRUE - GROUP BY s.ticketFk, t.warehouseFk + GROUP BY s.ticketFk, t.warehouseFk )sub2 - JOIN vncontrol.accion a ON a.accion = 'ENCAJAR' + JOIN vn.state s2 ON s2.code IN ('PACKING','PACKED') GROUP BY sub2.warehouseFk,sub2.workerFk, sub2.shipped; - + -- REVISADORES - INSERT INTO workerProductivity(dated, wareHouseFk, workerFk, volume, seconds, actionFk) - SELECT sub2.shipped, - sub2.warehouseFk, - sub2.workerFK, - SUM(sub2.volume), - SUM(sub2.seconds), - sub2.accion_id - FROM (SELECT t.warehouseFk, - SUM(s.volume) volume, - sub.workerFk, - DATE(t.shipped) shipped, - sub.seconds + w.minSeconsPackager seconds, - sub.accion_id - FROM vn.saleVolume s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN(SELECT st.workerFk, t.id ticketFk,TIME_TO_SEC(TIMEDIFF( MAX(st.created), MIN(st.created))) seconds, a.accion_id - FROM vn.saleTracking st - JOIN vncontrol.accion a ON a.accion_id = st.actionFk - JOIN vn.sale s ON s.id = st.saleFk - JOIN vn.ticket t ON s.ticketFk = t.id - WHERE a.accion = 'CONTROLAR' - AND t.shipped >= vDateFrom - GROUP BY t.id - )sub ON sub.ticketFk = t.id - JOIN workerProductivityConfig w ON TRUE - GROUP BY s.ticketFk, t.warehouseFk - )sub2 - GROUP BY sub2.warehouseFk,sub2.workerFk, sub2.shipped; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_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; - - SELECT MAX(hourTheoretical) INTO @h - FROM vn.zoneEstimatedDelivery ze - WHERE ze.remainingVolume ; - - DROP TEMPORARY TABLE IF EXISTS tmpZone; - - CREATE TEMPORARY TABLE tmpZone - SELECT remainingVolume, - hourTheoretical, - @m := @m + minutesLess + HOUR(TIMEDIFF(@h, hourTheoretical)) * 60 + MINUTE(TIMEDIFF(@h, hourTheoretical)) totalMinutes, - @h := hourTheoretical - FROM vn.zoneEstimatedDelivery ze - WHERE ze.remainingVolume - ORDER BY ze.hourTheoretical DESC; - - TRUNCATE bs.zone_ETD_byTime ; - - INSERT INTO bs.zone_ETD_byTime(theorical, practical, m3) - SELECT tz.hourTheoretical, - TIMESTAMPADD(MINUTE, MIN(totalMinutes), tz.hourTheoretical), - sum(tz.remainingVolume) - FROM tmpZone tz - GROUP BY tz.hourTheoretical; - - DROP TEMPORARY TABLE tmpZone; - + INSERT INTO workerProductivity(dated, wareHouseFk, workerFk, volume, seconds, stateFk) + SELECT sub2.shipped, + sub2.warehouseFk, + sub2.workerFK, + SUM(sub2.volume), + SUM(sub2.seconds), + sub2.stateFk + FROM (SELECT t.warehouseFk, + SUM(s.volume) volume, + sub.workerFk, + DATE(t.shipped) shipped, + sub.seconds + w.minSeconsPackager seconds, + sub.stateFk + FROM vn.saleVolume s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN(SELECT st.workerFk, t.id ticketFk,TIME_TO_SEC(TIMEDIFF( MAX(st.created), MIN(st.created))) seconds, s2.id stateFk + FROM vn.saleTracking st + JOIN vn.state s2 ON s2.id = st.stateFk + JOIN vn.sale s ON s.id = st.saleFk + JOIN vn.ticket t ON s.ticketFk = t.id + WHERE s2.code = 'CHECKED' + AND t.shipped >= vDateFrom + GROUP BY t.id + )sub ON sub.ticketFk = t.id + JOIN workerProductivityConfig w ON TRUE + GROUP BY s.ticketFk, t.warehouseFk + )sub2 + GROUP BY sub2.warehouseFk,sub2.workerFk, sub2.shipped; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -7278,7 +5676,7 @@ DELIMITER ; -- Current Database: `cache` -- -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `cache` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `cache` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci */; USE `cache`; @@ -7297,7 +5695,7 @@ CREATE TABLE `addressFriendship` ( KEY `addressFriendship_fk2_idx` (`addressFk2`), CONSTRAINT `addressFriendship_fk1` FOREIGN KEY (`addressFk1`) REFERENCES `vn`.`address` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `addressFriendship_fk2` FOREIGN KEY (`addressFk2`) REFERENCES `vn`.`address` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7313,7 +5711,7 @@ CREATE TABLE `available` ( `available` int(11) NOT NULL, UNIQUE KEY `calc_id` (`item_id`,`calc_id`) USING HASH, KEY `calc_id_4` (`calc_id`) USING BTREE -) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7329,7 +5727,7 @@ CREATE TABLE `availableNoRaids` ( `available` int(11) NOT NULL, UNIQUE KEY `calc_id` (`item_id`,`calc_id`), KEY `calc_id_4` (`calc_id`) USING BTREE -) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7341,11 +5739,11 @@ DROP TABLE IF EXISTS `cache`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cache` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(50) CHARACTER SET utf8 NOT NULL, + `name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `lifetime` time NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7358,8 +5756,8 @@ DROP TABLE IF EXISTS `cache_calc`; CREATE TABLE `cache_calc` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `cache_id` int(10) unsigned NOT NULL, - `cacheName` varchar(255) CHARACTER SET utf8 DEFAULT NULL, - `params` varchar(100) CHARACTER SET utf8 NOT NULL DEFAULT '', + `cacheName` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `params` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', `last_refresh` datetime DEFAULT NULL, `expires` datetime DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), @@ -7369,7 +5767,7 @@ CREATE TABLE `cache_calc` ( KEY `cache_id` (`cache_id`), KEY `cacheName` (`cacheName`), KEY `expires` (`expires`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7383,7 +5781,7 @@ CREATE TABLE `cache_valid` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `valid` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MEMORYDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7400,7 +5798,7 @@ CREATE TABLE `departure_limit` ( `minSpeed` decimal(10,2) NOT NULL DEFAULT 0.00, PRIMARY KEY (`warehouse_id`,`fecha`), CONSTRAINT `warehouse_departure` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7413,12 +5811,13 @@ DROP TABLE IF EXISTS `last_buy`; CREATE TABLE `last_buy` ( `item_id` int(10) unsigned NOT NULL, `warehouse_id` smallint(5) unsigned NOT NULL, - `buy_id` int(10) unsigned DEFAULT NULL, + `buy_id` int(11) DEFAULT NULL, `landing` date DEFAULT NULL, UNIQUE KEY `item_id` (`item_id`,`warehouse_id`) USING HASH, KEY `buy_id` (`buy_id`), - KEY `warehouse_id` (`warehouse_id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + KEY `warehouse_id` (`warehouse_id`) USING BTREE, + CONSTRAINT `last_buy_FK_1` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7435,9 +5834,9 @@ CREATE TABLE `prod_graphic_source` ( `hora` int(11) NOT NULL, `order` int(11) NOT NULL DEFAULT 0, `graphCategory` int(11) NOT NULL DEFAULT 0, - `Agencia` varchar(45) CHARACTER SET utf8 NOT NULL, + `Agencia` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7453,7 +5852,7 @@ CREATE TABLE `stock` ( `amount` int(11) NOT NULL, UNIQUE KEY `warehouse_id` (`warehouse_id`,`item_id`) USING HASH, KEY `warehouse_id_2` (`warehouse_id`) USING BTREE -) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7469,7 +5868,7 @@ CREATE TABLE `visible` ( `visible` int(11) NOT NULL, UNIQUE KEY `calc_id` (`calc_id`,`item_id`) USING HASH, KEY `id` (`item_id`) USING BTREE -) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7487,7 +5886,7 @@ CREATE TABLE `zoneAgencyFriendship` ( KEY `zoneAgencyFriendship_fk1_idx` (`zoneFk`), CONSTRAINT `zoneAgencyFriendship` FOREIGN KEY (`agencyModeFk`) REFERENCES `vn`.`agencyMode` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `zoneAgencyFriendship_fk1` FOREIGN KEY (`zoneFk`) REFERENCES `vn`.`zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7499,14 +5898,14 @@ 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 character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_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 `cacheCalc_clean` ON SCHEDULE EVERY 30 MINUTE STARTS '2022-01-28 09:29:18' ON COMPLETION NOT PRESERVE ENABLE DO CALL cacheCalc_clean */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `cacheCalc_clean` ON SCHEDULE EVERY 30 MINUTE STARTS '2022-01-28 09:29:18' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO CALL cacheCalc_clean */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -7517,14 +5916,14 @@ 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 character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_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 `cache_clean` ON SCHEDULE EVERY 5 MINUTE STARTS '2022-01-28 09:29:18' ON COMPLETION NOT PRESERVE ENABLE DO CALL cache_clean */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `cache_clean` ON SCHEDULE EVERY 5 MINUTE STARTS '2022-01-28 09:29:18' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO CALL cache_clean */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -7549,7 +5948,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `addressFriendship_Update`() BEGIN - REPLACE cache.addressFriendship + REPLACE cache.addressFriendship SELECT addressFk1, addressFk2, count(*) friendship FROM ( @@ -7560,7 +5959,7 @@ BEGIN AND t2.shipped >= TIMESTAMPADD(MONTH,-3,util.VN_CURDATE()) AND t.addressFk != t2.addressFk) sub GROUP BY addressFk1, addressFk2; - + REPLACE cache.zoneAgencyFriendship SELECT r.agencyModeFk, t.zoneFk, count(*) friendship FROM vn.route r @@ -7586,7 +5985,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!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) +CREATE DEFINER=`root`@`localhost` PROCEDURE `availableNoRaids_refresh`(OUT `vCalc` INT, IN `vRefresh` INT, IN `vWarehouse` INT, IN `vDated` DATE) proc: BEGIN DECLARE vStartDate DATE; DECLARE vEndDate DATETIME; @@ -7600,23 +5999,22 @@ proc: BEGIN RESIGNAL; END; - IF vDate < util.VN_CURDATE() THEN + IF vDated < util.VN_CURDATE() THEN LEAVE proc; END IF; - CALL vn.itemStock (vWarehouse, vDate, NULL); - - SET vParams = CONCAT_WS('/', vWarehouse, vDate); + SET vParams = CONCAT_WS('/', vWarehouse, vDated); + CALL vn.itemStock (vWarehouse, vDated, NULL); 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'); + -- Calcula algunos parametros necesarios + + SET vStartDate = TIMESTAMP(vDated, '00:00:00'); + SET vEndDate = TIMESTAMP(TIMESTAMPADD(DAY, 4, vDated), '23:59:59'); SELECT inventoried INTO vInventoryDate FROM vn.config; @@ -7625,108 +6023,87 @@ proc: BEGIN -- 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; + DROP TEMPORARY TABLE IF EXISTS tItemRange; + CREATE TEMPORARY TABLE tItemRange + (PRIMARY KEY (itemFk)) + ENGINE = MEMORY + SELECT c.itemFk, IF(it.life IS NULL, NULL, + TIMESTAMP(TIMESTAMPADD(DAY, it.life, c.landing), '23:59:59')) AS ended + FROM ( + SELECT b.itemFk, MAX(t.landed) landing + FROM vn.buy b + JOIN vn.entry e ON b.entryFk = e.id + JOIN vn.travel t ON t.id = e.travelFk + JOIN vn.warehouse w ON w.id = t.warehouseInFk + 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.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + HAVING ended >= vStartDate OR ended IS NULL; -- 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 + DROP TEMPORARY TABLE IF EXISTS tmp.itemCalc; + CREATE TEMPORARY TABLE tmp.itemCalc + (INDEX (itemFk, warehouseFk)) + SELECT itemFk, vWarehouse warehouseFk, DATE(dated) dated, SUM(quantity) quantity + FROM ( + SELECT i.itemFk, i.shipped dated, i.quantity FROM vn.itemTicketOut i - JOIN item_range_copy1 ir ON ir.item_id = i.itemFk + JOIN tItemRange ir ON ir.itemFk = i.itemFk WHERE i.shipped >= vStartDate - AND (ir.date_end IS NULL OR i.shipped <= ir.date_end) + AND (ir.ended IS NULL OR i.shipped <= ir.ended) AND i.warehouseFk = vWarehouse UNION ALL - SELECT i.itemFk, i.landed AS dat, i.quantity + SELECT i.itemFk, i.landed, i.quantity FROM vn.itemEntryIn i - JOIN item_range_copy2 ir ON ir.item_id = i.itemFk + JOIN tItemRange ir ON ir.itemFk = i.itemFk WHERE i.landed >= vStartDate - AND (ir.date_end IS NULL OR i.landed <= ir.date_end) + AND (ir.ended IS NULL OR i.landed <= ir.ended) AND i.warehouseInFk = vWarehouse AND i.isVirtualStock = FALSE UNION ALL - SELECT i.itemFk, i.shipped AS dat, i.quantity + SELECT i.itemFk, i.shipped, 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) + JOIN tItemRange ir ON ir.itemFk = i.itemFk + WHERE i.shipped >= vStartDate + AND (ir.ended IS NULL OR i.shipped <= ir.ended) 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 + JOIN tItemRange ir ON ir.itemFk = r.item_id WHERE r.shipment >= vStartDate - AND (ir.date_end IS NULL OR r.shipment <= ir.date_end) + AND (ir.ended IS NULL OR r.shipment <= ir.ended) 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; + GROUP BY itemFk, dated; - DROP TEMPORARY TABLE IF EXISTS - tmp.itemList - ,item_range - ,item_range_copy1 - ,item_range_copy2 - ,item_range_copy3 - ,item_range_copy4; + CALL vn.item_getAtp(vDated); + INSERT INTO availableNoRaids (calc_id, item_id, available) + SELECT vCalc, sub.itemFk, SUM(sub.quantity) + FROM ( + SELECT il.itemFk, stock quantity + FROM tmp.itemList il + JOIN tItemRange ir ON ir.itemFk = il.itemFk + UNION ALL + SELECT itemFk, quantity + FROM tmp.itemAtp + )sub + GROUP BY sub.itemFk; + + DROP TEMPORARY TABLE tmp.itemCalc, tItemRange; CALL cache_calc_end (vCalc); END ;; DELIMITER ; @@ -7756,12 +6133,12 @@ BEGIN FROM available a LEFT JOIN tCalc c ON c.id = a.calc_id WHERE c.id IS NULL; - + DELETE a FROM availableNoRaids a LEFT JOIN tCalc c ON c.id = a.calc_id WHERE c.id IS NULL; - + DROP TEMPORARY TABLE tCalc; END ;; DELIMITER ; @@ -7779,10 +6156,9 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `available_refresh`(OUT `vCalc` INT, IN `vRefresh` INT, IN `vWarehouse` INT, IN `vDate` DATE) +CREATE DEFINER=`root`@`localhost` PROCEDURE `available_refresh`(OUT `vCalc` INT, IN `vRefresh` INT, IN `vWarehouse` INT, IN `vDated` DATE) proc: BEGIN DECLARE vStartDate DATE; - DECLARE vEndDate DATETIME; DECLARE vReserveDate DATETIME; DECLARE vParams CHAR(100); DECLARE vInventoryDate DATE; @@ -7794,13 +6170,13 @@ proc: BEGIN RESIGNAL; END; - IF vDate < util.VN_CURDATE() THEN + IF vDated < util.VN_CURDATE() THEN LEAVE proc; END IF; - CALL vn.itemStock (vWarehouse, vDate, NULL); + CALL vn.itemStock(vWarehouse, vDated, NULL); - SET vParams = CONCAT_WS('/', vWarehouse, vDate); + SET vParams = CONCAT_WS('/', vWarehouse, vDated); CALL cache_calc_start (vCalc, vRefresh, 'available', vParams); IF !vRefresh THEN @@ -7808,131 +6184,101 @@ proc: BEGIN END IF; -- Invoca al procedimiento que genera el stock virtual de Logiflora, si coincide con la peticion de refresco del disponible - IF vn.isLogifloraDay(vDate, vWarehouse) THEN - + IF vn.isLogifloraDay(vDated, vWarehouse) THEN -- CALL edi.floramondo_offerRefresh; SET vIsLogifloraDay = TRUE; - ELSE - SET vIsLogifloraDay = FALSE; - - END IF; - - -- Calcula algunos parámetros necesarios - - SET vStartDate = TIMESTAMP(vDate, '00:00:00'); - SET vEndDate = TIMESTAMP(TIMESTAMPADD(DAY, 4, vDate), '23:59:59'); + END IF; + -- Calcula algunos parámetros necesarios + SET vStartDate = TIMESTAMP(vDated, '00:00:00'); SELECT inventoried INTO vInventoryDate FROM vn.config; - SELECT SUBTIME(util.VN_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 - WHERE t.landed BETWEEN vInventoryDate AND vStartDate - AND t.warehouseInFk = vWarehouse - AND NOT e.isInventory - 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; + DROP TEMPORARY TABLE IF EXISTS itemRange; + CREATE TEMPORARY TABLE itemRange + (PRIMARY KEY (itemFk)) + ENGINE = MEMORY + SELECT c.itemFk, + IF(it.life IS NULL, + NULL, + TIMESTAMP(TIMESTAMPADD(DAY, it.life, c.landing), '23:59:59')) ended + FROM ( + SELECT b.itemFk, MAX(t.landed) landing + FROM vn.buy b + JOIN vn.entry e ON b.entryFk = e.id + JOIN vn.travel t ON t.id = e.travelFk + JOIN vn.warehouse w ON w.id = t.warehouseInFk + WHERE t.landed BETWEEN vInventoryDate AND vStartDate + AND t.warehouseInFk = vWarehouse + AND NOT e.isExcludedFromAvailable + GROUP BY b.itemFk + ) c + JOIN vn.item i ON i.id = c.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + HAVING ended >= vStartDate OR ended IS NULL; -- Calcula el ATP - DELETE FROM available WHERE calc_id = vCalc; - INSERT INTO available (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 + DROP TEMPORARY TABLE IF EXISTS tmp.itemCalc; + CREATE TEMPORARY TABLE tmp.itemCalc + (INDEX (itemFk,warehouseFk)) + ENGINE = MEMORY + SELECT itemFk, vWarehouse warehouseFk, DATE(dated) dated, SUM(quantity) quantity + FROM (SELECT i.itemFk, i.shipped dated, i.quantity FROM vn.itemTicketOut i - JOIN item_range_copy1 ir ON ir.item_id = i.itemFk + JOIN itemRange ir ON ir.itemFk = i.itemFk WHERE i.shipped >= vStartDate - AND (ir.date_end IS NULL OR i.shipped <= ir.date_end) + AND (ir.ended IS NULL OR i.shipped <= ir.ended) AND i.warehouseFk = vWarehouse UNION ALL - SELECT i.itemFk, i.landed AS dat, i.quantity + SELECT i.itemFk, i.landed, i.quantity FROM vn.itemEntryIn i - JOIN item_range_copy2 ir ON ir.item_id = i.itemFk - LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = i.entryFk + JOIN itemRange ir ON ir.itemFk = i.itemFk + LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = i.entryFk WHERE i.landed >= vStartDate - AND (ir.date_end IS NULL OR i.landed <= ir.date_end) + AND (ir.ended IS NULL OR i.landed <= ir.ended) AND i.warehouseInFk = vWarehouse AND (ISNULL(wf.entryFk) OR vIsLogifloraDay) UNION ALL - SELECT i.itemFk, i.shipped AS dat, i.quantity + SELECT i.itemFk, i.shipped, 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) + JOIN itemRange ir ON ir.itemFk = i.itemFk + WHERE i.shipped >= vStartDate + AND (ir.ended IS NULL OR i.shipped <= ir.ended) 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 + JOIN itemRange ir ON ir.itemFk = r.item_id WHERE r.shipment >= vStartDate - AND (ir.date_end IS NULL OR r.shipment <= ir.date_end) + AND (ir.ended IS NULL OR r.shipment <= ir.ended) 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; + ) t + GROUP BY itemFk, dated; - DROP TEMPORARY TABLE IF EXISTS - tmp.itemList - ,item_range - ,item_range_copy1 - ,item_range_copy2 - ,item_range_copy3 - ,item_range_copy4; + CALL vn.item_getAtp(vDated); - + INSERT INTO available (calc_id, item_id, available) + SELECT vCalc, sub.itemFk, SUM(sub.quantity) + FROM ( + SELECT ir.itemFk, stock quantity + FROM tmp.itemList il + JOIN itemRange ir ON ir.itemFk = il.itemFk + UNION ALL + SELECT itemFk, quantity + FROM tmp.itemAtp + )sub + GROUP BY sub.itemFk; + + DROP TEMPORARY TABLE tmp.itemCalc, itemRange; CALL cache_calc_end (vCalc); END ;; DELIMITER ; @@ -8054,9 +6400,9 @@ proc: BEGIN 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' + 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 util.VN_NOW() < v_expires @@ -8120,7 +6466,7 @@ proc: BEGIN 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 @@ -8165,8 +6511,8 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`() BEGIN - - DECLARE vDateShort DATETIME; + + DECLARE vDateShort DATETIME; SET vDateShort = TIMESTAMPADD(MONTH, -1, util.VN_CURDATE()); @@ -8217,7 +6563,7 @@ DECLARE rs CURSOR FOR DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - SET myTime = HOUR(util.VN_NOW()) + MINUTE(util.VN_NOW()) / 60; + SET myTime = HOUR(util.VN_NOW()) + MINUTE(util.VN_NOW()) / 60; OPEN rs; @@ -8226,23 +6572,23 @@ DECLARE rs CURSOR FOR WHILE NOT done DO SET resto = IF(inicioProd < rsDeparture, rsDeparture - inicioProd,0); - + SET inicioProd = rsDeparture - rsHoras; - + IF inicioProd - resto < myTime THEN - + SET done = TRUE; - + ELSE - + SET departureLimit = rsDeparture; - + FETCH rs INTO rsDeparture, rsHoras , rsInicio; - + -- SELECT rsDeparture, rsHoras , rsInicio; - + END IF; - + END WHILE; SET departureLimit = IFNULL(departureLimit,24); @@ -8258,95 +6604,6 @@ DECLARE rs CURSOR FOR 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 `departure_timing_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 `departure_timing_beta__`(vWarehouseId INT) -BEGIN - -DECLARE done BOOL DEFAULT FALSE; -DECLARE rsDeparture INT; -DECLARE rsHoras DECIMAL(5,2); -DECLARE rsInicio DECIMAL(5,2); -DECLARE resto DECIMAL(5,2); -DECLARE horasProd DECIMAL(5,2); -DECLARE inicioProd DECIMAL(5,2) DEFAULT 24.00; -DECLARE myTime DECIMAL(5,2); -DECLARE departureLimit INT; - -DECLARE rs CURSOR FOR - SELECT Departure - , Sum(pb.m3)/GREATEST(v.m3,IFNULL(minSpeed,0)) AS Horas - , util.VN_CURDATE()+(Departure-(Sum(pb.m3)/GREATEST(v.m3,IFNULL(minSpeed,0)))/24) AS InicioPreparacion - FROM tmp.production_buffer pb - JOIN vn2008.v_encajado_ultima_hora v ON v.warehouse_id = pb.warehouse_id - LEFT JOIN cache.departure_limit dp ON dp.warehouse_id = pb.warehouse_id AND dp.fecha = util.VN_CURDATE() - WHERE pb.Fecha = util.VN_CURDATE() - AND alert_level < 2 - AND IFNULL(Departure,0) > 0 - GROUP BY Departure - ORDER BY Departure DESC; - -DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - -SET myTime = HOUR(util.VN_NOW()) + MINUTE(util.VN_NOW()) / 60; - -OPEN rs; - -FETCH rs INTO rsDeparture, rsHoras , rsInicio; - -SELECT rsDeparture, rsHoras , rsInicio, vWarehouseId, done; - -WHILE NOT done DO - - SET resto = IF(inicioProd < rsDeparture, rsDeparture - inicioProd,0); - - SET inicioProd = rsDeparture - rsHoras; - - SELECT rsDeparture, rsHoras , rsInicio, resto,inicioProd; - - IF inicioProd - resto < myTime THEN - - SET done = TRUE; - - ELSE - - SET departureLimit = rsDeparture; - - FETCH rs INTO rsDeparture, rsHoras , rsInicio; - - END IF; - -END WHILE; - -SELECT rsDeparture, rsHoras , rsInicio, resto,inicioProd; - - -SET departureLimit = IFNULL(departureLimit,24); - -IF departureLimit > 0 THEN - - REPLACE cache.departure_limit(warehouse_id, fecha, hora, minSpeed) - VALUES (vWarehouseId, util.VN_CURDATE(), departureLimit, myMinSpeed); - -END IF; - -CLOSE rs; - - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -8376,7 +6633,7 @@ proc: BEGIN DECLARE started DATE; DECLARE ended DATE; DECLARE vLastRefresh DATE; - + DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN CALL cache_calc_unlock (vCalc); @@ -8426,14 +6683,14 @@ proc: BEGIN DECLARE datEQ DATETIME; DECLARE timDIF TIME; DECLARE v_calc INT; - + CALL cache_calc_start (v_calc, v_refresh, 'prod_graphic', wh_id); - + IF !v_refresh THEN LEAVE proc; END IF; - + CALL vn2008.production_control_source(wh_id, 0); DELETE FROM prod_graphic_source; @@ -8451,8 +6708,8 @@ proc: BEGIN WHERE Fecha = util.VN_CURDATE() GROUP BY wh_id, graphCategory ; - - + + CALL cache_calc_end (v_calc); END ;; DELIMITER ; @@ -8473,7 +6730,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `stock_refresh`(v_refresh BOOL) proc: BEGIN /** - * Crea o actualiza la cache con el disponible hasta el día de + * Crea o actualiza la cache con el disponible hasta el día de * ayer. Esta cache es usada como base para otros procedimientos * como el cáculo del visible o del ATP. * @@ -8499,21 +6756,21 @@ proc: BEGIN SET v_date_inv = (SELECT inventoried FROM vn.config LIMIT 1); SET v_curdate = util.VN_CURDATE(); - + DELETE FROM stock; - + INSERT INTO stock (item_id, warehouse_id, amount) SELECT item_id, warehouse_id, SUM(amount) amount FROM ( - SELECT itemFk AS item_id, warehouseFk AS warehouse_id, quantity AS amount + SELECT itemFk AS item_id, warehouseFk AS warehouse_id, quantity AS amount FROM vn.itemTicketOut WHERE shipped >= v_date_inv AND shipped < v_curdate UNION ALL - SELECT itemFk ASitem_id, warehouseInFk AS warehouse_id, quantity AS amount + SELECT itemFk ASitem_id, warehouseInFk AS warehouse_id, quantity AS amount FROM vn.itemEntryIn WHERE landed >= v_date_inv AND landed < v_curdate AND isVirtualStock is FALSE UNION ALL - SELECT itemFk AS item_id ,warehouseOutFk AS warehouse_id, quantity AS amount + SELECT itemFk AS item_id ,warehouseOutFk AS warehouse_id, quantity AS amount FROM vn.itemEntryOut WHERE shipped >= v_date_inv AND shipped < v_curdate ) t @@ -8526,70 +6783,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 `stock_refresh__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `stock_refresh__`(v_refresh BOOL) -proc: BEGIN -/** - * bernat: WORKING IN THIS FILE - * Crea o actualiza la cache con el disponible hasta el día de - * ayer. Esta cache es usada como base para otros procedimientos - * como el cáculo del visible o del ATP. - * - * @param v_refresh %TRUE para forzar el recálculo de la cache - **/ - DECLARE v_calc INT; - DECLARE v_date_inv DATE; - DECLARE v_curdate DATE; - DECLARE v_last_refresh DATETIME; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - CALL cache_calc_unlock (v_calc); - RESIGNAL; - END; - - CALL cache_calc_start (v_calc, v_refresh, 'stock', NULL); - - IF !v_refresh - THEN - LEAVE proc; - END IF; - - SET v_date_inv = (SELECT FechaInventario FROM vn2008.tblContadores LIMIT 1); - SET v_curdate = util.VN_CURDATE(); - - DELETE FROM stock; - - INSERT INTO stock (item_id, warehouse_id, amount) - SELECT item_id, warehouse_id, SUM(amount) amount FROM - ( - SELECT item_id, warehouse_id, amount FROM vn2008.item_out - WHERE dat >= v_date_inv AND dat < v_curdate - UNION ALL - SELECT item_id, warehouse_id, amount FROM vn2008.item_entry_in - WHERE dat >= v_date_inv AND dat < v_curdate AND isVirtualStock is FALSE - UNION ALL - SELECT item_id ,warehouse_id, amount FROM vn2008.item_entry_out - WHERE dat >= v_date_inv AND dat < v_curdate - ) t - GROUP BY item_id, warehouse_id HAVING amount != 0; - - CALL cache_calc_end (v_calc); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_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_clean` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8607,12 +6800,12 @@ BEGIN (INDEX (id)) ENGINE = MEMORY SELECT id FROM cache_calc; - + DELETE v FROM visible v LEFT JOIN tCalc c ON c.id = v.calc_id WHERE c.id IS NULL; - + DROP TEMPORARY TABLE tCalc; END ;; DELIMITER ; @@ -8643,11 +6836,11 @@ proc: BEGIN IF !v_refresh THEN LEAVE proc; END IF; - + -- Calculamos el stock hasta ayer - + CALL `cache`.stock_refresh(false); - + DROP TEMPORARY TABLE IF EXISTS vn2008.tmp_item; CREATE TEMPORARY TABLE vn2008.tmp_item (PRIMARY KEY (item_id)) @@ -8656,65 +6849,9 @@ proc: BEGIN WHERE warehouse_id = v_warehouse; -- Calculamos los movimientos confirmados de hoy - CALL vn.item_GetVisible(v_warehouse, NULL); - DELETE FROM visible WHERE calc_id = v_calc; - - INSERT INTO visible (calc_id, item_id,visible) - SELECT v_calc, item_id, visible FROM vn2008.tmp_item; - CALL cache_calc_end (v_calc); - - DROP TEMPORARY TABLE vn2008.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 `visible_refresh__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_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_refresh__`(OUT v_calc INT, v_refresh BOOL, v_warehouse INT) -proc: BEGIN - -- bernat working in this file - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - CALL cache_calc_unlock (v_calc); - RESIGNAL; - END; - - CALL cache_calc_start (v_calc, v_refresh, 'visible', v_warehouse); - - IF !v_refresh THEN - LEAVE proc; - END IF; - - -- Calculamos el stock hasta ayer - - CALL `cache`.stock_refresh(false); - - DROP TEMPORARY TABLE IF EXISTS vn2008.tmp_item; - CREATE TEMPORARY TABLE vn2008.tmp_item - (PRIMARY KEY (item_id)) - ENGINE = MEMORY - SELECT item_id, amount stock, amount visible FROM `cache`.stock - WHERE warehouse_id = v_warehouse; - - -- Calculamos los movimientos confirmados de hoy - - CALL vn2008.item_stock_visible(v_warehouse, NULL); - - DELETE FROM visible WHERE calc_id = v_calc; - INSERT INTO visible (calc_id, item_id,visible) SELECT v_calc, item_id, visible FROM vn2008.tmp_item; @@ -8732,7 +6869,7 @@ DELIMITER ; -- Current Database: `edi` -- -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `edi` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `edi` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci */; USE `edi`; @@ -8746,21 +6883,21 @@ DROP TABLE IF EXISTS `PriceDetails`; CREATE TABLE `PriceDetails` ( `ID` int(11) NOT NULL, `SuplyResponseID` int(11) NOT NULL, - `PriceType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `Location` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `PriceType` varchar(255) DEFAULT NULL, + `Location` varchar(255) DEFAULT NULL, `Price` decimal(10,2) DEFAULT NULL, `BasisQuantitiy` int(11) DEFAULT NULL, - `BasisQuantityType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `BasisQuantityType` varchar(255) DEFAULT NULL, `MinimumQuantity` int(11) DEFAULT NULL, - `MinimumQuantityType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `MinimumQuantityType` varchar(255) DEFAULT NULL, `MaximumQuantity Integer` int(11) DEFAULT NULL, - `MaximumQuantityType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `MaximumQuantityType` varchar(255) DEFAULT NULL, `LatestDeliveryDateTime` datetime DEFAULT NULL, `EarliestDespatchDateTime` datetime DEFAULT NULL, `FirstOrderDateTime` datetime DEFAULT NULL, `LatestOrderDateTime` datetime DEFAULT NULL, PRIMARY KEY (`ID`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8772,19 +6909,19 @@ DROP TABLE IF EXISTS `VMPSettings`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `VMPSettings` ( `VMPID` int(11) NOT NULL, - `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `name` varchar(45) DEFAULT NULL, `isEktSender` tinyint(4) NOT NULL DEFAULT 0, `MessageID` int(11) NOT NULL, `dateTimeTry` timestamp NULL DEFAULT NULL, `isVmpBA` tinyint(4) DEFAULT NULL COMMENT 'Basic authentication', `vmpVersion` int(11) DEFAULT NULL, - `vmpUrl` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `loginName` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, - `loginPassword` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, + `vmpUrl` varchar(255) DEFAULT NULL, + `loginName` varchar(150) DEFAULT NULL, + `loginPassword` varchar(150) DEFAULT NULL, `refreshRate` int(11) DEFAULT NULL, - `eanBuyer` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `eanSupplier` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `eanAgent` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + `eanBuyer` varchar(15) DEFAULT NULL, + `eanSupplier` varchar(15) DEFAULT NULL, + `eanAgent` varchar(15) DEFAULT NULL, `dateTimeLastSync` timestamp NULL DEFAULT NULL, `closedFrom` int(11) DEFAULT NULL, `closedTo` int(11) DEFAULT NULL, @@ -8792,11 +6929,11 @@ CREATE TABLE `VMPSettings` ( `UseSupplierEmbalageCode` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'vmp you want to see their embalage code', `firstSupplyResponseId` int(11) DEFAULT NULL, `ApiId` int(11) DEFAULT NULL, - `ApiKey` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `ApiKey` varchar(100) DEFAULT NULL, `isBlocked` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'product source not allowed', `isVNHSupplier` tinyint(1) DEFAULT 0 COMMENT 'The account belongs to VNH', PRIMARY KEY (`VMPID`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8809,7 +6946,7 @@ DROP TABLE IF EXISTS `bucket`; CREATE TABLE `bucket` ( `bucket_id` int(11) unsigned NOT NULL, `bucket_type_id` mediumint(8) unsigned NOT NULL, - `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(100) NOT NULL, `x_size` mediumint(8) unsigned NOT NULL COMMENT 'mm', `y_size` mediumint(8) unsigned NOT NULL COMMENT 'mm', `z_size` mediumint(8) unsigned NOT NULL COMMENT 'mm', @@ -8819,7 +6956,7 @@ CREATE TABLE `bucket` ( PRIMARY KEY (`bucket_id`), KEY `group_id` (`y_size`), KEY `plant_id` (`x_size`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/VBN020101/CK090916.txt'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='/tmp/floricode/VBN020101/CK090916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8831,12 +6968,12 @@ DROP TABLE IF EXISTS `bucket_type`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `bucket_type` ( `bucket_type_id` mediumint(8) unsigned NOT NULL, - `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(100) NOT NULL, `entry_date` date DEFAULT NULL, `expiry_date` date DEFAULT NULL, `change_date_time` datetime DEFAULT NULL, PRIMARY KEY (`bucket_type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/VBN020101/FB090916.txt'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='/tmp/floricode/VBN020101/FB090916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8852,7 +6989,7 @@ CREATE TABLE `clientFHAdminNumber` ( PRIMARY KEY (`clientFk`), KEY `clientFHAdminNumber_fk_idx` (`fhAdminNumber`), CONSTRAINT `clientFHAdminNumber_fk` FOREIGN KEY (`fhAdminNumber`) REFERENCES `vn`.`company` (`fhAdminNumber`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8864,8 +7001,8 @@ DROP TABLE IF EXISTS `deliveryInformation`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `deliveryInformation` ( `ID` int(11) NOT NULL AUTO_INCREMENT, - `DeliveryType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `Location` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `DeliveryType` varchar(255) DEFAULT NULL, + `Location` varchar(255) DEFAULT NULL, `DeliveryPrice` decimal(10,2) DEFAULT NULL, `ChargeAmount` decimal(10,2) DEFAULT NULL, `BasisQuantitiy` int(11) DEFAULT NULL, @@ -8878,13 +7015,13 @@ CREATE TABLE `deliveryInformation` ( `supplyResponseID` int(11) DEFAULT NULL, `updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`ID`), - UNIQUE KEY `deliveryInformation_UN` (`Location`,`LatestDeliveryDateTime`,`FirstOrderDateTime`,`LatestOrderDateTime`,`supplyResponseID`), + UNIQUE KEY `deliveryInformation_UN` (`Location`,`LatestDeliveryDateTime`,`FirstOrderDateTime`,`LatestOrderDateTime`,`supplyResponseID`,`DeliveryType`), KEY `fgbSupplyResponse_idx` (`supplyResponseID`), KEY `fgbSupplyResponse_idx2` (`FirstOrderDateTime`), KEY `fgbSupplyResponse_idx3` (`LatestOrderDateTime`) USING BTREE, KEY `deliveryInformation_updated_IDX` (`updated`) USING BTREE, CONSTRAINT `fgbSupplyResponse` FOREIGN KEY (`supplyResponseID`) REFERENCES `supplyResponse` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8896,14 +7033,14 @@ DROP TABLE IF EXISTS `di`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `di` ( `ID` int(11) NOT NULL DEFAULT 0, - `Location` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `Location` varchar(255) DEFAULT NULL, `LatestDeliveryDateTime` datetime DEFAULT NULL, `FirstOrderDateTime` datetime DEFAULT NULL, `LatestOrderDateTime` datetime DEFAULT NULL, `supplyResponseID` int(11) DEFAULT NULL, PRIMARY KEY (`ID`), UNIQUE KEY `di_UN` (`Location`,`LatestDeliveryDateTime`,`FirstOrderDateTime`,`LatestOrderDateTime`,`supplyResponseID`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8914,45 +7051,49 @@ DROP TABLE IF EXISTS `ekt`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ekt` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `barcode` char(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `entryYear` smallint(5) unsigned NOT NULL, - `deliveryNumber` bigint(20) unsigned DEFAULT NULL, - `fec` date DEFAULT NULL, - `hor` time DEFAULT NULL, - `util.VN_NOW` timestamp NULL DEFAULT current_timestamp(), - `ptj` mediumint(8) unsigned DEFAULT NULL, - `ref` int(11) NOT NULL, - `item` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `pac` int(11) DEFAULT 0, - `qty` int(10) NOT NULL, - `ori` varchar(3) COLLATE utf8_unicode_ci DEFAULT 'NL', - `cat` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, - `agj` int(11) DEFAULT NULL, - `kop` int(11) DEFAULT NULL, - `ptd` varchar(6) COLLATE utf8_unicode_ci DEFAULT NULL, - `sub` mediumint(8) unsigned DEFAULT NULL, - `pro` mediumint(8) unsigned NOT NULL, - `pri` double NOT NULL, - `package` int(10) unsigned DEFAULT NULL, - `auction` smallint(5) unsigned DEFAULT NULL, - `klo` smallint(5) unsigned DEFAULT NULL, - `k1` smallint(5) unsigned DEFAULT NULL, - `k2` smallint(5) unsigned DEFAULT NULL, - `k3` tinyint(3) unsigned DEFAULT NULL, - `k4` tinyint(3) unsigned DEFAULT NULL, - `s1` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `s2` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `s3` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `s4` varchar(4) COLLATE utf8_unicode_ci DEFAULT NULL, - `s5` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `s6` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Id', + `barcode` char(25) DEFAULT NULL COMMENT 'Generated auction barcode', + `entryYear` smallint(5) unsigned NOT NULL COMMENT 'Transaction year', + `batchNumber` bigint(20) unsigned DEFAULT NULL COMMENT 'RFF+BT', + `deliveryNumber` bigint(20) unsigned DEFAULT NULL COMMENT 'RFF+AAJ', + `vendorOrderNumber` bigint(20) unsigned DEFAULT NULL COMMENT 'RFF+VN', + `fec` date DEFAULT NULL COMMENT 'DTM+97', + `hor` time DEFAULT NULL COMMENT 'UNB', + `util.VN_NOW` timestamp NULL DEFAULT current_timestamp() COMMENT 'Creation time', + `ptj` bigint(20) unsigned DEFAULT NULL COMMENT 'NAD+BY', + `ref` int(11) NOT NULL COMMENT 'LIN', + `item` varchar(50) DEFAULT NULL COMMENT 'IMD+S99', + `pac` int(11) DEFAULT 0 COMMENT 'QTY+52', + `qty` int(10) NOT NULL COMMENT 'QTY+66', + `ori` varchar(3) DEFAULT 'NL' COMMENT 'IMD+S62', + `cat` varchar(2) DEFAULT NULL COMMENT 'IMD+S98', + `agj` int(11) DEFAULT NULL COMMENT 'RFF+AGJ', + `kop` int(11) DEFAULT NULL COMMENT 'RFF+ADZ', + `ptd` varchar(6) DEFAULT NULL COMMENT 'RFF+ACE', + `sub` mediumint(8) unsigned DEFAULT NULL COMMENT 'RFF+CTS', + `pro` mediumint(8) unsigned NOT NULL COMMENT 'NAD+MF', + `pri` double NOT NULL COMMENT 'PRI+INV', + `package` int(10) unsigned DEFAULT NULL COMMENT 'PAC', + `auction` smallint(5) unsigned DEFAULT NULL COMMENT 'NAD+FLA', + `klo` smallint(5) unsigned DEFAULT NULL COMMENT 'RFF+FAC', + `k1` smallint(5) unsigned DEFAULT NULL COMMENT 'IMD+K01', + `k2` smallint(5) unsigned DEFAULT NULL COMMENT 'IMD+K02', + `k3` tinyint(3) unsigned DEFAULT NULL COMMENT 'IMD+P01', + `k4` tinyint(3) unsigned DEFAULT NULL COMMENT 'IMD+P02', + `s1` varchar(3) DEFAULT NULL, + `s2` varchar(3) DEFAULT NULL, + `s3` varchar(3) DEFAULT NULL, + `s4` varchar(4) DEFAULT NULL, + `s5` varchar(3) DEFAULT NULL, + `s6` varchar(3) DEFAULT NULL, `ok` tinyint(4) NOT NULL DEFAULT 0, `trolleyFk` int(11) DEFAULT NULL, - `putOrderFk` bigint(20) unsigned DEFAULT NULL, - `scanned` tinyint(1) NOT NULL DEFAULT 0, + `putOrderFk` bigint(20) unsigned DEFAULT NULL COMMENT 'RFF+ON', + `scanned` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Whether it''s been scanned', + `cps` varchar(7) DEFAULT NULL COMMENT 'Código alfanumérico de Floriday', + `dp` bigint(20) unsigned DEFAULT NULL COMMENT 'NAD+DP', + `sender` bigint(20) unsigned DEFAULT NULL COMMENT 'NAD+SE', PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `barcode_year` (`barcode`,`entryYear`), UNIQUE KEY `entry_year` (`deliveryNumber`,`entryYear`) USING BTREE, KEY `ref` (`ref`), KEY `ptj` (`ptj`), @@ -8960,30 +7101,89 @@ CREATE TABLE `ekt` ( KEY `kop` (`kop`), KEY `barcode` (`barcode`), KEY `fec` (`fec`), - KEY `putOrderFk` (`putOrderFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + KEY `putOrderFk` (`putOrderFk`), + KEY `ekt_batchNumber` (`batchNumber`) USING BTREE, + KEY `ekt_vendorOrderNumber` (`vendorOrderNumber`) USING BTREE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `ektEntryAssign__` +-- Table structure for table `ektConfig` -- -DROP TABLE IF EXISTS `ektEntryAssign__`; +DROP TABLE IF EXISTS `ektConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ektEntryAssign__` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `kop` int(11) DEFAULT NULL, - `sub` mediumint(8) unsigned DEFAULT NULL, - `warehouseOutFk` int(11) DEFAULT NULL, - `warehouseInFk` int(11) DEFAULT NULL, - `agencyModeFk` int(11) DEFAULT NULL, - `supplierFk` int(11) DEFAULT NULL, - `entryFk` int(11) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='define las condiciones para asignar entradas a los ekt'; +CREATE TABLE `ektConfig` ( + `usefulAuctionLeftSegmentLength` int(11) NOT NULL DEFAULT 13 COMMENT 'Segmento aprovechable del codigo de barras de Floricode', + `standardBarcodeLength` int(11) NOT NULL DEFAULT 20 COMMENT 'Longitud del código de barras standard de Floricode', + `floridayBarcodeLength` int(11) NOT NULL DEFAULT 6, + `floramondoBarcodeLength` int(11) NOT NULL DEFAULT 13 COMMENT 'Longitud del código de los albaranes múltiples de Floramondo', + `defaultKlo` int(11) NOT NULL DEFAULT 99 COMMENT 'Reloj por defecto', + `ektRecentScopeDays` int(11) NOT NULL DEFAULT 7 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `ektRecent` +-- + +DROP TABLE IF EXISTS `ektRecent`; +/*!50001 DROP VIEW IF EXISTS `ektRecent`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ektRecent` ( + `id` tinyint NOT NULL, + `barcode` tinyint NOT NULL, + `entryYear` tinyint NOT NULL, + `batchNumber` tinyint NOT NULL, + `deliveryNumber` tinyint NOT NULL, + `vendorOrderNumber` tinyint NOT NULL, + `fec` tinyint NOT NULL, + `hor` tinyint NOT NULL, + `util.VN_NOW` tinyint NOT NULL, + `ptj` tinyint NOT NULL, + `ref` tinyint NOT NULL, + `item` tinyint NOT NULL, + `pac` tinyint NOT NULL, + `qty` tinyint NOT NULL, + `ori` tinyint NOT NULL, + `cat` tinyint NOT NULL, + `agj` tinyint NOT NULL, + `kop` tinyint NOT NULL, + `ptd` tinyint NOT NULL, + `sub` tinyint NOT NULL, + `pro` tinyint NOT NULL, + `pri` tinyint NOT NULL, + `package` tinyint NOT NULL, + `auction` tinyint NOT NULL, + `klo` tinyint NOT NULL, + `k1` tinyint NOT NULL, + `k2` tinyint NOT NULL, + `k3` tinyint NOT NULL, + `k4` tinyint NOT NULL, + `s1` tinyint NOT NULL, + `s2` tinyint NOT NULL, + `s3` tinyint NOT NULL, + `s4` tinyint NOT NULL, + `s5` tinyint NOT NULL, + `s6` tinyint NOT NULL, + `ok` tinyint NOT NULL, + `trolleyFk` tinyint NOT NULL, + `putOrderFk` tinyint NOT NULL, + `scanned` tinyint NOT NULL, + `cps` tinyint NOT NULL, + `dp` tinyint NOT NULL, + `sender` tinyint NOT NULL, + `usefulAuctionLeftSegmentLength` tinyint NOT NULL, + `standardBarcodeLength` tinyint NOT NULL, + `floridayBarcodeLength` tinyint NOT NULL, + `floramondoBarcodeLength` tinyint NOT NULL, + `defaultKlo` tinyint NOT NULL, + `ektRecentScopeDays` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `errorList` -- @@ -9024,7 +7224,7 @@ CREATE TABLE `exchange` ( KEY `buy_edi_id` (`ektFk`), CONSTRAINT `exchange_ibfk_1` FOREIGN KEY (`mailFk`) REFERENCES `mail` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `exchange_ibfk_2` FOREIGN KEY (`ektFk`) REFERENCES `ekt` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9036,14 +7236,14 @@ DROP TABLE IF EXISTS `exchangeConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `exchangeConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `logMail` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Mail where the log information is sent', + `logMail` varchar(150) DEFAULT NULL COMMENT 'Mail where the log information is sent', `restrictToSenders` tinyint(4) NOT NULL COMMENT 'Whether to process mails only from known senders', `presaleFk` mediumint(8) unsigned DEFAULT NULL, `defaultKop` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `presale_id` (`presaleFk`), CONSTRAINT `exchangeConfig_ibfk_1` FOREIGN KEY (`presaleFk`) REFERENCES `exchangeType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9055,9 +7255,9 @@ DROP TABLE IF EXISTS `exchangeType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `exchangeType` ( `id` mediumint(8) unsigned NOT NULL, - `description` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(50) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9069,14 +7269,14 @@ DROP TABLE IF EXISTS `feature`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `feature` ( `item_id` int(11) unsigned NOT NULL, - `feature_type_id` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `feature_value` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `feature_type_id` varchar(3) NOT NULL, + `feature_value` varchar(3) NOT NULL, `entry_date` date NOT NULL, `expiry_date` date NOT NULL, `change_date_time` datetime NOT NULL, PRIMARY KEY (`item_id`,`feature_type_id`), KEY `feature_ix1` (`feature_value`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FF130916.txt'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='/tmp/floricode/florecompc2/FF130916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9087,13 +7287,12 @@ DROP TABLE IF EXISTS `fileConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `fileConfig` ( - `fileName` varchar(2) COLLATE utf8_unicode_ci NOT NULL, - `toTable` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `file` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `updated` date DEFAULT NULL, - PRIMARY KEY (`fileName`), - UNIQUE KEY `to_table` (`toTable`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + `name` varchar(25) NOT NULL, + `checksum` text DEFAULT NULL, + `keyValue` tinyint(1) NOT NULL DEFAULT 1, + PRIMARY KEY (`name`), + UNIQUE KEY `fileConfig_name_uindex` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9106,7 +7305,7 @@ DROP TABLE IF EXISTS `floraHollandConfig`; CREATE TABLE `floraHollandConfig` ( `defaultAdminNumber` int(11) NOT NULL DEFAULT 66011, `floramondoMargin` decimal(10,2) NOT NULL DEFAULT 0.17 -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9118,11 +7317,11 @@ DROP TABLE IF EXISTS `ftpConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ftpConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `host` varchar(255) CHARACTER SET utf8 NOT NULL, - `user` varchar(50) CHARACTER SET utf8 NOT NULL, - `password` varchar(50) CHARACTER SET utf8 NOT NULL, + `host` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `user` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `password` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9134,13 +7333,13 @@ DROP TABLE IF EXISTS `genus`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `genus` ( `genus_id` mediumint(8) unsigned NOT NULL, - `latin_genus_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `latin_genus_name` varchar(100) NOT NULL, `entry_date` date DEFAULT NULL, `expiry_date` date DEFAULT NULL, `change_date_time` datetime DEFAULT NULL, `isHazard` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`genus_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FG130916.txt'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='/tmp/floricode/florecompc2/FG130916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9151,11 +7350,11 @@ DROP TABLE IF EXISTS `goodCharacteristic`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `goodCharacteristic` ( - `supplyResponse` varchar(26) COLLATE utf8_unicode_ci NOT NULL, - `type` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'edi.type', - `value` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'edi.value', + `supplyResponse` varchar(26) NOT NULL, + `type` varchar(3) DEFAULT NULL COMMENT 'edi.type', + `value` varchar(3) DEFAULT NULL COMMENT 'edi.value', PRIMARY KEY (`supplyResponse`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9167,14 +7366,16 @@ DROP TABLE IF EXISTS `imapConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `imapConfig` ( `id` tinyint(3) unsigned NOT NULL, - `host` varchar(150) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'localhost', - `user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `pass` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `cleanPeriod` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'How long the old mails are preserved', - `successFolder` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, - `errorFolder` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='IMAP configuration parameters'; + `environment` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `host` varchar(150) NOT NULL DEFAULT 'localhost', + `user` varchar(45) DEFAULT NULL, + `pass` varchar(45) DEFAULT NULL, + `cleanPeriod` varchar(15) DEFAULT NULL COMMENT 'How long the old mails are preserved', + `successFolder` varchar(150) DEFAULT NULL, + `errorFolder` varchar(150) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `imapConfig_environment` (`environment`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='IMAP configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9186,8 +7387,8 @@ DROP TABLE IF EXISTS `item`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `item` ( `id` int(11) unsigned NOT NULL, - `product_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `product_name` varchar(100) DEFAULT NULL, + `name` varchar(100) NOT NULL, `plant_id` mediumint(8) unsigned DEFAULT NULL, `group_id` int(11) unsigned DEFAULT NULL, `entry_date` date DEFAULT NULL, @@ -9196,7 +7397,7 @@ CREATE TABLE `item` ( PRIMARY KEY (`id`), KEY `group_id` (`group_id`), KEY `plant_id` (`plant_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FP130916.txt'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='/tmp/floricode/florecompc2/FP130916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9211,7 +7412,7 @@ CREATE TABLE `item_defaultType` ( `itemTypeFk` int(11) NOT NULL, `bucket_id` int(11) DEFAULT NULL, PRIMARY KEY (`item_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='guarda las excepciones de los item holandeses para asignarles nuestros cubos y nuestros tipos'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='guarda las excepciones de los item holandeses para asignarles nuestros cubos y nuestros tipos'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9224,13 +7425,13 @@ DROP TABLE IF EXISTS `item_feature`; CREATE TABLE `item_feature` ( `item_id` int(11) NOT NULL, `presentation_order` tinyint(11) unsigned NOT NULL, - `feature` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `feature` varchar(3) NOT NULL, `regulation_type` tinyint(3) unsigned NOT NULL, `entry_date` date NOT NULL, `expiry_date` date DEFAULT NULL, `change_date_time` datetime NOT NULL, PRIMARY KEY (`item_id`,`presentation_order`,`entry_date`,`change_date_time`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FY130916.txt'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='/tmp/floricode/florecompc2/FY130916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -9266,7 +7467,7 @@ CREATE TABLE `item_free` ( `id` int(11) NOT NULL, `token` int(11) DEFAULT NULL COMMENT 'campo para asegurar que solo el usuario coge uno de los valores', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9278,12 +7479,12 @@ DROP TABLE IF EXISTS `item_group`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `item_group` ( `group_code` int(11) unsigned NOT NULL, - `dutch_group_description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `dutch_group_description` varchar(100) NOT NULL, `entry_date` date NOT NULL, `expiry_date` date NOT NULL, `change_date_time` datetime NOT NULL, PRIMARY KEY (`group_code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FO130916.txt'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='/tmp/floricode/florecompc2/FO130916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9298,7 +7499,7 @@ CREATE TABLE `item_groupToOffer` ( `itemTypeFk` smallint(5) unsigned NOT NULL, `intrastatFk` int(8) unsigned zerofill NOT NULL, `originFk` tinyint(2) unsigned NOT NULL DEFAULT 17, - `expenseFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT '7001000000', + `expenseFk` varchar(10) DEFAULT '7001000000', PRIMARY KEY (`group_code`), KEY `item_groupToOffer_fk2_idx` (`itemTypeFk`), KEY `item_groupToOffer_fk3_idx` (`intrastatFk`), @@ -9306,7 +7507,7 @@ CREATE TABLE `item_groupToOffer` ( CONSTRAINT `item_groupToOffer_fk2` FOREIGN KEY (`itemTypeFk`) REFERENCES `vn`.`itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `item_groupToOffer_fk3` FOREIGN KEY (`intrastatFk`) REFERENCES `vn`.`intrastat` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `item_groupToOffer_fk4` FOREIGN KEY (`originFk`) REFERENCES `vn`.`origin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='se ofreceran para ser comprados'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='se ofreceran para ser comprados'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9333,7 +7534,7 @@ CREATE TABLE `item_track` ( `sub` tinyint(3) NOT NULL DEFAULT 0, `item` tinyint(3) NOT NULL DEFAULT 0, PRIMARY KEY (`item_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9345,12 +7546,12 @@ DROP TABLE IF EXISTS `log`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `log` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `tableName` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `fieldName` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `fieldValue` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `tableName` varchar(100) NOT NULL, + `fieldName` varchar(100) DEFAULT NULL, + `fieldValue` varchar(100) DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9363,16 +7564,17 @@ DROP TABLE IF EXISTS `mail`; CREATE TABLE `mail` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `senderFk` int(10) unsigned DEFAULT NULL, - `sender` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `messageId` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `sender` varchar(255) DEFAULT NULL, + `messageId` varchar(100) DEFAULT NULL, `nExchanges` int(10) unsigned NOT NULL, - `error` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `error` varchar(255) DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), + `source` text DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `mail_id` (`messageId`), KEY `sender_id` (`senderFk`), CONSTRAINT `mail_ibfk_2` FOREIGN KEY (`senderFk`) REFERENCES `mailSender` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9384,11 +7586,11 @@ DROP TABLE IF EXISTS `mailSender`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `mailSender` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `mail` varchar(150) COLLATE utf8_unicode_ci NOT NULL, + `mail` varchar(150) NOT NULL, `kop` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `mail` (`mail`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='List of allowed mailers'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='List of allowed mailers'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9399,8 +7601,8 @@ DROP TABLE IF EXISTS `marketPlace`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `marketPlace` ( - `id` varchar(13) COLLATE utf8_unicode_ci NOT NULL, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `id` varchar(13) NOT NULL, + `name` varchar(45) NOT NULL, `supplierFk` int(11) NOT NULL DEFAULT 1433, `isOffered` tinyint(2) NOT NULL DEFAULT 0, `MaxLatestDeliveryHour` int(11) DEFAULT NULL COMMENT 'Maxima hora para tener en cuenta la oferta', @@ -9410,7 +7612,7 @@ CREATE TABLE `marketPlace` ( KEY `marketPlaceisOfferedIdx` (`isOffered`), KEY `marketPlaceMaxLatestIdx` (`MaxLatestDeliveryHour`), KEY `marketPlace_isLatestOrderDateTimeRelevant_IDX` (`isLatestOrderDateTimeRelevant`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9421,13 +7623,13 @@ DROP TABLE IF EXISTS `offerList`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `offerList` ( - `supplier` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `supplier` varchar(100) NOT NULL, `total` int(11) DEFAULT NULL COMMENT 'Total de oferta', `filter` int(11) DEFAULT NULL COMMENT 'Total en edi.supplyOffer', `vnh` int(11) DEFAULT NULL COMMENT 'Total en la entrada de VNH', `algemesi` int(11) DEFAULT NULL COMMENT 'Total en la entrada de Algemesi', PRIMARY KEY (`supplier`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de las ofertas para mostrar en grafana'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Lista de las ofertas para mostrar en grafana'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9439,15 +7641,16 @@ DROP TABLE IF EXISTS `param`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `param` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `code` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `name` varchar(5) COLLATE utf8_unicode_ci NOT NULL, - `subname` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, + `code` varchar(30) NOT NULL, + `name` varchar(5) NOT NULL, + `subname` varchar(5) DEFAULT NULL, `position` tinyint(3) unsigned NOT NULL DEFAULT 1, - `type` enum('INTEGER','DOUBLE','STRING','DATE','TIME') COLLATE utf8_unicode_ci NOT NULL, + `type` enum('INTEGER','DOUBLE','STRING','DATE','TIME') NOT NULL, `required` tinyint(3) unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), UNIQUE KEY `name` (`name`,`subname`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Parameters to capture of every exchange'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Parameters to capture of every exchange'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9465,7 +7668,7 @@ CREATE TABLE `plant` ( `expiry_date` date DEFAULT NULL, `change_date_time` datetime DEFAULT NULL, PRIMARY KEY (`plant_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FT130916.txt'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='/tmp/floricode/florecompc2/FT130916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9482,12 +7685,12 @@ CREATE TABLE `putOrder` ( `orderTradelineItemID` int(11) DEFAULT NULL COMMENT 'ticketFk or EntryFk?', `OrderTradeLineDateTime` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'fecha de creacion en la tabla', `quantity` int(11) DEFAULT NULL, - `EndUserPartyID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `EndUserPartyGLN` varchar(13) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The grower can use this reference in his EKT in the NAD (MA) segment.', + `EndUserPartyID` varchar(255) DEFAULT NULL, + `EndUserPartyGLN` varchar(13) DEFAULT NULL COMMENT 'The grower can use this reference in his EKT in the NAD (MA) segment.', `OrderStatus` int(11) DEFAULT 0 COMMENT '1 pending\n2 confirmed\n3 canceled', `isOrderProcessed` tinyint(4) DEFAULT NULL, - `error` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `barcode` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL, + `error` varchar(255) DEFAULT NULL, + `barcode` varchar(25) DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), `FHAdminNumber` int(11) DEFAULT 66011, `saleFk` int(11) DEFAULT NULL, @@ -9497,7 +7700,7 @@ CREATE TABLE `putOrder` ( KEY `supplyResponseID_idx` (`supplyResponseID`), KEY `putOrder_FK` (`saleFk`), CONSTRAINT `putOrder_FK` FOREIGN KEY (`saleFk`) REFERENCES `vn`.`sale` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -9514,9 +7717,9 @@ DELIMITER ;; BEGIN DECLARE nextID INT; - + SELECT 1 + MAX(id) INTO nextID FROM putOrder ; - + SET NEW.orderTradelineItemID = nextID; END */;; @@ -9538,36 +7741,36 @@ DELIMITER ;; BEFORE UPDATE ON `putOrder` FOR EACH ROW BEGIN - + DECLARE vError VARCHAR(100) DEFAULT 'Orderregel niet meer teruggevonden op basis van de orderps'; DECLARE vVmpIdError INT DEFAULT 7; DECLARE vVmpFk INT; DECLARE vSupplyResponseNumberOfUnits INT; - - SELECT sr.vmpID INTO vVmpFk - FROM edi.supplyResponse sr + + SELECT sr.vmpID INTO vVmpFk + FROM edi.supplyResponse sr WHERE sr.id = NEW.supplyResponseID; - - IF NEW.OrderStatus = 3 - AND NOT (NEW.OrderStatus <=> OLD.OrderStatus) - AND NEW.error = vError - AND vVmpFk = vVmpIdError - - THEN - + + IF NEW.OrderStatus = 3 + AND NOT (NEW.OrderStatus <=> OLD.OrderStatus) + AND NEW.error = vError + AND vVmpFk = vVmpIdError + + THEN + SET NEW.OrderStatus = 2; - + END IF; - + -- Error de disponible menor de lo solicitado IF NEW.error LIKE 'error2602%' THEN - + SELECT NumberOfUnits INTO vSupplyResponseNumberOfUnits - FROM edi.supplyResponse sr + FROM edi.supplyResponse sr WHERE sr.ID = NEW.supplyResponseID; - + SET NEW.error = CONCAT('(',vSupplyResponseNumberOfUnits,') ', NEW.error); - + END IF; END */;; DELIMITER ; @@ -9594,16 +7797,16 @@ BEGIN DECLARE vIsEktSender BOOLEAN; IF NEW.OrderStatus = vOrderStatusDenied AND NOT (NEW.OrderStatus <=> OLD.OrderStatus) THEN - + SELECT s.id INTO vSaleFk - FROM vn.sale s + FROM vn.sale s JOIN vn.ticket t ON s.ticketFk = t.id JOIN vn.item i ON i.id = s.itemFk JOIN deliveryInformation di ON di.ID = NEW.deliveryInformationID WHERE t.clientFk = NEW.EndUserPartyGLN AND t.shipped >= util.VN_CURDATE() AND i.supplyResponseFk = NEW.supplyResponseID LIMIT 1; - + UPDATE vn.sale s JOIN vn.ticket t ON s.ticketFk = t.id JOIN vn.item i ON i.id = s.itemFk @@ -9611,7 +7814,7 @@ BEGIN SET s.quantity = 0 WHERE t.clientFk = NEW.EndUserPartyGLN AND t.shipped >= util.VN_CURDATE() AND i.supplyResponseFk = NEW.supplyResponseID; - + INSERT INTO vn.mail (sender, `subject`, body) SELECT IF(u.id IS NOT NULL AND c.email IS NOT NULL, c.email, @@ -9621,28 +7824,28 @@ BEGIN CONCAT('El artículo ', s.concept, ' del ticket ', t.id , ' ha sido cancelado por Floramondo. ', ' Se ha actualizado la cantidad de ', OLD.quantity,' a 0. ', IF (u.id IS NOT NULL AND c.email IS NOT NULL , - CONCAT('https://verdnatura.es/#!form=ecomerce%2Fticket&ticket=', t.id ), + CONCAT('https://shop.verdnatura.es/#!form=ecomerce%2Fticket&ticket=', t.id ), CONCAT('https://salix.verdnatura.es/#!/ticket/', t.id ,'/summary'))) - FROM vn.sale s + FROM vn.sale s JOIN vn.ticket t ON t.id = s.ticketFk JOIN vn.`client` c ON c.id = t.clientFk LEFT JOIN account.user u ON u.id= c.salesPersonFk AND u.name IN ('ruben', 'ismaelalcolea') WHERE s.id = vSaleFk; - + END IF; IF NEW.OrderStatus = vOrderStatusOK AND NOT (NEW.OrderStatus <=> OLD.OrderStatus) THEN - SELECT v.isEktSender INTO vIsEktSender + SELECT v.isEktSender INTO vIsEktSender FROM edi.VMPSettings v - JOIN edi.supplyResponse sr ON sr.vmpID = v.VMPID + JOIN edi.supplyResponse sr ON sr.vmpID = v.VMPID WHERE sr.id = NEW.supplyResponseID; - + IF NOT vIsEktSender THEN CALL edi.ekt_add(NEW.id); - + END IF; IF NEW.barcode THEN @@ -9651,7 +7854,7 @@ BEGIN SELECT i.id, NEW.barcode FROM vn.item i WHERE i.supplyResponseFk = NEW.supplyResponseID; - + END IF; END IF; @@ -9673,12 +7876,12 @@ DROP TABLE IF EXISTS `specie`; CREATE TABLE `specie` ( `specie_id` mediumint(8) unsigned NOT NULL, `genus_id` mediumint(8) unsigned NOT NULL, - `latin_species_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `latin_species_name` varchar(100) NOT NULL, `entry_date` date DEFAULT NULL, `expiry_date` date DEFAULT NULL, `change_date_time` datetime DEFAULT NULL, PRIMARY KEY (`specie_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FS130916.txt'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='/tmp/floricode/florecompc2/FS130916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9690,8 +7893,8 @@ DROP TABLE IF EXISTS `supplier`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `supplier` ( `supplier_id` int(10) unsigned NOT NULL COMMENT 'FHRegistrationNr', - `glnAddressCode` varchar(13) COLLATE utf8_unicode_ci DEFAULT NULL, - `company_name` varchar(70) COLLATE utf8_unicode_ci NOT NULL, + `glnAddressCode` varchar(13) DEFAULT NULL, + `company_name` varchar(70) NOT NULL, `entry_date` date NOT NULL, `expiry_date` date NOT NULL, `change_date_time` datetime NOT NULL, @@ -9700,7 +7903,7 @@ CREATE TABLE `supplier` ( PRIMARY KEY (`supplier_id`), UNIQUE KEY `supplier_UN` (`glnAddressCode`), KEY `glnaddressCodeidx` (`glnAddressCode`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/FEC010104/CC090916.txt'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='/tmp/floricode/FEC010104/CC090916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9768,59 +7971,59 @@ DROP TABLE IF EXISTS `supplyResponse`; CREATE TABLE `supplyResponse` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `NumberBunchesPerCask` int(11) DEFAULT NULL, - `SupplierGLN` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `SupplierGLN` varchar(255) DEFAULT NULL, `NewItem` tinyint(1) DEFAULT NULL, - `SendererID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `ItemSupplierID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `SendererID` varchar(255) DEFAULT NULL, + `ItemSupplierID` varchar(255) DEFAULT NULL, `TransactionDate` datetime DEFAULT NULL, - `TransactionNumber` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `AuctionClockNumber` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `SupplierID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `TransactionNumber` varchar(255) DEFAULT NULL, + `AuctionClockNumber` varchar(255) DEFAULT NULL, + `SupplierID` varchar(255) DEFAULT NULL, `ItemDatesupplyResponsecol` datetime DEFAULT NULL, `Item_ArticleCode` int(11) DEFAULT NULL, - `VBNOmschrijving` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `ExtraRemark` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `ArtCodeType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `VBNGroupCode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `VBNGroupDescription` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `VBNOmschrijving` varchar(255) DEFAULT NULL, + `ExtraRemark` varchar(255) DEFAULT NULL, + `ArtCodeType` varchar(255) DEFAULT NULL, + `VBNGroupCode` varchar(255) DEFAULT NULL, + `VBNGroupDescription` varchar(255) DEFAULT NULL, `TransactionTime` time DEFAULT NULL, - `CountryOfOrigin` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `CountryOfOrigin` varchar(255) DEFAULT NULL, `NumberOfItemsPerCask` int(11) DEFAULT NULL, `NumberOfLayersPerTrolley` int(11) DEFAULT NULL, `NumberOfUnits` int(11) DEFAULT NULL, `MinimumNumberToOrder` int(11) DEFAULT NULL, - `MinimumOrderUnitType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `MinimumOrderUnitType` varchar(255) DEFAULT NULL, `Price` decimal(10,2) DEFAULT NULL, - `Quality` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `s1` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `s2` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `s3` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `s4` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `s5` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `s6` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `ExaminiationCode1` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `ExaminiationCode2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `OrderUnitType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `Quality` varchar(255) DEFAULT NULL, + `s1` varchar(3) DEFAULT NULL, + `s2` varchar(3) DEFAULT NULL, + `s3` varchar(3) DEFAULT NULL, + `s4` varchar(3) DEFAULT NULL, + `s5` varchar(3) DEFAULT NULL, + `s6` varchar(3) DEFAULT NULL, + `ExaminiationCode1` varchar(255) DEFAULT NULL, + `ExaminiationCode2` varchar(255) DEFAULT NULL, + `OrderUnitType` varchar(255) DEFAULT NULL, `EmbalageCode` int(11) DEFAULT NULL, - `PictureReference` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `AgentGLN` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `PictureReference` varchar(255) DEFAULT NULL, + `AgentGLN` varchar(255) DEFAULT NULL, `MaximumNumberToOrder` int(11) DEFAULT NULL, `MaximumOrderType` tinyint(1) DEFAULT NULL COMMENT 'Unit: 1 = piece, 2 = bunch, 3 = box, 4 = layer, 5 = load carrier/trolley', `IncrementalOrderableQuantity` int(11) DEFAULT NULL, `IncrementalOrderableQuantityType` tinyint(1) DEFAULT NULL COMMENT 'Unit: 1 = piece, 2 = bunch, 3 = box, 4 = layer, 5 = load carrier/trolley', `PackingPrice` decimal(10,2) DEFAULT NULL, - `PackingPriceType` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL, + `PackingPriceType` varchar(25) DEFAULT NULL, `PackingPriceQuantity` int(11) DEFAULT NULL, `PackingPriceQuantityType` tinyint(1) DEFAULT NULL COMMENT 'Unit: 1 = piece, 2 = bunch, 3 = box, 4 = layer, 5 = load carrier/trolley', - `MarketPlaceID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `MarketFormCode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '"002" Standard Sales\n"005" Catalogue (optional)\n"001" Committed (optional)\n"003" Buffer (optional, Clock Pre Sales) ', - `FlowerColor` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `MarketPlaceID` varchar(255) DEFAULT NULL, + `MarketFormCode` varchar(255) DEFAULT NULL COMMENT '"002" Standard Sales\n"005" Catalogue (optional)\n"001" Committed (optional)\n"003" Buffer (optional, Clock Pre Sales) ', + `FlowerColor` varchar(255) DEFAULT NULL, `vmpID` int(11) DEFAULT NULL, `widthMeasure` int(11) DEFAULT NULL COMMENT 'mm Embalage Width', `lengthMeasure` int(11) DEFAULT NULL COMMENT 'mm Embalage Length', `heightMeasure` int(11) DEFAULT NULL COMMENT 'mm Embalage Height', `created` datetime NOT NULL DEFAULT current_timestamp(), - `EmbalageCodeSupplier` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `EmbalageCodeSupplier` varchar(10) DEFAULT NULL, `updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`ID`), KEY `IX_TransNumber` (`TransactionNumber`) COMMENT 'Agregado por Ernesto 11.6.2019\nSe ejecutaba 1 consulta por segundo desde MAIL y consumia un 20% de CPU de todo el servidor !!!!!\nCPU usada es mas estable que Indice en SendererID, cpu vs espacio que ocupa?\n', @@ -9832,7 +8035,7 @@ CREATE TABLE `supplyResponse` ( KEY `supplyResponse_updated_IDX` (`updated`) USING BTREE, CONSTRAINT `supplyResponse_fk2` FOREIGN KEY (`MarketPlaceID`) REFERENCES `marketPlace` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `supplyResponseputOrder_FK` FOREIGN KEY (`vmpID`) REFERENCES `VMPSettings` (`VMPID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -9850,8 +8053,8 @@ BEGIN UPDATE 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 + JOIN vn.travel tr ON tr.id = e.travelFk + JOIN vn.agencyMode am ON am.id = tr.agencyModeFk JOIN vn.item i ON i.id = b.itemFk JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID SET b.quantity = NEW.NumberOfItemsPerCask * NEW.NumberOfUnits, @@ -9860,7 +8063,7 @@ BEGIN AND am.name = 'LOGIFLORA' AND e.isRaid AND tr.landed >= util.VN_CURDATE(); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -9885,7 +8088,24 @@ CREATE TABLE `supplyResponseLog` ( PRIMARY KEY (`id`), KEY `supplyResponseLog_FK` (`supplyResponseFk`), CONSTRAINT `supplyResponseLog_FK` FOREIGN KEY (`supplyResponseFk`) REFERENCES `supplyResponse` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Esta tabla la utiliza la empresa LOGIFLORA. No kkear.'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Esta tabla la utiliza la empresa LOGIFLORA. No kkear.'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `tableConfig` +-- + +DROP TABLE IF EXISTS `tableConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tableConfig` ( + `fileName` varchar(2) NOT NULL, + `toTable` varchar(15) NOT NULL, + `file` varchar(30) NOT NULL, + `updated` date DEFAULT NULL, + PRIMARY KEY (`fileName`), + UNIQUE KEY `to_table` (`toTable`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9896,14 +8116,14 @@ DROP TABLE IF EXISTS `type`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `type` ( - `type_id` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `type_id` varchar(3) NOT NULL, `type_group_id` tinyint(3) unsigned NOT NULL, - `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(100) NOT NULL, `entry_date` date NOT NULL, `expiry_date` date NOT NULL, `change_date_time` datetime NOT NULL, PRIMARY KEY (`type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FE130916.txt'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='/tmp/floricode/florecompc2/FE130916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9914,14 +8134,14 @@ DROP TABLE IF EXISTS `value`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `value` ( - `type_id` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `type_value` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `type_description` varchar(70) COLLATE utf8_unicode_ci NOT NULL, + `type_id` varchar(3) NOT NULL, + `type_value` varchar(3) NOT NULL, + `type_description` varchar(70) NOT NULL, `entry_date` date NOT NULL, `expiry_date` date NOT NULL, `change_date_time` datetime NOT NULL, PRIMARY KEY (`type_id`,`type_value`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FV130916.txt'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='/tmp/floricode/florecompc2/FV130916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9941,7 +8161,7 @@ CREATE TABLE `warehouseFloramondo` ( KEY `warehouseFloramondo_FK2_idx` (`entryFk`), CONSTRAINT `warehouseFloramondo_FK2` FOREIGN KEY (`entryFk`) REFERENCES `vn`.`entry` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `warehouseFloramondo_fk` FOREIGN KEY (`warehouseFk`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9953,14 +8173,14 @@ 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 character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_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 `floramondo` ON SCHEDULE EVERY 6 MINUTE STARTS '2022-01-28 09:52:45' ON COMPLETION NOT PRESERVE ENABLE DO CALL edi.floramondo_offerRefresh() */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `floramondo` ON SCHEDULE EVERY 6 MINUTE STARTS '2022-01-28 09:52:45' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO CALL edi.floramondo_offerRefresh() */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -9985,7 +8205,7 @@ 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,'/',''); @@ -9997,7 +8217,7 @@ BEGIN SET vPictureReference = REPLACE(vPictureReference,'?',''); SET vPictureReference = REPLACE(vPictureReference,'=',''); - + RETURN vPictureReference; END ;; @@ -10023,15 +8243,15 @@ BEGIN DECLARE vOneWeekAgo DATE DEFAULT TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()); DELETE FROM ekt WHERE fec < vFourYearsAgo; - + DELETE IGNORE sr.* FROM supplyResponse sr LEFT JOIN edi.deliveryInformation di ON sr.ID = di.supplyResponseID WHERE di.LatestOrderDateTime < vOneWeekAgo OR di.ID IS NULL; - - DELETE FROM putOrder + + DELETE FROM putOrder WHERE created < TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10050,27 +8270,27 @@ DELIMITER ; 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) + + SELECT MIN(ID), MAX(ID) INTO vID, vTope FROM edi.deliveryInformation; - WHILE vID <= vTope DO - + WHILE vID <= vTope DO + SET vID = vID + vGap; - - DELETE - FROM edi.deliveryInformation + + DELETE + FROM edi.deliveryInformation WHERE ID < vID AND EarliestDespatchDateTime IS NULL; - + END WHILE; - - + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10089,15 +8309,15 @@ DELIMITER ; 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, + + INSERT INTO edi.ekt(entryYear, + deliveryNumber, fec, hor, item, @@ -10137,17 +8357,17 @@ BEGIN i.value10 s6, p.id putOrderFk, sr.Item_ArticleCode, - sr.vmpID + sr.vmpID FROM edi.putOrder p - JOIN edi.supplyResponse sr ON sr.ID = p.supplyResponseID - JOIN edi.deliveryInformation di ON di.id = p.deliveryInformationID - 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 + JOIN edi.supplyResponse sr ON sr.ID = p.supplyResponseID + JOIN edi.deliveryInformation di ON di.id = p.deliveryInformationID + 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 */ ; @@ -10158,15 +8378,15 @@ 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 `ekt_load`(IN `vSelf` INT) proc:BEGIN - + DECLARE vRef INT; DECLARE vBuy INT; DECLARE vItem INT; @@ -10191,51 +8411,51 @@ proc:BEGIN FROM edi.ekt e LEFT JOIN edi.item i ON e.ref = i.id LEFT JOIN edi.putOrder po ON po.id = e.putOrderFk - LEFT JOIN vn.item i2 ON i2.supplyResponseFk = po.supplyResponseID + LEFT JOIN vn.item i2 ON i2.supplyResponseFk = po.supplyResponseID LEFT JOIN vn.ektEntryAssign eea ON eea.sub = e.sub LEFT JOIN edi.item_groupToOffer igto ON igto.group_code = i.group_id WHERE e.id = vSelf LIMIT 1; - + IF NOT vHasItemGroup THEN - + CALL vn.mail_insert('logistica@verdnatura.es', 'nocontestar@verdnatura.es', 'Nuevo grupo en Floramondo', vDescription); - + CALL vn.mail_insert('pako@verdnatura.es', 'nocontestar@verdnatura.es', CONCAT('Nuevo grupo en Floramondo: ', vDescription), vDescription); - + LEAVE proc; - + END IF; - + -- Asigna la entrada SELECT vn.ekt_getEntry(vSelf) INTO vEntryFk; - + -- Inserta el cubo si no existe IF vPackage = 800 THEN - + SET vHasToChangePackagingFk = TRUE; - + IF vItem THEN - + SELECT vn.item_getPackage(vItem) INTO vPackage ; - + ELSE - + SET vPackage = 8000 + vQty; INSERT IGNORE INTO vn.packaging(id, width, `depth`) SELECT vPackage, vc.ccLength / vQty, vc.ccWidth FROM vn.volumeConfig vc; - + END IF; - + ELSE - + INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z) SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10) FROM bucket WHERE bucket_id = vPackage; - + IF ROW_COUNT() > 0 THEN INSERT INTO vn2008.mail SET @@ -10244,27 +8464,27 @@ proc:BEGIN `to` = 'ekt@verdnatura.es'; END IF; END IF; - + -- Si es una compra de Logiflora obtiene el articulo IF vPutOrderFk THEN - + SELECT i.id INTO vItem FROM edi.putOrder po JOIN vn.item i ON i.supplyResponseFk = po.supplyResponseID WHERE po.id = vPutOrderFk LIMIT 1; - + END IF; INSERT IGNORE INTO item_track SET item_id = vRef; - + IF IFNULL(vItem,0) = 0 THEN - + -- Intenta obtener el artículo en base a los atributos holandeses - + SELECT b.id, IFNULL(b.itemOriginalFk ,b.itemFk) INTO vBuy, vItem - FROM edi.ekt e + FROM edi.ekt e JOIN edi.item_track t ON t.item_id = e.ref LEFT JOIN edi.ekt l ON l.ref = e.ref LEFT JOIN vn.buy b ON b.ektFk = l.id @@ -10285,19 +8505,19 @@ proc:BEGIN AND IF(t.pro, l.pro = e.pro, TRUE) AND IF(t.package, l.package = e.package, TRUE) AND IF(t.item, l.item = e.item, TRUE) - AND i.isFloramondo = vIsFloramondoDirect - ORDER BY l.util.VN_NOW DESC, b.id ASC + AND i.isFloramondo = vIsFloramondoDirect + ORDER BY l.util.VN_NOW DESC, b.id ASC LIMIT 1; END IF; - + -- Si no encuentra el articulo lo crea en el caso de las compras directas en Floramondo IF ISNULL(vItem) AND vIsFloramondoDirect THEN - + CALL edi.item_getNewByEkt(vSelf, vItem); - + END IF; - + INSERT INTO vn.buy ( entryFk @@ -10309,7 +8529,6 @@ proc:BEGIN ,`grouping` ,quantity ,groupingMode - ,producer ,packageFk ,weight ) @@ -10321,16 +8540,15 @@ proc:BEGIN ,e.qty stickers ,@pac := IFNULL(i.stemMultiplier, 1) * e.pac / @t packing ,IFNULL(b.`grouping`, e.pac) - ,@pac * e.qty + ,@pac * e.qty ,vForceToPacking - ,s.`name` ,IF(vHasToChangePackagingFk OR ISNULL(b.packageFk), vPackage, b.packageFk) - ,i.density * (vn.item_getVolume(i.id, IFNULL(b.packageFk, e.package)) / 1000000) - FROM edi.ekt e + ,(IFNULL(i.weightByPiece,0) * @pac)/1000 + FROM edi.ekt e LEFT JOIN vn.buy b ON b.id = vBuy LEFT JOIN vn.item i ON i.id = b.itemFk LEFT JOIN vn.supplier s ON e.pro = s.id - JOIN vn2008.config cfg + JOIN vn2008.config cfg WHERE e.id = vSelf LIMIT 1; @@ -10338,33 +8556,36 @@ proc:BEGIN CREATE TEMPORARY TABLE tmp.buyRecalc SELECT buy.id - FROM vn.buy + FROM vn.buy WHERE ektFk = vSelf; CALL vn.buy_recalcPrices(); -- Si es una compra de Logiflora hay que informar la tabla vn.saleBuy IF vPutOrderFk THEN - + REPLACE vn.saleBuy(saleFk, buyFk, workerFk) SELECT po.saleFk, b.id, account.myUser_getId() FROM edi.putOrder po JOIN vn.buy b ON b.ektFk = vSelf WHERE po.id = vPutOrderFk; - + END IF; - -- Si es una compra directa en Floramondo hay que añadirlo al ticket + -- Si es una compra directa en Floramondo hay que añadirlo al ticket IF vIsFloramondoDirect THEN SELECT t.id INTO vTicketFk - FROM vn.ticket t - JOIN vn.ektEntryAssign eea ON eea.addressFk = t.addressFk - JOIN vn.warehouse w ON w.id = t.warehouseFk AND w.name = 'Floramondo' - JOIN edi.ekt e ON e.sub = eea.sub AND e.id = vSelf - WHERE e.fec = t.shipped - LIMIT 1; - + FROM vn.ticket t + JOIN vn.ektEntryAssign eea + ON eea.addressFk = t.addressFk + AND t.warehouseFk = eea.warehouseInFk + JOIN edi.ekt e + ON e.sub = eea.sub + AND e.id = vSelf + WHERE e.fec = t.shipped + LIMIT 1; + IF ISNULL(vTicketFk) THEN INSERT INTO vn.ticket ( @@ -10386,27 +8607,26 @@ proc:BEGIN a.id, a.agencyModeFk, a.nickname, - w.id, + eea.warehouseInFk, c.id, e.fec, z.id, z.price, z.bonus - FROM edi.ekt e - JOIN vn.ektEntryAssign eea ON eea.sub = e.sub + FROM edi.ekt e + JOIN vn.ektEntryAssign eea ON eea.sub = e.sub JOIN vn.address a ON a.id = eea.addressFk - JOIN vn.warehouse w ON w.name = 'Floramondo' JOIN vn.company c ON c.code = 'VNL' JOIN vn.`zone` z ON z.code = 'FLORAMONDO' WHERE e.id = vSelf LIMIT 1; SET vTicketFk = LAST_INSERT_ID(); - + INSERT INTO vn.ticketLog - SET originFk = vTicketFk, - userFk = account.myUser_getId(), - `action` = 'insert', + SET originFk = vTicketFk, + userFk = account.myUser_getId(), + `action` = 'insert', description = CONCAT('EktLoad ha creado el ticket:', ' ', vTicketFk); END IF; @@ -10416,9 +8636,9 @@ proc:BEGIN FROM edi.ekt e JOIN edi.floraHollandConfig fhc WHERE e.id = vSelf; - + SELECT LAST_INSERT_ID() INTO vSaleFk; - + REPLACE vn.saleBuy(saleFk, buyFk, workerFk) SELECT vSaleFk, b.id, account.myUser_getId() FROM vn.buy b @@ -10429,15 +8649,15 @@ proc:BEGIN FROM edi.ekt e JOIN vn.component c ON c.code = 'purchaseValue' WHERE e.id = vSelf; - + INSERT INTO vn.saleComponent(saleFk, componentFk, value) - SELECT vSaleFk, c.id, e.pri * fhc.floramondoMargin + SELECT vSaleFk, c.id, e.pri * fhc.floramondoMargin FROM edi.ekt e JOIN edi.floraHollandConfig fhc JOIN vn.component c ON c.code = 'margin' WHERE e.id = vSelf; END IF; - + DROP TEMPORARY TABLE tmp.buyRecalc; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10456,7 +8676,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ekt_loadNotBuy`() BEGIN - + /** * Ejecuta ekt_load para aquellos ekt de hoy que no tienen vn.buy */ @@ -10466,24 +8686,24 @@ BEGIN DECLARE cursor1 CURSOR FOR SELECT e.id - FROM edi.ekt e - LEFT JOIN vn.buy b ON b.ektFk = e.id - WHERE e.fec >= util.VN_CURDATE() + FROM edi.ekt e + LEFT JOIN vn.buy b ON b.ektFk = e.id + WHERE e.fec >= util.VN_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; @@ -10493,7 +8713,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 `exchange_new` */; +/*!50003 DROP PROCEDURE IF EXISTS `ekt_refresh` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -10503,87 +8723,33 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `exchange_new`( - IN `vMailFk` INT, - IN `vItem` VARCHAR(255), - IN `vType` MEDIUMINT, - IN `vDeliveryNumber` BIGINT, - IN `vDate` DATE, - IN `vHour` TIME, - IN `vRef` INT, - IN `vAgj` INT, - IN `vCat` VARCHAR(2), - IN `vPac` INT, - IN `vSub` MEDIUMINT, - IN `vKop` INT, - IN `vPtd` VARCHAR(6), - IN `vPro` MEDIUMINT, - IN `vOrigin` VARCHAR(3), - IN `vPtj` MEDIUMINT, - IN `vQuantiy` INT, - IN `vPrice` DOUBLE, - IN `vClock` SMALLINT, - IN `vS1` VARCHAR(3), - IN `vS2` VARCHAR(3), - IN `vS3` VARCHAR(3), - IN `vS4` VARCHAR(4), - IN `vS5` VARCHAR(3), - IN `vS6` VARCHAR(3), - IN `vK1` SMALLINT, - IN `vK2` SMALLINT, - IN `vP1` TINYINT, - IN `vP2` TINYINT, - IN `vAuction` SMALLINT, - IN `vPackage` INT, - IN `vPutOrderFk` BIGINT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `ekt_refresh`( + `vSelf` INT, vMailFk INT) BEGIN /** - * Adds a new exchange, generates it's barcode and - * inserts/updates the transaction. When the referenced - * transaction exists as provisional, updates it with - * the new values. + * Updates a transaction, generates it's barcode. */ - DECLARE vEkt INT; DECLARE vRewriteKop INT DEFAULT NULL; DECLARE vTruncatePutOrder INT DEFAULT NULL; DECLARE vBarcode CHAR(15) DEFAULT NULL; - DECLARE vIsDuplicated BOOL; - DECLARE vUpdateExistent BOOL DEFAULT FALSE; - DECLARE duplicateKey CONDITION FOR 1062; + DECLARE vKop INT; + DECLARE vPutOrderFk BIGINT; - DECLARE CONTINUE HANDLER FOR duplicateKey - SET vIsDuplicated = TRUE; + SELECT kop, putOrderFk + INTO vKop, vPutOrderFk + FROM ekt + WHERE id = vSelf; -- Generates the barcode - IF vAgj != 0 AND vAgj IS NOT NULL - THEN - SET vBarcode = CONCAT( - LPAD(vAuction, 2, 0), - LPAD(IFNULL(vClock, 99), 2, 0), - LPAD(DAYOFYEAR(vDate), 3, 0), - IF(vClock IS NULL OR vClock = 99, - LPAD(vAgj, 8, 0), - CONCAT(LPAD(vAgj, 5, 0), '010') - ) - ); - END IF; - - -- Generates the barcode - - /*IF vAgj != 0 AND vAgj IS NOT NULL - THEN - SET vBarcode = CONCAT( - LPAD(vAuction, 2, 0), - LPAD(IFNULL(vClock, 99), 2, 0), - LPAD(DAYOFYEAR(vDate), 3, 0), - IF(vClock IS NULL OR vClock = 99, - LPAD(vAgj, 7, 0), - CONCAT(LPAD(vAgj, 5, 0), '01') - ), - '0' - ); - END IF;*/ + SELECT CONCAT( + LPAD(IFNULL(auction,0), 3, 0), + LPAD(IFNULL(klo, 99), 2, 0), + LPAD(DAYOFYEAR(fec), 3, 0), + COALESCE(agj, RIGHT(batchNumber,7), id)) + INTO vBarcode + FROM ekt + WHERE id = vSelf; -- Rewrites the kop parameter @@ -10598,111 +8764,161 @@ BEGIN SET vKop = IFNULL(vRewriteKop, vKop); - -- Inserts the new transaction - call util.debugAdd('vBarcode',vBarcode); - call util.debugAdd('vDeliveryNumber',vDeliveryNumber); - SET vIsDuplicated = FALSE; + -- Format order id + SET vTruncatePutOrder = vPutOrderFk MOD 1000000; - INSERT INTO ekt SET - barcode = IFNULL(vBarcode, barcode) - ,deliveryNumber = vDeliveryNumber - ,entryYear = YEAR(vDate) - ,fec = vDate - ,hor = vHour - ,ref = vRef - ,item = vItem - ,agj = vAgj - ,cat = vCat - ,pac = vPac - ,sub = vSub + -- Refresh EKT + + UPDATE ekt SET + barcode = vBarcode ,kop = vKop - ,ptd = vPtd - ,pro = vPro - ,ori = vOrigin - ,ptj = vPtj - ,qty = vQuantiy - ,pri = vPrice - ,klo = vClock - ,s1 = vS1 - ,s2 = vS2 - ,s3 = vS3 - ,s4 = vS4 - ,s5 = vS5 - ,s6 = vS6 - ,k1 = vK1 - ,k2 = vK2 - ,k3 = vP1 - ,k4 = vP2 - ,auction = vAuction - ,package = vPackage - ,putOrderFk = vTruncatePutOrder; + ,putOrderFk = vTruncatePutOrder + 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 `ekt_scan` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_scan`(vBarcode VARCHAR(512)) +BEGIN +/** + * Busca transaciones a partir de un código de barras, las marca como escaneadas + * y las devuelve. + * Ver https://wiki.verdnatura.es/index.php/Ekt#Algoritmos_de_lectura + * + * @param vBarcode Código de compra de una etiqueta de subasta + * @param vLabels Cantidad escaneada + * @table tmp.ekt(ektFk) Transacciones escaneadas + */ + DECLARE vIsFound BOOL; + DECLARE vUsefulAuctionLeftSegmentLength INT; + DECLARE vStandardBarcodeLength INT; + DECLARE vFloridayBarcodeLength INT; + DECLARE vFloramondoBarcodeLength INT; + DECLARE vAuction INT; + DECLARE vKlo INT; + DECLARE vFec DATE; + DECLARE vShortAgj INT; + DECLARE vLongAgj INT; + DECLARE vXtraLongAgj INT; + DECLARE vDefaultKlo INT; - -- If it exists duplicado updates it + SELECT + ec.usefulAuctionLeftSegmentLength, + ec.standardBarcodeLength, + ec.floridayBarcodeLength, + ec.floramondoBarcodeLength, + ec.defaultKlo + INTO + vUsefulAuctionLeftSegmentLength, + vStandardBarcodeLength, + vFloridayBarcodeLength, + vFloramondoBarcodeLength, + vDefaultKlo + FROM edi.ektConfig ec; - IF NOT vIsDuplicated - THEN - SET vEkt = LAST_INSERT_ID(); - CALL ekt_load (vEkt); + DROP TEMPORARY TABLE IF EXISTS tmp.ekt; + CREATE TEMPORARY TABLE tmp.ekt + ENGINE = MEMORY + SELECT id ektFk FROM ekt LIMIT 0; - ELSEIF vDeliveryNumber != 0 - AND vDeliveryNumber IS NOT NULL - THEN - SELECT id INTO vEkt - FROM ekt - WHERE deliveryNumber = vDeliveryNumber; + CASE + WHEN LENGTH(vBarcode) <= vFloridayBarcodeLength THEN + INSERT INTO tmp.ekt + SELECT id + FROM edi.ektRecent e + WHERE e.cps = vBarcode + OR e.batchNumber = vBarcode; - SELECT COUNT(*) = 0 INTO vUpdateExistent - FROM ekt t - JOIN `exchange` b ON b.ektFk = t.id - JOIN exchangeConfig c - WHERE t.deliveryNumber = vDeliveryNumber - AND t.entryYear = YEAR(vDate) - AND b.typeFk != c.presaleFk; + WHEN LENGTH(vBarcode) = vFloramondoBarcodeLength THEN + INSERT INTO tmp.ekt + SELECT e.id + FROM edi.ektRecent e + WHERE e.pro = MID(vBarcode,2,6) + AND CAST(e.ptd AS SIGNED) = MID(vBarcode,8,5); + + ELSE + SET vBarcode = LPAD(vBarcode,vStandardBarcodeLength,'0'); + SET vAuction = MID(vBarcode, 1, 3); + SET vKlo = MID(vBarcode, 4, 2); + SET vFec = MAKEDATE(YEAR(util.VN_CURDATE()), MID(vBarcode, 6, 3)); + SET vShortAgj = MID(vBarcode, 9, 5); + SET vLongAgj = MID(vBarcode, 9, 7); + SET vXtraLongAgj = MID(vBarcode, 9, 8); + + -- Clásico de subasta + -- Trade standard + -- Trade que construye como la subasta + -- Trade como el anterior pero sin trade code + INSERT INTO tmp.ekt + SELECT id + FROM ekt + WHERE fec = vFec + AND (( + vKlo = vDefaultKlo + AND (klo = vKlo OR klo IS NULL OR klo = 0) + AND agj IN (vShortAgj, vLongAgj, vXtraLongAgj)) + OR (klo = vKlo + AND auction = vAuction + AND agj = vShortAgj) + ) + ORDER BY agj DESC + LIMIT 1; + + SELECT COUNT(*) FROM tmp.ekt INTO vIsFound; + + -- BatchNumber largo + IF NOT vIsFound THEN + INSERT INTO tmp.ekt + SELECT id + FROM edi.ektRecent e + WHERE e.batchNumber + = LEFT(vBarcode,vUsefulAuctionLeftSegmentLength) + AND e.batchNumber > 0; + + SELECT COUNT(*) FROM tmp.ekt INTO vIsFound; + END IF; + + -- Order Number + IF NOT vIsFound THEN + INSERT INTO tmp.ekt + SELECT id + FROM edi.ektRecent e + WHERE e.putOrderFk = vBarcode; + + SELECT COUNT(*) FROM tmp.ekt INTO vIsFound; + END IF; + + -- deliveryNumber incrustado + IF NOT vIsFound THEN + INSERT INTO tmp.ekt + SELECT id + FROM edi.ektRecent e + WHERE e.deliveryNumber + = MID(vBarcode, 4, 13) + AND e.deliveryNumber > 0; + + SELECT COUNT(*) FROM tmp.ekt INTO vIsFound; + END IF; + END CASE; + + IF vIsFound THEN + UPDATE ekt e + JOIN tmp.ekt t ON t.ektFk = e.id + SET e.scanned = TRUE; END IF; - - IF vUpdateExistent - THEN - UPDATE ekt SET - barcode = IFNULL(vBarcode, barcode) - ,fec = vDate - ,hor = vHour - ,ref = vRef - ,item = vItem - ,agj = vAgj - ,cat = vCat - ,pac = vPac - ,sub = vSub - ,kop = vKop - ,ptd = vPtd - ,pro = vPro - ,ori = vOrigin - ,ptj = vPtj - ,qty = vQuantiy - ,pri = vPrice - ,klo = vClock - ,s1 = vS1 - ,s2 = vS2 - ,s3 = vS3 - ,s4 = vS4 - ,s5 = vS5 - ,s6 = vS6 - ,k1 = vK1 - ,k2 = vK2 - ,k3 = vP1 - ,k4 = vP2 - ,auction = vAuction - ,package = vPackage - ,putOrderFk = IFNULL(vTruncatePutOrder, putOrderFk) - WHERE id = vEkt; - END IF; - - -- Registers the exchange - - INSERT INTO `exchange` SET - mailFk = vMailFk - ,typeFk = vType - ,ektFk = vEkt; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10713,15 +8929,14 @@ 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 `floramondo_offerRefresh`() proc: BEGIN - DECLARE vLanded DATETIME; DECLARE done INT DEFAULT FALSE; DECLARE vFreeId INT; @@ -10732,12 +8947,12 @@ proc: BEGIN DECLARE vStartingTime DATETIME; DECLARE vAalsmeerMarketPlaceID VARCHAR(13) DEFAULT '8713783439043'; - DECLARE cur1 CURSOR FOR - SELECT id + DECLARE cur1 CURSOR FOR + SELECT id FROM edi.item_free; - DECLARE cur2 CURSOR FOR - SELECT srId + DECLARE cur2 CURSOR FOR + SELECT srId FROM itemToInsert; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; @@ -10746,31 +8961,45 @@ proc: BEGIN ROLLBACK; RESIGNAL; END; - + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + DO RELEASE_LOCK('edi.floramondo_offerRefresh'); + RESIGNAL; + END; + + IF 'test' = (SELECT environment FROM util.config) THEN + LEAVE proc; + END IF; + + IF !GET_LOCK('edi.floramondo_offerRefresh', 0) THEN + LEAVE proc; + END IF; + SET vStartingTime = util.VN_NOW(); TRUNCATE edi.offerList ; INSERT INTO edi.offerList(supplier, total) SELECT v.name, COUNT(DISTINCT sr.ID) total - FROM edi.supplyResponse sr - JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID + FROM edi.supplyResponse sr + JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID WHERE sr.NumberOfUnits > 0 AND sr.EmbalageCode != 999 GROUP BY sr.vmpID; - + UPDATE edi.offerList o JOIN (SELECT v.name, COUNT(*) total FROM edi.supplyOffer sr - JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID + JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID GROUP BY sr.vmpID) sub ON o.supplier = sub.name SET o.`filter` = sub.total; -- Refresca las fotos de los items existentes, con prioridad baja (0.7 seg) INSERT IGNORE INTO vn.itemImageQueue(itemFk, url,priority) SELECT i.id, sr.PictureReference , 100 - FROM edi.supplyResponse sr - JOIN vn.item i ON i.supplyResponseFk = sr.ID + FROM edi.supplyResponse sr + JOIN vn.item i ON i.supplyResponseFk = sr.ID WHERE i.image != edi.imageName(sr.PictureReference) AND sr.NumberOfUnits > 0; @@ -10778,14 +9007,14 @@ proc: BEGIN DELETE itf.* FROM edi.item_free itf JOIN vn.item i ON i.id = itf.id; - + DROP TEMPORARY TABLE IF EXISTS tmp; CREATE TEMPORARY TABLE tmp (INDEX (`Item_ArticleCode`)) ENGINE = MEMORY SELECT t.* FROM ( SELECT * - FROM edi.supplyOffer - ORDER BY (MarketPlaceID = vAalsmeerMarketPlaceID) DESC, NumberOfUnits DESC) t + FROM edi.supplyOffer + ORDER BY (MarketPlaceID = vAalsmeerMarketPlaceID) DESC, NumberOfUnits DESC LIMIT 10000000000000000000) t GROUP BY t.srId; DROP TEMPORARY TABLE IF EXISTS edi.offer; @@ -10793,7 +9022,7 @@ proc: BEGIN INDEX (`ef1`), INDEX (`ef2`), INDEX (`ef3`), INDEX (`ef4`),INDEX (`ef5`), INDEX (`ef6`), INDEX (`s1Value`), INDEX (`s2Value`), INDEX (`s3Value`), INDEX (`s4Value`),INDEX (`s5Value`), INDEX (`s6Value`)) ENGINE = MEMORY - SELECT so.*, + SELECT so.*, ev1.type_description s1Value, ev2.type_description s2Value, ev3.type_description s3Value, @@ -10814,7 +9043,7 @@ proc: BEGIN LEFT JOIN edi.item_feature eif3 ON eif3.item_id = so.Item_ArticleCode AND eif3.presentation_order = 3 AND eif3.expiry_date IS NULL LEFT JOIN edi.item_feature eif4 ON eif4.item_id = so.Item_ArticleCode - AND eif4.presentation_order = 4 AND eif4.expiry_date IS NULL + AND eif4.presentation_order = 4 AND eif4.expiry_date IS NULL LEFT JOIN edi.item_feature eif5 ON eif5.item_id = so.Item_ArticleCode AND eif5.presentation_order = 5 AND eif5.expiry_date IS NULL LEFT JOIN edi.item_feature eif6 ON eif6.item_id = so.Item_ArticleCode @@ -10827,7 +9056,7 @@ proc: BEGIN LEFT JOIN edi.`value` ev6 ON ev6.type_id = eif6.feature AND so.s6 = ev6.type_value ORDER BY Price; - DROP TEMPORARY TABLE tmp; + DROP TEMPORARY TABLE tmp; DELETE o FROM edi.offer o @@ -10845,18 +9074,18 @@ proc: BEGIN OR(t5.id IS NOT NULL AND CONVERT(s5Value, UNSIGNED) > fc.itemMaxSize) OR(t6.id IS NOT NULL AND CONVERT(s6Value, UNSIGNED) > fc.itemMaxSize); - START TRANSACTION; + START TRANSACTION; -- Actualizamos el campo supplyResponseFk para aquellos articulos que ya estan creados y reutilizamos - UPDATE IGNORE edi.offer o - JOIN vn.item i - ON i.name = o.product_name - AND i.subname <=> o.company_name - AND i.value5 <=> o.s1Value - AND i.value6 <=> o.s2Value - AND i.value7 <=> o.s3Value + UPDATE IGNORE edi.offer o + JOIN vn.item i + ON i.name = o.product_name + AND i.subname <=> o.company_name + AND i.value5 <=> o.s1Value + AND i.value6 <=> o.s2Value + AND i.value7 <=> o.s3Value AND i.value8 <=> o.s4Value - AND i.value9 <=> o.s5Value + AND i.value9 <=> o.s5Value AND i.value10 <=> o.s6Value AND i.NumberOfItemsPerCask <=> o.NumberOfItemsPerCask AND i.EmbalageCode <=> o.EmbalageCode @@ -10864,22 +9093,22 @@ proc: BEGIN JOIN vn.itemType it ON it.id = i.typeFk LEFT JOIN vn.sale s ON s.itemFk = i.id LEFT JOIN vn.ticket t ON t.id = s.ticketFk AND t.shipped > TIMESTAMPADD(WEEK, -1, util.VN_CURDATE()) - LEFT JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - LEFT JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID + LEFT JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk + LEFT JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID LEFT JOIN edi.putOrder po ON po.supplyResponseID = i.supplyResponseFk AND po.OrderTradeLineDateTime > TIMESTAMPADD(WEEK, -1, util.VN_CURDATE()) SET i.supplyResponseFk = o.srID - WHERE ( sr.ID IS NULL - OR sr.NumberOfUnits = 0 - OR di.LatestOrderDateTime < util.VN_NOW() + WHERE ( sr.ID IS NULL + OR sr.NumberOfUnits = 0 + OR di.LatestOrderDateTime < util.VN_NOW() OR di.ID IS NULL) AND it.isInventory AND t.id IS NULL AND po.id IS NULL; - -- select util.VN_NOW(),'Antes de crear ITO'; + -- select util.VN_NOW(),'Antes de crear ITO'; DROP TEMPORARY TABLE IF EXISTS itemToInsert; CREATE TEMPORARY TABLE itemToInsert ENGINE = MEMORY SELECT o.*, CAST(NULL AS DECIMAL(6,0)) as itemFk - FROM edi.offer o + FROM edi.offer o LEFT JOIN vn.item i ON i.supplyResponseFk = o.srId WHERE i.id IS NULL LIMIT vMaxNewItems; @@ -10887,7 +9116,7 @@ proc: BEGIN -- Reciclado de nº de item OPEN cur1; OPEN cur2; - + read_loop: LOOP FETCH cur2 INTO vSupplyResponseFk; @@ -10900,7 +9129,7 @@ proc: BEGIN UPDATE itemToInsert SET itemFk = vFreeId WHERE srId = vSupplyResponseFk; - + END LOOP; CLOSE cur1; @@ -10916,174 +9145,173 @@ proc: BEGIN intrastatFk, originFk, supplyResponseFk, - numberOfItemsPerCask, - embalageCode, - quality, - isFloramondo) + numberOfItemsPerCask, + embalageCode, + quality, + isFloramondo) SELECT iti.itemFk, iti.product_name, iti.product_name, - iti.company_name, + iti.company_name, iti.expenseFk, iti.itemTypeFk, iti.intrastatFk, iti.originFk, iti.`srId`, iti.NumberOfItemsPerCask, - iti.EmbalageCode, - iti.Quality, - TRUE + iti.EmbalageCode, + iti.Quality, + TRUE FROM itemToInsert iti; - + INSERT IGNORE INTO vn.itemImageQueue(itemFk, url) SELECT i.id, PictureReference FROM itemToInsert ii JOIN vn.item i ON i.supplyResponseFk = ii.srId WHERE PictureReference IS NOT NULL; - INSERT INTO edi.log(tableName, fieldName,fieldValue) + INSERT INTO edi.log(tableName, fieldName,fieldValue) SELECT 'itemImageQueue','NumImagenesPtes', COUNT(*) - FROM vn.itemImageQueue + FROM vn.itemImageQueue WHERE attempts = 0; - + -- Inserta si se añadiesen tags nuevos INSERT IGNORE INTO vn.tag (name, ediTypeFk) SELECT description, type_id FROM edi.type; -- Inserta los tags sólo en los articulos nuevos - -- desabilita el trigger para recalcular los tags al final - SET @isTriggerDisabled = TRUE; - + -- desabilita el trigger para recalcular los tags al final + SET @isTriggerDisabled = TRUE; + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , ii.product_name, 1 + SELECT i.id, t.id , ii.product_name, 1 FROM itemToInsert ii JOIN vn.tag t ON t.`name` = 'Producto' JOIN vn.item i ON i.supplyResponseFk = ii.`srId` WHERE NOT ISNULL(ii.product_name); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) SELECT i.id, t.id , ii.Quality, 3 FROM itemToInsert ii JOIN vn.tag t ON t.`name` = 'Calidad' JOIN vn.item i ON i.supplyResponseFk = ii.`srId` WHERE NOT ISNULL(ii.Quality); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) SELECT i.id, t.id , ii.company_name, 4 FROM itemToInsert ii JOIN vn.tag t ON t.`name` = 'Productor' JOIN vn.item i ON i.supplyResponseFk = ii.`srId` WHERE NOT ISNULL(ii.company_name); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s1Value, 5 + SELECT i.id, t.id , s1Value, 5 FROM itemToInsert ii JOIN vn.tag t ON t.ediTypeFk = ii.ef1 JOIN vn.item i ON i.supplyResponseFk = ii.`srId` WHERE NOT ISNULL(s1Value); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s2Value, 6 + SELECT i.id, t.id , s2Value, 6 FROM itemToInsert ii JOIN vn.tag t ON t.ediTypeFk = ii.ef2 JOIN vn.item i ON i.supplyResponseFk = ii.`srId` WHERE NOT ISNULL(s2Value); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s3Value, 7 + SELECT i.id, t.id , s3Value, 7 FROM itemToInsert ii JOIN vn.tag t ON t.ediTypeFk = ii.ef3 JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT ISNULL(s3Value); - + WHERE NOT ISNULL(s3Value); + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s4Value, 8 + SELECT i.id, t.id , s4Value, 8 FROM itemToInsert ii JOIN vn.tag t ON t.ediTypeFk = ii.ef4 JOIN vn.item i ON i.supplyResponseFk = ii.`srId` WHERE NOT ISNULL(s4Value); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s5Value, 9 + SELECT i.id, t.id , s5Value, 9 FROM itemToInsert ii JOIN vn.tag t ON t.ediTypeFk = ii.ef5 JOIN vn.item i ON i.supplyResponseFk = ii.`srId` WHERE NOT ISNULL(s5Value); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s6Value, 10 + SELECT i.id, t.id , s6Value, 10 FROM itemToInsert ii JOIN vn.tag t ON t.ediTypeFk = ii.ef6 JOIN vn.item i ON i.supplyResponseFk = ii.`srId` WHERE NOT ISNULL(s6Value); - + INSERT IGNORE INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, IFNULL(ink.name, ik.color), 11 + SELECT i.id, t.id, IFNULL(ink.name, ik.color), 11 FROM itemToInsert ii JOIN vn.item i ON i.supplyResponseFk = ii.`srId` JOIN vn.tag t ON t.`name` = 'Color' - LEFT JOIN edi.feature f ON f.item_id = ii.Item_ArticleCode - LEFT JOIN edi.`type` tp ON tp.type_id = f.feature_type_id AND tp.`description` = 'Hoofdkleur 1' - LEFT JOIN vn.ink ON ink.dutchCode = f.feature_value + LEFT JOIN edi.feature f ON f.item_id = ii.Item_ArticleCode + LEFT JOIN edi.`type` tp ON tp.type_id = f.feature_type_id AND tp.`description` = 'Hoofdkleur 1' + LEFT JOIN vn.ink ON ink.dutchCode = f.feature_value LEFT JOIN vn.itemInk ik ON ik.longName = i.longName - WHERE ink.name IS NOT NULL + WHERE ink.name IS NOT NULL OR ik.color IS NOT NULL; UPDATE vn.item i JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId` JOIN vn.packaging p ON p.id LIKE ii.EmbalageCode -- AND hasCompressionVariations JOIN vn.itemTag it ON it.itemFk = i.id - JOIN vn.tag tSize ON tSize.overwrite = 'size' AND tSize.id = it.tagFk + LEFT JOIN vn.tag tSize ON tSize.overwrite = 'size' AND tSize.id = it.tagFk JOIN vn.volumeConfig vc - SET i.packingOut = vc.standardFlowerBox * 1000 + SET i.packingOut = IFNULL(vc.standardFlowerBox * 1000 * ii.NumberOfItemsPerCask - / (p.width * p.depth * IFNULL(p.height, it.value )); + / (p.width * p.depth * IFNULL(p.height, it.value )),ii.NumberOfItemsPerCask); DROP TABLE IF EXISTS tmp.item; CREATE TABLE tmp.item (PRIMARY KEY (id)) - SELECT i.id FROM vn.item i + SELECT i.id FROM vn.item i JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId`; - + CALL vn.item_refreshTags(); - - SET @isTriggerDisabled = FALSE; - + + SET @isTriggerDisabled = FALSE; + SELECT MIN(LatestDeliveryDateTime) INTO vLanded - FROM edi.supplyResponse sr + FROM edi.supplyResponse sr JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID - JOIN vn.floramondoConfig fc + JOIN vn.floramondoConfig fc WHERE mp.isLatestOrderDateTimeRelevant AND di.LatestOrderDateTime > IF(fc.MaxLatestOrderHour > HOUR(util.VN_NOW()), util.VN_CURDATE(), TIMESTAMPADD(DAY,1,util.VN_CURDATE())); - - UPDATE vn.floramondoConfig + + UPDATE vn.floramondoConfig SET nextLanded = vLanded WHERE vLanded IS NOT NULL; - + -- Elimina la oferta obsoleta UPDATE 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 + JOIN vn.travel tr ON tr.id = e.travelFk + JOIN vn.agencyMode am ON am.id = tr.agencyModeFk JOIN vn.item i ON i.id = b.itemFk LEFT JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID LEFT JOIN edi.deliveryInformation di ON di.ID = b.deliveryFk SET b.quantity = 0 WHERE (IFNULL(di.LatestOrderDateTime,util.VN_NOW()) <= util.VN_NOW() - OR i.supplyResponseFk IS NULL - OR sr.NumberOfUnits = 0) + OR i.supplyResponseFk IS NULL + OR sr.NumberOfUnits = 0) AND am.name = 'LOGIFLORA' AND e.isRaid; - + -- Localiza las entradas de cada almacen UPDATE edi.warehouseFloramondo SET entryFk = vn.entry_getForLogiflora(TIMESTAMPADD(DAY,travellingDays,vLanded), warehouseFk); - - - IF vLanded IS NOT NULL THEN - -- actualiza la oferta existente + + IF vLanded IS NOT NULL THEN + -- actualiza la oferta existente UPDATE vn.buy b JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk JOIN vn.item i ON i.id = b.itemFk @@ -11091,26 +9319,19 @@ proc: BEGIN SET b.quantity = o.NumberOfUnits * o.NumberOfItemsPerCask, b.buyingValue = o.price WHERE (b.quantity <> o.NumberOfUnits * o.NumberOfItemsPerCask OR b.buyingValue <> o.price); -/* - -- Se eliminan las ofertas ya incluidas en las entradas - DELETE o - FROM edi.offer o - JOIN vn.item i ON i.supplyResponseFk = o.srId - JOIN vn.buy b ON i.id = b.itemFk - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk; - */ + -- Se inserta el resto SET vLastInserted := util.VN_NOW(); - - -- Inserta la oferta - INSERT INTO vn.buy( entryFk, + + -- Inserta la oferta + INSERT INTO vn.buy( entryFk, itemFk, - quantity, - buyingValue, - stickers, - packing, - `grouping`, - groupingMode, + quantity, + buyingValue, + stickers, + packing, + `grouping`, + groupingMode, packageFk, deliveryFk) @@ -11126,1013 +9347,72 @@ proc: BEGIN o.diId FROM edi.offer o JOIN vn.item i ON i.supplyResponseFk = o.srId - JOIN edi.warehouseFloramondo wf + JOIN edi.warehouseFloramondo wf JOIN vn.packaging p ON p.id LIKE o.embalageCode - LEFT JOIN vn.buy b ON b.itemFk = i.id AND b.entryFk = wf.entryFk + LEFT JOIN vn.buy b ON b.itemFk = i.id AND b.entryFk = wf.entryFk WHERE ISNULL(b.id); -- llevar esta linea i mirar de crear els packages a temps real - + DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc; - + CREATE TEMPORARY TABLE tmp.buyRecalc - SELECT b.id + SELECT b.id FROM vn.buy b JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk WHERE b.created >= vLastInserted; - + CALL vn.buy_recalcPrices(); - - UPDATE edi.offerList o - JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total - FROM vn.buy b - JOIN vn.item i ON i.id = b.itemFk - JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk - JOIN vn.warehouse w ON w.id = wf.warehouseFk - WHERE w.name = 'VNH' - AND b.quantity > 0 - GROUP BY sr.vmpID) sub ON o.supplier = sub.name - SET o.vnh = sub.total; - - UPDATE edi.offerList o - JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total - FROM vn.buy b - JOIN vn.item i ON i.id = b.itemFk - JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk - JOIN vn.warehouse w ON w.id = wf.warehouseFk - WHERE w.name = 'ALGEMESI' - AND b.quantity > 0 - GROUP BY sr.vmpID) sub ON o.supplier = sub.name - SET o.algemesi = sub.total; - - - END IF; - - DROP TEMPORARY TABLE - edi.offer, - itemToInsert; - - DROP TABLE tmp.item; - COMMIT; - - -- Esto habria que pasarlo a procesos programados o trabajar con tags y dejar las familias - UPDATE vn.item i - SET typeFk = 121 - WHERE i.longName LIKE 'Rosa Garden %' - AND typeFk = 17; - - UPDATE vn.item i - SET typeFk = 156 - WHERE i.longName LIKE 'Rosa ec %' - AND typeFk = 17; - - INSERT INTO edi.log(tableName, fieldName,fieldValue) - VALUES('floramondo_offerRefresh','Tiempo de proceso',TIMEDIFF(util.VN_NOW(),vStartingTime)); - - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `floramondo_offerRefresh_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 `floramondo_offerRefresh_beta`() -proc: BEGIN - - DECLARE vLanded DATETIME; - DECLARE done INT DEFAULT FALSE; - DECLARE vFreeId INT; - DECLARE vSupplyResponseFk INT; - DECLARE vLastInserted DATETIME; - DECLARE vIsAuctionDay BOOLEAN; - DECLARE vMaxNewItems INT DEFAULT 10000; - DECLARE vStartingTime DATETIME; - DECLARE vAalsmeerMarketPlaceID VARCHAR(13) DEFAULT '8713783439043'; - - DECLARE cur1 CURSOR FOR - SELECT id - FROM edi.item_free; - - DECLARE cur2 CURSOR FOR - SELECT srId - FROM itemToInsert; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - DECLARE EXIT HANDLER FOR SQLSTATE '45000' - BEGIN - ROLLBACK; - RESIGNAL; - END; - - SET vStartingTime = util.VN_NOW(); - - TRUNCATE edi.offerList ; - - INSERT INTO edi.offerList(supplier, total) - SELECT v.name, COUNT(DISTINCT sr.ID) total - FROM edi.supplyResponse sr - JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID - WHERE sr.NumberOfUnits > 0 - AND sr.EmbalageCode != 999 - GROUP BY sr.vmpID; - UPDATE edi.offerList o - JOIN (SELECT v.name, COUNT(*) total - FROM edi.supplyOffer sr - JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID - GROUP BY sr.vmpID) sub ON o.supplier = sub.name - SET o.`filter` = sub.total; - - -- Refresca las fotos de los items existentes, con prioridad baja (0.7 seg) - INSERT IGNORE INTO vn.itemImageQueue(itemFk, url,priority) - SELECT i.id, sr.PictureReference , 100 - FROM edi.supplyResponse sr - JOIN vn.item i ON i.supplyResponseFk = sr.ID - WHERE i.image != edi.imageName(sr.PictureReference) - AND sr.NumberOfUnits > 0; - - -- Elimina de la lista de items libres aquellos que ya existen - DELETE itf.* - FROM edi.item_free itf - JOIN vn.item i ON i.id = itf.id; - - DROP TEMPORARY TABLE IF EXISTS tmp; - CREATE TEMPORARY TABLE tmp (INDEX (`Item_ArticleCode`)) ENGINE = MEMORY - SELECT t.* - FROM ( - SELECT * - FROM edi.supplyOffer - ORDER BY (MarketPlaceID = vAalsmeerMarketPlaceID) DESC, NumberOfUnits DESC) t - GROUP BY t.srId; - - DROP TEMPORARY TABLE IF EXISTS edi.offer; - CREATE TEMPORARY TABLE edi.offer (INDEX (`srID`), INDEX (`EmbalageCode`), - INDEX (`ef1`), INDEX (`ef2`), INDEX (`ef3`), INDEX (`ef4`),INDEX (`ef5`), INDEX (`ef6`), - INDEX (`s1Value`), INDEX (`s2Value`), INDEX (`s3Value`), INDEX (`s4Value`),INDEX (`s5Value`), INDEX (`s6Value`)) - ENGINE = MEMORY - SELECT so.*, - ev1.type_description s1Value, - ev2.type_description s2Value, - ev3.type_description s3Value, - ev4.type_description s4Value, - ev5.type_description s5Value, - ev6.type_description s6Value, - eif1.feature ef1, - eif2.feature ef2, - eif3.feature ef3, - eif4.feature ef4, - eif5.feature ef5, - eif6.feature ef6 - FROM tmp so - LEFT JOIN edi.item_feature eif1 ON eif1.item_id = so.Item_ArticleCode - AND eif1.presentation_order = 1 AND eif1.expiry_date IS NULL - LEFT JOIN edi.item_feature eif2 ON eif2.item_id = so.Item_ArticleCode - AND eif2.presentation_order = 2 AND eif2.expiry_date IS NULL - LEFT JOIN edi.item_feature eif3 ON eif3.item_id = so.Item_ArticleCode - AND eif3.presentation_order = 3 AND eif3.expiry_date IS NULL - LEFT JOIN edi.item_feature eif4 ON eif4.item_id = so.Item_ArticleCode - AND eif4.presentation_order = 4 AND eif4.expiry_date IS NULL - LEFT JOIN edi.item_feature eif5 ON eif5.item_id = so.Item_ArticleCode - AND eif5.presentation_order = 5 AND eif5.expiry_date IS NULL - LEFT JOIN edi.item_feature eif6 ON eif6.item_id = so.Item_ArticleCode - AND eif6.presentation_order = 6 AND eif6.expiry_date IS NULL - LEFT JOIN edi.`value` ev1 ON ev1.type_id = eif1.feature AND so.s1 = ev1.type_value - LEFT JOIN edi.`value` ev2 ON ev2.type_id = eif2.feature AND so.s2 = ev2.type_value - LEFT JOIN edi.`value` ev3 ON ev3.type_id = eif3.feature AND so.s3 = ev3.type_value - LEFT JOIN edi.`value` ev4 ON ev4.type_id = eif4.feature AND so.s4 = ev4.type_value - LEFT JOIN edi.`value` ev5 ON ev5.type_id = eif5.feature AND so.s5 = ev5.type_value - LEFT JOIN edi.`value` ev6 ON ev6.type_id = eif6.feature AND so.s6 = ev6.type_value - ORDER BY Price; - - DROP TEMPORARY TABLE tmp; - - DELETE o - FROM edi.offer o - LEFT JOIN vn.tag t1 ON t1.ediTypeFk = o.ef1 AND t1.overwrite = 'size' - LEFT JOIN vn.tag t2 ON t2.ediTypeFk = o.ef2 AND t2.overwrite = 'size' - LEFT JOIN vn.tag t3 ON t3.ediTypeFk = o.ef3 AND t3.overwrite = 'size' - LEFT JOIN vn.tag t4 ON t4.ediTypeFk = o.ef4 AND t4.overwrite = 'size' - LEFT JOIN vn.tag t5 ON t5.ediTypeFk = o.ef5 AND t5.overwrite = 'size' - LEFT JOIN vn.tag t6 ON t6.ediTypeFk = o.ef6 AND t6.overwrite = 'size' - JOIN vn.floramondoConfig fc ON TRUE - WHERE (t1.id IS NOT NULL AND CONVERT(s1Value, UNSIGNED) > fc.itemMaxSize) - OR(t2.id IS NOT NULL AND CONVERT(s2Value, UNSIGNED) > fc.itemMaxSize) - OR(t3.id IS NOT NULL AND CONVERT(s3Value, UNSIGNED) > fc.itemMaxSize) - OR(t4.id IS NOT NULL AND CONVERT(s4Value, UNSIGNED) > fc.itemMaxSize) - OR(t5.id IS NOT NULL AND CONVERT(s5Value, UNSIGNED) > fc.itemMaxSize) - OR(t6.id IS NOT NULL AND CONVERT(s6Value, UNSIGNED) > fc.itemMaxSize); - - START TRANSACTION; - - -- Actualizamos el campo supplyResponseFk para aquellos articulos que ya estan creados y reutilizamos - UPDATE IGNORE edi.offer o - JOIN vn.item i - ON i.name = o.product_name - AND i.subname <=> o.company_name - AND i.value5 <=> o.s1Value - AND i.value6 <=> o.s2Value - AND i.value7 <=> o.s3Value - AND i.value8 <=> o.s4Value - AND i.value9 <=> o.s5Value - AND i.value10 <=> o.s6Value - AND i.NumberOfItemsPerCask <=> o.NumberOfItemsPerCask - AND i.EmbalageCode <=> o.EmbalageCode - AND i.quality <=> o.Quality - JOIN vn.itemType it ON it.id = i.typeFk - LEFT JOIN vn.sale s ON s.itemFk = i.id - LEFT JOIN vn.ticket t ON t.id = s.ticketFk AND t.shipped > TIMESTAMPADD(WEEK, -1, util.VN_CURDATE()) - LEFT JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - LEFT JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID - LEFT JOIN edi.putOrder po ON po.supplyResponseID = i.supplyResponseFk AND po.OrderTradeLineDateTime > TIMESTAMPADD(WEEK, -1, util.VN_CURDATE()) - SET i.supplyResponseFk = o.srID - WHERE ( sr.ID IS NULL - OR sr.NumberOfUnits = 0 - OR di.LatestOrderDateTime < util.VN_NOW() - OR di.ID IS NULL) - AND it.isInventory - AND t.id IS NULL - AND po.id IS NULL; - -- select util.VN_NOW(),'Antes de crear ITO'; - DROP TEMPORARY TABLE IF EXISTS itemToInsert; - CREATE TEMPORARY TABLE itemToInsert ENGINE = MEMORY - SELECT o.*, CAST(NULL AS DECIMAL(6,0)) as itemFk - FROM edi.offer o - LEFT JOIN vn.item i ON i.supplyResponseFk = o.srId - WHERE i.id IS NULL - LIMIT vMaxNewItems; - - -- Reciclado de nº de item - OPEN cur1; - OPEN cur2; - - read_loop: LOOP - - FETCH cur2 INTO vSupplyResponseFk; - FETCH cur1 INTO vFreeId; - - IF done THEN - LEAVE read_loop; - END IF; - - UPDATE itemToInsert - SET itemFk = vFreeId - WHERE srId = vSupplyResponseFk; - - END LOOP; - - CLOSE cur1; - CLOSE cur2; - - -- Insertamos todos los items en Articles de la oferta - INSERT INTO vn.item(id, - `name`, - longName, - subName, - expenceFk, - typeFk, - intrastatFk, - originFk, - supplyResponseFk, - numberOfItemsPerCask, - embalageCode, - quality, - isFloramondo) - SELECT iti.itemFk, - iti.product_name, - iti.product_name, - iti.company_name, - iti.expenseFk, - iti.itemTypeFk, - iti.intrastatFk, - iti.originFk, - iti.`srId`, - iti.NumberOfItemsPerCask, - iti.EmbalageCode, - iti.Quality, - TRUE - FROM itemToInsert iti; - - INSERT IGNORE INTO vn.itemImageQueue(itemFk, url) - SELECT i.id, PictureReference - FROM itemToInsert ii - JOIN vn.item i ON i.supplyResponseFk = ii.srId - WHERE PictureReference IS NOT NULL; - - INSERT INTO edi.log(tableName, fieldName,fieldValue) - SELECT 'itemImageQueue','NumImagenesPtes', COUNT(*) - FROM vn.itemImageQueue - WHERE attempts = 0; - - -- Inserta si se añadiesen tags nuevos - INSERT IGNORE INTO vn.tag (name, ediTypeFk) - SELECT description, type_id FROM edi.type; - - -- Inserta los tags sólo en los articulos nuevos - - -- desabilita el trigger para recalcular los tags al final - SET @isTriggerDisabled = TRUE; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , ii.product_name, 1 - FROM itemToInsert ii - JOIN vn.tag t ON t.`name` = 'Producto' - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT ISNULL(ii.product_name); - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , ii.Quality, 3 - FROM itemToInsert ii - JOIN vn.tag t ON t.`name` = 'Calidad' - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT ISNULL(ii.Quality); - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , ii.company_name, 4 - FROM itemToInsert ii - JOIN vn.tag t ON t.`name` = 'Productor' - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT ISNULL(ii.company_name); - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s1Value, 5 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef1 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT ISNULL(s1Value); - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s2Value, 6 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef2 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT ISNULL(s2Value); - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s3Value, 7 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef3 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT ISNULL(s3Value); - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s4Value, 8 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef4 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT ISNULL(s4Value); - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s5Value, 9 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef5 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT ISNULL(s5Value); - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s6Value, 10 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef6 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE NOT ISNULL(s6Value); - - INSERT IGNORE INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, IFNULL(ink.name, ik.color), 11 - FROM itemToInsert ii - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - JOIN vn.tag t ON t.`name` = 'Color' - LEFT JOIN edi.feature f ON f.item_id = ii.Item_ArticleCode - LEFT JOIN edi.`type` tp ON tp.type_id = f.feature_type_id AND tp.`description` = 'Hoofdkleur 1' - LEFT JOIN vn.ink ON ink.dutchCode = f.feature_value - LEFT JOIN vn.itemInk ik ON ik.longName = i.longName - WHERE ink.name IS NOT NULL - OR ik.color IS NOT NULL; - - UPDATE vn.item i - JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId` - JOIN vn.packaging p ON p.id LIKE 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); - - DROP TABLE IF EXISTS tmp.item; - CREATE TABLE tmp.item - (PRIMARY KEY (id)) - SELECT i.id FROM vn.item i - JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId`; - - CALL vn.item_refreshTags(); - - SET @isTriggerDisabled = FALSE; - - SELECT MIN(LatestDeliveryDateTime) INTO vLanded - FROM edi.supplyResponse sr - JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID - JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID - JOIN vn.floramondoConfig fc - WHERE mp.isLatestOrderDateTimeRelevant - AND di.LatestOrderDateTime > IF(fc.MaxLatestOrderHour > HOUR(util.VN_NOW()), util.VN_CURDATE(), TIMESTAMPADD(DAY,1,util.VN_CURDATE())); - - UPDATE vn.floramondoConfig - SET nextLanded = vLanded - WHERE vLanded IS NOT NULL; - - -- Elimina la oferta obsoleta - UPDATE 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 - JOIN vn.item i ON i.id = b.itemFk - LEFT JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID - LEFT JOIN edi.deliveryInformation di ON di.ID = b.deliveryFk - SET b.quantity = 0 - WHERE (IFNULL(di.LatestOrderDateTime,util.VN_NOW()) <= util.VN_NOW() - OR i.supplyResponseFk IS NULL - OR sr.NumberOfUnits = 0) - AND am.name = 'LOGIFLORA' - AND e.isRaid; - - -- Localiza las entradas de cada almacen - UPDATE edi.warehouseFloramondo - SET entryFk = vn.entry_getForLogiflora(TIMESTAMPADD(DAY,travellingDays,vLanded), warehouseFk); - - - IF vLanded IS NOT NULL THEN - -- actualiza la oferta existente - UPDATE vn.buy b - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk - JOIN vn.item i ON i.id = b.itemFk - JOIN edi.offer o ON i.supplyResponseFk = o.`srId` - SET b.quantity = o.NumberOfUnits * o.NumberOfItemsPerCask, - b.buyingValue = o.price - WHERE (b.quantity <> o.NumberOfUnits * o.NumberOfItemsPerCask OR b.buyingValue <> o.price); -/* - -- Se eliminan las ofertas ya incluidas en las entradas - DELETE o - FROM edi.offer o - JOIN vn.item i ON i.supplyResponseFk = o.srId - JOIN vn.buy b ON i.id = b.itemFk - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk; - */ - -- Se inserta el resto - SET vLastInserted := util.VN_NOW(); - - -- Inserta la oferta - INSERT INTO vn.buy( entryFk, - itemFk, - quantity, - buyingValue, - stickers, - packing, - `grouping`, - groupingMode, - packageFk, - deliveryFk) - - SELECT wf.entryFk, - i.id, - o.NumberOfUnits * o.NumberOfItemsPerCask as quantity, - o.Price, - o.NumberOfUnits as etiquetas, - o.NumberOfItemsPerCask as packing, - GREATEST(1, IFNULL(o.MinimumQuantity,0)) * o.NumberOfItemsPerCask as `grouping`, - 2, -- Obliga al Packing - o.embalageCode, - o.diId - FROM edi.offer o - JOIN vn.item i ON i.supplyResponseFk = o.srId - JOIN edi.warehouseFloramondo wf - JOIN vn.packaging p ON p.id LIKE o.embalageCode - LEFT JOIN vn.buy b ON b.itemFk = i.id AND b.entryFk = wf.entryFk - WHERE ISNULL(b.id); -- llevar esta linea i mirar de crear els packages a temps real - - DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc; - - CREATE TEMPORARY TABLE tmp.buyRecalc - SELECT b.id - FROM vn.buy b - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk - WHERE b.created >= vLastInserted; - - CALL vn.buy_recalcPrices(); - - UPDATE edi.offerList o JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total FROM vn.buy b JOIN vn.item i ON i.id = b.itemFk - JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk - JOIN vn.warehouse w ON w.id = wf.warehouseFk + JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk + JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID + JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk + JOIN vn.warehouse w ON w.id = wf.warehouseFk WHERE w.name = 'VNH' AND b.quantity > 0 GROUP BY sr.vmpID) sub ON o.supplier = sub.name SET o.vnh = sub.total; - - UPDATE edi.offerList o + + UPDATE edi.offerList o JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total FROM vn.buy b JOIN vn.item i ON i.id = b.itemFk - JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk - JOIN vn.warehouse w ON w.id = wf.warehouseFk + JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk + JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID + JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk + JOIN vn.warehouse w ON w.id = wf.warehouseFk WHERE w.name = 'ALGEMESI' AND b.quantity > 0 GROUP BY sr.vmpID) sub ON o.supplier = sub.name SET o.algemesi = sub.total; - - - END IF; - - DROP TEMPORARY TABLE - edi.offer, - itemToInsert; - - DROP TABLE tmp.item; - COMMIT; + END IF; + + DROP TEMPORARY TABLE + edi.offer, + itemToInsert; + + DROP TABLE tmp.item; + + COMMIT; -- Esto habria que pasarlo a procesos programados o trabajar con tags y dejar las familias UPDATE vn.item i SET typeFk = 121 WHERE i.longName LIKE 'Rosa Garden %' AND typeFk = 17; - + UPDATE vn.item i SET typeFk = 156 WHERE i.longName LIKE 'Rosa ec %' AND typeFk = 17; - INSERT INTO edi.log(tableName, fieldName,fieldValue) - VALUES('floramondo_offerRefresh','Tiempo de proceso',TIMEDIFF(util.VN_NOW(),vStartingTime)); - - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `floramondo_offerRefresh__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `floramondo_offerRefresh__`() -proc: BEGIN - - DECLARE vLanded DATETIME; - DECLARE done INT DEFAULT FALSE; - DECLARE vFreeId INT; - DECLARE vSupplyResponseFk INT; - DECLARE vLastInserted DATETIME; - DECLARE vIsAuctionDay BOOLEAN; - DECLARE vMaxNewItems INT DEFAULT 10000; - DECLARE vStartingTime DATETIME; - DECLARE vAalsmeerMarketPlaceID VARCHAR(13) DEFAULT '8713783439043'; - - DECLARE cur1 CURSOR FOR - SELECT id - FROM edi.item_free; - - DECLARE cur2 CURSOR FOR - SELECT srId - FROM itemToInsert; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - DECLARE EXIT HANDLER FOR SQLSTATE '45000' - BEGIN - ROLLBACK; - RESIGNAL; - END; - - SET vStartingTime = util.VN_NOW(); - - CALL util.debugAdd('edi.floramondo_offerRefresh',CONCAT('MaxItemId:' ,(SELECT MAX(id) FROM vn.item))); - - -- CALL vn.clean_logiflora(); - - -- Refresca las fotos de los items existentes, con prioridad baja (0.7 seg) - INSERT IGNORE INTO vn.itemImageQueue(itemFk, url,priority) - SELECT i.id, sr.PictureReference , 100 - FROM edi.supplyResponse sr - JOIN vn.item i ON i.supplyResponseFk = sr.ID - WHERE i.image != edi.imageName(sr.PictureReference) - AND sr.NumberOfUnits > 0; - - -- Elimina de la lista de items libres aquellos que ya existen - DELETE itf.* - FROM edi.item_free itf - JOIN vn.item i ON i.id = itf.id; - - DROP TEMPORARY TABLE IF EXISTS tmp; - CREATE TEMPORARY TABLE tmp (INDEX (`Item_ArticleCode`)) ENGINE = MEMORY - SELECT t.*, - IFNULL(idt.itemTypeFk, igo.itemTypeFk) itemTypeFk, - igo.expenseFk , - igo.intrastatFk , - igo.originFk - FROM ( - SELECT * - FROM edi.supplyOffer - ORDER BY (MarketPlaceID = vAalsmeerMarketPlaceID) DESC, NumberOfUnits DESC) t - JOIN edi.item_groupToOffer igo ON igo.group_code = t.group_id - LEFT JOIN edi.item_defaultType idt ON idt.item_id = t.Item_ArticleCode - GROUP BY t.srId - -- GROUP BY Item_ArticleCode, s1, s2, s3, s4, s5, s6, company_name, Quality, NumberOfItemsPerCask, EmbalageCode, Price, PictureReference - ; - - -- select util.VN_NOW(),'Antes de crear edi.offer'; - - DROP TEMPORARY TABLE IF EXISTS edi.offer; - CREATE TEMPORARY TABLE edi.offer (INDEX (`srID`), INDEX (`EmbalageCode`), - INDEX (`ef1`), INDEX (`ef2`), INDEX (`ef3`), INDEX (`ef4`),INDEX (`ef5`), INDEX (`ef6`), - INDEX (`s1Value`), INDEX (`s2Value`), INDEX (`s3Value`), INDEX (`s4Value`),INDEX (`s5Value`), INDEX (`s6Value`)) - ENGINE = MEMORY - SELECT so.*, ev1.type_description s1Value, ev2.type_description s2Value, ev3.type_description s3Value, - ev4.type_description s4Value, ev5.type_description s5Value, ev6.type_description s6Value, - eif1.feature ef1, eif2.feature ef2, eif3.feature ef3, eif4.feature ef4, eif5.feature ef5, eif6.feature ef6 - FROM tmp so - LEFT JOIN edi.item_feature eif1 ON eif1.item_id = so.Item_ArticleCode - AND eif1.presentation_order = 1 AND eif1.expiry_date IS NULL - LEFT JOIN edi.item_feature eif2 ON eif2.item_id = so.Item_ArticleCode - AND eif2.presentation_order = 2 AND eif2.expiry_date IS NULL - LEFT JOIN edi.item_feature eif3 ON eif3.item_id = so.Item_ArticleCode - AND eif3.presentation_order = 3 AND eif3.expiry_date IS NULL - LEFT JOIN edi.item_feature eif4 ON eif4.item_id = so.Item_ArticleCode - AND eif4.presentation_order = 4 AND eif4.expiry_date IS NULL - LEFT JOIN edi.item_feature eif5 ON eif5.item_id = so.Item_ArticleCode - AND eif5.presentation_order = 5 AND eif5.expiry_date IS NULL - LEFT JOIN edi.item_feature eif6 ON eif6.item_id = so.Item_ArticleCode - AND eif6.presentation_order = 6 AND eif6.expiry_date IS NULL - LEFT JOIN edi.`value` ev1 ON ev1.type_id = eif1.feature AND so.s1 = ev1.type_value - LEFT JOIN edi.`value` ev2 ON ev2.type_id = eif2.feature AND so.s2 = ev2.type_value - LEFT JOIN edi.`value` ev3 ON ev3.type_id = eif3.feature AND so.s3 = ev3.type_value - LEFT JOIN edi.`value` ev4 ON ev4.type_id = eif4.feature AND so.s4 = ev4.type_value - LEFT JOIN edi.`value` ev5 ON ev5.type_id = eif5.feature AND so.s5 = ev5.type_value - LEFT JOIN edi.`value` ev6 ON ev6.type_id = eif6.feature AND so.s6 = ev6.type_value - ORDER BY Price; - - DROP TEMPORARY TABLE tmp; - - DELETE o - FROM edi.offer o - LEFT JOIN vn.tag t1 ON t1.ediTypeFk = o.ef1 AND t1.overwrite = 'size' - LEFT JOIN vn.tag t2 ON t2.ediTypeFk = o.ef2 AND t2.overwrite = 'size' - LEFT JOIN vn.tag t3 ON t3.ediTypeFk = o.ef3 AND t3.overwrite = 'size' - LEFT JOIN vn.tag t4 ON t4.ediTypeFk = o.ef4 AND t4.overwrite = 'size' - LEFT JOIN vn.tag t5 ON t5.ediTypeFk = o.ef5 AND t5.overwrite = 'size' - LEFT JOIN vn.tag t6 ON t6.ediTypeFk = o.ef6 AND t6.overwrite = 'size' - JOIN vn.floramondoConfig fc ON TRUE - WHERE (t1.id IS NOT NULL AND CONVERT(s1Value, UNSIGNED) > fc.itemMaxSize) - OR(t2.id IS NOT NULL AND CONVERT(s2Value, UNSIGNED) > fc.itemMaxSize) - OR(t3.id IS NOT NULL AND CONVERT(s3Value, UNSIGNED) > fc.itemMaxSize) - OR(t4.id IS NOT NULL AND CONVERT(s4Value, UNSIGNED) > fc.itemMaxSize) - OR(t5.id IS NOT NULL AND CONVERT(s5Value, UNSIGNED) > fc.itemMaxSize) - OR(t6.id IS NOT NULL AND CONVERT(s6Value, UNSIGNED) > fc.itemMaxSize); - - START TRANSACTION; - - -- Actualizamos el campo supplyResponseFk para aquellos articulos que ya estan creados y reutilizamos - UPDATE IGNORE edi.offer o - JOIN vn.item i - ON i.name = o.product_name - AND i.subname <=> o.company_name - AND i.value5 <=> o.s1Value - AND i.value6 <=> o.s2Value - AND i.value7 <=> o.s3Value - AND i.value8 <=> o.s4Value - AND i.value9 <=> o.s5Value - AND i.value10 <=> o.s6Value - AND i.NumberOfItemsPerCask <=> o.NumberOfItemsPerCask - AND i.EmbalageCode <=> o.EmbalageCode - AND i.quality <=> o.Quality - JOIN vn.itemType it ON it.id = i.typeFk - LEFT JOIN vn.sale s ON s.itemFk = i.id - LEFT JOIN vn.ticket t ON t.id = s.ticketFk AND t.shipped > TIMESTAMPADD(WEEK, -1, util.VN_CURDATE()) - LEFT JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - LEFT JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID - LEFT JOIN edi.putOrder po ON po.supplyResponseID = i.supplyResponseFk AND po.OrderTradeLineDateTime > TIMESTAMPADD(WEEK, -1, util.VN_CURDATE()) - SET i.supplyResponseFk = o.srID - WHERE ( sr.ID IS NULL - OR sr.NumberOfUnits = 0 - OR di.LatestOrderDateTime < util.VN_NOW() - OR di.ID IS NULL) - AND it.isInventory - AND t.id IS NULL - AND po.id IS NULL; - -- select util.VN_NOW(),'Antes de crear ITO'; - DROP TEMPORARY TABLE IF EXISTS itemToInsert; - CREATE TEMPORARY TABLE itemToInsert ENGINE = MEMORY - SELECT o.*, CAST(NULL AS DECIMAL(6,0)) as itemFk - FROM edi.offer o - LEFT JOIN vn.item i ON i.supplyResponseFk = o.srId - WHERE i.id IS NULL - LIMIT vMaxNewItems; - - -- Reciclado de nº de item - OPEN cur1; - OPEN cur2; - - read_loop: LOOP - - FETCH cur2 INTO vSupplyResponseFk; - FETCH cur1 INTO vFreeId; - - IF done THEN - LEAVE read_loop; - END IF; - - UPDATE itemToInsert - SET itemFk = vFreeId - WHERE srId = vSupplyResponseFk; - - END LOOP; - - CLOSE cur1; - CLOSE cur2; - - -- Insertamos todos los items en Articles de la oferta - INSERT INTO vn.item( id, - `name`, - longName, - subName, - expenceFk, - typeFk, - intrastatFk, - originFk, - supplyResponseFk, - numberOfItemsPerCask, - embalageCode, - quality, - isFloramondo) - SELECT iti.itemFk, - iti.product_name, - iti.product_name, - iti.company_name, - iti.expenseFk, - iti.itemTypeFk, - iti.intrastatFk, - iti.originFk, - iti.`srId`, - iti.NumberOfItemsPerCask, - iti.EmbalageCode, - iti.Quality, - TRUE - FROM itemToInsert iti; - - INSERT IGNORE INTO vn.itemImageQueue(itemFk, url) - SELECT i.id, PictureReference - FROM itemToInsert ii - JOIN vn.item i ON i.supplyResponseFk = ii.srId - WHERE PictureReference IS NOT NULL; - - INSERT INTO edi.log(tableName, fieldName,fieldValue) - SELECT 'itemImageQueue','NumImagenesPtes', COUNT(*) - FROM vn.itemImageQueue - WHERE attempts = 0; - - -- Inserta si se añadiesen tags nuevos - INSERT IGNORE INTO vn.tag (name, ediTypeFk) - SELECT description, type_id FROM edi.type; - - -- Inserta los tags sólo en los articulos nuevos - - -- desabilita el trigger para recalcular los tags al final - SET @isTriggerDisabled = TRUE; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , ii.product_name, 1 - FROM itemToInsert ii - JOIN vn.tag t ON t.`name` = 'Producto' - JOIN vn.item i ON i.supplyResponseFk = ii.`srId`; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , ii.Quality, 3 - FROM itemToInsert ii - JOIN vn.tag t ON t.`name` = 'Calidad' - JOIN vn.item i ON i.supplyResponseFk = ii.`srId`; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , ii.company_name, 4 - FROM itemToInsert ii - JOIN vn.tag t ON t.`name` = 'Productor' - JOIN vn.item i ON i.supplyResponseFk = ii.`srId`; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s1Value, 5 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef1 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE s1Value != ''; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s2Value, 6 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef2 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE s2Value != ''; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s3Value, 7 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef3 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE s3Value != ''; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s4Value, 8 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef4 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE s4Value != ''; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s5Value, 9 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef5 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE s5Value != ''; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id , s6Value, 10 - FROM itemToInsert ii - JOIN vn.tag t ON t.ediTypeFk = ii.ef6 - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - WHERE s6Value != ''; - - INSERT IGNORE INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, IFNULL(ink.name, ik.color), 11 - FROM itemToInsert ii - JOIN vn.item i ON i.supplyResponseFk = ii.`srId` - JOIN vn.tag t ON t.`name` = 'Color' - LEFT JOIN edi.feature f ON f.item_id = ii.Item_ArticleCode - LEFT JOIN edi.`type` tp ON tp.type_id = f.feature_type_id AND tp.`description` = 'Hoofdkleur 1' - LEFT JOIN vn.ink ON ink.dutchCode = f.feature_value - LEFT JOIN vn.itemInk ik ON ik.longName = i.longName - WHERE ink.name IS NOT NULL - OR ik.color IS NOT NULL; - - UPDATE vn.item i - JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId` - JOIN vn.packaging p ON p.id LIKE 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); - - DROP TABLE IF EXISTS tmp.item; - CREATE TABLE tmp.item - (PRIMARY KEY (id)) - SELECT i.id FROM vn.item i - JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId`; - - CALL vn.item_refreshTags(); - - SET @isTriggerDisabled = FALSE; - - SELECT MIN(LatestDeliveryDateTime) INTO vLanded - FROM edi.supplyResponse sr - JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID - JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID - JOIN vn.floramondoConfig fc - WHERE mp.isLatestOrderDateTimeRelevant - AND di.LatestOrderDateTime > IF(fc.MaxLatestOrderHour > HOUR(util.VN_NOW()), util.VN_CURDATE(), TIMESTAMPADD(DAY,1,util.VN_CURDATE())); - - UPDATE vn.floramondoConfig - SET nextLanded = vLanded - WHERE vLanded IS NOT NULL; - - -- Elimina la oferta obsoleta - UPDATE 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 - JOIN vn.item i ON i.id = b.itemFk - LEFT JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID - LEFT JOIN edi.deliveryInformation di ON di.ID = b.deliveryFk - SET b.quantity = 0 - WHERE (IFNULL(di.LatestOrderDateTime,util.VN_NOW()) <= util.VN_NOW() - OR i.supplyResponseFk IS NULL - OR sr.NumberOfUnits = 0) - AND am.name = 'LOGIFLORA' - AND e.isRaid; - - -- Localiza las entradas de cada almacen - UPDATE edi.warehouseFloramondo - SET entryFk = vn.floramondo_getEntry(TIMESTAMPADD(DAY,travellingDays,vLanded), warehouseFk); - - IF vLanded IS NOT NULL THEN - -- actualiza la oferta existente - UPDATE vn.buy b - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk - JOIN vn.item i ON i.id = b.itemFk - JOIN edi.offer o ON i.supplyResponseFk = o.`srId` - SET b.quantity = o.NumberOfUnits * o.NumberOfItemsPerCask, - b.buyingValue = o.price - WHERE (b.quantity <> o.NumberOfUnits * o.NumberOfItemsPerCask OR b.buyingValue <> o.price); - - -- Se eliminan las ofertas ya incluidas en las entradas - DELETE o - FROM edi.offer o - JOIN vn.item i ON i.supplyResponseFk = o.srId - JOIN vn.buy b ON i.id = b.itemFk - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk; - - -- Se inserta el resto - SET vLastInserted := util.VN_NOW(); - - -- Inserta la oferta - INSERT INTO vn.buy(entryFk, - itemFk, - quantity, - buyingValue, - stickers, - packing, - `grouping`, - groupingMode, - packageFk, - deliveryFk) - - SELECT wf.entryFk, - i.id, - o.NumberOfUnits * o.NumberOfItemsPerCask as quantity, - o.Price, - o.NumberOfUnits as etiquetas, - o.NumberOfItemsPerCask as packing, - GREATEST(1, IFNULL(o.MinimumQuantity,0)) * o.NumberOfItemsPerCask as `grouping`, - 2, -- Obliga al Packing - o.embalageCode, - o.diId - FROM edi.offer o - JOIN vn.item i ON i.supplyResponseFk = o.srId - -- JOIN vn.itemType it ON it.id = i.typeFk - JOIN edi.warehouseFloramondo wf - JOIN vn.packaging p ON p.id LIKE o.embalageCode; -- llevar esta linea i mirar de crear els packages a temps real - - DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc; - - CREATE TEMPORARY TABLE tmp.buyRecalc - SELECT b.id - FROM vn.buy b - JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk - WHERE b.created >= vLastInserted; - - CALL vn.buy_recalcPrices(); - - END IF; - - DROP TEMPORARY TABLE - edi.offer, - itemToInsert; - - DROP TABLE tmp.item; - - COMMIT; - - -- Esto habria que pasarlo a procesos programados o trabajar con tags y dejar las familias - UPDATE vn.item i - SET typeFk = 121 - WHERE i.longName LIKE 'Rosa Garden %' - AND typeFk = 17; - - UPDATE vn.item i - SET typeFk = 156 - WHERE i.longName LIKE 'Rosa ec %' - AND typeFk = 17; - - INSERT INTO edi.log(tableName, fieldName,fieldValue) + INSERT INTO edi.log(tableName, fieldName,fieldValue) VALUES('floramondo_offerRefresh','Tiempo de proceso',TIMEDIFF(util.VN_NOW(),vStartingTime)); + DO RELEASE_LOCK('edi.floramondo_offerRefresh'); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -12151,55 +9431,33 @@ DELIMITER ; 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; - +/** + * Rellena la tabla item_free con los id ausentes en vn.item + * + */ DECLARE vMaxItem INT; - DECLARE vExists BOOLEAN DEFAULT FALSE; - SELECT MAX(id) - INTO vMaxItem + INTO vMaxItem FROM vn.item; - + DROP TEMPORARY TABLE IF EXISTS tmp.itemBusy; CREATE TEMPORARY TABLE tmp.itemBusy - (id INT PRIMARY KEY) - SELECT i.id + (id INT PRIMARY KEY) + SELECT i.id FROM vn.item i - WHERE id >= 400000 + WHERE i.isFloramondo UNION ALL - SELECT ifr.id + 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; + INSERT INTO edi.item_free(id) + SELECT i.id + FROM vn.item i + LEFT JOIN tmp.itemBusy ib ON ib.id = i.id + WHERE i.isFloramondo AND ib.id is null; + DROP TEMPORARY TABLE IF EXISTS tmp.itemBusy; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -12210,9 +9468,9 @@ 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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -12221,7 +9479,7 @@ BEGIN /** * Devuelve un número nuevo de item a partir de un registro de la tabla edi.ekt - * + * * @param vEktFk Identificador de la tabla edi.ekt */ @@ -12230,17 +9488,17 @@ BEGIN SELECT MIN(id) id INTO vItemFk FROM edi.item_free; - DELETE FROM edi.item_free + DELETE FROM edi.item_free WHERE id = vItemFk; - + COMMIT; - + IF ISNULL(vItemFk) THEN SELECT MAX(i.id) + 1 INTO vItemFk FROM vn.item i; END IF; - + INSERT INTO vn.item(id, @@ -12267,118 +9525,118 @@ BEGIN least(IF((e.package = 800),((e.package * 10) + e.pac), e.package), ifnull(idt.bucket_id, '999')) packageFk, e.cat, TRUE - FROM edi.ekt e - JOIN edi.item i ON i.id = e.`ref` - JOIN edi.item_groupToOffer igto ON igto.group_code = i.group_id - LEFT JOIN edi.item_defaultType idt ON idt.item_id = e.`ref` + FROM edi.ekt e + JOIN edi.item i ON i.id = e.`ref` + JOIN edi.item_groupToOffer igto ON igto.group_code = i.group_id + LEFT JOIN edi.item_defaultType idt ON idt.item_id = e.`ref` WHERE e.id = vEktFk; SET @isTriggerDisabled = TRUE; - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.item , 1 - FROM edi.ekt e + SELECT vItemFk, t.id , e.item , 1 + FROM edi.ekt e JOIN vn.tag t ON t.`name` = 'Producto' WHERE e.id = vEktFk AND NOT ISNULL(e.item); INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.cat , 3 - FROM edi.ekt e + SELECT vItemFk, t.id , e.cat , 3 + FROM edi.ekt e JOIN vn.tag t ON t.`name` = 'Calidad' WHERE e.id = vEktFk AND NOT ISNULL(e.cat); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , s.company_name , 4 - FROM edi.ekt e + SELECT vItemFk, t.id , s.company_name , 4 + FROM edi.ekt e JOIN edi.supplier s ON s.supplier_id = e.pro JOIN vn.tag t ON t.`name` = 'Productor' WHERE e.id = vEktFk AND NOT ISNULL(s.company_name); INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.s1, 5 + SELECT vItemFk, t.id , e.s1, 5 FROM edi.ekt e - LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` - AND eif.presentation_order = 1 + LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` + AND eif.presentation_order = 1 AND eif.expiry_date IS NULL - LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature + LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature AND e.s1 = ev.type_value JOIN vn.tag t ON t.ediTypeFk = eif.feature WHERE e.id = vEktFk AND NOT ISNULL(e.s1); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.s2, 6 + SELECT vItemFk, t.id , e.s2, 6 FROM edi.ekt e - LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` - AND eif.presentation_order = 2 + LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` + AND eif.presentation_order = 2 AND eif.expiry_date IS NULL - LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature + LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature AND e.s2 = ev.type_value JOIN vn.tag t ON t.ediTypeFk = eif.feature WHERE e.id = vEktFk AND NOT ISNULL(e.s2); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.s3, 7 + SELECT vItemFk, t.id , e.s3, 7 FROM edi.ekt e - LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` - AND eif.presentation_order = 3 + LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` + AND eif.presentation_order = 3 AND eif.expiry_date IS NULL - LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature + LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature AND e.s3 = ev.type_value JOIN vn.tag t ON t.ediTypeFk = eif.feature WHERE e.id = vEktFk AND NOT ISNULL(e.s3); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.s4, 8 + SELECT vItemFk, t.id , e.s4, 8 FROM edi.ekt e - LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` + LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` AND eif.presentation_order = 4 AND eif.expiry_date IS NULL - LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature + LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature AND e.s4 = ev.type_value JOIN vn.tag t ON t.ediTypeFk = eif.feature WHERE e.id = vEktFk AND NOT ISNULL(e.s4); - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.s5, 9 + SELECT vItemFk, t.id , e.s5, 9 FROM edi.ekt e - LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` + LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` AND eif.presentation_order = 5 AND eif.expiry_date IS NULL - LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature + LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature AND e.s5 = ev.type_value JOIN vn.tag t ON t.ediTypeFk = eif.feature WHERE e.id = vEktFk AND NOT ISNULL(e.s5); INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id , e.s6, 10 + SELECT vItemFk, t.id , e.s6, 10 FROM edi.ekt e - LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` + LEFT JOIN edi.item_feature eif ON eif.item_id = e.`ref` AND eif.presentation_order = 6 AND eif.expiry_date IS NULL - LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature + LEFT JOIN edi.`value` ev ON ev.type_id = eif.feature AND e.s6 = ev.type_value JOIN vn.tag t ON t.ediTypeFk = eif.feature WHERE e.id = vEktFk AND NOT ISNULL(e.s6); INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, t.id, IFNULL(ink.name, ik.color), 11 - FROM edi.ekt e + SELECT vItemFk, t.id, IFNULL(ink.name, ik.color), 11 + FROM edi.ekt e JOIN vn.tag t ON t.`name` = 'Color' - LEFT JOIN edi.feature f ON f.item_id = e.`ref` + LEFT JOIN edi.feature f ON f.item_id = e.`ref` LEFT JOIN edi.`type` tp ON tp.type_id = f.feature_type_id AND tp.`description` = 'Hoofdkleur 1' LEFT JOIN vn.ink ON ink.dutchCode = f.feature_value LEFT JOIN vn.itemInk ik ON ik.longName = e.item WHERE e.id = vEktFk - AND ( ink.name IS NOT NULL + AND ( ink.name IS NOT NULL OR ik.color IS NOT NULL) LIMIT 1; @@ -12390,8 +9648,8 @@ BEGIN CALL vn.item_refreshTags(); - SET @isTriggerDisabled = FALSE; - + SET @isTriggerDisabled = FALSE; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -12437,7 +9695,7 @@ BEGIN sender = vSender, senderFk = vSenderId, messageId = vMessageId; - + IF vIsDuplicated THEN SELECT id INTO vSelf FROM mail @@ -12451,66 +9709,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 `orderLog__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!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; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_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_calcCompByFloramondo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12523,26 +9721,26 @@ DELIMITER ; 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.* + DELETE sc.* FROM vn.saleComponent sc - JOIN vn.sale s ON s.id = sc.saleFk + 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 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 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) @@ -12551,18 +9749,18 @@ BEGIN 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 + 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 + SELECT s.id, c.id, MAX(b.buyingValue) * fhc.floramondoMargin FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk + 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 @@ -12582,7 +9780,7 @@ DELIMITER ; -- Current Database: `hedera` -- -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `hedera` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `hedera` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci */; USE `hedera`; @@ -12594,11 +9792,11 @@ DROP TABLE IF EXISTS `androidUser`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `androidUser` ( - `androidId` varchar(200) CHARACTER SET utf8 NOT NULL, + `androidId` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `userFk` int(10) unsigned NOT NULL, PRIMARY KEY (`userFk`,`androidId`), CONSTRAINT `androidUser_ibfk_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12616,7 +9814,7 @@ CREATE TABLE `basketOrder` ( CONSTRAINT `basketOrder_ibfk_1` FOREIGN KEY (`orderFk`, `clientFk`) REFERENCES `order` (`id`, `customer_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `basketOrder_ibfk_2` FOREIGN KEY (`orderFk`) REFERENCES `order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `basketOrder_ibfk_3` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12627,10 +9825,10 @@ DROP TABLE IF EXISTS `browser`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `browser` ( - `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Browser name in browscap', + `name` varchar(30) NOT NULL COMMENT 'Browser name in browscap', `version` float NOT NULL COMMENT 'Minimal version', UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='List of compatible web browsers and its version'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='List of compatible web browsers and its version'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12642,21 +9840,21 @@ DROP TABLE IF EXISTS `config`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `config` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `defaultLang` char(2) CHARACTER SET utf8 NOT NULL COMMENT 'The default language if none is specified', + `defaultLang` char(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT 'The default language if none is specified', `https` tinyint(3) unsigned NOT NULL COMMENT 'Wether to force de use of HTTPS', `cookieLife` smallint(5) unsigned NOT NULL COMMENT 'The cookies life, in days', - `jwtKey` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The key used to encode/decode JWT tokens', - `defaultForm` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Form loaded at web login', - `restUri` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The URI for rest service', - `testRestUri` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The URI for test rest service', - `guestUser` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Guest user name', - `testDomain` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The address for beta website', - `productionDomain` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The address for production website', - `pdfsDir` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Directory where PDFs are allocated', - `dmsDir` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Directory where documents are allocated', + `jwtKey` varchar(255) NOT NULL COMMENT 'The key used to encode/decode JWT tokens', + `defaultForm` varchar(50) DEFAULT NULL COMMENT 'Form loaded at web login', + `restUri` varchar(255) NOT NULL COMMENT 'The URI for rest service', + `testRestUri` varchar(255) NOT NULL COMMENT 'The URI for test rest service', + `guestUser` varchar(50) DEFAULT NULL COMMENT 'Guest user name', + `testDomain` varchar(255) DEFAULT NULL COMMENT 'The address for beta website', + `productionDomain` varchar(255) DEFAULT NULL COMMENT 'The address for production website', + `pdfsDir` varchar(255) NOT NULL COMMENT 'Directory where PDFs are allocated', + `dmsDir` varchar(255) DEFAULT NULL COMMENT 'Directory where documents are allocated', PRIMARY KEY (`id`), KEY `jwtkey_IX` (`jwtKey`) COMMENT 'Prueba de Ernesto 3.8.2020. MySQL se queja de no tener indices. Si, se que solo tiene un registro pero molesta para depurar otros.' -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12668,9 +9866,9 @@ DROP TABLE IF EXISTS `contact`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `contact` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `recipient` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `recipient` varchar(255) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12682,14 +9880,14 @@ DROP TABLE IF EXISTS `image`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `image` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `collectionFk` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `collectionFk` varchar(50) NOT NULL, + `name` varchar(255) NOT NULL, `updated` int(11) DEFAULT NULL, `nRefs` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Number of references, don''t modify this column manually', PRIMARY KEY (`id`), UNIQUE KEY `collection` (`collectionFk`,`name`), CONSTRAINT `image_ibfk_1` FOREIGN KEY (`collectionFk`) REFERENCES `imageCollection` (`name`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12701,15 +9899,15 @@ DROP TABLE IF EXISTS `imageCollection`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `imageCollection` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `desc` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(50) NOT NULL, + `desc` varchar(50) NOT NULL, `maxWidth` int(10) unsigned NOT NULL, `maxHeight` int(10) unsigned NOT NULL, - `model` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `property` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `schema` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Deprecated', - `table` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Deprecated', - `column` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Deprecated', + `model` varchar(255) DEFAULT NULL, + `property` varchar(255) DEFAULT NULL, + `schema` varchar(50) NOT NULL COMMENT 'Deprecated', + `table` varchar(50) NOT NULL COMMENT 'Deprecated', + `column` varchar(50) NOT NULL COMMENT 'Deprecated', `readRoleFk` int(10) unsigned DEFAULT 1, `writeRoleFk` int(10) unsigned DEFAULT 1, PRIMARY KEY (`id`), @@ -12718,7 +9916,7 @@ CREATE TABLE `imageCollection` ( KEY `role_id_readRoleFk` (`readRoleFk`), CONSTRAINT `role_id_readRoleFk` FOREIGN KEY (`readRoleFk`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE, CONSTRAINT `role_id_writeRoleFk` FOREIGN KEY (`writeRoleFk`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12737,7 +9935,7 @@ CREATE TABLE `imageCollectionSize` ( PRIMARY KEY (`id`), KEY `image_schema_id` (`collectionFk`), CONSTRAINT `imageCollectionSize_ibfk_1` FOREIGN KEY (`collectionFk`) REFERENCES `imageCollection` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12753,7 +9951,7 @@ CREATE TABLE `imageConfig` ( `useXsendfile` tinyint(4) NOT NULL COMMENT 'Whether to use the apache module XSendfile', `url` varchar(255) NOT NULL COMMENT 'Public URL where image are hosted', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Global image parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Global image parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12764,12 +9962,12 @@ DROP TABLE IF EXISTS `language`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `language` ( - `code` varchar(10) CHARACTER SET utf8 NOT NULL, - `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `orgName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `name` varchar(20) NOT NULL, + `orgName` varchar(255) NOT NULL, `isActive` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12781,12 +9979,12 @@ DROP TABLE IF EXISTS `link`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `link` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `link` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `image` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, + `name` varchar(30) NOT NULL, + `description` varchar(255) NOT NULL, + `link` varchar(255) NOT NULL, + `image` varchar(30) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -12861,17 +10059,17 @@ DROP TABLE IF EXISTS `location`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `location` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, - `lat` varchar(12) COLLATE utf8_unicode_ci NOT NULL, - `lng` varchar(12) COLLATE utf8_unicode_ci NOT NULL, - `title` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `address` varchar(75) COLLATE utf8_unicode_ci DEFAULT NULL, - `postcode` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `city` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `province` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `phone` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, - `language` char(2) COLLATE utf8_unicode_ci DEFAULT NULL, + `lat` varchar(12) NOT NULL, + `lng` varchar(12) NOT NULL, + `title` varchar(50) NOT NULL, + `address` varchar(75) DEFAULT NULL, + `postcode` varchar(15) DEFAULT NULL, + `city` varchar(50) DEFAULT NULL, + `province` varchar(50) DEFAULT NULL, + `phone` varchar(20) DEFAULT NULL, + `language` char(2) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12883,15 +10081,15 @@ DROP TABLE IF EXISTS `mailConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `mailConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier', - `host` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'localhost' COMMENT 'SMTP host', + `host` varchar(255) NOT NULL DEFAULT 'localhost' COMMENT 'SMTP host', `port` smallint(6) NOT NULL DEFAULT 465 COMMENT 'SMTP port', `secure` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Wether to use a secure connection', - `sender` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The sender mail address', - `senderName` varchar(75) CHARACTER SET utf8 NOT NULL COMMENT 'The sender name', - `user` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'SMTP user', - `password` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'SMTP password, base64 encoded', + `sender` varchar(255) NOT NULL COMMENT 'The sender mail address', + `senderName` varchar(75) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT 'The sender name', + `user` varchar(50) DEFAULT NULL COMMENT 'SMTP user', + `password` varchar(100) DEFAULT NULL COMMENT 'SMTP password, base64 encoded', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12904,7 +10102,7 @@ DROP TABLE IF EXISTS `mainAccount`; CREATE TABLE `mainAccount` ( `accountFk` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`accountFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12930,8 +10128,8 @@ DROP TABLE IF EXISTS `menu`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `menu` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `path` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `description` varchar(30) NOT NULL, + `path` varchar(50) DEFAULT NULL, `roleFk` int(10) unsigned NOT NULL, `parentFk` int(10) unsigned DEFAULT NULL, `displayOrder` tinyint(4) unsigned NOT NULL DEFAULT 1, @@ -12939,7 +10137,7 @@ CREATE TABLE `menu` ( KEY `group_id` (`roleFk`), KEY `parent` (`parentFk`), CONSTRAINT `menu_ibfk_1` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12951,11 +10149,11 @@ DROP TABLE IF EXISTS `message`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `message` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `code` char(35) COLLATE utf8_unicode_ci NOT NULL, - `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `code` char(35) NOT NULL, + `description` varchar(255) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code` (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12967,11 +10165,11 @@ DROP TABLE IF EXISTS `metatag`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `metatag` ( `id` int(11) NOT NULL, - `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `content` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(50) NOT NULL, + `content` varchar(255) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13280,19 +10478,19 @@ DROP TABLE IF EXISTS `news`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `news` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, - `title` varchar(150) COLLATE utf8_unicode_ci NOT NULL, - `text` text COLLATE utf8_unicode_ci NOT NULL, - `image` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `title` varchar(150) NOT NULL, + `text` text NOT NULL, + `image` varchar(100) DEFAULT NULL, `userFk` int(10) unsigned NOT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), `priority` tinyint(3) unsigned NOT NULL DEFAULT 3, - `tag` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'new', + `tag` varchar(15) NOT NULL DEFAULT 'new', PRIMARY KEY (`id`), KEY `user` (`userFk`), KEY `tag` (`tag`), CONSTRAINT `news_ibfk_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`account` (`id`) ON UPDATE CASCADE, CONSTRAINT `news_ibfk_2` FOREIGN KEY (`tag`) REFERENCES `newsTag` (`name`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -13366,10 +10564,10 @@ DROP TABLE IF EXISTS `newsTag`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `newsTag` ( - `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `description` varchar(25) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(15) NOT NULL, + `description` varchar(25) NOT NULL, PRIMARY KEY (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13387,8 +10585,8 @@ CREATE TABLE `order` ( `agency_id` int(11) DEFAULT 2, `address_id` int(11) DEFAULT NULL, `company_id` smallint(5) unsigned NOT NULL DEFAULT 442, - `note` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `source_app` set('WEB','ANDROID','IOS','SALIX','TPV','TABLET_VN','') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'TPV', + `note` varchar(255) DEFAULT NULL, + `source_app` set('WEB','ANDROID','IOS','SALIX','TPV','TABLET_VN','') NOT NULL DEFAULT 'TPV', `is_bionic` tinyint(1) NOT NULL DEFAULT 1, `confirmed` tinyint(1) NOT NULL DEFAULT 0, `date_make` timestamp NOT NULL DEFAULT current_timestamp(), @@ -13409,7 +10607,7 @@ CREATE TABLE `order` ( CONSTRAINT `order_ibfk_5` FOREIGN KEY (`address_id`) REFERENCES `vn`.`address` (`id`) ON UPDATE CASCADE, CONSTRAINT `order_ibfk_8` FOREIGN KEY (`delivery_method_id`) REFERENCES `vn`.`deliveryMethod` (`id`) ON UPDATE CASCADE, CONSTRAINT `order_ibfk_9` FOREIGN KEY (`agency_id`) REFERENCES `vn`.`agencyMode` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -13423,16 +10621,16 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `hedera`.`order_afterInsert` AFTER INSERT ON `order` FOR EACH ROW -BEGIN +BEGIN IF NEW.address_id = 2850 THEN -- Fallo que se insertan no se sabe como tickets en este cliente CALL vn.mail_insert( 'jgallego@verdnatura.es', 'noreply@verdnatura.es', 'Creada order al address 2850', - CONCAT(account.myUserGetName(), ' ha creado la order ',NEW.id) + CONCAT(account.myUser_getName(), ' ha creado la order ',NEW.id) ); - + END IF; END */;; DELIMITER ; @@ -13454,7 +10652,7 @@ DELIMITER ;; 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 @@ -13467,7 +10665,7 @@ BEGIN 'jgallego@verdnatura.es', 'noreply@verdnatura.es', 'Actualizada order al address 2850', - CONCAT(account.myUserGetName(), ' ha creado la order ',NEW.id) + CONCAT(account.myUser_getName(), ' ha creado la order ',NEW.id) ); END IF; END */;; @@ -13508,9 +10706,8 @@ CREATE TABLE `orderConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `employeeFk` int(10) unsigned NOT NULL, `defaultAgencyFk` int(11) DEFAULT NULL, - `guestMethod` varchar(45) CHARACTER SET utf8 NOT NULL, + `guestMethod` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `guestAgencyFk` int(11) NOT NULL, - `guestAddressFk` int(11) NOT NULL, `reserveTime` time NOT NULL, `defaultCompanyFk` smallint(6) unsigned DEFAULT NULL, PRIMARY KEY (`id`), @@ -13519,13 +10716,11 @@ CREATE TABLE `orderConfig` ( KEY `defaultCompanyFk` (`defaultCompanyFk`), KEY `guestMethod` (`guestMethod`), KEY `defaultAgencyFk` (`defaultAgencyFk`), - KEY `guestAddressFk` (`guestAddressFk`), CONSTRAINT `orderConfig_ibfk_1` FOREIGN KEY (`employeeFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `orderConfig_ibfk_2` FOREIGN KEY (`defaultCompanyFk`) REFERENCES `vn`.`company` (`id`) ON UPDATE CASCADE, CONSTRAINT `orderConfig_ibfk_3` FOREIGN KEY (`guestAgencyFk`) REFERENCES `vn`.`agencyMode` (`id`) ON UPDATE CASCADE, - CONSTRAINT `orderConfig_ibfk_4` FOREIGN KEY (`defaultAgencyFk`) REFERENCES `vn`.`agencyMode` (`id`), - CONSTRAINT `orderConfig_ibfk_5` FOREIGN KEY (`guestAddressFk`) REFERENCES `vn`.`address` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + CONSTRAINT `orderConfig_ibfk_4` FOREIGN KEY (`defaultAgencyFk`) REFERENCES `vn`.`agencyMode` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13536,10 +10731,11 @@ DROP TABLE IF EXISTS `orderRecalc`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `orderRecalc` ( + `id` int(11) NOT NULL AUTO_INCREMENT, `orderFk` int(10) unsigned NOT NULL, - PRIMARY KEY (`orderFk`), - CONSTRAINT `orderRecalc_ibfk_1` FOREIGN KEY (`orderFk`) REFERENCES `order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queue of changed orders to recalc it''s total'; + PRIMARY KEY (`id`), + KEY `orderRecalc_ibfk_1` (`orderFk`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Queue of changed orders to recalc it''s total'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13565,9 +10761,11 @@ CREATE TABLE `orderRow` ( KEY `order_id` (`orderFk`), KEY `created` (`created`), KEY `warehouse_shipment` (`warehouseFk`,`shipment`), + KEY `orderRow_ibfk_4` (`saleFk`), CONSTRAINT `orderRow_ibfk_2` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON UPDATE CASCADE, - CONSTRAINT `orderRow_ibfk_3` FOREIGN KEY (`orderFk`) REFERENCES `order` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + CONSTRAINT `orderRow_ibfk_3` FOREIGN KEY (`orderFk`) REFERENCES `order` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `orderRow_ibfk_4` FOREIGN KEY (`saleFk`) REFERENCES `vn`.`sale` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -13584,12 +10782,12 @@ DELIMITER ;; BEGIN DECLARE vIsFirst BOOL; - SELECT (first_row_stamp IS NULL) INTO vIsFirst - FROM `order` + SELECT (first_row_stamp IS NULL) INTO vIsFirst + FROM `order` WHERE id = NEW.orderFk; IF vIsFirst THEN - UPDATE `order` SET first_row_stamp = util.VN_NOW() + UPDATE `order` SET first_row_stamp = util.VN_NOW() WHERE id = NEW.orderFk; END IF; END */;; @@ -13677,7 +10875,7 @@ CREATE TABLE `orderRowComponent` ( PRIMARY KEY (`rowFk`,`componentFk`), KEY `component_id` (`componentFk`), CONSTRAINT `orderRowComponent_ibfk_1` FOREIGN KEY (`rowFk`) REFERENCES `orderRow` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13740,12 +10938,12 @@ DROP TABLE IF EXISTS `restPriv`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `restPriv` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `methodPath` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `role` int(10) unsigned NOT NULL, + `methodPath` varchar(255) NOT NULL, + `role` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `role` (`role`), CONSTRAINT `restPriv_ibfk_1` FOREIGN KEY (`role`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13757,14 +10955,14 @@ DROP TABLE IF EXISTS `shelf`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `shelf` ( `id` int(10) unsigned NOT NULL, - `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(30) NOT NULL, `nTrays` tinyint(3) unsigned NOT NULL, `trayheight` mediumint(8) unsigned NOT NULL, `topTrayHeight` mediumint(8) unsigned NOT NULL, `width` mediumint(8) unsigned NOT NULL, `depth` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Dimensiones de las estanterias'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Dimensiones de las estanterias'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13776,8 +10974,8 @@ DROP TABLE IF EXISTS `shelfConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `shelfConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(25) COLLATE utf8_unicode_ci NOT NULL, - `namePrefix` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `name` varchar(25) NOT NULL, + `namePrefix` varchar(50) DEFAULT NULL, `warehouse` smallint(5) unsigned NOT NULL, `family` smallint(5) unsigned NOT NULL, `shelf` int(10) unsigned NOT NULL, @@ -13791,7 +10989,7 @@ CREATE TABLE `shelfConfig` ( CONSTRAINT `shelfConfig_ibfk_1` FOREIGN KEY (`family`) REFERENCES `vn`.`itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `shelfConfig_ibfk_2` FOREIGN KEY (`shelf`) REFERENCES `shelf` (`id`) ON UPDATE CASCADE, CONSTRAINT `shelfConfig_ibfk_3` FOREIGN KEY (`warehouse`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13803,13 +11001,13 @@ DROP TABLE IF EXISTS `social`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `social` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `title` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `link` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `icon` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `title` varchar(50) NOT NULL, + `link` varchar(255) NOT NULL, + `icon` varchar(50) NOT NULL, `priority` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `priority` (`priority`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13821,9 +11019,9 @@ DROP TABLE IF EXISTS `survey`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `survey` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `question` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `question` varchar(255) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13836,11 +11034,11 @@ DROP TABLE IF EXISTS `surveyAnswer`; CREATE TABLE `surveyAnswer` ( `id` int(10) unsigned NOT NULL, `surveyFk` int(10) unsigned NOT NULL, - `answer` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `answer` varchar(30) NOT NULL, `votes` int(10) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `survey` (`surveyFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13857,7 +11055,7 @@ CREATE TABLE `surveyVote` ( KEY `surveyVote_ibfk_2` (`userFk`), CONSTRAINT `surveyVote_ibfk_1` FOREIGN KEY (`surveyFk`) REFERENCES `survey` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `surveyVote_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13874,15 +11072,15 @@ CREATE TABLE `tpvConfig` ( `transactionType` tinyint(3) unsigned NOT NULL, `maxAmount` int(10) unsigned DEFAULT NULL, `employeeFk` int(10) unsigned NOT NULL, - `url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The bank web service URL for production environment', + `url` varchar(255) DEFAULT NULL COMMENT 'The bank web service URL for production environment', `testMode` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'Whether test mode is enabled', - `testUrl` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT 'The bank web service URL for test environment', - `testKey` varchar(50) CHARACTER SET utf8 DEFAULT NULL COMMENT 'The bank secret key for test environment', - `merchantUrl` varchar(255) CHARACTER SET utf8 DEFAULT NULL, + `testUrl` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'The bank web service URL for test environment', + `testKey` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'The bank secret key for test environment', + `merchantUrl` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `employee_id` (`employeeFk`), CONSTRAINT `employee_id` FOREIGN KEY (`employeeFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Virtual TPV parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Virtual TPV parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13893,10 +11091,10 @@ DROP TABLE IF EXISTS `tpvError`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tpvError` ( - `code` char(7) COLLATE utf8_unicode_ci NOT NULL, - `message` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `code` char(7) NOT NULL, + `message` varchar(255) NOT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT=' List of possible TPV errors'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT=' List of possible TPV errors'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13908,14 +11106,14 @@ DROP TABLE IF EXISTS `tpvImapConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tpvImapConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `host` varchar(150) COLLATE utf8_unicode_ci NOT NULL, - `user` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `pass` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `cleanPeriod` varchar(15) CHARACTER SET utf8 NOT NULL, - `successFolder` varchar(150) CHARACTER SET utf8 DEFAULT NULL, - `errorFolder` varchar(150) CHARACTER SET utf8 DEFAULT NULL, + `host` varchar(150) NOT NULL, + `user` varchar(50) NOT NULL, + `pass` varchar(50) NOT NULL, + `cleanPeriod` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `successFolder` varchar(150) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `errorFolder` varchar(150) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='IMAP configuration parameters for virtual TPV'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='IMAP configuration parameters for virtual TPV'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13927,15 +11125,15 @@ DROP TABLE IF EXISTS `tpvMerchant`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tpvMerchant` ( `id` int(10) unsigned NOT NULL COMMENT 'Merchant identifier', - `description` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Small description', + `description` varchar(50) NOT NULL COMMENT 'Small description', `companyFk` smallint(6) unsigned DEFAULT NULL COMMENT 'Company associated with the merchant', `bankFk` int(10) NOT NULL COMMENT 'The bank where merchant receipts are created', - `secretKey` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The merchant secret key to sign transactions', + `secretKey` varchar(50) NOT NULL COMMENT 'The merchant secret key to sign transactions', PRIMARY KEY (`id`), KEY `bank_id` (`bankFk`), KEY `company_id` (`companyFk`), KEY `id` (`id`,`companyFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Virtual TPV providers'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Virtual TPV providers'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13951,7 +11149,7 @@ CREATE TABLE `tpvMerchantEnable` ( PRIMARY KEY (`merchantFk`,`companyFk`), UNIQUE KEY `company_id` (`companyFk`), CONSTRAINT `tpvMerchantEnable_ibfk_1` FOREIGN KEY (`merchantFk`, `companyFk`) REFERENCES `tpvMerchant` (`id`, `companyFk`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Virtual TPV enabled providers'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Virtual TPV enabled providers'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13963,9 +11161,9 @@ DROP TABLE IF EXISTS `tpvResponse`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tpvResponse` ( `id` smallint(5) unsigned NOT NULL, - `message` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `message` varchar(255) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='List of possible TPV reponses'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='List of possible TPV reponses'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13982,9 +11180,13 @@ CREATE TABLE `tpvTransaction` ( `receiptFk` int(11) DEFAULT NULL, `amount` int(10) unsigned NOT NULL, `response` smallint(5) unsigned DEFAULT NULL COMMENT 'Status notified by bank: NULL if no notification, 0 if success, error otherwise', - `errorCode` char(7) COLLATE utf8_unicode_ci DEFAULT NULL, - `status` enum('started','ok','ko') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'started', + `errorCode` char(7) DEFAULT NULL, + `status` enum('started','ok','ko') NOT NULL DEFAULT 'started', `created` timestamp NOT NULL DEFAULT current_timestamp(), + `merchantParameters` text DEFAULT NULL, + `signature` varchar(255) DEFAULT NULL, + `signatureVersion` varchar(50) DEFAULT NULL, + `responseError` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `merchant_id` (`merchantFk`), KEY `receipt_id` (`receiptFk`), @@ -13994,7 +11196,7 @@ CREATE TABLE `tpvTransaction` ( CONSTRAINT `receipt_id` FOREIGN KEY (`receiptFk`) REFERENCES `vn`.`receipt` (`Id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `tpvTransaction_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `tpvTransaction_ibfk_2` FOREIGN KEY (`merchantFk`) REFERENCES `tpvMerchant` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Transactions realized through the virtual TPV'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Transactions realized through the virtual TPV'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -14007,13 +11209,13 @@ DROP TABLE IF EXISTS `userSession`; CREATE TABLE `userSession` ( `created` datetime NOT NULL DEFAULT current_timestamp(), `lastUpdate` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `ssid` char(64) COLLATE utf8_unicode_ci NOT NULL, - `data` text COLLATE utf8_unicode_ci DEFAULT NULL, + `ssid` char(64) NOT NULL, + `data` text DEFAULT NULL, `userVisitFk` int(10) unsigned DEFAULT NULL, UNIQUE KEY `ssid` (`ssid`), KEY `userVisit` (`userVisitFk`), KEY `lastUpdate` (`lastUpdate`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -14029,7 +11231,7 @@ CREATE TABLE `visit` ( PRIMARY KEY (`id`), KEY `firstAgent` (`firstAgentFk`), CONSTRAINT `visit_ibfk_1` FOREIGN KEY (`firstAgentFk`) REFERENCES `visitAgent` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -14044,12 +11246,12 @@ CREATE TABLE `visitAccess` ( `agentFk` int(10) unsigned NOT NULL, `stamp` datetime NOT NULL DEFAULT current_timestamp(), `ip` int(10) unsigned DEFAULT NULL, - `referer` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `referer` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `visit_access_idx_agent` (`agentFk`), KEY `stamp` (`stamp`), CONSTRAINT `visitAccess_ibfk_1` FOREIGN KEY (`agentFk`) REFERENCES `visitAgent` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -14063,18 +11265,18 @@ CREATE TABLE `visitAgent` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `visitFk` int(10) unsigned NOT NULL, `firstAccessFk` int(10) unsigned DEFAULT NULL, - `platform` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, - `browser` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, - `version` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + `platform` varchar(30) DEFAULT NULL, + `browser` varchar(30) DEFAULT NULL, + `version` varchar(15) DEFAULT NULL, `javascript` tinyint(3) unsigned DEFAULT NULL, `cookies` tinyint(3) unsigned DEFAULT NULL, - `agent` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `agent` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `visit_id` (`visitFk`), KEY `firstAccess` (`firstAccessFk`), CONSTRAINT `visitAgent_ibfk_1` FOREIGN KEY (`visitFk`) REFERENCES `visit` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `visitAgent_ibfk_2` FOREIGN KEY (`firstAccessFk`) REFERENCES `visitAccess` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -14094,7 +11296,7 @@ CREATE TABLE `visitUser` ( KEY `date_time` (`stamp`), KEY `user_id` (`userFk`), CONSTRAINT `visitUser_ibfk_1` FOREIGN KEY (`accessFk`) REFERENCES `visitAccess` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -14106,14 +11308,14 @@ 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 character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_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 `order_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2019-08-29 14:18:04' ON COMPLETION PRESERVE ENABLE DO CALL order_doRecalc */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `order_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2019-08-29 14:18:04' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL order_doRecalc */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -14125,7 +11327,7 @@ DELIMITER ; -- -- Dumping routines for database 'hedera' -- -/*!50003 DROP FUNCTION IF EXISTS `MYBASKET_GETID` */; +/*!50003 DROP FUNCTION IF EXISTS `myBasket_getId` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -14135,12 +11337,12 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `MYBASKET_GETID`() RETURNS int(11) +CREATE DEFINER=`root`@`localhost` FUNCTION `myBasket_getId`() RETURNS int(11) DETERMINISTIC BEGIN DECLARE vOrder INT; - - SELECT orderFk INTO vOrder FROM basketOrder + + SELECT orderFk INTO vOrder FROM basketOrder WHERE clientFk = account.myUser_getId(); RETURN vOrder; @@ -14168,7 +11370,7 @@ BEGIN * * @return Saldo del cliente */ - RETURN vn.clientGetDebt(account.userGetId(), vDate); + RETURN vn.clientGetDebt(account.myUser_getId(), vDate); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -14189,19 +11391,29 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `myUser_checkRestPriv`(vMethodPath VA DETERMINISTIC BEGIN /** - * Comprueba si el usuario actual tiene permiso para ejecutar - * un servicio REST. + * Checks if the current user has permission to run a REST service. * - * @param vMethodPath Ruta del servicio REST a ejecutar - * @return %TRUE si tiene permisos, %FALSE en caso contrario - **/ - DECLARE vRole INT DEFAULT NULL; + * @param vMethodPath Route of the REST service + * @return %TRUE if it has permissions, otherwise %FALSE + */ + DECLARE vCount INT; + DECLARE vHasRole INT DEFAULT NULL; - SELECT role INTO vRole FROM restPriv + SELECT COUNT(*) INTO vCount FROM restPriv WHERE methodPath = vMethodPath; - - RETURN vRole IS NULL - OR account.myUserHasRoleId (vRole); + + IF vCount = 0 THEN + RETURN FALSE; + END IF; + + SELECT COUNT(*) > 0 + INTO vHasRole + FROM restPriv + WHERE methodPath = vMethodPath + AND (`role` IS NULL OR account.myUser_hasRoleId(`role`)) + LIMIT 1; + + RETURN vHasRole; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -14273,14 +11485,14 @@ BEGIN * @return tmp.ticketComponent * @return tmp.ticketLot * @return tmp.zoneGetShipped - */ + */ DECLARE vAgencyMode INT; - + SELECT a.agencyModeFk INTO vAgencyMode FROM myClient c JOIN vn.address a ON a.clientFk = c.id - WHERE a.id = vAddress; + WHERE a.id = vAddress; CALL vn.available_calc(vDelivery, vAddress, vAgencyMode); @@ -14293,7 +11505,7 @@ BEGIN JOIN tmp.availableCalc a ON a.calcFk = c.calc_id WHERE c.available > 0 GROUP BY c.item_id; - + CALL vn.catalog_calculate(vDelivery, vAddress, vAgencyMode); DROP TEMPORARY TABLE tmp.item; @@ -14345,7 +11557,7 @@ BEGIN JOIN tmp.availableCalc a ON a.calcFk = c.calc_id WHERE c.available > 0 GROUP BY c.item_id; - + CALL vn.catalog_calculate_beta(vDelivery, vAddress, vAgencyMode); DROP TEMPORARY TABLE tmp.item; @@ -14355,81 +11567,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_getTags__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_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_getTags__`(vLimit INT) -BEGIN -/** - * Returns the main tags for a list of items. - * - * @table tItems The list of items - * @select The main tags for the passed items - */ - CALL catalogGetAvailable; - - DROP TEMPORARY TABLE IF EXISTS tTags; - CREATE TEMPORARY TABLE tTags - (INDEX (tagFk)) - ENGINE = MEMORY - SELECT it.tagFk, SUM(it.priority) priority - FROM vn.itemTag it - JOIN tItems i ON i.id = it.itemFk - GROUP BY tagFk - LIMIT vLimit; - - SELECT l.id, l.name - FROM tTags t - JOIN vn.tagL10n l ON l.id = t.tagFk - ORDER BY priority DESC; - - DROP TEMPORARY TABLE tTags; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `catalog_getTagValues__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_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_getTagValues__`(vTag INT) -BEGIN -/** - * Returns the list of available values for a tag and a list of items. - * - * @table tItems The list of items - * @param vTag The tag identifier - * @select The list of available tags - */ - CALL catalogGetAvailable; - - SELECT DISTINCT it.value - FROM vn.itemTag it - JOIN tItems i ON i.id = it.itemFk - WHERE it.tagFk = vTag - ORDER BY value - LIMIT 200; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `image_ref` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -14522,7 +11659,7 @@ BEGIN */ DROP TEMPORARY TABLE IF EXISTS tmp.item; CREATE TEMPORARY TABLE tmp.item - ENGINE = MEMORY + ENGINE = MEMORY SELECT vSelf itemFk; CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); @@ -14546,55 +11683,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `item_getList` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_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_getList`(IN `vWarehouse` SMALLINT, IN `vShipping` DATE, IN `vCategory` INT, IN `vRate` TINYINT) -BEGIN - DECLARE vCalc INT; - - CALL cache.available_refresh(vCalc, FALSE, vWarehouse, vShipping); - CALL vn.buyUltimate(vWarehouse, vShipping); - - SELECT a.id, a.`name`, a.category, a.size, a.stems, a.inkFk, a.typeFk, a.image, - c.available, o.`name` origin, t.`name` `type`, - CASE b.groupingMode - WHEN 0 THEN 1 - WHEN 2 THEN b.packing - ELSE b.`grouping` - END AS `grouping`, - CASE vRate - WHEN 1 THEN b.price1 - WHEN 2 THEN b.price2 - WHEN 3 THEN b.price3 - ELSE NULL - END AS price - FROM cache.available c - JOIN vn.item a ON a.id = c.item_id - JOIN vn.itemType t ON t.id = a.typeFk - JOIN vn.itemCategory r ON r.id = t.categoryFk - LEFT JOIN vn.origin o ON o.id = a.originFk - JOIN tmp.buyUltimate bu ON bu.itemFk = a.id - JOIN vn.buy b ON b.id = bu.buyFk - WHERE c.calc_id = vCalc - AND c.available > 0 - AND a.id != 90 - AND r.display - AND (vCategory IS NULL OR vCategory = r.id) - ORDER BY a.typeFk, a.`name`, a.size; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_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 */ ; @@ -14611,7 +11699,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getVisible`( vType INT, vPrefix VARCHAR(255)) BEGIN - + /** * Gets visible items of the specified type at specified date. * @@ -14620,7 +11708,7 @@ BEGIN * @param vType The type id * @param vPrefix The article prefix to filter or %NULL for all * @return tmp.itemVisible Visible items - */ + */ DECLARE vPrefixLen SMALLINT; DECLARE vFilter VARCHAR(255) DEFAULT NULL; DECLARE vDateInv DATE DEFAULT vn2008.date_inv(); @@ -14629,13 +11717,13 @@ BEGIN GET DIAGNOSTICS CONDITION 1 @message = MESSAGE_TEXT; CALL vn.mail_insert( - 'cau@verdnatura.es', - NULL, + 'cau@verdnatura.es', + NULL, CONCAT('hedera.item_getVisible error: ', @message), CONCAT( - 'warehouse: ', IFNULL(vWarehouse, ''), - ', Fecha:', IFNULL(vDate, ''), - ', tipo: ', IFNULL(vType,''), + 'warehouse: ', IFNULL(vWarehouse, ''), + ', Fecha:', IFNULL(vDate, ''), + ', tipo: ', IFNULL(vType,''), ', prefijo: ', IFNULL(vPrefix,''))); RESIGNAL; END; @@ -14702,6 +11790,7 @@ BEGIN AND b.price2 >= 0 AND b.packageFk IS NOT NULL ORDER BY t.warehouseInFk = vWarehouse DESC, t.landed DESC + LIMIT 10000000000000000000 ) t GROUP BY itemFk; DROP TEMPORARY TABLE IF EXISTS tmp.itemVisible; @@ -14713,13 +11802,13 @@ BEGIN IF(p.depth > 0, p.depth, 0) depth, p.width, p.height, CEIL(s.quantity / t.packing) etiquetas FROM vn.item i - JOIN `filter` f ON f.itemFk = i.id + JOIN `filter` f ON f.itemFk = i.id JOIN currentStock s ON s.itemFk = i.id LEFT JOIN tmp t ON t.itemFk = i.id LEFT JOIN vn.packaging p ON p.id = t.packageFk WHERE CEIL(s.quantity / t.packing) > 0 -- FIXME: Column Cubos.box not included in view vn.packaging - /* AND p.box */ ; + /* AND p.box */; DROP TEMPORARY TABLE `filter`, @@ -14731,127 +11820,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `item_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 TINYINT, - vDate DATE, - vType INT, - vPrefix VARCHAR(255)) -BEGIN -/** - * Gets visible items of the specified type at specified date. - * - * @param vWarehouse The warehouse id - * @param vDate The visible date - * @param vType The type id - * @param vPrefix The article prefix to filter or %NULL for all - * @return tmp.itemVisible Visible items - */ - DECLARE vPrefixLen SMALLINT; - DECLARE vFilter VARCHAR(255) DEFAULT NULL; - DECLARE vDateInv DATE DEFAULT vn2008.date_inv(); - - SET vPrefixLen = IFNULL(LENGTH(vPrefix), 0) + 1; - - IF vPrefixLen > 1 THEN - SET vFilter = CONCAT(vPrefix, '%'); - END IF; - - DROP TEMPORARY TABLE IF EXISTS filter; - CREATE TEMPORARY TABLE filter - (INDEX (itemFk)) - ENGINE = MEMORY - SELECT id itemFk FROM vn.item - WHERE typeFk = vType - AND (vFilter IS NULL OR `name` LIKE vFilter); - - DROP TEMPORARY TABLE IF EXISTS currentStock; - CREATE TEMPORARY TABLE currentStock - (INDEX (itemFk)) - ENGINE = MEMORY - SELECT itemFk, SUM(quantity) quantity - FROM ( - SELECT b.itemFk, b.quantity - FROM vn.buy b - JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.travel t ON t.id = e.travelFk - WHERE t.landed BETWEEN vDateInv AND vDate - AND t.warehouseInFk = vWarehouse - AND NOT e.isRaid - UNION ALL - SELECT b.itemFk, -b.quantity - FROM vn.buy b - JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.travel t ON t.id = e.travelFk - WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE() - AND t.warehouseOutFk = vWarehouse - AND NOT e.isRaid - AND t.isDelivered - UNION ALL - SELECT m.itemFk, -m.quantity - FROM vn.sale m - JOIN vn.ticket t ON t.id = m.ticketFk - JOIN vn.ticketState s ON s.ticket = t.id - WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE() - AND t.warehouseFk = vWarehouse - AND s.alertLevel = 3 - ) t - GROUP BY itemFk - HAVING quantity > 0; - - DROP TEMPORARY TABLE IF EXISTS tmp; - CREATE TEMPORARY TABLE tmp - (INDEX (itemFk)) - ENGINE = MEMORY - SELECT * - FROM ( - SELECT b.itemFk, b.packageFk, b.packing - FROM vn.buy b - JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.travel t ON t.id = e.travelFk - WHERE t.landed BETWEEN vDateInv AND vDate - AND NOT b.isIgnored - AND b.price2 >= 0 - AND b.packageFk IS NOT NULL - ORDER BY t.warehouseInFk = vWarehouse DESC, t.landed DESC - ) t GROUP BY itemFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.itemVisible; - CREATE TEMPORARY TABLE tmp.itemVisible - ENGINE = MEMORY - SELECT i.id Id_Article, - SUBSTRING(i.`name`, vPrefixLen) Article, - t.packing, p.id Id_Cubo, - IF(p.depth > 0, p.depth, 0) depth, p.width, p.height, - CEIL(s.quantity / t.packing) etiquetas - FROM vn.item i - JOIN filter f ON f.itemFk = i.id - JOIN currentStock s ON s.itemFk = i.id - LEFT JOIN tmp t ON t.itemFk = i.id - LEFT JOIN vn.packaging p ON p.id = t.packageFk - WHERE CEIL(s.quantity / t.packing) > 0 - -- FIXME: Column Cubos.box not included in view vn.packaging - /* AND p.box */ ; - - DROP TEMPORARY TABLE - filter, - currentStock, - tmp; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_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_listAllocation` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -15008,7 +11976,7 @@ BEGIN IF vStatus = 'OK' THEN CALL order_checkConfig(vSelf); - + IF vStatus = 'OK' AND vCreated < TIMESTAMPADD(DAY, -1, util.VN_NOW()) THEN CALL order_update(vSelf); @@ -15035,20 +12003,20 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myBasket_configure`( vDelivery DATE, - vDeliveryMethod VARCHAR(45), - vAgency INT, - vAddress INT) + 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. + * 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 vCompany INT; DECLARE vDeliveryMethodId INT; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vSelf = NULL; @@ -15064,35 +12032,32 @@ BEGIN FROM vn.deliveryMethod WHERE code = vDeliveryMethod; - IF vDeliveryMethod = 'PICKUP' AND vAddress IS NULL - THEN + 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 - + IF vSelf IS NULL THEN SELECT defaultCompanyFk INTO vCompany FROM orderConfig; INSERT INTO `order` SET - customer_id = account.userGetId(), + customer_id = account.myUser_getId(), date_send = vDelivery, delivery_method_id = vDeliveryMethodId, agency_id = vAgency, address_id = vAddress, - source_app = 'WEB', - company_id = vCompany; + source_app = 'WEB', + company_id = vCompany; SET vSelf = LAST_INSERT_ID(); - - INSERT INTO basketOrder SET - clientFk = account.userGetId(), - orderFk = vSelf; + + INSERT INTO basketOrder SET + clientFk = account.myUser_getId(), + orderFk = vSelf; ELSE UPDATE `order` SET @@ -15102,7 +12067,7 @@ BEGIN address_id = vAddress WHERE id = vSelf; - + CALL order_update(vSelf); END IF; @@ -15127,23 +12092,24 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myBasket_configureForGuest`() BEGIN - DECLARE vMethod VARCHAR(255); - DECLARE vAgency INT; - DECLARE vAddress INT; - DECLARE vDate DATE; - - SELECT guestMethod, guestAgencyFk, guestAddressFk + DECLARE vMethod VARCHAR(255); + DECLARE vAgency INT; + DECLARE vAddress INT; + DECLARE vDate DATE; + + SELECT cf.guestMethod, cf.guestAgencyFk, cl.defaultAddressFk INTO vMethod, vAgency, vAddress - FROM orderConfig - LIMIT 1; - + FROM orderConfig cf + JOIN myClient cl + LIMIT 1; + SET vDate = TIMESTAMPADD(DAY, 1, util.VN_CURDATE()); - - IF WEEKDAY(vDate) BETWEEN 5 AND 6 THEN + + IF WEEKDAY(vDate) BETWEEN 5 AND 6 THEN SET vDate = TIMESTAMPADD(DAY, 7 - WEEKDAY(vDate), vDate); END IF; - - CALL myBasket_configure(vDate, vMethod, vAgency, vAddress); + + CALL myBasket_configure(vDate, vMethod, vAgency, vAddress); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -15166,7 +12132,7 @@ BEGIN IF vSelf IS NOT NULL THEN CALL order_confirm(vSelf); - + DELETE FROM basketOrder WHERE orderFk = vSelf; END IF; @@ -15222,9 +12188,9 @@ BEGIN CREATE TEMPORARY TABLE tmp.`order` ENGINE = MEMORY SELECT myBasket_getId() orderFk; - + CALL order_getTax(); - + DROP TEMPORARY TABLE IF EXISTS tmp.`order`; END ;; DELIMITER ; @@ -15253,7 +12219,7 @@ BEGIN SELECT COUNT(*) INTO vIsMine FROM myOrder WHERE id = vSelf; - + IF vIsMine THEN CALL order_addItem(vSelf, vWarehouse, vItem, vAmount); END IF; @@ -15276,11 +12242,11 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_confirm`(vSelf INT) BEGIN DECLARE vIsMine BOOL; - - SELECT COUNT(*) INTO vIsMine + + SELECT COUNT(*) INTO vIsMine FROM myOrder WHERE id = vSelf; - + IF vIsMine THEN CALL order_confirm(vSelf); END IF; @@ -15313,7 +12279,7 @@ BEGIN SELECT COUNT(*) INTO isMine FROM myOrder WHERE id = vSelf; - + IF isMine THEN CALL order_getAvailable(vSelf); END IF; @@ -15359,15 +12325,15 @@ BEGIN START TRANSACTION; - SELECT a.agencyModeFk, a.id + SELECT a.agencyModeFk, a.id INTO vAgencyMode, vAddressFk - FROM vn.address a + 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 @@ -15376,7 +12342,7 @@ BEGIN INSERT INTO `order` SET - customer_id = account.userGetId(), + customer_id = account.myUser_getId(), date_send = vLandingDate, delivery_method_id = vDeliveryMethodId, agency_id = vAgencyMode, @@ -15385,7 +12351,7 @@ BEGIN company_id = vCompany; SET vSelf = LAST_INSERT_ID(); - + CALL order_checkConfig(vSelf); COMMIT; @@ -15431,15 +12397,15 @@ BEGIN START TRANSACTION; - SELECT a.agencyModeFk, a.id + 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 @@ -15448,7 +12414,7 @@ BEGIN INSERT INTO `order` SET - customer_id = account.userGetId(), + customer_id = account.myUser_getId(), date_send = vLandingDate, delivery_method_id = vDeliveryMethodId, agency_id = vAgencyMode, @@ -15457,7 +12423,7 @@ BEGIN company_id = vCompany; SET vSelf = LAST_INSERT_ID(); - + CALL order_checkConfig(vSelf); COMMIT; @@ -15640,7 +12606,7 @@ BEGIN SELECT t.id ticketFk FROM myTicket t WHERE shipped BETWEEN TIMESTAMP(vFrom) AND TIMESTAMP(vTo, '23:59:59'); - + CALL vn.ticketGetTotal; SELECT v.id, IFNULL(v.landed, v.shipped) landed, @@ -15681,7 +12647,7 @@ BEGIN */ INSERT INTO vn.ticketLog (originFk, userFk, `action`, description) - SELECT vSelf, account.userGetId(), 'select', 'Accede a ticket' + SELECT vSelf, account.myUser_getId(), 'select', 'Accede a ticket' FROM myTicket t WHERE t.id = vSelf; END ;; @@ -15700,23 +12666,26 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `myTpvTransaction_end`(vSelf INT, vStatus VARCHAR(12)) +CREATE DEFINER=`root`@`localhost` PROCEDURE `myTpvTransaction_end`( + vSelf INT, + vStatus VARCHAR(12)) BEGIN /** - * Finaliza una transaccción estableciendo su estado a 'ok' o - * 'ko' en función de si esta se ha realizado correctamente. - * Este procedimiento debe ser llamado directamente por el cliente - * nada mas finalizar la transacción y solo tiene validez hasta que - * llega la notificacion definitiva desde el banco. + * See tpvTransaction_start() for more info. * - * @param vSelf El identificador de la transacción - * @param vStatus El estado, 'ok' o 'ko' + * @param vSelf Transaction indentifier + * @param vStatus The status, 'ok' o 'ko' */ - IF vStatus IN ('ok', 'ko') - THEN - UPDATE myTpvTransaction SET status = vStatus - WHERE id = vSelf AND response IS NULL; + DECLARE vIsOwned BOOL; + + SELECT COUNT(*) > 0 INTO vIsOwned + FROM myTpvTransaction WHERE id = vSelf; + + IF NOT vIsOwned THEN + CALL util.throw('transactionNotOwnedByUser'); END IF; + + CALL tpvTransaction_end(vSelf, vStatus); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -15733,77 +12702,17 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `myTpvTransaction_start`(vAmount INT, vCompany INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `myTpvTransaction_start`( + vAmount INT, + vCompany INT) BEGIN /** - * Inicia una nueva transacción con el TPV virtual, generando - * un identificador de transacción y devolviendo con un SELECT - * los parámetros que deben enviarse a la URL del servicio web - * del banco. + * See tpvTransaction_start() for more info. * - * @param vAmount Cantidad a pagar en céntimos - * @param vCompany El identificador de la empresa - * - * @select Los parámetros que deben pasarse al banco + * @param vAmount Amount to pay in cents + * @param vCompany The company identifier */ - DECLARE vSelf CHAR(12); - DECLARE vMerchant INT; - DECLARE vUrl VARCHAR(255); - DECLARE vKey VARCHAR(50); - DECLARE vEnvironment VARCHAR(255); - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - START TRANSACTION; - - IF vCompany IS NULL - THEN - SELECT companyFk INTO vCompany - FROM tpvMerchantEnable LIMIT 1; - END IF; - - SELECT merchantFk INTO vMerchant - FROM tpvMerchantEnable WHERE companyFk = vCompany; - - SELECT environment INTO vEnvironment - FROM util.config; - - IF vEnvironment = 'production' - THEN - SELECT c.url, m.secretKey INTO vUrl, vKey - FROM tpvMerchant m - JOIN tpvConfig c - WHERE m.id = vMerchant; - ELSE - SELECT testUrl, testKey INTO vUrl, vKey - FROM tpvConfig; - END IF; - - INSERT INTO myTpvTransaction - SET - merchantFk = vMerchant - ,clientFk = account.userGetId() - ,amount = vAmount; - - SET vSelf = LAST_INSERT_ID(); - - SELECT - vAmount amount - ,vSelf transactionId - ,vMerchant merchant - ,currency - ,transactionType - ,terminal - ,merchantUrl - ,vUrl url - ,vKey secretKey - FROM tpvConfig; - - COMMIT; + CALL tpvTransaction_start(vAmount, vCompany, account.myUser_getId()); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -15883,7 +12792,7 @@ BEGIN IF vDone THEN LEAVE l; END IF; - + SET vAdd = vAmount - MOD(vAmount, vGrouping); SET vAmount = vAmount - vAdd; @@ -15899,7 +12808,7 @@ BEGIN rate = vRate, amount = vAdd, price = vPrice; - + SET vRow = LAST_INSERT_ID(); INSERT INTO orderRowComponent (rowFk, componentFk, price) @@ -15917,7 +12826,7 @@ BEGIN IF vAmount > 0 THEN CALL util.throw ('AMOUNT_NOT_MATCH_GROUPING'); END IF; - + COMMIT; CALL vn.ticketCalculatePurge; END ;; @@ -15960,10 +12869,10 @@ BEGIN CREATE TEMPORARY TABLE tmp.item (PRIMARY KEY (itemFk)) ENGINE = MEMORY - SELECT itemFk FROM orderRow + SELECT itemFk FROM orderRow WHERE orderFk = vSelf GROUP BY itemFk; - + CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode); DROP TEMPORARY TABLE tmp.item; @@ -16048,10 +12957,13 @@ BEGIN CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode); - IF account.myUserGetName() = 'visitor' - THEN - DROP TEMPORARY TABLE tmp.ticketComponent; - UPDATE tmp.ticketCalculateItem SET price = NULL; + IF account.myUser_getName() = 'visitor' THEN + UPDATE tmp.ticketCalculateItem + SET price = NULL; + UPDATE tmp.ticketComponent + SET cost = 0; + UPDATE tmp.ticketComponentPrice + SET price = 0, priceKg = NULL; END IF; END ;; DELIMITER ; @@ -16080,7 +12992,9 @@ BEGIN DECLARE vLanded DATE; DECLARE vAgencyMode INT; DECLARE vAddress INT; - DECLARE vIsAvailable BOOL; + DECLARE vIsAvailable BOOL; + DECLARE vIsActive BOOL; + DECLARE vClientFk INT; -- Obtiene los datos del pedido @@ -16092,25 +13006,37 @@ BEGIN -- Comprueba que se ha seleccionado una dirección - IF vDeliveryMethod IN ('AGENCY', 'DELIVERY') - AND vAddress IS NULL - THEN + IF vDeliveryMethod IN ('AGENCY', 'DELIVERY') AND vAddress IS NULL THEN CALL util.throw ('ORDER_EMPTY_ADDRESS'); END IF; + -- Comprueba que el cliente esté activo + + SELECT customer_id INTO vClientFk + FROM hedera.`order` + WHERE id = vSelf; + + SELECT isActive INTO vIsActive + FROM vn.client + WHERE id = vClientFk; + + IF NOT vIsActive THEN + CALL util.throw ('CLIENT_NOT_ACTIVE'); + END IF; + -- Comprueba que la agencia es correcta CALL vn.zone_getAgency(vAddress, vLanded); - - SELECT COUNT(*) > 0 INTO vIsAvailable + + SELECT COUNT(*) > 0 INTO vIsAvailable FROM tmp.zoneGetAgency - WHERE agencyModeFk = vAgencyMode; + WHERE agencyModeFk = vAgencyMode; IF NOT vIsAvailable THEN CALL util.throw ('ORDER_INVALID_AGENCY'); END IF; - - DROP TEMPORARY TABLE tmp.zoneGetAgency; + + DROP TEMPORARY TABLE tmp.zoneGetAgency; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -16135,7 +13061,7 @@ BEGIN * * @param vSelf The order identifier */ - DECLARE vUser INT DEFAULT account.userGetId(); + DECLARE vUser INT DEFAULT account.myUser_getId(); CALL order_confirmWithUser(vSelf, vUser); END ;; DELIMITER ; @@ -16155,7 +13081,6 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_confirmWithUser`(IN `vOrder` INT, IN `vUserId` INT) BEGIN - /** * Confirms an order, creating each of its tickets on the corresponding * date, store and user. @@ -16183,8 +13108,12 @@ BEGIN DECLARE vCompanyId INT; DECLARE vAgencyModeId INT; DECLARE TICKET_FREE INT DEFAULT 2; - DECLARE vIsFloramondoWarehouse BOOL; DECLARE vCalc INT; + DECLARE vIsLogifloraItem BOOL; + DECLARE vOldQuantity INT; + DECLARE vNewQuantity INT; + DECLARE vOldInstance JSON; + DECLARE vNewInstance JSON; DECLARE cDates CURSOR FOR SELECT zgs.shipped, r.warehouse_id @@ -16194,8 +13123,8 @@ BEGIN WHERE o.id = vOrder AND r.amount != 0 GROUP BY r.warehouse_id; - DECLARE cRows CURSOR FOR - SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate + DECLARE cRows CURSOR FOR + SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate, i.isFloramondo FROM order_row r JOIN vn.item i ON i.id = r.item_id WHERE r.amount != 0 @@ -16214,14 +13143,33 @@ BEGIN -- Carga los datos del pedido SELECT o.date_send, o.address_id, o.note, - a.clientFk, o.company_id, o.agency_id - INTO vDelivery, vAddress, vNotes, - vClientId, vCompanyId, vAgencyModeId + a.clientFk, o.company_id, o.agency_id + INTO vDelivery, vAddress, vNotes, + vClientId, vCompanyId, vAgencyModeId FROM hedera.`order` o JOIN vn.address a ON a.id = o.address_id WHERE o.id = vOrder; - - -- Comprueba que el pedido no est? vac?o + + -- Carga las fechas de salida de cada almac?n + CALL vn.zone_getShipped (vDelivery, vAddress, vAgencyModeId, FALSE); + + -- Trabajador que realiza la accion + IF vUserId IS NULL THEN + SELECT employeeFk INTO vUserId FROM orderConfig; + END IF; + + START TRANSACTION; + -- Comprueba que el pedido no esta confirmado + SELECT o.confirmed INTO vIsConfirmed + FROM hedera.`order` o + WHERE o.id = vOrder + FOR UPDATE; + + IF vIsConfirmed THEN + CALL util.throw ('ORDER_ALREADY_CONFIRMED'); + END IF; + + -- Comprueba que el pedido no esta vacio SELECT COUNT(*) > 0 INTO vOk FROM order_row WHERE order_id = vOrder AND amount > 0; @@ -16229,18 +13177,7 @@ BEGIN CALL util.throw ('ORDER_EMPTY'); END IF; - -- Carga las fechas de salida de cada almac?n - CALL vn.zone_getShipped (vDelivery, vAddress, vAgencyModeId, FALSE); - - -- Trabajador que realiza la acci?n - IF vUserId IS NULL THEN - SELECT employeeFk INTO vUserId FROM orderConfig; - END IF; - -- Crea los tickets del pedido - - START TRANSACTION; - OPEN cDates; lDates: @@ -16248,7 +13185,7 @@ BEGIN SET vTicket = NULL; SET vDone = FALSE; FETCH cDates INTO vShipment, vWarehouse; - + IF vDone THEN LEAVE lDates; END IF; @@ -16262,20 +13199,20 @@ BEGIN ON o.address_id = t.addressFk AND vWarehouse = t.warehouseFk -- AND o.agency_id = t.agencyModeFk - AND o.date_send = t.landed + AND o.date_send = t.landed AND vShipment = DATE(t.shipped) WHERE o.id = vOrder - AND t.invoiceOutFk IS NULL + AND t.refFk IS NULL AND IFNULL(tls.alertLevel,0) = 0 LIMIT 1; - + -- Crea el ticket en el caso de no existir uno adecuado IF vTicket IS NULL THEN - + SET vShipment = IFNULL(vShipment, util.VN_CURDATE()); - + CALL vn.ticket_add( vClientId, vShipment, @@ -16290,54 +13227,73 @@ BEGIN vTicket ); ELSE - INSERT INTO vncontrol.inter - SET Id_Ticket = vTicket, - Id_Trabajador = vUserId, - state_id = TICKET_FREE; + INSERT INTO vn.ticketTracking + SET ticketFk = vTicket, + workerFk = vUserId, + stateFk = TICKET_FREE; END IF; - + INSERT IGNORE INTO vn.orderTicket SET orderFk = vOrder, ticketFk = vTicket; - -- A?ade las notas + -- Añade las notas IF vNotes IS NOT NULL AND vNotes != '' THEN INSERT INTO vn.ticketObservation SET ticketFk = vTicket, - observationTypeFk = 4 /* salesperson */ , + observationTypeFk = 4 /* salesperson */, `description` = vNotes ON DUPLICATE KEY UPDATE `description` = CONCAT(VALUES(`description`),'. ', `description`); END IF; - -- A?ade los movimientos y sus componentes + -- Añade los movimientos y sus componentes OPEN cRows; lRows: LOOP + SET vDone = FALSE; - FETCH cRows INTO vRowId, vItem, vConcept, vAmount, vPrice, vRate; + + FETCH cRows INTO vRowId, vItem, vConcept, vAmount, vPrice, vRate, vIsLogifloraItem; IF vDone THEN LEAVE lRows; END IF; + SET vSale = NULL; - SELECT s.id INTO vSale + + SELECT s.id, s.quantity INTO vSale, vOldQuantity FROM vn.sale s WHERE ticketFk = vTicket AND price = vPrice AND itemFk = vItem - AND discount = 0 + AND discount = 0 LIMIT 1; + IF vSale THEN UPDATE vn.sale SET quantity = quantity + vAmount WHERE id = vSale; + + SELECT s.quantity INTO vNewQuantity + FROM vn.sale s + WHERE id = vSale; + + SET vOldInstance = JSON_OBJECT( + 'quantity', vOldQuantity + ); + SET vNewInstance = JSON_OBJECT( + 'quantity', vNewQuantity + ); + + CALL `util`.`log_addWithUser`('vn', 'ticket', + 'Sale', vTicket, vSale, 'update', vOldInstance, vNewInstance, vUserId); ELSE - INSERT INTO vn.sale + INSERT INTO vn.sale SET itemFk = vItem, ticketFk = vTicket, @@ -16349,6 +13305,18 @@ BEGIN SET vSale = LAST_INSERT_ID(); + SET vNewInstance = JSON_OBJECT( + 'itemFk', vItem, + 'ticketFk', vTicket, + 'concept', vConcept, + 'quantity', vAmount, + 'price', vPrice, + 'priceFixed', FALSE, + 'isPriceFixed', TRUE + ); + CALL `util`.`log_addWithUser`('vn', 'ticket', + 'Sale', vTicket, vSale, 'insert', NULL, vNewInstance, vUserId); + INSERT INTO vn.saleComponent (saleFk, componentFk, `value`) SELECT vSale, cm.component_id, cm.price @@ -16357,37 +13325,37 @@ BEGIN WHERE cm.order_row_id = vRowId GROUP BY vSale, cm.component_id; END IF; - UPDATE order_row SET Id_Movimiento = vSale + UPDATE order_row SET Id_Movimiento = vSale WHERE id = vRowId; - - -- Inserta en putOrder si la compra es de Floramondo - IF vn.isLogifloraDay(vShipment, vWarehouse) THEN - + + -- Inserta en putOrder si la compra es de Floramondo + IF vIsLogifloraItem THEN + CALL cache.availableNoRaids_refresh(vCalc,FALSE,vWarehouse,vShipment); - + SET @available := 0; - + SELECT GREATEST(0,available) INTO @available FROM cache.availableNoRaids WHERE calc_id = vCalc AND item_id = vItem; - - UPDATE cache.availableNoRaids + + UPDATE cache.availableNoRaids SET available = GREATEST(0,available - vAmount) WHERE item_id = vItem AND calc_id = vCalc; - - INSERT INTO edi.putOrder (deliveryInformationID, - supplyResponseId, - quantity , - EndUserPartyId, + + INSERT INTO edi.putOrder (deliveryInformationID, + supplyResponseId, + quantity , + EndUserPartyId, EndUserPartyGLN, FHAdminNumber, saleFk) - SELECT di.ID, - i.supplyResponseFk, - CEIL((vAmount - @available)/ sr.NumberOfItemsPerCask ), - o.address_id , + SELECT di.ID, + i.supplyResponseFk, + CEIL((vAmount - @available)/ sr.NumberOfItemsPerCask), + o.address_id , vClientId, IFNULL(ca.fhAdminNumber, fhc.defaultAdminNumber), vSale @@ -16397,16 +13365,16 @@ BEGIN LEFT JOIN edi.clientFHAdminNumber ca ON ca.clientFk = vClientId JOIN edi.floraHollandConfig fhc JOIN hedera.`order` o ON o.id = vOrder - WHERE i.id = vItem + WHERE i.id = vItem AND di.LatestOrderDateTime > util.VN_NOW() AND vAmount > @available LIMIT 1; - + END IF; - + END LOOP; - - CLOSE cRows; + + CLOSE cRows; -- Fija el coste DROP TEMPORARY TABLE IF EXISTS tComponents; @@ -16431,19 +13399,8 @@ BEGIN CLOSE cDates; DELETE FROM basketOrder WHERE orderFk = vOrder; - - SELECT o.confirmed INTO vIsConfirmed - FROM hedera.`order` o - JOIN vn.address a ON a.id = o.address_id - WHERE o.id = vOrder; - -- Comprueba que el pedido no est? confirmado - - IF vIsConfirmed THEN - CALL util.throw ('ORDER_ALREADY_CONFIRMED'); - END IF; - - UPDATE `order` SET confirmed = TRUE, confirm_date = util.VN_NOW() + UPDATE `order` SET confirmed = TRUE, confirm_date = util.VN_NOW() WHERE id = vOrder; COMMIT; @@ -16472,24 +13429,27 @@ proc: BEGIN DECLARE vOrderFk INT; DECLARE cCur CURSOR FOR - SELECT orderFk FROM orderRecalc; + SELECT DISTINCT orderFk FROM tOrder; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION - BEGIN + BEGIN DO RELEASE_LOCK('hedera.order_doRecalc'); - # Agregado por Ernesto 9.Agosto.2020, quiero comprobar cuantos rollbacks suceden. - CALL util.debugAdd('Event Hedera order_doRecalc() (ernesto)', 'Rollback! '); # max 255 chars en variable y 255 en value, ya hay campo de fecha ROLLBACK; - RESIGNAL; + RESIGNAL; END; IF !GET_LOCK('hedera.order_doRecalc', 0) THEN LEAVE proc; END IF; + DROP TEMPORARY TABLE IF EXISTS tOrder; + CREATE TEMPORARY TABLE tOrder + ENGINE = MEMORY + SELECT id, orderFk FROM orderRecalc; + OPEN cCur; myLoop: LOOP @@ -16500,14 +13460,15 @@ proc: BEGIN LEAVE myLoop; END IF; - START TRANSACTION; - CALL order_recalc(vOrderFk); - COMMIT; - - DELETE FROM orderRecalc WHERE orderFk = vOrderFk; + CALL order_recalc(vOrderFk); END LOOP; CLOSE cCur; + + DELETE o FROM orderRecalc o JOIN tOrder t ON t.id = o.id; + + DROP TEMPORARY TABLE tOrder; + DO RELEASE_LOCK('hedera.order_doRecalc'); END ;; DELIMITER ; @@ -16541,7 +13502,7 @@ BEGIN INTO vDelivery, vAddress, vAgencyMode FROM `order` WHERE id = vSelf; - + CALL vn.available_calc(vDelivery, vAddress, vAgencyMode); DROP TEMPORARY TABLE IF EXISTS tmp.itemAvailable; @@ -16583,7 +13544,7 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; CREATE TEMPORARY TABLE tmp.addressCompany (INDEX (addressFk, companyFk)) - ENGINE = MEMORY + ENGINE = MEMORY SELECT DISTINCT o.address_id addressFk, o.company_id companyFk FROM tmp.`order` tmpOrder JOIN hedera.`order` o ON o.id = tmpOrder.orderFk; @@ -16618,7 +13579,7 @@ BEGIN JOIN vn.taxClass tc ON tc.id = bp.taxClassFk GROUP BY tmpOrder.orderFk, pgc.`code`, pgc.rate HAVING taxableBase != 0; - + DROP TEMPORARY TABLE IF EXISTS tmp.orderAmount; CREATE TEMPORARY TABLE tmp.orderAmount (INDEX (orderFk)) @@ -16627,7 +13588,7 @@ BEGIN SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax FROM tmp.orderTax GROUP BY orderFk, `code`; - + DROP TEMPORARY TABLE tmp.addressTaxArea; END ;; DELIMITER ; @@ -16697,7 +13658,7 @@ BEGIN CREATE TEMPORARY TABLE tmp.`order` ENGINE = MEMORY SELECT vSelf orderFk; - + CALL order_getTax; SELECT IFNULL(SUM(taxableBase), 0.0), IFNULL(SUM(tax), 0.0) @@ -16740,7 +13701,7 @@ proc: BEGIN LEAVE proc; END IF; - INSERT IGNORE INTO orderRecalc SET orderFk = vSelf; + INSERT INTO orderRecalc SET orderFk = vSelf; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -16788,7 +13749,7 @@ proc: BEGIN FROM orderRow r JOIN orderRowComponent c ON c.rowFk = r.id WHERE r.orderFk = vSelf; - + UPDATE orderRow r LEFT JOIN tmp.ticketComponentPrice p ON p.warehouseFk = r.warehouseFk @@ -16813,7 +13774,7 @@ proc: BEGIN ON t.id = c.componentFk AND (t.classRate IS NULL OR t.classRate = r.rate) WHERE r.orderFk = vSelf; - + CALL vn.ticketCalculatePurge; END IF; @@ -16849,7 +13810,7 @@ BEGIN INSERT INTO surveyVote SET surveyFk = vSurvey, - userFk = account.userGetId(); + userFk = account.myUser_getId(); UPDATE surveyAnswer SET votes = votes + 1 WHERE id = vAnswer; @@ -17077,6 +14038,124 @@ 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 `tpvTransaction_end` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_end`( + vSelf INT, + vStatus VARCHAR(12)) +BEGIN +/** + * Ends a transaction by setting its status to 'ok' or 'ko' depending on + * if this has been done correctly. + * This procedure must be called directly by the client when the transaction + * ends, it is only valid until the arrival of the definitive notification from + * the payment platform. + * + * @param vSelf Transaction indentifier + * @param vStatus The status, 'ok' o 'ko' + */ + IF vStatus IN ('ok', 'ko') THEN + UPDATE tpvTransaction SET `status` = vStatus + WHERE id = vSelf AND response IS 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 `tpvTransaction_start` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_start`( + vAmount INT, + vCompany INT, + vUser INT) +BEGIN +/** + * Start a new transaction with the virtual TPV, generating an identifier + * of transaction and returning the parameters that should be sent to the + * payment platform. + * + * @param vAmount Amount to pay in cents + * @param vCompany The company identifier + * @select Parameters that will be sent to payment platform + */ + DECLARE vSelf CHAR(12); + DECLARE vMerchant INT; + DECLARE vUrl VARCHAR(255); + DECLARE vKey VARCHAR(50); + DECLARE vEnvironment VARCHAR(255); + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + + IF vCompany IS NULL THEN + SELECT companyFk INTO vCompany + FROM tpvMerchantEnable LIMIT 1; + END IF; + + SELECT merchantFk INTO vMerchant + FROM tpvMerchantEnable WHERE companyFk = vCompany; + + SELECT environment INTO vEnvironment + FROM util.config; + + IF vEnvironment = 'production' THEN + SELECT c.url, m.secretKey INTO vUrl, vKey + FROM tpvMerchant m + JOIN tpvConfig c + WHERE m.id = vMerchant; + ELSE + SELECT testUrl, testKey INTO vUrl, vKey + FROM tpvConfig; + END IF; + + INSERT INTO tpvTransaction + SET merchantFk = vMerchant, + clientFk = vUser, + amount = vAmount; + + SET vSelf = LAST_INSERT_ID(); + + SELECT vAmount amount, + vSelf transactionId, + vMerchant merchant, + currency, + transactionType, + terminal, + merchantUrl, + vUrl url, + vKey secretKey + FROM tpvConfig; + + 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 `tpvTransaction_undo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -17157,13 +14236,13 @@ p: BEGIN AND DATE(FECHA) = vDate AND EURODEBE = vAmount LIMIT 1; - + -- Actualiza la transaccion UPDATE tpvTransaction SET response = NULL, status = 'started' WHERE id = vSelf; - + COMMIT; END ;; DELIMITER ; @@ -17190,13 +14269,13 @@ BEGIN INSERT INTO visitUser SET accessFk = vAccess, - userFk = account.userGetId(); + userFk = account.myUser_getId(); SET vUserVisit = LAST_INSERT_ID(); UPDATE userSession SET userVisitFk = vUserVisit WHERE ssid = vSsid; - + DELETE FROM userSession WHERE lastUpdate < TIMESTAMPADD(HOUR, -1, util.VN_NOW()); END ;; @@ -17320,7 +14399,7 @@ BEGIN UPDATE visitAgent SET firstAccessFk = vAccessId WHERE id = vAgentId; END IF; - + -- Returns the visit info SELECT vVisit visit, vAccessId access; @@ -17331,421 +14410,11 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; --- --- Current Database: `nst` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `nst` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; - -USE `nst`; - --- --- Table structure for table `balance` --- - -DROP TABLE IF EXISTS `balance`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `balance` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `lft` int(11) NOT NULL, - `rgt` int(11) NOT NULL, - `name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `lft_UNIQUE` (`lft`), - UNIQUE KEY `rgt_UNIQUE` (`rgt`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `geo` --- - -DROP TABLE IF EXISTS `geo`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `geo` ( - `id` int(11) NOT NULL, - `lft` int(11) DEFAULT NULL, - `rgt` int(11) DEFAULT NULL, - `depth` int(11) DEFAULT NULL, - `sons` int(11) DEFAULT NULL, - `item` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `lft_UNIQUE` (`lft`), - UNIQUE KEY `rgt_UNIQUE` (`rgt`), - CONSTRAINT `nst_geo_id` FOREIGN KEY (`id`) REFERENCES `nst` (`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 `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 AUTO_INCREMENT, - `lft` int(11) NOT NULL, - `rgt` int(11) NOT NULL, - `depth` int(11) NOT NULL DEFAULT 0, - `sons` int(11) NOT NULL DEFAULT 0, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `nst` --- - -DROP TABLE IF EXISTS `nst`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `nst` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `lft` int(11) NOT NULL, - `rgt` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `lft_UNIQUE` (`lft`), - UNIQUE KEY `rgt_UNIQUE` (`rgt`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping events for database 'nst' --- - --- --- Dumping routines for database 'nst' --- -/*!50003 DROP PROCEDURE IF EXISTS `nodeAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `nodeAdd`(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 - )); - - CALL util.exec(CONCAT( - 'SELECT COUNT(c.id) INTO @childs', - ' FROM ', vScheme, '.', vTable, ' p', - ' LEFT JOIN tmp.', vTableClone, ' c ON c.depth = p.depth + 1', - ' AND c.lft BETWEEN p.lft AND p.rgt AND c.id != ', vParentFk, - ' WHERE p.id = ', vParentFk - )); - - IF @childs = 0 THEN - CALL util.exec(CONCAT( - 'SELECT lft, depth INTO @vLeft, @vDepth', - ' FROM ', vScheme, '.', vTable, - ' WHERE id = ', vParentFk - )); - ELSE - CALL util.exec(CONCAT( - 'SELECT c.rgt, p.depth INTO @vLeft, @vDepth', - ' FROM ', vScheme, '.', vTable, ' p', - ' JOIN tmp.', vTableClone, ' c ON c.depth = p.depth + 1' - ' AND c.lft BETWEEN p.lft AND p.rgt', - ' WHERE p.id = ', vParentFk, - ' ORDER BY c.lft', - ' DESC LIMIT 1' - )); - END IF; - - CALL util.exec(CONCAT( - 'UPDATE ', vScheme, '.', vTable, ' SET rgt = rgt + 2', - ' WHERE rgt > @vLeft', - ' ORDER BY rgt DESC' - )); - CALL util.exec(CONCAT( - 'UPDATE ', vScheme, '.', vTable, ' SET lft = lft + 2', - ' WHERE lft > @vLeft', - ' ORDER BY lft DESC' - )); - - SET vChild = REPLACE(vChild, "'", "\\'"); - - CALL util.exec(CONCAT( - 'INSERT INTO ', vScheme, '.', vTable, ' (name, lft, rgt, depth)', - ' VALUES ("', vChild, '", @vLeft + 1, @vLeft + 2, @vDepth + 1)' - )); - - 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 `nodeDelete` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `nodeDelete`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45), IN `vNodeId` INT) -BEGIN - DECLARE vMyRight INT; - DECLARE vMyLeft INT; - DECLARE vMyWidth INT; - - CALL util.exec(CONCAT( - 'SELECT t.rgt, t.lft, t.rgt - t.lft + 1', - ' INTO @vMyRight, @vMyLeft, @vMyWidth', - ' FROM ', vScheme, '.', vTable, ' t', - ' WHERE t.id = ', vNodeId - )); - - CALL util.exec(CONCAT( - 'DELETE FROM ', vScheme, '.', vTable, - ' WHERE lft BETWEEN @vMyLeft AND @vMyRight' - )); - - CALL util.exec(CONCAT( - 'UPDATE ', vScheme, '.', vTable, ' SET rgt = rgt - @vMyWidth' - ' WHERE rgt > @vMyRight ORDER BY rgt' - )); - - CALL util.exec(CONCAT( - 'UPDATE ', vScheme, '.', vTable, ' SET lft = lft - @vMyWidth' - ' WHERE lft > @vMyRight ORDER BY 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 `nodeMove` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `nodeMove`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45), IN `vNodeId` INT, IN `vFatherId` INT) -BEGIN - -- Averiguamos el ancho de la rama - CALL util.exec (sql_printf ( - 'SELECT t.rgt - t.lft +1 INTO @vMyWidth FROM %t.%t t WHERE t.id = %v' - ,vScheme - ,vTable - ,vNodeId - )); - - -- Averiguamos la posicion del nuevo padre - - CALL util.exec (sql_printf ( - 'SELECT t.rgt, t.lft INTO @vFatherRight , @vFatherLeft FROM %t.%t t WHERE t.id = %v' - ,vScheme - ,vTable - ,vFatherId - )); - - -- 1º Incrementamos los valores de todos los nodos a la derecha del punto de inserción (vFatherRight) , para hacer sitio - - CALL util.exec (sql_printf ( - 'UPDATE %t.%t SET rgt = rgt + @vMyWidth WHERE rgt >= @vFatherRight ORDER BY rgt DESC' - ,vScheme - ,vTable - )); - - CALL util.exec (sql_printf ( - 'UPDATE %t.%t SET lft = lft + @vMyWidth WHERE lft >= @vFatherRight ORDER BY lft DESC' - ,vScheme - ,vTable - )); - - -- Es preciso recalcular los valores del nodo en el caso de que estuviera a la derecha del nuevo padre - - CALL util.exec (sql_printf ( - 'SELECT t.rgt, t.lft, @vFatherRight - t.lft INTO @vMyRight, @vMyLeft, @vGap FROM %t.%t t WHERE t.id = %v' - ,vScheme - ,vTable - ,vNodeId - )); - -- 2º Incrementamos el valor de todos los nodos a trasladar hasta alcanzar su nueva posicion - - CALL util.exec (sql_printf ( - 'UPDATE %t.%t SET lft = lft + @vGap WHERE lft BETWEEN @vMyLeft AND @vMyRight ORDER BY lft DESC' - ,vScheme - ,vTable - )); - CALL util.exec (sql_printf ( - 'UPDATE %t.%t SET rgt = rgt + @vGap WHERE rgt BETWEEN @vMyLeft AND @vMyRight ORDER BY rgt DESC' - ,vScheme - ,vTable - )); - - -- 3º Restaremos a todos los nodos resultantes, a la derecha de la posicion arrancada el ancho de la rama escindida - - CALL util.exec (sql_printf ( - 'UPDATE %t.%t SET lft = lft - @vMyWidth WHERE lft > @vMyLeft ORDER BY lft' - ,vScheme - ,vTable - )); - CALL util.exec (sql_printf ( - 'UPDATE %t.%t SET rgt = rgt - @vMyWidth WHERE rgt > @vMyRight ORDER BY rgt' - ,vScheme - ,vTable - )); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `nodeRecalc` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `nodeRecalc`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45)) -BEGIN - CALL util.exec(CONCAT ( - 'UPDATE ', vScheme, '.', vTable, ' d', - ' JOIN (SELECT', - ' node.id,', - ' COUNT(parent.id) - 1 as depth,', - ' cast((node.rgt - node.lft - 1) / 2 as DECIMAL) as sons', - ' FROM ', - ' ', vScheme, '.', vTable, ' AS node,', - ' ', vScheme, '.', vTable, ' AS parent', - ' WHERE node.lft BETWEEN parent.lft AND parent.rgt', - ' GROUP BY node.id', - ' ORDER BY node.lft) n ON n.id = d.id ', - ' SET d.`depth` = n.depth, d.sons = n.sons' - )); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `nodeTree` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `nodeTree`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45), IN `vGap` INT, IN `vShouldShow` BOOLEAN) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.nest; - CALL util.exec (sql_printf ( - 'CREATE TEMPORARY TABLE tmp.nest - SELECT node.id - ,CONCAT( REPEAT(REPEAT(" ",%v), COUNT(parent.id) - 1), node.name) AS name - ,node.lft - ,node.rgt - ,COUNT(parent.id) - 1 as depth - ,cast((node.rgt - node.lft - 1) / 2 as DECIMAL) as sons - FROM %t.%t AS node, - %t.%t AS parent - WHERE node.lft BETWEEN parent.lft AND parent.rgt - GROUP BY node.id - ORDER BY node.lft' - ,vGap - ,vScheme - ,vTable - ,vScheme - ,vTable - )); - - IF vShouldShow THEN - SELECT * FROM tmp.nest; - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `nodeTree_pako` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `nodeTree_pako`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45), IN `vGap` INT, IN `vShouldShow` BOOLEAN) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.nest; - CALL util.exec (sql_printf ( - 'CREATE TEMPORARY TABLE tmp.nest - SELECT node.id - ,CONCAT( REPEAT(REPEAT(" ",%v), COUNT(parent.id) - 1), node.name) AS name - ,node.lft - ,node.rgt - ,COUNT(parent.id) - 1 as depth - ,cast((node.rgt - node.lft - 1) / 2 as DECIMAL) as sons - ,node.isSelected - FROM %t.%t AS node, - %t.%t AS parent - WHERE node.lft BETWEEN parent.lft AND parent.rgt - GROUP BY node.id - ORDER BY node.lft' - ,vGap - ,vScheme - ,vTable - ,vScheme - ,vTable - )); - - IF vShouldShow THEN - SELECT * FROM tmp.nest; - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - -- -- Current Database: `pbx` -- -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `pbx` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `pbx` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci */; USE `pbx`; @@ -17757,9 +14426,9 @@ DROP TABLE IF EXISTS `blacklist`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `blacklist` ( - `phone` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `phone` varchar(20) NOT NULL, PRIMARY KEY (`phone`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Hangup input calls from this list'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Hangup input calls from this list'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -17812,21 +14481,21 @@ DROP TABLE IF EXISTS `cdr`; CREATE TABLE `cdr` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `call_date` datetime NOT NULL DEFAULT current_timestamp(), - `clid` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `src` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `dst` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `dcontext` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `channel` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `dst_channel` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `last_app` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `last_data` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `clid` varchar(80) NOT NULL DEFAULT '', + `src` varchar(80) NOT NULL DEFAULT '', + `dst` varchar(80) NOT NULL DEFAULT '', + `dcontext` varchar(80) NOT NULL DEFAULT '', + `channel` varchar(80) NOT NULL DEFAULT '', + `dst_channel` varchar(80) NOT NULL DEFAULT '', + `last_app` varchar(80) NOT NULL DEFAULT '', + `last_data` varchar(80) NOT NULL DEFAULT '', `duration` int(11) NOT NULL DEFAULT 0, `billsec` int(11) NOT NULL DEFAULT 0, - `disposition` varchar(45) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `disposition` varchar(45) NOT NULL DEFAULT '', `ama_flags` int(11) NOT NULL DEFAULT 0, - `account_code` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `unique_id` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `user_field` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `account_code` varchar(20) NOT NULL DEFAULT '', + `unique_id` varchar(32) NOT NULL DEFAULT '', + `user_field` varchar(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `calldate` (`call_date`), KEY `dst` (`dst`), @@ -17834,7 +14503,7 @@ CREATE TABLE `cdr` ( KEY `dstchannel` (`dst_channel`), KEY `disposition` (`disposition`), KEY `src` (`src`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17875,9 +14544,9 @@ DROP TABLE IF EXISTS `config`; CREATE TABLE `config` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `sundayFestive` tinyint(4) NOT NULL, - `countryPrefix` varchar(20) CHARACTER SET utf8 DEFAULT NULL, + `countryPrefix` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17888,11 +14557,11 @@ DROP TABLE IF EXISTS `followme`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `followme` ( - `extension` varchar(128) CHARACTER SET utf8 NOT NULL, - `phone` varchar(20) CHARACTER SET utf8 NOT NULL, + `extension` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `phone` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`extension`), CONSTRAINT `followme_ibfk_1` FOREIGN KEY (`extension`) REFERENCES `sip` (`extension`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -17961,13 +14630,13 @@ DROP TABLE IF EXISTS `followmeConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `followmeConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `music` varchar(50) CHARACTER SET utf8 DEFAULT NULL, - `context` varchar(50) CHARACTER SET utf8 NOT NULL, - `takeCall` char(1) CHARACTER SET utf8 NOT NULL, - `declineCall` char(1) CHARACTER SET utf8 NOT NULL, + `music` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `context` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `takeCall` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `declineCall` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `timeout` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17995,15 +14664,15 @@ DROP TABLE IF EXISTS `queue`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `queue` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(128) CHARACTER SET utf8 NOT NULL, - `name` varchar(128) CHARACTER SET utf8 NOT NULL, + `description` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `name` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `config` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), UNIQUE KEY `description` (`description`), KEY `config` (`config`), CONSTRAINT `queue_ibfk_1` FOREIGN KEY (`config`) REFERENCES `queueConfig` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queues'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Queues'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18074,14 +14743,14 @@ DROP TABLE IF EXISTS `queueConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `queueConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `strategy` varchar(128) CHARACTER SET utf8 NOT NULL, + `strategy` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `timeout` int(10) unsigned NOT NULL, `retry` int(10) unsigned NOT NULL, `weight` int(10) unsigned NOT NULL, `maxLen` int(10) unsigned NOT NULL, `ringInUse` tinyint(4) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default values for queues configuration'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Default values for queues configuration'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18093,14 +14762,14 @@ DROP TABLE IF EXISTS `queueMember`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `queueMember` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `queue` varchar(128) CHARACTER SET utf8 NOT NULL, - `extension` varchar(128) CHARACTER SET utf8 NOT NULL, + `queue` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `extension` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `queue` (`queue`,`extension`), KEY `extension` (`extension`), CONSTRAINT `queueMember_ibfk_1` FOREIGN KEY (`queue`) REFERENCES `queue` (`name`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `queueMember_ibfk_2` FOREIGN KEY (`extension`) REFERENCES `sip` (`extension`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queue members'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Queue members'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18128,12 +14797,12 @@ DROP TABLE IF EXISTS `queuePhone`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `queuePhone` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `queue` varchar(128) CHARACTER SET utf8 NOT NULL, - `phone` varchar(128) CHARACTER SET utf8 NOT NULL, + `queue` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `phone` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `queue` (`queue`,`phone`), CONSTRAINT `queuePhone_ibfk_1` FOREIGN KEY (`queue`) REFERENCES `queue` (`name`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -18188,11 +14857,11 @@ CREATE TABLE `schedule` ( `weekDay` tinyint(3) unsigned NOT NULL COMMENT '0 = Monday, 6 = Sunday', `timeStart` time NOT NULL, `timeEnd` time NOT NULL, - `queue` varchar(128) CHARACTER SET utf8 NOT NULL, + `queue` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`), KEY `queue` (`queue`), CONSTRAINT `schedule_ibfk_1` FOREIGN KEY (`queue`) REFERENCES `queue` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18204,14 +14873,14 @@ DROP TABLE IF EXISTS `sip`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sip` ( `user_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'The user id', - `extension` varchar(128) CHARACTER SET utf8 NOT NULL COMMENT 'The softphone extension', - `md5Secret` varchar(80) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'MD5 hash of extension and password', - `secret` varchar(80) CHARACTER SET utf8 DEFAULT NULL COMMENT 'Deprecated', - `caller_id` varchar(80) CHARACTER SET utf8 DEFAULT NULL COMMENT 'Deprecated', + `extension` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT 'The softphone extension', + `md5Secret` varchar(80) DEFAULT NULL COMMENT 'MD5 hash of extension and password', + `secret` varchar(80) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'Deprecated', + `caller_id` varchar(80) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'Deprecated', PRIMARY KEY (`user_id`), UNIQUE KEY `extension` (`extension`), CONSTRAINT `sip_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='SIP accounts'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='SIP accounts'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -18349,27 +15018,27 @@ DROP TABLE IF EXISTS `sipConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sipConfig` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `host` varchar(40) CHARACTER SET utf8 DEFAULT NULL, - `deny` varchar(95) CHARACTER SET utf8 NOT NULL, - `permit` varchar(95) CHARACTER SET utf8 NOT NULL, - `type` enum('user','peer','friend') CHARACTER SET utf8 NOT NULL, - `context` varchar(80) CHARACTER SET utf8 NOT NULL, - `incomingLimit` varchar(10) CHARACTER SET utf8 NOT NULL, - `pickupGroup` varchar(10) CHARACTER SET utf8 NOT NULL, - `careInvite` varchar(10) CHARACTER SET utf8 NOT NULL, - `insecure` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `transport` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `avpf` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `icesupport` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `encryption` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `dtlsenable` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `dtlverify` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `dtlscertfile` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `dtlsprivatekey` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `dtlssetup` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `nat` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `host` varchar(40) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `deny` varchar(95) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `permit` varchar(95) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `type` enum('user','peer','friend') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `context` varchar(80) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `incomingLimit` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `pickupGroup` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `careInvite` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `insecure` varchar(45) NOT NULL, + `transport` varchar(255) DEFAULT NULL, + `avpf` varchar(255) DEFAULT NULL, + `icesupport` varchar(255) DEFAULT NULL, + `encryption` varchar(255) DEFAULT NULL, + `dtlsenable` varchar(255) DEFAULT NULL, + `dtlverify` varchar(255) DEFAULT NULL, + `dtlscertfile` varchar(255) DEFAULT NULL, + `dtlsprivatekey` varchar(255) DEFAULT NULL, + `dtlssetup` varchar(255) DEFAULT NULL, + `nat` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default values for SIP accounts'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Default values for SIP accounts'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18381,17 +15050,17 @@ DROP TABLE IF EXISTS `sipReg`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sipReg` ( `userId` int(10) unsigned NOT NULL, - `ipAddr` varchar(45) CHARACTER SET utf8 DEFAULT NULL, + `ipAddr` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `regSeconds` bigint(20) unsigned DEFAULT NULL, - `port` varchar(50) CHARACTER SET utf8 DEFAULT NULL, - `defaultUser` varchar(50) CHARACTER SET utf8 DEFAULT NULL, - `userAgent` varchar(80) CHARACTER SET utf8 DEFAULT NULL, - `lastMs` varchar(50) CHARACTER SET utf8 DEFAULT NULL, - `fullContact` varchar(50) CHARACTER SET utf8 DEFAULT NULL, - `regServer` varchar(20) CHARACTER SET utf8 DEFAULT NULL, + `port` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `defaultUser` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `userAgent` varchar(80) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `lastMs` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `fullContact` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `regServer` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, PRIMARY KEY (`userId`), CONSTRAINT `sipReg_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `sip` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='SIP registrations'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='SIP registrations'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18445,7 +15114,7 @@ BEGIN WHILE vI < vLen DO SET vChr = SUBSTR(vPhone, vI + 1, 1); - + IF vChr REGEXP '^[0-9]$' THEN SET vNewPhone = CONCAT(vNewPhone, vChr); @@ -18453,7 +15122,7 @@ BEGIN THEN SET vNewPhone = CONCAT(vNewPhone, '00'); END IF; - + SET vI = vI + 1; END WHILE; @@ -18552,18 +15221,18 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sip_getExtension`(vUserId INT(10)) BEGIN - + /* * Devuelve la extensión pbx del usuario - * - * @param vUserId Id del usuario - * + * + * @param vUserId Id del usuario + * */ SELECT extension - FROM sip s + FROM sip s WHERE s.user_id = vUserId; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -18633,7 +15302,7 @@ DELIMITER ; -- Current Database: `postgresql` -- -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `postgresql` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `postgresql` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci */; USE `postgresql`; @@ -18657,7 +15326,7 @@ CREATE TABLE `address` ( KEY `address_town_id_idx` (`town_id`), CONSTRAINT `address_ibfk_1` FOREIGN KEY (`address_type_id`) REFERENCES `address_type` (`address_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `address_ibfk_2` FOREIGN KEY (`town_id`) REFERENCES `townKk` (`town_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18671,41 +15340,7 @@ CREATE TABLE `address_type` ( `address_type_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL, PRIMARY KEY (`address_type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `bank_account` --- - -DROP TABLE IF EXISTS `bank_account`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `bank_account` ( - `bank_account_id` int(11) NOT NULL AUTO_INCREMENT, - `client_id` int(11) DEFAULT NULL, - `account` char(50) DEFAULT NULL, - `bic` char(20) DEFAULT NULL, - `bank_account_type_id` int(11) DEFAULT NULL, - `nation_id` mediumint(8) unsigned DEFAULT NULL, - `sortcode` char(50) DEFAULT NULL, - `bank_name` char(30) DEFAULT NULL, - `bank_adress` char(125) DEFAULT NULL, - `bank_city` char(50) DEFAULT NULL, - `bank_account_link_id` int(11) DEFAULT NULL, - `workerFk` int(10) unsigned NOT NULL, - PRIMARY KEY (`bank_account_id`), - UNIQUE KEY `workerFk_UNIQUE` (`workerFk`), - KEY `fki_bank_profile` (`client_id`), - KEY `fki_business_account_fk` (`client_id`), - KEY `fki_person_account_fk` (`client_id`), - KEY `bank_account_bank_account_type` (`bank_account_type_id`), - KEY `bank_account_nation_id` (`nation_id`), - CONSTRAINT `bank_account_bank_account_type` FOREIGN KEY (`bank_account_type_id`) REFERENCES `bank_account_type` (`bank_account_type_id`) ON UPDATE CASCADE, - CONSTRAINT `bank_account_client_id` FOREIGN KEY (`client_id`) REFERENCES `profile` (`profile_id`) ON UPDATE CASCADE, - CONSTRAINT `bank_account_nation_id` FOREIGN KEY (`nation_id`) REFERENCES `vn`.`country` (`id`) ON UPDATE CASCADE, - CONSTRAINT `bank_account_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18719,145 +15354,7 @@ CREATE TABLE `bank_account_type` ( `bank_account_type_id` int(11) NOT NULL AUTO_INCREMENT, `name` char(15) DEFAULT NULL, PRIMARY KEY (`bank_account_type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `bank_bic__` --- - -DROP TABLE IF EXISTS `bank_bic__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `bank_bic__` ( - `nrbe` int(11) NOT NULL, - `denominacion` varchar(255) DEFAULT NULL, - `bic` char(11) DEFAULT NULL, - `referenciaFTH` varchar(35) DEFAULT NULL, - `referenciaVNL` varchar(35) DEFAULT NULL, - PRIMARY KEY (`nrbe`), - KEY `bankbic_ikey1` (`bic`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `business` --- - -DROP TABLE IF EXISTS `business`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `business` ( - `business_id` int(11) NOT NULL AUTO_INCREMENT, - `client_id` int(11) DEFAULT NULL, - `provider_id` int(11) DEFAULT NULL, - `date_start` date DEFAULT NULL, - `date_end` date DEFAULT NULL, - `workerBusiness` longtext DEFAULT NULL, - `reasonEndFk` int(11) DEFAULT NULL, - `payedHolidays` int(11) DEFAULT NULL, - `occupationCodeFk` varchar(1) DEFAULT NULL, - PRIMARY KEY (`business_id`), - KEY `business_client` (`client_id`), - KEY `bussiness_provider` (`provider_id`), - KEY `business_occupationCodeFk` (`occupationCodeFk`), - CONSTRAINT `business_client` FOREIGN KEY (`client_id`) REFERENCES `profile` (`profile_id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `business_occupationCodeFk` FOREIGN KEY (`occupationCodeFk`) REFERENCES `vn`.`occupationCode` (`code`) ON UPDATE CASCADE, - CONSTRAINT `bussiness_provider` FOREIGN KEY (`provider_id`) REFERENCES `profile` (`profile_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 `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 */ ; -/*!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 `business_labour` --- - -DROP TABLE IF EXISTS `business_labour`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `business_labour` ( - `business_id` int(11) NOT NULL, - `notes` longtext DEFAULT NULL, - `department_id` int(11) NOT NULL, - `professional_category_id` int(11) DEFAULT 0, - `incentivo` double DEFAULT 0, - `calendar_labour_type_id` int(11) DEFAULT 1, - `porhoras` smallint(6) NOT NULL DEFAULT 0, - `labour_agreement_id` int(11) DEFAULT NULL, - `workcenter_id` int(11) NOT NULL, - PRIMARY KEY (`business_id`), - KEY `fki_business_labour_agreement` (`labour_agreement_id`), - KEY `fki_workcenter_labour` (`workcenter_id`), - KEY `horario_tipo` (`calendar_labour_type_id`), - KEY `business_labour_department_idx` (`department_id`), - CONSTRAINT `bus_restriction` FOREIGN KEY (`business_id`) REFERENCES `business` (`business_id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `business_labour_agreement` FOREIGN KEY (`labour_agreement_id`) REFERENCES `labour_agreement` (`labour_agreement_id`) ON UPDATE CASCADE, - CONSTRAINT `business_labour_department_id` FOREIGN KEY (`department_id`) REFERENCES `vn`.`department` (`id`) ON UPDATE CASCADE, - CONSTRAINT `horario_tipo` FOREIGN KEY (`calendar_labour_type_id`) REFERENCES `calendar_labour_type` (`calendar_labour_type_id`) ON UPDATE CASCADE, - CONSTRAINT `workcenter_labour` FOREIGN KEY (`workcenter_id`) REFERENCES `workcenter` (`workcenter_id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `business_labour_payroll` --- - -DROP TABLE IF EXISTS `business_labour_payroll`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `business_labour_payroll` ( - `business_id` int(11) NOT NULL, - `cod_tarifa` int(11) DEFAULT NULL, - `cod_categoria` int(11) DEFAULT NULL, - `cod_contrato` int(11) DEFAULT NULL, - `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_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_fk1` FOREIGN KEY (`business_id`) REFERENCES `business` (`business_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18870,68 +15367,12 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE TABLE `calendar_employee` ( `id` tinyint NOT NULL, - `business_id` tinyint NOT NULL, + `businessFk` tinyint NOT NULL, `calendar_state_id` tinyint NOT NULL, `date` tinyint NOT NULL ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; --- --- Table structure for table `calendar_free__` --- - -DROP TABLE IF EXISTS `calendar_free__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `calendar_free__` ( - `calendar_free_id` int(11) NOT NULL AUTO_INCREMENT, - `type` varchar(20) NOT NULL, - `rgb` varchar(7) DEFAULT NULL, - PRIMARY KEY (`calendar_free_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `calendar_labour__` --- - -DROP TABLE IF EXISTS `calendar_labour__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `calendar_labour__` ( - `calendar_free_id` int(11) NOT NULL, - `person_id` int(11) NOT NULL, - `day` date NOT NULL, - `calendar_labour_legend_id` int(11) DEFAULT NULL, - `workcenter_id` int(11) NOT NULL, - `calendar_id` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`calendar_id`), - UNIQUE KEY `person_id_UNIQUE` (`person_id`,`day`,`workcenter_id`), - KEY `calendar_labour_calendar_free_id_idx` (`calendar_free_id`), - KEY `fki_calendar_labour_legend_id` (`calendar_labour_legend_id`), - KEY `fki_calendar_labour_person_day` (`person_id`,`day`), - KEY `fki_workcenter_calendar` (`workcenter_id`), - CONSTRAINT `fk_calendar_labour_calendar_free1` FOREIGN KEY (`calendar_free_id`) REFERENCES `calendar_free__` (`calendar_free_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `fk_calendar_labour_legend_id` FOREIGN KEY (`calendar_labour_legend_id`) REFERENCES `calendar_labour_legend__` (`calendar_labour_legend_id`) ON DELETE NO ACTION ON UPDATE CASCADE, - CONSTRAINT `workcenter_calendar` FOREIGN KEY (`workcenter_id`) REFERENCES `workcenter` (`workcenter_id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `calendar_labour_legend__` --- - -DROP TABLE IF EXISTS `calendar_labour_legend__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `calendar_labour_legend__` ( - `calendar_labour_legend_id` int(11) NOT NULL AUTO_INCREMENT, - `descripcion` longtext DEFAULT NULL, - PRIMARY KEY (`calendar_labour_legend_id`), - UNIQUE KEY `calendar_labour_legend_calendar_labour_legend_id_key` (`calendar_labour_legend_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `calendar_labour_type` -- @@ -18947,43 +15388,7 @@ CREATE TABLE `calendar_labour_type` ( `isPartial` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`calendar_labour_type_id`), UNIQUE KEY `hours_labour_hours_labour_id_key` (`calendar_labour_type_id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `calendar_state` --- - -DROP TABLE IF EXISTS `calendar_state`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `calendar_state` ( - `calendar_state_id` int(11) NOT NULL AUTO_INCREMENT, - `type` varchar(30) NOT NULL, - `rgb` varchar(7) NOT NULL, - `color` bigint(20) DEFAULT 0, - `permissionRate` decimal(3,2) DEFAULT NULL, - `code` varchar(45) DEFAULT NULL, - `isAllowedToWork` tinyint(4) NOT NULL DEFAULT 0, - `isPrintable` tinyint(1) NOT NULL DEFAULT 0, - `discountRate` decimal(3,2) DEFAULT NULL, - `holidayEntitlementRate` decimal(3,2) DEFAULT 1.00, - PRIMARY KEY (`calendar_state_id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `currency__` --- - -DROP TABLE IF EXISTS `currency__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `currency__` ( - `currency_id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(15) NOT NULL, - PRIMARY KEY (`currency_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -18995,10 +15400,9 @@ DROP TABLE IF EXISTS `erte_COVID19`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `erte_COVID19` ( `personFk` int(11) NOT NULL, - `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`personFk`), - CONSTRAINT `erte_COVID19_FK` FOREIGN KEY (`personFk`) REFERENCES `vn`.`person` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + `description` varchar(45) DEFAULT NULL, + PRIMARY KEY (`personFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19014,15 +15418,77 @@ CREATE TABLE `income_employee` ( `haber` decimal(10,2) NOT NULL DEFAULT 0.00, `id_incomeType` int(11) DEFAULT NULL, `odbc_date` date DEFAULT NULL, - `person_id` int(11) DEFAULT NULL, + `workerFk` int(11) unsigned NOT NULL, `concepto` longtext DEFAULT NULL, PRIMARY KEY (`id`), - KEY `fperson_id` (`person_id`), KEY `income_employeeId_incomeType_idx` (`id_incomeType`), + KEY `income_employee_workerFk_idx` (`workerFk`), CONSTRAINT `income_employeeId_incomeType` FOREIGN KEY (`id_incomeType`) REFERENCES `vn2008`.`payroll_conceptos` (`conceptoid`) ON UPDATE CASCADE, - CONSTRAINT `income_employee_FK` FOREIGN KEY (`person_id`) REFERENCES `vn`.`person` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; + CONSTRAINT `income_employee_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_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 `postgresql`.`income_employee_afterInsert` + AFTER INSERT ON `income_employee` + FOR EACH ROW +BEGIN + CALL vn.worker_updateBalance(NEW.workerFk,NEW.haber,NEW.debe); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `postgresql`.`income_employee_afterUpdate` + AFTER UPDATE ON `income_employee` + FOR EACH ROW +BEGIN + CALL vn.worker_updateBalance(NEW.workerFk,-OLD.haber,-OLD.debe); + + CALL vn.worker_updateBalance(NEW.workerFk,NEW.haber,NEW.debe); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `postgresql`.`income_employee_afterDelete` + AFTER DELETE ON `income_employee` + FOR EACH ROW +BEGIN + CALL vn.worker_updateBalance(OLD.workerFk,-OLD.haber,-OLD.debe); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `incometype_employee` @@ -19037,7 +15503,7 @@ CREATE TABLE `incometype_employee` ( `nomina` smallint(6) DEFAULT 0, `isExtraSalarial` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`id_incometype`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19055,9 +15521,9 @@ CREATE TABLE `journey` ( `business_id` int(11) NOT NULL, PRIMARY KEY (`journey_id`), UNIQUE KEY `day_id` (`day_id`,`start`,`end`,`business_id`), - KEY `fki_business_journey` (`business_id`), - CONSTRAINT `business_journey` FOREIGN KEY (`business_id`) REFERENCES `business` (`business_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; + KEY `journey_business_id_idx` (`business_id`), + CONSTRAINT `journey_business_id` FOREIGN KEY (`business_id`) REFERENCES `vn`.`business` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19075,7 +15541,7 @@ CREATE TABLE `labour_agreement` ( `date_START` date DEFAULT NULL, `date_END` date DEFAULT NULL, PRIMARY KEY (`labour_agreement_id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19093,7 +15559,7 @@ CREATE TABLE `media` ( PRIMARY KEY (`media_id`), KEY `media_media_type_id_idx` (`media_type_id`), CONSTRAINT `media_ibfk_1` FOREIGN KEY (`media_type_id`) REFERENCES `media_type` (`media_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19108,98 +15574,7 @@ CREATE TABLE `media_type` ( `name` varchar(15) NOT NULL, PRIMARY KEY (`media_type_id`), UNIQUE KEY `media_type_name_key` (`name`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `nation__` --- - -DROP TABLE IF EXISTS `nation__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `nation__` ( - `nation_id` int(11) NOT NULL AUTO_INCREMENT, - `currency_id` int(11) NOT NULL DEFAULT 1, - `name` varchar(20) NOT NULL, - `brief` char(3) NOT NULL, - `flag` longblob DEFAULT NULL, - PRIMARY KEY (`nation_id`), - UNIQUE KEY `nation_name_key` (`name`), - KEY `nation_currency_id_idx` (`currency_id`), - CONSTRAINT `nation___ibfk_1` FOREIGN KEY (`currency_id`) REFERENCES `currency__` (`currency_id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `periodos` --- - -DROP TABLE IF EXISTS `periodos`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `periodos` ( - `fecha` date NOT NULL, - `periodo` int(11) DEFAULT NULL, - PRIMARY KEY (`fecha`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `person` --- - -DROP TABLE IF EXISTS `person`; -/*!50001 DROP VIEW IF EXISTS `person`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `person` ( - `person_id` tinyint NOT NULL, - `name` tinyint NOT NULL, - `nickname` tinyint NOT NULL, - `nif` tinyint NOT NULL, - `birth` tinyint NOT NULL, - `firstname` tinyint NOT NULL, - `p2` tinyint NOT NULL, - `nis` tinyint NOT NULL, - `id_trabajador` tinyint NOT NULL, - `isDisable` tinyint NOT NULL, - `isFreelance` tinyint NOT NULL, - `isSsDiscounted` tinyint NOT NULL, - `sex` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `person__` --- - -DROP TABLE IF EXISTS `person__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `person__` ( - `person_id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(60) NOT NULL, - `nickname` varchar(15) DEFAULT NULL, - `nif` varchar(15) DEFAULT NULL, - `birth` date DEFAULT NULL, - `firstname` varchar(20) DEFAULT NULL, - `p2` longtext DEFAULT NULL, - `nis` int(11) DEFAULT NULL, - `id_trabajador` int(10) unsigned DEFAULT NULL, - `isDisable` smallint(6) NOT NULL DEFAULT 0, - `isFreelance` smallint(6) NOT NULL DEFAULT 0 COMMENT 'M Male\nF Female', - `isSsDiscounted` smallint(6) NOT NULL DEFAULT 0, - `sex` enum('M','F') NOT NULL DEFAULT 'F' COMMENT 'M Masculino F Femenino', - PRIMARY KEY (`person_id`), - UNIQUE KEY `person_nis` (`person_id`), - UNIQUE KEY `Index_unique_nif` (`nif`), - UNIQUE KEY `person_nif_key` (`nif`), - UNIQUE KEY `nis_UNIQUE` (`nis`), - KEY `index1` (`person_id`,`name`,`nickname`,`firstname`), - KEY `person_worker` (`id_trabajador`), - CONSTRAINT `Person_ibfk_1` FOREIGN KEY (`id_trabajador`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19218,7 +15593,7 @@ CREATE TABLE `professional_category` ( `dayBreak` int(11) DEFAULT NULL, PRIMARY KEY (`professional_category_id`), UNIQUE KEY `professional_category_name_category_key` (`category_name`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19233,25 +15608,7 @@ CREATE TABLE `professional_levels` ( `level_name` varchar(5) DEFAULT NULL, `price_overtime` double DEFAULT NULL, PRIMARY KEY (`professional_levels_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!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` ( - `profile_id` int(11) NOT NULL AUTO_INCREMENT, - `person_id` int(11) NOT NULL, - `profile_type_id` int(11) NOT NULL DEFAULT 1, - PRIMARY KEY (`profile_id`), - KEY `profile_person_id_idx` (`person_id`), - KEY `profile_profile_type_id_idx` (`profile_type_id`), - CONSTRAINT `profile_FK` FOREIGN KEY (`person_id`) REFERENCES `vn`.`person` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19268,7 +15625,7 @@ CREATE TABLE `profile_address` ( PRIMARY KEY (`profile_address_id`), KEY `profile_address_address_id_idx` (`address_id`), KEY `profile_address_profile_id_idx` (`profile_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19284,10 +15641,8 @@ CREATE TABLE `profile_media` ( `media_id` int(11) NOT NULL, PRIMARY KEY (`profile_media_id`), KEY `profile_media_media_id_idx` (`media_id`), - KEY `profile_media_profile_id_idx` (`profile_id`), - CONSTRAINT `fk_profile_media_media1` FOREIGN KEY (`media_id`) REFERENCES `media` (`media_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `media_ibfk_20` FOREIGN KEY (`profile_id`) REFERENCES `profile` (`profile_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; + CONSTRAINT `fk_profile_media_media1` FOREIGN KEY (`media_id`) REFERENCES `media` (`media_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19301,7 +15656,7 @@ CREATE TABLE `profile_type` ( `profile_type_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(15) NOT NULL, PRIMARY KEY (`profile_type_id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19316,10 +15671,8 @@ CREATE TABLE `province` ( `name` varchar(15) NOT NULL, `nation_id` int(11) NOT NULL, PRIMARY KEY (`province_id`), - UNIQUE KEY `province_name_key` (`name`), - KEY `province_nation_id_idx` (`nation_id`), - CONSTRAINT `fk_province_nation1` FOREIGN KEY (`nation_id`) REFERENCES `nation__` (`nation_id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8; + UNIQUE KEY `province_name_key` (`name`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19337,44 +15690,7 @@ CREATE TABLE `townKk` ( PRIMARY KEY (`town_id`), KEY `town_province_id_idx` (`province_id`), CONSTRAINT `townKk_ibfk_1` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!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` ( - `workcenter_id` int(11) NOT NULL AUTO_INCREMENT, - `name` longtext DEFAULT NULL, - `center_id` 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 (`workcenter_id`), - KEY `workcenter_geoFk_idx` (`geoFk`), - CONSTRAINT `workCenter_geoFk` FOREIGN KEY (`geoFk`) REFERENCES `vn`.`zoneGeo` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; -/*!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` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `warehouseFk` smallint(6) unsigned NOT NULL, - PRIMARY KEY (`id`), - KEY `warehouseFk_1_idx` (`warehouseFk`), - CONSTRAINT `warehouseFk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `vn`.`warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19387,16 +15703,16 @@ DROP TABLE IF EXISTS `workers20190711_FichadasAbril`; 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, + `nif` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `Apellidos` varchar(60) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `Nombre` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19411,7 +15727,7 @@ CREATE TABLE `workers20190711_FichadasAbril` ( -- Current Database: `sage` -- -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `sage` /*!40100 DEFAULT CHARACTER SET utf8 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `sage` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */; USE `sage`; @@ -19427,7 +15743,7 @@ CREATE TABLE `ClavesOperacion` ( `Descripcion` varchar(250) NOT NULL, PRIMARY KEY (`ClaveOperacionFactura_`), UNIQUE KEY `ClaveOperacionFactura__UNIQUE` (`ClaveOperacionFactura_`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19447,7 +15763,7 @@ CREATE TABLE `Municipios` ( `Autonomia` smallint(6) NOT NULL, `Nacion` tinyint(4) NOT NULL, PRIMARY KEY (`Codigo`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19461,18 +15777,18 @@ CREATE TABLE `Naciones` ( `countryFk` mediumint(8) NOT NULL, `CodigoNacion` smallint(6) NOT NULL DEFAULT 108, `CodigoNacion347` smallint(6) NOT NULL DEFAULT 108, - `Nacion` varchar(25) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `SiglaNacion` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ES', - `TipoCodigo` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT 'A', + `Nacion` varchar(25) NOT NULL DEFAULT '', + `SiglaNacion` varchar(2) NOT NULL DEFAULT 'ES', + `TipoCodigo` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'A', `Longitud1` tinyint(4) NOT NULL DEFAULT 0, `Longitud2` tinyint(4) NOT NULL DEFAULT 0, `Longitud3` tinyint(4) NOT NULL DEFAULT 0, `Longitud4` tinyint(4) NOT NULL DEFAULT 0, `NacionCEE` smallint(6) NOT NULL DEFAULT 0, `FechaCEE` datetime DEFAULT NULL, - `NacionISO` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '', + `NacionISO` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', PRIMARY KEY (`countryFk`,`CodigoNacion`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19486,10 +15802,10 @@ CREATE TABLE `Provincias` ( `provinceFk` smallint(6) NOT NULL, `CodigoProvincia` varchar(5) NOT NULL DEFAULT '', `CodigoMatricula` varchar(2) NOT NULL DEFAULT '', - `Provincia` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `Provincia` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '', `RecargoProvincial` decimal(28,10) NOT NULL DEFAULT 0.0000000000, PRIMARY KEY (`CodigoProvincia`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19527,7 +15843,7 @@ CREATE TABLE `TiposIva` ( `IGICImplicito` smallint(6) NOT NULL DEFAULT 0, `isIntracommunity` tinyint(2) NOT NULL DEFAULT 0, PRIMARY KEY (`CodigoIva`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19548,7 +15864,7 @@ CREATE TABLE `TiposRetencion` ( `CuentaAbonoANT_` varchar(15) DEFAULT NULL, `IdTipoRetencion` varchar(45) DEFAULT NULL, PRIMARY KEY (`CodigoRetencion`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19565,7 +15881,7 @@ CREATE TABLE `TiposTransacciones` ( `Autofactura` smallint(6) NOT NULL DEFAULT 0, `ClaveOperacionDefecto` varchar(1) NOT NULL DEFAULT '', PRIMARY KEY (`CodigoTransaccion`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19591,39 +15907,39 @@ DROP TABLE IF EXISTS `clientesProveedores`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientesProveedores` ( `CodigoEmpresa` smallint(6) NOT NULL, - `ClienteOProveedor` varchar(1) COLLATE utf8_unicode_ci NOT NULL, + `ClienteOProveedor` varchar(1) NOT NULL, `CodigoClienteProveedor` int(11) NOT NULL, - `RazonSocial` varchar(40) COLLATE utf8_unicode_ci NOT NULL, - `RazonSocial2` varchar(40) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `Nombre` varchar(35) COLLATE utf8_unicode_ci NOT NULL, - `Domicilio` varchar(40) COLLATE utf8_unicode_ci NOT NULL, - `Cargo1` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `Nombre1` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `Cargo2` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `Nombre2` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoCuenta` varchar(15) CHARACTER SET utf8 NOT NULL, - `CifDni` varchar(13) COLLATE utf8_unicode_ci NOT NULL, - `CifEuropeo` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `CodigoSigla` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `ViaPublica` varchar(40) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `Numero1` varchar(4) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `Numero2` varchar(4) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `Escalera` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `Piso` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `Puerta` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `Letra` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoPostal` varchar(8) COLLATE utf8_unicode_ci NOT NULL, - `CodigoMunicipio` varchar(7) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `Municipio` varchar(25) COLLATE utf8_unicode_ci NOT NULL, - `ColaMunicipio` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoProvincia` varchar(5) COLLATE utf8_unicode_ci NOT NULL, - `Provincia` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `RazonSocial` varchar(40) NOT NULL, + `RazonSocial2` varchar(40) NOT NULL DEFAULT '', + `Nombre` varchar(35) NOT NULL, + `Domicilio` varchar(40) NOT NULL, + `Cargo1` varchar(15) NOT NULL DEFAULT '', + `Nombre1` varchar(30) NOT NULL DEFAULT '', + `Cargo2` varchar(15) NOT NULL DEFAULT '', + `Nombre2` varchar(30) NOT NULL DEFAULT '', + `CodigoCuenta` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `CifDni` varchar(13) NOT NULL, + `CifEuropeo` varchar(15) NOT NULL, + `CodigoSigla` varchar(2) NOT NULL DEFAULT '', + `ViaPublica` varchar(40) NOT NULL DEFAULT '', + `Numero1` varchar(4) NOT NULL DEFAULT '', + `Numero2` varchar(4) NOT NULL DEFAULT '', + `Escalera` varchar(2) NOT NULL DEFAULT '', + `Piso` varchar(2) NOT NULL DEFAULT '', + `Puerta` varchar(2) NOT NULL DEFAULT '', + `Letra` varchar(2) NOT NULL DEFAULT '', + `CodigoPostal` varchar(8) NOT NULL, + `CodigoMunicipio` varchar(7) NOT NULL DEFAULT '', + `Municipio` varchar(25) NOT NULL, + `ColaMunicipio` varchar(15) NOT NULL DEFAULT '', + `CodigoProvincia` varchar(5) NOT NULL, + `Provincia` varchar(20) NOT NULL, `CodigoNacion` smallint(6) NOT NULL DEFAULT 0, - `Nacion` varchar(25) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `Telefono` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `Telefono2` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `Telefono3` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `Fax` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `Nacion` varchar(25) NOT NULL DEFAULT '', + `Telefono` varchar(15) NOT NULL, + `Telefono2` varchar(15) NOT NULL, + `Telefono3` varchar(15) NOT NULL DEFAULT '', + `Fax` varchar(15) NOT NULL DEFAULT '', `CodigoTransaccion` tinyint(4) NOT NULL DEFAULT 0, `CodigoRetencion` smallint(6) NOT NULL, `Deducible` smallint(6) NOT NULL DEFAULT 0, @@ -19641,30 +15957,30 @@ CREATE TABLE `clientesProveedores` ( `ControlarFestivos` smallint(6) NOT NULL DEFAULT 0, `DiasRetroceso` tinyint(4) NOT NULL DEFAULT 0, `MesesComerciales` smallint(6) NOT NULL DEFAULT 0, - `RemesaHabitual` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `RemesaHabitual` varchar(15) NOT NULL DEFAULT '', `CodigoTipoEfecto` smallint(6) NOT NULL DEFAULT 0, - `Email1` varchar(250) COLLATE utf8_unicode_ci NOT NULL, - `Email2` varchar(250) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoCategoriaCliente_` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'CLI', - `IdDelegacion` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoMotivoBajaClienteLc` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoDepartamento` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoCanal` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoBanco` varchar(6) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoAgencia` varchar(6) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `DC` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CCC` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `IBAN` varchar(34) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `Email1` varchar(250) NOT NULL, + `Email2` varchar(250) NOT NULL DEFAULT '', + `CodigoCategoriaCliente_` varchar(10) NOT NULL DEFAULT 'CLI', + `IdDelegacion` varchar(10) NOT NULL DEFAULT '', + `CodigoMotivoBajaClienteLc` varchar(3) NOT NULL DEFAULT '', + `CodigoDepartamento` varchar(10) NOT NULL DEFAULT '', + `CodigoCanal` varchar(10) NOT NULL DEFAULT '', + `CodigoBanco` varchar(6) NOT NULL DEFAULT '', + `CodigoAgencia` varchar(6) NOT NULL DEFAULT '', + `DC` varchar(2) NOT NULL DEFAULT '', + `CCC` varchar(15) NOT NULL DEFAULT '', + `IBAN` varchar(34) NOT NULL DEFAULT '', `CodigoCondiciones` smallint(6) NOT NULL DEFAULT 0, `StatusTraspasadoIME` tinyint(4) NOT NULL DEFAULT 0, `TipoImportacionIME` tinyint(4) NOT NULL DEFAULT 2, `TipoPlanCuentaIME` smallint(6) NOT NULL DEFAULT 2, - `Contrapartida` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoCuentaImpagado` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoCuentaEfecto` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `Comentarios` text COLLATE utf8_unicode_ci NOT NULL, + `Contrapartida` varchar(15) NOT NULL DEFAULT '', + `CodigoCuentaImpagado` varchar(15) NOT NULL DEFAULT '', + `CodigoCuentaEfecto` varchar(15) NOT NULL DEFAULT '', + `Comentarios` text NOT NULL DEFAULT '', `CodigoTerritorio` smallint(6) NOT NULL DEFAULT 0, - `CodigoIdioma_` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `CodigoIdioma_` varchar(3) NOT NULL DEFAULT '', `TarifaPrecio` smallint(6) NOT NULL DEFAULT 0, `%Descuento` decimal(28,10) NOT NULL DEFAULT 0.0000000000, `%Rappel` decimal(28,10) NOT NULL DEFAULT 0.0000000000, @@ -19672,46 +15988,60 @@ CREATE TABLE `clientesProveedores` ( `%Financiacion` decimal(28,10) NOT NULL DEFAULT 0.0000000000, `CodigoComisionista` int(11) NOT NULL DEFAULT 0, `TarifaDescuento` smallint(6) NOT NULL DEFAULT 0, - `SiglaNacion` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `SiglaNacion` varchar(2) NOT NULL DEFAULT '', `MarcaMenorSinNif` smallint(6) NOT NULL DEFAULT 0, - `PersonaFisicaJuridica` varchar(1) COLLATE utf8_unicode_ci NOT NULL, - `SiglaNacionRepresentante` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CifDniRepresentante` varchar(13) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `NombreRepresentante` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `PersonaFisicaJuridica` varchar(1) NOT NULL, + `SiglaNacionRepresentante` varchar(2) NOT NULL DEFAULT '', + `CifDniRepresentante` varchar(13) NOT NULL DEFAULT '', + `NombreRepresentante` varchar(50) NOT NULL DEFAULT '', `TipoDocumentoPersona` smallint(6) NOT NULL, - `TipoCif` varchar(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `MotivoBajaClienteLc` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `TipoCif` varchar(1) NOT NULL DEFAULT '', + `MotivoBajaClienteLc` varchar(30) NOT NULL DEFAULT '', `PuntosSR` decimal(28,10) NOT NULL DEFAULT 0.0000000000, - `TarjetaSR` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `TarjetaSR` varchar(100) NOT NULL DEFAULT '', `FechaNacimiento` datetime DEFAULT NULL, - `Domicilio2` varchar(40) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CuentaProvision` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `Domicilio2` varchar(40) NOT NULL DEFAULT '', + `CuentaProvision` varchar(15) NOT NULL DEFAULT '', `CodigoTransportista` int(11) NOT NULL DEFAULT 0, - `FormadePago` varchar(35) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `ObservacionesCliente` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoTipoClienteLc` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `TipoCliente` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoActividadLc` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `Actividad` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `IndicadorIva` varchar(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoRuta_` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `NombreEmpleado` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `PrimerApellidoEmpleado` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `SegundoApellidoEmpleado` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `FormadePago` varchar(35) NOT NULL DEFAULT '', + `ObservacionesCliente` varchar(50) NOT NULL DEFAULT '', + `CodigoTipoClienteLc` varchar(3) NOT NULL DEFAULT '', + `TipoCliente` varchar(10) NOT NULL DEFAULT '', + `CodigoActividadLc` varchar(2) NOT NULL DEFAULT '', + `Actividad` varchar(50) NOT NULL DEFAULT '', + `IndicadorIva` varchar(1) NOT NULL DEFAULT '', + `CodigoRuta_` varchar(10) NOT NULL DEFAULT '', + `NombreEmpleado` varchar(10) NOT NULL DEFAULT '', + `PrimerApellidoEmpleado` varchar(15) NOT NULL DEFAULT '', + `SegundoApellidoEmpleado` varchar(15) NOT NULL DEFAULT '', `sysTick` int(11) NOT NULL DEFAULT 0, `RiesgoMaximo` decimal(28,10) NOT NULL DEFAULT 0.0000000000, `PlazoMedioPCMA` smallint(6) NOT NULL DEFAULT 0, `CriterioIvaIME` smallint(6) NOT NULL DEFAULT 0, - `ReferenciaMandato` varchar(35) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `ReferenciaMandato` varchar(35) NOT NULL DEFAULT '', `%Comision` decimal(28,10) NOT NULL DEFAULT 0.0000000000, `CodigoZona` int(11) NOT NULL DEFAULT 0, `BloqueoAlbaran` smallint(6) NOT NULL DEFAULT 0, - `CodigoSeccion` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoSector_` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `CodigoProyecto` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `CodigoSeccion` varchar(10) NOT NULL DEFAULT '', + `CodigoSector_` varchar(10) NOT NULL DEFAULT '', + `CodigoProyecto` varchar(10) NOT NULL DEFAULT '', PRIMARY KEY (`CodigoEmpresa`,`ClienteOProveedor`,`CodigoClienteProveedor`), KEY `CodigoCuenta` (`CodigoCuenta`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `config` +-- + +DROP TABLE IF EXISTS `config`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `config` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `pendingTaxAccount` varchar(100) DEFAULT NULL COMMENT 'Cuenta contable IVA pendiente', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19746,9 +16076,210 @@ CREATE TABLE `invoiceType` ( PRIMARY KEY (`code`), UNIQUE KEY `code_UNIQUE` (`code`), UNIQUE KEY `codeSage_UNIQUE` (`codeSage`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `movConta` +-- + +DROP TABLE IF EXISTS `movConta`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `movConta` ( + `OrdenMovimientos` int(11) NOT NULL AUTO_INCREMENT, + `MovPosicion` varchar(64) NOT NULL, + `Ejercicio` smallint(6) NOT NULL, + `CodigoEmpresa` smallint(6) NOT NULL, + `Asiento` int(11) NOT NULL, + `CargoAbono` varchar(1) NOT NULL, + `CodigoCuenta` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `Contrapartida` varchar(15) NOT NULL, + `FechaAsiento` datetime NOT NULL, + `TipoDocumento` varchar(6) NOT NULL, + `DocumentoConta` varchar(9) NOT NULL, + `Comentario` varchar(40) NOT NULL, + `ImporteAsiento` decimal(28,10) NOT NULL, + `CodigoDiario` smallint(6) NOT NULL, + `CodigoCanal` varchar(10) NOT NULL, + `CodigoActividad` varchar(1) NOT NULL, + `FechaVencimiento` datetime DEFAULT NULL, + `NumeroPeriodo` smallint(6) NOT NULL, + `CodigoUsuario` smallint(6) NOT NULL, + `FechaGrabacion` datetime NOT NULL, + `TipoEntrada` varchar(2) NOT NULL, + `CodigoDepartamento` varchar(10) NOT NULL, + `CodigoSeccion` varchar(10) NOT NULL, + `CodigoDivisa` varchar(3) NOT NULL, + `ImporteCambio` decimal(28,10) NOT NULL, + `ImporteDivisa` decimal(28,10) NOT NULL, + `FactorCambio` decimal(28,10) NOT NULL, + `CodigoProyecto` varchar(10) NOT NULL, + `LibreN1` int(11) NOT NULL, + `LibreN2` int(11) NOT NULL, + `LibreA1` varchar(15) NOT NULL, + `LibreA2` varchar(15) NOT NULL, + `IdDelegacion` varchar(10) NOT NULL, + `MovCartera` varchar(64) DEFAULT NULL, + `IdProcesoIME` varchar(64) NOT NULL, + `TipoCarteraIME` smallint(6) NOT NULL, + `TipoAnaliticaIME` smallint(6) NOT NULL, + `StatusTraspasadoIME` tinyint(4) NOT NULL, + `TipoImportacionIME` tinyint(4) NOT NULL, + `BaseIva1` decimal(28,10) NOT NULL, + `PorBaseCorrectora1` decimal(28,10) NOT NULL, + `PorIva1` decimal(28,10) NOT NULL, + `CuotaIva1` decimal(28,10) NOT NULL, + `PorRecargoEquivalencia1` decimal(28,10) NOT NULL, + `RecargoEquivalencia1` decimal(28,10) NOT NULL, + `CodigoTransaccion1` tinyint(4) NOT NULL, + `BaseIva2` decimal(28,10) NOT NULL, + `PorBaseCorrectora2` decimal(28,10) NOT NULL, + `PorIva2` decimal(28,10) NOT NULL, + `CuotaIva2` decimal(28,10) NOT NULL, + `PorRecargoEquivalencia2` decimal(28,10) NOT NULL, + `RecargoEquivalencia2` decimal(28,10) NOT NULL, + `CodigoTransaccion2` tinyint(4) NOT NULL, + `BaseIva3` decimal(28,10) NOT NULL, + `PorBaseCorrectora3` decimal(28,10) NOT NULL, + `PorIva3` decimal(28,10) NOT NULL, + `CuotaIva3` decimal(28,10) NOT NULL, + `PorRecargoEquivalencia3` decimal(28,10) NOT NULL, + `RecargoEquivalencia3` decimal(28,10) NOT NULL, + `CodigoTransaccion3` tinyint(4) NOT NULL, + `baseIva4` decimal(28,10) NOT NULL, + `PorBaseCorrectora4` decimal(28,10) NOT NULL, + `PorIva4` decimal(28,10) NOT NULL, + `CuotaIva4` decimal(28,10) NOT NULL, + `PorRecargoEquivalencia4` decimal(28,10) NOT NULL, + `RecargoEquivalencia4` decimal(28,10) NOT NULL, + `CodigoTransaccion4` tinyint(4) NOT NULL, + `Año` smallint(6) NOT NULL, + `Serie` varchar(10) NOT NULL, + `Factura` int(11) NOT NULL, + `SuFacturaNo` varchar(40) NOT NULL, + `FechaFactura` datetime NOT NULL, + `ImporteFactura` decimal(28,10) NOT NULL, + `TipoFactura` varchar(1) NOT NULL, + `CodigoCuentaFactura` varchar(15) NOT NULL, + `CifDni` varchar(13) NOT NULL, + `Nombre` varchar(35) NOT NULL, + `CodigoRetencion` smallint(6) NOT NULL, + `BaseRetencion` decimal(28,10) NOT NULL, + `PorRetencion` decimal(28,10) NOT NULL, + `ImporteRetencion` decimal(28,10) NOT NULL, + `AbonoIva` smallint(6) NOT NULL, + `CodigoActividadF` varchar(1) NOT NULL, + `Intracomunitaria` smallint(6) NOT NULL, + `CodigoTerritorio` smallint(6) NOT NULL, + `SiglaNacion` varchar(2) NOT NULL, + `RetencionInformativa` smallint(6) NOT NULL, + `EjercicioFacturaOriginal` smallint(6) NOT NULL, + `SerieFacturaOriginal` varchar(10) NOT NULL, + `NumeroFacturaOriginal` int(11) NOT NULL, + `EjercicioFactura` smallint(6) NOT NULL, + `CobroPagoRetencion` varchar(1) NOT NULL, + `FechaOperacion` datetime NOT NULL, + `Exclusion347` smallint(6) NOT NULL, + `MovIdentificadorIME` varchar(64) NOT NULL, + `Previsiones` varchar(1) NOT NULL, + `MantenerAsiento` tinyint(4) NOT NULL, + `OrdenMovIME` smallint(6) NOT NULL, + `Metalico347` smallint(6) NOT NULL, + `ClaveOperacionFactura_` varchar(1) NOT NULL, + `SerieAgrupacion_` varchar(10) NOT NULL, + `NumeroFacturaInicial_` int(11) NOT NULL, + `NumeroFacturaFinal_` int(11) NOT NULL, + `IdAsientoExterno` varchar(50) NOT NULL, + `IdDiarioExterno` varchar(10) NOT NULL, + `IdFacturaExterno` varchar(50) NOT NULL, + `IdMovimiento` varchar(40) NOT NULL, + `IdCuadre` smallint(6) NOT NULL, + `FechaCuadre` datetime NOT NULL, + `TipoCuadre` varchar(4) NOT NULL, + `AgrupacionCuadre` int(11) NOT NULL, + `StatusSaldo` smallint(6) NOT NULL, + `StatusConciliacion` smallint(6) NOT NULL, + `CodigoConciliacion` int(11) NOT NULL, + `FechaConciliacion` datetime NOT NULL, + `TipoConciliacion` smallint(6) NOT NULL, + `IndicadorContaBanco` varchar(1) NOT NULL, + `Descripcion3` varchar(40) NOT NULL, + `Descripcion4` varchar(40) NOT NULL, + `Descripcion5` varchar(40) NOT NULL, + `Descripcion6` varchar(40) NOT NULL, + `Descripcion7` varchar(40) NOT NULL, + `Descripcion8` varchar(50) NOT NULL, + `Descripcion9` varchar(50) NOT NULL, + `Descripcion2` varchar(250) NOT NULL, + `Descripcion1` varchar(250) NOT NULL, + `Punteo1` smallint(6) NOT NULL, + `Punteo9` smallint(6) NOT NULL, + `Punteo8` smallint(6) NOT NULL, + `Punteo7` smallint(6) NOT NULL, + `Punteo6` smallint(6) NOT NULL, + `Punteo5` smallint(6) NOT NULL, + `Punteo4` smallint(6) NOT NULL, + `Punteo3` smallint(6) NOT NULL, + `Punteo2` smallint(6) NOT NULL, + `CodigoIva1` smallint(6) NOT NULL, + `CodigoIva2` smallint(6) NOT NULL, + `CodigoIva3` smallint(6) NOT NULL, + `CodigoIva4` smallint(6) NOT NULL, + `CriterioIva` tinyint(4) NOT NULL, + `FechaMaxVencimiento` datetime NOT NULL, + `TipoCriterioCaja` tinyint(4) NOT NULL, + `MovFacturaOrigenIME` varchar(50) NOT NULL, + `IdFacturaExternoFinal` varchar(50) NOT NULL, + `IdFacturaExternoInicial` varchar(50) NOT NULL, + `IdFacturaExternoOriginal` varchar(50) NOT NULL, + `NumFacturasExternoAgrupacion` int(11) NOT NULL, + `CodigoMedioCobro` varchar(1) NOT NULL, + `MedioCobro` varchar(31) NOT NULL, + `IvaDeducible1` smallint(6) NOT NULL DEFAULT 1, + `IvaDeducible2` smallint(6) NOT NULL DEFAULT 1, + `IvaDeducible3` smallint(6) NOT NULL DEFAULT 1, + `IvaDeducible4` smallint(6) NOT NULL DEFAULT 1, + `TipoRectificativa` smallint(6) NOT NULL, + `FechaFacturaOriginal` datetime NOT NULL, + `BaseImponibleOriginal` decimal(28,10) NOT NULL, + `CuotaIvaOriginal` decimal(28,10) NOT NULL, + `ClaseAbonoRectificativas` smallint(6) NOT NULL, + `RecargoEquivalenciaOriginal` decimal(28,10) NOT NULL, + `ObjetoFactura` varchar(500) NOT NULL, + `enlazadoSage` tinyint(1) NOT NULL DEFAULT 0, + PRIMARY KEY (`OrdenMovimientos`,`LibreN1`), + KEY `ix_movconta2` (`IdProcesoIME`), + KEY `CodigoCuenta` (`CodigoCuenta`), + KEY `movConta_Asiento` (`Asiento`), + KEY `ix_movconta` (`enlazadoSage`,`IdProcesoIME`), + KEY `movConta_IdProcesoIME` (`IdProcesoIME`), + KEY `movConta_Asiento2` (`Asiento`,`IdProcesoIME`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 `sage`.`movConta_BEFORE_UPDATE` + BEFORE UPDATE ON `movConta` + FOR EACH ROW +BEGIN + IF NEW.enlazadoSage = TRUE THEN + UPDATE vn.XDiario SET enlazadoSage = TRUE WHERE ASIEN = NEW.Asiento; + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `movContaIVA` -- @@ -19758,7 +16289,7 @@ DROP TABLE IF EXISTS `movContaIVA`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `movContaIVA` ( `id` int(11) NOT NULL, - `CodigoDivisa` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `CodigoDivisa` varchar(3) NOT NULL, `BaseIva1` double DEFAULT NULL, `PorBaseCorrectora1` double DEFAULT NULL, `PorIva1` double DEFAULT NULL, @@ -19792,33 +16323,33 @@ CREATE TABLE `movContaIVA` ( `CodigoTransaccion4` double NOT NULL DEFAULT 0, `CodigoIva4` smallint(6) NOT NULL, `Año` int(11) DEFAULT NULL, - `Serie` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `Serie` varchar(10) DEFAULT NULL, `Factura` int(11) DEFAULT NULL, - `SuFacturaNo` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL, + `SuFacturaNo` varchar(40) DEFAULT NULL, `FechaFactura` date DEFAULT NULL, `ImporteFactura` double DEFAULT NULL, - `TipoFactura` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `CodigoCuentaFactura` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `CifDni` varchar(13) COLLATE utf8_unicode_ci DEFAULT NULL, - `Nombre` varchar(35) COLLATE utf8_unicode_ci DEFAULT NULL, + `TipoFactura` varchar(1) DEFAULT NULL, + `CodigoCuentaFactura` varchar(15) DEFAULT NULL, + `CifDni` varchar(13) DEFAULT NULL, + `Nombre` varchar(35) DEFAULT NULL, `CodigoRetencion` int(2) DEFAULT NULL, `BaseRetencion` double DEFAULT NULL, `PorRetencion` double DEFAULT NULL, `ImporteRetencion` double DEFAULT NULL, - `SiglaNacion` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ES', + `SiglaNacion` varchar(2) NOT NULL DEFAULT 'ES', `EjercicioFactura` int(2) DEFAULT NULL, `FechaOperacion` date DEFAULT NULL, `Exclusion347` int(2) DEFAULT NULL, `MantenerAsiento` int(2) DEFAULT -1, `Metalico347` int(2) DEFAULT NULL, - `ClaveOperacionFactura` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `ClaveOperacionFactura` varchar(1) DEFAULT NULL, `TipoRectificativa` int(2) DEFAULT NULL, `FechaFacturaOriginal` date DEFAULT NULL, `CuotaIvaOriginal` double DEFAULT NULL, `BaseImponibleOriginal` double DEFAULT NULL, `ClaseAbonoRectificativas` int(2) DEFAULT NULL, `RecargoEquivalenciaOriginal` double DEFAULT NULL, - `LibreA1` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + `LibreA1` varchar(15) DEFAULT NULL, `IvaDeducible1` int(2) NOT NULL DEFAULT -1, `IvaDeducible2` int(2) NOT NULL DEFAULT -1, `IvaDeducible3` int(2) NOT NULL DEFAULT -1, @@ -19828,7 +16359,7 @@ CREATE TABLE `movContaIVA` ( `moveData` tinyint(1) DEFAULT 1, PRIMARY KEY (`id`), CONSTRAINT `movContaIVA_fk1` FOREIGN KEY (`id`) REFERENCES `vn`.`XDiario` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Informa del valor de los campos de IVA para enlazar en la tabla vn.movConta'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Informa del valor de los campos de IVA para enlazar en la tabla vn.movConta'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19842,10 +16373,10 @@ CREATE TABLE `pgcToSage` ( `id` int(11) NOT NULL AUTO_INCREMENT, `taxCodeSage` int(11) NOT NULL, `transactionCode` int(11) NOT NULL, - `accountTaxInput` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, - `accountTaxOutput` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, + `accountTaxInput` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL, + `accountTaxOutput` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Tabla relaciona cuentas pgc con Código de IVA y Código de Transacción en Sage'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Tabla relaciona cuentas pgc con Código de IVA y Código de Transacción en Sage'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19857,39 +16388,39 @@ DROP TABLE IF EXISTS `planCuentasPGC`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `planCuentasPGC` ( `CodigoEmpresa` smallint(6) NOT NULL, - `CodigoCuenta` varchar(15) CHARACTER SET utf8 NOT NULL, - `Cuenta` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `ClienteOProveedor` varchar(1) COLLATE utf8_unicode_ci NOT NULL, - `CodigoDivisa` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `CodigoCuenta` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `Cuenta` varchar(50) NOT NULL, + `ClienteOProveedor` varchar(1) NOT NULL, + `CodigoDivisa` varchar(3) NOT NULL DEFAULT '', `IndicadorProrrata` smallint(6) NOT NULL DEFAULT 0, `TipoPlanCuentaIME` smallint(6) NOT NULL DEFAULT 2, `StatusAnalitica` smallint(6) NOT NULL DEFAULT 0, - `AnaCodigoCuenta` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `AnaCodigoCuenta` varchar(15) NOT NULL DEFAULT '', `StatusTraspasadoIME` tinyint(4) NOT NULL DEFAULT 0, `TipoImportacionIME` tinyint(4) NOT NULL DEFAULT 0, `CierrePatrimonio_` smallint(6) NOT NULL DEFAULT 0, - `CuentaPatrimonio_` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `CuentaPatrimonio_` varchar(15) NOT NULL DEFAULT '', `CuentaVarios` smallint(6) NOT NULL DEFAULT 0, `TodasLasActividades` smallint(6) NOT NULL DEFAULT 0, - `ValorDelegacion` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `ValorDepartamento` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `ValorProyecto` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `ValorCanal` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `ValorSeccion` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `ValorDelegacion` varchar(10) NOT NULL DEFAULT '', + `ValorDepartamento` varchar(10) NOT NULL DEFAULT '', + `ValorProyecto` varchar(10) NOT NULL DEFAULT '', + `ValorCanal` varchar(10) NOT NULL DEFAULT '', + `ValorSeccion` varchar(10) NOT NULL DEFAULT '', PRIMARY KEY (`CodigoEmpresa`,`CodigoCuenta`), KEY `CodigoCuenta` (`CodigoCuenta`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `providerLastThreeMonths` +-- Temporary table structure for view `supplierLastThreeMonths` -- -DROP TABLE IF EXISTS `providerLastThreeMonths`; -/*!50001 DROP VIEW IF EXISTS `providerLastThreeMonths`*/; +DROP TABLE IF EXISTS `supplierLastThreeMonths`; +/*!50001 DROP VIEW IF EXISTS `supplierLastThreeMonths`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `providerLastThreeMonths` ( +/*!50001 CREATE TABLE `supplierLastThreeMonths` ( `supplierFk` tinyint NOT NULL, `companyFk` tinyint NOT NULL ) ENGINE=MyISAM */; @@ -19902,13 +16433,50 @@ SET character_set_client = @saved_cs_client; -- -- Dumping routines for database 'sage' -- -/*!50003 DROP PROCEDURE IF EXISTS `accountingMovements_add` */; +/*!50003 DROP FUNCTION IF EXISTS `company_getCode` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!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 = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `company_getCode`(vCompanyFk INT) RETURNS int(2) + READS SQL DATA +BEGIN +/** + * Devuelve la correspondencía del código de empresa de sage. + * Tiene en cuenta el entorno + * + * @param vSelf Id de empresa de verdnatura + * @return Código de empresa sage + */ + DECLARE vCompanySageFk INT(2); + + SELECT IF(c.environment = 'production', + co.companyCode, + co.companyCodeTest + ) INTO vCompanySageFk + FROM util.config c + JOIN vn.company co + WHERE co.id = vCompanyFk; + + RETURN vCompanySageFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `accountingMovements_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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -19934,29 +16502,29 @@ BEGIN DECLARE vBookEntries TEXT; SELECT SiglaNacion INTO vCountryCanariasCode - FROM Naciones + FROM Naciones WHERE Nacion ='ISLAS CANARIAS'; SELECT SiglaNacion INTO vCountryCeutaMelillaCode - FROM Naciones + FROM Naciones WHERE Nacion ='CEUTA Y MELILLA'; SELECT CodigoTransaccion INTO vDuaTransactionFk FROM TiposTransacciones WHERE Transaccion = 'Import. bienes y serv. corrientes pdte. liquidar'; - - SELECT CodigoIva INTO vTaxImportFk + + SELECT CodigoIva INTO vTaxImportFk FROM TiposIva - WHERE Iva = 'IVA 21% importaciones'; - - SELECT CodigoIva INTO vTaxImportReducedFk + WHERE Iva = 'IVA 21% importaciones'; + + SELECT CodigoIva INTO vTaxImportReducedFk FROM TiposIva WHERE Iva = 'IVA 10% importaciones'; - SELECT CodigoIva INTO vTaxImportSuperReducedFk + SELECT CodigoIva INTO vTaxImportSuperReducedFk FROM TiposIva WHERE Iva = 'H.P. IVA Soportado Impor 4%'; - + SELECT CodigoTransaccion INTO vTransactionExportFk FROM TiposTransacciones WHERE Transaccion = 'Exportaciones definitivas'; @@ -19966,22 +16534,22 @@ BEGIN WHERE Transaccion = 'Envíos definitivos a Canarias, Ceuta y Melilla'; SELECT codeSage INTO vInvoiceTypeInformativeCode - FROM invoiceType WHERE code ='informative'; + FROM invoiceType WHERE code ='informative'; SELECT CAST(CONCAT(vYear, '-01-01') AS DATETIME), util.dayEnd(CAST(CONCAT(vYear, '-12-31') AS DATE)) INTO vDatedFrom, vDatedTo; - + TRUNCATE movContaIVA; - - DELETE FROM movConta - WHERE enlazadoSage = FALSE + + DELETE FROM movConta + WHERE enlazadoSage = FALSE AND Asiento <> 1 ; - + CALL clientSupplier_add(vCompanyFk); CALL pgc_add(vCompanyFk); CALL invoiceOut_manager(vYear, vCompanyFk); CALL invoiceIn_manager(vYear, vCompanyFk); - + INSERT INTO movConta(TipoEntrada, Ejercicio, CodigoEmpresa, @@ -20057,7 +16625,7 @@ BEGIN BaseImponibleOriginal, CuotaIvaOriginal, ClaseAbonoRectificativas, - RecargoEquivalenciaOriginal, + RecargoEquivalenciaOriginal, LibreA1, CodigoIva1, CodigoIva2, @@ -20070,8 +16638,8 @@ BEGIN Intracomunitaria ) SELECT 'EN' TipoEntrada, - YEAR(x.FECHA) Ejercicio, - IF (@@hostname = 'db', c.companyCode, companyCodeTest) AS CodigoEmpresa, + YEAR(x.FECHA) Ejercicio, + company_getCode(vCompanyFk) AS CodigoEmpresa, x.ASIEN Asiento, IF(EURODEBE <> 0 OR (EURODEBE = 0 AND EUROHABER IS NULL), 'D', 'H') CargoAbono, x.SUBCTA CodigoCuenta, @@ -20156,63 +16724,63 @@ BEGIN mci.IvaDeducible4, mci.Intracomunitaria FROM vn.XDiario x - JOIN vn.company c ON c.id = x.empresa_id - LEFT JOIN movContaIVA mci ON mci.id = x.id - LEFT JOIN (SELECT * + LEFT JOIN movContaIVA mci ON mci.id = x.id + LEFT JOIN (SELECT * FROM (SELECT DISTINCT ASIEN, FECREGCON, FECHA_EX FROM vn.XDiario - WHERE enlazadoSage = FALSE + WHERE enlazadoSage = FALSE ORDER BY ASIEN, FECREGCON DESC, FECHA_EX DESC + LIMIT 10000000000000000000 ) sub GROUP BY ASIEN - )sub2 ON sub2.ASIEN = x.ASIEN - LEFT JOIN ( SELECT DISTINCT(account),cu.code + )sub2 ON sub2.ASIEN = x.ASIEN + LEFT JOIN ( SELECT DISTINCT(account),cu.code FROM vn.bank b JOIN vn.currency cu ON cu.id = b.currencyFk WHERE cu.code <> 'EUR' -- no se informa cuando la divisa en EUR - )sub3 ON sub3.account = x.SUBCTA - WHERE x.enlazadoSage = FALSE + )sub3 ON sub3.account = x.SUBCTA + WHERE x.enlazadoSage = FALSE AND x.empresa_id = vCompanyFk AND x.FECHA BETWEEN vDatedFrom AND vDatedTo; -- Metálicos UPDATE movConta m - JOIN (SELECT Asiento, - c.socialName name, - c.fi, - n.SiglaNacion, - m.CodigoCuenta, + JOIN (SELECT Asiento, + c.socialName name, + c.fi, + n.SiglaNacion, + m.CodigoCuenta, m.Contrapartida - FROM movConta m + FROM movConta m LEFT JOIN vn.client c ON c.id = IF(m.CargoAbono = 'H', CAST(SUBSTRING(m.CodigoCuenta, 3, LENGTH(m.CodigoCuenta)) AS UNSIGNED), CAST(SUBSTRING(m.Contrapartida, 3, LENGTH(m.Contrapartida)) AS UNSIGNED)) - LEFT JOIN Naciones n ON n.countryFk = c.countryFk - WHERE m.Metalico347 = TRUE - AND m.enlazadoSage = FALSE - )sub ON m.Asiento = sub.Asiento + LEFT JOIN Naciones n ON n.countryFk = c.countryFk + WHERE m.Metalico347 = TRUE + AND m.enlazadoSage = FALSE + )sub ON m.Asiento = sub.Asiento SET m.Metalico347 = TRUE, m.TipoFactura = vInvoiceTypeInformativeCode, m.CifDni = sub.fi, m.Nombre = sub.name, - m.SiglaNacion = sub.SiglaNacion + m.SiglaNacion = sub.SiglaNacion WHERE m.enlazadoSage = FALSE; UPDATE movConta m SET m.Metalico347 = FALSE, m.TipoFactura = '' - WHERE m.CargoAbono = 'D' - AND m.enlazadoSage = FALSE; + WHERE m.CargoAbono = 'D' + AND m.enlazadoSage = FALSE; -- Elimina cuentas de cliente/proveedor que no se utilizarán en la importación - DELETE cp + DELETE cp FROM clientesProveedores cp - LEFT JOIN movConta mc ON mc.codigoCuenta = cp.codigoCuenta + LEFT JOIN movConta mc ON mc.codigoCuenta = cp.codigoCuenta AND mc.enlazadoSage = FALSE WHERE mc.codigoCuenta IS NULL; -- Elimina cuentas contables que no se utilizarán en la importación - DELETE pc - FROM planCuentasPGC pc + DELETE pc + FROM planCuentasPGC pc LEFT JOIN movConta mc ON mc.codigoCuenta = pc.codigoCuenta AND mc.enlazadoSage = FALSE WHERE mc.codigoCuenta IS NULL; @@ -20221,7 +16789,7 @@ BEGIN UPDATE movConta mci JOIN vn.XDiario x ON x.ASIEN = mci.Asiento JOIN TiposIva ti ON ti.CodigoIva = x.IVA - JOIN vn.pgcMaster pm ON pm.code = mci.CodigoCuenta COLLATE utf8_general_ci + JOIN vn.pgcMaster pm ON pm.code = mci.CodigoCuenta COLLATE utf8mb3_unicode_ci SET mci.BaseIva1 = x.BASEEURO, mci.PorIva1 = x.IVA, mci.CuotaIva1 = CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)), @@ -20234,13 +16802,13 @@ BEGIN mci.ImporteFactura = mci.ImporteFactura + x.BASEEURO + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) WHERE pm.description = 'HP Iva pendiente' AND mci.enlazadoSage = FALSE - AND x.SERIE = vSerialDua COLLATE utf8_general_ci + AND x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci AND ti.Iva = 'I.V.A. 10% Nacional'; UPDATE movConta mci JOIN vn.XDiario x ON x.ASIEN = mci.Asiento JOIN TiposIva ti ON ti.CodigoIva = x.IVA - JOIN vn.pgcMaster pm ON pm.code = mci.CodigoCuenta COLLATE utf8_general_ci + JOIN vn.pgcMaster pm ON pm.code = mci.CodigoCuenta COLLATE utf8mb3_unicode_ci SET mci.BaseIva2 = x.BASEEURO , mci.PorIva2 = x.IVA, mci.CuotaIva2 = CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10,2)), @@ -20250,13 +16818,13 @@ BEGIN mci.ImporteFactura = mci.ImporteFactura + x.BASEEURO + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) WHERE pm.description = 'HP Iva pendiente' AND mci.enlazadoSage = FALSE - AND x.SERIE = vSerialDua COLLATE utf8_general_ci + AND x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci AND ti.Iva = 'I.V.A. 21%'; - + UPDATE movConta mci JOIN vn.XDiario x ON x.ASIEN = mci.Asiento JOIN TiposIva ti ON ti.CodigoIva = x.IVA - JOIN vn.pgcMaster pm ON pm.code = mci.CodigoCuenta COLLATE utf8_general_ci + JOIN vn.pgcMaster pm ON pm.code = mci.CodigoCuenta COLLATE utf8mb3_unicode_ci SET mci.BaseIva3 = x.BASEEURO , mci.PorIva3 = x.IVA, mci.CuotaIva3 = CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10,2)), @@ -20266,23 +16834,23 @@ BEGIN mci.ImporteFactura = mci.ImporteFactura + x.BASEEURO + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) WHERE pm.description = 'HP Iva pendiente' AND mci.enlazadoSage = FALSE - AND x.SERIE = vSerialDua COLLATE utf8_general_ci + AND x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci AND ti.Iva = 'I.V.A. 4%'; -- Rectificativas - UPDATE movConta mci - JOIN (SELECT x.ASIEN, x.FECHA_RT, x.SERIE_RT, x.FACTU_RT - FROM movConta mci + UPDATE movConta mci + JOIN (SELECT x.ASIEN, x.FECHA_RT, x.SERIE_RT, x.FACTU_RT + FROM movConta mci JOIN vn.XDiario x ON x.ASIEN = mci.Asiento - WHERE mci.TipoRectificativa > 0 - AND mci.enlazadoSage = FALSE + WHERE mci.TipoRectificativa > 0 + AND mci.enlazadoSage = FALSE AND x.FACTU_RT IS NOT NULL GROUP BY x.ASIEN ) sub ON sub.ASIEN = mci.Asiento - SET mci.EjercicioFacturaOriginal = YEAR(sub.FECHA_RT), - mci.SerieFacturaOriginal = sub.SERIE_RT, - mci.NumeroFacturaOriginal = sub.FACTU_RT - WHERE mci.TipoRectificativa > 0 AND + SET mci.EjercicioFacturaOriginal = YEAR(sub.FECHA_RT), + mci.SerieFacturaOriginal = sub.SERIE_RT, + mci.NumeroFacturaOriginal = sub.FACTU_RT + WHERE mci.TipoRectificativa > 0 AND mci.enlazadoSage = FALSE ; -- Exportaciones Andorras y Canarias cambia TT (la cuenta es compartida) @@ -20291,39 +16859,39 @@ BEGIN CodigoTransaccion2 = IF(CodigoTransaccion2 = 0, 0, vTransactionExportTaxFreeFk), CodigoTransaccion3 = IF(CodigoTransaccion3 = 0, 0, vTransactionExportTaxFreeFk), CodigoTransaccion4 = IF(CodigoTransaccion4 = 0, 0, vTransactionExportTaxFreeFk) - WHERE enlazadoSage = FALSE - AND (CodigoTransaccion1 = vTransactionExportFk - OR CodigoTransaccion2 = vTransactionExportFk - OR CodigoTransaccion3 = vTransactionExportFk - OR CodigoTransaccion4 = vTransactionExportFk) - AND SiglaNacion IN (vCountryCanariasCode COLLATE utf8_general_ci, vCountryCeutaMelillaCode COLLATE utf8_general_ci); + WHERE enlazadoSage = FALSE + AND (CodigoTransaccion1 = vTransactionExportFk + OR CodigoTransaccion2 = vTransactionExportFk + OR CodigoTransaccion3 = vTransactionExportFk + OR CodigoTransaccion4 = vTransactionExportFk) + AND SiglaNacion IN (vCountryCanariasCode COLLATE utf8mb3_unicode_ci, vCountryCeutaMelillaCode COLLATE utf8mb3_unicode_ci); UPDATE movConta mc SET CodigoDivisa = 'USD', FactorCambio = TRUE, ImporteCambio = ABS( CAST( IF( ImporteDivisa <> 0 AND ImporteCambio = 0, ImporteAsiento / ImporteDivisa, ImporteCambio) AS DECIMAL( 10, 2))) - WHERE enlazadoSage = FALSE + WHERE enlazadoSage = FALSE AND (ImporteCambio <> 0 OR ImporteDivisa <> 0 OR FactorCambio); UPDATE movConta mc SET importeDivisa= -importeDivisa - WHERE enlazadoSage = FALSE - AND importeDivisa > 0 + WHERE enlazadoSage = FALSE + AND importeDivisa > 0 AND ImporteAsiento < 0; -- Comprobación que los importes e ivas sean correctos, avisa vía CAU - SELECT GROUP_CONCAT(Asiento ORDER BY Asiento ASC SEPARATOR ' \n\r') INTO vBookEntries + SELECT GROUP_CONCAT(Asiento ORDER BY Asiento ASC SEPARATOR ',') INTO vBookEntries FROM(SELECT sub.Asiento FROM (SELECT mc.Asiento, SUM(mc.ImporteAsiento) amount FROM movConta mc WHERE mc.enlazadoSage = FALSE GROUP BY mc.Asiento)sub JOIN (SELECT x.ASIEN, SUM(IFNULL(x.EURODEBE,0) + IFNULL(x.EUROHABER,0)) amount - FROM vn.XDiario x + FROM vn.XDiario x WHERE x.enlazadoSage = FALSE GROUP BY ASIEN)sub2 ON sub2.ASIEN = sub.Asiento WHERE sub.amount <> sub2.amount - UNION ALL + UNION ALL SELECT sub.Asiento FROM (SELECT Asiento, SUM(BaseIva1 + BaseIva2 + BaseIva3 + BaseIva4) amountTaxableBase FROM movConta @@ -20332,452 +16900,17 @@ BEGIN GROUP BY Asiento) sub JOIN (SELECT ASIEN, SUM(BASEEURO) amountTaxableBase FROM (SELECT ASIEN, SUM(BASEEURO) BASEEURO - FROM vn.XDiario - WHERE FACTURA - AND auxiliar <> '*' - AND enlazadoSage = FALSE - GROUP BY FACTURA, ASIEN)sub3 - GROUP BY ASIEN) sub2 ON sub2.ASIEN = sub.Asiento - WHERE sub.amountTaxableBase<>sub2.amountTaxableBase - AND sub.amountTaxableBase/2 <> sub2.amountTaxableBase) sub; - - IF vBookEntries IS NOT NULL THEN - CALL vn.mail_insert('cau@verdnatura.es, administracion@verdnatura.es', - 'noreply@verdnatura.es', - CONCAT('Asientos contables importados incorrectamente'), - CONCAT('

Existen asientos que difieren entre la info. de XDiario y la que se ha importado a Sage.

- Asientos nº ', vBookEntries, '
')); - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `accountingMovements_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 `accountingMovements_add__`(vYear INT, vCompanyFk INT) -BEGIN -/** - * Traslada la info de contabilidad generada en base a vn.XDiario a la tabla sage.movConta para poder ejecutar posteriormente el proceso de importación de datos de SQL Server - * Solo traladará los asientos marcados con el campo vn.XDiario.enlazadoSage = FALSE - * @vYear Año contable del que se quiere trasladar la información - * @vCompanyFk Empresa de la que se quiere trasladar datos - */ - DECLARE vDatedFrom DATETIME; - DECLARE vDatedTo DATETIME; - DECLARE vDuaTransactionFk INT; - DECLARE vTaxImportFk INT; - DECLARE vTaxImportReducedFk INT; - DECLARE vTransactionExportFk INT; - DECLARE vTransactionExportTaxFreeFk INT; - DECLARE vSerialDua VARCHAR(1) DEFAULT 'D'; - DECLARE vInvoiceTypeInformativeCode VARCHAR(1); - DECLARE vCountryCanariasCode, vCountryCeutaMelillaCode VARCHAR(2) ; - DECLARE vBookEntries TEXT; - - SELECT SiglaNacion INTO vCountryCanariasCode - FROM Naciones - WHERE Nacion ='ISLAS CANARIAS'; - - SELECT SiglaNacion INTO vCountryCeutaMelillaCode - FROM Naciones - WHERE Nacion ='CEUTA Y MELILLA'; - - SELECT CodigoTransaccion INTO vDuaTransactionFk - FROM TiposTransacciones - WHERE Transaccion = 'Import. bienes y serv. corrientes pdte. liquidar'; - - SELECT CodigoIva INTO vTaxImportFk - FROM TiposIva - WHERE Iva = 'IVA 21% importaciones'; - - SELECT CodigoIva INTO vTaxImportReducedFk - FROM TiposIva - WHERE Iva = 'IVA 10% importaciones'; - - SELECT CodigoTransaccion INTO vTransactionExportFk - FROM TiposTransacciones - WHERE Transaccion = 'Exportaciones definitivas'; - - SELECT CodigoTransaccion INTO vTransactionExportTaxFreeFk - FROM TiposTransacciones - WHERE Transaccion = 'Envíos definitivos a Canarias, Ceuta y Melilla'; - - SELECT codeSage INTO vInvoiceTypeInformativeCode - FROM invoiceType WHERE code ='informative'; - - SELECT CAST(CONCAT(vYear, '-01-01') AS DATETIME), util.dayEnd(CAST(CONCAT(vYear, '-12-31') AS DATE)) - INTO vDatedFrom, vDatedTo; - - TRUNCATE movContaIVA; - - DELETE FROM movConta - WHERE enlazadoSage = FALSE - AND Asiento <> 1 ; - - CALL clientSupplier_add(vCompanyFk); - CALL pgc_add(vCompanyFk); - CALL invoiceOut_manager(vYear, vCompanyFk); - CALL invoiceIn_manager(vYear, vCompanyFk); - - INSERT INTO movConta(TipoEntrada, - Ejercicio, - CodigoEmpresa, - Asiento, - CargoAbono, - CodigoCuenta, - Contrapartida, - FechaAsiento, - Comentario, - ImporteAsiento, - NumeroPeriodo, - FechaGrabacion, - CodigoDivisa, - ImporteCambio, - ImporteDivisa, - FactorCambio, - IdProcesoIME, - TipoCarteraIME, - TipoAnaliticaIME, - StatusTraspasadoIME, - TipoImportacionIME, - Metalico347, - BaseIva1, - PorBaseCorrectora1, - PorIva1, - CuotaIva1, - PorRecargoEquivalencia1, - RecargoEquivalencia1, - CodigoTransaccion1, - BaseIva2, - PorBaseCorrectora2, - PorIva2, - CuotaIva2, - PorRecargoEquivalencia2, - RecargoEquivalencia2, - CodigoTransaccion2, - BaseIva3, - PorBaseCorrectora3, - PorIva3, - CuotaIva3, - PorRecargoEquivalencia3, - RecargoEquivalencia3, - CodigoTransaccion3, - BaseIva4, - PorBaseCorrectora4, - PorIva4, - CuotaIva4, - PorRecargoEquivalencia4, - RecargoEquivalencia4, - CodigoTransaccion4, - Año, - Serie, - Factura, - SuFacturaNo, - FechaFactura, - ImporteFactura, - TipoFactura, - CodigoCuentaFactura, - CifDni, - Nombre, - CodigoRetencion, - BaseRetencion, - PorRetencion, - ImporteRetencion, - SiglaNacion, - EjercicioFactura, - FechaOperacion, - Exclusion347, - MantenerAsiento, - ClaveOperacionFactura_, - TipoRectificativa, - FechaFacturaOriginal, - BaseImponibleOriginal, - CuotaIvaOriginal, - ClaseAbonoRectificativas, - RecargoEquivalenciaOriginal, - LibreA1, - CodigoIva1, - CodigoIva2, - CodigoIva3, - CodigoIva4, - IvaDeducible1, - IvaDeducible2, - IvaDeducible3, - IvaDeducible4, - Intracomunitaria - ) - SELECT 'EN' TipoEntrada, - YEAR(x.FECHA) Ejercicio, - IF (@@hostname = 'db', c.companyCode, companyCodeTest) AS CodigoEmpresa, - x.ASIEN Asiento, - IF(EURODEBE <> 0 OR (EURODEBE = 0 AND EUROHABER IS NULL), 'D', 'H') CargoAbono, - x.SUBCTA CodigoCuenta, - x.CONTRA Contrapartida, - x.FECHA FechaAsiento, - x.CONCEPTO Comentario, - IF(x.EURODEBE, x.EURODEBE, x.EUROHABER) ImporteAsiento, - MONTH(x.FECHA) NumeroPeriodo, - IF(sub2.FECREGCON IS NULL, sub2.FECHA_EX, sub2.FECREGCON) FechaGrabacion, - IF(x.CAMBIO, IFNULL(mci.CodigoDivisa, sub3.code), '') CodigoDivisa, - x.CAMBIO ImporteCambio, - IFNULL(x.DEBEME, x.HABERME) ImporteDivisa, - IF(x.CAMBIO, TRUE, FALSE) FactorCambio, - NULL IdProcesoIME, - 0 TipoCarteraIME, - 0 TipoAnaliticaIME, - 0 StatusTraspasadoIME, - 0 TipoImportacionIME, - x.METAL Metalico347, - mci.BaseIva1, - mci.PorBaseCorrectora1, - mci.PorIva1, - mci.CuotaIva1, - mci.PorRecargoEquivalencia1, - mci.RecargoEquivalencia1, - mci.CodigoTransaccion1, - mci.BaseIva2, - mci.PorBaseCorrectora2, - mci.PorIva2, - mci.CuotaIva2, - mci.PorRecargoEquivalencia2, - mci.RecargoEquivalencia2, - mci.CodigoTransaccion2, - mci.BaseIva3, - mci.PorBaseCorrectora3, - mci.PorIva3, - mci.CuotaIva3, - mci.PorRecargoEquivalencia3, - mci.RecargoEquivalencia3, - mci.CodigoTransaccion3, - mci.BaseIva4, - mci.PorBaseCorrectora4, - mci.PorIva4, - mci.CuotaIva4, - mci.PorRecargoEquivalencia4, - mci.RecargoEquivalencia4, - mci.CodigoTransaccion4, - mci.Año, - mci.Serie, - mci.Factura, - mci.SuFacturaNo, - mci.FechaFactura, - mci.ImporteFactura, - mci.TipoFactura, - mci.CodigoCuentaFactura, - mci.CifDni, - mci.Nombre, - mci.CodigoRetencion, - mci.BaseRetencion, - mci.PorRetencion, - mci.ImporteRetencion, - mci.SiglaNacion, - mci.EjercicioFactura, - mci.FechaOperacion, - mci.Exclusion347, - TRUE, - mci.ClaveOperacionFactura, - mci.TipoRectificativa, - mci.FechaFacturaOriginal, - mci.BaseImponibleOriginal, - mci.CuotaIvaOriginal, - mci.ClaseAbonoRectificativas, - mci.RecargoEquivalenciaOriginal, - mci.LibreA1, - mci.CodigoIva1, - mci.CodigoIva2, - mci.CodigoIva3, - mci.CodigoIva4, - mci.IvaDeducible1, - mci.IvaDeducible2, - mci.IvaDeducible3, - mci.IvaDeducible4, - mci.Intracomunitaria - FROM vn.XDiario x - JOIN vn.company c ON c.id = x.empresa_id - LEFT JOIN movContaIVA mci ON mci.id = x.id - LEFT JOIN (SELECT * - FROM (SELECT DISTINCT ASIEN, FECREGCON, FECHA_EX FROM vn.XDiario - WHERE enlazadoSage = FALSE - ORDER BY ASIEN, FECREGCON DESC, FECHA_EX DESC - ) sub GROUP BY ASIEN - )sub2 ON sub2.ASIEN = x.ASIEN - LEFT JOIN ( SELECT DISTINCT(account),cu.code - FROM vn.bank b - JOIN vn.currency cu ON cu.id = b.currencyFk - WHERE cu.code <> 'EUR' -- no se informa cuando la divisa en EUR - )sub3 ON sub3.account = x.SUBCTA - WHERE x.enlazadoSage = FALSE - AND x.empresa_id = vCompanyFk - AND x.FECHA BETWEEN vDatedFrom AND vDatedTo; - --- Metálicos - UPDATE movConta m - JOIN (SELECT Asiento, - c.socialName name, - c.fi, - n.SiglaNacion, - m.CodigoCuenta, - m.Contrapartida - FROM movConta m - LEFT JOIN vn.client c ON c.id = IF(m.CargoAbono = 'H', - CAST(SUBSTRING(m.CodigoCuenta, 3, LENGTH(m.CodigoCuenta)) AS UNSIGNED), - CAST(SUBSTRING(m.Contrapartida, 3, LENGTH(m.Contrapartida)) AS UNSIGNED)) - LEFT JOIN Naciones n ON n.countryFk = c.countryFk - WHERE m.Metalico347 = TRUE - AND m.enlazadoSage = FALSE - )sub ON m.Asiento = sub.Asiento - SET m.Metalico347 = TRUE, - m.TipoFactura = vInvoiceTypeInformativeCode, - m.CifDni = sub.fi, - m.Nombre = sub.name, - m.SiglaNacion = sub.SiglaNacion - WHERE m.enlazadoSage = FALSE; - - UPDATE movConta m - SET m.Metalico347 = FALSE, - m.TipoFactura = '' - WHERE m.CargoAbono = 'D' - AND m.enlazadoSage = FALSE; - --- Elimina cuentas de cliente/proveedor que no se utilizarán en la importación - DELETE cp - FROM clientesProveedores cp - LEFT JOIN movConta mc ON mc.codigoCuenta = cp.codigoCuenta - AND mc.enlazadoSage = FALSE - WHERE mc.codigoCuenta IS NULL; - --- Elimina cuentas contables que no se utilizarán en la importación - DELETE pc - FROM planCuentasPGC pc - LEFT JOIN movConta mc ON mc.codigoCuenta = pc.codigoCuenta - AND mc.enlazadoSage = FALSE - WHERE mc.codigoCuenta IS NULL; - --- DUAS - UPDATE movConta mci - JOIN vn.XDiario x ON x.ASIEN = mci.Asiento - JOIN TiposIva ti ON ti.CodigoIva = x.IVA - JOIN vn.pgcMaster pm ON pm.code = mci.CodigoCuenta COLLATE utf8_general_ci - SET mci.BaseIva1 = x.BASEEURO, - mci.PorIva1 = x.IVA, - mci.CuotaIva1 = CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)), - mci.CodigoTransaccion1 = vDuaTransactionFk, - mci.CodigoIva1 = vTaxImportReducedFk, - mci.IvaDeducible1 = TRUE, - mci.FechaFacturaOriginal = x.FECHA_EX, - mci.SuFacturaNo = x.FACTURAEX, - mci.FechaOperacion = x.FECHA_OP, - mci.ImporteFactura = mci.ImporteFactura + x.BASEEURO + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) - WHERE pm.description = 'HP Iva pendiente' - AND mci.enlazadoSage = FALSE - AND x.SERIE = vSerialDua COLLATE utf8_general_ci - AND ti.Iva = 'I.V.A. 10% Nacional'; - - UPDATE movConta mci - JOIN vn.XDiario x ON x.ASIEN = mci.Asiento - JOIN TiposIva ti ON ti.CodigoIva = x.IVA - JOIN vn.pgcMaster pm ON pm.code = mci.CodigoCuenta COLLATE utf8_general_ci - SET mci.BaseIva2 = x.BASEEURO , - mci.PorIva2 = x.IVA, - mci.CuotaIva2 = CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10,2)), - mci.CodigoTransaccion2 = vDuaTransactionFk , - mci.CodigoIva2 = vTaxImportFk, - mci.IvaDeducible2 = TRUE, - mci.ImporteFactura = mci.ImporteFactura + x.BASEEURO + CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2)) - WHERE pm.description = 'HP Iva pendiente' - AND mci.enlazadoSage = FALSE - AND x.SERIE = vSerialDua COLLATE utf8_general_ci - AND ti.Iva = 'I.V.A. 21%'; - --- Rectificativas - UPDATE movConta mci - JOIN (SELECT x.ASIEN, x.FECHA_RT, x.SERIE_RT, x.FACTU_RT - FROM movConta mci - JOIN vn.XDiario x ON x.ASIEN = mci.Asiento - WHERE mci.TipoRectificativa > 0 - AND mci.enlazadoSage = FALSE - AND x.FACTU_RT IS NOT NULL - GROUP BY x.ASIEN - ) sub ON sub.ASIEN = mci.Asiento - SET mci.EjercicioFacturaOriginal = YEAR(sub.FECHA_RT), - mci.SerieFacturaOriginal = sub.SERIE_RT, - mci.NumeroFacturaOriginal = sub.FACTU_RT - WHERE mci.TipoRectificativa > 0 AND - mci.enlazadoSage = FALSE ; - --- Exportaciones Andorras y Canarias cambia TT (la cuenta es compartida) - UPDATE movConta mci - SET CodigoTransaccion1 = vTransactionExportTaxFreeFk, - CodigoTransaccion2 = IF(CodigoTransaccion2 = 0, 0, vTransactionExportTaxFreeFk), - CodigoTransaccion3 = IF(CodigoTransaccion3 = 0, 0, vTransactionExportTaxFreeFk), - CodigoTransaccion4 = IF(CodigoTransaccion4 = 0, 0, vTransactionExportTaxFreeFk) - WHERE enlazadoSage = FALSE - AND (CodigoTransaccion1 = vTransactionExportFk - OR CodigoTransaccion2 = vTransactionExportFk - OR CodigoTransaccion3 = vTransactionExportFk - OR CodigoTransaccion4 = vTransactionExportFk) - AND SiglaNacion IN (vCountryCanariasCode COLLATE utf8_general_ci, vCountryCeutaMelillaCode COLLATE utf8_general_ci); - - UPDATE movConta mc - SET CodigoDivisa = 'USD', - FactorCambio = TRUE, - ImporteCambio = ABS( CAST( IF( ImporteDivisa <> 0 AND ImporteCambio = 0, ImporteAsiento / ImporteDivisa, ImporteCambio) AS DECIMAL( 10, 2))) - WHERE enlazadoSage = FALSE - AND (ImporteCambio <> 0 OR ImporteDivisa <> 0 OR FactorCambio); - - UPDATE movConta mc - SET importeDivisa= -importeDivisa - WHERE enlazadoSage = FALSE - AND importeDivisa > 0 - AND ImporteAsiento < 0; - - -- Comprobación que los importes e ivas sean correctos, avisa vía CAU - SELECT GROUP_CONCAT(Asiento ORDER BY Asiento ASC SEPARATOR ' \n\r') INTO vBookEntries - FROM(SELECT sub.Asiento - FROM (SELECT mc.Asiento, SUM(mc.ImporteAsiento) amount - FROM movConta mc - WHERE mc.enlazadoSage = FALSE - GROUP BY mc.Asiento)sub - JOIN (SELECT x.ASIEN, SUM(IFNULL(x.EURODEBE,0) + IFNULL(x.EUROHABER,0)) amount - FROM vn.XDiario x - WHERE x.enlazadoSage = FALSE - GROUP BY ASIEN)sub2 ON sub2.ASIEN = sub.Asiento - WHERE sub.amount <> sub2.amount - UNION ALL - SELECT sub.Asiento - FROM (SELECT Asiento, SUM(BaseIva1 + BaseIva2 + BaseIva3 + BaseIva4) amountTaxableBase - FROM movConta - WHERE TipoFactura <> 'I' - AND enlazadoSage = FALSE - GROUP BY Asiento) sub - JOIN (SELECT ASIEN, SUM(BASEEURO) amountTaxableBase - FROM (SELECT ASIEN, SUM(BASEEURO) BASEEURO - FROM vn.XDiario - WHERE FACTURA + WHERE FACTURA AND auxiliar <> '*' AND enlazadoSage = FALSE GROUP BY FACTURA, ASIEN)sub3 GROUP BY ASIEN) sub2 ON sub2.ASIEN = sub.Asiento - WHERE sub.amountTaxableBase<>sub2.amountTaxableBase + WHERE sub.amountTaxableBase<>sub2.amountTaxableBase AND sub.amountTaxableBase/2 <> sub2.amountTaxableBase) sub; IF vBookEntries IS NOT NULL THEN - CALL vn.mail_insert('cau@verdnatura.es, administracion@verdnatura.es', - 'noreply@verdnatura.es', - CONCAT('Asientos contables importados incorrectamente'), - CONCAT('

Existen asientos que difieren entre la info. de XDiario y la que se ha importado a Sage.

- Asientos nº ', vBookEntries, '
')); + SELECT util.notification_send ("book-entries-imported-incorrectly", CONCAT('{"bookEntries":"', vBookEntries,'"}'), null); END IF; END ;; DELIMITER ; @@ -20785,127 +16918,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 `clientesProveedoresAdd__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clientesProveedoresAdd__`() -BEGIN -TRUNCATE TABLE clientesProveedores; - INSERT INTO clientesProveedores - (CodigoEmpresa, - ClienteOProveedor, - CodigoClienteProveedor, - RazonSocial, - Nombre, - Domicilio, - CodigoCuenta, - CifDni, - CifEuropeo, - CodigoPostal, - Municipio, - CodigoProvincia, - Provincia, - CodigoNacion, - SiglaNacion, - PersonaFisicaJuridica, - TipoDocumentoPersona, - CodigoIva, - Nacion, - Telefono, - Telefono2, - CodigoTransaccion, - CodigoRetencion, - Email1, - iban) - SELECT IF (@@hostname = 'db', c.companyCode, companyCodeTest) CodigoEmpresa, - 'C' ClienteOProveedor, - cl.id CodigoClienteProveedor, - cl.socialName RazonSocial, - cl.name Nombre, - cl.street Domicilio, - cl.accountingAccount CodigoCuenta, - TRIM(IF(co.code = LEFT(cl.fi,2), MID(cl.fi,3, length(cl.fi)-1), cl.fi)) AS CifDni, - IF(sn.NacionCEE,TRIM(CONCAT(co.code, IF(co.code = LEFT(cl.fi,2), MID(cl.fi,3, length(cl.fi)-1), cl.fi))) , "")AS CifEuropeo, - cl.postcode CodigoPostal, - cl.city Municipio, - sp.CodigoProvincia CodigoProvincia, - p.name Provincia, - IF (sn.SiglaNacion = "XB",IF(sp.CodigoProvincia IN (51,52), 22, IF (sp.CodigoProvincia IN (35,38), 21, sn.CodigoNacion)), sn.CodigoNacion) CodigoNacion, - IF (sn.SiglaNacion = "XB",IF(sp.CodigoProvincia IN (51,52), "XC",IF (sp.CodigoProvincia IN (35,38), "XB", sn.SiglaNacion)), sn.SiglaNacion) SiglaNacion, - IF((cl.fi REGEXP '^([[:blank:]]|[[:digit:]])'), 'J','F') PersonaFisicaJuridica, - IF((co.id = 1 OR co.id = 30), 1, IF((co.isUeeMember = 1 AND cl.isVies), 2, 4)) TipoDocumentoPersona, - -- IF(cl.isEqualizated, 'R', IF ((cl.isVies AND cl.countryFk <> 1) OR (NOT co.isUeeMember),'E','I'))AS CodigoIva, - cl.taxTypeSageFk CodigoIva, - IF(sn.SiglaNacion = "XB", IF(sp.CodigoProvincia IN (51,52), "CEUTA Y MELILLA", IF (sp.CodigoProvincia IN (35,38), "ISLAS CANARIAS",sn.Nacion)) , sn.Nacion) Nacion, - cl.phone Telefono, - cl.mobile Telefono2, - cl.transactionTypeSageFk CodigoTransaccion, - 0 CodigoRetencion, - SUBSTR(cl.email, 1, LOCATE(',', CONCAT(cl.email,','))-1) Email1, - cl.iban iban - FROM vn.client cl - JOIN vn2008.v_xsubclien ON v_xsubclien.Id_Cliente = cl.id - LEFT JOIN vn.country co ON co.id = cl.countryFk - LEFT JOIN sage.Naciones sn ON sn.countryFk = co.id - LEFT JOIN vn.province p ON p.id = cl.provinceFk - LEFT JOIN sage.Provincias sp ON sp.provinceFk = p.id - JOIN vn.company c ON c.id = v_xsubclien.empresa_id - WHERE cl.isRelevant AND c.code = 'VNL' - UNION ALL - SELECT IF (@@hostname = 'db', c.companyCode, companyCodeTest) CodigoEmpresa, - 'P' ClienteOProveedor, - s.id CodigoClienteProveedor, - s.name RazonSocial, - s.name Nombre, - s.street Domicilio, - s.account CodigoCuenta, - TRIM(IF(co.code = LEFT(s.nif,2), MID(s.nif,3, length(s.nif)-1), s.nif)) CifDni, - IF(sn.NacionCEE,TRIM(CONCAT(co.code, IF(co.code = LEFT(s.nif,2), MID(s.nif,3, length(s.nif)-1), s.nif))), "") AS CifEuropeo, - s.postCode CodigoPostal, - s.city Municipio, - sp.CodigoProvincia CodigoProvincia, - p.name Provincia, - sn.CodigoNacion CodigoNacion, - sn.SiglaNacion SiglaNacion, - IF((s.nif REGEXP '^([[:blank:]]|[[:digit:]])'),'J','F') PersonaFisicaJuridica, - IF((co.id = 1 OR co.id = 30),1,IF((co.isUeeMember = 1), 2, 4)) TipoDocumentoPersona, - -- 'I' CodigoIva, - s.taxTypeSageFk CodigoIva, - sn.Nacion Nacion, - con.Telefono Telefono, - con.Movil Telefono2, - s.transactionTypeSageFk CodigoTransaccion, - s.withholdingSageFk CodigoRetencion, - SUBSTR(con.email,1,(COALESCE(NULLIF(LOCATE(',', con.email), 0), 99) - 1)) Email1, - sa.iban iban - FROM vn.supplier s - JOIN vn2008.v_xsubprov xsp ON xsp.proveedor_id = s.id -- Proveedores activos los últimos 3 meses - LEFT JOIN vn.country co ON co.id = s.countryFk - LEFT JOIN sage.Naciones sn ON sn.countryFk = co.id - LEFT JOIN vn.province p ON p.id = s.provinceFk - LEFT JOIN sage.Provincias sp ON sp.provinceFk = p.id - LEFT JOIN vn2008.Relaciones r ON r.Id_Proveedor = s.id - LEFT JOIN vn.supplierAccount sa ON sa.supplierFk = s.id - LEFT JOIN vn2008.Contactos con ON con.Id_Contacto = r.Id_Contacto - JOIN vn.company c ON c.id = xsp.empresa_id - WHERE - c.code = 'VNL' AND - s.isActive AND - s.nif <> '' -GROUP BY xsp.proveedor_id , xsp.empresa_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 `clientSupplier_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20919,18 +16931,18 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clientSupplier_add`(vCompanyFk INT) BEGIN /** - * Prepara los datos de clientes y proveedores para exportarlos a Sage + * Prepara los datos de clientes y proveedores para exportarlos a Sage * @vCompanyFk Empresa dela que se quiere trasladar datos */ DECLARE vCountryCeutaMelillaFk INT; DECLARE vCountryCanariasCode, vCountryCeutaMelillaCode VARCHAR(2); SELECT SiglaNacion INTO vCountryCanariasCode - FROM Naciones + FROM Naciones WHERE Nacion ='ISLAS CANARIAS'; SELECT CodigoNacion, SiglaNacion INTO vCountryCeutaMelillaFk, vCountryCeutaMelillaCode - FROM Naciones + FROM Naciones WHERE Nacion ='CEUTA Y MELILLA'; TRUNCATE TABLE clientesProveedores; @@ -20961,8 +16973,8 @@ BEGIN CodigoRetencion, Email1, iban) - SELECT - IF (@@hostname = 'db', co.companyCode, co.companyCodeTest), + SELECT + company_getCode(vCompanyFk), 'C', c.id, c.socialName, @@ -20975,15 +16987,15 @@ BEGIN IFNULL(c.city, ''), IFNULL(pr.CodigoProvincia, ''), IFNULL(p.name, ''), - IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8_general_ci, IF(@isCeutaMelilla := IF(pr.Provincia IN ('CEUTA', 'MELILLA'), TRUE, FALSE), vCountryCeutaMelillaFk, IF (@isCanarias, vCountryCanariasCode, n.CodigoNacion)), n.CodigoNacion), - IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8_general_ci, IF(@isCeutaMelilla, vCountryCeutaMelillaCode, IF (@isCanarias, vCountryCanariasCode, n.SiglaNacion)), n.SiglaNacion), + IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci, IF(@isCeutaMelilla := IF(pr.Provincia IN ('CEUTA', 'MELILLA'), TRUE, FALSE), vCountryCeutaMelillaFk, IF (@isCanarias, vCountryCanariasCode, n.CodigoNacion)), n.CodigoNacion), + IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci, IF(@isCeutaMelilla, vCountryCeutaMelillaCode, IF (@isCanarias, vCountryCanariasCode, n.SiglaNacion)), n.SiglaNacion), IF((c.fi REGEXP '^([[:blank:]]|[[:digit:]])'), 'J','F'), - IF(cu.code IN('ES','EX'), - 1, + IF(cu.code IN('ES','EX'), + 1, IF((cu.isUeeMember AND c.isVies), 2, 4)), IFNULL(c.taxTypeSageFk,0), - IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8_general_ci, - IF(@isCeutaMelilla, 'CEUTA Y MELILLA', IF (@isCanarias, 'ISLAS CANARIAS', n.Nacion)), + IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci, + IF(@isCeutaMelilla, 'CEUTA Y MELILLA', IF (@isCanarias, 'ISLAS CANARIAS', n.Nacion)), n.Nacion), IFNULL(c.phone, ''), IFNULL(c.mobile, ''), @@ -20993,15 +17005,14 @@ BEGIN IFNULL(c.iban, '') FROM vn.`client` c JOIN clientLastTwoMonths clm ON clm.clientFk = c.id - JOIN vn.company co ON co.id = clm.companyFk LEFT JOIN vn.country cu ON cu.id = c.countryFk LEFT JOIN Naciones n ON n.countryFk = cu.id LEFT JOIN vn.province p ON p.id = c.provinceFk LEFT JOIN Provincias pr ON pr.provinceFk = p.id - WHERE c.isRelevant - AND co.id = vCompanyFk + WHERE c.isRelevant + AND clm.companyFk = vCompanyFk UNION ALL - SELECT IF (@@hostname = 'db', c.companyCode, companyCodeTest), + SELECT company_getCode(vCompanyFk), 'P', s.id, s.name, @@ -21015,169 +17026,27 @@ BEGIN IFNULL(pr.CodigoProvincia, ''), IFNULL(p.name, ''), n.CodigoNacion, - n.SiglaNacion COLLATE utf8_general_ci, + n.SiglaNacion COLLATE utf8mb3_unicode_ci, IF((s.nif REGEXP '^([[:blank:]]|[[:digit:]])'),'J','F'), IF(co.country IN ('España', 'España exento'), 1,IF(co.isUeeMember = 1, 2, 4)), IFNULL(s.taxTypeSageFk, 0), n.Nacion, - IFNULL(con.Telefono, ''), - IFNULL(con.Movil, ''), + IFNULL(sc.phone, ''), + IFNULL(sc.mobile, ''), IFNULL(s.transactionTypeSageFk, 0), IFNULL(s.withholdingSageFk, '0'), - IFNULL(SUBSTR(con.email, 1, (COALESCE(NULLIF(LOCATE(',', con.email), 0), 99) - 1)), ''), + IFNULL(SUBSTR(sc.email, 1, (COALESCE(NULLIF(LOCATE(',', sc.email), 0), 99) - 1)), ''), IFNULL(iban, '') FROM vn.supplier s - JOIN providerLastThreeMonths pl ON pl.supplierFk = s.id + JOIN supplierLastThreeMonths pl ON pl.supplierFk = s.id LEFT JOIN vn.country co ON co.id = s.countryFk LEFT JOIN Naciones n ON n.countryFk = co.id LEFT JOIN vn.province p ON p.id = s.provinceFk LEFT JOIN Provincias pr ON pr.provinceFk = p.id - LEFT JOIN vn2008.Relaciones r ON r.Id_Proveedor = s.id + LEFT JOIN vn.supplierContact sc ON sc.supplierFk = s.id LEFT JOIN vn.supplierAccount sa ON sa.supplierFk = s.id - LEFT JOIN vn2008.Contactos con ON con.Id_Contacto = r.Id_Contacto - JOIN vn.company c ON c.id = pl.companyFk - WHERE c.id = vCompanyFk AND - s.isActive AND - s.nif <> '' - GROUP BY pl.supplierFk, pl.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 `clientSupplier_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 `clientSupplier_add__`(vCompanyFk INT) -BEGIN -/** - * Prepara los datos de clientes y proveedores para exportarlos a Sage - * @vCompanyFk Empresa dela que se quiere trasladar datos - */ - DECLARE vCountryCeutaMelillaFk INT; - DECLARE vCountryCanariasCode, vCountryCeutaMelillaCode VARCHAR(2); - - SELECT SiglaNacion INTO vCountryCanariasCode - FROM Naciones - WHERE Nacion ='ISLAS CANARIAS'; - - SELECT CodigoNacion, SiglaNacion INTO vCountryCeutaMelillaFk, vCountryCeutaMelillaCode - FROM Naciones - WHERE Nacion ='CEUTA Y MELILLA'; - - TRUNCATE TABLE clientesProveedores; - - INSERT INTO clientesProveedores - (CodigoEmpresa, - ClienteOProveedor, - CodigoClienteProveedor, - RazonSocial, - Nombre, - Domicilio, - CodigoCuenta, - CifDni, - CifEuropeo, - CodigoPostal, - Municipio, - CodigoProvincia, - Provincia, - CodigoNacion, - SiglaNacion, - PersonaFisicaJuridica, - TipoDocumentoPersona, - CodigoIva, - Nacion, - Telefono, - Telefono2, - CodigoTransaccion, - CodigoRetencion, - Email1, - iban) - SELECT - IF (@@hostname = 'db', co.companyCode, co.companyCodeTest), - 'C', - c.id, - c.socialName, - c.name, - IFNULL(c.street, ''), - c.accountingAccount, - TRIM(IF(cu.code = LEFT(c.fi, 2), MID(c.fi, 3, LENGTH(c.fi)-1), c.fi)), - IF(n.NacionCEE,TRIM(CONCAT(cu.code, IF(cu.code = LEFT(c.fi,2), MID(c.fi,3, LENGTH(c.fi)-1), c.fi))) , ''), - IFNULL(c.postcode, ''), - IFNULL(c.city, ''), - IFNULL(pr.CodigoProvincia, ''), - IFNULL(p.name, ''), - IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8_general_ci, IF(@isCeutaMelilla := IF(pr.Provincia IN ('CEUTA', 'MELILLA'), TRUE, FALSE), vCountryCeutaMelillaFk, IF (@isCanarias, vCountryCanariasCode, n.CodigoNacion)), n.CodigoNacion), - IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8_general_ci, IF(@isCeutaMelilla, vCountryCeutaMelillaCode, IF (@isCanarias, vCountryCanariasCode, n.SiglaNacion)), n.SiglaNacion), - IF((c.fi REGEXP '^([[:blank:]]|[[:digit:]])'), 'J','F'), - IF(cu.code IN('ES','EX'), - 1, - IF((cu.isUeeMember AND c.isVies), 2, 4)), - IFNULL(c.taxTypeSageFk,0), - IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8_general_ci, - IF(@isCeutaMelilla, 'CEUTA Y MELILLA', IF (@isCanarias, 'ISLAS CANARIAS', n.Nacion)), - n.Nacion), - IFNULL(c.phone, ''), - IFNULL(c.mobile, ''), - IFNULL(c.transactionTypeSageFk, 0), - '0', - IFNULL(SUBSTR(c.email, 1, LOCATE(',', CONCAT(c.email, ','))-1), ''), - IFNULL(c.iban, '') - FROM vn.`client` c - JOIN clientLastTwoMonths clm ON clm.clientFk = c.id - JOIN vn.company co ON co.id = clm.companyFk - LEFT JOIN vn.country cu ON cu.id = c.countryFk - LEFT JOIN Naciones n ON n.countryFk = cu.id - LEFT JOIN vn.province p ON p.id = c.provinceFk - LEFT JOIN Provincias pr ON pr.provinceFk = p.id - WHERE c.isRelevant - AND co.id = vCompanyFk - UNION ALL - SELECT IF (@@hostname = 'db', c.companyCode, companyCodeTest), - 'P', - s.id, - s.name, - s.name, - IFNULL(s.street, ''), - s.account, - TRIM(IF(co.code = LEFT(s.nif, 2), MID(s.nif, 3, LENGTH(s.nif) - 1), s.nif)), - IF(n.NacionCEE, TRIM(CONCAT(co.code, IF(co.code = LEFT(s.nif, 2), MID(s.nif, 3, LENGTH(s.nif) - 1), s.nif))), ''), - IFNULL(s.postCode,''), - IFNULL(s.city, ''), - IFNULL(pr.CodigoProvincia, ''), - IFNULL(p.name, ''), - n.CodigoNacion, - n.SiglaNacion COLLATE utf8_general_ci, - IF((s.nif REGEXP '^([[:blank:]]|[[:digit:]])'),'J','F'), - IF(co.country IN ('España', 'España exento'), 1,IF(co.isUeeMember = 1, 2, 4)), - IFNULL(s.taxTypeSageFk, 0), - n.Nacion, - IFNULL(con.Telefono, ''), - IFNULL(con.Movil, ''), - IFNULL(s.transactionTypeSageFk, 0), - IFNULL(s.withholdingSageFk, '0'), - IFNULL(SUBSTR(con.email, 1, (COALESCE(NULLIF(LOCATE(',', con.email), 0), 99) - 1)), ''), - IFNULL(iban, '') - FROM vn.supplier s - JOIN providerLastThreeMonths pl ON pl.supplierFk = s.id - LEFT JOIN vn.country co ON co.id = s.countryFk - LEFT JOIN Naciones n ON n.countryFk = co.id - LEFT JOIN vn.province p ON p.id = s.provinceFk - LEFT JOIN Provincias pr ON pr.provinceFk = p.id - LEFT JOIN vn2008.Relaciones r ON r.Id_Proveedor = s.id - LEFT JOIN vn.supplierAccount sa ON sa.supplierFk = s.id - LEFT JOIN vn2008.Contactos con ON con.Id_Contacto = r.Id_Contacto - JOIN vn.company c ON c.id = pl.companyFk - WHERE c.id = vCompanyFk AND - s.isActive AND + WHERE pl.companyFk = vCompanyFk AND + s.isActive AND s.nif <> '' GROUP BY pl.supplierFk, pl.companyFk; END ;; @@ -21200,10 +17069,10 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceIn_add`(vInvoiceInFk INT, vX BEGIN /** * Traslada la info de contabilidad relacionada con las facturas recibidas - * + * * @vInvoiceInFk Factura recibida * @vXDiarioFk Id tabla XDiario - */ + */ DECLARE vDone BOOL DEFAULT FALSE; DECLARE vBase DOUBLE; DECLARE vVat DOUBLE; @@ -21219,24 +17088,24 @@ BEGIN DECLARE vInvoiceTypeReceived VARCHAR(1); DECLARE vInvoiceTypeInformative VARCHAR(1); - DECLARE vCursor CURSOR FOR + DECLARE vCursor CURSOR FOR SELECT it.taxableBase, CAST((( it.taxableBase / 100) * t.PorcentajeIva) AS DECIMAL (10,2)), t.PorcentajeIva, it.transactionTypeSageFk, it.taxTypeSageFk, t.isIntracommunity, - tt.ClaveOperacionDefecto + tt.ClaveOperacionDefecto FROM vn.invoiceIn i - JOIN vn.invoiceInTax it ON it.InvoiceInFk = i.id + JOIN vn.invoiceInTax it ON it.InvoiceInFk = i.id JOIN TiposIva t ON t.CodigoIva = it.taxTypeSageFk JOIN TiposTransacciones tt ON tt.CodigoTransaccion = it.transactionTypeSageFk LEFT JOIN vn.dua d ON d.id = vInvoiceInFk - WHERE i.id = vInvoiceInFk + WHERE i.id = vInvoiceInFk AND d.id IS NULL; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + DELETE FROM movContaIVA WHERE id = vXDiarioFk; @@ -21259,22 +17128,22 @@ BEGIN vTaxCode, vIsIntracommunity, vOperationCode; - - IF vDone THEN + + IF vDone THEN LEAVE l; END IF; - SET vTransactionCodeOld = vTransactionCode; - SET vTaxCodeOld = vTaxCode; + SET vTransactionCodeOld = vTransactionCode; + SET vTaxCodeOld = vTaxCode; - IF vOperationCode IS NOT NULL THEN + IF vOperationCode IS NOT NULL THEN UPDATE movContaIVA SET ClaveOperacionFactura = vOperationCode WHERE id = vXDiarioFk; END IF; - + SET vCounter = vCounter + 1; - CASE vCounter + CASE vCounter WHEN 1 THEN UPDATE movContaIVA SET BaseIva1 = vBase, @@ -21310,21 +17179,21 @@ BEGIN WHERE id = vXDiarioFk; ELSE SELECT vXDiarioFk INTO vXDiarioFk; - END CASE; + END CASE; IF vIsIntracommunity THEN UPDATE movContaIVA SET Intracomunitaria = TRUE WHERE id = vXDiarioFk; END IF; - - SET vTransactionCodeOld = vTransactionCode; - SET vTaxCodeOld = vTaxCode; - + + SET vTransactionCodeOld = vTransactionCode; + SET vTaxCodeOld = vTaxCode; + END LOOP; CLOSE vCursor; - + UPDATE movContaIVA mci JOIN tmp.invoiceIn ii ON ii.id = vInvoiceInFk JOIN vn.XDiario x ON x.id = mci.id @@ -21336,11 +17205,11 @@ BEGIN mci.Serie = ii.serial, mci.Factura = ii.serialNumber, mci.FechaFactura = ii.issued, - mci.ImporteFactura = IFNULL(mci.BaseIva1, 0) + IFNULL(mci.CuotaIva1, 0) + - IFNULL(mci.BaseIva2, 0) + IFNULL(mci.CuotaIva2, 0) + - IFNULL(mci.BaseIva3, 0) + IFNULL(mci.CuotaIva3, 0) + + mci.ImporteFactura = IFNULL(mci.BaseIva1, 0) + IFNULL(mci.CuotaIva1, 0) + + IFNULL(mci.BaseIva2, 0) + IFNULL(mci.CuotaIva2, 0) + + IFNULL(mci.BaseIva3, 0) + IFNULL(mci.CuotaIva3, 0) + IFNULL(mci.BaseIva4, 0) + IFNULL(mci.CuotaIva4, 0), - mci.TipoFactura = IF(id.id, IF( ii.serial = vSerialDua, vInvoiceTypeReceived, vInvoiceTypeInformative), vInvoiceTypeReceived), + mci.TipoFactura = IF(id.id, IF( ii.serial = vSerialDua COLLATE utf8mb3_unicode_ci, vInvoiceTypeReceived, vInvoiceTypeInformative), vInvoiceTypeReceived), mci.CodigoCuentaFactura = x.SUBCTA, mci.CifDni = IF(LEFT(TRIM(s.nif), 2) = n.SiglaNacion, SUBSTRING(TRIM(s.nif), 3), s.nif), mci.Nombre = s.name, @@ -21364,10 +17233,11 @@ BEGIN JOIN vn.invoiceInTax iit ON iit.invoiceInFk = ii.id JOIN vn.expence e ON e.id = iit.expenceFk JOIN TiposRetencion t ON t.CodigoRetencion = ii.withholdingSageFk + LEFT JOIN tmp.invoiceDua id ON id.id = mci.id JOIN (SELECT SUM(x2.BASEEURO) taxableBase, SUM(x2.EURODEBE) taxBase FROM vn.XDiario x1 JOIN vn.XDiario x2 ON x1.ASIEN = x2.ASIEN - WHERE x2.BASEEURO <> 0 + WHERE x2.BASEEURO <> 0 AND x1.id = vXDiarioFk )sub JOIN ClavesOperacion co ON co.Descripcion = 'Arrendamiento de locales de negocio' @@ -21375,9 +17245,10 @@ BEGIN mci.ClaveOperacionFactura = IF( t.Retencion = 'ARRENDAMIENTO Y SUBARRENDAMIENTO', co.ClaveOperacionFactura_, mci.ClaveOperacionFactura), mci.BaseRetencion = IF (t.Retencion = 'ACTIVIDADES AGRICOLAS O GANADERAS', sub.taxableBase + sub.taxBase, sub.taxableBase), mci.PorRetencion = t.PorcentajeRetencion, - mci.ImporteRetencion = iit.taxableBase * - 1 - WHERE mci.id = vXDiarioFk - AND e.name = 'Retenciones'; + mci.ImporteRetencion = iit.taxableBase * - 1 + WHERE mci.id = vXDiarioFk + AND e.name = 'Retenciones' + AND id.id IS NULL; END ;; DELIMITER ; @@ -21398,10 +17269,10 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceIn_manager`(vYear INT, vCompanyFk INT) BEGIN /** - * Traslada la info de contabilidad relacionada con las facturas recibidas - * + * Traslada la info de contabilidad relacionada con las facturas recibidas + * * @vYear Año contable del que se quiere trasladar la información - * @vCompany Empresa de la que se quiere trasladar datos + * @vCompany Empresa de la que se quiere trasladar datos */ DECLARE vDone BOOL DEFAULT FALSE; DECLARE vInvoiceFk INT; @@ -21413,22 +17284,22 @@ BEGIN DECLARE vAccountTaxOutstanding VARCHAR(10); DECLARE vInvoiceTypeSended VARCHAR(1); DECLARE vCursor CURSOR FOR - SELECT IFNULL(x.CLAVE, x.FACTURA) invoiceInFk, + SELECT IFNULL(x.CLAVE, x.FACTURA) invoiceInFk, x.id XDiarioFk - FROM vn.XDiario x + FROM vn.XDiario x JOIN(SELECT DISTINCT(x.ASIEN) FROM vn.XDiario x LEFT JOIN vn.invoiceIn ii ON x.CLAVE = ii.id LEFT JOIN vn.invoiceInTax it ON it.invoiceInFk = ii.id - WHERE(it.taxTypeSageFk IS NOT NULL OR x.SERIE = vSerialDua COLLATE utf8_general_ci) - AND x.enlazadoSage = FALSE + WHERE(it.taxTypeSageFk IS NOT NULL OR x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci) + AND x.enlazadoSage = FALSE AND x.FECHA BETWEEN vDatedFrom AND vDatedTo - AND x.empresa_id = vCompanyFk + AND x.empresa_id = vCompanyFk ) sub ON sub.ASIEN = x.ASIEN WHERE x.CLAVE IS NOT NULL; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + SELECT CAST(CONCAT(vYear, '-01-01') AS DATETIME), util.dayEnd(CAST(CONCAT(vYear, '-12-31') AS DATE)) INTO vDatedFrom, vDatedTo; @@ -21442,16 +17313,16 @@ BEGIN SELECT codeSage INTO vInvoiceTypeSended FROM invoiceType WHERE `code` ='sended'; - + DROP TEMPORARY TABLE IF EXISTS tmp.invoiceDua; CREATE TEMPORARY TABLE tmp.invoiceDua - SELECT x.id + SELECT x.id FROM vn.XDiario x JOIN vn.company c ON c.id = x.empresa_id JOIN (SELECT ASIEN - FROM vn.XDiario x - WHERE x.enlazadoSage = FALSE - AND x.SUBCTA = vAccountTaxOutstanding COLLATE utf8_general_ci + FROM vn.XDiario x + WHERE x.enlazadoSage = FALSE + AND x.SUBCTA = vAccountTaxOutstanding COLLATE utf8mb3_unicode_ci AND x.FECHA BETWEEN vDatedFrom AND vDatedTo )sub ON sub.ASIEN = x.ASIEN WHERE NOT x.CONTRA <=> vAccountVNL; @@ -21460,7 +17331,7 @@ BEGIN CREATE TEMPORARY TABLE tmp.invoiceIn SELECT i.id, i.supplierRef, - i.serial COLLATE utf8_general_ci serial, + i.serial COLLATE utf8mb3_unicode_ci serial, i.supplierFk, i.issued, IF(expenceFkDeductible, FALSE, i.isVatDeductible) isVatDeductible, @@ -21469,7 +17340,7 @@ BEGIN FROM vn.invoiceIn i JOIN vn.currency c ON c.id = i.currencyFk WHERE i.bookEntried BETWEEN vDatedFrom AND vDatedTo - UNION ALL + UNION ALL SELECT d.id, d.code, vSerialDua, @@ -21478,8 +17349,8 @@ BEGIN FALSE, d.id, '' -- EUROS - FROM vn.dua d - WHERE d.issued IS NOT NULL + FROM vn.dua d + WHERE d.issued IS NOT NULL AND code IS NOT NULL; OPEN vCursor; @@ -21487,7 +17358,7 @@ BEGIN l: LOOP FETCH vCursor INTO vInvoiceFk, vXDiarioFk; - IF vDone THEN + IF vDone THEN LEAVE l; END IF; CALL invoiceIn_add(vInvoiceFk, vXDiarioFk); @@ -21575,21 +17446,21 @@ BEGIN JOIN (SELECT x.ASIEN, x.id FROM vn.XDiario x JOIN(SELECT DISTINCT(x.ASIEN) ASIEN - FROM vn.XDiario x + FROM vn.XDiario x JOIN (SELECT DISTINCT(ASIEN) FROM vn.XDiario x - WHERE SUBCTA LIKE '472%' + WHERE SUBCTA LIKE '472%' AND x.enlazadoSage = FALSE AND x.empresa_id = vCompanyFk AND x.FECHA BETWEEN vDatedFrom AND vDatedTo ) sub ON sub.ASIEN = x.ASIEN WHERE x.SUBCTA LIKE '477%' )sub2 ON sub2.ASIEN = x.ASIEN - WHERE x.CONTRA IS NOT NULL + WHERE x.CONTRA IS NOT NULL AND x.SUBCTA LIKE '477%' GROUP BY x.ASIEN )sub3 ON sub3.ASIEN = x.ASIEN; - + INSERT INTO movContaIVA (`id`, `CodigoDivisa`, @@ -21660,9 +17531,9 @@ BEGIN `FechaGrabacion`, `Intracomunitaria`, `moveData`) - SELECT * + SELECT * FROM tmp.movContaIVA; - + DROP TEMPORARY TABLE tmp.movContaIVA; END ;; @@ -21684,10 +17555,10 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_add`(IN vInvoiceOutFk INT, IN vXDiarioFk INT) BEGIN /** - * Traslada la info de contabilidad relacionada con las facturas emitidas - * + * Traslada la info de contabilidad relacionada con las facturas emitidas + * * @vYear Año contable del que se quiere trasladar la información - * @vCompany Empresa de la que se quiere trasladar datos + * @vCompany Empresa de la que se quiere trasladar datos */ DECLARE vDone BOOL DEFAULT FALSE; DECLARE vMaxLengthName INT DEFAULT 35; @@ -21704,14 +17575,15 @@ BEGIN DECLARE vIsIntracommunity BOOL DEFAULT FALSE; DECLARE vInvoiceTypeSended VARCHAR(1); DECLARE vOperationCode VARCHAR(1); - + DECLARE vHasCustomsAccountingNote BOOL; + DECLARE vCursor CURSOR FOR - SELECT oit.taxableBase, - oit.vat, - pgc.rate, - pgc.mod347, - pgcRE.rate, - oitRE.vat, + SELECT oit.taxableBase, + oit.vat, + pgc.rate, + pgc.mod347, + pgcRE.rate, + oitRE.vat, tc.transactionCode, tc.taxCode, tc.isIntracommunity, @@ -21720,22 +17592,28 @@ BEGIN JOIN vn.pgc ON pgc.code = oit.pgcFk LEFT JOIN vn.pgcEqu e ON e.vatFk = oit.pgcFk LEFT JOIN vn.pgcEqu eRE ON eRE.equFk = oit.pgcFk - LEFT JOIN vn.invoiceOutTax oitRE ON oitRE.invoiceOutFk = oit.invoiceOutFk + LEFT JOIN vn.invoiceOutTax oitRE ON oitRE.invoiceOutFk = oit.invoiceOutFk AND oitRE.pgcFk = e.equFk LEFT JOIN vn.pgc pgcRE ON pgcRE.code = oitRE.pgcFk - LEFT JOIN vn.taxCode tc ON tc.code = pgc.code COLLATE 'utf8_general_ci' + LEFT JOIN vn.taxCode tc ON tc.code = pgc.code COLLATE 'utf8mb3_unicode_ci' WHERE eRE.equFk IS NULL AND oit.invoiceOutFk = vInvoiceOutFk GROUP BY pgc.code; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + + SELECT COUNT(*) INTO vHasCustomsAccountingNote + FROM vn.XDiario x + JOIN config c ON c.pendingTaxAccount = x.SUBCTA + WHERE ASIEN = (SELECT ASIEN FROM vn.XDiario WHERE id = vXDiarioFk); + SELECT codeSage INTO vInvoiceTypeSended - FROM invoiceType WHERE code ='sended'; - + FROM invoiceType + WHERE code = IF(vHasCustomsAccountingNote, 'informative', 'sended'); + DELETE FROM movContaIVA WHERE id = vXDiarioFk; - + INSERT INTO movContaIVA(id) VALUES (vXDiarioFk); OPEN vCursor; @@ -21752,13 +17630,13 @@ BEGIN vIsIntracommunity, vOperationCode; - IF vDone THEN + IF vDone THEN LEAVE l; END IF; SET vCounter = vCounter + 1; - - CASE vCounter + + CASE vCounter WHEN 1 THEN UPDATE movContaIVA SET BaseIva1 = vBase, @@ -21799,7 +17677,7 @@ BEGIN CodigoTransaccion4 = vTransactionCode, CodigoIva4 = vTaxCode WHERE id = vXDiarioFk; - END CASE; + END CASE; UPDATE movContaIVA SET Exclusion347 = NOT vMod347, @@ -21810,7 +17688,7 @@ BEGIN END LOOP; CLOSE vCursor; - + UPDATE movContaIVA mci JOIN vn.invoiceOut i ON i.id = vInvoiceOutFk LEFT JOIN vn.invoiceCorrection ic ON ic.correctedFk = vInvoiceOutFk @@ -21835,25 +17713,25 @@ BEGIN mci.MantenerAsiento = TRUE, mci.FechaFacturaOriginal = x.FECHA_EX WHERE mci.id = vXDiarioFk; - + SELECT correctedFk INTO vInvoiceOutCorrectedFk FROM vn.invoiceCorrection WHERE correctingFk = vInvoiceOutFk; - - IF vInvoiceOutCorrectedFk THEN + + IF vInvoiceOutCorrectedFk THEN UPDATE movContaIVA mci JOIN vn.invoiceOut i ON i.id = vInvoiceOutCorrectedFk JOIN vn.invoiceCorrection ic ON ic.correctedFk = vInvoiceOutCorrectedFk - JOIN (SELECT SUM(IF(IFNULL(e.vatFk, TRUE), iot.taxableBase, 0)) taxableBase, + JOIN (SELECT SUM(IF(IFNULL(e.vatFk, TRUE), iot.taxableBase, 0)) taxableBase, SUM(IF(IFNULL(e.vatFk, TRUE), iot.vat, 0)) vat, SUM(IF(IFNULL(e.vatFk, TRUE), 0, iot.vat)) equ FROM vn.invoiceOutTax iot - LEFT JOIN vn.pgcEqu e ON e.vatFk = iot.pgcFk + LEFT JOIN vn.pgcEqu e ON e.vatFk = iot.pgcFk WHERE iot.invoiceOutFk = vInvoiceOutCorrectedFk ) tax JOIN ClavesOperacion co ON co.Descripcion = 'Factura rectificativa' SET mci.TipoRectificativa = 2, - mci.ClaseAbonoRectificativas = 1, + mci.ClaseAbonoRectificativas = 1, mci.FechaFacturaOriginal = i.issued, mci.FechaOperacion = i.issued, mci.BaseImponibleOriginal = tax.taxableBase, @@ -21884,10 +17762,10 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_manager`(vYear INT, vCompanyFk INT) BEGIN /** - * Traslada la info de contabilidad relacionada con las facturas emitidas - * + * Traslada la info de contabilidad relacionada con las facturas emitidas + * * @vYear Año contable del que se quiere trasladar la información - * @vCompany Empresa de la que se quiere trasladar datos + * @vCompany Empresa de la que se quiere trasladar datos */ DECLARE vDone BOOL DEFAULT FALSE; DECLARE vInvoiceFk INT; @@ -21904,7 +17782,7 @@ BEGIN JOIN (SELECT x.ASIEN, CONCAT(x.SERIE, x.FACTURA) refFk FROM vn.XDiario x WHERE x.enlazadoSage = FALSE - AND x.FACTURA + AND x.FACTURA AND x.empresa_id = vCompanyFk AND x.FECHA BETWEEN vDatedFrom AND vDatedTo GROUP BY refFk @@ -21913,580 +17791,25 @@ BEGIN )sub2 ON sub2.refFk = i.ref; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + SELECT CAST(CONCAT(vYear, '-01-01') AS DATETIME), util.dayEnd(CAST(CONCAT(vYear, '-12-31') AS DATE)) INTO vDatedFrom, vDatedTo; - + OPEN vCursor; l: LOOP FETCH vCursor INTO vInvoiceFk, vXDiarioFk; - IF vDone THEN + IF vDone THEN LEAVE l; END IF; - + CALL invoiceOut_add(vInvoiceFk, vXDiarioFk); 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 `movContaAdd__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `movContaAdd__`() -BEGIN - /* Copia en movConta los asientos de XDiario para que luego los importe el proceso automático que hay en SQL Server - */ - DECLARE vDated DATE; - SELECT CONCAT(YEAR(util.VN_CURDATE()), "-01-01") INTO vDated; -SELECT "2021-01-01" INTO vDated; - TRUNCATE XDiario_movConta_IVA; - DELETE FROM movConta WHERE enlazadoSage = FALSE AND Asiento <> 1 ; - CALL clientesProveedoresAdd; - CALL planCuentasPgcAdd; - CALL XDiario_movConta_IVA_InvoiceOutAdd_Manager; - CALL XDiario_movConta_IVA_InvoiceInAdd_Manager; - INSERT INTO movConta( - TipoEntrada, -- VARCHAR(2) - Ejercicio, -- Año - CodigoEmpresa, -- ENT(2) - Asiento, -- LONG(4), nº ASIENTO - CargoAbono, -- VARCHAR(1) "D" debe ó "H" haber - CodigoCuenta, -- VARCHAR(15) partida contable - Contrapartida, -- VARCHAR(15) partida contable - FechaAsiento, -- FECHA(8) - Comentario, -- VARCHAR(40) - ImporteAsiento, -- DOBLE(19) - NumeroPeriodo, -- ENT(2) "-1" Al informar este valor se calcula automát. A partir de la fecha de asiento - FechaGrabacion, -- FECHA(8) - CodigoDivisa, -- VARCHAR(3) - ImporteCambio, -- DOBLE(19) - ImporteDivisa, -- DOBLE(19) - FactorCambio, -- DOBLE(19) - IdProcesoIME, -- GUID(16) - TipoCarteraIME, -- ENT(2) "0" para que no genere cartera - TipoAnaliticaIME, -- ENT(2) - StatusTraspasadoIME, -- BYTE "0" para dejar como no importado aún - TipoImportacionIME, -- BYTE "0" Alta "1" Baja - Metalico347, -- ENT(2) - /* ESTOS CAMPOS SOLO SE INFORMAN EN EL CASO DE SER FACTURA */ - BaseIva1, -- DOBLE(19) - PorBaseCorrectora1, -- DOBLE(19) - PorIva1, -- DOBLE(19) - CuotaIva1, -- DOBLE(19) - PorRecargoEquivalencia1,-- DOBLE(19) - RecargoEquivalencia1, -- DOBLE(19) - CodigoTransaccion1, -- BYTE "0" Nacional "1" Intracomunitario "2" Extracomunitario - BaseIva2, - PorBaseCorrectora2, - PorIva2, - CuotaIva2, - PorRecargoEquivalencia2, - RecargoEquivalencia2, - CodigoTransaccion2, - BaseIva3, - PorBaseCorrectora3, - PorIva3, - CuotaIva3, - PorRecargoEquivalencia3, - RecargoEquivalencia3, - CodigoTransaccion3, - BaseIva4, - PorBaseCorrectora4, - PorIva4, - CuotaIva4, - PorRecargoEquivalencia4, - RecargoEquivalencia4, - CodigoTransaccion4, - Año, -- ENT(2) - Serie, -- VARCHAR(10) - Factura, -- LONG(4) - SuFacturaNo, -- VARCHAR(40) - FechaFactura, -- FECHA(8) - ImporteFactura, -- DOBLE(19) - TipoFactura, -- VARCHAR(1) "E" / "R" / "I" - CodigoCuentaFactura, -- VARCHAR(15) cuenta del cliente/proveedor - CifDni, -- VARCHAR(13) - Nombre, -- VARCHAR(35) - CodigoRetencion, -- ENT(2) - BaseRetencion, -- DOBLE(19) - PorRetencion, -- DOBLE(19) - ImporteRetencion, -- DOBLE(19) - SiglaNacion, -- VARCHAR(2) "ES" por defecto - EjercicioFactura, -- ENT(2) - FechaOperacion, -- FECHA(8) - Exclusion347, -- ENT(2) - MantenerAsiento, -- BYTE "-1" mantener "0" Sage asigna nuevo - ClaveOperacionFactura_, -- VARCHAR(1) P(4721000011,4721000021)-I(4721000015-4720000005-4720000006)-D (Rectificativas) - TipoRectificativa, -- ENT(2) - FechaFacturaOriginal, -- FECHA(8) - BaseImponibleOriginal, -- DOBLE(19) - CuotaIvaOriginal, -- DOBLE(19) - ClaseAbonoRectificativas,-- ENT(2) - RecargoEquivalenciaOriginal, -- DOBLE(19) */ - LibreA1, - CodigoIva1, -- ENT(6) - CodigoIva2, -- ENT(6) - CodigoIva3, -- ENT(6) - CodigoIva4, -- ENT(6) - IvaDeducible1, -- Entero 2 ((-1)) - IvaDeducible2, -- Entero 2 ((-1)) - IvaDeducible3, -- Entero 2 ((-1)) - IvaDeducible4, -- Entero 2 ((-1))-- ENT(6) - Intracomunitaria -- INT(2) - ) - SELECT 'EN' as TipoEntrada, - YEAR(x.FECHA) AS Ejercicio, - IF (@@hostname = 'db', c.companyCode, companyCodeTest) AS CodigoEmpresa, -- ENT(2) c.companyCode AS CodigoEmpresa, - x.ASIEN AS Asiento, -- LONG(4), nº ASIENTO - IF(EURODEBE<>0 OR (EURODEBE=0 AND EUROHABER IS NULL),'D','H')AS CargoAbono, -- IF(EURODEBE IS NULL,"H","D") AS CargoAbono, VARCHAR(1) "D" debe ó "H" haber - x.SUBCTA AS CodigoCuenta, -- VARCHAR(15) partida contable - x.CONTRA AS Contrapartida, -- VARCHAR(15) partida contable - x.FECHA AS FechaAsiento, -- FECHA(8) - SUBSTRING(x.CONCEPTO, 1, 40) AS Comentario, -- VARCHAR(40) - IF(x.EURODEBE,x.EURODEBE,x.EUROHABER) AS ImporteAsiento, -- DOBLE(19) - MONTH(x.FECHA) AS NumeroPeriodo, -- ENT(2) "-1" Al informar este valor se calcula automát. A partir de la fecha de asiento - IF( sub2.FECREGCON IS NULL, sub2.FECHA_EX, sub2.FECREGCON) FechaGrabacion, -- FECHA(8) - IF(x.CAMBIO,IFNULL(xmi.CodigoDivisa, sub3.code),'') CodigoDivisa, -- VARCHAR(3) - x.CAMBIO AS ImporteCambio, -- DOBLE(19) - IFNULL(x.DEBEME,x.HABERME) AS ImporteDivisa, -- DOBLE(19) - IF(x.CAMBIO,1,0) AS FactorCambio, -- DOBLE(19) - NULL AS IdProcesoIME, -- GUID(16) - 0 AS TipoCarteraIME, -- ENT(2) "0" para que no genere cartera - 0 AS TipoAnaliticaIME, -- ENT(2) - 0 AS StatusTraspasadoIME, -- BYTE "0" para dejar como no importado aún - 0 AS TipoImportacionIME, -- BYTE "0" Alta "1" Baja - x.METAL as Metalico347, - /* ESTOS CAMPOS SOLO SE INFORMAN EN EL CASO DE SER FACTURA */ - xmi.BaseIva1, -- DOBLE(19) - xmi.PorBaseCorrectora1, -- DOBLE(19) - xmi.PorIva1, -- DOBLE(19) - xmi.CuotaIva1, -- DOBLE(19) - xmi.PorRecargoEquivalencia1,-- DOBLE(19) - xmi.RecargoEquivalencia1, -- DOBLE(19) - xmi.CodigoTransaccion1, -- BYTE "0" Nacional "1" Intracomunitario "2" Extracomunitario - xmi.BaseIva2, - xmi.PorBaseCorrectora2, - xmi.PorIva2, - xmi.CuotaIva2, - xmi.PorRecargoEquivalencia2, - xmi.RecargoEquivalencia2, - xmi.CodigoTransaccion2, - xmi.BaseIva3, - xmi.PorBaseCorrectora3, - xmi.PorIva3, - xmi.CuotaIva3, - xmi.PorRecargoEquivalencia3, - xmi.RecargoEquivalencia3, - xmi.CodigoTransaccion3, - xmi.BaseIva4, - xmi.PorBaseCorrectora4, - xmi.PorIva4, - xmi.CuotaIva4, - xmi.PorRecargoEquivalencia4, - xmi.RecargoEquivalencia4, - xmi.CodigoTransaccion4, - xmi.Año, -- ENT(2) - xmi.Serie, -- VARCHAR(10) - xmi.Factura, -- LONG(4) - xmi.SuFacturaNo, -- VARCHAR(40) - xmi.FechaFactura, -- FECHA(8) - xmi.ImporteFactura, -- DOBLE(19) - xmi.TipoFactura, -- VARCHAR(1) "E" / "R" - xmi.CodigoCuentaFactura, -- VARCHAR(15) cuenta del cliente/proveedor - xmi.CifDni, -- VARCHAR(13) - xmi.Nombre, -- VARCHAR(35) - xmi.CodigoRetencion, -- ENT(2) - xmi.BaseRetencion, -- DOBLE(19) - xmi.PorRetencion, -- DOBLE(19) - xmi.ImporteRetencion, -- DOBLE(19) - xmi.SiglaNacion, -- VARCHAR(2) "ES" por defecto - xmi.EjercicioFactura, -- ENT(2) - xmi.FechaOperacion, -- FECHA(8) - xmi.Exclusion347, -- ENT(2) - 1, -- xmi.MantenerAsiento BYTE "-1" mantener "0" Sage asigna nuevo - xmi.ClaveOperacionFactura, -- VARCHAR(1) - xmi.TipoRectificativa, -- ENT(2) - xmi.FechaFacturaOriginal, -- FECHA(8) - xmi.BaseImponibleOriginal, -- DOBLE(19) - xmi.CuotaIvaOriginal, -- DOBLE(19) - xmi.ClaseAbonoRectificativas,-- ENT(2) - xmi.RecargoEquivalenciaOriginal,-- DOBLE(19) */ - xmi.LibreA1, - xmi.CodigoIva1, -- ENT(6) - xmi.CodigoIva2, -- ENT(6) - xmi.CodigoIva3, -- ENT(6) - xmi.CodigoIva4, -- ENT(6) - xmi.IvaDeducible1, -- Entero 2 ((-1)) - xmi.IvaDeducible2, -- Entero 2 ((-1)) - xmi.IvaDeducible3, -- Entero 2 ((-1)) - xmi.IvaDeducible4, -- Entero 2 ((-1))-- ENT(6) - xmi.Intracomunitaria -- TINYINT(1) - FROM vn2008.XDiario x - JOIN vn.company c ON c.id = x.empresa_id - LEFT JOIN XDiario_movConta_IVA xmi ON xmi.id = x.id AND xmi.moveData > 0 - LEFT JOIN (SELECT ASIEN, FECREGCON, FECHA_EX - FROM (SELECT DISTINCT ASIEN, FECREGCON, FECHA_EX - FROM vn2008.XDiario - ORDER BY ASIEN, FECREGCON DESC, FECHA_EX DESC - ) sub GROUP BY ASIEN - )sub2 ON sub2.ASIEN = x.ASIEN - LEFT JOIN ( SELECT DISTINCT(account),cu.code - FROM vn.bank b - JOIN vn.currency cu ON cu.id = b.currencyFk - WHERE cu.code <> "EUR" -- no se informa cuando la divisa en EUR - )sub3 ON sub3.account = x.SUBCTA - WHERE x.enlazadoSage = 0 AND - c.companyCode AND - x.FECHA >= vDated; - --- Prepara Metálicos - UPDATE sage.movConta m - JOIN (SELECT Asiento, SUBSTR(c.socialName,1,35) Nombre, c.fi, n.SiglaNacion - FROM sage.movConta m - JOIN vn.client c ON c.id = IF(m.CargoAbono = "H", m.CodigoCuenta-4300000000, m.Contrapartida-4300000000 ) - LEFT JOIN Naciones n ON n.countryFk = c.countryFk - WHERE m.Metalico347 = TRUE AND - m.enlazadoSage = FALSE - ) AS sub ON m.Asiento = sub.Asiento - SET m.Metalico347 = TRUE, - m.TipoFactura = "I", - m.CifDni = sub.fi , - m.Nombre = sub.Nombre, - m.SiglaNacion = sub.SiglaNacion - WHERE m.enlazadoSage = FALSE; - - UPDATE sage.movConta m - SET Metalico347 = FALSE, - m.TipoFactura = "", - m.Metalico347 = FALSE - WHERE CargoAbono = "D" AND - m.enlazadoSage = FALSE; - --- Elimina cuentas de cliente/proveedor que no se utilizarán en la importación - DELETE cp - FROM clientesProveedores cp - JOIN (SELECT cp.codigoCuenta - FROM clientesProveedores cp - LEFT JOIN movConta mc ON mc.codigoCuenta = cp.codigoCuenta AND mc.enlazadoSage = FALSE - WHERE mc.codigoCuenta IS NULL - GROUP BY cp.codigoCuenta - ) sub ON sub.codigoCuenta = cp.codigoCuenta ; - --- Elimina cuentas contables que no se utilizarán en la importación - DELETE pc - FROM planCuentasPGC pc - JOIN ( SELECT pc.codigoCuenta - FROM planCuentasPGC pc - LEFT JOIN movConta mc ON mc.codigoCuenta = pc.codigoCuenta AND mc.enlazadoSage = FALSE - WHERE mc.codigoCuenta IS NULL - GROUP BY pc.codigoCuenta - ) sub ON sub.codigoCuenta = pc.codigoCuenta ; - --- DUAS - UPDATE movConta m - JOIN vn.XDiario x ON x.ASIEN = m.Asiento - SET m.BaseIva1 = x.BASEEURO , - m.PorIva1 = x.IVA, - m.CuotaIva1 = CAST((x.IVA/100) * x.BASEEURO AS DECIMAL(10,2)) , - m.CodigoTransaccion1 = 56 , - m.CodigoIva1 = 22, - m.IvaDeducible1 = TRUE, - m.FechaFacturaOriginal = x.FECHA_EX, - m.SuFacturaNo = x.FACTURAEX, - m.FechaOperacion = x.FECHA_OP, - m.ImporteFactura = m.ImporteFactura + x.BASEEURO + CAST((x.IVA/100) * x.BASEEURO AS DECIMAL(10,2)) - WHERE m.CodigoCuenta = 4700000999 - AND m.enlazadoSage = FALSE - AND x.SERIE='D' - AND x.IVA = 10; - - UPDATE movConta m - JOIN vn.XDiario x ON x.ASIEN = m.Asiento - SET m.BaseIva2 = x.BASEEURO , - m.PorIva2 = x.IVA, - m.CuotaIva2 = CAST((x.IVA/100) * x.BASEEURO AS DECIMAL(10,2)), - m.CodigoTransaccion2 = 56 , - m.CodigoIva2 = 90, - m.IvaDeducible2 = TRUE, - m.ImporteFactura = m.ImporteFactura + x.BASEEURO + CAST((x.IVA/100) * x.BASEEURO AS DECIMAL(10,2)) - WHERE m.CodigoCuenta = 4700000999 - AND m.enlazadoSage = FALSE - AND x.SERIE='D' - AND x.IVA = 21; - --- Rectificativas -UPDATE movConta m - JOIN (SELECT x.ASIEN, x.FECHA_RT, x.SERIE_RT, x.FACTU_RT - FROM movConta m - JOIN vn.XDiario x ON x.ASIEN = m.Asiento - WHERE m.TipoRectificativa>0 AND - m.enlazadoSage = FALSE AND - x.FACTU_RT IS NOT NULL - GROUP BY x.ASIEN - ) sub ON sub.ASIEN = m.Asiento - SET m.EjercicioFacturaOriginal = YEAR(sub.FECHA_RT), - m.SerieFacturaOriginal = sub.SERIE_RT, - m.NumeroFacturaOriginal = sub.FACTU_RT - WHERE m.TipoRectificativa > 0 AND - m.enlazadoSage = FALSE ; - --- Exportaciones Andorras y Canarias cambia TT (la cuenta de taxCode es compartida, id:125) -UPDATE sage.movConta m - SET CodigoTransaccion1 = 15, - CodigoTransaccion2 = IF(CodigoTransaccion2 = 0, 0, 15), - CodigoTransaccion3 = IF(CodigoTransaccion3 = 0, 0, 15), - CodigoTransaccion4 = IF(CodigoTransaccion4 = 0, 0, 15) - WHERE enlazadoSage = FALSE AND - (CodigoTransaccion1 = 14 OR CodigoTransaccion2 = 14 OR CodigoTransaccion3 = 14 OR CodigoTransaccion4 = 14) AND - SiglaNAcion IN ('XC','XB'); - --- Divisas - - UPDATE sage.movConta mc - SET CodigoDivisa = 'USD', - FactorCambio = 1, - ImporteCambio = ABS( CAST( IF( ImporteDivisa <> 0 AND ImporteCambio=0, ImporteAsiento / ImporteDivisa, ImporteCambio) AS DECIMAL( 10, 2))) - WHERE (ImporteCambio <> 0 OR ImporteDivisa <> 0 OR FactorCambio <> 0) - AND enlazadoSage = FALSE ; - - UPDATE sage.movConta mc - SET importeDivisa= importeDivisa * -1 - WHERE enlazadoSage = FALSE - AND importeDivisa > 0 - AND ImporteAsiento < 0; - - - -/*-- Actualiza las facturas DUA para excluirlas del 347 y marcarlas como intracomunitarias -/*UPDATE sage.movConta mc - SET - mc.Intracomunitaria = 1, - mc.Exclusion347 = 1 -WHERE - mc.CodigoCuenta = '4700000999'; */ - - --- MARCAR EN CASO DE SER INTRACOMUNITARIA -/* -UPDATE sage.movConta mc - SET - mc.Intracomunitaria = 1 -WHERE - mc.CodigoTransaccion1 IN (20,29); -*/ - - - -- LAS FACTURAS RTECTIFICATIVAS QUE TIENEN CUENTA DE IVA 477.2 SALE CON T.T. 1, TODAS ESTAS FACTURAS DEBEN DE TENER T.T. 15 - - /*UPDATE sage.movConta mc - JOIN - (SELECT - Asiento - FROM - sage.movConta - WHERE - CodigoCuenta = 4770000002) sub ON sub.Asiento = mc.Asiento -SET - CodigoTransaccion1 = CASE - WHEN CodigoTransaccion1 = 1 THEN 15 - ELSE CodigoTransaccion1 - END, - CodigoTransaccion2 = CASE - WHEN CodigoTransaccion2 = 1 THEN 15 - ELSE CodigoTransaccion2 - END, - CodigoTransaccion3 = CASE - WHEN CodigoTransaccion3 = 1 THEN 15 - ELSE CodigoTransaccion3 - END, - CodigoTransaccion4 = CASE - WHEN CodigoTransaccion4 = 1 THEN 15 - ELSE CodigoTransaccion4 - END -WHERE - serie = 'R'; - -*/ - -/* -Nombre Tipo Longitud Descripción campo / Valor por defecto -MovPosicion Guid contador 16 Automático, no informar -Ejercicio Entero 2 -1 -- Al informar este valor se calcula automát. A partir de la fecha de asiento -CodigoEmpresa Entero 2 Empresa de Sage 200c donde va destinado el asiento -Asiento Entero Largo 4 Número de asiento -CargoAbono Texto 1 "D" - Debe / "H" - Haber -CodigoCuenta Texto 15 Cuenta contable del movimiento -Contrapartida Texto 15 Es informativo, no es necesario informarlo -FechaAsiento Fecha 8 Fecha del asiento -TipoDocumento Texto 6 -DocumentoConta Texto 9 -Comentario Texto 40 Comentario del asiento -ImporteAsiento Doble 19 Importe del movimiento -CodigoDiario Entero 2 -CodigoCanal Texto 10 Centro coste analítico (no necesario informar) -CodigoActividad Texto 1 -FechaVencimiento Fecha 8 Si se tienen que generar efectos, será la fecha de vto. Del efecto. No informar -NumeroPeriodo Entero 2 -1 -- Al informar este valor se calcula automát. A partir de la fecha de asiento -CodigoUsuario Entero 2 -FechaGrabacion Fecha 8 -TipoEntrada Texto 2 -CodigoDepartamento Texto 10 Centro coste analítico (no necesario informar) -CodigoSeccion Texto 10 Centro coste analítico (no necesario informar) -CodigoDivisa Texto 3 -ImporteCambio Doble 19 -ImporteDivisa Doble 19 -FactorCambio Doble 19 -CodigoProyecto Texto 10 Centro coste analítico (no necesario informar) -LibreN1 Entero Largo 4 Campo libre numérico -LibreN2 Entero Largo 4 Campo libre numérico -LibreA1 Texto 15 Campo libre alfanumérico -LibreA2 Texto 15 Campo libre alfanumérico -IdDelegacion Texto 10 Centro coste analítico (no necesario informar) -OrdenMovimientos Contador 4 Número de orden de cada movimiento dentro de un mismo asiento, autonumerar para cada asiento -MovCartera Guid 16 -IdProcesoIME Guid 16 guid igual para todos los registros que correspondan a una misma importación. -TipoCarteraIME Entero 2 0 - Para que no genere cartera -TipoAnaliticaIME Entero 2 -StatusTraspasadoIME Byte 1 0 - Para que quede marcado el movimiento como no importado todavía. -TipoImportacionIME Byte 1 0 - Alta -BaseIva1 Doble 19 Base para el IVA 1 (idéntico para cada posible IVA hasta el 4) (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -PorBaseCorrectora1 Doble 19 Base correctora (en caso de que la haya) para el IVA 1 (idéntico para cada posible IVA hasta el 4) (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -PorIva1 Doble 19 Porcentaje IVA 1 (idéntico para cada posible IVA hasta el 4) (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -CuotaIva1 Doble 19 Cuota IVA 1 (idéntico para cada posible IVA hasta el 4) (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -PorRecargoEquivalencia1 Doble 19 Si hay recargo - Porcentaje de recargo para el IVA 1 (idéntico para cada posible IVA hasta el 4) (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -RecargoEquivalencia1 Doble 19 Si hay recargo - Importe de Recargo para el IVA 1 (idéntico para cada posible IVA hasta el 4) (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -CodigoTransaccion1 Byte 1 Ver con dpto. de contabilidad - Depende de la naturaleza del asiento (Nacional, Intracoumunitario, etc…) (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -BaseIva2 Doble 19 0 -PorBaseCorrectora2 Doble 19 0 -PorIva2 Doble 19 0 -CuotaIva2 Doble 19 0 -PorRecargoEquivalencia2 Doble 19 0 -RecargoEquivalencia2 Doble 19 0 -CodigoTransaccion2 Byte 1 0 -BaseIva3 Doble 19 0 -PorBaseCorrectora3 Doble 19 0 -PorIva3 Doble 19 0 -CuotaIva3 Doble 19 0 -PorRecargoEquivalencia3 Doble 19 0 -RecargoEquivalencia3 Doble 19 0 -CodigoTransaccion3 Byte 1 0 -BaseIva4 Doble 19 0 -PorBaseCorrectora4 Doble 19 0 -PorIva4 Doble 19 0 -CuotaIva4 Doble 19 0 -PorRecargoEquivalencia4 Doble 19 0 -RecargoEquivalencia4 Doble 19 0 -CodigoTransaccion4 Byte 1 0 -Año Entero 2 Ejercicio de la factura en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -Serie Texto 10 Serie de la factura en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -Factura Entero Largo 4 Número de la factura en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -SuFacturaNo Texto 40 Número de la factura del proveedor para factura recibidas, en el caso de que el asiento sea de una factura. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -FechaFactura Fecha 8 Fecha de la factura en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -ImporteFactura Doble 19 Importe de la factura en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -TipoFactura Texto 1 "E" - Factura emitida / "R" - Factura Recibida - en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -CodigoCuentaFactura Texto 15 Cuenta contable del cliente / proveedor en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -CifDni Texto 13 CIF del cliente / proveedor en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -Nombre Texto 35 Nombre del cliente / proveedor en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -CodigoRetencion Entero 2 Código de retención de la factura en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -BaseRetencion Doble 19 Base de retención de la factura en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -PorRetencion Doble 19 Porcentaje de retención de la factura en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -ImporteRetencion Doble 19 Importe de retención de la factura en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -AbonoIva Entero 2 0 -CodigoActividadF Texto 1 ('') -Intracomunitaria Entero 2 0 -CodigoTerritorio Entero 2 0 -SiglaNacion Texto 2 Sigla de la nación de la factura en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -RetencionInformativa Entero 2 0 -EjercicioFacturaOriginal Entero 2 0 -SerieFacturaOriginal Texto 10 ('') -NumeroFacturaOriginal Entero Largo 4 0 -EjercicioFactura Entero 2 Ejercicio de la factura en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -CobroPagoRetencion Texto 1 ('') -FechaOperacion Fecha 8 Normalmente Fecha Factura en el caso de que sea un asiento de facturas. (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -Exclusion347 Entero 2 0 -MovIdentificadorIME Guid contador 16 (newid()) -Previsiones Texto 1 ('') -MantenerAsiento Byte 1 -1 si se quiere mantener el número de asiento que se informa en la importación o "0" si se quiere que se asigne automáticamente el asiento en Sage 200c -OrdenMovIME Entero 2 0 -Metalico347 Entero 2 0 -ClaveOperacionFactura_ Texto 1 Ver con dpto. de contabilidad - Depende de la naturaleza del asiento (Nacional, Intracoumunitario, etc…) (Solamente se informa en el movimiento de la factura - cuenta cliente / proveedor) -SerieAgrupacion_ Texto 10 ('') -NumeroFacturaInicial_ Entero Largo 4 0 -NumeroFacturaFinal_ Entero Largo 4 0 -IdAsientoExterno Texto 50 ('') -IdDiarioExterno Texto 10 ('') -IdFacturaExterno Texto 50 ('') -IdMovimiento Texto 40 ('') -IdCuadre Entero 2 ((0)) -FechaCuadre Fecha 8 (getdate()) -TipoCuadre Texto 4 ('') -AgrupacionCuadre Entero Largo 4 ((0)) -StatusSaldo Entero 2 ((0)) -StatusConciliacion Entero 2 ((0)) -CodigoConciliacion Entero Largo 4 ((0)) -FechaConciliacion Fecha 8 -TipoConciliacion Entero 2 ((0)) -IndicadorContaBanco Texto 1 ('') -Descripcion3 Texto 40 ('') -Descripcion4 Texto 40 ('') -Descripcion5 Texto 40 ('') -Descripcion6 Texto 40 ('') -Descripcion7 Texto 40 ('') -Descripcion8 Texto 50 ('') -Descripcion9 Texto 50 ('') -Descripcion2 Texto 250 ('') -Descripcion1 Texto 250 ('') -Punteo1 Entero 2 ((0)) -Punteo9 Entero 2 ((0)) -Punteo8 Entero 2 ((0)) -Punteo7 Entero 2 ((0)) -Punteo6 Entero 2 ((0)) -Punteo5 Entero 2 ((0)) -Punteo4 Entero 2 ((0)) -Punteo3 Entero 2 ((0)) -Punteo2 Entero 2 ((0)) -CodigoIva1 Entero 2 ((0)) -CodigoIva2 Entero 2 ((0)) -CodigoIva3 Entero 2 ((0)) -CodigoIva4 Entero 2 ((0)) -CriterioIva Byte 1 ((0)) -FechaMaxVencimiento Fecha 8 -TipoCriterioCaja Byte 1 ((0)) -MovFacturaOrigenIME Texto 50 ('') -IdFacturaExternoFinal Texto 50 ('') -IdFacturaExternoInicial Texto 50 ('') -IdFacturaExternoOriginal Texto 50 ('') -NumFacturasExternoAgrupacion Entero Largo 4 ((0)) -CodigoMedioCobro Texto 1 ('') -MedioCobro Texto 31 ('') -IvaDeducible1 Entero 2 ((-1)) -IvaDeducible2 Entero 2 ((-1)) -IvaDeducible3 Entero 2 ((-1)) -IvaDeducible4 Entero 2 ((-1)) -TipoRectificativa Entero 2 ((0)) -FechaFacturaOriginal Fecha 8 -BaseImponibleOriginal Doble 19 ((0)) -CuotaIvaOriginal Doble 19 ((0)) -ClaseAbonoRectificativas Entero 2 ((0)) -RecargoEquivalenciaOriginal Doble 19 ((0)) -ObjetoFactura Texto 500 ('') -*/ END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -22506,7 +17829,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `pgc_add`(vCompanyFk INT) BEGIN /** - * Añade cuentas del plan general contable para exportarlos a Sage + * Añade cuentas del plan general contable para exportarlos a Sage * @vCompanyFk Empresa de la que se quiere trasladar datos */ TRUNCATE TABLE planCuentasPGC; @@ -22516,29 +17839,25 @@ BEGIN CodigoCuenta, Cuenta, ClienteOProveedor) - SELECT * - FROM (SELECT IF(@@hostname = 'db', c.companyCode, companyCodeTest) companyFk, + SELECT * + FROM (SELECT company_getCode(vCompanyFk) companyFk, e.id accountFk, UCASE(e.name), '' FROM vn.expence e - JOIN vn.company c - WHERE c.id = vCompanyFk - UNION - SELECT IF(@@hostname = 'db', c.companyCode, companyCodeTest), - b.account, + UNION + SELECT company_getCode(vCompanyFk), + b.account, UCASE(b.bank), - '' + '' FROM vn.bank b - JOIN vn.company c - WHERE c.id = vCompanyFk - AND b.isActive + WHERE b.isActive AND b.`account` - UNION + UNION SELECT CodigoEmpresa, CodigoCuenta, Nombre, - ClienteOProveedor + ClienteOProveedor FROM clientesProveedores)sub GROUP BY companyFk, accountFk; END ;; @@ -22547,799 +17866,12 @@ 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 `planCuentasPgcAdd__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `planCuentasPgcAdd__`() -BEGIN - -TRUNCATE TABLE planCuentasPGC; - -REPLACE INTO planCuentasPGC( - CodigoEmpresa, - CodigoCuenta, - Cuenta, - ClienteOProveedor - ) - SELECT codigoEmpresa, CodigoCuenta, Cuenta, ClienteOProveedor - FROM - ( - SELECT - IF (@@hostname = 'db', c.companyCode, companyCodeTest) AS codigoEmpresa, - e.id AS CodigoCuenta, - UCASE(e.name) AS Cuenta, - '' AS ClienteOProveedor - FROM - (vn.expence e - JOIN vn.company c) - WHERE - c.companyCode - GROUP BY e.id - - UNION - SELECT - IF (@@hostname = 'db', c.companyCode, companyCodeTest) AS codigoEmpresa, - b.account AS CodigoCuenta, - UCASE(b.bank) AS Cuenta, - '' AS ClienteOProveedor - FROM - (vn.bank b - JOIN vn.company c) - WHERE (c.companyCode AND b.isActive) - AND b.account - GROUP BY b.account - UNION - SELECT - codigoEmpresa, - CodigoCuenta, - Nombre AS Cuenta, - ClienteOProveedor - FROM clientesProveedores - GROUP BY CodigoCuenta - ) pgc - GROUP BY CodigoCuenta; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `XDiario_movConta_IVA_InvoiceInAdd_Manager__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `XDiario_movConta_IVA_InvoiceInAdd_Manager__`() -BEGIN - DECLARE done BOOL DEFAULT FALSE; - DECLARE vInvoiceFk INT; - DECLARE vXDiarioFk INT; - DECLARE vDated DATE; - DECLARE rs CURSOR FOR - SELECT IFNULL(x.CLAVE,x.FACTURA) invoiceInFk, x.id XDiarioFk - FROM vn2008.XDiario x - JOIN(SELECT DISTINCT (x.ASIEN) - FROM vn2008.XDiario x - LEFT JOIN vn.invoiceIn ii ON x.CLAVE = ii.id - LEFT JOIN vn.invoiceInTax it ON it.invoiceInFk = ii.id - WHERE(it.taxTypeSageFk IS NOT NULL OR x.SERIE='D') AND - x.enlazadoSage = FALSE AND - x.FECHA >= vDated - ) sub ON sub.ASIEN =x.ASIEN -- Elimina las Facturas con IVA 0 (-) no se trasladan a sage - WHERE x.enlazadoSage = FALSE AND - x.FECHA >= vDated AND - x.CLAVE IS NOT NULL ; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - SELECT CONCAT(YEAR(util.VN_CURDATE()), "-01-01") INTO vDated; - SELECT "2021-01-01" INTO vDated; - DROP TEMPORARY TABLE IF EXISTS tmp.invoiceDua; - CREATE TEMPORARY TABLE tmp.invoiceDua - SELECT id - FROM vn2008.XDiario x - WHERE ASIEN IN (SELECT ASIEN - FROM vn2008.XDiario x - WHERE x.enlazadoSage = FALSE AND - x.SUBCTA = '4700000999' AND - x.FECHA >= vDated - ) AND - NOT CONTRA <=> "4330002067"; - - DROP TEMPORARY TABLE IF EXISTS tmp.invoiceInList; - CREATE TEMPORARY TABLE tmp.invoiceInList - SELECT i.id id, - i.supplierRef supplierRef, - i.serial serial, - i.supplierFk supplierFk, - i.issued issued, - IF(expenceFkDeductible, FALSE, i.isVatDeductible) isVatDeductible, - i.serialNumber serialNumber, - IF(c.code = "EUR", '',c.code) currencyFk - FROM vn.invoiceIn i - JOIN vn.currency c ON c.id = i.currencyFk - WHERE i.bookEntried >= vDated - UNION ALL - SELECT d.id , - d.code , - 'D' , - d.companyFk , - d.issued , - FALSE, - d.id, - '' -- EUROS - FROM vn.dua d - WHERE d.issued IS NOT NULL AND - code IS NOT NULL; - - OPEN rs; - FETCH rs INTO vInvoiceFk, vXDiarioFk; - WHILE NOT done DO - CALL XDiario_movConta_IVA_InvoiceInAdd(vInvoiceFk, vXDiarioFk); - FETCH rs INTO vInvoiceFk, vXDiarioFk; - END WHILE; - CLOSE rs; - - DROP TEMPORARY TABLE tmp.invoiceDua; - DROP TEMPORARY TABLE tmp.invoiceInList; - - -- ASIENTOS CON IVA SOPORTADO 472. y 477. hay que informar 2 líneas la info de facturas una como tipo de factura emitida y otra como recibida - DROP TEMPORARY TABLE IF EXISTS tmp.XDiario_movConta_IVA; - CREATE TEMPORARY TABLE tmp.XDiario_movConta_IVA - SELECT - sub3.id, - mc.CodigoDivisa, - mc.BaseIva1, - mc.PorBaseCorrectora1, - mc.PorIva1, - mc.CuotaIva1, - mc.PorRecargoEquivalencia1, - mc.RecargoEquivalencia1, - mc.CodigoTransaccion1, - mc.CodigoIva1, - mc.BaseIva2, - mc.PorBaseCorrectora2, - mc.PorIva2, - mc.CuotaIva2, - mc.PorRecargoEquivalencia2, - mc.RecargoEquivalencia2, - mc.CodigoTransaccion2, - mc.CodigoIva2, - mc.BaseIva3, - mc.PorBaseCorrectora3, - mc.PorIva3, - mc.CuotaIva3, - mc.PorRecargoEquivalencia3, - mc.RecargoEquivalencia3, - mc.CodigoTransaccion3, - mc.CodigoIva3, - mc.BaseIva4, - mc.PorBaseCorrectora4, - mc.PorIva4, - mc.CuotaIva4, - mc.PorRecargoEquivalencia4, - mc.RecargoEquivalencia4, - mc.CodigoTransaccion4, - mc.CodigoIva4, - mc.Año, - mc.Serie, - mc.Factura, - mc.SuFacturaNo, - mc.FechaFactura, - mc.ImporteFactura, - 'E', - mc.CodigoCuentaFactura, - mc.CifDni, - mc.Nombre, - mc.CodigoRetencion, - mc.BaseRetencion, - mc.PorRetencion, - mc.ImporteRetencion, - mc.SiglaNacion, - mc.EjercicioFactura, - x.FECHA, - mc.Exclusion347, - mc.MantenerAsiento, - mc.Metalico347, - mc.ClaveOperacionFactura, - mc.TipoRectificativa, - mc.FechaFacturaOriginal, - mc.CuotaIvaOriginal, - mc.BaseImponibleOriginal, - mc.ClaseAbonoRectificativas, - mc.RecargoEquivalenciaOriginal, - mc.LibreA1, - mc.IvaDeducible1, - mc.IvaDeducible2, - mc.IvaDeducible3, - mc.IvaDeducible4, - mc.FechaGrabacion, - mc.Intracomunitaria, - mc.moveData - FROM sage.XDiario_movConta_IVA mc - JOIN vn.XDiario x ON x.id = mc.id - JOIN (SELECT x.ASIEN, x.id - FROM vn.XDiario x - JOIN(SELECT DISTINCT(x.ASIEN) ASIEN - FROM (SELECT DISTINCT(ASIEN) - FROM vn.XDiario x - WHERE SUBCTA LIKE '472%' AND - x.enlazadoSage = FALSE AND - x.FECHA >= vDated - ) sub JOIN vn.XDiario x ON x.ASIEN = sub.ASIEN - WHERE x.SUBCTA LIKE '477%' - )sub2 ON sub2.ASIEN = x.ASIEN - WHERE x.CONTRA IS NOT NULL AND x.SUBCTA LIKE '477%' - GROUP BY x.ASIEN - )sub3 ON sub3.ASIEN = x.ASIEN; - - INSERT INTO sage.XDiario_movConta_IVA - (`id`, - `CodigoDivisa`, - `BaseIva1`, - `PorBaseCorrectora1`, - `PorIva1`, - `CuotaIva1`, - `PorRecargoEquivalencia1`, - `RecargoEquivalencia1`, - `CodigoTransaccion1`, - `CodigoIva1`, - `BaseIva2`, - `PorBaseCorrectora2`, - `PorIva2`, - `CuotaIva2`, - `PorRecargoEquivalencia2`, - `RecargoEquivalencia2`, - `CodigoTransaccion2`, - `CodigoIva2`, - `BaseIva3`, - `PorBaseCorrectora3`, - `PorIva3`, - `CuotaIva3`, - `PorRecargoEquivalencia3`, - `RecargoEquivalencia3`, - `CodigoTransaccion3`, - `CodigoIva3`, - `BaseIva4`, - `PorBaseCorrectora4`, - `PorIva4`, - `CuotaIva4`, - `PorRecargoEquivalencia4`, - `RecargoEquivalencia4`, - `CodigoTransaccion4`, - `CodigoIva4`, - `Año`, - `Serie`, - `Factura`, - `SuFacturaNo`, - `FechaFactura`, - `ImporteFactura`, - `TipoFactura`, - `CodigoCuentaFactura`, - `CifDni`, - `Nombre`, - `CodigoRetencion`, - `BaseRetencion`, - `PorRetencion`, - `ImporteRetencion`, - `SiglaNacion`, - `EjercicioFactura`, - `FechaOperacion`, - `Exclusion347`, - `MantenerAsiento`, - `Metalico347`, - `ClaveOperacionFactura`, - `TipoRectificativa`, - `FechaFacturaOriginal`, - `CuotaIvaOriginal`, - `BaseImponibleOriginal`, - `ClaseAbonoRectificativas`, - `RecargoEquivalenciaOriginal`, - `LibreA1`, - `IvaDeducible1`, - `IvaDeducible2`, - `IvaDeducible3`, - `IvaDeducible4`, - `FechaGrabacion`, - `Intracomunitaria`, - `moveData`) - SELECT * - FROM tmp.XDiario_movConta_IVA; - DROP TEMPORARY TABLE tmp.XDiario_movConta_IVA; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `XDiario_movConta_IVA_InvoiceInAdd__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `XDiario_movConta_IVA_InvoiceInAdd__`(IN vInvoiceInFk INT, IN vXDiarioId INT) -BEGIN - - DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vBase DOUBLE; - DECLARE vVat DOUBLE; - DECLARE vRate DOUBLE; - DECLARE vTransactionCode INT; - DECLARE vCounter INT DEFAULT 0; - DECLARE vTransactionCodeOld INT; - DECLARE vTaxCode INT; - DECLARE vTaxCodeOld INT; - DECLARE vOperationCode VARCHAR(1); - DECLARE vIsIntracommunity BOOL DEFAULT FALSE; - DECLARE vDuaExcluded INT; - - DECLARE rs CURSOR FOR -- IVA - SELECT it.taxableBase BASEEURO, - CAST((( it.taxableBase / 100) * t.PorcentajeIva) AS DECIMAL (10,2)) vat, - t.PorcentajeIva rate, - it.transactionTypeSageFk transactionCode, - it.taxTypeSageFk taxCode, - t.isIntracommunity, - tt.ClaveOperacionDefecto operationCode, - id.id - FROM vn.invoiceIn i - JOIN vn.invoiceInTax it ON it.InvoiceInFk = i.id - JOIN TiposIva t ON t.CodigoIva = it.taxTypeSageFk - JOIN TiposTransacciones tt ON tt.CodigoTransaccion = it.transactionTypeSageFk - LEFT JOIN tmp.invoiceDua id ON id.id = vXDiarioId - WHERE i.id = vInvoiceInFk - AND i.id> 70000; -- los DUAS no son vInvoiceInFk, pero se pasan en el mismo parametro comparten id en tablas distintas de InvoiceIN (100000) dua(20000) - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - DELETE FROM XDiario_movConta_IVA - WHERE id = vXDiarioId; - - INSERT INTO XDiario_movConta_IVA(id, LibreA1) - VALUES (vXDiarioId, vInvoiceInFk); - - OPEN rs; - FETCH rs INTO vBase, - vVat, - vRate, - vTransactionCode, - vTaxCode, - vIsIntracommunity, - vOperationCode, - vDuaExcluded; - - SET vTransactionCodeOld=vTransactionCode; - SET vTaxCodeOld=vTaxCode; - - WHILE NOT vDone DO - IF vOperationCode IS NOT NULL THEN - UPDATE XDiario_movConta_IVA - SET ClaveOperacionFactura = vOperationCode - WHERE id = vXDiarioId; - END IF; - - IF vTransactionCode IS NULL THEN - SET vTransactionCode = vTransactionCodeOld; - END IF; - - IF vTaxCodeOld IS NULL THEN - SET vTaxCode = vTaxCodeOld; - END IF; - - SET vCounter = vCounter + 1; - CASE vCounter - WHEN 1 THEN - UPDATE XDiario_movConta_IVA - SET BaseIva1 = vBase, - PorIva1 = vRate, - CuotaIva1 = vVat, - CodigoTransaccion1 = vTransactionCode, - CodigoIva1 = vTaxCode - WHERE id = vXDiarioId; - WHEN 2 THEN - UPDATE XDiario_movConta_IVA - SET BaseIva2 = vBase, - PorIva2 = vRate, - CuotaIva2 = vVat, - CodigoTransaccion2 = vTransactionCode, - CodigoIva2 = vTaxCode - WHERE id = vXDiarioId; - WHEN 3 THEN - UPDATE XDiario_movConta_IVA - SET BaseIva3 = vBase, - PorIva3 = vRate, - CuotaIva3 = vVat, - CodigoTransaccion3 = vTransactionCode, - CodigoIva3 = vTaxCode - WHERE id = vXDiarioId; - WHEN 4 THEN - UPDATE XDiario_movConta_IVA - SET BaseIva4 = vBase, - PorIva4 = vRate, - CuotaIva4 = vVat, - CodigoTransaccion4 = vTransactionCode, - CodigoIva4 = vTaxCode - WHERE id = vXDiarioId; - ELSE - SELECT vXDiarioId INTO vXDiarioId; - END CASE; - - IF vIsIntracommunity THEN - UPDATE XDiario_movConta_IVA - SET Intracomunitaria = TRUE - WHERE id = vXDiarioId; - END IF; - - SET vTransactionCodeOld=vTransactionCode; - SET vTaxCodeOld=vTaxCode; - - FETCH rs INTO vBase, - vVat, - vRate, - vTransactionCode, - vTaxCode, - vIsIntracommunity, - vOperationCode, - vDuaExcluded; - END WHILE; - CLOSE rs; - - UPDATE XDiario_movConta_IVA xmi - JOIN tmp.invoiceInList ii ON ii.id = vInvoiceInFk - JOIN vn2008.XDiario x ON x.id = xmi.id - LEFT JOIN tmp.invoiceDua id ON id.id = xmi.id - JOIN vn.supplier s ON s.id = ii.supplierFk - JOIN Naciones n ON n.countryFk = s.countryFk - SET xmi.CodigoDivisa = ii.currencyFk, - xmi.Año = YEAR(ii.issued), - xmi.Serie = ii.serial, - xmi.Factura = ii.serialNumber, -- x.FACTURA, DUAS¿? - xmi.FechaFactura = ii.issued, - xmi.ImporteFactura = IFNULL(xmi.BaseIva1, 0) + IFNULL(xmi.CuotaIva1, 0) + - IFNULL(xmi.BaseIva2, 0) + IFNULL(xmi.CuotaIva2, 0) + - IFNULL(xmi.BaseIva3, 0) + IFNULL(xmi.CuotaIva3, 0) + - IFNULL(xmi.BaseIva4, 0) + IFNULL(xmi.CuotaIva4, 0), - xmi.TipoFactura = IF(id.id,IF( ii.serial = 'D', 'R','I'), 'R'), -- MARCAR I para informativa - xmi.CodigoCuentaFactura = x.SUBCTA, - xmi.CifDni = IF(LEFT(TRIM(s.nif),2) = n.SiglaNacion, SUBSTRING(TRIM(s.nif),3) ,s.nif), - xmi.Nombre = s.name, - xmi.SiglaNacion = n.SiglaNacion, - xmi.EjercicioFactura = YEAR(ii.issued), - xmi.FechaOperacion = ii.issued, - xmi.MantenerAsiento = TRUE, - xmi.SuFacturaNo = ii.supplierRef, - xmi.IvaDeducible1 = IF(id.id, FALSE, IF(IFNULL(xmi.BaseIva1, FALSE) = FALSE, FALSE, ii.isVatDeductible)), - xmi.IvaDeducible2 = IF(id.id, FALSE, IF(IFNULL(xmi.BaseIva2, FALSE) = FALSE, FALSE, ii.isVatDeductible)), - xmi.IvaDeducible3 = IF(id.id, FALSE, IF(IFNULL(xmi.BaseIva3, FALSE) = FALSE, FALSE, ii.isVatDeductible)), - xmi.IvaDeducible4 = IF(id.id, FALSE, IF(IFNULL(xmi.BaseIva4, FALSE) = FALSE, FALSE, ii.isVatDeductible)), - xmi.FechaFacturaOriginal = x.FECHA_EX - WHERE xmi.id = vXDiarioId; - - -- RETENCIONES - - UPDATE XDiario_movConta_IVA xmi - JOIN vn.invoiceIn ii ON ii.id = vInvoiceInFk - JOIN vn2008.XDiario x ON x.id = xmi.id - JOIN vn.supplier s ON s.id = supplierFk - JOIN vn.invoiceInTax iit ON iit.invoiceInFk = ii.id - JOIN TiposRetencion t ON t.CodigoRetencion = ii.withholdingSageFk - JOIN (SELECT SUM(BASEEURO) taxableBase, SUM(EURODEBE) taxBase - FROM vn.XDiario - WHERE BASEEURO <> 0 AND ASIEN = (SELECT ASIEN FROM vn.XDiario WHERE id = vXDiarioId) - )sub - SET xmi.CodigoRetencion = t.CodigoRetencion, - xmi.ClaveOperacionFactura = IF( t.Retencion = 'ARRENDAMIENTO Y SUBARRENDAMIENTO', 'R', xmi.ClaveOperacionFactura), - xmi.BaseRetencion = IF (t.CodigoRetencion = 2, sub.taxableBase + sub.taxBase, sub.taxableBase), - xmi.PorRetencion = t.PorcentajeRetencion, - xmi.ImporteRetencion = iit.taxableBase * - 1 - WHERE xmi.id = vXDiarioId AND iit.expenceFk = 4751000000; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `XDiario_movConta_IVA_InvoiceOutAdd_Manager__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `XDiario_movConta_IVA_InvoiceOutAdd_Manager__`() -BEGIN - - DECLARE done BOOL DEFAULT FALSE; - DECLARE vInvoiceFk INT; - DECLARE vXDiarioFk INT; - DECLARE vDated DATE; - - DECLARE rs CURSOR FOR - SELECT io.id invoiceOutFk, x.XDiarioFk - FROM vn.invoiceOut io - JOIN (SELECT MIN(id) XDiarioFk, refFk - FROM vn2008.XDiario x - JOIN (SELECT x.ASIEN, CONCAT(x.SERIE,x.FACTURA) AS refFk - FROM vn2008.XDiario x - JOIN vn.company c ON c.id = x.empresa_id - WHERE enlazadoSage = FALSE AND - x.FACTURA AND - c.companyCode AND - x.FECHA >= vDated - GROUP BY refFk - ) a ON a.ASIEN = x.ASIEN - GROUP BY refFk - ) x ON x.refFk = io.ref; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - SELECT CONCAT(YEAR(util.VN_CURDATE()), "-01-01") INTO vDated; -SELECT "2021-01-01" INTO vDated; - OPEN rs; - FETCH rs INTO vInvoiceFk, vXDiarioFk; - WHILE NOT done DO - CALL XDiario_movConta_IVA_InvoiceOutAdd(vInvoiceFk, vXDiarioFk); - FETCH rs INTO vInvoiceFk, vXDiarioFk; - 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 `XDiario_movConta_IVA_InvoiceOutAdd__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `XDiario_movConta_IVA_InvoiceOutAdd__`(IN vInvoiceOutFk INT, IN vXDiarioId INT) -BEGIN - - DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vBase DOUBLE; - DECLARE vVat DOUBLE; - DECLARE vRate DOUBLE; - DECLARE vIs340 DOUBLE; - DECLARE vIs347 DOUBLE; - DECLARE vVatRE DOUBLE; - DECLARE vRateRE DOUBLE; - DECLARE vTransactionCode INT; - DECLARE vCounter INT DEFAULT 0; - DECLARE vInvoiceOutCorrectedFk INT; - DECLARE vTaxCode INT; - DECLARE vIsIntracommunity BOOL DEFAULT FALSE; - DECLARE vOperationCode VARCHAR(1); - - -- IVA - DECLARE rs CURSOR FOR - SELECT oit.taxableBase, - oit.vat, - pgc.rate, - pgc.mod340, - pgc.mod347, - pgcRE.rate as rateRE, - oitRE.vat as vatRE, - tc.transactionCode , - tc.taxCode, - tc.isIntracommunity, - tc.operationcode - FROM vn.invoiceOutTax oit - JOIN vn.pgc ON pgc.code = oit.pgcFk - LEFT JOIN vn.pgcEqu e ON e.vatFk = oit.pgcFk - LEFT JOIN vn.pgcEqu eRE ON eRE.equFk = oit.pgcFk - LEFT JOIN vn.invoiceOutTax oitRE ON oitRE.invoiceOutFk = oit.invoiceOutFk AND oitRE.pgcFk = e.equFk - LEFT JOIN vn.pgc pgcRE ON pgcRE.code = oitRE.pgcFk - LEFT JOIN vn.taxCode tc ON tc.code = pgc.code COLLATE 'utf8_general_ci' - WHERE eRE.equFk Is NULL - AND oit.invoiceOutFk = vInvoiceOutFk - GROUP by pgc.code; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - DELETE FROM XDiario_movConta_IVA - WHERE id = vXDiarioId; - - INSERT INTO XDiario_movConta_IVA(id) - VALUES (vXDiarioId); - OPEN rs; - FETCH rs INTO vBase, - vVat, - vRate, - vIs340, - vIs347, - vVatRE, - vRateRE, - vTransactionCode, - vTaxCode, - vIsIntracommunity, - vOperationCode; - - WHILE NOT vDone DO - - IF vOperationCode IS NOT NULL THEN - UPDATE XDiario_movConta_IVA - SET ClaveOperacionFactura = vOperationCode - WHERE id = vXDiarioId; - END IF; - - SET vCounter = vCounter + 1; - CASE vCounter - WHEN 1 THEN - UPDATE XDiario_movConta_IVA - SET BaseIva1 = vBase, - PorIva1 = vRate, - CuotaIva1 = vVat, - PorRecargoEquivalencia1 = vVatRE, - RecargoEquivalencia1 = vRateRE, - CodigoTransaccion1 = vTransactionCode, - CodigoIva1 = vTaxCode - WHERE id = vXDiarioId; - WHEN 2 THEN - UPDATE XDiario_movConta_IVA - SET BaseIva2 = vBase, - PorIva2 = vRate, - CuotaIva2 = vVat, - PorRecargoEquivalencia2 = vVatRE, - RecargoEquivalencia2 =vRateRE, - CodigoTransaccion2 = vTransactionCode, - CodigoIva2 = vTaxCode - WHERE id = vXDiarioId; - WHEN 3 THEN - UPDATE XDiario_movConta_IVA - SET BaseIva3 = vBase, - PorIva3 = vRate, - CuotaIva3 = vVat, - PorRecargoEquivalencia3 = vVatRE, - RecargoEquivalencia3 = vRateRE, - CodigoTransaccion3 = vTransactionCode, - CodigoIva3 = vTaxCode - WHERE id = vXDiarioId; - WHEN 4 THEN - UPDATE XDiario_movConta_IVA - SET BaseIva4 = vBase, - PorIva4 = vRate, - CuotaIva4 = vVat, - PorRecargoEquivalencia4 = vVatRE, - RecargoEquivalencia4 = vRateRE, - CodigoTransaccion4 = vTransactionCode, - CodigoIva4 = vTaxCode - WHERE id = vXDiarioId; - END CASE; - - UPDATE XDiario_movConta_IVA - SET Exclusion347 = NOT vIs347 - WHERE id = vXDiarioId; - - IF vIsIntracommunity THEN - UPDATE XDiario_movConta_IVA - SET Intracomunitaria = TRUE - WHERE id = vXDiarioId; - END IF; - - FETCH rs INTO vBase, - vVat, - vRate, - vIs340, - vIs347, - vVatRE, - vRateRE, - vTransactionCode, - vTaxCode, - vIsIntracommunity, - vOperationCode; - END WHILE; - CLOSE rs; - -- OTROS CAMPOS RELATIVOS A LAS FACTURAS - UPDATE XDiario_movConta_IVA xmi - JOIN vn.invoiceOut io ON io.id = vInvoiceOutFk - LEFT JOIN vn.invoiceCorrection ic ON ic.correctedFk = vInvoiceOutFk - LEFT JOIN vn.invoiceOut ioc ON ioc.id = ic.correctingFk - JOIN vn2008.XDiario x ON x.id = xmi.id - JOIN vn.client c ON c.id = io.clientFk - JOIN Naciones n ON n.countryFk = c.countryFk - JOIN vn.invoiceOutSerial ios ON ios.code = io.serial - JOIN vn.taxArea ta ON ta.code = ios.taxAreaFk - JOIN (SELECT SERIE - FROM vn2008.XDiario - WHERE ASIEN = (SELECT ASIEN - FROM vn2008.XDiario - WHERE id = vXDiarioId - ) - AND SERIE IS NOT NULL - ) sub - SET xmi.Año = YEAR(io.issued), - xmi.Serie = sub.SERIE, - xmi.Factura = RIGHT(io.ref, LENGTH(io.ref) -1), - xmi.FechaFactura = io.issued, - xmi.ImporteFactura = io.amount, - xmi.TipoFactura = "E", - xmi.CodigoCuentaFactura = x.SUBCTA, - xmi.CifDni = c.fi, - xmi.Nombre = SUBSTR(c.socialName,1,35), - xmi.SiglaNacion = n.SiglaNacion, - xmi.EjercicioFactura = YEAR(io.issued), - xmi.FechaOperacion = io.issued, - xmi.MantenerAsiento = TRUE, - xmi.FechaFacturaOriginal = x.FECHA_EX - WHERE xmi.id = vXDiarioId; - - -- RECTIFICATIVAS - SELECT correctedFk - INTO vInvoiceOutCorrectedFk - FROM vn.invoiceCorrection - WHERE correctingFk = vInvoiceOutFk; - - IF vInvoiceOutCorrectedFk THEN - UPDATE XDiario_movConta_IVA xmi - JOIN vn.invoiceOut ioc ON ioc.id = vInvoiceOutCorrectedFk - JOIN vn.invoiceCorrection ic ON ic.correctedFk = vInvoiceOutCorrectedFk - JOIN vn.invoiceOut io ON io.id = vInvoiceOutCorrectedFk - JOIN ( - SELECT sum(IF(IFNULL(e.vatFk,1),iot.taxableBase,0)) AS Base, - sum(IF(IFNULL(e.vatFk,1),iot.vat,0)) AS CuotaIva, - sum(IF(IFNULL(e.vatFk,1),0,iot.vat)) as RE - FROM vn.invoiceOutTax iot - LEFT JOIN vn.pgcEqu e ON e.vatFk = iot.pgcFk - WHERE iot.invoiceOutFk = vInvoiceOutCorrectedFk - ) iocTAX - SET xmi.TipoRectificativa = 2, - xmi.ClaseAbonoRectificativas = 1, -- ic.invoiceCorrectionTypeFk no coincide con las opcioens de SAGE * - xmi.FechaFacturaOriginal = io.issued, - xmi.FechaOperacion = io.issued, - xmi.BaseImponibleOriginal = iocTAX.Base, - xmi.CuotaIvaOriginal = iocTAX.CuotaIva, - xmi.RecargoEquivalenciaOriginal = RE, - xmi.ClaveOperacionFactura = 'D' - WHERE xmi.id = vXDiarioId; - /* - Envases y embalajes / descuentos y bonificaciones / eror fundado - Concurso de acreedores - Creditos incobrables - resto de tectificativas - Restificativas de facturas simplificadas - */ - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_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: `salix` -- -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `salix` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `salix` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci */; USE `salix`; @@ -23352,17 +17884,17 @@ DROP TABLE IF EXISTS `ACL`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ACL` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `model` varchar(512) CHARACTER SET utf8 DEFAULT NULL, - `property` varchar(512) CHARACTER SET utf8 DEFAULT NULL, - `accessType` set('READ','WRITE','*') COLLATE utf8_unicode_ci DEFAULT 'READ', - `permission` set('DENY','ALLOW') COLLATE utf8_unicode_ci DEFAULT 'ALLOW', - `principalType` set('ROLE','USER') COLLATE utf8_unicode_ci DEFAULT 'ROLE', - `principalId` varchar(512) CHARACTER SET utf8 DEFAULT NULL, + `model` varchar(512) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `property` varchar(512) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `accessType` set('READ','WRITE','*') DEFAULT 'READ', + `permission` set('DENY','ALLOW') DEFAULT 'ALLOW', + `principalType` set('ROLE','USER') DEFAULT 'ROLE', + `principalId` varchar(512) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `model_ix` (`model`(255)) COMMENT 'ernesto 3.8.2020. Mysql pide indices', KEY `property_ix` (`property`(255)), KEY `accessType_ix` (`accessType`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23373,13 +17905,13 @@ DROP TABLE IF EXISTS `AccessToken`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `AccessToken` ( - `id` varchar(255) CHARACTER SET utf8 NOT NULL, + `id` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `ttl` int(11) DEFAULT NULL, - `scopes` varchar(255) CHARACTER SET utf8 DEFAULT NULL, + `scopes` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `created` datetime DEFAULT NULL, `userId` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23462,9 +17994,9 @@ DROP TABLE IF EXISTS `defaultViewConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `defaultViewConfig` ( - `tableCode` varchar(25) COLLATE utf8_unicode_ci NOT NULL, - `columns` text COLLATE utf8_unicode_ci NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='The default configuration of columns for views'; + `tableCode` varchar(25) NOT NULL, + `columns` text NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='The default configuration of columns for views'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23476,12 +18008,12 @@ DROP TABLE IF EXISTS `fieldAcl`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `fieldAcl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `model` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `property` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `actionType` set('insert','update','*') COLLATE utf8_unicode_ci DEFAULT '*', - `role` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `model` varchar(255) DEFAULT NULL, + `property` varchar(255) DEFAULT NULL, + `actionType` set('insert','update','*') DEFAULT '*', + `role` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23492,9 +18024,39 @@ DROP TABLE IF EXISTS `module`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `module` ( - `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(45) NOT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `printConfig` +-- + +DROP TABLE IF EXISTS `printConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `printConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itRecipient` varchar(50) DEFAULT NULL COMMENT 'IT recipients for report mailing', + `incidencesEmail` varchar(50) DEFAULT NULL COMMENT 'CAU destinatary email', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Print service config'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `url` +-- + +DROP TABLE IF EXISTS `url`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `url` ( + `appName` varchar(100) NOT NULL, + `environment` varchar(100) NOT NULL, + `url` varchar(255) NOT NULL, + PRIMARY KEY (`appName`,`environment`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23507,11 +18069,11 @@ DROP TABLE IF EXISTS `userConfigView`; CREATE TABLE `userConfigView` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userFk` int(10) unsigned NOT NULL, - `tableCode` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `configuration` text COLLATE utf8_unicode_ci DEFAULT NULL, + `tableCode` varchar(255) NOT NULL, + `configuration` text DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `uniqueUser_TableCode` (`userFk`,`tableCode`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23526,7 +18088,7 @@ CREATE TABLE `userConfigView` ( -- Current Database: `stock` -- -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `stock` /*!40100 DEFAULT CHARACTER SET utf8 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `stock` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */; USE `stock`; @@ -23553,7 +18115,7 @@ CREATE TABLE `inbound` ( UNIQUE KEY `source` (`tableName`,`tableId`), KEY `warehouseFk` (`warehouseFk`,`itemFk`,`dated`,`expired`,`available`), KEY `isSync` (`isSync`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_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 */ ; @@ -23569,7 +18131,7 @@ DELIMITER ;; FOR EACH ROW BEGIN SET NEW.isPicked = NEW.isPicked OR NEW.dated < util.VN_CURDATE(); - + CALL visible_log( NEW.isPicked, NEW.warehouseFk, @@ -23631,7 +18193,7 @@ CREATE TABLE `inboundPick` ( PRIMARY KEY (`inboundFk`,`outboundFk`,`quantity`), UNIQUE KEY `buyFk` (`inboundFk`,`outboundFk`), KEY `saleFk` (`outboundFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23648,7 +18210,7 @@ CREATE TABLE `log` ( `tableId` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `tableName` (`tableName`,`tableId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23676,7 +18238,7 @@ CREATE TABLE `outbound` ( KEY `warehouseFk` (`warehouseFk`,`itemFk`,`dated`), KEY `expired` (`expired`), KEY `isSync` (`isSync`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_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 */ ; @@ -23693,7 +18255,7 @@ DELIMITER ;; BEGIN SET NEW.lack = NEW.quantity; SET NEW.isPicked = NEW.isPicked OR NEW.dated < util.VN_CURDATE(); - + CALL visible_log( NEW.isPicked, NEW.warehouseFk, @@ -23753,7 +18315,7 @@ CREATE TABLE `visible` ( `warehouseFk` int(10) unsigned NOT NULL, `quantity` int(11) NOT NULL, PRIMARY KEY (`itemFk`,`warehouseFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23765,14 +18327,14 @@ 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 character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_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 `log_clean` ON SCHEDULE EVERY 1 DAY STARTS '2022-01-28 09:29:18' ON COMPLETION PRESERVE ENABLE DO CALL log_clean */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `log_clean` ON SCHEDULE EVERY 1 DAY STARTS '2022-01-28 09:29:18' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL log_clean */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -23904,7 +18466,7 @@ BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + SET vSupplied = 0; OPEN vPicks; @@ -23920,7 +18482,7 @@ BEGIN SET vPickGranted = LEAST(vRequested - vSupplied, vPickQuantity); SET vSupplied = vSupplied + vPickGranted; CALL inbound_removePick(vSelf, vOutboundFk, vPickGranted, vPickQuantity); - + UPDATE outbound SET isSync = FALSE, lack = lack + vPickGranted @@ -24000,7 +18562,7 @@ BEGIN END IF; SET vSupplied = LEAST(vAvailable, vLack); - + IF vSupplied > 0 THEN SET vAvailable = vAvailable - vSupplied; UPDATE outbound @@ -24013,7 +18575,7 @@ BEGIN SET vSupplied = vSupplied + vSuppliedFromRequest; SET vAvailable = vAvailable - vSuppliedFromRequest; END IF; - + IF vSupplied > 0 THEN CALL inbound_addPick(vSelf, vOutboundFk, vSupplied); END IF; @@ -24069,76 +18631,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 `log_add_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 `log_add_beta__`(IN `vTableName` VARCHAR(255), IN `vNewId` VARCHAR(255), IN `vOldId` VARCHAR(255)) -proc: BEGIN - -- XXX: Disabled while testing - DECLARE vLanded DATE; - DECLARE vWarehouseFk INT; - DECLARE vBuyerFk INT; - DECLARE vEntryFk INT; - DECLARE vItemFk INT; - DECLARE vItemName VARCHAR(50); - - -- LEAVE proc; - - IF vOldId IS NOT NULL AND !(vOldId <=> vNewId) THEN - INSERT IGNORE INTO `log` SET - tableName = vTableName, - tableId = vOldId, - operation = 'delete'; - END IF; - - IF vNewId IS NOT NULL THEN - INSERT IGNORE INTO `log` SET - tableName = vTableName, - tableId = vNewId, - operation = 'insert'; - END IF; - - IF vTableName = 'buy' THEN - - SELECT IFNULL(tr.landed,'2000-01-01') - INTO vLanded - FROM vn.travel tr - JOIN vn.entry e ON e.travelFk = tr.id - JOIN vn.buy b ON b.entryFk = e.id - JOIN vn.warehouse w ON w.id = tr.warehouseInFk - WHERE b.id = vNewId - AND w.isBuyerToBeEmailed; - - IF vLanded = util.VN_CURDATE() THEN - - SELECT it.workerFk, b.entryFk, i.id, i.longName - INTO vBuyerFk, vEntryFk, vItemFk, vItemName - FROM vn.itemType it - JOIN vn.item i ON i.typeFk = it.id - JOIN vn.buy b ON b.itemFk = i.id - WHERE b.id = vNewId; - - CALL vn.mail_insert(CONCAT(account.user_getNameFromId(vBuyerFk),'@verdnatura.es'), - CONCAT(account.myUser_getName(),'@verdnatura.es'), - CONCAT('E-',vEntryFk,' Se ha modificado item ', vItemFk, ' ',vItemName), - 'Este email se ha generado automáticamente'); - - 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 `log_clean` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -24212,7 +18704,7 @@ BEGIN DO RELEASE_LOCK('stock.log_sync'); RESIGNAL; END; - + IF !GET_LOCK('stock.log_sync', 30) THEN CALL util.throw('Lock timeout exceeded'); END IF; @@ -24683,7 +19175,7 @@ BEGIN SET vPickGranted = LEAST(vRequested - vSupplied, vPickQuantity); SET vSupplied = vSupplied + vPickGranted; CALL inbound_removePick(vInboundFk, vSelf, vPickGranted, vPickQuantity); - + UPDATE inbound SET isSync = FALSE, available = available + vPickGranted @@ -24830,11 +19322,25 @@ DELIMITER ; -- Current Database: `util` -- - -CREATE SCHEMA IF NOT EXISTS `util`; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `util` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci */; USE `util`; +-- +-- Table structure for table `binlogQueue` +-- + +DROP TABLE IF EXISTS `binlogQueue`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `binlogQueue` ( + `code` varchar(255) NOT NULL, + `logName` varchar(255) NOT NULL, + `position` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Binary log position of asynchronous queues'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `config` -- @@ -24844,12 +19350,12 @@ DROP TABLE IF EXISTS `config`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `config` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `dbVersion` char(11) CHARACTER SET utf8 DEFAULT NULL COMMENT 'The current database version', + `dbVersion` char(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'The current database version', `hasTriggersDisabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Defines if triggers are disabled', - `environment` varchar(45) CHARACTER SET utf8 DEFAULT NULL COMMENT 'The current Database environment', + `environment` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'The current Database environment', `lastDump` datetime DEFAULT NULL COMMENT 'Timestamp of the last data dump', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration table'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration table'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -24863,13 +19369,133 @@ CREATE TABLE `debug` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `connectionId` int(10) unsigned DEFAULT NULL, - `user` varchar(255) CHARACTER SET utf8 DEFAULT NULL, - `host` varchar(255) CHARACTER SET utf8 DEFAULT NULL, - `variable` varchar(255) CHARACTER SET utf8 DEFAULT NULL, - `value` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `user` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `host` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `variable` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `value` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `created` (`created`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Log de depuración'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Log de depuración'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `eventLog` +-- + +DROP TABLE IF EXISTS `eventLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `eventLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `date` datetime NOT NULL, + `event` varchar(512) NOT NULL, + `error` varchar(1024) NOT NULL, + PRIMARY KEY (`id`), + KEY `date` (`date`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Event scheduler error log'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `eventLogGrouped` +-- + +DROP TABLE IF EXISTS `eventLogGrouped`; +/*!50001 DROP VIEW IF EXISTS `eventLogGrouped`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `eventLogGrouped` ( + `lastHappened` tinyint NOT NULL, + `nErrors` tinyint NOT NULL, + `event` tinyint NOT NULL, + `error` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `notification` +-- + +DROP TABLE IF EXISTS `notification`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `notification` ( + `id` int(11) NOT NULL, + `name` varchar(255) DEFAULT NULL, + `description` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `notificationAcl` +-- + +DROP TABLE IF EXISTS `notificationAcl`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `notificationAcl` ( + `notificationFk` int(11) NOT NULL, + `roleFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`notificationFk`,`roleFk`), + KEY `notificationAcl_ibfk_2` (`roleFk`), + CONSTRAINT `notificationAcl_ibfk_1` FOREIGN KEY (`notificationFk`) REFERENCES `notification` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `notificationAcl_ibfk_2` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `notificationConfig` +-- + +DROP TABLE IF EXISTS `notificationConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `notificationConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `cleanDays` mediumint(9) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `notificationQueue` +-- + +DROP TABLE IF EXISTS `notificationQueue`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `notificationQueue` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `notificationFk` varchar(255) DEFAULT NULL, + `params` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`params`)), + `authorFk` int(10) unsigned DEFAULT NULL, + `status` enum('pending','sent','error') NOT NULL DEFAULT 'pending', + `created` datetime DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `notificationFk` (`notificationFk`), + KEY `authorFk` (`authorFk`), + KEY `status` (`status`), + CONSTRAINT `nnotificationQueue_ibfk_1` FOREIGN KEY (`notificationFk`) REFERENCES `notification` (`name`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `notificationQueue_ibfk_2` FOREIGN KEY (`authorFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `notificationSubscription` +-- + +DROP TABLE IF EXISTS `notificationSubscription`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `notificationSubscription` ( + `notificationFk` int(11) NOT NULL, + `userFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`notificationFk`,`userFk`), + KEY `notificationSubscription_ibfk_2` (`userFk`), + CONSTRAINT `notificationSubscription_ibfk_1` FOREIGN KEY (`notificationFk`) REFERENCES `notification` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `notificationSubscription_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -24880,13 +19506,13 @@ DROP TABLE IF EXISTS `version`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `version` ( - `code` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `number` char(11) COLLATE utf8_unicode_ci DEFAULT NULL, - `gitCommit` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `code` varchar(50) NOT NULL, + `number` char(11) DEFAULT NULL, + `gitCommit` varchar(255) DEFAULT NULL, `updated` datetime DEFAULT NULL, - `lastNumber` char(11) COLLATE utf8_unicode_ci DEFAULT NULL, + `lastNumber` char(11) DEFAULT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -24897,15 +19523,15 @@ DROP TABLE IF EXISTS `versionLog`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `versionLog` ( - `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, + `code` varchar(50) NOT NULL, + `number` char(11) NOT NULL, + `file` varchar(255) NOT NULL, + `user` varchar(255) DEFAULT NULL, `updated` datetime NOT NULL, `errorNumber` int(10) unsigned DEFAULT NULL, - `errorMessage` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `errorMessage` varchar(255) DEFAULT NULL, PRIMARY KEY (`code`,`number`,`file`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -24917,14 +19543,14 @@ 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 character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_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 `slowLog_prune` ON SCHEDULE EVERY 1 DAY STARTS '2021-10-08 00:00:00' ON COMPLETION PRESERVE ENABLE DO CALL util.slowLog_prune */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `slowLog_prune` ON SCHEDULE EVERY 1 DAY STARTS '2021-10-08 00:00:00' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL util.slowLog_prune */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -24984,11 +19610,11 @@ BEGIN WHILE vI < vLen DO SET vSpaceIni = vI; - + WHILE MID(vString, vI, 1) REGEXP '[[:space:]]' DO SET vI = vI + 1; END WHILE; - + SET vWordIni = vI; SET vI = vWordIni + 1; @@ -25025,11 +19651,11 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `crypt`(vText VARCHAR(255), vKey VARC BEGIN DECLARE vResult VARCHAR(255); - + CALL vn.crypt(vText, vKey, vResult); RETURN vResult; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -25051,18 +19677,18 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `cryptOff`(vText VARCHAR(255), vKey V BEGIN DECLARE vResult VARCHAR(255); - + CALL vn.cryptOff(vText, vKey, vResult); 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 `dayend` */; +/*!50003 DROP FUNCTION IF EXISTS `dayEnd` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -25072,7 +19698,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `dayend`(vDated DATE) RETURNS datetime +CREATE DEFINER=`root`@`localhost` FUNCTION `dayEnd`(vDated DATE) RETURNS datetime NO SQL DETERMINISTIC BEGIN @@ -25116,6 +19742,102 @@ 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 `CURDATE` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = 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 `util`.`CURDATE`() RETURNS date + DETERMINISTIC +BEGIN + /** + * @return The mock date + **/ + + RETURN DATE(mockTime()); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 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 `mockTime` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = 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 `util`.`mockTime`() RETURNS datetime + DETERMINISTIC +BEGIN +/** + * Returns the mockTime with predefined timezone or current dateTime + * depending of config.mockEnabled + * + * @return formatted datetime + */ + DECLARE vMockEnabled BOOL; + + SELECT mockEnabled INTO vMockEnabled FROM config LIMIT 1; + + IF vMockEnabled THEN + RETURN mockTimeBase(FALSE); + ELSE + RETURN 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 FUNCTION IF EXISTS `mockTimeBase` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = 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 `util`.`mockTimeBase`(vIsUtc BOOL) RETURNS datetime + DETERMINISTIC +BEGIN +/** + * Returns the date formatted to utc if vIsUtc or config.mocTz if not + * + * @param vIsUtc If date must be returned as UTC format + * @return The formatted mock time + */ +DECLARE vMockUtcTime DATETIME; + DECLARE vMockTz VARCHAR(255); + + SELECT mockUtcTime, mockTz + INTO vMockUtcTime, vMockTz + FROM config + LIMIT 1; + + IF vIsUtc OR vMockTz IS NULL THEN + RETURN vMockUtcTime; + ELSE + RETURN CONVERT_TZ(vMockUtcTime, '+00:00', vMockTz); + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 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 `firstDayOfYear` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -25143,6 +19865,74 @@ 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 `formatRow` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = 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 `formatRow`(vType CHAR(3), vValues VARCHAR(512)) RETURNS varchar(512) CHARSET utf8 COLLATE utf8_unicode_ci + DETERMINISTIC +BEGIN + DECLARE vRow VARCHAR(512); + + IF vValues IS NOT NULL THEN + SET vRow = CONCAT(' + + ', vType ,' + ', REPLACE(vValues, ',', '') ,' + + '); + ELSE + SET vRow = ''; + END IF; + + RETURN vRow; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 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 `formatTable` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = 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 `formatTable`(vFields VARCHAR(512), vOldValues VARCHAR(512), vNewValues VARCHAR(512)) RETURNS text CHARSET utf8 COLLATE utf8_unicode_ci + DETERMINISTIC +BEGIN + DECLARE vTable TEXT; + + SET vTable = CONCAT(' + + + + + + ', formatRow('old', vOldValues) ,' + ', formatRow('new', vNewValues) ,' + +
type', REPLACE(vFields, ',', '') ,' +
+ '); + + RETURN vTable; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 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 `hasDateOverlapped` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -25155,7 +19945,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `hasDateOverlapped`(vSarted1 DATE, vEnded1 DATE, vSarted2 DATE, vEnded2 DATE) RETURNS tinyint(1) DETERMINISTIC -BEGIN +BEGIN RETURN GREATEST(vSarted1, vSarted2) <= LEAST(vEnded1,vEnded2); @@ -25184,7 +19974,7 @@ BEGIN */ DECLARE vHashlen INT UNSIGNED; DECLARE vOpad, vIpad TINYBLOB; - + CASE vAlg WHEN 224 THEN SET vHashlen = 64; WHEN 256 THEN SET vHashlen = 64; @@ -25192,16 +19982,16 @@ BEGIN WHEN 512 THEN SET vHashlen = 128; ELSE CALL throw ('WRONG_ALGORYTHM_IDENTIFICATOR_USED'); END CASE; - + IF LENGTH(vKey) > vHashlen THEN SET vKey = UNHEX(SHA2(vKey, vAlg)); END IF; - + SET vKey = RPAD(vKey, vHashlen, 0x00); - + SET vIpad = stringXor(vKey, 0x36); SET vOpad = stringXor(vKey, 0x5C); - + RETURN SHA2(CONCAT(vOpad, UNHEX(SHA2(CONCAT(vIpad, vMsg), vAlg))), vAlg); END ;; DELIMITER ; @@ -25224,7 +20014,49 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `isLeapYear`(vYear INT) RETURNS tinyi BEGIN RETURN (DAYOFYEAR(CONCAT(vYear, "-02-29")) 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 FUNCTION IF EXISTS `json_removeNulls` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = 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 `json_removeNulls`(vObject JSON) RETURNS longtext CHARSET utf8mb4 COLLATE utf8mb4_bin +BEGIN +/** + * Elimina las propiedades con valor NULL de un objeto. + * + * @param vObject El objeto en formato JSON + * @return El objeto JSON sin propiedades a NULL + */ + DECLARE vKeys JSON; + DECLARE vKey VARCHAR(255); + DECLARE vValue VARCHAR(255); + DECLARE i INT DEFAULT 0; + DECLARE vCount INT; + + SET vKeys = JSON_KEYS(vObject); + SET vCount = JSON_LENGTH(vKeys); + WHILE i < vCount DO + SET vKey = JSON_VALUE(vKeys, CONCAT('$[',i,']')); + SET vValue = JSON_VALUE(vObject, CONCAT('$.', vKey)); + IF vValue IS NULL THEN + SET vObject = JSON_REMOVE(vObject, CONCAT('$.', vKey)); + END IF; + SET i := i + 1; + END WHILE; + + RETURN vObject; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -25297,7 +20129,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `midnight`() RETURNS datetime READS SQL DATA BEGIN - + RETURN TIMESTAMP(util.VN_CURDATE(), '23:59:59'); END ;; @@ -25325,7 +20157,7 @@ BEGIN * modo 3. */ DECLARE vYear INT DEFAULT FLOOR(vYearWeek / 100); - + IF vYearWeek < YEARWEEK(CONCAT(vYear, '-12-31'), 3) THEN RETURN vYearWeek + 1; ELSE @@ -25337,6 +20169,40 @@ 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 `notification_send` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `notification_send`(vNotificationName VARCHAR(255), vParams TEXT, vAuthorFk INT) RETURNS int(11) + MODIFIES SQL DATA +BEGIN +/** + * Sends a notification. + * + * @param vNotificationName The notification name + * @param vParams The notification parameters formatted as JSON + * @param vAuthorFk The notification author or %NULL if there is no author + * @return The notification id + */ + + INSERT INTO notificationQueue + SET notificationFk = vNotificationName, + params = vParams, + authorFk = vAuthorFk; + + RETURN 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 FUNCTION IF EXISTS `quarterFirstDay` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -25357,6 +20223,27 @@ 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 `quoteIdentifier` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = 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 `quoteIdentifier`(vString TEXT) RETURNS text CHARSET utf8mb3 + NO SQL + DETERMINISTIC +BEGIN + RETURN CONCAT('`', REPLACE(vString, '`', '``'), '`'); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 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 `stringXor` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -25376,16 +20263,16 @@ BEGIN */ DECLARE vLen, vPos INT UNSIGNED; DECLARE vResult MEDIUMBLOB; - + SET vLen = LENGTH(vString); SET vPos = 1; SET vResult = ''; - + WHILE vPos <= vLen DO SET vResult = CONCAT(vResult, LPAD(HEX( ORD(SUBSTR(vString, vPos, 1)) ^ vConst), 2, '0')); SET vPos = vPos + 1; END WHILE; - + RETURN UNHEX(vResult); END ;; DELIMITER ; @@ -25495,11 +20382,11 @@ BEGIN IF vYear = vCurYear THEN RETURN 'curYear'; END IF; - + IF vYear = vCurYear - 1 THEN RETURN 'lastYear'; END IF; - + IF vYear = vCurYear - 2 THEN RETURN 'twoYearsAgo'; END IF; @@ -25536,6 +20423,32 @@ 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 `checkHex` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `checkHex`(vParam VARCHAR(255)) +BEGIN +/** + * Comprueba si vParam es un número hexadecimal que empieza por # y tiene una longitud total de 7 dígitos + * + * @param expresión a comprobar + */ + IF vParam NOT REGEXP ('^#[0-9a-f]{6}$') THEN + CALL util.throw('Invalid RGB format'); + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `compareObjects` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -25560,10 +20473,10 @@ BEGIN */ SET vChain = CONCAT('%', vChain, '%'); SET vCompare = CONCAT('%', vCompare, '%'); - SELECT * FROM + SELECT * FROM ( SELECT t1.* FROM - ( + ( SELECT `db`, `name`, @@ -25590,7 +20503,7 @@ BEGIN 'TRIGGER', `ACTION_STATEMENT`, NULL, - NULL + NULL FROM `information_schema`.`TRIGGERS` WHERE `ACTION_STATEMENT` LIKE vChain COLLATE utf8_general_ci UNION ALL @@ -25600,7 +20513,7 @@ BEGIN 'VIEW', `VIEW_DEFINITION`, NULL, - NULL + NULL FROM `information_schema`.`VIEWS` WHERE `VIEW_DEFINITION` LIKE vChain COLLATE utf8_general_ci ) t1 @@ -25631,7 +20544,7 @@ BEGIN 'TRIGGER', `ACTION_STATEMENT`, NULL, - NULL + NULL FROM `information_schema`.`TRIGGERS` WHERE `ACTION_STATEMENT` LIKE vCompare COLLATE utf8_general_ci UNION ALL @@ -25641,7 +20554,7 @@ BEGIN 'VIEW', `VIEW_DEFINITION`, NULL, - NULL + NULL FROM `information_schema`.`VIEWS` WHERE `VIEW_DEFINITION` LIKE vCompare COLLATE utf8_general_ci) t2 ON t2.name = t1.name ORDER BY t1.`db`, t1.`name` @@ -25672,7 +20585,7 @@ BEGIN * @param vValue Valor de la variable */ DECLARE vIndex INT DEFAULT INSTR(USER(), '@'); - + INSERT INTO debug SET `connectionId` = CONNECTION_ID(), `user` = LEFT(USER(), vIndex - 1), @@ -25696,6 +20609,7 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `exec`(vSqlQuery TEXT) + SQL SECURITY INVOKER BEGIN /** * Executes a string with an SQL query. @@ -25708,7 +20622,7 @@ BEGIN EXECUTE stmt; DEALLOCATE PREPARE stmt; - SET @sqlQuery = NULL; + SET @sqlQuery = NULL; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -25738,7 +20652,7 @@ BEGIN SET vChain = CONCAT('%', vChain, '%'); SELECT * FROM - ( + ( SELECT `routine_schema` `schema`, `routine_name` `name`, @@ -25765,7 +20679,7 @@ BEGIN 'TRIGGER', `ACTION_STATEMENT`, NULL, - NULL + NULL FROM `information_schema`.`TRIGGERS` WHERE `ACTION_STATEMENT` LIKE vChain COLLATE utf8_general_ci UNION ALL @@ -25775,7 +20689,7 @@ BEGIN 'VIEW', `VIEW_DEFINITION`, NULL, - NULL + NULL FROM `information_schema`.`VIEWS` WHERE `VIEW_DEFINITION` LIKE vChain COLLATE utf8_general_ci ) t @@ -25786,6 +20700,119 @@ 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 `log_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 `log_add`( + vSchema VARCHAR(45), + vEntity VARCHAR(45), + vChangedModel VARCHAR(45), + vOriginFk INT, + vChangedModelId INT, + vActionCode VARCHAR(45), + vOldInstance JSON, + vNewInstance JSON) +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 vScheme Esquema al que pertenece la tabla. + * @param vEntity Nombre que hace referencia a la tabla. + * @param vOldInstance Valores antiguos + * @param vNewInstance Valores nuevos + */ + CALL util.log_addWithUser(vSchema, vEntity, + vChangedModel, vOriginFk, vChangedModelId, vActionCode, vOldInstance, vNewInstance, 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 `log_addWithUser` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `log_addWithUser`( + vSchema VARCHAR(45), + vEntity VARCHAR(45), + vChangedModel VARCHAR(45), + vOriginFk INT, + vChangedModelId INT, + vActionCode VARCHAR(45), + vOldInstance JSON, + vNewInstance JSON, + vUserId INT) +BEGIN +/** + * Guarda las acciones realizadas por el usuario + * + * @param vScheme Esquema al que pertenece la tabla. + * @param vEntity Nombre que hace referencia a la tabla donde se insertará el log + * @param vChangedModel Nombre que hace referencia a la tabla que se modifica + * @param vOriginFk Id del registro de la tabla origen + * @param vChangedModelId Id del registro de la tabla a la que se realiza la acción + * @param vActionCode Código de la acción {insert | delete | update} + * @param vOldInstance JSON que contiene los valores viejos + * @param vNewInstance JSON que contiene los valores nuevos + * @param vUserId Id del usuario que realiza la acción + */ + DECLARE vTableName VARCHAR(255) DEFAULT CONCAT(IFNULL(vEntity, ''), 'Log'); + DECLARE vKeys JSON; + DECLARE vKey VARCHAR(255); + DECLARE vOldValue VARCHAR(255); + DECLARE vNewValue VARCHAR(255); + DECLARE vValue VARCHAR(255); + DECLARE i INT DEFAULT 0; + DECLARE vCount INT; + + SET vSchema = util.quoteIdentifier(vSchema); + SET vTableName = util.quoteIdentifier(vTableName); + + CASE vActionCode + WHEN 'insert' THEN + SELECT json_removeNulls(vNewInstance) INTO vNewInstance; + WHEN 'update' THEN + SET vKeys = JSON_KEYS(vOldInstance); + SET vCount = JSON_LENGTH(vOldInstance); + WHILE i < vCount DO + SET vKey = JSON_VALUE(vKeys, CONCAT('$[',i,']')); + SET vOldValue = JSON_VALUE(vOldInstance, CONCAT('$.',vKey)); + SET vNewValue = JSON_VALUE(vNewInstance, CONCAT('$.',vKey)); + IF (vOldValue = vNewValue) THEN + SET vOldInstance = JSON_REMOVE(vOldInstance, CONCAT('$.',vKey)); + SET vNewInstance = JSON_REMOVE(vNewInstance, CONCAT('$.',vKey)); + END IF; + SET i := i + 1; + END WHILE; + WHEN 'delete' THEN + SELECT json_removeNulls(vOldInstance) INTO vOldInstance; + END CASE; + + EXECUTE IMMEDIATE CONCAT( + 'INSERT INTO ', vSchema, '.', vTableName, ' SET changedModel = ?, originFk = ?, changedModelId= ?, action = ?, oldInstance = ?, newInstance = ?, userFk = ?' + ) USING vChangedModel, vOriginFk, vChangedModelId, vActionCode, vOldInstance, vNewInstance, 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 `procNoOverlap` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -25911,11 +20938,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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `slowLog_prune`() BEGIN @@ -25923,15 +20950,20 @@ BEGIN * Prunes MySQL slow query log table deleting all records older than one week. */ DECLARE vSlowQueryLog INT DEFAULT @@slow_query_log; + DECLARE vSqlLogBin INT DEFAULT @@SESSION.sql_log_bin; + + SET sql_log_bin = OFF; + SET GLOBAL slow_query_log = OFF; - 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, util.VN_NOW()); RENAME TABLE `mysql`.`slow_log_temp` TO `mysql`.`slow_log`; + SET GLOBAL slow_query_log = vSlowQueryLog; + SET sql_log_bin = vSqlLogBin; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -25984,7 +21016,7 @@ BEGIN INSERT INTO tmp.time (dated) VALUES (vCurrentDate); SET vCurrentDate = DATE_ADD(vCurrentDate, INTERVAL 1 DAY); END WHILE; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -26016,7 +21048,7 @@ DELIMITER ; -- Current Database: `vn` -- -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `vn` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `vn` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci */; USE `vn`; @@ -26046,21 +21078,21 @@ CREATE TABLE `XDiario` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ASIEN` double DEFAULT NULL, `FECHA` datetime DEFAULT NULL, - `SUBCTA` varchar(12) CHARACTER SET utf8 DEFAULT NULL, - `CONTRA` varchar(12) CHARACTER SET utf8 DEFAULT NULL, - `CONCEPTO` varchar(50) CHARACTER SET utf8 DEFAULT NULL, + `SUBCTA` varchar(12) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `CONTRA` varchar(12) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `CONCEPTO` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `EURODEBE` decimal(10,2) DEFAULT NULL, `EUROHABER` decimal(10,2) DEFAULT NULL, `BASEEURO` decimal(10,2) DEFAULT NULL, - `SERIE` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `FACTURA` varchar(8) COLLATE utf8_unicode_ci DEFAULT '0', + `SERIE` varchar(1) DEFAULT NULL, + `FACTURA` varchar(8) DEFAULT '0', `BASEIMPO` decimal(10,2) DEFAULT NULL, `IVA` decimal(10,2) DEFAULT NULL, `RECEQUIV` decimal(10,2) DEFAULT 0.00, - `DOCUMENTO` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `DEPARTA` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + `DOCUMENTO` varchar(10) DEFAULT NULL, + `DEPARTA` varchar(3) DEFAULT NULL, `CLAVE` int(11) DEFAULT NULL, - `ESTADO` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `ESTADO` varchar(1) DEFAULT NULL, `NCASADO` decimal(10,2) DEFAULT NULL, `TCASADO` decimal(10,2) DEFAULT NULL, `TRANS` decimal(10,2) DEFAULT NULL, @@ -26068,22 +21100,22 @@ CREATE TABLE `XDiario` ( `DEBEME` decimal(10,2) DEFAULT NULL, `HABERME` decimal(10,2) DEFAULT NULL, `PTAHABER` decimal(10,2) DEFAULT NULL, - `AUXILIAR` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `SUCURSAL` varchar(4) COLLATE utf8_unicode_ci DEFAULT NULL, + `AUXILIAR` varchar(1) DEFAULT NULL, + `SUCURSAL` varchar(4) DEFAULT NULL, `PTADEBE` decimal(10,2) DEFAULT NULL, - `CODDIVISA` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, + `CODDIVISA` varchar(5) DEFAULT NULL, `IMPAUXME` decimal(10,2) DEFAULT NULL, - `MONEDAUSO` varchar(1) COLLATE utf8_unicode_ci DEFAULT '2', + `MONEDAUSO` varchar(1) DEFAULT '2', `NOCONV` tinyint(1) NOT NULL DEFAULT 0, - `NUMEROINV` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `TIPOOPE` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `NUMEROINV` varchar(10) DEFAULT NULL, + `TIPOOPE` varchar(1) DEFAULT NULL, `NFACTICK` tinyint(1) NOT NULL DEFAULT 1, `TERIDNIF` tinyint(1) NOT NULL DEFAULT 2, - `TERNIF` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'I.F.', - `TERNOM` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Nombre Importador', + `TERNIF` varchar(20) NOT NULL DEFAULT 'I.F.', + `TERNOM` varchar(50) NOT NULL DEFAULT 'Nombre Importador', `OPBIENES` tinyint(1) NOT NULL DEFAULT 1, - `TIPOFAC` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `TIPOIVA` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `TIPOFAC` varchar(1) DEFAULT NULL, + `TIPOIVA` varchar(1) DEFAULT NULL, `L340` tinyint(2) NOT NULL DEFAULT 0, `enlazado` tinyint(1) NOT NULL DEFAULT 0, `FECHA_EX` date DEFAULT NULL COMMENT 'FEcha de expedicion de la factura', @@ -26092,17 +21124,17 @@ CREATE TABLE `XDiario` ( `LDIFADUAN` tinyint(4) NOT NULL DEFAULT 0, `METAL` tinyint(1) NOT NULL DEFAULT 0, `METALIMP` decimal(10,2) NOT NULL DEFAULT 0.00, - `CLIENTE` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL, - `METALEJE` varchar(4) COLLATE utf8_unicode_ci DEFAULT NULL, + `CLIENTE` varchar(12) DEFAULT NULL, + `METALEJE` varchar(4) DEFAULT NULL, `FECHA_OP` date DEFAULT NULL COMMENT 'FEcha de operacion', - `FACTURAEX` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Numero de factura del proveedor', + `FACTURAEX` varchar(45) DEFAULT NULL COMMENT 'Numero de factura del proveedor', `TIPOCLAVE` int(3) DEFAULT NULL, `TIPOEXENCI` int(3) DEFAULT NULL, `TIPONOSUJE` int(3) DEFAULT NULL, `TIPOFACT` int(3) DEFAULT NULL, `TIPORECTIF` int(3) DEFAULT NULL, - `SERIE_RT` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, - `FACTU_RT` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `SERIE_RT` varchar(2) DEFAULT NULL, + `FACTU_RT` varchar(10) DEFAULT NULL, `BASEIMP_RT` decimal(10,2) DEFAULT NULL, `BASEIMP_RF` decimal(10,2) DEFAULT NULL, `RECTIFICA` int(1) NOT NULL DEFAULT 0, @@ -26118,49 +21150,88 @@ CREATE TABLE `XDiario` ( KEY `XDiario` (`enlazado`), KEY `enlazadoSage` (`enlazadoSage`), CONSTRAINT `XDiario_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`XDiario_beforeInsert` BEFORE INSERT ON `XDiario` FOR EACH ROW BEGIN -/* - IF NEW.EURODEBE < 0 THEN - - SET NEW.EUROHABER = - NEW.EURODEBE; - SET NEW.EURODEBE = NULL; - - END IF; - - IF NEW.EUROHABER < 0 THEN - - SET NEW.EURODEBE = - NEW.EUROHABER; - SET NEW.EUROHABER = NULL; - - END IF; - - IF NEW.DEBEME < 0 THEN - - SET NEW.HABERME = - NEW.DEBEME; - SET NEW.DEBEME = NULL; - - END IF; - - IF NEW.HABERME < 0 THEN - - SET NEW.DEBEME = - NEW.HABERME; - SET NEW.HABERME = NULL; - END IF; - */ + IF NEW.SUBCTA <=> '' THEN + SET NEW.SUBCTA = NULL; + END IF; + IF NEW.SUBCTA IS NOT NULL AND NOT LENGTH(NEW.SUBCTA) <=> 10 THEN + CALL util.throw('INVALID_STRING_LENGTH'); + END IF; + IF NEW.CONTRA <=> '' THEN + SET NEW.CONTRA = NULL; + END IF; + IF NEW.CONTRA IS NOT NULL AND NOT LENGTH(NEW.CONTRA) <=> 10 THEN + CALL util.throw('INVALID_STRING_LENGTH'); + END IF; + CALL XDiario_checkDate(NEW.FECHA); + CALL XDiario_checkDate(NEW.FECHA_EX); + CALL XDiario_checkDate(NEW.FECHA_OP); + CALL XDiario_checkDate(NEW.FECHA_RT); + CALL XDiario_checkDate(NEW.FECREGCON); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_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`.`XDiario_beforeUpdate` + BEFORE UPDATE ON `XDiario` + FOR EACH ROW +BEGIN + IF NOT NEW.SUBCTA <=> OLD.SUBCTA THEN + IF NEW.SUBCTA <=> '' THEN + SET NEW.SUBCTA = NULL; + END IF; + IF NEW.SUBCTA IS NOT NULL AND NOT LENGTH(NEW.SUBCTA) <=> 10 THEN + CALL util.throw('INVALID_STRING_LENGTH'); + END IF; + END IF; + IF NOT NEW.CONTRA <=> OLD.CONTRA THEN + IF NEW.CONTRA <=> '' THEN + SET NEW.CONTRA = NULL; + END IF; + IF NEW.CONTRA IS NOT NULL AND NOT LENGTH(NEW.CONTRA) <=> 10 THEN + CALL util.throw('INVALID_STRING_LENGTH'); + END IF; + END IF; + IF NOT NEW.FECHA <=> OLD.FECHA THEN + CALL XDiario_checkDate(NEW.FECHA); + END IF; + IF NOT NEW.FECHA_EX <=> OLD.FECHA_EX THEN + CALL XDiario_checkDate(NEW.FECHA_EX); + END IF; + IF NOT NEW.FECHA_OP <=> OLD.FECHA_OP THEN + CALL XDiario_checkDate(NEW.FECHA_OP); + END IF; + IF NOT NEW.FECHA_RT <=> OLD.FECHA_RT THEN + CALL XDiario_checkDate(NEW.FECHA_RT); + END IF; + IF NOT NEW.FECREGCON <=> OLD.FECREGCON THEN + CALL XDiario_checkDate(NEW.FECREGCON); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -26169,23 +21240,43 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary table structure for view `absenceType` +-- Temporary table structure for view `__coolerPathDetail` +-- + +DROP TABLE IF EXISTS `__coolerPathDetail`; +/*!50001 DROP VIEW IF EXISTS `__coolerPathDetail`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `__coolerPathDetail` ( + `id` tinyint NOT NULL, + `coolerPathFk` tinyint NOT NULL, + `hallway` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `absenceType` -- DROP TABLE IF EXISTS `absenceType`; -/*!50001 DROP VIEW IF EXISTS `absenceType`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `absenceType` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL, - `rgb` tinyint NOT NULL, - `code` tinyint NOT NULL, - `permissionRate` tinyint NOT NULL, - `holidayEntitlementRate` tinyint NOT NULL, - `discountRate` 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 `absenceType` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(30) NOT NULL, + `rgb` varchar(7) NOT NULL, + `color` bigint(20) DEFAULT 0, + `permissionRate` decimal(3,2) DEFAULT NULL, + `code` varchar(45) DEFAULT NULL, + `isAllowedToWork` tinyint(4) NOT NULL DEFAULT 0, + `isPrintable` tinyint(1) NOT NULL DEFAULT 0, + `discountRate` decimal(3,2) DEFAULT NULL, + `holidayEntitlementRate` decimal(3,2) DEFAULT 1.00, + `isNaturalDay` tinyint(1) DEFAULT 0 COMMENT 'Para el cálculo de los salarios de los repartidores', + `isCalculate` tinyint(1) DEFAULT 0 COMMENT 'Para el cálculo de los salarios de los repartidores', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `accounting` @@ -26196,21 +21287,37 @@ DROP TABLE IF EXISTS `accounting`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `accounting` ( `id` int(11) NOT NULL DEFAULT 0, - `bank` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `account` varchar(10) CHARACTER SET utf8 DEFAULT NULL, + `bank` varchar(50) DEFAULT NULL, + `account` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `accountingTypeFk` smallint(6) NOT NULL DEFAULT 0, - `entityFk` int(10) unsigned NOT NULL, + `entityFk` int(10) unsigned DEFAULT NULL, `isActive` tinyint(4) NOT NULL DEFAULT 1, `currencyFk` tinyint(3) unsigned DEFAULT 1, - `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `code` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), KEY `BancosBanco` (`bank`), KEY `fk_Bancos_entity1_idx` (`entityFk`), KEY `foreignkey1_idx` (`accountingTypeFk`), KEY `Bancoscurrency_idx` (`currencyFk`), CONSTRAINT `Bancoscurrency` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE, + CONSTRAINT `accounting_FK` FOREIGN KEY (`entityFk`) REFERENCES `bankEntity` (`id`) ON UPDATE CASCADE, CONSTRAINT `bank_FK` FOREIGN KEY (`accountingTypeFk`) REFERENCES `accountingType` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Apunta a la vista vn.Accounting\nLa columna cash es la FK de vn.AccountingType'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Apunta a la vista vn.Accounting\nLa columna cash es la FK de vn.AccountingType'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `accountingConfig` +-- + +DROP TABLE IF EXISTS `accountingConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `accountingConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `minDate` date NOT NULL, + `maxDate` date NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26222,28 +21329,15 @@ DROP TABLE IF EXISTS `accountingType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `accountingType` ( `id` smallint(6) NOT NULL DEFAULT 0, - `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `receiptDescription` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Descripción por defecto al crear nuevo recibo', - `code` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + `description` varchar(100) NOT NULL, + `receiptDescription` varchar(50) DEFAULT NULL COMMENT 'Descripción por defecto al crear nuevo recibo', + `code` varchar(20) DEFAULT NULL, `isAutoConciliated` tinyint(1) DEFAULT 1 COMMENT 'Si hay que marcar como conciliado el recibo al usar este tipo', `maxAmount` int(11) DEFAULT NULL, + `daysInFuture` int(11) DEFAULT 0, PRIMARY KEY (`id`), KEY `accountingType_code_IDX` (`code`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='descripcio dels valors de la columna "cash" de la taula vn2008.Bancios'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `activeContrat` --- - -DROP TABLE IF EXISTS `activeContrat`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `activeContrat` ( - `date` date NOT NULL, - `business_id` int(11) NOT NULL, - PRIMARY KEY (`date`,`business_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='descripcio dels valors de la columna "cash" de la taula vn2008.Bancios'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26260,7 +21354,7 @@ CREATE TABLE `activityTaxDismissed` ( `notified` int(11) DEFAULT 0, PRIMARY KEY (`clientFk`), CONSTRAINT `clientFk` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26273,33 +21367,25 @@ DROP TABLE IF EXISTS `address`; CREATE TABLE `address` ( `id` int(11) NOT NULL AUTO_INCREMENT, `clientFk` int(11) NOT NULL DEFAULT 0, - `warehouseFk__` smallint(6) unsigned DEFAULT 1, - `street` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `city` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `street` varchar(255) DEFAULT NULL, + `city` varchar(50) DEFAULT NULL, `provinceFk` smallint(5) unsigned DEFAULT NULL, - `postalCode` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `phone` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `mobile` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `nickname` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL, + `postalCode` varchar(10) DEFAULT NULL, + `phone` varchar(15) DEFAULT NULL, + `mobile` varchar(15) DEFAULT NULL, + `nickname` varchar(40) DEFAULT NULL, `isDefaultAddress` tinyint(1) NOT NULL DEFAULT 0, `agencyModeFk` int(11) NOT NULL DEFAULT 2, - `notes__` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `hasInsurance__` tinyint(1) NOT NULL DEFAULT 0, - `porte__` double DEFAULT NULL, `isActive` tinyint(4) NOT NULL DEFAULT 1, - `postcodeOLD__` int(11) unsigned DEFAULT NULL, `longitude` decimal(11,7) DEFAULT NULL, `latitude` decimal(11,7) DEFAULT NULL, - `codPosOld__` char(5) COLLATE utf8_unicode_ci DEFAULT NULL, `isEqualizated` tinyint(1) DEFAULT NULL, `customsAgentFk` int(11) DEFAULT NULL, - `incotermsFk` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `isVilassarBuyer__` tinyint(4) NOT NULL DEFAULT 0, + `incotermsFk` varchar(3) DEFAULT NULL, `isLogifloraAllowed` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `Id_Agencia` (`agencyModeFk`), KEY `Id_cliente` (`clientFk`), - KEY `warehouse_id` (`warehouseFk__`), KEY `province_id` (`provinceFk`), KEY `telefono` (`phone`), KEY `movil` (`mobile`), @@ -26308,11 +21394,10 @@ CREATE TABLE `address` ( KEY `address_incotermsFk_idx` (`incotermsFk`), CONSTRAINT `address_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, CONSTRAINT `address_customsAgentFk` FOREIGN KEY (`customsAgentFk`) REFERENCES `customsAgent` (`id`) ON UPDATE CASCADE, - CONSTRAINT `address_ibfk_1` FOREIGN KEY (`warehouseFk__`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `address_ibfk_3` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE, CONSTRAINT `address_ibfk_4` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE, CONSTRAINT `address_incotermsFk` FOREIGN KEY (`incotermsFk`) REFERENCES `incoterms` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -26338,11 +21423,11 @@ BEGIN END IF; IF NEW.isEqualizated IS NULL THEN - SELECT isEqualizated + SELECT isEqualizated INTO vIsEqualizated FROM client WHERE id = NEW.clientFk; - + SET NEW.isEqualizated = vIsEqualizated; END IF; END */;; @@ -26364,11 +21449,11 @@ DELIMITER ;; BEFORE UPDATE ON `address` FOR EACH ROW BEGIN - + IF !(NEW.phone <=> OLD.phone) AND (NEW.phone <> '') THEN CALL pbx.phone_isValid(NEW.phone); END IF; - + IF !(NEW.mobile <=> OLD.mobile) AND (NEW.mobile <> '')THEN CALL pbx.phone_isValid(NEW.mobile); END IF; @@ -26394,16 +21479,16 @@ DELIMITER ;; BEGIN -- Recargos de equivalencia distintos implican facturacion por consignatario IF NEW.isEqualizated != OLD.isEqualizated THEN - IF + IF (SELECT COUNT(*) FROM ( SELECT DISTINCT (isEqualizated = FALSE) as Equ - FROM address + FROM address WHERE clientFk = NEW.clientFk ) t1 ) > 1 - THEN - UPDATE client + THEN + UPDATE client SET hasToInvoiceByAddress = TRUE WHERE id = NEW.clientFk; END IF; @@ -26411,10 +21496,10 @@ BEGIN IF NEW.isDefaultAddress AND NEW.isActive = FALSE THEN CALL util.throw ('Cannot desactivate the default address'); END IF; - + IF NOT (NEW.isEqualizated <=> OLD.isEqualizated) THEN INSERT IGNORE INTO ticketRecalc (ticketFk) - SELECT id FROM ticket t + SELECT id FROM ticket t WHERE t.addressFk = NEW.id AND t.refFk IS NULL; END IF; @@ -26450,7 +21535,7 @@ CREATE TABLE `addressFilter` ( CONSTRAINT `addressFilter_FK` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `addressFilter_FK_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `addressFilter_FK_2` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Establece los criterios para habilitar las compras directas a Logiflora'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Establece los criterios para habilitar las compras directas a Logiflora'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26465,7 +21550,7 @@ CREATE TABLE `addressForPackaging` ( `packagingValue` decimal(10,2) NOT NULL DEFAULT 0.04, PRIMARY KEY (`addressFk`), CONSTRAINT `addresForPackaging_fk1` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26479,13 +21564,13 @@ CREATE TABLE `addressObservation` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `addressFk` int(11) NOT NULL, `observationTypeFk` tinyint(3) unsigned NOT NULL, - `description` text COLLATE utf8_unicode_ci NOT NULL, + `description` text NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `Id_Consigna` (`addressFk`,`observationTypeFk`), KEY `addressObservationFgn_idx` (`observationTypeFk`), CONSTRAINT `addressFgn` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `addressObservationFgn` FOREIGN KEY (`observationTypeFk`) REFERENCES `observationType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de los consignatarios'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Observaciones de los consignatarios'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26497,26 +21582,20 @@ DROP TABLE IF EXISTS `agency`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `agency` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(25) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(25) NOT NULL, `warehouseFk` smallint(5) unsigned DEFAULT NULL COMMENT 'A nulo si se puede enrutar desde todos los almacenes', - `isVolumetric` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Si el calculo del porte se hacer por volumen', - `bankFk` int(11) NOT NULL DEFAULT 8 COMMENT 'para realizar los reembolsos', `warehouseAliasFk` smallint(5) unsigned DEFAULT NULL, `isOwn` tinyint(1) NOT NULL DEFAULT 0, - `labelZone` tinyint(4) NOT NULL DEFAULT 0, `workCenterFk` 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', + `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__`), + CONSTRAINT `agency_FK` FOREIGN KEY (`warehouseAliasFk`) REFERENCES `warehouseAlias` (`id`) ON UPDATE CASCADE, CONSTRAINT `agency_ibfk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, - CONSTRAINT `agency_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, CONSTRAINT `agency_ibfk_3` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -26556,7 +21635,7 @@ CREATE TABLE `agencyExtraCharge` ( PRIMARY KEY (`id`), UNIQUE KEY `agencyExtraChargeUniqueIdx` (`agencyFk`,`sinced`,`sizeMin`), CONSTRAINT `agencyExtraChargeFk1` FOREIGN KEY (`agencyFk`) REFERENCES `agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26568,22 +21647,22 @@ DROP TABLE IF EXISTS `agencyMode`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `agencyMode` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `description` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `name` varchar(50) DEFAULT NULL, + `description` varchar(50) DEFAULT NULL, `deliveryMethodFk` int(11) DEFAULT NULL, `m3` double DEFAULT 0, - `cod71__` tinyint(3) unsigned DEFAULT 0, `web` smallint(1) unsigned zerofill NOT NULL DEFAULT 0, `agencyFk` smallint(5) unsigned NOT NULL, `inflation` decimal(5,2) NOT NULL DEFAULT 0.00 COMMENT 'Este valor se utiliza para aumentar el valor del componente porte.', `isVolumetric` tinyint(1) NOT NULL DEFAULT 0, - `reportMail` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `reportMail` varchar(100) DEFAULT NULL, `showAgencyName` tinyint(1) DEFAULT 1 COMMENT 'obsoleta', `isActive` tinyint(1) NOT NULL DEFAULT 1, `isExternalAgency` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'obsoleta', `flag` blob DEFAULT NULL COMMENT 'obsoleta', - `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `code` varchar(45) DEFAULT NULL, `isRiskFree` tinyint(1) NOT NULL DEFAULT 0, + `hasWeightVolumetric` int(11) NOT NULL DEFAULT 0 COMMENT 'Tiene en cuenta el peso volumetrico para los calculos', PRIMARY KEY (`id`), KEY `Agencias` (`name`), KEY `Vista` (`deliveryMethodFk`), @@ -26591,28 +21670,27 @@ CREATE TABLE `agencyMode` ( KEY `agencyMode_code` (`code`), CONSTRAINT `agencyMode_agencyFk` FOREIGN KEY (`agencyFk`) REFERENCES `agency` (`id`) ON UPDATE CASCADE, CONSTRAINT `agencyMode_deliveryMethodFk` FOREIGN KEY (`deliveryMethodFk`) REFERENCES `deliveryMethod` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `agencyTerm` +-- Table structure for table `agencyModeItemType` -- -DROP TABLE IF EXISTS `agencyTerm`; -/*!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; +DROP TABLE IF EXISTS `agencyModeItemType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `agencyModeItemType` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `agencyModeFk` int(11) NOT NULL, + `itemTypeFk` smallint(5) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `agencyModeItemType_FK` (`agencyModeFk`), + KEY `agencyModeItemType_FK_1` (`itemTypeFk`), + CONSTRAINT `agencyModeItemType_FK` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `agencyModeItemType_FK_1` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Combinaciones prohibidas entre agencyMode e itemType al calcular el catálogo de items'; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Temporary table structure for view `agencyTerm` @@ -26646,7 +21724,7 @@ CREATE TABLE `agencyTermConfig` ( `vatAccountSupported` varchar(15) DEFAULT NULL, `vatPercentage` decimal(28,10) DEFAULT NULL, `transaction` varchar(50) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26657,10 +21735,10 @@ DROP TABLE IF EXISTS `alertLevel`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `alertLevel` ( - `code` varchar(45) CHARACTER SET utf8 NOT NULL, + `code` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `id` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26671,10 +21749,10 @@ DROP TABLE IF EXISTS `amortizationType`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `amortizationType` ( - `code` varchar(45) CHARACTER SET utf8 NOT NULL, - `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `code` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `description` varchar(255) DEFAULT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26691,6 +21769,26 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `arcRead` +-- + +DROP TABLE IF EXISTS `arcRead`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `arcRead` ( + `id` smallint(2) unsigned NOT NULL AUTO_INCREMENT, + `printerFk` tinyint(3) unsigned DEFAULT NULL, + `ip` varchar(50) NOT NULL, + `counter` smallint(2) unsigned DEFAULT NULL COMMENT 'Número de etiquetas leídas del pallet actual por el arco', + `error` varchar(50) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `arcRead_ip_UN` (`ip`), + KEY `worker_printer_FK` (`printerFk`), + CONSTRAINT `worker_printer_FK` FOREIGN KEY (`printerFk`) REFERENCES `printer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `assignedTicketToWorker` -- @@ -26705,7 +21803,22 @@ CREATE TABLE `assignedTicketToWorker` ( PRIMARY KEY (`id`), UNIQUE KEY `idWorker_UNIQUE` (`idWorker`), UNIQUE KEY `idTicket_UNIQUE` (`idTicket`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla para relacionar un ticket con el sacador del altillo '; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tabla para relacionar un ticket con el sacador del altillo '; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `auctionConfig` +-- + +DROP TABLE IF EXISTS `auctionConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `auctionConfig` ( + `conversionCoefficient` double NOT NULL DEFAULT 1 COMMENT 'value used to calculate the used space of an item in a container', + `warehosueFk` smallint(6) unsigned NOT NULL DEFAULT 7 COMMENT 'default warehouse used for the calculation', + KEY `auctionConfig_FK` (`warehosueFk`), + CONSTRAINT `auctionConfig_FK` FOREIGN KEY (`warehosueFk`) REFERENCES `warehouse` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26717,13 +21830,13 @@ DROP TABLE IF EXISTS `autoRadioConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `autoRadioConfig` ( `id` int(11) NOT NULL, - `password` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `url` varchar(75) COLLATE utf8_unicode_ci DEFAULT NULL, + `password` varchar(45) DEFAULT NULL, + `user` varchar(45) DEFAULT NULL, + `url` varchar(75) DEFAULT NULL, `client` int(32) DEFAULT NULL, - `center` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, + `center` varchar(2) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26737,29 +21850,11 @@ CREATE TABLE `autoRadioLogCall` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` int(11) NOT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), - `response` longtext COLLATE utf8_unicode_ci NOT NULL, + `response` longtext NOT NULL, PRIMARY KEY (`id`), KEY `ticket_idx` (`ticketFk`), CONSTRAINT `ticket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `autonomousRegion__` --- - -DROP TABLE IF EXISTS `autonomousRegion__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `autonomousRegion__` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(50) CHARACTER SET utf8 NOT NULL, - `geoFk` int(11) DEFAULT NULL, - `countryFk` mediumint(8) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `countryFk` (`countryFk`), - CONSTRAINT `countryFk` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26771,7 +21866,7 @@ DROP TABLE IF EXISTS `autonomy`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `autonomy` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(100) NOT NULL, `countryFk` mediumint(8) unsigned NOT NULL, `geoFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), @@ -26779,7 +21874,7 @@ CREATE TABLE `autonomy` ( KEY `autonomy_FK_1` (`geoFk`), CONSTRAINT `autonomy_FK` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `autonomy_FK_1` FOREIGN KEY (`geoFk`) REFERENCES `zoneGeo` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Comunidades autónomas o su equivalente en otros paises. Agrupación de provincias, en una categoria inferior a country.'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Comunidades autónomas o su equivalente en otros paises. Agrupación de provincias, en una categoria inferior a country.'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -26793,8 +21888,8 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_BI` BEFORE INSERT ON `autonomy` FOR EACH ROW -BEGIN - +BEGIN + SET NEW.geoFk = zoneGeo_new('autonomy', NEW.`name`, (SELECT geoFk FROM country WHERE id = NEW.countryFk)); END */;; @@ -26844,7 +21939,7 @@ DELIMITER ;; AFTER DELETE ON `autonomy` FOR EACH ROW BEGIN - CALL zoneGeo_delete(OLD.geoFk); + CALL zoneGeo_delete(OLD.geoFk); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -26861,19 +21956,19 @@ DROP TABLE IF EXISTS `awb`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `awb` ( `id` smallint(11) unsigned NOT NULL AUTO_INCREMENT, - `code` varchar(18) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(18) NOT NULL, `package` float unsigned NOT NULL, `weight` float unsigned DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), `transitoryFk` int(11) DEFAULT NULL, `taxFk` int(10) unsigned DEFAULT 62, - `duakk` varchar(18) COLLATE utf8_unicode_ci DEFAULT NULL, + `duakk` varchar(18) DEFAULT NULL, `docFk` int(11) DEFAULT NULL, `amount` double NOT NULL DEFAULT 0, `freightFk` int(11) DEFAULT NULL, `m3` double unsigned DEFAULT NULL, `stems` int(10) unsigned DEFAULT NULL, - `flightFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `flightFk` varchar(10) DEFAULT NULL, `volumeWeight` float unsigned DEFAULT NULL, `hb` decimal(10,1) unsigned DEFAULT NULL, `rate` decimal(10,2) unsigned DEFAULT NULL, @@ -26885,8 +21980,10 @@ CREATE TABLE `awb` ( `isChecked` tinyint(3) DEFAULT 0, `isTransitoryChecked` tinyint(3) DEFAULT 0, `year` int(4) DEFAULT NULL, - `observation` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `observation` varchar(45) DEFAULT NULL, `hasFreightPrepaid` tinyint(3) DEFAULT 0, + `invoiceInPaletizedFk` mediumint(8) unsigned DEFAULT NULL, + `propertyNumber` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `codigo_UNIQUE` (`code`,`year`), KEY `proveedor_id` (`transitoryFk`), @@ -26894,10 +21991,16 @@ CREATE TABLE `awb` ( KEY `carguera_id` (`freightFk`), KEY `flight_id` (`flightFk`), KEY `awbInvoiceIn` (`invoiceInFk`), + KEY `awb_FK` (`docFk`), + KEY `awb_FK_3` (`invoiceInPaletizedFk`), CONSTRAINT `awbInvoiceIn` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `awbTransitoryFk` FOREIGN KEY (`transitoryFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `awb_FK` FOREIGN KEY (`docFk`) REFERENCES `dms` (`id`) ON UPDATE CASCADE, + CONSTRAINT `awb_FK_1` FOREIGN KEY (`flightFk`) REFERENCES `vn2008`.`flight` (`flight_id`) ON UPDATE CASCADE, + CONSTRAINT `awb_FK_2` FOREIGN KEY (`freightFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `awb_FK_3` FOREIGN KEY (`invoiceInPaletizedFk`) REFERENCES `invoiceIn` (`id`) ON UPDATE CASCADE, CONSTRAINT `awb_ibfk_1` FOREIGN KEY (`taxFk`) REFERENCES `taxCode` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -26912,7 +22015,7 @@ DELIMITER ;; BEFORE INSERT ON `awb` FOR EACH ROW BEGIN - + SET NEW.year= year(util.VN_CURDATE()); @@ -26922,30 +22025,21 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!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`.`awb_au` - AFTER UPDATE ON `awb` - FOR EACH ROW -BEGIN - IF NEW.amount <> OLD.amount THEN - CALL vn2008.buy_tarifas_awb(NEW.code); - END IF; +-- +-- Temporary table structure for view `awbVolume` +-- -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; +DROP TABLE IF EXISTS `awbVolume`; +/*!50001 DROP VIEW IF EXISTS `awbVolume`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `awbVolume` ( + `awbFk` tinyint NOT NULL, + `volume` tinyint NOT NULL, + `buyFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `bank` @@ -26977,14 +22071,101 @@ DROP TABLE IF EXISTS `bankEntity`; CREATE TABLE `bankEntity` ( `countryFk` mediumint(8) unsigned NOT NULL DEFAULT 1, `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `bic` varchar(11) CHARACTER SET utf8 DEFAULT NULL, + `name` varchar(45) NOT NULL, + `bic` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `bic_UNIQUE` (`bic`), KEY `fg_entity1_idx` (`countryFk`), CONSTRAINT `fg_entity1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Entidades bancarias '; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Entidades bancarias '; /*!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`.`bankEntity_beforeInsert` + BEFORE INSERT ON `bankEntity` + FOR EACH ROW +BEGIN + CALL bankEntity_checkBic(NEW.bic); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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`.`bankEntity_beforeUpdate` + BEFORE UPDATE ON `bankEntity` + FOR EACH ROW +BEGIN + IF NOT (NEW.bic <=> OLD.bic) THEN + CALL bankEntity_checkBic(NEW.bic); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `bankEntityConfig` +-- + +DROP TABLE IF EXISTS `bankEntityConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bankEntityConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `bicLength` tinyint(4) DEFAULT 11 COMMENT 'Tamaño del campo bic', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `bankPolicy` +-- + +DROP TABLE IF EXISTS `bankPolicy`; +/*!50001 DROP VIEW IF EXISTS `bankPolicy`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `bankPolicy` ( + `id` tinyint NOT NULL, + `ref` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `balanceInterestDrawn` tinyint NOT NULL, + `commissionAvailableBalances` tinyint NOT NULL, + `openingCommission` tinyint NOT NULL, + `started` tinyint NOT NULL, + `ended` tinyint NOT NULL, + `bankFk` tinyint NOT NULL, + `companyFk` tinyint NOT NULL, + `supplierFk` tinyint NOT NULL, + `description` tinyint NOT NULL, + `hasGuarantee` tinyint NOT NULL, + `dmsFk` tinyint NOT NULL, + `notaryFk` tinyint NOT NULL, + `currencyFk` tinyint NOT NULL, + `amortizationTypeFk` tinyint NOT NULL, + `periodicityTypeFk` tinyint NOT NULL, + `insuranceExpired` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; -- -- Table structure for table `beach` @@ -26994,14 +22175,10 @@ DROP TABLE IF EXISTS `beach`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `beach` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `warehouseFk` smallint(6) NOT NULL, - `x` int(11) NOT NULL, - `y` int(11) NOT NULL, - `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `isShowed` tinyint(1) DEFAULT 0, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Ubicaciones respecto a la playa del almacén'; + `code` varchar(45) NOT NULL, + `warehouseFk` smallint(6) NOT NULL DEFAULT 60, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Ubicaciones respecto a la playa del almacén'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27018,7 +22195,7 @@ CREATE TABLE `bionicConfig` ( `verdnaturaVolumeBox` int(11) NOT NULL, `itemCarryBox` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27031,8 +22208,8 @@ DROP TABLE IF EXISTS `bookingPlanner`; CREATE TABLE `bookingPlanner` ( `id` int(10) NOT NULL AUTO_INCREMENT, `effectived` timestamp NOT NULL DEFAULT current_timestamp(), - `pgcFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `taxAreaFk` varchar(15) CHARACTER SET utf8 NOT NULL DEFAULT 'SPAIN', + `pgcFk` varchar(10) NOT NULL, + `taxAreaFk` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'SPAIN', `priority` int(2) unsigned DEFAULT NULL, `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT 1, `countryFk` mediumint(8) unsigned NOT NULL DEFAULT 1, @@ -27045,7 +22222,7 @@ CREATE TABLE `bookingPlanner` ( CONSTRAINT `bookingPlanner_ibfk_1` FOREIGN KEY (`pgcFk`) REFERENCES `pgc` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `bookingPlanner_ibfk_2` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `bookingPlanner_ibfk_3` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON DELETE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27060,16 +22237,16 @@ CREATE TABLE `botanicExport` ( `ediGenusFk` mediumint(8) unsigned NOT NULL, `ediSpecieFk` mediumint(8) unsigned DEFAULT NULL, `countryFk` mediumint(8) unsigned DEFAULT NULL, - `restriction` enum('Sin restriccion','Importacion Prohibida','pasaporte fitosanitario','pasaporte individual','declaracion origen') CHARACTER SET utf8 NOT NULL, - `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `restriction` enum('Sin restriccion','Importacion Prohibida','pasaporte fitosanitario','pasaporte individual','declaracion origen') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `description` varchar(45) DEFAULT NULL, `isProtectedZone` tinyint(1) NOT NULL DEFAULT 0, - `code` enum('importProhibited','phytosanitaryPassport','individualPassport') COLLATE utf8_unicode_ci DEFAULT NULL, + `code` enum('importProhibited','phytosanitaryPassport','individualPassport') DEFAULT NULL, PRIMARY KEY (`id`), KEY `Id_Paises` (`countryFk`), KEY `botanicExport_ibfk_2_idx` (`ediGenusFk`), KEY `botanicExport_ibfk_3_idx` (`ediSpecieFk`), CONSTRAINT `botanicExport_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Especifica los generos y especies prohibidos en paises'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Especifica los generos y especies prohibidos en paises'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -27104,7 +22281,7 @@ DROP TABLE IF EXISTS `budget`; CREATE TABLE `budget` ( `id` int(11) NOT NULL AUTO_INCREMENT, `created` timestamp NOT NULL DEFAULT current_timestamp(), - `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(100) NOT NULL, `started` date DEFAULT NULL, `finished` date DEFAULT NULL, `userFk` int(10) unsigned DEFAULT NULL, @@ -27122,7 +22299,7 @@ CREATE TABLE `budget` ( CONSTRAINT `budget_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `budget_FK_2` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `budget_FK_3` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Master de presupuestos de project'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Master de presupuestos de project'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27141,7 +22318,7 @@ CREATE TABLE `budgetDms` ( KEY `budgetDms_FK_1` (`dmsFk`), CONSTRAINT `budgetDms_FK` FOREIGN KEY (`budgetFk`) REFERENCES `budget` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `budgetDms_FK_1` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Gestion documental de budget'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Gestion documental de budget'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27162,7 +22339,7 @@ CREATE TABLE `budgetInvoiceIn` ( KEY `budgetInvoiceIn_FK_1` (`invoiceInFk`), CONSTRAINT `budgetInvoiceIn_FK` FOREIGN KEY (`budgetFk`) REFERENCES `budget` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `budgetInvoiceIn_FK_1` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Facturas relativas al presupuesto'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Facturas relativas al presupuesto'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27176,14 +22353,14 @@ CREATE TABLE `budgetNotes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `budgetFk` int(11) NOT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), - `txt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `txt` varchar(255) NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `budgetNotes_FK` (`budgetFk`), KEY `budgetNotes_FK_2` (`userFk`), CONSTRAINT `budgetNotes_FK` FOREIGN KEY (`budgetFk`) REFERENCES `budget` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `budgetNotes_FK_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Historico de budget'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Historico de budget'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -27198,11 +22375,11 @@ DELIMITER ;; BEFORE INSERT ON `budgetNotes` FOR EACH ROW BEGIN - + IF ISNULL(NEW.userFk) THEN - + SET NEW.userFk = account.myUser_getId(); - + END IF; END */;; @@ -27212,6 +22389,187 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `business` +-- + +DROP TABLE IF EXISTS `business`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `business` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `companyCodeFk` char(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL, + `started` date DEFAULT NULL, + `ended` date DEFAULT NULL, + `workerBusiness` longtext DEFAULT NULL, + `reasonEndFk` int(11) DEFAULT NULL, + `payedHolidays` decimal(5,2) NOT NULL DEFAULT 0.00, + `occupationCodeFk` varchar(1) DEFAULT NULL, + `workerFk` int(10) unsigned NOT NULL, + `notes` longtext DEFAULT NULL, + `departmentFk` int(11) DEFAULT NULL, + `workerBusinessProfessionalCategoryFk` int(11) DEFAULT NULL, + `calendarTypeFk` int(11) DEFAULT 1, + `isHourlyLabor` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Contrato por horas', + `workcenterFk` int(11) NOT NULL, + `rate` int(11) DEFAULT NULL, + `workerBusinessCategoryFk` int(11) DEFAULT NULL, + `workerBusinessTypeFk` int(11) DEFAULT NULL, + `amount` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Importe pactado', + `workerBusinessAgreementFk` int(11) DEFAULT NULL, + `basicSalary` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `business_occupationCodeFk` (`occupationCodeFk`), + KEY `business_companyCodeFk` (`companyCodeFk`), + KEY `business_workerFk_idx` (`workerFk`), + KEY `business_departmentFk_idx` (`departmentFk`), + KEY `business_workerBusinessProfessionalCategoryFk_idx` (`workerBusinessProfessionalCategoryFk`), + KEY `business_calendarTypeFk_idx` (`calendarTypeFk`), + KEY `business_workerBusinessCategoryFk` (`workerBusinessCategoryFk`), + KEY `business_workerBusinessTypeFk_idx` (`workerBusinessTypeFk`), + KEY `business_workerBusinessAgreementFk_idx` (`workerBusinessAgreementFk`), + CONSTRAINT `business_calendarTypeFk` FOREIGN KEY (`calendarTypeFk`) REFERENCES `postgresql`.`calendar_labour_type` (`calendar_labour_type_id`) ON UPDATE CASCADE, + CONSTRAINT `business_companyCodeFk` FOREIGN KEY (`companyCodeFk`) REFERENCES `company` (`code`) ON UPDATE CASCADE, + CONSTRAINT `business_departmentFk` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON UPDATE CASCADE, + CONSTRAINT `business_occupationCodeFk` FOREIGN KEY (`occupationCodeFk`) REFERENCES `occupationCode` (`code`) ON UPDATE CASCADE, + CONSTRAINT `business_workerBusinessAgreementFk` FOREIGN KEY (`workerBusinessAgreementFk`) REFERENCES `postgresql`.`labour_agreement` (`labour_agreement_id`) ON UPDATE CASCADE, + CONSTRAINT `business_workerBusinessCategoryFk` FOREIGN KEY (`workerBusinessCategoryFk`) REFERENCES `vn2008`.`payroll_categorias` (`codcategoria`) ON UPDATE CASCADE, + CONSTRAINT `business_workerBusinessProfessionalCategoryFk` FOREIGN KEY (`workerBusinessProfessionalCategoryFk`) REFERENCES `postgresql`.`professional_category` (`professional_category_id`) ON UPDATE CASCADE, + CONSTRAINT `business_workerBusinessTypeFk` FOREIGN KEY (`workerBusinessTypeFk`) REFERENCES `workerBusinessType` (`id`) ON UPDATE CASCADE, + CONSTRAINT `business_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_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`.`business_beforeInsert` + BEFORE INSERT ON `business` + FOR EACH ROW +BEGIN + IF NEW.ended IS NULL THEN + SET NEW.payedHolidays = 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`.`business_afterInsert` + AFTER INSERT ON `business` + FOR EACH ROW +BEGIN + CALL worker_updateBusiness(NEW.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 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!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`.`business_beforeUpdate` + BEFORE UPDATE ON `business` + FOR EACH ROW +BEGIN + DECLARE isOverlapping BOOL; + + IF NEW.ended IS NULL THEN + SET NEW.payedHolidays = 0; + END IF; + + IF !(OLD.started <=> NEW.started AND OLD.ended <=> NEW.ended) THEN + + SELECT COUNT(*) > 0 INTO isOverlapping + FROM business b + WHERE (util.hasDateOverlapped( + NEW.started, + IFNULL(NEW.ended, b.started), + b.started, + IFNULL(b.ended, NEW.started)) + OR (NEW.ended <=> NULL AND b.ended <=> NULL)) + AND b.id <> OLD.id + AND workerFk = OLD.workerFk; + + IF isOverlapping THEN + CALL util.throw ('IS_OVERLAPPING'); + 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 `vn`.`business_afterUpdate` + AFTER UPDATE ON `business` + FOR EACH ROW +BEGIN + CALL worker_updateBusiness(NEW.workerFk); + + IF NOT (OLD.workerFk <=> NEW.workerFk) THEN + CALL worker_updateBusiness(OLD.workerFk); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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`.`business_afterDelete` + AFTER DELETE ON `business` + FOR EACH ROW +BEGIN + CALL worker_updateBusiness(OLD.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 */ ; + -- -- Temporary table structure for view `businessCalendar` -- @@ -27237,9 +22595,9 @@ DROP TABLE IF EXISTS `businessReasonEnd`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `businessReasonEnd` ( `id` tinyint(3) NOT NULL AUTO_INCREMENT, - `reason` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `reason` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27250,10 +22608,10 @@ DROP TABLE IF EXISTS `businessType`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `businessType` ( - `code` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(100) NOT NULL DEFAULT '', + `description` varchar(100) NOT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27269,23 +22627,22 @@ CREATE TABLE `buy` ( `itemFk` int(11) NOT NULL DEFAULT 90, `quantity` int(11) DEFAULT 0, `dispatched` int(11) NOT NULL DEFAULT 0, - `buyingValue` decimal(10,3) DEFAULT 0.000, - `freightValue` decimal(10,3) DEFAULT 0.000, + `buyingValue` decimal(10,3) NOT NULL DEFAULT 0.000, + `freightValue` decimal(10,3) NOT NULL DEFAULT 0.000, `isIgnored` tinyint(1) NOT NULL DEFAULT 0, - `stickers` int(11) DEFAULT 0, + `stickers` int(11) NOT NULL DEFAULT 0, `packing` int(11) DEFAULT 0, `grouping` smallint(5) unsigned NOT NULL DEFAULT 1, `groupingMode` tinyint(4) NOT NULL DEFAULT 0 COMMENT '0=sin obligar 1=groping 2=packing', `containerFk` smallint(5) unsigned DEFAULT NULL, - `comissionValue` decimal(10,3) DEFAULT 0.000, - `packageValue` decimal(10,3) DEFAULT 0.000, - `location` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, - `packageFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT '--', + `comissionValue` decimal(10,3) NOT NULL DEFAULT 0.000, + `packageValue` decimal(10,3) NOT NULL DEFAULT 0.000, + `location` varchar(5) DEFAULT NULL, + `packageFk` varchar(10) 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, `printedStickers` int(11) DEFAULT 0, `workerFk` int(11) DEFAULT 0, `isChecked` tinyint(1) NOT NULL DEFAULT 0, @@ -27306,13 +22663,14 @@ CREATE TABLE `buy` ( KEY `buy_fk_4_idx` (`deliveryFk`), KEY `buy_FK` (`itemOriginalFk`), CONSTRAINT `buy_FK` FOREIGN KEY (`itemOriginalFk`) REFERENCES `item` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `buy_FK_1` FOREIGN KEY (`containerFk`) REFERENCES `vn2008`.`container` (`container_id`) ON UPDATE CASCADE, CONSTRAINT `buy_ektFk` FOREIGN KEY (`ektFk`) REFERENCES `edi`.`ekt` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `buy_fk_4` FOREIGN KEY (`deliveryFk`) REFERENCES `edi`.`deliveryInformation` (`ID`) ON DELETE SET NULL ON UPDATE SET NULL, CONSTRAINT `buy_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE, CONSTRAINT `buy_ibfk_2` FOREIGN KEY (`packageFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE, CONSTRAINT `buy_id` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `buy_itemfk` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -27333,18 +22691,16 @@ trig: BEGIN DECLARE vGroupingMode TINYINT; DECLARE vGenericFk INT; DECLARE vGenericInDate BOOL; - - IF @isModeInventory THEN + + IF @isModeInventory THEN LEAVE trig; END IF; - - CALL buy_checkGrouping(NEW.`grouping`); + CALL buy_checkGrouping(NEW.`grouping`); SELECT t.warehouseInFk, t.landed INTO vWarehouse, vLanding - FROM entry e + 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 @@ -27354,40 +22710,32 @@ trig: BEGIN 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 + 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 IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -27407,13 +22755,31 @@ DELIMITER ;; AFTER INSERT ON `buy` FOR EACH ROW trig: BEGIN + DECLARE vValues VARCHAR(255); + CALL stock.log_add('buy', NEW.id, NULL); IF @isModeInventory THEN LEAVE trig; END IF; - CALL buy_afterUpsert(NEW.id); + IF @isTriggerDisabled THEN + LEAVE trig; + END IF; + + CALL buy_afterUpsert(NEW.id); + + /*IF entry_isInventoryOrPrevious(NEW.entryFk) THEN + SET vValues = CONCAT_WS(',', + NEW.entryFk, + NEW.itemFk, + NEW.quantity, + NEW.price1, + NEW.price2, + NEW.price3 + ); + CALL entry_notifyChanged(NEW.entryFk, NEW.id, vValues, NULL); + END IF;*/ END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -27432,43 +22798,43 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeUpdate` BEFORE UPDATE ON `buy` FOR EACH ROW -trig:BEGIN +trig:BEGIN DECLARE vGenericFk INT; DECLARE vGenericInDate BOOL; - - IF @isTriggerDisabled THEN - + DECLARE vIsInventory BOOL; + IF @isTriggerDisabled THEN LEAVE trig; - END IF; - - IF !(NEW.`grouping` <=> OLD.`grouping`) THEN + 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 + 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; + SELECT COUNT(*) INTO vIsInventory + FROM vn.entry e + JOIN vn.supplier s ON s.id = e.supplierFk + JOIN vn.entryConfig ec ON ec.inventorySupplierFk = e.supplierFk + WHERE e.id = NEW.entryFk; + + IF vIsInventory THEN + IF NOT NEW.printedStickers <=> OLD.printedStickers THEN + CALL util.throw("Stickers cannot be modified if they are inventory"); + END IF; END IF; END */;; DELIMITER ; @@ -27492,53 +22858,51 @@ trig: BEGIN DECLARE vLanded DATE; 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) - OR !(NEW.itemFk <=> OLD.itemFk) - OR !(NEW.quantity <=> OLD.quantity) - OR !(NEW.created <=> OLD.created) THEN + DECLARE vItemName VARCHAR(50); + DECLARE vNewValues VARCHAR(255); + DECLARE vOldValues VARCHAR(255); + + IF !(NEW.id <=> OLD.id) + OR !(NEW.entryFk <=> OLD.entryFk) + OR !(NEW.itemFk <=> OLD.itemFk) + OR !(NEW.quantity <=> OLD.quantity) + OR !(NEW.created <=> OLD.created) THEN CALL stock.log_add('buy', NEW.id, OLD.id); END IF; - + IF @isModeInventory THEN LEAVE trig; END IF; - CALL buy_afterUpsert(NEW.id); - - IF !(NEW.weight <=> OLD.weight) AND NEW.weight THEN - UPDATE item - SET density = NEW.weight / (item_getVolume(NEW.itemFk, NEW.packageFk) / 1000000) - WHERE id = NEW.itemFk; + IF @isTriggerDisabled THEN + LEAVE trig; END IF; - + + CALL buy_afterUpsert(NEW.id); + SELECT w.isBuyerToBeEmailed, t.landed INTO vIsBuyerToBeEmailed, vLanded FROM entry e JOIN travel t ON t.id = e.travelFk - JOIN warehouse w ON w.id = t.warehouseInFk + JOIN warehouse w ON w.id = t.warehouseInFk WHERE e.id = NEW.entryFk; - - SELECT it.workerFk, i.longName + + SELECT it.workerFk, i.longName INTO vBuyerFk, vItemName FROM itemCategory k JOIN itemType it ON it.categoryFk = k.id JOIN item i ON i.typeFk = it.id WHERE i.id = OLD.itemFk; - - IF vIsBuyerToBeEmailed AND - vBuyerFk != account.myUser_getId() AND - vLanded = util.VN_CURDATE() THEN - IF !(NEW.itemFk <=> OLD.itemFk) OR - !(NEW.quantity <=> OLD.quantity) OR - !(NEW.packing <=> OLD.packing) OR - !(NEW.grouping <=> OLD.grouping) OR - !(NEW.packageFk <=> OLD.packageFk) OR - !(NEW.weight <=> OLD.weight) THEN + + IF vIsBuyerToBeEmailed AND + vBuyerFk != account.myUser_getId() AND + vLanded = util.VN_CURDATE() THEN + IF !(NEW.itemFk <=> OLD.itemFk) OR + !(NEW.quantity <=> OLD.quantity) OR + !(NEW.packing <=> OLD.packing) OR + !(NEW.grouping <=> OLD.grouping) OR + !(NEW.packageFk <=> OLD.packageFk) OR + !(NEW.weight <=> OLD.weight) THEN CALL vn.mail_insert( CONCAT(account.user_getNameFromId(vBuyerFk),'@verdnatura.es'), CONCAT(account.myUser_getName(),'@verdnatura.es'), @@ -27548,32 +22912,28 @@ trig: BEGIN 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 */ ; +/*!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`.`buy_beforeDelete` + BEFORE DELETE ON buy + FOR EACH ROW +BEGIN + IF OLD.printedStickers <> 0 THEN + CALL util.throw("it is not possible to delete buys with printed labels "); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -27592,8 +22952,28 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_afterDelete` AFTER DELETE ON `buy` FOR EACH ROW -BEGIN +trig: BEGIN + DECLARE vValues VARCHAR(255); + + IF @isTriggerDisabled THEN + LEAVE trig; + END IF; + CALL stock.log_add('buy', NULL, OLD.id); + + CALL util.debugAdd('buy_deleted', CONCAT(OLD.id,' ', OLD.itemFk,' ', OLD.entryFk, ' ', vn.getWorkerCode())); + + /*IF entry_isInventoryOrPrevious(OLD.entryFk) THEN + SET vValues = CONCAT_WS(',', + OLD.entryFk, + OLD.itemFk, + OLD.quantity, + OLD.price1, + OLD.price2, + OLD.price3 + ); + CALL entry_notifyChanged(OLD.entryFk, OLD.id, NULL, vValues); + END IF;*/ END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -27610,12 +22990,12 @@ DROP TABLE IF EXISTS `buyMark`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `buyMark` ( `id` int(11) NOT NULL, - `comment` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `comment` varchar(255) DEFAULT NULL, `mark` tinyint(1) DEFAULT NULL, `odbcDate` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), CONSTRAINT `Compres_mark_ibfk_1` FOREIGN KEY (`id`) REFERENCES `buy` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27661,13 +23041,13 @@ CREATE TABLE `calendar` ( `dayOffTypeFk` int(11) NOT NULL, `dated` date NOT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `business_id_date` (`businessFk`,`dated`), + UNIQUE KEY `calendar_UN` (`businessFk`,`dated`), KEY `calendar_employee_business_labour_id_idx` (`businessFk`), KEY `calendar_employee_calendar_state_calendar_state_id_idx` (`dayOffTypeFk`), KEY `id_index` (`id`), - CONSTRAINT `calendar_businessFk` FOREIGN KEY (`businessFk`) REFERENCES `postgresql`.`business` (`business_id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `calendar_employee_state_id` FOREIGN KEY (`dayOffTypeFk`) REFERENCES `postgresql`.`calendar_state` (`calendar_state_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; + CONSTRAINT `calendar_FK` FOREIGN KEY (`dayOffTypeFk`) REFERENCES `absenceType` (`id`) ON UPDATE CASCADE, + CONSTRAINT `calendar_businessFk` FOREIGN KEY (`businessFk`) REFERENCES `business` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27691,7 +23071,7 @@ CREATE TABLE `calendarHolidays` ( CONSTRAINT `calendarHolidaysNameFk` FOREIGN KEY (`calendarHolidaysNameFk`) REFERENCES `calendarHolidaysName` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `calendarholidaystypeFk` FOREIGN KEY (`calendarHolidaysTypeFk`) REFERENCES `calendarHolidaysType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `workCenterFk` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27705,7 +23085,7 @@ CREATE TABLE `calendarHolidaysName` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(100) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27720,25 +23100,9 @@ CREATE TABLE `calendarHolidaysType` ( `name` varchar(50) NOT NULL, `hexColour` char(7) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `calendar__` --- - -DROP TABLE IF EXISTS `calendar__`; -/*!50001 DROP VIEW IF EXISTS `calendar__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `calendar__` ( - `id` tinyint NOT NULL, - `businessFk` tinyint NOT NULL, - `dayOffTypeFk` tinyint NOT NULL, - `dated` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `campaign` -- @@ -27748,12 +23112,12 @@ DROP TABLE IF EXISTS `campaign`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `campaign` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `code` enum('mothersDay','allSaints','valentinesDay') COLLATE utf8_unicode_ci NOT NULL, + `code` enum('mothersDay','allSaints','valentinesDay') NOT NULL, `dated` datetime NOT NULL DEFAULT current_timestamp(), `scopeDays` int(11) NOT NULL DEFAULT 15, PRIMARY KEY (`id`), UNIQUE KEY `campaign_dated_uindex` (`dated`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27765,10 +23129,10 @@ DROP TABLE IF EXISTS `category`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `category` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `nick` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(45) NOT NULL, + `nick` varchar(3) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27780,13 +23144,36 @@ DROP TABLE IF EXISTS `chain`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `chain` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(45) NOT NULL, `rappel` decimal(5,2) NOT NULL DEFAULT 0.00, `componentFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `chain_FK` (`componentFk`), CONSTRAINT `chain_FK` FOREIGN KEY (`componentFk`) REFERENCES `component` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Grupos de clientes'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Grupos de clientes'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `chat` +-- + +DROP TABLE IF EXISTS `chat`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `chat` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `senderFk` int(10) unsigned DEFAULT NULL, + `recipient` varchar(50) DEFAULT NULL, + `dated` datetime DEFAULT NULL, + `checkUserStatus` tinyint(1) DEFAULT NULL, + `message` text DEFAULT NULL, + `status` tinyint(1) DEFAULT NULL, + `attempts` int(1) DEFAULT NULL, + `error` text DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `chat_FK` (`senderFk`), + CONSTRAINT `chat_FK` FOREIGN KEY (`senderFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27798,12 +23185,12 @@ DROP TABLE IF EXISTS `chatConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `chatConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `host` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `api` 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, + `host` varchar(255) NOT NULL, + `api` varchar(255) NOT NULL, + `user` varchar(50) NOT NULL, + `password` varchar(50) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27816,9 +23203,8 @@ DROP TABLE IF EXISTS `claim`; CREATE TABLE `claim` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `ticketCreated` date NOT NULL, - `claimDepartmentFk__` tinyint(3) unsigned DEFAULT NULL, `claimStateFk` int(10) unsigned NOT NULL DEFAULT 1, - `observation` text COLLATE utf8_unicode_ci DEFAULT NULL, + `observation` text DEFAULT NULL, `clientFk` int(11) NOT NULL, `workerFk` int(11) NOT NULL, `responsibility` int(1) unsigned NOT NULL DEFAULT 3, @@ -27826,18 +23212,17 @@ 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', + `packages` smallint(10) unsigned DEFAULT 0 COMMENT 'packages received by the client', + `rma` varchar(100) DEFAULT NULL, PRIMARY KEY (`id`), - KEY `cl_dep_id` (`claimDepartmentFk__`), KEY `cl_est_id` (`claimStateFk`), KEY `Id_Cliente` (`clientFk`), KEY `Id_Trabajador` (`workerFk`), KEY `cl_main_ticketFk_idx` (`ticketFk`), CONSTRAINT `cl_main_ticketFk` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE, CONSTRAINT `claim_ibfk_3` FOREIGN KEY (`claimStateFk`) REFERENCES `claimState` (`id`) ON UPDATE CASCADE, - CONSTRAINT `claim_ibfk_4` FOREIGN KEY (`claimDepartmentFk__`) REFERENCES `vn2008`.`cl_dep` (`id`) ON UPDATE CASCADE, CONSTRAINT `claim_ibfk_5` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Reclamaciones, tabla principal'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27851,15 +23236,13 @@ CREATE TABLE `claimBeginning` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `claimFk` int(10) unsigned NOT NULL, `saleFk` int(11) DEFAULT NULL, - `claimComplaintFk__` int(10) unsigned NOT NULL DEFAULT 1, - `claimRequestFk__` int(1) unsigned NOT NULL DEFAULT 1, `quantity` double DEFAULT NULL, PRIMARY KEY (`id`), KEY `Id_Movimiento` (`saleFk`), KEY `cl_main_id` (`claimFk`), CONSTRAINT `claimBeginning_ibfk_7` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `claimBeginning_ibfk_8` FOREIGN KEY (`claimFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de las reclamaciones'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Detalle de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -27880,7 +23263,7 @@ BEGIN FROM sale WHERE id = NEW.saleFk; - UPDATE claim + UPDATE claim SET ticketFk = vTicket WHERE id = NEW.claimFk; END */;; @@ -27899,9 +23282,9 @@ DROP TABLE IF EXISTS `claimConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimConfig` ( `id` int(11) NOT NULL, - `pickupContact` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL, + `maxResponsibility` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27913,12 +23296,12 @@ DROP TABLE IF EXISTS `claimDestination`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimDestination` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(15) NOT NULL, `addressFk` int(10) DEFAULT NULL COMMENT 'Indica el consignatario para el ticket que regulariza el inventario', PRIMARY KEY (`id`), KEY `clSolAddressFk_idx` (`addressFk`), CONSTRAINT `clSolAddressFk` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Solucion ofrecida a la reclamación'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Solucion ofrecida a la reclamación'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27952,7 +23335,7 @@ CREATE TABLE `claimDevelopment` ( CONSTRAINT `claimDevelopment_ibfk_7` FOREIGN KEY (`claimReasonFk`) REFERENCES `claimReason` (`id`) ON UPDATE CASCADE, CONSTRAINT `claimDevelopment_ibfk_8` FOREIGN KEY (`claimResultFk`) REFERENCES `claimResult` (`id`) ON UPDATE CASCADE, CONSTRAINT `claimDevelopment_ibfk_9` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Causas de las reclamaciones'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Causas de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27969,7 +23352,7 @@ CREATE TABLE `claimDms` ( KEY `dmsFk_idx` (`dmsFk`), CONSTRAINT `claimFk` FOREIGN KEY (`claimFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `dmsFk` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27994,7 +23377,7 @@ CREATE TABLE `claimEnd` ( CONSTRAINT `claimEnd_ibfk_1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `claimEnd_ibfk_3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `claimEnd_ibfk_4` FOREIGN KEY (`claimFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28008,20 +23391,42 @@ CREATE TABLE `claimLog` ( `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, + `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), - `description` text CHARACTER SET utf8 DEFAULT NULL, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, - `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` varchar(45) DEFAULT NULL, + `oldInstance` text DEFAULT NULL, + `newInstance` text DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), KEY `originFk` (`originFk`), KEY `userFk` (`userFk`), CONSTRAINT `claimOriginFk` FOREIGN KEY (`originFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `claimUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `claimObservation` +-- + +DROP TABLE IF EXISTS `claimObservation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `claimObservation` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `claimFk` int(10) unsigned NOT NULL, + `workerFk` int(10) unsigned DEFAULT NULL, + `text` text NOT NULL, + `created` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `worker_key` (`workerFk`), + KEY `claim_key` (`claimFk`), + KEY `claimObservation_created_IDX` (`created`) USING BTREE, + CONSTRAINT `claimObservation_ibfk_1` FOREIGN KEY (`claimFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `claimObservation_ibfk_2` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Todas las observaciones referentes a una reclamación'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28040,7 +23445,7 @@ CREATE TABLE `claimRatio` ( `packingRate` decimal(5,2) NOT NULL DEFAULT 1.00, PRIMARY KEY (`clientFk`), CONSTRAINT `claimRatio_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28052,10 +23457,10 @@ DROP TABLE IF EXISTS `claimReason`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimReason` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(45) NOT NULL, `isTired` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Motivos de las fallos'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Motivos de las fallos'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28067,9 +23472,9 @@ DROP TABLE IF EXISTS `claimRedelivery`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimRedelivery` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Método por el cual el cliente nos devuelve la mercancía'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Método por el cual el cliente nos devuelve la mercancía'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28081,10 +23486,10 @@ DROP TABLE IF EXISTS `claimResponsible`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimResponsible` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(45) NOT NULL, `responsability` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'if=1 >sensib >culpa', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Responsables de las causas'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Responsables de las causas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28096,9 +23501,25 @@ DROP TABLE IF EXISTS `claimResult`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimResult` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Consecuencias de los motivos'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Consecuencias de los motivos'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `claimRma` +-- + +DROP TABLE IF EXISTS `claimRma`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `claimRma` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `code` varchar(100) NOT NULL, + `created` timestamp NOT NULL DEFAULT current_timestamp(), + `workerFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28110,15 +23531,15 @@ DROP TABLE IF EXISTS `claimState`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimState` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `code` varchar(45) CHARACTER SET utf8 DEFAULT NULL, - `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', + `code` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `description` varchar(15) 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 -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Estados posibles de las reclamaciones'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Estados posibles de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28130,38 +23551,26 @@ DROP TABLE IF EXISTS `client`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `client` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `discount` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'obsoleta (comprobar)', + `name` varchar(50) NOT NULL, `defaultAddressFk` int(11) DEFAULT NULL, - `street` longtext COLLATE utf8_unicode_ci DEFAULT NULL, - `fi` varchar(14) COLLATE utf8_unicode_ci DEFAULT NULL, - `phone` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `fax__` varchar(11) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'obsoleta (comprobar)', - `email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `cc` varchar(23) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'obsoleta (comprobar)', + `street` longtext DEFAULT NULL, + `fi` varchar(14) DEFAULT NULL, + `phone` varchar(15) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, `dueDay` smallint(6) NOT NULL DEFAULT 5, - `receipt__` int(11) DEFAULT 1 COMMENT 'obsoleta', - `isOfficial__` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'obsoleta (comprobar)', `isTaxDataChecked` tinyint(1) NOT NULL DEFAULT 0, - `mobile` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `accountingAccount` varchar(10) CHARACTER SET utf8 NOT NULL, + `mobile` varchar(15) DEFAULT NULL, + `accountingAccount` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `isEqualizated` tinyint(1) NOT NULL DEFAULT 0, - `city` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL, - `provinceFk` smallint(5) unsigned DEFAULT NULL, - `postcode` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL, - `socialName` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL, - `contact` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `wholesaler__` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'obsoleta (comprobar)', - `isReExpedition__` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'obsoleta (comprobar)', + `city` varchar(25) DEFAULT NULL, + `provinceFk` smallint(5) unsigned NOT NULL, + `postcode` varchar(8) DEFAULT NULL, + `socialName` varchar(60) DEFAULT NULL, + `contact` varchar(50) DEFAULT NULL, `hasToInvoice` tinyint(1) NOT NULL DEFAULT 1, - `notes` text COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'obsoleta (comprobar)', - `administrativeNotes__` text COLLATE utf8_unicode_ci NOT NULL COMMENT 'obsoleta (comprobar)', - `invoiceCopy__` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'obsoleta (comprobar)', - `hold__` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'obsoleta (comprobar)', `isFreezed` tinyint(1) NOT NULL DEFAULT 0, `salesPersonFk` int(10) unsigned DEFAULT NULL, `credit` decimal(10,2) NOT NULL DEFAULT 0.00, - `cyc` double DEFAULT NULL COMMENT 'obsoleta (comprobar)', `countryFk` mediumint(8) unsigned NOT NULL DEFAULT 1, `isActive` tinyint(1) NOT NULL DEFAULT 1, `gestdocFk` int(11) DEFAULT NULL, @@ -28171,33 +23580,29 @@ CREATE TABLE `client` ( `isToBeMailed` tinyint(1) NOT NULL DEFAULT 1, `contactChannelFk` smallint(6) DEFAULT NULL, `isVies` tinyint(4) NOT NULL DEFAULT 0, - `splitHolland__` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'obsoleta (comprobar)', - `sepaFth__` tinyint(1) DEFAULT 0 COMMENT 'campo para recibir los escritos de los clientes para el sepaobsoleta (comprobar)', `hasSepaVnl` tinyint(1) DEFAULT 0, - `coreFth__` tinyint(1) DEFAULT 0 COMMENT 'obsoleta (comprobar)', `hasCoreVnl` tinyint(1) DEFAULT 0, `riskCalculated` date NOT NULL, `hasCoreVnh` tinyint(1) DEFAULT 0, `isRelevant` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Define los clientes cuyas ventas hay que tener en cuenta en los calculos estadisticos.', `clientTypeFk` int(11) NOT NULL DEFAULT 1, - `postcodeOld__` int(11) unsigned DEFAULT NULL COMMENT 'obsoleta (comprobar)', `mailAddress` int(11) DEFAULT NULL, - `codposOLD__` char(5) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'obsoleta (comprobar)', `creditInsurance` int(11) DEFAULT NULL, `eypbc` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Email\\nYesterday\\nPurchases\\nBy\\nConsigna', `hasToInvoiceByAddress` tinyint(1) DEFAULT 0, - `cplusTerIdNifFk__` int(11) NOT NULL DEFAULT 1 COMMENT 'OBSOLETO', `isCreatedAsServed` tinyint(1) DEFAULT 0, `hasInvoiceSimplified` tinyint(1) NOT NULL DEFAULT 0, - `iban` varchar(45) CHARACTER SET utf8 DEFAULT NULL, + `hasElectronicInvoice` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Registro de facturas mediante FACe', + `iban` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `hasLcr` tinyint(1) NOT NULL DEFAULT 0, - `bankEntityFk` int(10) DEFAULT NULL, - `typeFk` varchar(20) CHARACTER SET utf8 NOT NULL DEFAULT 'normal', + `bankEntityFk` int(10) unsigned DEFAULT NULL, + `typeFk` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'normal', `taxTypeSageFk` smallint(6) DEFAULT NULL COMMENT 'Tipo de Iva por defecto asociado al cliente en SAGE', `transactionTypeSageFk` tinyint(4) DEFAULT NULL COMMENT 'Tipo de transacción por defecto asociado al cliente en SAGE', `transferorFk` int(11) DEFAULT NULL COMMENT 'Cliente que le ha transmitido la titularidad de la empresa', - `lastSalesPersonFk` int(11) DEFAULT NULL COMMENT 'ultimo comercial que tuvo, para el calculo del peso en los rankings de equipo', - `businessTypeFk` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + `lastSalesPersonFk` int(10) unsigned DEFAULT NULL COMMENT 'ultimo comercial que tuvo, para el calculo del peso en los rankings de equipo', + `businessTypeFk` varchar(20) NOT NULL DEFAULT 'florist', + `hasIncoterms` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Received incoterms authorization from client', PRIMARY KEY (`id`), UNIQUE KEY `IF` (`fi`), KEY `Id_Trabajador` (`salesPersonFk`), @@ -28210,15 +23615,19 @@ CREATE TABLE `client` ( KEY `Telefono` (`phone`), KEY `movil` (`mobile`), KEY `tipos_de_cliente_idx` (`clientTypeFk`), - KEY `codpos` (`codposOLD__`,`postcode`), KEY `fk_Clientes_entity_idx` (`bankEntityFk`), KEY `typeFk` (`typeFk`), KEY `client_taxTypeSageFk_idx` (`taxTypeSageFk`), KEY `client_transactionTypeSageFk_idx` (`transactionTypeSageFk`), KEY `client_FK` (`businessTypeFk`), KEY `client_lastSalesPersonFk_IDX` (`lastSalesPersonFk`) USING BTREE, + KEY `client_FK_3` (`transferorFk`), + KEY `codpos` (`postcode`), CONSTRAINT `canal_nuevo_cliente` FOREIGN KEY (`contactChannelFk`) REFERENCES `contactChannel` (`id`) ON UPDATE CASCADE, CONSTRAINT `client_FK` FOREIGN KEY (`businessTypeFk`) REFERENCES `businessType` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `client_FK_1` FOREIGN KEY (`bankEntityFk`) REFERENCES `bankEntity` (`id`) ON UPDATE CASCADE, + CONSTRAINT `client_FK_2` FOREIGN KEY (`lastSalesPersonFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `client_FK_3` FOREIGN KEY (`transferorFk`) REFERENCES `client` (`id`), CONSTRAINT `client_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, CONSTRAINT `client_ibfk_2` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON UPDATE CASCADE, CONSTRAINT `client_ibfk_3` FOREIGN KEY (`salesPersonFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, @@ -28228,7 +23637,7 @@ CREATE TABLE `client` ( CONSTRAINT `client_transactionTypeSageFk` FOREIGN KEY (`transactionTypeSageFk`) REFERENCES `sage`.`TiposTransacciones` (`CodigoTransaccion`) ON UPDATE CASCADE, CONSTRAINT `tipos_de_cliente` FOREIGN KEY (`clientTypeFk`) REFERENCES `clientType` (`id`) ON UPDATE CASCADE, CONSTRAINT `typeFk` FOREIGN KEY (`typeFk`) REFERENCES `clientType` (`code`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -28253,7 +23662,7 @@ BEGIN END IF; SET NEW.accountingAccount = 4300000000 + NEW.id; - + SET NEW.lastSalesPersonFk = NEW.salesPersonFk; END */;; DELIMITER ; @@ -28281,19 +23690,19 @@ BEGIN IF !(NEW.phone <=> OLD.phone) AND (NEW.phone <> '') THEN CALL pbx.phone_isValid(NEW.phone); END IF; - + IF !(NEW.mobile <=> OLD.mobile) AND (NEW.mobile <> '')THEN CALL pbx.phone_isValid(NEW.mobile); END IF; SELECT id INTO vPayMethodFk - FROM vn.payMethod + FROM vn.payMethod WHERE code = 'bankDraft'; - + IF NEW.payMethodFk = vPayMethodFk AND NEW.dueDay = 0 THEN SET NEW.dueDay = 5; END IF; - + -- Avisar al comercial si ha llegado la documentación sepa/core IF NEW.hasSepaVnl AND !OLD.hasSepaVnl THEN @@ -28306,7 +23715,7 @@ BEGIN IF vText IS NOT NULL THEN - INSERT INTO mail(receiver, replyTo, `subject`, body) + INSERT INTO mail(receiver, replyTo, `subject`, body) SELECT CONCAT(IF(ac.id,u.name, 'jgallego'), '@verdnatura.es'), 'administracion@verdnatura.es', @@ -28317,17 +23726,23 @@ BEGIN LEFT JOIN account.account ac ON ac.id = u.id WHERE w.id = NEW.salesPersonFk; END IF; - + IF NEW.salespersonFk IS NULL AND OLD.salespersonFk IS NOT NULL THEN - IF (SELECT COUNT(clientFk) + IF (SELECT COUNT(clientFk) FROM clientProtected WHERE clientFk = NEW.id ) > 0 THEN CALL util.throw("HAS_CLIENT_PROTECTED"); END IF; END IF; - - SET NEW.lastSalesPersonFk = IFNULL(NEW.salesPersonFk, OLD.salesPersonFk); + + IF !(NEW.salesPersonFk <=> OLD.salesPersonFk) THEN + SET NEW.lastSalesPersonFk = IFNULL(NEW.salesPersonFk, OLD.salesPersonFk); + END IF; + + IF !(NEW.businessTypeFk <=> OLD.businessTypeFk) THEN + SET NEW.isTaxDataChecked = 0; + END IF; END */;; DELIMITER ; @@ -28348,21 +23763,26 @@ DELIMITER ;; AFTER UPDATE ON `client` FOR EACH ROW BEGIN - IF !(NEW.defaultAddressFk <=> OLD.defaultAddressFk) THEN - UPDATE `address` SET isDefaultAddress = 0 - WHERE clientFk = NEW.id; - + IF !(NEW.defaultAddressFk <=> OLD.defaultAddressFk) THEN + UPDATE `address` SET isDefaultAddress = 0 + WHERE clientFk = NEW.id; + UPDATE `address` SET isDefaultAddress = 1 - WHERE id = NEW.defaultAddressFk; - END IF; - - IF NOT (NEW.provinceFk <=> OLD.provinceFk) OR NOT (NEW.isVies <=> OLD.isVies) THEN - INSERT IGNORE INTO ticketRecalc (ticketFk) - SELECT id FROM ticket t - WHERE t.clientFk = NEW.id - AND t.refFk IS NULL; + WHERE id = NEW.defaultAddressFk; END IF; + IF NOT (NEW.provinceFk <=> OLD.provinceFk) OR NOT (NEW.isVies <=> OLD.isVies) THEN + INSERT IGNORE INTO ticketRecalc (ticketFk) + SELECT id FROM ticket t + WHERE t.clientFk = NEW.id + AND t.refFk IS NULL; + END IF; + + IF NOT NEW.isActive THEN + UPDATE account.`user` + SET active = FALSE + WHERE id = NEW.id; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -28386,7 +23806,7 @@ CREATE TABLE `clientChain` ( KEY `clientChain_fk2_idx` (`chainFk`), CONSTRAINT `clientChain_fk1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientChain_fk2` FOREIGN KEY (`chainFk`) REFERENCES `chain` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28399,8 +23819,28 @@ DROP TABLE IF EXISTS `clientConfig`; CREATE TABLE `clientConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `riskTolerance` int(11) DEFAULT NULL COMMENT 'Maximo riesgo de un cliente para preparar su pedido', + `maxCreditRows` int(11) DEFAULT NULL COMMENT 'Máximo número de registros a mantener en la tabla clientCredit', + `maxPriceIncreasingRatio` decimal(2,2) NOT NULL DEFAULT 0.25 COMMENT 'máximo recobro permitido', + `riskScope` int(11) NOT NULL DEFAULT 2 COMMENT 'Time range in months to calculating a customer''s risk', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `clientConsumptionQueue` +-- + +DROP TABLE IF EXISTS `clientConsumptionQueue`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `clientConsumptionQueue` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `params` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`params`)), + `queued` datetime NOT NULL DEFAULT current_timestamp(), + `printed` datetime DEFAULT NULL, + `status` varchar(50) DEFAULT '', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Queue for client consumption PDF mailing'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28413,10 +23853,10 @@ DROP TABLE IF EXISTS `clientContact`; CREATE TABLE `clientContact` ( `id` int(11) NOT NULL AUTO_INCREMENT, `clientFk` int(11) NOT NULL, - `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `phone` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + `name` varchar(45) DEFAULT NULL, + `phone` varchar(15) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28437,14 +23877,14 @@ CREATE TABLE `clientCredit` ( KEY `credit_ClienteFk` (`clientFk`), CONSTRAINT `credit_ClienteFk` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `workers_fk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -28452,15 +23892,15 @@ DELIMITER ;; AFTER INSERT ON clientCredit FOR EACH ROW BEGIN - + DECLARE vSender VARCHAR(50); SELECT u.name INTO vSender FROM account.`user` u WHERE u.id = NEW.workerFk; - + IF vSender IN ('juanvi','pepe') THEN - + CALL `vn`.`mail_insert`('pako@verdnatura.es', NULL, CONCAT('ClientCredit ',vSender, ' ', NEW.clientFk, ' ' , NEW.amount, ' €'), @@ -28489,7 +23929,7 @@ CREATE TABLE `clientCreditLimit` ( PRIMARY KEY (`id`), KEY `clientCreditLimit_FK_idx` (`roleFk`), CONSTRAINT `clientCreditLimit_FK` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28505,28 +23945,9 @@ CREATE TABLE `clientDms` ( PRIMARY KEY (`dmsFk`), KEY `gest_doc_id` (`dmsFk`), KEY `fk_clientes_gestdoc_1_idx` (`clientFk`), - CONSTRAINT `clientDms_ibfk_2` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `clientDms_ibfk_2` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_clientes_gestdoc_3` FOREIGN KEY (`clientFk`) REFERENCES `client` (`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 `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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28538,16 +23959,15 @@ DROP TABLE IF EXISTS `clientItemType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientItemType` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `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', + `itemTypeFk` smallint(5) unsigned NOT NULL DEFAULT 1, 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'; + CONSTRAINT `clientItemType_FK_1` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='son familias de productos que se quieren sustraer a la oferta del cliente'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28561,20 +23981,20 @@ CREATE TABLE `clientLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `originFk` int(11) NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, - `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), - `description` text CHARACTER SET utf8 DEFAULT NULL, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, - `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` varchar(45) DEFAULT NULL, + `oldInstance` text DEFAULT NULL, + `newInstance` text DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), KEY `originFk` (`originFk`), KEY `userFk` (`userFk`), CONSTRAINT `clientLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28606,24 +24026,9 @@ CREATE TABLE `clientManaCache` ( PRIMARY KEY (`clientFk`,`dated`), KEY `manaCustomerIdx1` (`dated`), CONSTRAINT `cliente_fk` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `clientManaCache__` --- - -DROP TABLE IF EXISTS `clientManaCache__`; -/*!50001 DROP VIEW IF EXISTS `clientManaCache__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `clientManaCache__` ( - `clientFk` tinyint NOT NULL, - `mana` tinyint NOT NULL, - `dated` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `clientObservation` -- @@ -28635,7 +24040,7 @@ CREATE TABLE `clientObservation` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `clientFk` int(11) NOT NULL, `workerFk` int(10) unsigned DEFAULT NULL, - `text` text COLLATE utf8_unicode_ci NOT NULL, + `text` text NOT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `Id_Trabajador` (`workerFk`), @@ -28643,51 +24048,8 @@ CREATE TABLE `clientObservation` ( KEY `clientObservation_created_IDX` (`created`) USING BTREE, CONSTRAINT `clientObservation_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientObservation_ibfk_2` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Todas las observaciones referentes 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`.`clientObservation_AFTER_INSERT` - AFTER INSERT ON `clientObservation` - FOR EACH ROW -BEGIN -/* DECLARE vMailSender VARCHAR(90); - DECLARE vUserName VARCHAR(30); - DECLARE vUserId INT ; - - SELECT u.name, u.id INTO vUserName, vUserId - FROM account.user u - JOIN vn.worker w ON w.userFk = u.id - WHERE w.id = NEW.workerFk; - - SELECT CONCAT(salesPerson.name, '@verdnatura.es, ',vUserName, '@verdnatura.es') INTO vMailSender - FROM vn.client c - JOIN vn.worker w ON w.id = c.salesPersonFk - JOIN account.user salesPerson ON salesPerson.id = w.userFk - WHERE c.id = NEW.clientFk - AND salesPerson.id <> vUserId; - - IF vMailSender >'' THEN - INSERT INTO vn.mail SET - `sender` = vMailSender, - `replyTo` = CONCAT(vUserName, '@verdnatura.es'), - `subject` = CONCAT ('Nota añadida al cliente ', NEW.clientFk) , - `body` = CONCAT(vUserName, ' ha añadido la siguiente nota: ', NEW.`text`); - END IF; -*/ -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_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 `clientPackagingGifts` @@ -28704,7 +24066,7 @@ CREATE TABLE `clientPackagingGifts` ( KEY `clientPackagingGifts_FK_1` (`giftFk`), CONSTRAINT `clientPackagingGifts_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`), CONSTRAINT `clientPackagingGifts_FK_1` FOREIGN KEY (`giftFk`) REFERENCES `packagingGifts` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28731,12 +24093,11 @@ DROP TABLE IF EXISTS `clientProtected`; CREATE TABLE `clientProtected` ( `clientFk` int(11) NOT NULL, `workerFk` int(10) unsigned NOT NULL, - `isValidated__` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`clientFk`), KEY `clientProtected_fk2_idx` (`workerFk`), CONSTRAINT `clientProtected_fk1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientProtected_fk2` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de clientes y comerciales que no se van a ver afectados por las desagsignaciones mensuales automaticas'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Lista de clientes y comerciales que no se van a ver afectados por las desagsignaciones mensuales automaticas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28754,7 +24115,7 @@ CREATE TABLE `clientRisk` ( KEY `company_id` (`companyFk`), CONSTRAINT `clientRisk_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientRisk_ibfk_2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Saldo de apertura < 2015-01-01'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Saldo de apertura < 2015-01-01'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28776,7 +24137,7 @@ CREATE TABLE `clientSample` ( PRIMARY KEY (`id`), KEY `empresa_id` (`companyFk`), CONSTRAINT `clientSample_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28788,12 +24149,28 @@ DROP TABLE IF EXISTS `clientType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientType` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `code` varchar(20) CHARACTER SET utf8 NOT NULL, - `type` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `type` varchar(45) NOT NULL, `isCreatedAsServed` tinyint(1) DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Establece categorias para poder agrupar las ventas'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Establece categorias para poder agrupar las ventas'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `clientUnpaid` +-- + +DROP TABLE IF EXISTS `clientUnpaid`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `clientUnpaid` ( + `clientFk` int(11) NOT NULL, + `dated` date NOT NULL, + `amount` double DEFAULT 0, + PRIMARY KEY (`clientFk`), + CONSTRAINT `clientUnpaid_clientFk` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28810,7 +24187,7 @@ CREATE TABLE `clientYoke` ( KEY `clientYoke_fk2_idx` (`rightOx`), CONSTRAINT `clientYoke_fk1` FOREIGN KEY (`leftOx`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientYoke_fk2` FOREIGN KEY (`rightOx`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='emparejamiento de clientes a efectos de precios'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='emparejamiento de clientes a efectos de precios'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28823,19 +24200,19 @@ DROP TABLE IF EXISTS `cmr`; CREATE TABLE `cmr` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` int(11) DEFAULT NULL, - `truckPlate` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, - `observations` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `senderInstruccions` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'Flowers 4º C. Plants 14º C', - `paymentInstruccions` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'Carriage paid', - `specialAgreements` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `truckPlate` varchar(30) DEFAULT NULL, + `observations` varchar(255) DEFAULT NULL, + `senderInstruccions` varchar(255) DEFAULT 'Flowers 4º C. Plants 14º C', + `paymentInstruccions` varchar(255) DEFAULT 'Carriage paid', + `specialAgreements` varchar(255) DEFAULT NULL, `created` timestamp NULL DEFAULT current_timestamp(), `companyFk` smallint(5) unsigned DEFAULT NULL, `addressToFk` int(11) DEFAULT NULL, `addressFromFk` int(11) DEFAULT NULL, `supplierFk` int(11) DEFAULT NULL, - `packagesList` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `merchandiseDetail` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `state` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `packagesList` varchar(255) DEFAULT NULL, + `merchandiseDetail` varchar(255) DEFAULT NULL, + `state` varchar(100) DEFAULT NULL, `landed` datetime DEFAULT NULL COMMENT 'Hora de llegada a destino', `ead` datetime DEFAULT NULL COMMENT 'Estimated Arriving Date', PRIMARY KEY (`id`), @@ -28843,11 +24220,13 @@ CREATE TABLE `cmr` ( KEY `cmr_fk2_idx` (`companyFk`), KEY `cmr_fk3_idx` (`addressToFk`), KEY `cm_fk4_idx` (`supplierFk`), + KEY `cmr_FK` (`addressFromFk`), CONSTRAINT `cm_fk4` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `cmr_FK` FOREIGN KEY (`addressFromFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE, CONSTRAINT `cmr_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `cmr_fk2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `cmr_fk3` FOREIGN KEY (`addressToFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -28866,23 +24245,23 @@ BEGIN DECLARE vLastSenderInstructions VARCHAR(255); DECLARE vLastId INT; DECLARE vCurrentAgency INT; - + SELECT am.agencyFk INTO vCurrentAgency FROM vn.agencyMode am JOIN vn.ticket t ON t.agencyModeFk = am.id WHERE t.id = NEW.ticketFk; - + SELECT MAX(cmr.id) INTO vLastId FROM cmr JOIN vn.ticket t ON t.id = cmr.ticketFk JOIN vn.agencyMode am ON am.id = t.agencyModeFk - WHERE am.agencyFk = vCurrentAgency + WHERE am.agencyFk = vCurrentAgency ; - + SELECT senderInstruccions INTO vLastSenderInstructions FROM cmr WHERE id = vLastId; - + SET NEW.senderInstruccions = vLastSenderInstructions; END */;; @@ -28901,18 +24280,18 @@ DROP TABLE IF EXISTS `cmrConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cmrConfig` ( `dayOfMonth` int(11) DEFAULT NULL, - `landingDays` tinyint(4) NOT NULL DEFAULT '1' -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + `landingDays` tinyint(4) NOT NULL DEFAULT 1 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `cmr_expeditionPallet` +-- Table structure for table `cmrPallet` -- -DROP TABLE IF EXISTS `cmr_expeditionPallet`; +DROP TABLE IF EXISTS `cmrPallet`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cmr_expeditionPallet` ( +CREATE TABLE `cmrPallet` ( `id` int(11) NOT NULL AUTO_INCREMENT, `cmrFk` int(11) NOT NULL, `expeditionPalletFk` int(11) NOT NULL, @@ -28922,7 +24301,7 @@ CREATE TABLE `cmr_expeditionPallet` ( KEY `cmr_expeditionPallet_fk2_idx` (`expeditionPalletFk`), CONSTRAINT `cmr_expeditionPallet_fk1` FOREIGN KEY (`cmrFk`) REFERENCES `cmr` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `cmr_expeditionPallet_fk2` FOREIGN KEY (`expeditionPalletFk`) REFERENCES `expeditionPallet` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='relaciona los cmr con los pallets de expediciones'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='relaciona los cmr con los pallets de expediciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28983,19 +24362,26 @@ CREATE TABLE `collection` ( `created` timestamp NOT NULL DEFAULT current_timestamp(), `workerFk` int(10) unsigned DEFAULT NULL, `stateFk` tinyint(3) unsigned DEFAULT NULL, - `itemPackingTypeFk` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `itemPackingTypeFk` varchar(1) DEFAULT NULL, `saleTotalCount` int(11) NOT NULL DEFAULT 0, `salePickedCount` int(11) NOT NULL DEFAULT 0, `trainFk` int(11) NOT NULL DEFAULT 1, + `sectorFk` int(11) DEFAULT NULL, + `wagons` int(11) DEFAULT NULL, + `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 60, PRIMARY KEY (`id`), KEY `ticketCollection_idx` (`workerFk`), KEY `collection_id2_idx` (`stateFk`), KEY `collection_FK` (`itemPackingTypeFk`), KEY `collectionTrain_Fk` (`trainFk`), + KEY `collectionSector_FK` (`sectorFk`), + KEY `collection_FK2` (`warehouseFk`), + CONSTRAINT `collectionSector_FK` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `collectionTrain_Fk` FOREIGN KEY (`trainFk`) REFERENCES `train` (`id`) ON UPDATE CASCADE, + CONSTRAINT `collection_FK2` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `collection_id2` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `ticketCollection` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -29010,33 +24396,33 @@ DELIMITER ;; 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 + IF NEW.saleTotalCount <= NEW.salePickedCount + AND (NEW.saleTotalCount != OLD.saleTotalCount OR NEW.salePickedCount != OLD.salePickedCount) - THEN - + THEN + SELECT id INTO vStateFk - FROM vn.state + 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 + IF NEW.saleTotalCount > NEW.salePickedCount + AND (NEW.saleTotalCount != OLD.saleTotalCount OR NEW.salePickedCount != OLD.salePickedCount) THEN SELECT id INTO vStateFk - FROM vn.state + FROM vn.state WHERE code = 'ON_PREPARATION'; - + SET NEW.stateFk = vStateFk; - + END IF; END */;; @@ -29055,78 +24441,72 @@ DROP TABLE IF EXISTS `collectionColors`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `collectionColors` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `code` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(20) NOT NULL, `shelve` int(11) NOT NULL DEFAULT 1, `wagon` int(11) NOT NULL DEFAULT 1, `trainFk` int(11) NOT NULL DEFAULT 1, + `rgb` char(7) DEFAULT NULL, PRIMARY KEY (`id`), + UNIQUE KEY `collectionColors_UN` (`shelve`,`wagon`,`trainFk`), KEY `collectionColors_FK` (`trainFk`), CONSTRAINT `collectionColors_FK` FOREIGN KEY (`trainFk`) REFERENCES `train` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los colores para las baldas de las colecciones'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Recoge los colores para las baldas de las colecciones'; /*!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.collectionColors_beforeInsert +BEFORE INSERT +ON collectionColors FOR EACH ROW +BEGIN + CALL util.checkHex(NEW.rgb); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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`.`collectionColors_beforeUpdate` + BEFORE UPDATE ON `collectionColors` + FOR EACH ROW +BEGIN + CALL util.checkHex(NEW.rgb); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `collectionReportSource` +-- Table structure for table `collectionHotbed` -- -DROP TABLE IF EXISTS `collectionReportSource`; -/*!50001 DROP VIEW IF EXISTS `collectionReportSource`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `collectionReportSource` ( - `collectionFk` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `concept` tinyint NOT NULL, - `size` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `nicho` tinyint NOT NULL, - `level` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `collectionSmartTag` --- - -DROP TABLE IF EXISTS `collectionSmartTag`; -/*!50001 DROP VIEW IF EXISTS `collectionSmartTag`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `collectionSmartTag` ( - `code` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL, - `level` tinyint NOT NULL, - `wagon` tinyint NOT NULL, - `shelvingFk` tinyint NOT NULL, - `collectionFk` tinyint NOT NULL, - `agencyFk` tinyint NOT NULL, - `clientFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `collectionSmartTag2` --- - -DROP TABLE IF EXISTS `collectionSmartTag2`; -/*!50001 DROP VIEW IF EXISTS `collectionSmartTag2`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `collectionSmartTag2` ( - `code` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL, - `level` tinyint NOT NULL, - `wagon` tinyint NOT NULL, - `shelvingFk` tinyint NOT NULL, - `collectionFk` tinyint NOT NULL, - `agencyFk` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `worker` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `landed` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; +DROP TABLE IF EXISTS `collectionHotbed`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `collectionHotbed` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `userFk` int(11) NOT NULL, + `created` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `collectionVolumetry` @@ -29141,14 +24521,14 @@ CREATE TABLE `collectionVolumetry` ( `lines` int(10) unsigned NOT NULL DEFAULT 1, `liters` int(10) unsigned NOT NULL DEFAULT 0, `height` int(10) unsigned NOT NULL DEFAULT 20, - `itemPackingTypeFk` varchar(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'H', + `itemPackingTypeFk` varchar(1) NOT NULL DEFAULT 'H', `trainFk` int(11) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), KEY `collectionVolumetry_FK` (`itemPackingTypeFk`), KEY `collectionVolumetry_FK_1` (`trainFk`), CONSTRAINT `collectionVolumetry_FK` FOREIGN KEY (`itemPackingTypeFk`) REFERENCES `itemPackingType` (`code`) ON UPDATE CASCADE, CONSTRAINT `collectionVolumetry_FK_1` FOREIGN KEY (`trainFk`) REFERENCES `train` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29171,8 +24551,14 @@ CREATE TABLE `commissionConfig` ( `minScoreForPlusBoss` int(11) DEFAULT NULL, `plusTeam` int(11) DEFAULT NULL, `plusBoss` int(11) DEFAULT NULL COMMENT 'Este campo se deberá multiplicar x el número de miembros del equipo', + `executionDay` smallint(6) DEFAULT NULL, + `salesPersonWithPlusNewClient` int(11) DEFAULT NULL, + `maxPlusNewClient` int(11) DEFAULT NULL, + `plusDifference` int(11) DEFAULT NULL, + `maxScoreNewClient` int(11) DEFAULT NULL, + `scoreDifference` int(11) DEFAULT NULL, PRIMARY KEY (`rate`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29184,18 +24570,18 @@ DROP TABLE IF EXISTS `company`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `company` ( `id` smallint(5) unsigned NOT NULL, - `code` char(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `register` varchar(120) COLLATE utf8_unicode_ci NOT NULL, + `code` char(3) DEFAULT NULL, + `register` varchar(120) NOT NULL, `workerManagerFk` int(10) unsigned NOT NULL, `registered` date NOT NULL, `expired` date DEFAULT NULL, `logo` longblob DEFAULT NULL, `isOfficial` tinyint(1) unsigned NOT NULL DEFAULT 1, `hasCyc` tinyint(1) unsigned zerofill NOT NULL DEFAULT 0, - `rgb` varchar(6) COLLATE utf8_unicode_ci NOT NULL, - `email` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `rgb` varchar(6) NOT NULL, + `email` varchar(30) NOT NULL, `stamp` blob DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), + `created` timestamp NOT NULL ON UPDATE current_timestamp(), `clientFk` int(11) DEFAULT NULL, `sage200Company` int(2) DEFAULT NULL, `supplierAccountFk` mediumint(8) unsigned DEFAULT NULL, @@ -29203,10 +24589,11 @@ CREATE TABLE `company` ( `companyGroupFk` int(11) NOT NULL DEFAULT 1 COMMENT 'usado para calcular los greuges ', `companyCode` int(2) DEFAULT NULL COMMENT 'Campo para movConta', `companyCodeTest` int(2) DEFAULT NULL, - `footnotes` longtext COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'pie de paginas en las facturas', - `phytosanitary` longtext COLLATE utf8_unicode_ci DEFAULT NULL, + `footnotes` longtext DEFAULT NULL COMMENT 'pie de paginas en las facturas', + `phytosanitary` longtext DEFAULT NULL, `fhAdminNumber` int(11) DEFAULT NULL COMMENT 'número de cliente en FloraHolland', PRIMARY KEY (`id`), + UNIQUE KEY `companyCode_UNIQUE` (`code`), KEY `gerente_id` (`workerManagerFk`), KEY `empresa_cliente_idx` (`clientFk`), KEY `Id_Proveedores_account` (`supplierAccountFk`), @@ -29216,7 +24603,7 @@ CREATE TABLE `company` ( CONSTRAINT `empresa_cliente` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `empresa_fk4` FOREIGN KEY (`supplierAccountFk`) REFERENCES `supplierAccount` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `fk_empresa_grupo` FOREIGN KEY (`companyGroupFk`) REFERENCES `companyGroup` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29228,9 +24615,24 @@ DROP TABLE IF EXISTS `companyGroup`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `companyGroup` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `comparativeFilterType` +-- + +DROP TABLE IF EXISTS `comparativeFilterType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `comparativeFilterType` ( + `comparativeFilterFk` int(11) NOT NULL, + `itemTypeFk` int(11) NOT NULL, + PRIMARY KEY (`comparativeFilterFk`,`itemTypeFk`), + CONSTRAINT `comparativeFilterType_FK` FOREIGN KEY (`comparativeFilterFk`) REFERENCES `comparativeFilter` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29242,18 +24644,18 @@ DROP TABLE IF EXISTS `component`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `component` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(45) NOT NULL, `typeFk` int(11) NOT NULL, `classRate` smallint(6) DEFAULT NULL, `tax` double DEFAULT NULL, `isRenewable` tinyint(2) NOT NULL DEFAULT 1, - `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `code` varchar(45) DEFAULT NULL, `isRequired` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Son componentes imprescindibles en toda venta', PRIMARY KEY (`id`), KEY `series_componentes_idx` (`typeFk`), KEY `comp` (`classRate`), CONSTRAINT `serie_componente` FOREIGN KEY (`typeFk`) REFERENCES `componentType` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29265,13 +24667,13 @@ DROP TABLE IF EXISTS `componentType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `componentType` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `type` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `type` varchar(45) NOT NULL, `isBase` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Marca aquellas series que se utilizan para calcular el precio base de las ventas, a efectos estadisticos', `isMargin` tinyint(4) NOT NULL DEFAULT 0, - `code` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `Serie_UNIQUE` (`type`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Permite organizar de forma ordenada los distintos componentes'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Permite organizar de forma ordenada los distintos componentes'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29283,9 +24685,9 @@ DROP TABLE IF EXISTS `confectionType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `confectionType` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29299,21 +24701,12 @@ CREATE TABLE `config` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ochoa` int(10) unsigned NOT NULL, `invoiceOutFk` int(11) DEFAULT 0, - `bookFk` int(11) DEFAULT 0, - `serialAFk` int(11) DEFAULT 0, - `serialEFk` int(11) DEFAULT 0, - `serialRFk` int(11) DEFAULT 0, - `serialCFk` int(11) DEFAULT 0, - `serialHFk` int(11) NOT NULL, - `serialPFk` int(11) DEFAULT 0, - `serialTFk` int(11) DEFAULT 0, `inventoried` datetime DEFAULT NULL, - `serialMFk` int(11) DEFAULT 0, `itemLog` int(11) DEFAULT 0, `weekGoal` int(11) DEFAULT NULL, - `photosPath` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `photosPath` varchar(255) DEFAULT NULL, `cashBoxNumber` int(11) DEFAULT 0, - `redCode` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `redCode` varchar(50) DEFAULT NULL, `TabletTime` datetime DEFAULT NULL, `t0` int(11) NOT NULL DEFAULT 0, `t1` int(11) NOT NULL DEFAULT 0, @@ -29325,7 +24718,7 @@ CREATE TABLE `config` ( `campaignLife` tinyint(3) unsigned NOT NULL, `truckDays` tinyint(3) unsigned NOT NULL, `transportCharges` double NOT NULL, - `escanerPath` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `escanerPath` varchar(50) NOT NULL, `printedTurn` int(4) DEFAULT NULL, `truckLength` int(11) DEFAULT 24, `fuelConsumption` int(11) DEFAULT NULL, @@ -29336,14 +24729,14 @@ CREATE TABLE `config` ( `kmPrice` decimal(10,1) DEFAULT NULL, `routeOption` int(11) DEFAULT 1, `dbproduccion` tinyint(1) NOT NULL DEFAULT 1, - `mdbServer` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `fakeEmail` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `mdbServer` varchar(255) NOT NULL, + `fakeEmail` varchar(255) DEFAULT NULL, `defaultersMaxAmount` int(10) DEFAULT 200 COMMENT 'maxima deuda permitida a partir de la cual se bloquea a un usuario', `ASIEN` bigint(20) DEFAULT NULL, `dayStartingHour` int(11) NOT NULL DEFAULT 3 COMMENT 'Hora a la que empieza una nueva jornada de producción', PRIMARY KEY (`id`), KEY `fechainv_idx` (`inventoried`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29355,9 +24748,9 @@ DROP TABLE IF EXISTS `contactChannel`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `contactChannel` ( `id` smallint(6) NOT NULL AUTO_INCREMENT, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Canal por el que nos ha conocido un cliente y se ha dado de'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Canal por el que nos ha conocido un cliente y se ha dado de'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29369,11 +24762,11 @@ DROP TABLE IF EXISTS `continent`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `continent` ( `id` tinyint(4) NOT NULL AUTO_INCREMENT, - `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `code` varchar(2) CHARACTER SET utf8 NOT NULL, + `name` varchar(50) NOT NULL, + `code` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `continent_name_uindex` (`name`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='World continents'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='World continents'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29389,16 +24782,14 @@ CREATE TABLE `contratos_subvencion_270619` ( `cod_centroFk` int(11) NOT NULL, `CodContratoFk` int(11) NOT NULL, `journey` decimal(5,2) NOT NULL DEFAULT 8.00, - `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `nif` varchar(12) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(50) NOT NULL, + `nif` varchar(12) NOT NULL, PRIMARY KEY (`id`), KEY `contratos_subvencion_270619_fk2_idx` (`cod_centroFk`), - KEY `contratos_subvencion_270619_fk3_idx` (`CodContratoFk`), KEY `contratos_subvencion_270619_fk1_idx` (`workerFk`), CONSTRAINT `contratos_subvencion_270619_fk1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `contratos_subvencion_270619_fk2` FOREIGN KEY (`cod_centroFk`) REFERENCES `vn2008`.`payroll_centros` (`cod_centro`) ON UPDATE CASCADE, - CONSTRAINT `contratos_subvencion_270619_fk3` FOREIGN KEY (`CodContratoFk`) REFERENCES `vn2008`.`payroll_contratos__` (`CodContrato`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Segun los informes de vida laboral aportados por la SS'; + CONSTRAINT `contratos_subvencion_270619_fk2` FOREIGN KEY (`cod_centroFk`) REFERENCES `vn2008`.`payroll_centros` (`cod_centro`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Segun los informes de vida laboral aportados por la SS'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29424,7 +24815,7 @@ CREATE TABLE `conveyor` ( PRIMARY KEY (`id`), KEY `conveyor_fk1_idx` (`typeFk`), CONSTRAINT `conveyor_fk1` FOREIGN KEY (`typeFk`) REFERENCES `conveyorType` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29436,11 +24827,11 @@ DROP TABLE IF EXISTS `conveyorBuildingClass`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `conveyorBuildingClass` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `description` varchar(255) DEFAULT NULL, `priority` int(11) NOT NULL DEFAULT 0, `weightThreshold` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tipo de caja para el montaje de pallets'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tipo de caja para el montaje de pallets'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29452,13 +24843,13 @@ DROP TABLE IF EXISTS `conveyorConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `conveyorConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `itemName` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `itemName` varchar(45) NOT NULL, `length` int(11) DEFAULT NULL, `width` int(11) DEFAULT NULL, `height` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `itemName_UNIQUE` (`itemName`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29482,7 +24873,7 @@ CREATE TABLE `conveyorExpedition` ( `isIn` tinyint(4) NOT NULL DEFAULT 0, `productionMinute` int(11) DEFAULT NULL, `isOut` tinyint(4) NOT NULL DEFAULT 0, - `truck` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + `truck` varchar(20) DEFAULT NULL, `criterion` int(11) DEFAULT NULL, `isHeavy` tinyint(1) NOT NULL DEFAULT 1, PRIMARY KEY (`expeditionFk`), @@ -29490,7 +24881,7 @@ CREATE TABLE `conveyorExpedition` ( KEY `conveyorExpedition_fk2_idx` (`conveyorBuildingClassFk`), CONSTRAINT `conveyorExpedition_fk1` FOREIGN KEY (`conveyorFk`) REFERENCES `conveyor` (`id`) ON UPDATE CASCADE, CONSTRAINT `conveyorExpedition_fk2` FOREIGN KEY (`conveyorBuildingClassFk`) REFERENCES `conveyorBuildingClass` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29501,12 +24892,12 @@ DROP TABLE IF EXISTS `conveyorMode`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `conveyorMode` ( - `code` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(20) NOT NULL, `saturacion` int(11) NOT NULL, `gap` int(11) NOT NULL, `isActive` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29518,10 +24909,10 @@ DROP TABLE IF EXISTS `conveyorType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `conveyorType` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `description` varchar(45) DEFAULT NULL, `color` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29532,11 +24923,11 @@ DROP TABLE IF EXISTS `corridor`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `corridor` ( - `code` varchar(1) COLLATE utf8_unicode_ci NOT NULL COMMENT 'letra que da nombre al pasillo', + `code` varchar(1) NOT NULL COMMENT 'letra que da nombre al pasillo', `isAscendent` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'TRUE cuando se prepara de menor a mayor, FALSE cuando es a la inversa', `prepOrder` int(10) unsigned NOT NULL COMMENT 'orden de preparacion de los pasillos', PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='establece el orden y sentido de preparacion de los pasillos del parking'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='establece el orden y sentido de preparacion de los pasillos del parking'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29548,9 +24939,9 @@ DROP TABLE IF EXISTS `country`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `country` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `country` varchar(25) COLLATE utf8_unicode_ci NOT NULL, + `country` varchar(25) NOT NULL, `CEE` tinyint(1) NOT NULL DEFAULT 1, - `code` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, + `code` varchar(2) DEFAULT NULL, `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 1, `politicalCountryFk` mediumint(8) unsigned NOT NULL COMMENT 'Pais Real(apaño por culpa del España Exento)', `geoFk` int(11) DEFAULT NULL, @@ -29564,9 +24955,12 @@ CREATE TABLE `country` ( KEY `currency_id_fk_idx` (`currencyFk`), KEY `country_Ix4` (`country`), KEY `continent_id_fk_idx` (`continentFk`), + KEY `country_FK_1` (`geoFk`), CONSTRAINT `continent_id_fk` FOREIGN KEY (`continentFk`) REFERENCES `continent` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `country_FK` FOREIGN KEY (`politicalCountryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, + CONSTRAINT `country_FK_1` FOREIGN KEY (`geoFk`) REFERENCES `zoneGeo` (`id`) ON UPDATE CASCADE, CONSTRAINT `currency_id_fk` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -29601,8 +24995,7 @@ DELIMITER ;; AFTER INSERT ON `country` FOR EACH ROW BEGIN - - UPDATE sage.Naciones + UPDATE sage.Naciones SET countryFk = NEW.id WHERE Nacion = NEW.country; @@ -29611,12 +25004,9 @@ BEGIN 'cau@verdnatura.es', NULL, 'Actualizar tabla sage.Naciones', - CONCAT('Se ha insertado un nuevo país en la tabla vn.conuntry. Para el correcto funcionamiento del sistema - de contabilidad es necesario actualizar la columna sage.Naciones.countryFk con el valor del nuevo país. - Hay que buscar el nuevo país: ', NEW.country, ' en la tabla sage.Naciones y actualizar el campo sage.Naciones.countryFk con el valor ', NEW.id) + CONCAT('Se ha insertado un nuevo país en la tabla vn.conuntry. Para el correcto funcionamiento del sistema \n\t\t\t\tde contabilidad es necesario actualizar la columna sage.Naciones.countryFk con el valor del nuevo país. \n\t\t\t Hay que buscar el nuevo país: ', NEW.country, ' en la tabla sage.Naciones y actualizar el campo sage.Naciones.countryFk con el valor ', NEW.id) ); END IF; - END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -29698,9 +25088,9 @@ DROP TABLE IF EXISTS `cplusCorrectingType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusCorrectingType` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29712,9 +25102,9 @@ DROP TABLE IF EXISTS `cplusInvoiceType472`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusInvoiceType472` ( `id` int(10) unsigned NOT NULL, - `description` varchar(255) CHARACTER SET utf8 NOT NULL, + `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='(*18) TIPO FACTURA (Asientos)SOPORTADO – DEDUCIBLE (472)'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='(*18) TIPO FACTURA (Asientos)SOPORTADO – DEDUCIBLE (472)'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29726,9 +25116,9 @@ DROP TABLE IF EXISTS `cplusInvoiceType477`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusInvoiceType477` ( `id` int(10) unsigned NOT NULL, - `description` varchar(255) CHARACTER SET utf8 NOT NULL, + `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='(*18) TIPO FACTURA (Asientos)REPERCUTIDO - DEVENGADO (477)'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='(*18) TIPO FACTURA (Asientos)REPERCUTIDO - DEVENGADO (477)'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29740,9 +25130,9 @@ DROP TABLE IF EXISTS `cplusRectificationType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusRectificationType` ( `id` int(10) unsigned NOT NULL, - `description` varchar(255) CHARACTER SET utf8 NOT NULL, + `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='(*20) TIPO RECTIFICATIVA (Asientos)'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='(*20) TIPO RECTIFICATIVA (Asientos)'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29754,9 +25144,9 @@ DROP TABLE IF EXISTS `cplusSubjectOp`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusSubjectOp` ( `id` int(10) unsigned NOT NULL, - `description` varchar(255) CHARACTER SET utf8 NOT NULL, + `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='(*17) TIPO OPERACIÓN SUJETA/NO SUJETA (Asientos)'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='(*17) TIPO OPERACIÓN SUJETA/NO SUJETA (Asientos)'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29768,9 +25158,9 @@ DROP TABLE IF EXISTS `cplusTaxBreak`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusTaxBreak` ( `id` int(10) unsigned NOT NULL, - `description` varchar(255) CHARACTER SET utf8 NOT NULL, + `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='(*16) TIPO EXENCIÓN (Asientos)'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='(*16) TIPO EXENCIÓN (Asientos)'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29782,9 +25172,9 @@ DROP TABLE IF EXISTS `cplusTerIdNif`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusTerIdNif` ( `id` int(11) NOT NULL, - `description` varchar(255) CHARACTER SET utf8 NOT NULL, + `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29796,9 +25186,9 @@ DROP TABLE IF EXISTS `cplusTrascendency472`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusTrascendency472` ( `id` int(10) unsigned NOT NULL, - `description` varchar(255) CHARACTER SET utf8 NOT NULL, + `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='(*15) CLAVE DE RÉGIMEN ESPECIAL O TRASCENDENCIA(Asientos)SOPORTADO – DEDUCIBLE (472)'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='(*15) CLAVE DE RÉGIMEN ESPECIAL O TRASCENDENCIA(Asientos)SOPORTADO – DEDUCIBLE (472)'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29810,9 +25200,9 @@ DROP TABLE IF EXISTS `cplusTrascendency477`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusTrascendency477` ( `id` int(10) unsigned NOT NULL, - `description` varchar(255) CHARACTER SET utf8 NOT NULL, + `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='(*15) CLAVE DE RÉGIMEN ESPECIAL O TRASCENDENCIA(Asientos) REPERCUTIDO - DEVENGADO (477)'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='(*15) CLAVE DE RÉGIMEN ESPECIAL O TRASCENDENCIA(Asientos) REPERCUTIDO - DEVENGADO (477)'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29831,7 +25221,7 @@ CREATE TABLE `creditClassification` ( KEY `creditClassifClientFk_idx` (`client`), KEY `creditClassifdateEnd_idx` (`dateEnd`), CONSTRAINT `creditClassifClientFk` FOREIGN KEY (`client`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -29873,14 +25263,39 @@ CREATE TABLE `creditInsurance` ( `credit` int(11) DEFAULT NULL, `creationDate` timestamp NOT NULL DEFAULT current_timestamp(), `grade` tinyint(1) DEFAULT NULL, + `creditClassificationFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `CreditInsurance_Fk1_idx` (`creditClassification`), - CONSTRAINT `CreditInsurance_Fk1` FOREIGN KEY (`creditClassification`) REFERENCES `creditClassification` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalla los clientes que tienen seguro de credito'; + KEY `creditInsurance_creditClassificationFk` (`creditClassificationFk`), + CONSTRAINT `CreditInsurance_Fk1` FOREIGN KEY (`creditClassification`) REFERENCES `creditClassification` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `creditInsurance_creditClassificationFk` FOREIGN KEY (`creditClassificationFk`) REFERENCES `creditClassification` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Detalla los clientes que tienen seguro de credito'; /*!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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_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`.`creditInsurance_beforeInsert` + BEFORE INSERT ON `creditInsurance` + FOR EACH ROW +BEGIN + IF NEW.creditClassificationFk THEN + SET NEW.creditClassification = NEW.creditClassificationFk; + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 */ ; @@ -29894,7 +25309,7 @@ BEGIN UPDATE `client` c JOIN vn.creditClassification cc ON cc.client = c.id SET creditInsurance = NEW.credit WHERE cc.id = NEW.creditClassification; - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -29911,12 +25326,12 @@ DROP TABLE IF EXISTS `currency`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `currency` ( `id` tinyint(3) unsigned NOT NULL, - `code` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `code` varchar(3) NOT NULL, + `name` varchar(45) DEFAULT NULL, `ratio` double NOT NULL DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `Moneda_UNIQUE` (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29928,11 +25343,11 @@ DROP TABLE IF EXISTS `customsAgent`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `customsAgent` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `fiscalName` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, - `street` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `nif` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, - `phone` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `email` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `fiscalName` varchar(50) NOT NULL, + `street` varchar(50) DEFAULT NULL, + `nif` varchar(50) NOT NULL, + `phone` varchar(16) DEFAULT NULL, + `email` varchar(150) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `nif_UNIQUE` (`nif`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; @@ -29952,7 +25367,7 @@ CREATE TABLE `dayMinute` ( PRIMARY KEY (`id`), KEY `dayMinute_ix1` (`hh`), KEY `dayMinute_ix2` (`mm`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='sirve de soporte para el calculo presencial de los trabjadores'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='sirve de soporte para el calculo presencial de los trabjadores'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29989,7 +25404,7 @@ CREATE TABLE `delivery` ( PRIMARY KEY (`id`), KEY `delivery_FK` (`addressFk`), CONSTRAINT `delivery_FK` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Informa de los datos geográficos y temporales de las entregas de los repartidores'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Informa de los datos geográficos y temporales de las entregas de los repartidores'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30001,11 +25416,11 @@ DROP TABLE IF EXISTS `deliveryMethod`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `deliveryMethod` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(45) DEFAULT NULL, + `code` varchar(45) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code` (`code`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30017,10 +25432,10 @@ DROP TABLE IF EXISTS `deliveryPoint`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `deliveryPoint` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `ubication` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `name` varchar(45) NOT NULL, + `ubication` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30031,18 +25446,18 @@ DROP TABLE IF EXISTS `delivery_zip`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `delivery_zip` ( - `postal_code` varchar(2) COLLATE utf8_unicode_ci NOT NULL, - `country_code` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, - `place_name` varchar(150) COLLATE utf8_unicode_ci NOT NULL, - `admin_name1` varchar(150) COLLATE utf8_unicode_ci NOT NULL, - `code_name1` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, - `admin_name2` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, - `code_name2` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, - `admin_name3` varchar(150) COLLATE utf8_unicode_ci NOT NULL, - `code_name3` varchar(5) COLLATE utf8_unicode_ci NOT NULL, - `latitude` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `longitude` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `accuracy` varchar(1) COLLATE utf8_unicode_ci NOT NULL, + `postal_code` varchar(2) NOT NULL, + `country_code` varchar(5) DEFAULT NULL, + `place_name` varchar(150) NOT NULL, + `admin_name1` varchar(150) NOT NULL, + `code_name1` varchar(150) DEFAULT NULL, + `admin_name2` varchar(150) DEFAULT NULL, + `code_name2` varchar(2) DEFAULT NULL, + `admin_name3` varchar(150) NOT NULL, + `code_name3` varchar(5) NOT NULL, + `latitude` varchar(10) NOT NULL, + `longitude` varchar(10) NOT NULL, + `accuracy` varchar(1) NOT NULL, `delivery_zipPK` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`delivery_zipPK`), KEY `country_code_idx` (`country_code`), @@ -30050,7 +25465,7 @@ CREATE TABLE `delivery_zip` ( KEY `postal_code_idx` (`postal_code`), KEY `admin_name3_idx` (`admin_name3`), KEY `admin_name2_idx` (`admin_name2`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30062,28 +25477,25 @@ DROP TABLE IF EXISTS `department`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `department` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(45) DEFAULT NULL, + `name` varchar(45) NOT NULL, `lft` int(11) DEFAULT NULL, `rgt` int(11) DEFAULT NULL, `workerFk` int(10) unsigned DEFAULT NULL COMMENT 'Id_Trabajador es el jefe del departamento', `companyFk` int(11) NOT NULL, - `bossFk__` int(11) DEFAULT NULL, - `x__` int(11) DEFAULT NULL, - `y__` int(11) DEFAULT NULL, `isProduction` tinyint(4) NOT NULL DEFAULT 0, `isSelected` tinyint(1) NOT NULL DEFAULT 0, `depth` int(11) NOT NULL DEFAULT 0, `sons` decimal(10,0) NOT NULL DEFAULT 0, - `parentFk` int(10) unsigned DEFAULT 1, - `path` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `chatName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `parentFk` int(11) DEFAULT 1, + `path` varchar(255) DEFAULT NULL, + `chatName` varchar(45) DEFAULT NULL, `isTeleworking` tinyint(1) DEFAULT 0, - `notificationEmail` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, - `hasToRefill` tinyint(1) DEFAULT '0' COMMENT 'Rellenar días sin fichadas presenciales', - `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', + `notificationEmail` varchar(150) DEFAULT NULL, + `hasToRefill` tinyint(1) DEFAULT 0 COMMENT 'Rellenar días sin fichadas presenciales', + `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`), @@ -30091,9 +25503,11 @@ CREATE TABLE `department` ( KEY `dep_org_ibfk_3_idx` (`companyFk`), KEY `lft_rgt_depth_idx` (`lft`,`rgt`,`depth`), KEY `department_FK` (`clientFk`), + KEY `department_FK_1` (`parentFk`), CONSTRAINT `department_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `department_FK_1` FOREIGN KEY (`parentFk`) REFERENCES `department` (`id`), CONSTRAINT `fk_department_Trabajadores1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -30140,22 +25554,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 ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER department_beforeDelete -BEFORE DELETE -ON department FOR EACH ROW +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`department_beforeDelete` + BEFORE DELETE ON `department` + FOR EACH ROW BEGIN - UPDATE postgresql.business_labour bl - JOIN vn.department d ON d.id = bl.department_id - SET bl.department_id = d.parentFk - WHERE bl.department_id = OLD.id; - + UPDATE vn.business b + JOIN vn.department d ON d.id = b.departmentFk + SET b.departmentFk = d.parentFk + WHERE b.departmentFk = OLD.id; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -30165,23 +25579,23 @@ 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 ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`department_afterDelete` AFTER DELETE ON `department` FOR EACH ROW BEGIN - + UPDATE vn.department_recalc SET isChanged = TRUE; - - UPDATE postgresql.business_labour bl - JOIN vn.department d ON d.id = bl.department_id - SET bl.department_id = d.parentFk - WHERE bl.department_id = OLD.id; + + UPDATE vn.business b + JOIN vn.department d ON d.id = b.departmentFk + SET b.departmentFk = d.parentFk + WHERE b.departmentFk = OLD.id; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -30214,7 +25628,7 @@ CREATE TABLE `department_recalc` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `isChanged` tinyint(4) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30226,13 +25640,13 @@ DROP TABLE IF EXISTS `device`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `device` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `sn` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `model` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `sn` varchar(50) DEFAULT NULL, + `model` varchar(50) DEFAULT NULL, `userFk` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `device_fk1_idx` (`userFk`), CONSTRAINT `device_fk1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30244,14 +25658,41 @@ DROP TABLE IF EXISTS `deviceLog`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `deviceLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `android_id` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `userFk` int(11) DEFAULT NULL, + `android_id` varchar(100) NOT NULL, + `userFk` int(10) unsigned DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), - `nameApp` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `versionApp` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + `nameApp` varchar(45) DEFAULT NULL, + `versionApp` varchar(45) DEFAULT NULL, + `deviceProductionFk` int(10) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `deviceLog_FK` (`userFk`), + CONSTRAINT `deviceLog_FK` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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`.`deviceLog_beforeInsert` +BEFORE INSERT +ON deviceLog FOR EACH ROW +BEGIN + DECLARE vDeviceProductionFk INTEGER; + SELECT dp.id INTO vDeviceProductionFk + FROM deviceProduction dp + WHERE dp.android_id = NEW.android_id; + SET NEW.deviceProductionFk = vDeviceProductionFk; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `deviceProduction` @@ -30262,24 +25703,67 @@ DROP TABLE IF EXISTS `deviceProduction`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `deviceProduction` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `imei` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `modelFk` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `macWifi` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `serialNumber` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `departmentFk` int(11) DEFAULT NULL, - `isOutOfService` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0: Ok - 1: No disponible - 2: Sat', - `android_id` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `imei` varchar(50) DEFAULT NULL, + `modelFk` varchar(50) NOT NULL, + `macWifi` varchar(45) DEFAULT NULL, + `serialNumber` varchar(45) DEFAULT NULL, + `android_id` varchar(50) DEFAULT NULL, `purchased` date NOT NULL DEFAULT '1900-01-01' COMMENT 'Fecha de compra', + `stateFk` varchar(50) DEFAULT 'idle', + `isInScalefusion` tinyint(1) DEFAULT 0 COMMENT 'Para saber si esta en Scalefusion', + `description` varchar(100) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `device_id_UNIQUE` (`id`), UNIQUE KEY `sn_UNIQUE` (`imei`), UNIQUE KEY `serial_number_UN` (`serialNumber`), KEY `deviceProductionModelsFgn` (`modelFk`), - KEY `departmentFgn` (`departmentFk`), - CONSTRAINT `departmentFgn` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `deviceProductionModelsFgn` FOREIGN KEY (`modelFk`) REFERENCES `deviceProductionModels` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + KEY `deviceProduction_FK` (`stateFk`), + CONSTRAINT `deviceProductionModelsFgn` FOREIGN KEY (`modelFk`) REFERENCES `deviceProductionModels` (`code`) ON UPDATE CASCADE, + CONSTRAINT `deviceProduction_FK` FOREIGN KEY (`stateFk`) REFERENCES `deviceProductionState` (`code`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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`.`deviceProduction_afterInsert` + AFTER INSERT + ON deviceProduction FOR EACH ROW +BEGIN + INSERT INTO deviceProductionLog (originFk, userFk, newInstance, action, changedModel, changedModelId) + VALUES(NEW.id, account.myUser_getId(), NEW.stateFk, 'INSERT', 'deviceProduction', NEW.id); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!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`.`deviceProduction_afterUpdate` + BEFORE UPDATE + ON vn.deviceProduction FOR EACH ROW +BEGIN + INSERT INTO deviceProductionLog (originFk, userFk, newInstance, oldInstance , action, changedModel, changedModelId) + VALUES(OLD.id, account.myUser_getId(), NEW.stateFk, OLD.stateFk , 'update', 'deviceProduction', 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 `deviceProductionConfig` @@ -30293,7 +25777,7 @@ CREATE TABLE `deviceProductionConfig` ( `isAllUsersallowed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Permite que cualquier usuario pueda loguearse', `isTractorHuntingMode` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Habilita el modo cazador para usuarios que no se han logeado un tractor para sacar', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -30309,7 +25793,7 @@ DELIMITER ;; FOR EACH ROW BEGIN IF NEW.isAllUsersAllowed = 1 OR NEW.isAllUsersAllowed = -1 THEN - SET @username := (SELECT account.userGetName()); + SET @username := (SELECT account.myUser_getName()); INSERT INTO vn.mail (receiver, subject, body) VALUES ('cau@verdnatura.es', 'Se ha activado la autenticación sin restricciones en la app', CONCAT('El usuario ', @username,' ha habilitado la opción para que todos los usuarios puedan acceder a la app sin restricciones')); @@ -30321,6 +25805,28 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `deviceProductionLog` +-- + +DROP TABLE IF EXISTS `deviceProductionLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `deviceProductionLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `originFk` int(11) NOT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + `deviceProduction` int(10) unsigned NOT NULL, + `action` set('insert','update','delete','retired') NOT NULL, + `created` timestamp NULL DEFAULT current_timestamp(), + `oldInstance` varchar(50) DEFAULT NULL, + `newInstance` varchar(50) DEFAULT NULL, + `changedModel` varchar(50) DEFAULT NULL, + `changedModelId` int(11) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `deviceProductionModels` -- @@ -30329,9 +25835,23 @@ DROP TABLE IF EXISTS `deviceProductionModels`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `deviceProductionModels` ( - `code` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(50) NOT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `deviceProductionState` +-- + +DROP TABLE IF EXISTS `deviceProductionState`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `deviceProductionState` ( + `code` varchar(50) NOT NULL, + `description` varchar(50) NOT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30344,12 +25864,43 @@ DROP TABLE IF EXISTS `deviceProductionUser`; CREATE TABLE `deviceProductionUser` ( `deviceProductionFk` int(11) NOT NULL, `userFk` int(10) unsigned NOT NULL, - PRIMARY KEY (`deviceProductionFk`,`userFk`), + `created` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`deviceProductionFk`), + UNIQUE KEY `deviceProductionUser_UN` (`userFk`), KEY `userFgn_idx` (`userFk`), - CONSTRAINT `deviceProductionFgn` FOREIGN KEY (`deviceProductionFk`) REFERENCES `deviceProduction` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `userFgn` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + CONSTRAINT `deviceProductionUser_FK` FOREIGN KEY (`deviceProductionFk`) REFERENCES `deviceProduction` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `deviceProductionUser_PK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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`.`deviceProductionUser_afterDelete` + AFTER DELETE + ON deviceProductionUser FOR EACH ROW +BEGIN + INSERT INTO deviceProductionLog (originFk, userFk, oldInstance, action, changedModel, changedModelId) + SELECT + OLD.deviceProductionFk, + account.myUser_getId(), + stateFk, + 'DELETE', + 'deviceProductionUser', + OLD.deviceProductionFk + FROM deviceProduction + WHERE id = OLD.deviceProductionFk; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `disabilityGrade` @@ -30360,9 +25911,9 @@ DROP TABLE IF EXISTS `disabilityGrade`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `disabilityGrade` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Grados de discapacidad Modelo 145 IRPF', - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30375,12 +25926,12 @@ DROP TABLE IF EXISTS `dms`; CREATE TABLE `dms` ( `id` int(11) NOT NULL AUTO_INCREMENT, `dmsTypeFk` int(11) NOT NULL DEFAULT 1, - `reference` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `description` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, + `reference` varchar(50) DEFAULT NULL, + `description` varchar(200) DEFAULT NULL, `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, `hardCopyNumber` mediumint(8) unsigned DEFAULT NULL, - `contentType` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, - `file` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, + `contentType` varchar(150) DEFAULT NULL, + `file` varchar(30) DEFAULT NULL, `hasFile` tinyint(4) NOT NULL DEFAULT 0, `workerFk` int(10) unsigned DEFAULT NULL, `created` timestamp NULL DEFAULT current_timestamp(), @@ -30395,7 +25946,7 @@ CREATE TABLE `dms` ( CONSTRAINT `dms_dmsTypeFk` FOREIGN KEY (`dmsTypeFk`) REFERENCES `dmsType` (`id`) ON UPDATE CASCADE, CONSTRAINT `dms_warehouseFk` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `dms_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='document managment system'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='document managment system'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -30412,20 +25963,20 @@ DELIMITER ;; BEGIN DECLARE vHardCopyNumber INT; DECLARE vDmsTypeCode INT; - + IF (SELECT NOT hasDms FROM warehouse WHERE id = NEW.warehouseFk) THEN CALL util.throw('this warehouse has not dms'); END IF; IF NEW.hasFile THEN - SELECT 1 + MAX(hardCopyNumber) INTO vHardCopyNumber - FROM dms + SELECT 1 + MAX(hardCopyNumber) INTO vHardCopyNumber + FROM dms WHERE warehouseFk = NEW.warehouseFk; - + SET NEW.hardCopyNumber = IFNULL(vHardCopyNumber,1); END IF; - - SELECT code INTO vDmsTypeCode + + SELECT code INTO vDmsTypeCode FROM dmsType WHERE NEW.dmsTypeFk = id; IF (vDmsTypeCode ='ticket') THEN UPDATE ticket SET isSigned = 1 WHERE id = NEW.reference; @@ -30439,9 +25990,9 @@ 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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -30450,24 +26001,24 @@ DELIMITER ;; FOR EACH ROW BEGIN DECLARE vHardCopyNumber INT; - + IF (NEW.hasFile <> 0) AND (OLD.hasFile = 0) AND (NEW.hardCopyNumber IS NULL) - OR + OR (NEW.hardCopyNumber = OLD.hardCopyNumber AND OLD.warehouseFk <> NEW.warehouseFk) THEN - - IF (SELECT NOT hasDms FROM warehouse WHERE id = 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 + + 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 */;; @@ -30476,6 +26027,34 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!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`.`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 ; +/*!50003 SET sql_mode = @saved_sql_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 `dmsRecover` @@ -30487,12 +26066,12 @@ DROP TABLE IF EXISTS `dmsRecover`; CREATE TABLE `dmsRecover` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` int(11) DEFAULT NULL, - `sign` text COLLATE utf8_unicode_ci DEFAULT NULL, + `sign` text DEFAULT NULL, `created` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `ticketFk_idx` (`ticketFk`), CONSTRAINT `ticketFk` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30504,17 +26083,18 @@ DROP TABLE IF EXISTS `dmsType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `dmsType` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `path` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(45) NOT NULL, + `path` varchar(255) NOT NULL, `writeRoleFk` int(10) unsigned DEFAULT NULL, `readRoleFk` int(10) unsigned DEFAULT NULL, - `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(45) NOT NULL, + `monthToDelete` int(10) unsigned DEFAULT NULL COMMENT 'Meses en el pasado para ir borrando registros, dejar a null para no borrarlos nunca', PRIMARY KEY (`id`), KEY `readRoleFk` (`readRoleFk`), KEY `writeRoleFk` (`writeRoleFk`), CONSTRAINT `readRoleFk` FOREIGN KEY (`readRoleFk`) REFERENCES `account`.`role` (`id`), CONSTRAINT `writeRoleFk` FOREIGN KEY (`writeRoleFk`) REFERENCES `account`.`role` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30525,10 +26105,10 @@ DROP TABLE IF EXISTS `dock`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `dock` ( - `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `description` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `code` varchar(10) NOT NULL DEFAULT '', + `description` varchar(50) DEFAULT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Se utiliza para el panel de grafana: https://grafana.verdnatura.es/d/w9w3Uo-7z/'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */; -- @@ -30540,12 +26120,13 @@ DROP TABLE IF EXISTS `docuware`; /*!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, + `code` varchar(50) NOT NULL, + `fileCabinetName` varchar(50) NOT NULL, + `action` varchar(255) NOT NULL, + `dialogName` varchar(100) NOT NULL, + `findById` varchar(50) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30557,10 +26138,10 @@ DROP TABLE IF EXISTS `docuwareConfig`; /*!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, + `url` varchar(75) DEFAULT NULL, + `cookie` varchar(1000) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30572,7 +26153,7 @@ DROP TABLE IF EXISTS `dua`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `dua` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `code` varchar(45) DEFAULT NULL, `awbFk` smallint(11) unsigned NOT NULL, `issued` date DEFAULT NULL, `operated` date DEFAULT NULL, @@ -30590,7 +26171,7 @@ CREATE TABLE `dua` ( CONSTRAINT `dua_fk1` FOREIGN KEY (`gestdocFk`) REFERENCES `dms` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `dua_fk2` FOREIGN KEY (`awbFk`) REFERENCES `awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `dua_fk4` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30611,7 +26192,7 @@ CREATE TABLE `duaEntry` ( KEY `fk_duaEntry_Entradas1_idx` (`entryFk`), CONSTRAINT `fk_duaEntry_Entradas1` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_duaEntry_dua1` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30631,7 +26212,7 @@ CREATE TABLE `duaIntrastat` ( KEY `duaIntrastat_fk2_idx` (`duaFk`), CONSTRAINT `duaIntrastat_fk1` FOREIGN KEY (`intrastatFk`) REFERENCES `intrastat` (`id`) ON UPDATE CASCADE, CONSTRAINT `duaIntrastat_fk2` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30651,7 +26232,7 @@ CREATE TABLE `duaInvoiceIn` ( KEY `duaInvoiceIn_fk2_idx` (`invoiceInFk`), CONSTRAINT `duaInvoiceIn_fk1` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `duaInvoiceIn_fk2` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Facturas asociadas a la declaración aduanera, básicamente la del agente transitario'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Facturas asociadas a la declaración aduanera, básicamente la del agente transitario'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30676,7 +26257,7 @@ CREATE TABLE `duaTax` ( CONSTRAINT `duaTax_fk1` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `duaTax_fk2` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `duaTax_fk3` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -30765,9 +26346,9 @@ DROP TABLE IF EXISTS `educationLevel`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `educationLevel` ( `id` smallint(6) NOT NULL, - `name` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, + `name` varchar(200) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Nivel de formación mismo de a3'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Nivel de formación mismo de a3'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30782,19 +26363,61 @@ CREATE TABLE `ektEntryAssign` ( `kop` int(11) DEFAULT NULL, `sub` mediumint(8) unsigned DEFAULT NULL, `pro` mediumint(8) unsigned DEFAULT NULL, - `warehouseOutFk` int(11) DEFAULT NULL, - `warehouseInFk` int(11) DEFAULT NULL, - `agencyModeFk` int(11) DEFAULT NULL, - `supplierFk` int(11) DEFAULT NULL, + `auction` int(11) DEFAULT NULL, + `warehouseOutFk` int(11) NOT NULL, + `warehouseInFk` int(11) NOT NULL, + `agencyModeFk` int(11) NOT NULL, + `supplierFk` int(11) NOT NULL, `entryFk` int(11) DEFAULT NULL, - `ref` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `ref` varchar(45) DEFAULT NULL, `addressFk` int(11) DEFAULT NULL, + `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, PRIMARY KEY (`id`), UNIQUE KEY `ektEntryAssign_ix1` (`kop`,`sub`,`pro`), KEY `ektEntryAssign_FK` (`addressFk`), CONSTRAINT `ektEntryAssign_FK` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='define las condiciones para asignar entradas a los ekt'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='define las condiciones para asignar entradas a los ekt'; /*!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 ektEntryAssign_afterInsert +AFTER INSERT +ON ektEntryAssign FOR EACH ROW + UPDATE entry SET reference = NEW.`ref` WHERE id = NEW.entryFk */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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.ektEntryAssign_afterUpdate + AFTER UPDATE ON ektEntryAssign + FOR EACH ROW +BEGIN + IF NOT(NEW.`ref` <=> OLD.`ref`) OR NOT(NEW.`entryFk` <=> OLD.`entryFk`) THEN + UPDATE entry SET reference = NEW.`ref` WHERE id = NEW.entryFk; + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `ektSubAddress` @@ -30821,10 +26444,10 @@ DROP TABLE IF EXISTS `emergencyMedia`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `emergencyMedia` ( `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 emergency phones', + `name` varchar(45) DEFAULT NULL, + `value` varchar(45) DEFAULT NULL COMMENT 'Table to save all emergency phones', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30836,10 +26459,10 @@ DROP TABLE IF EXISTS `energyInput`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `energyInput` ( `input` int(11) NOT NULL COMMENT 'The input number', - `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(255) NOT NULL, `consumption` int(11) NOT NULL COMMENT 'Consumption in watts', PRIMARY KEY (`input`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Defines inputs and the power of each one'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Defines inputs and the power of each one'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30855,7 +26478,7 @@ CREATE TABLE `energyMeter` ( `activeTime` int(11) NOT NULL COMMENT 'Number of seconds active', `consumption` decimal(10,2) NOT NULL COMMENT 'Comsumption in watts', PRIMARY KEY (`input`,`period`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='History of consumption of each input with one hour intervals'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='History of consumption of each input with one hour intervals'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30869,16 +26492,16 @@ CREATE TABLE `entry` ( `id` int(11) NOT NULL AUTO_INCREMENT, `supplierFk` int(11) NOT NULL DEFAULT 644, `dated` datetime NOT NULL, - `ref` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `invoiceNumber` varchar(50) DEFAULT NULL, `isBooked` tinyint(1) NOT NULL DEFAULT 0, - `isInventory` tinyint(1) NOT NULL DEFAULT 0, - `notes` longtext COLLATE utf8_unicode_ci DEFAULT NULL, + `isExcludedFromAvailable` tinyint(1) NOT NULL DEFAULT 0, + `notes` longtext DEFAULT NULL, `isConfirmed` tinyint(1) NOT NULL DEFAULT 0, `isOrdered` tinyint(1) NOT NULL DEFAULT 0, `isRaid` tinyint(1) NOT NULL DEFAULT 0, `commission` float DEFAULT 0, `created` timestamp NOT NULL DEFAULT current_timestamp(), - `evaNotes` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `evaNotes` varchar(45) DEFAULT NULL, `travelFk` int(11) unsigned DEFAULT NULL, `currencyFk` tinyint(3) unsigned DEFAULT 1, `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, @@ -30889,6 +26512,13 @@ CREATE TABLE `entry` ( `kop` int(11) DEFAULT NULL, `sub` mediumint(8) unsigned DEFAULT NULL, `pro` mediumint(8) unsigned DEFAULT NULL, + `auction` int(11) DEFAULT NULL, + `invoiceAmount` decimal(10,2) DEFAULT NULL, + `buyerFk` int(10) unsigned DEFAULT NULL, + `typeFk` varchar(100) DEFAULT NULL COMMENT 'Tipo de entrada', + `reference` varchar(50) DEFAULT NULL COMMENT 'Referencia para eti', + `ref` varchar(50) GENERATED ALWAYS AS (`invoiceNumber`) VIRTUAL COMMENT 'Columna virtual provisional para Salix', + `observationEditorFk` INT(10) unsigned NULL COMMENT 'Último usuario que ha modificado el campo evaNotes', PRIMARY KEY (`id`), KEY `Id_Proveedor` (`supplierFk`), KEY `Fecha` (`dated`), @@ -30896,11 +26526,16 @@ CREATE TABLE `entry` ( KEY `empresa_id` (`companyFk`), KEY `gestdoc_id` (`gestDocFk`), KEY `recibida_id` (`invoiceInFk`), + KEY `entry_FK` (`buyerFk`), + KEY `entry_FK_1` (`typeFk`), CONSTRAINT `Entradas_fk8` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `entry_FK` FOREIGN KEY (`buyerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `entry_FK_1` FOREIGN KEY (`typeFk`) REFERENCES `entryType` (`code`) ON UPDATE CASCADE, CONSTRAINT `entry_ibfk_1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `entry_ibfk_6` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`) ON UPDATE CASCADE, - CONSTRAINT `entry_ibfk_7` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee'; + CONSTRAINT `entry_ibfk_7` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `entry_observationEditorFk` FOREIGN KEY (`observationEditorFk`) REFERENCES `account`.`user`(`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -30915,6 +26550,7 @@ DELIMITER ;; BEFORE INSERT ON `entry` FOR EACH ROW BEGIN + CALL supplier_checkIsActive(NEW.supplierFk); SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk); SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk); END */;; @@ -30935,7 +26571,7 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`entry_afterInsert` AFTER INSERT ON `entry` FOR EACH ROW -BEGIN +BEGIN CALL travel_requestRecalc(NEW.travelFk); END */;; DELIMITER ; @@ -30975,7 +26611,7 @@ BEGIN SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'A cloned entry cannot be moved to a travel with different warehouses'; END IF; - + IF NEW.travelFk IS NULL THEN SELECT COUNT(*) INTO vPrintedCount FROM buy @@ -30990,11 +26626,12 @@ BEGIN END IF; IF !(NEW.supplierFk <=> OLD.supplierFk) THEN + CALL supplier_checkIsActive(NEW.supplierFk); SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk); END IF; IF !(NEW.travelFk <=> OLD.travelFk) - OR !(NEW.currencyFk <=> OLD.currencyFk) THEN + OR !(NEW.currencyFk <=> OLD.currencyFk) THEN SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk); END IF; @@ -31029,11 +26666,21 @@ BEGIN OR !(NEW.isRaid <=> OLD.isRaid) THEN CALL stock.log_add('entry', NEW.id, OLD.id); END IF; - + IF !(NEW.travelFk <=> OLD.travelFk) THEN CALL travel_requestRecalc(OLD.travelFk); CALL travel_requestRecalc(NEW.travelFk); END IF; + + IF NOT (NEW.invoiceAmount <=> OLD.invoiceAmount) THEN + INSERT INTO vn.entryLog SET + `action` = 'update', + userFk = account.myUser_getId(), + originFk = NEW.id, + changedModel = 'Entry', + oldInstance = CONCAT('{"old invoiceAmount":', OLD.invoiceAmount, '}'), + newInstance = CONCAT('{"new invoiceAmount":', NEW.invoiceAmount, '}'); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31072,7 +26719,7 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`entry_afterDelete` AFTER DELETE ON `entry` FOR EACH ROW -BEGIN +BEGIN CALL travel_requestRecalc(OLD.travelFk); END */;; DELIMITER ; @@ -31090,33 +26737,12 @@ 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, + `mailToNotify` varchar(255) DEFAULT NULL, + `inventorySupplierFk` int(11) DEFAULT 4, PRIMARY KEY (`defaultEntry`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `entryList` --- - -DROP TABLE IF EXISTS `entryList`; -/*!50001 DROP VIEW IF EXISTS `entryList`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `entryList` ( - `entryFk` tinyint NOT NULL, - `isHere` tinyint NOT NULL, - `landed` tinyint NOT NULL, - `supplier` tinyint NOT NULL, - `entryRef` tinyint NOT NULL, - `agency` tinyint NOT NULL, - `travelRef` tinyint NOT NULL, - `appointment` tinyint NOT NULL, - `supplierFk` tinyint NOT NULL, - `warehouseInFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `entryLog` -- @@ -31128,20 +26754,20 @@ CREATE TABLE `entryLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `originFk` int(11) NOT NULL, `userFk` int(10) unsigned NOT NULL, - `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), - `description` text CHARACTER SET utf8 DEFAULT NULL, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, - `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` varchar(45) DEFAULT NULL, + `oldInstance` text DEFAULT NULL, + `newInstance` text DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), KEY `logEntry_ibfk_1` (`originFk`), KEY `entryLog_ibfk_2` (`userFk`), CONSTRAINT `entryLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `entryLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31155,30 +26781,27 @@ CREATE TABLE `entryObservation` ( `id` int(11) NOT NULL AUTO_INCREMENT, `entryFk` int(11) NOT NULL, `observationTypeFk` tinyint(3) unsigned DEFAULT NULL, - `description` text COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `entryFk_observationTypeFk_UNIQUE` (`entryFk`,`observationTypeFk`), KEY `observationType_id_observationTypeFk` (`observationTypeFk`), CONSTRAINT `entry_id_entryFk` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`), CONSTRAINT `observationType_id_observationTypeFk` FOREIGN KEY (`observationTypeFk`) REFERENCES `observationType` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `entrySplit__` +-- Table structure for table `entryType` -- -DROP TABLE IF EXISTS `entrySplit__`; +DROP TABLE IF EXISTS `entryType`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `entrySplit__` ( - `receivedFk` int(11) NOT NULL, - `delayedFk` int(11) NOT NULL, - PRIMARY KEY (`receivedFk`,`delayedFk`), - KEY `entrySplit_fk2_idx` (`delayedFk`), - CONSTRAINT `entrySplit_fk1` FOREIGN KEY (`receivedFk`) REFERENCES `entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `entrySplit_fk2` FOREIGN KEY (`delayedFk`) REFERENCES `entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TABLE `entryType` ( + `code` varchar(100) NOT NULL, + `description` varchar(100) NOT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31192,7 +26815,7 @@ CREATE TABLE `entryVirtual` ( `entryFk` int(11) NOT NULL, PRIMARY KEY (`entryFk`), CONSTRAINT `entryVirtual_ibfk_1` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='entradas que se van moviendo automaticamente al futuro'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='entradas que se van moviendo automaticamente al futuro'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31203,33 +26826,13 @@ DROP TABLE IF EXISTS `envialiaAgency`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `envialiaAgency` ( - `id` varchar(6) COLLATE utf8_unicode_ci NOT NULL, - `route` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `agencyName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `id` varchar(6) NOT NULL, + `route` varchar(3) DEFAULT NULL, + `agencyName` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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`.`envialiaAgency_bd` - BEFORE DELETE ON `envialiaAgency` - FOR EACH ROW -BEGIN - CALL util.debugAdd("envialiaAgency", 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 `envialiaCity` @@ -31240,34 +26843,14 @@ DROP TABLE IF EXISTS `envialiaCity`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `envialiaCity` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `city` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `postalCode` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `agencyFk` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `city` varchar(255) NOT NULL, + `postalCode` varchar(255) NOT NULL, + `agencyFk` varchar(45) NOT NULL, PRIMARY KEY (`id`), KEY `agencyFk` (`agencyFk`), KEY `postalCode` (`postalCode`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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`.`envialiaCity_bd` - BEFORE DELETE ON `envialiaCity` - FOR EACH ROW -BEGIN - CALL util.debugAdd("envialiaCity", 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 `envialiaConfig` @@ -31277,16 +26860,16 @@ DROP TABLE IF EXISTS `envialiaConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `envialiaConfig` ( - `serviceType` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT '024' COMMENT 'Tipo de servicio en horas. 024 -> servicio las 24h', - `numBox` varchar(3) COLLATE utf8_unicode_ci DEFAULT '001' COMMENT 'cajas por envio', + `serviceType` varchar(3) NOT NULL DEFAULT '024' COMMENT 'Tipo de servicio en horas. 024 -> servicio las 24h', + `numBox` varchar(3) DEFAULT '001' COMMENT 'cajas por envio', `startRange` bigint(25) DEFAULT NULL COMMENT 'Principio del rango que nos proporciona enviaría', `endRange` bigint(25) DEFAULT NULL COMMENT 'limite del rango que nos proporciona enviaría', - `cargoAgency` varchar(25) COLLATE utf8_unicode_ci DEFAULT '004666' COMMENT 'numero de verdnatura dado por enviaría', + `cargoAgency` varchar(25) DEFAULT '004666' COMMENT 'numero de verdnatura dado por enviaría', `actualNumber` bigint(25) DEFAULT NULL COMMENT 'Numero actual de etiquetas imprimidas , comprimido entre startRange y endRange, ', `isAlreadyNotified` int(1) NOT NULL DEFAULT 0 COMMENT 'Booleano para que el evento vn.envialiaRangeChecker compruebe si se a enviado una notificación\n', `notificationThrehold` int(11) DEFAULT NULL COMMENT 'Umbral para avisar a enviaría de reseetar el startRange y endRange\nSe avisara a enviaría si el umbral + el actualNumber es superior a endRange\n', PRIMARY KEY (`serviceType`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31298,11 +26881,11 @@ DROP TABLE IF EXISTS `errorLogApp`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `errorLogApp` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `error` varchar(55) COLLATE utf8_unicode_ci DEFAULT NULL, + `error` varchar(55) DEFAULT NULL, `date` datetime DEFAULT NULL, `workerFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Guarda un registro de errores e la app de almacén'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Guarda un registro de errores e la app de almacén'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31315,42 +26898,19 @@ DROP TABLE IF EXISTS `errorProduction`; CREATE TABLE `errorProduction` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userFk` int(11) DEFAULT NULL, - `firstname` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `lastname` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `rol` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `firstname` varchar(100) DEFAULT NULL, + `lastname` varchar(100) DEFAULT NULL, + `rol` varchar(100) DEFAULT NULL, `ticketNumber` int(11) DEFAULT NULL, `lineNumber` int(11) DEFAULT NULL, `error` int(11) DEFAULT NULL, `volume` double DEFAULT NULL, - `hourStart` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `hourEnd` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `hourWorked` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `hourStart` varchar(100) DEFAULT NULL, + `hourEnd` varchar(100) DEFAULT NULL, + `hourWorked` varchar(100) DEFAULT NULL, `dated` date 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 `errorProduction__` --- - -DROP TABLE IF EXISTS `errorProduction__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `errorProduction__` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `userFk` int(11) DEFAULT NULL, - `firstname` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `lastname` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `rol` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `ticketNumber` int(11) DEFAULT NULL, - `error` int(11) DEFAULT NULL, - `ratio` double DEFAULT NULL, - `volume` double DEFAULT NULL, - `month` int(11) DEFAULT NULL, - `year` int(11) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31374,7 +26934,7 @@ CREATE TABLE `erte` ( `saturday` tinyint(1) DEFAULT NULL, `sunday` tinyint(1) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31392,6 +26952,21 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Temporary table structure for view `exchangeInsuranceIn` +-- + +DROP TABLE IF EXISTS `exchangeInsuranceIn`; +/*!50001 DROP VIEW IF EXISTS `exchangeInsuranceIn`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `exchangeInsuranceIn` ( + `dated` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `rate` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `exchangeInsuranceOut` -- @@ -31407,6 +26982,25 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Temporary table structure for view `exchangeReportSourcePrevious` +-- + +DROP TABLE IF EXISTS `exchangeReportSourcePrevious`; +/*!50001 DROP VIEW IF EXISTS `exchangeReportSourcePrevious`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `exchangeReportSourcePrevious` ( + `dated` tinyint NOT NULL, + `amountIn` tinyint NOT NULL, + `rateIn` tinyint NOT NULL, + `amountOut` tinyint NOT NULL, + `rateOut` tinyint NOT NULL, + `amountEntry` tinyint NOT NULL, + `rateEntry` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `excuse` -- @@ -31416,10 +27010,10 @@ DROP TABLE IF EXISTS `excuse`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `excuse` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `txt` varchar(255) CHARACTER SET latin1 NOT NULL, + `txt` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL, `date` datetime NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31433,22 +27027,21 @@ CREATE TABLE `expedition` ( `id` int(11) NOT NULL AUTO_INCREMENT, `agencyModeFk` int(11) NOT NULL, `ticketFk` int(10) NOT NULL, - `isBox` int(11) DEFAULT 1 COMMENT 'Este campo realmente en un campo itemFk, haciendo referencia al artículo que nos va a facturar el proveedor de transporte.\nSe debería llamar freightItemFk', + `freightItemFk` int(11) DEFAULT 1 COMMENT 'itemFk del artículo que nos va a facturar el proveedor de transporte.', `created` timestamp NULL DEFAULT current_timestamp(), - `isRefund` bit(1) DEFAULT b'0', - `isPickUp` bit(1) DEFAULT b'0', - `itemFk` int(11) DEFAULT NULL COMMENT 'Este campo hace referencia al artículo que habria que facturar si las cajas no fueran incluidos.\\nSe debería llamar packageItemFk', + `itemFk__` int(11) DEFAULT NULL COMMENT 'Si es necesario el itemFk del cubo, se obtiene mediante packagingFk, join packing.itemFk', `counter` smallint(5) unsigned NOT NULL, - `checked` tinyint(4) NOT NULL DEFAULT 0, `workerFk` int(10) unsigned DEFAULT NULL, - `externalId` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, - `packagingFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `itemPackingTypeFk` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `hostFk` varchar(6) COLLATE utf8_unicode_ci NOT NULL, + `externalId` varchar(20) DEFAULT NULL, + `packagingFk` varchar(10) DEFAULT NULL, + `itemPackingTypeFk` varchar(1) DEFAULT NULL, + `hostFk` varchar(6) NOT NULL, `stateTypeFk` int(11) DEFAULT NULL COMMENT 'Ultimo estado de la expedicion', + `hasNewRoute` bit(1) NOT NULL DEFAULT b'0', + `isBox` int(11) GENERATED ALWAYS AS (`freightItemFk`) VIRTUAL COMMENT 'Columna virtual provisional para Salix', PRIMARY KEY (`id`), KEY `index1` (`agencyModeFk`), - KEY `index2` (`isBox`), + KEY `index2` (`freightItemFk`), KEY `index3` (`created`), KEY `index4` (`ticketFk`), KEY `expedition_fk3_idx` (`packagingFk`), @@ -31461,7 +27054,7 @@ CREATE TABLE `expedition` ( CONSTRAINT `expedition_fk3` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE, CONSTRAINT `expedition_ibfk_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`), CONSTRAINT `expedition_itemPackingTypeFk` FOREIGN KEY (`itemPackingTypeFk`) REFERENCES `itemPackingType` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -31476,34 +27069,24 @@ DELIMITER ;; BEFORE INSERT ON `expedition` FOR EACH ROW BEGIN - DECLARE intcounter INT; - DECLARE vShipFk INT; - IF NEW.isBox > 0 THEN + IF NEW.freightItemFk IS NOT NULL THEN UPDATE ticket SET packages = nz(packages) + 1 WHERE id = NEW.ticketFk; - SELECT IFNULL(MAX(counter),0) +1 INTO intcounter - FROM expedition e - INNER JOIN ticket t1 ON e.ticketFk = t1.id + SELECT IFNULL(MAX(counter),0) +1 INTO intcounter + FROM expedition e + INNER JOIN ticket t1 ON e.ticketFk = t1.id LEFT JOIN ticketState ts ON ts.ticket = t1.id - INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped) + INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped) AND t1.warehouseFk = t2.warehouseFk - WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk + WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk AND t1.agencyModeFk = t2.agencyModeFk; SET NEW.`counter` = intcounter; END IF; - -/* - SELECT shipFk INTO vShipFk FROM stowaway WHERE id = NEW.ticketFk; - - IF vShipFk THEN - CALL stowaway_unboarding(vShipFk, NEW.ticketFk); - END IF; -*/ END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31524,9 +27107,9 @@ DELIMITER ;; FOR EACH ROW BEGIN IF NEW.counter <> OLD.counter THEN - IF (SELECT COUNT(*) FROM expedition e + IF (SELECT COUNT(*) FROM expedition e INNER JOIN ticket t1 ON e.ticketFk = t1.id - INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped) + INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped) WHERE t1.id = NEW.ticketFk AND counter = NEW.counter) > 0 THEN SET NEW.id = NULL; END IF; @@ -31550,11 +27133,11 @@ DELIMITER ;; BEFORE DELETE ON `expedition` FOR EACH ROW BEGIN - UPDATE ticket t - SET packages = (SELECT COUNT(counter)-1 - FROM expedition e WHERE e.ticketFk = OLD.ticketFk and e.isBox) - WHERE t.id = OLD.ticketFk; - + UPDATE ticket t + SET packages = (SELECT COUNT(counter)-1 + FROM expedition e WHERE e.ticketFk = OLD.ticketFk and e.freightItemFk) + WHERE t.id = OLD.ticketFk; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31573,8 +27156,9 @@ CREATE TABLE `expeditionBoxVol` ( `boxFk` int(11) NOT NULL, `m3` double NOT NULL, `ratio` double NOT NULL, - PRIMARY KEY (`boxFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Establece el volumen de cada servicio para poder comparar el teorico y el real en el control de portes'; + PRIMARY KEY (`boxFk`), + CONSTRAINT `expeditionBoxVol_FK` FOREIGN KEY (`boxFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Establece el volumen de cada servicio para poder comparar el teorico y el real en el control de portes'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31600,6 +27184,41 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `expeditionMistake` +-- + +DROP TABLE IF EXISTS `expeditionMistake`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `expeditionMistake` ( + `expeditionFk` int(11) NOT NULL, + `workerFk` int(10) unsigned NOT NULL COMMENT 'Quien marca el error', + `typeFk` varchar(15) NOT NULL, + `created` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`expeditionFk`), + KEY `expeditionMistake_FK_1` (`workerFk`), + KEY `expeditionMistake_FK_2` (`typeFk`), + CONSTRAINT `expeditionMistake_FK` FOREIGN KEY (`expeditionFk`) REFERENCES `expedition` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `expeditionMistake_FK_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `expeditionMistake_FK_2` FOREIGN KEY (`typeFk`) REFERENCES `expeditionMistakeType` (`code`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Errores de encajadores'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `expeditionMistakeType` +-- + +DROP TABLE IF EXISTS `expeditionMistakeType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `expeditionMistakeType` ( + `code` varchar(15) NOT NULL, + `description` varchar(45) NOT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `expeditionPallet` -- @@ -31616,7 +27235,7 @@ CREATE TABLE `expeditionPallet` ( PRIMARY KEY (`id`), KEY `expeditionPallet_fk1_idx` (`truckFk`), CONSTRAINT `expeditionPallet_fk1` FOREIGN KEY (`truckFk`) REFERENCES `expeditionTruck` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -31633,13 +27252,13 @@ DELIMITER ;; BEGIN DECLARE vNewPosition INT; - + SELECT MAX(position) + 1 INTO vNewPosition FROM vn.expeditionPallet WHERE truckFk = NEW.truckFk; - + SET NEW.position = IFNULL(vNewPosition,1); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31647,6 +27266,26 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Temporary table structure for view `expeditionPallet_Print` +-- + +DROP TABLE IF EXISTS `expeditionPallet_Print`; +/*!50001 DROP VIEW IF EXISTS `expeditionPallet_Print`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `expeditionPallet_Print` ( + `truck` tinyint NOT NULL, + `routeFk` tinyint NOT NULL, + `zone` tinyint NOT NULL, + `eti` tinyint NOT NULL, + `palletFk` tinyint NOT NULL, + `isMatch` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `nombreDia` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `expeditionRoute_Monitor` -- @@ -31704,7 +27343,7 @@ CREATE TABLE `expeditionScan` ( CONSTRAINT `expeditionScan_fk1` FOREIGN KEY (`expeditionFk`) REFERENCES `expedition` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `expeditionScan_fk2` FOREIGN KEY (`palletFk`) REFERENCES `expeditionPallet` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `expeditionScan_fk3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -31721,7 +27360,7 @@ DELIMITER ;; BEGIN SET NEW.workerFk = vn.getUser(); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31768,14 +27407,14 @@ CREATE TABLE `expeditionState` ( KEY `expeditionState_FK_1` (`typeFk`), CONSTRAINT `expeditionState_FK` FOREIGN KEY (`expeditionFk`) REFERENCES `expedition` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `expeditionState_FK_1` FOREIGN KEY (`typeFk`) REFERENCES `expeditionStateType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Historico de estados de las expediciones'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Historico de estados de las expediciones'; /*!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 character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -31783,9 +27422,9 @@ DELIMITER ;; BEFORE INSERT ON expeditionState FOR EACH ROW BEGIN - + SET NEW.userFk = account.myUser_getId(); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31795,9 +27434,9 @@ 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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -31809,7 +27448,7 @@ BEGIN UPDATE vn.expedition e SET e.stateTypeFk = NEW.typeFk WHERE e.id = NEW.expeditionFk; - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31826,10 +27465,10 @@ DROP TABLE IF EXISTS `expeditionStateType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `expeditionStateType` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `code` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(100) NOT NULL, + `code` varchar(100) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Posibles estados de una expedición'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Posibles estados de una expedición'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -31858,31 +27497,6 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `expeditionSticker__` --- - -DROP TABLE IF EXISTS `expeditionSticker__`; -/*!50001 DROP VIEW IF EXISTS `expeditionSticker__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `expeditionSticker__` ( - `expeditionFk` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL, - `addressFk` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `street` tinyint NOT NULL, - `postalCode` tinyint NOT NULL, - `city` tinyint NOT NULL, - `nickname` tinyint NOT NULL, - `routeFk` tinyint NOT NULL, - `beachFk` tinyint NOT NULL, - `zona` tinyint NOT NULL, - `province` tinyint NOT NULL, - `phone` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `expeditionTicket_NoBoxes` -- @@ -31926,14 +27540,24 @@ DROP TABLE IF EXISTS `expeditionTruck`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `expeditionTruck` ( `id` int(11) NOT NULL AUTO_INCREMENT, + `roadmapFk` int(10) unsigned DEFAULT NULL, + `warehouseFk` smallint(6) unsigned DEFAULT NULL, `ETD` datetime DEFAULT NULL, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(45) NOT NULL, `bufferFk` int(11) DEFAULT NULL COMMENT 'buffer destino de las cajas', + `created` timestamp NULL DEFAULT current_timestamp(), + `userFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `expeditionTruck_idx1` (`ETD`), KEY `expeditionTruck_FK` (`bufferFk`), - CONSTRAINT `expeditionTruck_FK` FOREIGN KEY (`bufferFk`) REFERENCES `srt`.`buffer` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + KEY `expeditionTruck_FK_1` (`warehouseFk`), + KEY `expeditionTruck_FK_2` (`roadmapFk`), + KEY `expeditionTruck_FK_3` (`userFk`), + CONSTRAINT `expeditionTruck_FK` FOREIGN KEY (`bufferFk`) REFERENCES `srt`.`buffer` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `expeditionTruck_FK_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, + CONSTRAINT `expeditionTruck_FK_2` FOREIGN KEY (`roadmapFk`) REFERENCES `roadmap` (`id`) ON UPDATE CASCADE, + CONSTRAINT `expeditionTruck_FK_3` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -32054,14 +27678,10 @@ DROP TABLE IF EXISTS `expence`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `expence` ( `id` varchar(10) NOT NULL, - `taxTypeFk` tinyint(4) NOT NULL, - `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, - `isConbase` tinyint(4) NOT NULL DEFAULT 1, + `name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL, `isWithheld` tinyint(4) NOT NULL DEFAULT 0, - `isForSale` tinyint(4) NOT NULL DEFAULT 0, - PRIMARY KEY (`id`,`taxTypeFk`), - KEY `iva_tipo_id` (`taxTypeFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32107,20 +27727,14 @@ CREATE TABLE `floramondoConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `nextLanded` datetime DEFAULT NULL, `warehouseInFk` smallint(6) unsigned DEFAULT NULL, - `warehouseOutFk__` smallint(6) unsigned DEFAULT NULL, - `agencyModeFk__` int(11) DEFAULT NULL, `MaxLatestDeliveryHour` int(11) DEFAULT NULL, `MaxLatestOrderHour` int(11) DEFAULT 12 COMMENT 'Hora máxima para aceptar pedidos hoy', `LastUpdated` datetime DEFAULT NULL, `itemMaxSize` int(11) DEFAULT NULL COMMENT 'tamaño maximo de los articulos a mostrar', PRIMARY KEY (`id`), KEY `floramondoConfigWarehouseIn_idx` (`warehouseInFk`), - KEY `floramondoConfigWarehouseOut_idx` (`warehouseOutFk__`), - KEY `floramondoConfigAgencyModeFk_idx` (`agencyModeFk__`), - CONSTRAINT `floramondoConfigAgencyModeFk` FOREIGN KEY (`agencyModeFk__`) REFERENCES `agencyMode` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `floramondoConfigWarehouseInFk` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `floramondoConfigWarehouseOutFk` FOREIGN KEY (`warehouseOutFk__`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + CONSTRAINT `floramondoConfigWarehouseInFk` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -32143,20 +27757,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; --- --- Table structure for table `floramondoNotOfferDay__` --- - -DROP TABLE IF EXISTS `floramondoNotOfferDay__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `floramondoNotOfferDay__` ( - `dated` date NOT NULL, - `warehouseFk` int(11) NOT NULL DEFAULT 60, - PRIMARY KEY (`dated`,`warehouseFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='no muestra oferta en floramondo para ese dia y almacen'; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `fuelType` -- @@ -32166,11 +27766,11 @@ DROP TABLE IF EXISTS `fuelType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `fuelType` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(45) NOT NULL, + `code` varchar(45) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32182,10 +27782,10 @@ DROP TABLE IF EXISTS `gateArea`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `gateArea` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(45) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32199,13 +27799,13 @@ CREATE TABLE `genericAllocation` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemFk` int(11) NOT NULL, `typeFk` smallint(5) unsigned NOT NULL COMMENT ' vn.itemType.id', - `origin` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `color` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `quality` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `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, + `origin` varchar(50) DEFAULT NULL, + `color` varchar(50) DEFAULT NULL, + `quality` varchar(10) DEFAULT NULL, + `numFlores` varchar(10) DEFAULT NULL, + `category` varchar(50) DEFAULT NULL, + `productor` varchar(50) DEFAULT NULL, + `longName` varchar(100) DEFAULT NULL, `size` int(11) DEFAULT NULL, `startDated` date DEFAULT NULL, `endDated` date DEFAULT NULL, @@ -32221,7 +27821,7 @@ CREATE TABLE `genericAllocation` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los filtros para asignar códigos genéricos a los items'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Almacena los filtros para asignar códigos genéricos a los items'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32233,10 +27833,10 @@ DROP TABLE IF EXISTS `genus`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `genus` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(100) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `genus_PK2` (`name`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32250,32 +27850,14 @@ CREATE TABLE `glsConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `service` int(1) DEFAULT NULL, `schedule` int(1) DEFAULT NULL, - `token` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `labelType` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + `token` varchar(45) DEFAULT NULL, + `labelType` varchar(3) DEFAULT NULL, `supplierFk` int(11) DEFAULT NULL, `package` int(1) DEFAULT NULL, `refund` int(1) DEFAULT NULL, `weight` int(1) 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 `glsExpedition__` --- - -DROP TABLE IF EXISTS `glsExpedition__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `glsExpedition__` ( - `expeditionFk` int(11) NOT NULL, - `barcode` bigint(20) unsigned DEFAULT NULL, - `uid` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `codexp` int(11) DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT current_timestamp(), - PRIMARY KEY (`expeditionFk`), - CONSTRAINT `glsInfo_FK` FOREIGN KEY (`expeditionFk`) REFERENCES `expedition` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32288,19 +27870,23 @@ DROP TABLE IF EXISTS `greuge`; CREATE TABLE `greuge` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, `clientFk` int(10) unsigned NOT NULL, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(45) NOT NULL, `amount` decimal(10,2) NOT NULL, `shipped` datetime NOT NULL DEFAULT current_timestamp(), `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `greugeTypeFk` int(11) DEFAULT NULL, `ticketFk` int(11) DEFAULT NULL, + `userFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`Id`), KEY `greuges_type_fk_idx` (`greugeTypeFk`), KEY `Id_Ticket_Greuge_Ticket_idx` (`ticketFk`), KEY `Greuges_cliente_idx` (`clientFk`), + KEY `greuge_shipped_IDX` (`shipped`) USING BTREE, + KEY `greuge_FK` (`userFk`), CONSTRAINT `Id_Ticket_Greuge_Ticket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `greuge_FK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `greuges_type_fk` FOREIGN KEY (`greugeTypeFk`) REFERENCES `greugeType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPACT; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ROW_FORMAT=COMPACT; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -32311,14 +27897,12 @@ CREATE TABLE `greuge` ( /*!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`.`greuge_beforeUpdate` - BEFORE UPDATE ON `greuge` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`gregue_beforeInsert` + BEFORE INSERT ON greuge FOR EACH ROW BEGIN - DECLARE vMaxDate DATETIME DEFAULT TIMESTAMPADD(YEAR,1,util.VN_CURDATE()); - - IF NEW.shipped > vMaxDate THEN - SET NEW.shipped = vMaxDate; + IF NEW.userFk IS NULL THEN + SET NEW.userFk = account.myUser_getId(); END IF; END */;; DELIMITER ; @@ -32337,8 +27921,9 @@ DROP TABLE IF EXISTS `greugeConfig`; CREATE TABLE `greugeConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `freightPickUpPrice` decimal(10,2) NOT NULL, + `yearsToDelete` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32350,71 +27935,12 @@ DROP TABLE IF EXISTS `greugeType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `greugeType` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(45) NOT NULL, + `code` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `holidayDetail__` --- - -DROP TABLE IF EXISTS `holidayDetail__`; -/*!50001 DROP VIEW IF EXISTS `holidayDetail__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `holidayDetail__` ( - `id` tinyint NOT NULL, - `description` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `holidayLegend__` --- - -DROP TABLE IF EXISTS `holidayLegend__`; -/*!50001 DROP VIEW IF EXISTS `holidayLegend__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `holidayLegend__` ( - `id` tinyint NOT NULL, - `description` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `holidayType__` --- - -DROP TABLE IF EXISTS `holidayType__`; -/*!50001 DROP VIEW IF EXISTS `holidayType__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `holidayType__` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL, - `rgb` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `holiday__` --- - -DROP TABLE IF EXISTS `holiday__`; -/*!50001 DROP VIEW IF EXISTS `holiday__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `holiday__` ( - `holidayDetailFk` tinyint NOT NULL, - `holidayTypeFk` tinyint NOT NULL, - `workCenterFk` tinyint NOT NULL, - `dated` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `host` -- @@ -32424,34 +27950,30 @@ DROP TABLE IF EXISTS `host`; /*!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, + `code` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `description` varchar(50) DEFAULT NULL, `workerFk` int(10) unsigned DEFAULT NULL, - `windowsSerial` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL, + `windowsSerial` varchar(40) DEFAULT NULL, `printerFk` 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, + `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 (`id`), UNIQUE KEY `host_UN` (`code`), KEY `configHost_FK_3` (`companyFk`), KEY `configHost_FK` (`printerFk`), - 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_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=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -32474,6 +27996,38 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `improvedGeneralLog` +-- + +DROP TABLE IF EXISTS `improvedGeneralLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `improvedGeneralLog` ( + `user` char(128) NOT NULL DEFAULT '', + `db` char(64) NOT NULL DEFAULT '', + `tables` char(64) NOT NULL DEFAULT '', + `type` set('Select','Insert','Update','Delete') DEFAULT NULL, + PRIMARY KEY (`user`,`db`,`tables`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `improvedGeneralLogProcedures` +-- + +DROP TABLE IF EXISTS `improvedGeneralLogProcedures`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `improvedGeneralLogProcedures` ( + `user` char(128) NOT NULL DEFAULT '', + `db` varchar(250) NOT NULL DEFAULT '', + `routine` char(64) NOT NULL DEFAULT '', + `type` enum('FUNCTION','PROCEDURE') NOT NULL, + PRIMARY KEY (`user`,`db`,`routine`,`type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `incoterms` -- @@ -32482,10 +28036,10 @@ DROP TABLE IF EXISTS `incoterms`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `incoterms` ( - `code` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `code` varchar(3) NOT NULL DEFAULT '', + `name` varchar(45) DEFAULT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Internacional Commercial Terms'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Internacional Commercial Terms'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32496,19 +28050,19 @@ DROP TABLE IF EXISTS `ink`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ink` ( - `id` char(3) COLLATE utf8_unicode_ci NOT NULL, - `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `id` char(3) NOT NULL, + `name` varchar(50) DEFAULT NULL, `picture` blob NOT NULL, `showOrder` int(11) NOT NULL, `ball` blob DEFAULT NULL, `isCargex` tinyint(4) NOT NULL DEFAULT 0, - `dutchCode` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `hex` varchar(6) COLLATE utf8_unicode_ci DEFAULT NULL, + `dutchCode` varchar(3) DEFAULT NULL, + `hex` varchar(6) DEFAULT NULL, `isRealColor` tinyint(1) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `dutchCode_UNIQUE` (`dutchCode`), CONSTRAINT `ink_fk1` FOREIGN KEY (`dutchCode`) REFERENCES `edi`.`feature` (`feature_value`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32519,11 +28073,12 @@ DROP TABLE IF EXISTS `inkI18n`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `inkI18n` ( - `inkFk` char(3) COLLATE utf8_unicode_ci NOT NULL, - `lang` char(2) CHARACTER SET utf8 NOT NULL, - `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`inkFk`,`lang`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + `inkFk` char(3) NOT NULL, + `lang` char(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `name` varchar(255) NOT NULL, + PRIMARY KEY (`inkFk`,`lang`), + CONSTRAINT `inkI18n_FK` FOREIGN KEY (`inkFk`) REFERENCES `ink` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32549,14 +28104,13 @@ DROP TABLE IF EXISTS `intrastat`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `intrastat` ( `id` int(8) unsigned zerofill NOT NULL, - `description` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `import__` tinyint(4) NOT NULL DEFAULT 0, + `description` varchar(50) DEFAULT NULL, `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT 2, `taxCodeFk` tinyint(2) unsigned NOT NULL DEFAULT 64, PRIMARY KEY (`id`), KEY `iva_group_id` (`taxClassFk`), CONSTRAINT `intrastat_ibfk_1` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32576,7 +28130,7 @@ CREATE TABLE `inventoryFailure` ( `throwerFk` int(10) unsigned DEFAULT NULL, `guiltyFk` int(10) unsigned DEFAULT NULL, `causeFk` int(11) DEFAULT NULL, - `explanation` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL, + `explanation` varchar(250) DEFAULT NULL, PRIMARY KEY (`id`), KEY `inventoryFailure_fk1_idx` (`itemFk`), KEY `inventoryFailure_fk2_idx` (`throwerFk`), @@ -32588,7 +28142,7 @@ CREATE TABLE `inventoryFailure` ( CONSTRAINT `inventoryFailure_fk3` FOREIGN KEY (`guiltyFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inventoryFailure_fk4` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inventoryFailure_fk5` FOREIGN KEY (`causeFk`) REFERENCES `inventoryFailureCause` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32600,9 +28154,9 @@ DROP TABLE IF EXISTS `inventoryFailureCause`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `inventoryFailureCause` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(100) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32628,7 +28182,7 @@ CREATE TABLE `invoiceCorrection` ( CONSTRAINT `cplusInvoiceTyoeFk` FOREIGN KEY (`cplusInvoiceType477Fk`) REFERENCES `cplusInvoiceType477` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceCorrectionType_Fk33` FOREIGN KEY (`invoiceCorrectionTypeFk`) REFERENCES `invoiceCorrectionType` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceCorrection_ibfk_1` FOREIGN KEY (`cplusRectificationTypeFk`) REFERENCES `cplusRectificationType` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relacion entre las facturas rectificativas y las rectificadas.'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Relacion entre las facturas rectificativas y las rectificadas.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32660,10 +28214,10 @@ DROP TABLE IF EXISTS `invoiceCorrectionType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceCorrectionType` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(100) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `description_UNIQUE` (`description`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -32676,10 +28230,10 @@ DROP TABLE IF EXISTS `invoiceIn`; CREATE TABLE `invoiceIn` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `serialNumber` mediumint(11) unsigned DEFAULT NULL COMMENT 'insertado por Trigger', - `serial` char(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'R', + `serial` char(1) NOT NULL DEFAULT 'R', `supplierFk` int(11) NOT NULL, `issued` date DEFAULT NULL COMMENT 'Fecha de emision de la factura', - `supplierRef` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `supplierRef` varchar(50) DEFAULT NULL, `isBooked` tinyint(1) NOT NULL DEFAULT 0, `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 1, `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), @@ -32695,7 +28249,7 @@ CREATE TABLE `invoiceIn` ( `bookEntried` date DEFAULT NULL COMMENT 'Fecha Asiento', `isVatDeductible` tinyint(1) NOT NULL DEFAULT 1, `withholdingSageFk` smallint(6) DEFAULT NULL COMMENT 'Tipos de retención SAGE', - `expenceFkDeductible` varchar(10) CHARACTER SET utf8 DEFAULT NULL, + `expenceFkDeductible` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `proveedor_id` (`supplierFk`), KEY `empresa_id` (`companyFk`), @@ -32709,7 +28263,7 @@ CREATE TABLE `invoiceIn` ( KEY `recibida_ibfk_6` (`cplusRectificationTypeFk`), KEY `recibida_ibfk_7` (`cplusTrascendency472Fk`), KEY `invoiceIn_withholdingFk_idx` (`withholdingSageFk`), - KEY `invoiceIn_expenceFkDeductible` (`expenceFkDeductible`), + KEY `invoiceIn_expenceFkDeductible_idx` (`expenceFkDeductible`), CONSTRAINT `invoiceIn_expenceFkDeductible` FOREIGN KEY (`expenceFkDeductible`) REFERENCES `expence` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceIn_ibfk_1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceIn_ibfk_2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, @@ -32719,7 +28273,7 @@ CREATE TABLE `invoiceIn` ( CONSTRAINT `invoiceIn_ibfk_6` FOREIGN KEY (`cplusRectificationTypeFk`) REFERENCES `cplusRectificationType` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceIn_ibfk_7` FOREIGN KEY (`cplusTrascendency472Fk`) REFERENCES `cplusTrascendency472` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceIn_withholdingFk` FOREIGN KEY (`withholdingSageFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -32739,49 +28293,49 @@ BEGIN DECLARE vIssuingCountry, vhostCountry INT; DECLARE vActive TINYINT; DECLARE vWithholdingSageFk INT; - - SELECT withholdingSageFk INTO vWithholdingSageFk - FROM vn.supplier + + SELECT withholdingSageFk INTO vWithholdingSageFk + FROM vn.supplier WHERE id = NEW.supplierFk; - SET NEW.withholdingSageFk = vWithholdingSageFk; - - SELECT countryFk, isActive INTO vIssuingCountry, vActive - FROM vn.supplier + SET NEW.withholdingSageFk = vWithholdingSageFk; + + SELECT countryFk, isActive INTO vIssuingCountry, vActive + FROM vn.supplier WHERE id = NEW.supplierFk; - - SELECT countryFk INTO vhostCountry - FROM vn.supplier + + SELECT countryFk INTO vhostCountry + FROM vn.supplier WHERE id = NEW.companyFk; IF vActive = 0 THEN CALL util.throw('INACTIVE_PROVIDER'); END IF; - - IF (SELECT COUNT(*) FROM vn.invoiceIn - WHERE supplierRef = NEW.supplierRef - AND supplierFk = NEW.supplierFk + + IF (SELECT COUNT(*) FROM vn.invoiceIn + WHERE supplierRef = NEW.supplierRef + AND supplierFk = NEW.supplierFk AND YEAR(issued) = YEAR(NEW.issued) ) THEN CALL util.throw('reference duplicated'); END IF; - + SELECT CASE WHEN (SELECT account FROM vn.supplier where id = NEW.supplierFk) LIKE '___3______' THEN 'C' - WHEN (SELECT vIssuingCountry=vhostCountry from vn.country p1 join vn.country p2 ON p2.id = vhostCountry AND p1.id = vIssuingCountry + WHEN (SELECT vIssuingCountry=vhostCountry from vn.country p1 join vn.country p2 ON p2.id = vhostCountry AND p1.id = vIssuingCountry where p1.CEE < 2 and p2.CEE < 2) = 1 THEN 'R' - WHEN (SELECT vIssuingCountry <> vhostCountry from vn.country p1 join vn.country p2 ON p2.id = vhostCountry AND p1.id = vIssuingCountry - where p1.CEE < 2 and p2.CEE < 2) = 1 THEN 'E' + WHEN (SELECT vIssuingCountry <> vhostCountry from vn.country p1 join vn.country p2 ON p2.id = vhostCountry AND p1.id = vIssuingCountry + where p1.CEE < 2 and p2.CEE < 2) = 1 THEN 'E' WHEN (SELECT vIssuingCountry<>vhostCountry from vn.country p1 join vn.country p2 ON p2.id = vhostCountry AND p1.id = vIssuingCountry - where NOT p1.CEE < 2 AND not p1.id = 1) = 1 THEN 'W' + where NOT p1.CEE < 2 AND not p1.id = 1) = 1 THEN 'W' END INTO vSerie; - + SET NEW.serial = IFNULL(vSerie,'R'); IF vSerie LIKE 'W' THEN - SELECT IFNULL(MAX(serialNumber) + 1,1) INTO vNumReceived - FROM invoiceIn - WHERE `serial` LIKE NEW.serial AND - YEAR(issued) = YEAR(NEW.issued) AND + SELECT IFNULL(MAX(serialNumber) + 1,1) INTO vNumReceived + FROM invoiceIn + WHERE `serial` LIKE NEW.serial AND + YEAR(issued) = YEAR(NEW.issued) AND companyFk = NEW.companyFk; SET NEW.serialNumber = vNumReceived; END IF; @@ -32807,9 +28361,9 @@ BEGIN DECLARE vWithholdingSageFk INT; - IF (SELECT COUNT(*) FROM vn.invoiceIn - WHERE supplierRef = NEW.supplierRef - AND supplierFk = NEW.supplierFk + IF (SELECT COUNT(*) FROM vn.invoiceIn + WHERE supplierRef = NEW.supplierRef + AND supplierFk = NEW.supplierFk AND YEAR(issued) = YEAR(NEW.issued) AND id <> NEW.id ) THEN @@ -32817,8 +28371,9 @@ BEGIN END IF; IF NEW.supplierFk != OLD.supplierFk THEN + CALL supplier_checkIsActive(NEW.supplierFk); SELECT withholdingSageFk INTO vWithholdingSageFk - FROM vn.supplier + FROM vn.supplier WHERE id = NEW.supplierFk; SET NEW.withholdingSageFk = vWithholdingSageFk; END IF; @@ -32843,23 +28398,23 @@ DELIMITER ;; FOR EACH ROW BEGIN - IF NEW.issued != OLD.issued + IF NEW.issued != OLD.issued OR NEW.currencyFk != OLD.currencyFk THEN UPDATE invoiceInTax iit JOIN invoiceIn ii ON ii.id = iit.invoiceInFk LEFT JOIN referenceRate rr ON rr.dated = ii.issued - AND rr.currencyFk = ii.currencyFk + AND rr.currencyFk = ii.currencyFk SET iit.taxableBase = IF(iit.foreignValue IS NULL, iit.taxableBase, iit.foreignValue / rr.value) WHERE ii.id = NEW.id; - + UPDATE invoiceInDueDay iidd JOIN invoiceIn ii ON ii.id = iidd.invoiceInFk LEFT JOIN referenceRate rr ON rr.dated = ii.issued - AND rr.currencyFk = ii.currencyFk + AND rr.currencyFk = ii.currencyFk SET iidd.amount = IF(iidd.foreignValue IS NULL, iidd.amount, iidd.foreignValue / rr.value) - WHERE ii.id = NEW.id; - + WHERE ii.id = NEW.id; + END IF; END */;; @@ -32869,6 +28424,24 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `invoiceInConfig` +-- + +DROP TABLE IF EXISTS `invoiceInConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `invoiceInConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `retentionRate` int(3) NOT NULL, + `retentionName` varchar(25) NOT NULL, + `sageWithholdingFk` smallint(6) NOT NULL, + PRIMARY KEY (`id`), + KEY `invoiceInConfig_sageWithholdingFk` (`sageWithholdingFk`), + CONSTRAINT `invoiceInConfig_sageWithholdingFk` FOREIGN KEY (`sageWithholdingFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `invoiceInDueDay` -- @@ -32889,7 +28462,7 @@ CREATE TABLE `invoiceInDueDay` ( KEY `banco_id` (`bankFk`), CONSTRAINT `invoiceInDueDay_ibfk_6` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceInDueDay_ibfk_7` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -32905,13 +28478,13 @@ DELIMITER ;; FOR EACH ROW BEGIN DECLARE vIsNotified BOOLEAN; - - SELECT isNotified INTO vIsNotified - FROM vn.invoiceIn ii + + SELECT isNotified INTO vIsNotified + FROM vn.invoiceIn ii JOIN vn.supplier s ON s.id = ii.supplierFk JOIN vn.payMethod pm ON pm.id = s.payMethodFk WHERE ii.id = NEW.invoiceInFk; - + IF (NEW.dueDated <= util.VN_CURDATE() AND vIsNotified) THEN CALL mail_insert( @@ -32919,12 +28492,12 @@ BEGIN 'begonya@verdnatura.es', 'Añadido vencimiento en el pasado', CONCAT( - account.myUserGetName(), ' ha añadido un vencimiento de ', + account.myUser_getName(), ' ha añadido un vencimiento de ', NEW.amount, '€ en una fecha pasada en la recibida ', NEW.invoiceInFk ) ); END IF; - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -32945,13 +28518,13 @@ DELIMITER ;; FOR EACH ROW BEGIN DECLARE vIsNotified BOOLEAN; - - SELECT isNotified INTO vIsNotified - FROM vn.invoiceIn ii + + SELECT isNotified INTO vIsNotified + FROM vn.invoiceIn ii JOIN vn.supplier s ON s.id = ii.supplierFk JOIN vn.payMethod pm ON pm.id = s.payMethodFk WHERE ii.id = NEW.invoiceInFk; - + IF (NEW.dueDated <= util.VN_CURDATE() AND vIsNotified) THEN CALL mail_insert( @@ -32959,12 +28532,12 @@ BEGIN 'begonya@verdnatura.es', 'Añadido vencimiento en el pasado', CONCAT( - account.myUserGetName(), ' ha añadido un vencimiento de ', + account.myUser_getName(), ' ha añadido un vencimiento de ', NEW.amount,'€ en una fecha pasada en la recibida ',NEW.invoiceInFk ) ); END IF; - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -32994,26 +28567,7 @@ CREATE TABLE `invoiceInIntrastat` ( KEY `invoiceInIntrastat_FK` (`invoiceInFk`), 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `invoiceInIntrastat__` --- - -DROP TABLE IF EXISTS `invoiceInIntrastat__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `invoiceInIntrastat__` ( - `invoiceInFk` mediumint(8) unsigned NOT NULL, - `intrastatFk` int(8) unsigned zerofill NOT NULL, - `amount` decimal(10,2) NOT NULL, - PRIMARY KEY (`invoiceInFk`,`intrastatFk`), - KEY `Codintrastat` (`intrastatFk`), - KEY `recibida_id` (`invoiceInFk`), - CONSTRAINT `invoiceInIntrastat___ibfk_1` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `invoiceInIntrastat___ibfk_2` FOREIGN KEY (`intrastatFk`) REFERENCES `intrastat` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33027,20 +28581,20 @@ CREATE TABLE `invoiceInLog` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `originFk` mediumint(8) unsigned NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, - `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), - `description` text CHARACTER SET utf8 DEFAULT NULL, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, - `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` varchar(45) DEFAULT NULL, + `oldInstance` text DEFAULT NULL, + `newInstance` text DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), KEY `originFk` (`originFk`), KEY `userFk` (`userFk`), CONSTRAINT `invoiceInLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceInLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33052,28 +28606,28 @@ DROP TABLE IF EXISTS `invoiceInSage`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceInSage` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `taxClassFk` varchar(1) COLLATE utf8_unicode_ci NOT NULL, - `invoiceInSerialFk` varchar(2) COLLATE utf8_unicode_ci NOT NULL, + `taxClassFk` varchar(1) NOT NULL, + `invoiceInSerialFk` varchar(2) NOT NULL, `taxTypeSageFk` smallint(6) NOT NULL, `transactionTypeSageFk` tinyint(4) NOT NULL, `isService` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Para diferenciar producto de servicio', - `expenceFk` varchar(10) CHARACTER SET utf8 NOT NULL, + `expenceFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `withholdingSageFk` smallint(6) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `invoiceInSafe_unique` (`taxClassFk`,`invoiceInSerialFk`,`isService`,`withholdingSageFk`), - KEY `invoiceInSage_expenceFk` (`expenceFk`), KEY `invoiceInSage_withholdingSageFk` (`withholdingSageFk`), KEY `invoiceInSage_taxClassFk` (`taxClassFk`), KEY `invoiceInSage_invoiceInSerialFk` (`invoiceInSerialFk`), KEY `invoiceInSage_taxTypeSageFk` (`taxTypeSageFk`), KEY `invoiceInSage_transactionTypeSageFk` (`transactionTypeSageFk`), + KEY `invoiceInSage_idx` (`expenceFk`), CONSTRAINT `invoiceInSage_expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceInSage_invoiceInSerialFk` FOREIGN KEY (`invoiceInSerialFk`) REFERENCES `invoiceInSerial` (`code`) ON UPDATE CASCADE, CONSTRAINT `invoiceInSage_taxClassFk` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`code`) ON UPDATE CASCADE, CONSTRAINT `invoiceInSage_taxTypeSageFk` FOREIGN KEY (`taxTypeSageFk`) REFERENCES `sage`.`TiposIva` (`CodigoIva`) ON UPDATE CASCADE, CONSTRAINT `invoiceInSage_transactionTypeSageFk` FOREIGN KEY (`transactionTypeSageFk`) REFERENCES `sage`.`TiposTransacciones` (`CodigoTransaccion`) ON UPDATE CASCADE, CONSTRAINT `invoiceInSage_withholdingSageFk` FOREIGN KEY (`withholdingSageFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciones de entrelas series de facturas recibidas y sus tipo de IVA con código Iva y codigo de Transación en Sage. Para precontabilizadar facturas recibidas'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Relaciones de entrelas series de facturas recibidas y sus tipo de IVA con código Iva y codigo de Transación en Sage. Para precontabilizadar facturas recibidas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33084,16 +28638,16 @@ DROP TABLE IF EXISTS `invoiceInSerial`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceInSerial` ( - `code` varchar(2) COLLATE utf8_unicode_ci NOT NULL, - `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `code` varchar(2) NOT NULL, + `description` varchar(45) DEFAULT NULL, `cplusTerIdNifFk` int(11) NOT NULL DEFAULT 1, - `taxAreaFk` varchar(15) CHARACTER SET utf8 DEFAULT NULL, + `taxAreaFk` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, PRIMARY KEY (`code`), KEY `InvoiceInSerial_Fk1_idx` (`cplusTerIdNifFk`), KEY `InvoiceInSerialTaxArea_idx` (`taxAreaFk`), CONSTRAINT `InvoiceInSerialTaxArea` FOREIGN KEY (`taxAreaFk`) REFERENCES `taxArea` (`code`) ON UPDATE CASCADE, CONSTRAINT `InvoiceInSerial_Fk1` FOREIGN KEY (`cplusTerIdNifFk`) REFERENCES `cplusTerIdNif` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33108,7 +28662,7 @@ CREATE TABLE `invoiceInTax` ( `invoiceInFk` mediumint(8) unsigned NOT NULL, `taxCodeFk` int(10) DEFAULT NULL, `taxableBase` decimal(10,2) NOT NULL, - `expenceFk` varchar(10) CHARACTER SET utf8 NOT NULL, + `expenceFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `foreignValue` decimal(10,2) DEFAULT NULL, `taxTypeSageFk` smallint(6) DEFAULT NULL COMMENT 'Tipo de IVA SAGE', `transactionTypeSageFk` tinyint(4) DEFAULT NULL COMMENT 'Tipo de transacción SAGE', @@ -33116,14 +28670,14 @@ CREATE TABLE `invoiceInTax` ( PRIMARY KEY (`id`), KEY `recibida_id` (`invoiceInFk`), KEY `recibida_iva_ibfk_2` (`taxCodeFk`), - KEY `recibida_iva_gastos_id` (`expenceFk`), KEY `recibida_iva_taxTypeSageFk` (`taxTypeSageFk`), KEY `invoiceInTax_transactionTypeSageFk_idx` (`transactionTypeSageFk`), + KEY `invoiceInTax_idx` (`expenceFk`), + CONSTRAINT `invoiceInTax_expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceInTax_ibfk_5` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceInTax_transactionTypeSageFk` FOREIGN KEY (`transactionTypeSageFk`) REFERENCES `sage`.`TiposTransacciones` (`CodigoTransaccion`) ON UPDATE CASCADE, - CONSTRAINT `recibida_iva_gastos_id` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `recibida_iva_taxTypeSageFk` FOREIGN KEY (`taxTypeSageFk`) REFERENCES `sage`.`TiposIva` (`CodigoIva`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33136,8 +28690,8 @@ DROP TABLE IF EXISTS `invoiceInTaxBookingAccount`; CREATE TABLE `invoiceInTaxBookingAccount` ( `id` int(10) NOT NULL AUTO_INCREMENT, `effectived` timestamp NOT NULL DEFAULT current_timestamp(), - `account` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `taxAreaFk` varchar(15) CHARACTER SET utf8 NOT NULL, + `account` varchar(10) NOT NULL, + `taxAreaFk` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `priority` int(2) unsigned DEFAULT NULL, `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT 1, `countryFk` mediumint(8) unsigned NOT NULL DEFAULT 1, @@ -33149,7 +28703,7 @@ CREATE TABLE `invoiceInTaxBookingAccount` ( CONSTRAINT `invoiceInTaxBookingAccount_fk1` FOREIGN KEY (`taxAreaFk`) REFERENCES `taxArea` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceInTaxBookingAccount_fk2` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceInTaxBookingAccount_fk3` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33161,20 +28715,13 @@ DROP TABLE IF EXISTS `invoiceOut`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceOut` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `ref` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `serial` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, + `ref` varchar(20) NOT NULL, + `serial` varchar(2) DEFAULT NULL, `issued` date DEFAULT NULL, `amount` decimal(12,2) DEFAULT 0.00, `dued` datetime DEFAULT NULL, `bankFk` int(11) DEFAULT NULL, `clientFk` int(11) DEFAULT 0, - `taxableBase7__` decimal(12,2) DEFAULT 0.00, - `taxableBase16__` decimal(12,2) DEFAULT 0.00, - `equ1__` decimal(12,2) DEFAULT 0.00, - `equ4__` decimal(12,2) DEFAULT 0.00, - `vat7__` decimal(12,2) DEFAULT 0.00, - `vat16__` decimal(12,2) DEFAULT 0.00, - `workerFk__` int(11) DEFAULT 0, `created` timestamp NOT NULL DEFAULT current_timestamp(), `companyFk` smallint(5) unsigned NOT NULL DEFAULT 442, `hasPdf` tinyint(3) unsigned NOT NULL DEFAULT 0, @@ -33187,7 +28734,6 @@ CREATE TABLE `invoiceOut` ( UNIQUE KEY `Id_Factura` (`ref`), KEY `Id_Banco` (`bankFk`), KEY `Id_Cliente` (`clientFk`), - KEY `Id_Trabajador` (`workerFk__`), KEY `empresa_id` (`companyFk`), KEY `Fecha` (`issued`), KEY `Facturas_ibfk_2_idx` (`cplusInvoiceType477Fk`), @@ -33203,7 +28749,7 @@ CREATE TABLE `invoiceOut` ( CONSTRAINT `invoiceOut_serial` FOREIGN KEY (`serial`) REFERENCES `invoiceOutSerial` (`code`), CONSTRAINT `invoice_bank_id` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoice_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -33217,34 +28763,32 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceOut_beforeInsert` BEFORE INSERT ON `invoiceOut` FOR EACH ROW --- Edit trigger body code below this line. Do not edit lines above this one BEGIN DECLARE vRef CHAR(10) ; - + IF YEAR(NEW.issued) <= 2021 THEN - + SELECT CONCAT(NEW.serial, - IFNULL(RIGHT(MAX(i.ref), LENGTH(i.ref)-1) , + IFNULL(RIGHT(MAX(i.ref), LENGTH(i.ref)-1) , RPAD(CONCAT(c.sage200Company, RIGHT(YEAR(util.VN_CURDATE()), 2)), 7,'0')) + 1) INTO vRef FROM invoiceOut i LEFT JOIN company c ON c.id = i.companyFk WHERE i.serial = NEW.serial - AND i.issued BETWEEN util.firstDayOfYear(NEW.issued) AND util.dayEnd(util.lastDayOfYear(NEW.issued)) + AND i.issued BETWEEN util.firstDayOfYear(NEW.issued) AND util.dayEnd(util.lastDayOfYear(NEW.issued)) AND c.id = NEW.companyFk; ELSE - + SELECT CONCAT(NEW.serial, - IFNULL(RIGHT(MAX(i.ref), LENGTH(i.ref)-1) , + IFNULL(RIGHT(MAX(i.ref), LENGTH(i.ref)-1) , RPAD(CONCAT(c.sage200Company, RIGHT(YEAR(util.VN_CURDATE()), 2)), 8,'0')) + 1) INTO vRef FROM invoiceOut i LEFT JOIN company c ON c.id = i.companyFk WHERE i.serial = NEW.serial - AND i.issued BETWEEN util.firstDayOfYear(NEW.issued) AND util.dayEnd(util.lastDayOfYear(NEW.issued)) + AND i.issued BETWEEN util.firstDayOfYear(NEW.issued) AND util.dayEnd(util.lastDayOfYear(NEW.issued)) AND c.id = NEW.companyFk; END IF; - + SET NEW.ref = vRef; - END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -33265,15 +28809,15 @@ DELIMITER ;; FOR EACH ROW BEGIN CALL clientRisk_update(NEW.clientFk, NEW.companyFk, NEW.amount); - IF (SELECT COUNT(*) - FROM client - WHERE id = NEW.clientFk + IF (SELECT COUNT(*) + FROM client + WHERE id = NEW.clientFk AND businessTypeFk = 'officialOrganism' ) THEN CALL mail_insert('administracion@verdnatura.es', NULL, CONCAT('Se ha emitido una factura al organismo: ', NEW.clientFk), - CONCAT('Presentar factura en FACE https://salix.verdnatura.es/#!/invoice-out/', + CONCAT('Presentar factura en FACE https://salix.verdnatura.es/#!/invoice-out/', NEW.id, '/summary')); END IF; @@ -33336,14 +28880,14 @@ CREATE TABLE `invoiceOutExpence` ( `id` int(11) NOT NULL AUTO_INCREMENT, `invoiceOutFk` int(10) unsigned NOT NULL, `amount` decimal(10,2) NOT NULL DEFAULT 0.00, - `expenceFk` varchar(10) CHARACTER SET utf8 NOT NULL, + `expenceFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `created` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `invoiceOutExpence_FK_1_idx` (`invoiceOutFk`), - KEY `invoiceOutExpence_FK_2_idx` (`expenceFk`), + KEY `invoiceOutExpence_expenceFk_idx` (`expenceFk`), CONSTRAINT `invoiceOutExpence_FK_1` FOREIGN KEY (`invoiceOutFk`) REFERENCES `invoiceOut` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceOutExpence_expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Desglosa la base imponible de una factura en funcion del tipo de gasto/venta'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Desglosa la base imponible de una factura en funcion del tipo de gasto/venta'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33354,18 +28898,18 @@ DROP TABLE IF EXISTS `invoiceOutSerial`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceOutSerial` ( - `code` varchar(2) COLLATE utf8_unicode_ci NOT NULL, - `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `code` varchar(2) NOT NULL, + `description` varchar(45) DEFAULT NULL, `isTaxed` tinyint(1) NOT NULL DEFAULT 1, - `taxAreaFk` varchar(15) CHARACTER SET utf8 NOT NULL DEFAULT 'NATIONAL', + `taxAreaFk` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'NATIONAL', `isCEE` tinyint(1) NOT NULL DEFAULT 0, `cplusInvoiceType477Fk` int(10) unsigned DEFAULT 1, - `footNotes` longtext COLLATE utf8_unicode_ci DEFAULT NULL, + `footNotes` longtext DEFAULT NULL, `isRefEditable` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`code`), KEY `taxAreaFk_idx` (`taxAreaFk`), CONSTRAINT `invoiceOutSeriaTaxArea` FOREIGN KEY (`taxAreaFk`) REFERENCES `taxArea` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33381,14 +28925,14 @@ CREATE TABLE `invoiceOutTax` ( `taxableBase` decimal(10,2) NOT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), `vat` decimal(10,2) NOT NULL DEFAULT 0.00, - `pgcFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0000000000', + `pgcFk` varchar(10) NOT NULL DEFAULT '0000000000', PRIMARY KEY (`id`), UNIQUE KEY `invoiceOutTax_Resctriccion` (`invoiceOutFk`,`pgcFk`), KEY `invoiceOutFk_idx` (`invoiceOutFk`), KEY `pgcFk` (`pgcFk`), CONSTRAINT `invoiceOutFk` FOREIGN KEY (`invoiceOutFk`) REFERENCES `invoiceOut` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceOutTax_ibfk_1` FOREIGN KEY (`pgcFk`) REFERENCES `pgc` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33400,11 +28944,11 @@ DROP TABLE IF EXISTS `invoiceOutTaxConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceOutTaxConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `taxClassCodeFk` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `taxClassCodeFk` varchar(1) DEFAULT NULL, `taxTypeSageFk` smallint(6) DEFAULT NULL, `transactionTypeSageFk` tinyint(4) DEFAULT NULL, `isService` tinyint(1) DEFAULT 0, - `expenceFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `expenceFk` varchar(10) DEFAULT NULL, PRIMARY KEY (`id`), KEY `invoiceOutTaxConfig_FK` (`taxClassCodeFk`), KEY `invoiceOutTaxConfig_FK_1` (`taxTypeSageFk`), @@ -33412,7 +28956,7 @@ CREATE TABLE `invoiceOutTaxConfig` ( CONSTRAINT `invoiceOutTaxConfig_FK` FOREIGN KEY (`taxClassCodeFk`) REFERENCES `taxClass` (`code`), CONSTRAINT `invoiceOutTaxConfig_FK_1` FOREIGN KEY (`taxTypeSageFk`) REFERENCES `sage`.`TiposIva` (`CodigoIva`), CONSTRAINT `invoiceOutTaxConfig_FK_2` FOREIGN KEY (`transactionTypeSageFk`) REFERENCES `sage`.`TiposTransacciones` (`CodigoTransaccion`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33425,77 +28969,70 @@ DROP TABLE IF EXISTS `item`; CREATE TABLE `item` ( `id` int(11) NOT NULL AUTO_INCREMENT, `equivalent` int(11) unsigned DEFAULT NULL, - `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `name` varchar(50) DEFAULT NULL, `size` int(10) unsigned DEFAULT NULL, `stems` int(11) DEFAULT 1, `minPrice` double DEFAULT 0, `isToPrint` tinyint(1) NOT NULL DEFAULT 0, - `isDeliveryNote__` tinyint(1) NOT NULL DEFAULT 0, - `taxClassFk__` tinyint(4) unsigned NOT NULL DEFAULT 1, - `family` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT 'VT', + `family` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'VT', `box` tinyint(1) NOT NULL DEFAULT 0, - `category` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + `category` varchar(3) DEFAULT NULL, `originFk` tinyint(2) unsigned NOT NULL, `doPhoto` tinyint(4) NOT NULL DEFAULT 0, - `image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `inkFk` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `niche__` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `image` varchar(255) DEFAULT NULL, + `inkFk` varchar(3) DEFAULT NULL, `intrastatFk` int(8) unsigned zerofill NOT NULL DEFAULT 06039010, `hasMinPrice` tinyint(1) NOT NULL DEFAULT 0, `created` timestamp NOT NULL DEFAULT current_timestamp(), - `isOnOffer__` tinyint(4) NOT NULL DEFAULT 0, - `isBargain__` tinyint(4) NOT NULL DEFAULT 0, - `comment` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, + `comment` varchar(150) DEFAULT NULL, `typeFk` smallint(5) unsigned NOT NULL, `generic` tinyint(1) unsigned zerofill NOT NULL DEFAULT 0, `producerFk` mediumint(3) unsigned DEFAULT NULL, - `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `description` varchar(1000) DEFAULT NULL, `density` int(11) NOT NULL DEFAULT 167 COMMENT 'Almacena la densidad en kg/m3 para el calculo de los portes, si no se especifica se pone por defecto la del tipo en un trigger', - `relevancy` tinyint(1) NOT NULL DEFAULT 0, - `expenceFk` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '7001000000', + `relevancy` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'La web ordena de forma descendiente por este campo para mostrar los artículos', + `expenceFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '7001000000', `isActive` tinyint(1) NOT NULL DEFAULT 1, - `longName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `subName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `tag5` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, - `value5` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `tag6` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, - `value6` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `tag7` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, - `value7` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `tag8` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, - `value8` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `tag9` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, - `value9` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `tag10` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, - `value10` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `compression` decimal(5,2) NOT NULL DEFAULT 1.00 COMMENT 'Relacion de compresividad entre el volumen de las entradas en Silla y el empaquetado en los envios a clientes.\n\nMenor que 1 significa que se puede comprimir más que el volumen original.', + `longName` varchar(50) DEFAULT NULL, + `subName` varchar(50) DEFAULT NULL, + `tag5` varchar(20) DEFAULT NULL, + `value5` varchar(50) DEFAULT NULL, + `tag6` varchar(20) DEFAULT NULL, + `value6` varchar(50) DEFAULT NULL, + `tag7` varchar(20) DEFAULT NULL, + `value7` varchar(50) DEFAULT NULL, + `tag8` varchar(20) DEFAULT NULL, + `value8` varchar(50) DEFAULT NULL, + `tag9` varchar(20) DEFAULT NULL, + `value9` varchar(50) DEFAULT NULL, + `tag10` varchar(20) DEFAULT NULL, + `value10` varchar(50) DEFAULT NULL, `minimum` decimal(10,0) unsigned NOT NULL DEFAULT 3 COMMENT 'Cantidad máxima de cajas / cubos que cabe en un nicho', `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 NULL, - `isFloramondo` tinyint(1) NOT NULL DEFAULT '0', - `isFragile` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'articulos solo para recogidas por su fragilidad', + `hasKgPrice` tinyint(1) NOT NULL DEFAULT 0, + `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', `embalageCode` int(11) DEFAULT NULL COMMENT 'Campo para Floramondo', - `quality` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Campo para Floramondo', + `quality` varchar(255) DEFAULT NULL COMMENT 'Campo para Floramondo', `stars` int(11) DEFAULT NULL, `stemMultiplier` double NOT NULL DEFAULT 1 COMMENT 'este valor multiplica las unidades y divide los precios en el procedimiento edi.ekt_load', - `itemPackingTypeFk` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `itemPackingTypeFk` varchar(1) DEFAULT NULL, `packingOut` decimal(10,2) DEFAULT NULL COMMENT 'cantidad que cabe en una caja de verdnatura', `genericFk` int(11) DEFAULT NULL COMMENT 'Item genérico', `packingShelve` int(11) DEFAULT NULL COMMENT 'unidades que caben en una bandeja, en el caso de los sacadores', + `isLaid` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Indica si el producto se puede tumbar a efectos del transporte desde Holanda', + `lastUsed` datetime DEFAULT current_timestamp(), + `weightByPiece` int(10) unsigned DEFAULT NULL COMMENT 'peso por defecto para un articulo por tallo/unidad', PRIMARY KEY (`id`), UNIQUE KEY `item_supplyResponseFk_idx` (`supplyResponseFk`), KEY `Color` (`inkFk`), KEY `id_origen` (`originFk`), KEY `Codintrastat` (`intrastatFk`), - KEY `iva_group_id` (`taxClassFk__`), KEY `tipo_id` (`typeFk`), KEY `producer_id` (`producerFk`), KEY `ArticlesIsActive_idx` (`isActive`), - KEY `item_ibfk_6_idx` (`sectorFk`), - KEY `item_expenceFk` (`expenceFk`), KEY `Article` (`name`,`subName`,`value5`,`value6`,`value7`,`value8`,`value9`,`value10`), KEY `item_id10` (`embalageCode`), KEY `item_id11` (`numberOfItemsPerCask`), @@ -33504,17 +29041,17 @@ CREATE TABLE `item` ( KEY `item_FK` (`genericFk`), KEY `item_size_IDX` (`size`) USING BTREE, KEY `item_size_IDX2` (`longName`) USING BTREE, + KEY `item_lastUsed_IDX` (`lastUsed`) USING BTREE, + KEY `item_expenceFk_idx` (`expenceFk`), CONSTRAINT `item_FK` FOREIGN KEY (`genericFk`) REFERENCES `item` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `item_FK_1` FOREIGN KEY (`typeFk`) REFERENCES `itemType` (`id`), CONSTRAINT `item_expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE, CONSTRAINT `item_family` FOREIGN KEY (`family`) REFERENCES `itemFamily` (`code`) ON UPDATE CASCADE, CONSTRAINT `item_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `origin` (`id`) ON UPDATE CASCADE, CONSTRAINT `item_ibfk_2` FOREIGN KEY (`intrastatFk`) REFERENCES `intrastat` (`id`) ON UPDATE CASCADE, - CONSTRAINT `item_ibfk_4` FOREIGN KEY (`taxClassFk__`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE, - CONSTRAINT `item_ibfk_5` FOREIGN KEY (`typeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE, - CONSTRAINT `item_ibfk_6` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `itemsupplyResponseFk` FOREIGN KEY (`supplyResponseFk`) REFERENCES `edi`.`supplyResponse` (`ID`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `producer_id` FOREIGN KEY (`producerFk`) REFERENCES `producer` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -33529,33 +29066,17 @@ DELIMITER ;; BEFORE INSERT ON `item` FOR EACH ROW BEGIN - DECLARE vDensity DOUBLE; - DECLARE vCompression DOUBLE; DECLARE vItemPackingType VARCHAR(1); - IF NEW.density IS NULL THEN - SELECT density INTO vDensity - FROM itemType WHERE id = NEW.typeFk; - - SET NEW.density = vDensity; + IF NEW.itemPackingTypeFk IS NULL THEN + + SELECT itemPackingTypeFk INTO vItemPackingType + FROM vn.itemType it + WHERE id = NEW.typeFk; + + SET NEW.itemPackingTypeFk = vItemPackingType; + END IF; - - IF NEW.compression IS NULL OR NEW.compression = 1 THEN - SELECT compression INTO vCompression - FROM itemType WHERE id = NEW.typeFk; - - SET NEW.compression = vCompression; - END IF; - - IF NEW.itemPackingTypeFk IS NULL THEN - - SELECT itemPackingTypeFk INTO vItemPackingType - FROM vn.itemType it - WHERE id = NEW.typeFk; - - SET NEW.itemPackingTypeFk = vItemPackingType; - - END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -33610,23 +29131,23 @@ DELIMITER ;; BEFORE UPDATE ON `item` FOR EACH ROW BEGIN - + DECLARE vNewPackingShelve INT; - IF ISNULL(NEW.packingShelve) AND NOT ISNULL(NEW.packingOut) THEN - - SELECT NEW.packingOut * vc.shelveVolume / vc.standardFlowerBox + IF ISNULL(NEW.packingShelve) AND NOT ISNULL(NEW.packingOut) THEN + + SELECT NEW.packingOut * vc.shelveVolume / vc.standardFlowerBox INTO vNewPackingShelve FROM vn.volumeConfig vc; - + SET NEW.packingShelve = vNewPackingShelve; - + END IF; IF NEW.itemPackingTypeFk = '' THEN SET NEW.itemPackingTypeFk = NULL; - + END IF; END */;; @@ -33638,9 +29159,9 @@ 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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -33672,7 +29193,8 @@ DELIMITER ;; FOR EACH ROW BEGIN CALL hedera.image_unref('catalog', OLD.image); - IF OLD.id > 400000 THEN + + IF OLD.isFloramondo THEN INSERT IGNORE edi.item_free (id) VALUES (OLD.id); END IF; @@ -33693,13 +29215,13 @@ DROP TABLE IF EXISTS `itemBarcode`; CREATE TABLE `itemBarcode` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `itemFk` int(11) NOT NULL, - `code` varchar(22) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(22) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code` (`code`), UNIQUE KEY `Id_Article_2` (`itemFk`,`code`), KEY `Id_Article` (`itemFk`), CONSTRAINT `itemBarcode_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33711,7 +29233,6 @@ DROP TABLE IF EXISTS `itemBotanical`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemBotanical` ( `itemFk` int(11) NOT NULL, - `botanical__` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `genusFk` int(11) NOT NULL, `specieFk` int(11) DEFAULT NULL, PRIMARY KEY (`itemFk`), @@ -33720,7 +29241,7 @@ CREATE TABLE `itemBotanical` ( CONSTRAINT `itemBotanicalItemFkFk` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemBotanical_FK` FOREIGN KEY (`specieFk`) REFERENCES `specie` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `itemBotanical_FK_1` FOREIGN KEY (`genusFk`) REFERENCES `genus` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Sustituye a antiguo NomBotanic de Articles'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Sustituye a antiguo NomBotanic de Articles'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33746,15 +29267,15 @@ DROP TABLE IF EXISTS `itemCategory`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemCategory` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(45) NOT NULL, `order` int(10) unsigned DEFAULT NULL, `display` tinyint(4) NOT NULL DEFAULT 1, - `color` char(6) COLLATE utf8_unicode_ci DEFAULT NULL, + `color` char(6) DEFAULT NULL, `shortLife` int(11) NOT NULL DEFAULT 0 COMMENT 'Sirve para filtrar aquellos reinos que tienen precios estables', `merchandise` tinyint(1) NOT NULL DEFAULT 1, - `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', + `icon` varchar(45) DEFAULT NULL, + `code` varchar(45) 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`), @@ -33762,7 +29283,7 @@ CREATE TABLE `itemCategory` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -33797,10 +29318,10 @@ DROP TABLE IF EXISTS `itemCategoryI18n`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemCategoryI18n` ( `categoryFk` int(10) unsigned NOT NULL, - `lang` char(2) CHARACTER SET utf8 NOT NULL, - `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `lang` char(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `name` varchar(255) NOT NULL, PRIMARY KEY (`categoryFk`,`lang`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33817,6 +29338,21 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `itemCleanLog` +-- + +DROP TABLE IF EXISTS `itemCleanLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `itemCleanLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itemDeleted` int(11) DEFAULT NULL COMMENT 'Indica la cantidad de items que ha eliminado', + `created` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Temporary table structure for view `itemColor` -- @@ -33839,25 +29375,17 @@ 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__` --- - -DROP TABLE IF EXISTS `itemConversor__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `itemConversor__` ( - `espItemFk` int(11) NOT NULL, - `genItemFk` int(11) DEFAULT NULL, - PRIMARY KEY (`espItemFk`), - KEY `itemConversor_fk2_idx` (`genItemFk`), - CONSTRAINT `itemConversor_fk1` FOREIGN KEY (`espItemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `itemConversor_fk2` FOREIGN KEY (`genItemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona los item específicos con los genéricos'; + `id` int(11) NOT NULL, + `isItemTagTriggerDisabled` tinyint(1) NOT NULL DEFAULT 1, + `monthToDeactivate` int(3) NOT NULL DEFAULT 24, + `wasteRecipients` varchar(50) NOT NULL COMMENT 'Weekly waste report schedule recipients', + `defaultTag` int(11) NOT NULL DEFAULT 56, + `validPriorities` varchar(50) NOT NULL DEFAULT '[1,2,3]', + `defaultPriority` int(11) NOT NULL DEFAULT 2, + PRIMARY KEY (`id`), + KEY `itemConfig_FK` (`defaultTag`), + CONSTRAINT `itemConfig_FK` FOREIGN KEY (`defaultTag`) REFERENCES `tag` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -33883,7 +29411,7 @@ CREATE TABLE `itemCost` ( KEY `warehouse_id_rotacion_idx` (`warehouseFk`), CONSTRAINT `id_article_rotaci` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `warehouse_id_rotaci` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los valores de rotacion en los ultimos 365 dias'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Almacena los valores de rotacion en los ultimos 365 dias'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -33924,15 +29452,15 @@ BEGIN IF NEW.itemFk IN (95, 98) THEN SET NEW.cm3 = 0; END IF; - + IF !(NEW.cm3delivery <=> OLD.cm3delivery) THEN INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id + SELECT r.id FROM vn.itemCost ic JOIN vn.sale s ON s.itemFk = ic.itemFk - JOIN vn.ticket t ON t.id = s.ticketFk AND t.warehouseFk = ic.warehouseFk + JOIN vn.ticket t ON t.id = s.ticketFk AND t.warehouseFk = ic.warehouseFk JOIN vn.route r ON r.id = t.routeFk - WHERE r.isOk = FALSE + WHERE r.isOk = FALSE AND ic.itemFk = NEW.itemFk AND r.created >= util.VN_CURDATE() GROUP BY r.id; @@ -33996,10 +29524,10 @@ DROP TABLE IF EXISTS `itemFamily`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemFamily` ( - `code` varchar(3) CHARACTER SET utf8 NOT NULL, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `description` varchar(45) NOT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -34011,15 +29539,15 @@ DROP TABLE IF EXISTS `itemImageQueue`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemImageQueue` ( `itemFk` int(11) NOT NULL, - `url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `error` text COLLATE utf8_unicode_ci DEFAULT NULL, + `url` varchar(255) DEFAULT NULL, + `error` text DEFAULT NULL, `attempts` int(11) DEFAULT 0, `created` timestamp NULL DEFAULT current_timestamp(), `updated` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `priority` int(11) DEFAULT 99, PRIMARY KEY (`itemFk`), CONSTRAINT `itemImageQueueItemIdx` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Cola para añadir las imagenes al campo vn.item.image a partir de una url'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Cola para añadir las imagenes al campo vn.item.image a partir de una url'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -34047,11 +29575,11 @@ DROP TABLE IF EXISTS `itemLabel`; CREATE TABLE `itemLabel` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemFk` int(11) DEFAULT NULL, - `itemName` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + `itemName` varchar(20) DEFAULT NULL, `price` decimal(10,2) DEFAULT NULL, `labels` int(11) DEFAULT NULL COMMENT 'Tabla hecha para Ruben Espinosa, para sacar etiquetas en Holanda para un cliente.', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -34065,20 +29593,20 @@ CREATE TABLE `itemLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `originFk` int(11) NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, - `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), - `description` text CHARACTER SET utf8 DEFAULT NULL, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, - `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` varchar(45) DEFAULT NULL, + `oldInstance` text DEFAULT NULL, + `newInstance` text DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `changedModelValue` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), KEY `itemLogItemFk_idx` (`originFk`), KEY `itemLogUserFk_idx` (`userFk`), CONSTRAINT `itemLogItemFk` FOREIGN KEY (`originFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemLogUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -34090,12 +29618,12 @@ DROP TABLE IF EXISTS `itemMatchProperties`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemMatchProperties` ( `itemFk` int(11) NOT NULL, - `name` varchar(80) COLLATE utf8_unicode_ci NOT NULL, - `producer` varchar(80) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(80) NOT NULL, + `producer` varchar(80) NOT NULL, `size` int(11) NOT NULL, PRIMARY KEY (`itemFk`,`name`,`producer`,`size`), CONSTRAINT `itemFk___fk` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Propiedades para encontrar articulos equivalentes en verdnatura'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Propiedades para encontrar articulos equivalentes en verdnatura'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -34106,83 +29634,13 @@ DROP TABLE IF EXISTS `itemPackingType`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemPackingType` ( - `code` varchar(1) COLLATE utf8_unicode_ci NOT NULL, - `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(1) NOT NULL, + `description` varchar(100) NOT NULL, + `isActive` tinyint(1) NOT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define la linea de encajado para cada producto'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Define la linea de encajado para cada producto'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `itemPlacement` --- - -DROP TABLE IF EXISTS `itemPlacement`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `itemPlacement` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `itemFk` int(11) NOT NULL, - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 1, - `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `modificationDate` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), - `reserve` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `pickable` int(11) unsigned NOT NULL DEFAULT 0, - `sectorFk` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `Id_Article_UNIQUE` (`itemFk`,`warehouseFk`), - KEY `Articles_nicho_wh_fk` (`warehouseFk`), - KEY `itemPlacement_fk3_idx` (`id`,`sectorFk`), - KEY `itemPlacement_fk3_idx1` (`sectorFk`), - CONSTRAINT `Articles_nicho_wh_fk` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `Articles_nichos_fk` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `itemPlacement_fk3` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`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`.`itemPlacement_BEFORE_INSERT` - BEFORE INSERT ON `itemPlacement` - FOR EACH ROW -BEGIN - IF LENGTH(NEW.code) < 3 THEN - CALL util.throw('code too short'); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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`.`itemPlacement_BEFORE_UPDATE` - BEFORE UPDATE ON `itemPlacement` - FOR EACH ROW -BEGIN - IF LENGTH(NEW.code) < 3 THEN - CALL util.throw('code too short'); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_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 `itemPlacementSupply` -- @@ -34208,7 +29666,7 @@ CREATE TABLE `itemPlacementSupply` ( CONSTRAINT `itemPlacementSupply_fk2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemPlacementSupply_fk3` FOREIGN KEY (`repoUserFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemPlacementSupply_fk4` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de nichos de picking que hay que reponer'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Lista de nichos de picking que hay que reponer'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -34266,22 +29724,7 @@ CREATE TABLE `itemProposal` ( KEY `itemProposal_fk2_idx` (`mateFk`), CONSTRAINT `itemProposal_fk1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemProposal_fk2` FOREIGN KEY (`mateFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='almacena los cambios realizados de unos items por otros, cuando faltaban los primeros'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `itemRepo__` --- - -DROP TABLE IF EXISTS `itemRepo__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `itemRepo__` ( - `itemFk` int(11) NOT NULL, - `quantity` int(10) unsigned NOT NULL DEFAULT 0, - PRIMARY KEY (`itemFk`), - CONSTRAINT `itemRepo_fk1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='almacena los cambios realizados de unos items por otros, cuando faltaban los primeros'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -34311,20 +29754,14 @@ DROP TABLE IF EXISTS `itemShelving`; CREATE TABLE `itemShelving` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `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', - `visible` 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', + `shelvingFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `visible` int(11) NOT NULL DEFAULT 0, + `created` timestamp NOT NULL DEFAULT current_timestamp(), `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', + `packagingFk` varchar(10) DEFAULT NULL, `userFk` int(10) unsigned DEFAULT NULL, - `stars` int(11) DEFAULT NULL, + `isChecked` tinyint(1) DEFAULT NULL COMMENT 'Este valor cambia al escanear un carro. True: Existe. False: Nuevo. Null: No escaneado', PRIMARY KEY (`id`), KEY `itemShelving_fk1_idx` (`itemFk`), KEY `itemShelving_fk2_idx` (`shelvingFk`), @@ -34333,7 +29770,7 @@ CREATE TABLE `itemShelving` ( CONSTRAINT `itemShelving_fk1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelving_fk2` FOREIGN KEY (`shelvingFk`) REFERENCES `shelving` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelving_fk3` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla utilizada para localizar los artículos dentro de los carros. Usado para la gestión del almacén en el altillo '; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tabla utilizada para localizar los artículos dentro de los carros. Usado para la gestión del almacén en el 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 */ ; @@ -34348,10 +29785,10 @@ DELIMITER ;; BEFORE INSERT ON `itemShelving` FOR EACH ROW BEGIN - - SET NEW.userFk = account.userGetId(); - + SET NEW.userFk = account.myUser_getId(); + + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -34377,8 +29814,7 @@ INSERT INTO vn.itemShelvingLog( itemShelvingFk, shelvingFk, visible, `grouping`, - packing, - stars) + packing) VALUES( NEW.id, NEW.userFk, 'CREA REGISTRO', @@ -34386,8 +29822,7 @@ INSERT INTO vn.itemShelvingLog( itemShelvingFk, NEW.shelvingFk, NEW.visible, NEW.`grouping`, - NEW.packing, - NEW.stars + NEW.packing ) */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -34407,7 +29842,7 @@ DELIMITER ;; BEFORE UPDATE ON `itemShelving` FOR EACH ROW BEGIN - SET NEW.userFk = account.userGetId(); + SET NEW.userFk = account.myUser_getId(); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -34433,17 +29868,15 @@ INSERT INTO vn.itemShelvingLog( itemShelvingFk, shelvingFk, visible, `grouping`, - packing, - stars) + packing) VALUES( NEW.id, - account.userGetId(), + account.myUser_getId(), 'CAMBIO', NEW.itemFk, NEW.shelvingFk, NEW.visible, NEW.`grouping`, - NEW.packing, - NEW.stars + NEW.packing ) */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -34462,13 +29895,13 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_BEFORE_DELETE` BEFORE DELETE ON `itemShelving` FOR EACH ROW -INSERT INTO vn.itemShelvingLog(itemShelvingFk, - workerFk, +INSERT INTO vn.itemShelvingLog(itemShelvingFk, + workerFk, accion, shelvingFk, itemFk) VALUES( OLD.id, - account.userGetId(), + account.myUser_getId(), 'ELIMINADO', OLD.shelvingFk, OLD.itemFk) */;; @@ -34547,9 +29980,9 @@ CREATE TABLE `itemShelvingLog` ( `itemShelvingFk` int(10) unsigned DEFAULT NULL, `workerFk` int(11) DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), - `accion` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + `accion` varchar(20) DEFAULT NULL, `itemFk` int(11) DEFAULT NULL, - `shelvingFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `shelvingFk` varchar(10) DEFAULT NULL, `quantity` int(11) DEFAULT NULL, `visible` int(11) DEFAULT NULL, `available` int(11) DEFAULT NULL, @@ -34558,7 +29991,7 @@ CREATE TABLE `itemShelvingLog` ( `stars` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `itemShelving_Log_FK` (`itemShelvingFk`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -34582,7 +30015,7 @@ CREATE TABLE `itemShelvingPlacementSupply` ( KEY `itemShelvingPlacementSupply_fk3_idx` (`userFk`), CONSTRAINT `itemShelvingPlacementSupply_fk1` FOREIGN KEY (`itemShelvingFk`) REFERENCES `itemShelving` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelvingPlacementSupply_fk2` FOREIGN KEY (`itemPlacementSupplyFk`) REFERENCES `itemPlacementSupply` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de los itemShelving afectados por las ordenes de reposicion de nicho'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Detalle de los itemShelving afectados por las ordenes de reposicion de nicho'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -34631,7 +30064,7 @@ CREATE TABLE `itemShelvingSale` ( 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'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -34648,7 +30081,7 @@ DELIMITER ;; BEGIN UPDATE vn.sale - SET isPicked = TRUE + SET isPicked = TRUE WHERE id = NEW.saleFk; END */;; @@ -34769,18 +30202,19 @@ 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, + `value` varchar(50) NOT NULL, `intValue` int(11) DEFAULT NULL, `priority` int(2) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `itemTagItemUq` (`itemFk`,`tagFk`), + UNIQUE KEY `itemTagItemPriority` (`itemFk`,`priority`), 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -34824,7 +30258,7 @@ trig: BEGIN 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 @@ -34849,7 +30283,7 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_beforeUpdate` BEFORE UPDATE ON `itemTag` FOR EACH ROW -BEGIN +BEGIN IF !(OLD.`value` <=> NEW.`value`) OR !(OLD.intValue <=> NEW.intValue) THEN SET NEW.intValue = itemTag_getIntValue(NEW.`value`); @@ -34882,7 +30316,7 @@ trig: BEGIN 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 @@ -34918,7 +30352,7 @@ trig: BEGIN 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 @@ -34965,7 +30399,7 @@ CREATE TABLE `itemTaxCountry` ( 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'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Define la clase de iva por artículo y pais'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -34997,20 +30431,18 @@ 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, + `id` smallint(5) unsigned NOT NULL, + `code` varchar(3) NOT NULL, + `name` varchar(30) NOT 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, + `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, + `location__` varchar(10) DEFAULT NULL, `life` smallint(5) unsigned DEFAULT NULL, `maneuver` double NOT NULL DEFAULT 0.21, `target` double NOT NULL DEFAULT 0.15, @@ -35019,26 +30451,29 @@ CREATE TABLE `itemType` ( `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, + `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) DEFAULT NULL, + `temperatureFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci 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`), + `isLaid` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Indica si el producto se puede tumbar a efectos del transporte desde Holanda', + `maxRefs` int(10) unsigned DEFAULT NULL COMMENT 'Indica el número máximo de referencias', + `isMergeable` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Articulos que al mergear los tickets se fusionara la linea', + PRIMARY KEY (`id`), UNIQUE KEY `Tipo_UNIQUE` (`name`,`categoryFk`), + UNIQUE KEY `itemType_UN` (`code`), KEY `Trabajador` (`workerFk`), KEY `reino_id` (`categoryFk`), KEY `Tipos_fk3_idx` (`making`), - KEY `warehouseFk5_idx` (`warehouseFk`), + 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.'; + CONSTRAINT `warehouseFk5` FOREIGN KEY (`warehouseFk__`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -35052,21 +30487,17 @@ 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 - + IF NEW.itemPackingTypeFk = '' THEN + SET NEW.itemPackingTypeFk = NULL; - + END IF; - IF NEW.itemPackingTypeFk != OLD.itemPackingTypeFk THEN - - UPDATE vn.item + IF NEW.itemPackingTypeFk != OLD.itemPackingTypeFk THEN + UPDATE vn.item SET itemPackingTypeFk = NEW.itemPackingTypeFk WHERE typeFk = NEW.id; - END IF; END */;; DELIMITER ; @@ -35084,10 +30515,10 @@ DROP TABLE IF EXISTS `itemTypeI18n`; /*!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, + `lang` char(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `name` varchar(255) NOT NULL, PRIMARY KEY (`typeFk`,`lang`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35119,8 +30550,8 @@ CREATE TABLE `itemTypeRestriction` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + CONSTRAINT `itemTypeRestriction_FK` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35140,23 +30571,8 @@ CREATE TABLE `itemTypeTag` ( 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'; + CONSTRAINT `itemTypeTag_FK` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35200,20 +30616,6 @@ SET character_set_client = utf8; ) 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` -- @@ -35223,13 +30625,13 @@ DROP TABLE IF EXISTS `labourTree`; /*!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, + `name` varchar(45) 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35298,8 +30700,9 @@ DROP TABLE IF EXISTS `ledgerConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ledgerConfig` ( `lastBookEntry` int(11) NOT NULL, + `maxTolerance` decimal(10,2) NOT NULL, PRIMARY KEY (`lastBookEntry`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35314,7 +30717,7 @@ CREATE TABLE `lungSize` ( `size` decimal(5,0) NOT NULL, `dia` date NOT NULL, PRIMARY KEY (`hora`,`size`,`dia`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35326,15 +30729,15 @@ DROP TABLE IF EXISTS `machine`; /*!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, + `plate` varchar(20) DEFAULT NULL, + `serialNumber` varchar(30) DEFAULT NULL, + `maker` varchar(50) DEFAULT NULL, + `model` varchar(20) 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, + `type` varchar(100) DEFAULT NULL, + `use` varchar(100) DEFAULT NULL, `productionYear` int(11) DEFAULT NULL, `photo` blob DEFAULT NULL, `workerFk` int(10) unsigned DEFAULT NULL, @@ -35350,7 +30753,7 @@ CREATE TABLE `machine` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Maquinaria industrial, vehículos y demás elementos amortizables'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -35365,7 +30768,7 @@ DELIMITER ;; BEFORE INSERT ON `machine` FOR EACH ROW BEGIN - + SET NEW.workerFk = vn.getUser(); END */;; @@ -35386,7 +30789,7 @@ 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, + `action` varchar(100) NOT NULL, `value` decimal(10,2) DEFAULT NULL, `workerFk` int(10) unsigned NOT NULL, `dmsFk` int(11) DEFAULT NULL, @@ -35397,7 +30800,7 @@ CREATE TABLE `machineDetail` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35416,7 +30819,7 @@ CREATE TABLE `machineDms` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35437,7 +30840,7 @@ CREATE TABLE `machineWorker` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Registros horarios de vehículos de almacén por empleado'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Registros horarios de vehículos de almacén por empleado'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35451,7 +30854,7 @@ 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35463,22 +30866,26 @@ DROP TABLE IF EXISTS `mail`; /*!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, + `receiver` varchar(255) DEFAULT NULL, + `sender` varchar(255) DEFAULT NULL, + `replyTo` varchar(50) DEFAULT NULL, + `subject` varchar(100) NOT NULL, + `body` text 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 DEFAULT NULL, + `attachment` varchar(100) DEFAULT NULL, + `status` varchar(255) NOT NULL DEFAULT 'OK', + `senderFk` int(10) unsigned DEFAULT NULL, + `recipientFk` int(10) unsigned DEFAULT NULL, + `plainTextBody` text DEFAULT NULL, PRIMARY KEY (`id`), KEY `sent_idx` (`sent`), - KEY `creation_idx` (`creationDate`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + KEY `creation_idx` (`creationDate`), + KEY `mail_FK_1` (`recipientFk`), + KEY `mail_FK` (`senderFk`), + CONSTRAINT `mail_FK` FOREIGN KEY (`senderFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE, + CONSTRAINT `mail_FK_1` FOREIGN KEY (`recipientFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -35495,9 +30902,9 @@ DELIMITER ;; BEGIN IF NEW.sender IS NOT NULL THEN - + SET NEW.receiver = NEW.sender; - + END IF; END */;; @@ -35516,10 +30923,10 @@ DROP TABLE IF EXISTS `mailTemplates`; /*!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, + `name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `attachmentPath` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35533,7 +30940,7 @@ 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, + `code` varchar(32) DEFAULT NULL, `created` timestamp NULL DEFAULT current_timestamp(), `finished` timestamp NULL DEFAULT NULL, `mandateTypeFk` smallint(5) NOT NULL, @@ -35544,7 +30951,7 @@ CREATE TABLE `mandate` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -35560,8 +30967,8 @@ DELIMITER ;; FOR EACH ROW BEGIN IF (NEW.code IS NULL) THEN - SET NEW.code=CONCAT(NEW.clientFk,'-',(SELECT AUTO_INCREMENT - FROM information_schema.TABLES + SET NEW.code=CONCAT(NEW.clientFk,'-',(SELECT AUTO_INCREMENT + FROM information_schema.TABLES WHERE TABLE_SCHEMA='vn' and TABLE_NAME='mandate')); END IF; END */;; @@ -35580,9 +30987,9 @@ DROP TABLE IF EXISTS `mandateType`; /*!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, + `name` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35594,12 +31001,102 @@ DROP TABLE IF EXISTS `manuscript`; /*!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 DEFAULT NULL, + `code` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `description` text DEFAULT NULL, `enabled` tinyint(1) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mdbApp` +-- + +DROP TABLE IF EXISTS `mdbApp`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mdbApp` ( + `app` varchar(100) NOT NULL, + `baselineBranchFk` varchar(255) NOT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + `locked` datetime DEFAULT NULL, + PRIMARY KEY (`app`), + KEY `mdbApp_FK` (`userFk`), + KEY `mdbApp_FK_1` (`baselineBranchFk`), + CONSTRAINT `mdbApp_FK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `mdbApp_FK_1` FOREIGN KEY (`baselineBranchFk`) REFERENCES `mdbBranch` (`name`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mdbBranch` +-- + +DROP TABLE IF EXISTS `mdbBranch`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mdbBranch` ( + `name` varchar(255) NOT NULL DEFAULT '', + `dsName` varchar(255) DEFAULT NULL, + PRIMARY KEY (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mdbConfig` +-- + +DROP TABLE IF EXISTS `mdbConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mdbConfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `issueTrackerUrl` varchar(255) NOT NULL, + `issueNumberRegex` varchar(255) NOT NULL, + `chatDestination` varchar(255) NOT NULL COMMENT 'User (@) or channel (#) to send the message', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration parameters for Access'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mdbVersion` +-- + +DROP TABLE IF EXISTS `mdbVersion`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mdbVersion` ( + `app` varchar(255) NOT NULL, + `branchFk` varchar(255) NOT NULL, + `version` int(11) DEFAULT NULL, + PRIMARY KEY (`app`,`branchFk`), + KEY `mdbVersion_branchFk` (`branchFk`), + CONSTRAINT `mdbVersion_branchFk` FOREIGN KEY (`branchFk`) REFERENCES `mdbBranch` (`name`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mdbVersionTree` +-- + +DROP TABLE IF EXISTS `mdbVersionTree`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mdbVersionTree` ( + `app` varchar(255) NOT NULL, + `version` int(10) unsigned NOT NULL, + `branchFk` varchar(255) NOT NULL, + `fromVersion` int(10) unsigned NOT NULL, + `userFk` int(10) unsigned NOT NULL, + `description` text DEFAULT NULL, + `created` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`app`,`version`), + KEY `mdbVersionTree_FK` (`userFk`), + KEY `mdbVersionTree_FK_2` (`branchFk`), + CONSTRAINT `mdbVersionTree_FK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE, + CONSTRAINT `mdbVersionTree_FK_2` FOREIGN KEY (`branchFk`) REFERENCES `mdbBranch` (`name`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35611,9 +31108,9 @@ DROP TABLE IF EXISTS `medicalCenter`; /*!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, + `name` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35628,17 +31125,17 @@ CREATE TABLE `medicalReview` ( `workerFk` int(10) unsigned NOT NULL, `centerFk` int(11) NOT NULL, `date` date DEFAULT NULL, - `time` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, + `time` varchar(5) 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 DEFAULT NULL, + `invoice` varchar(10) DEFAULT NULL, + `remark` longtext DEFAULT NULL, 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35650,16 +31147,16 @@ DROP TABLE IF EXISTS `message`; /*!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 DEFAULT NULL, + `uuid` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `sender` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `recipient` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `message` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `sendDate` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `sender` (`sender`), KEY `recipient` (`recipient`), KEY `uuid` (`uuid`(8)) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35671,17 +31168,17 @@ DROP TABLE IF EXISTS `messageInbox`; /*!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 DEFAULT NULL, + `uuid` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `sender` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `recipient` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `finalRecipient` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `message` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `sendDate` timestamp NULL DEFAULT current_timestamp(), - `read` varchar(45) CHARACTER SET utf8 NOT NULL DEFAULT '0', + `read` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `uuid` (`uuid`(8)), KEY `finalRecipient` (`finalRecipient`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35733,9 +31230,9 @@ DROP TABLE IF EXISTS `mistakeType`; /*!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, + `description` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35747,11 +31244,15 @@ DROP TABLE IF EXISTS `mobileAppVersionControl`; /*!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, + `appName` varchar(45) DEFAULT NULL, + `version` varchar(45) NOT NULL DEFAULT '0', + `isVersionCritical` tinyint(1) DEFAULT 0, + `urlProduction` varchar(100) DEFAULT NULL, + `urlBeta` varchar(100) DEFAULT NULL, + `versionBeta` varchar(45) DEFAULT NULL, + `isVersionBetaCritical` tinyint(1) DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla para llevar el control de las Versions de las aplicaciones móvil '; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tabla para llevar el control de las Versions de las aplicaciones móvil '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35768,7 +31269,40 @@ CREATE TABLE `mrw` ( `shipped` date DEFAULT NULL, `price` decimal(10,2) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mrwService` +-- + +DROP TABLE IF EXISTS `mrwService`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mrwService` ( + `agencyModeCodeFk` varchar(45) NOT NULL, + `clientType` int(11) unsigned NOT NULL, + `serviceType` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`agencyModeCodeFk`), + CONSTRAINT `mrwService_agencyModeCodeFk` FOREIGN KEY (`agencyModeCodeFk`) REFERENCES `agencyMode` (`code`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Configuración de los servicios de MRW'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mrwServiceWeekday` +-- + +DROP TABLE IF EXISTS `mrwServiceWeekday`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mrwServiceWeekday` ( + `agencyModeCodeFk` varchar(45) NOT NULL, + `weekdays` set('mon','tue','wed','thu','fri','sat','sun') NOT NULL, + `serviceType` int(11) unsigned NOT NULL, + `params` varchar(255) DEFAULT NULL, + PRIMARY KEY (`agencyModeCodeFk`), + CONSTRAINT `mrwServiceWeekday_agencyModeCodeFk` FOREIGN KEY (`agencyModeCodeFk`) REFERENCES `agencyMode` (`code`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Configuración de los servicios en relación con el día de la semana para MRW'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35788,23 +31322,6 @@ SET character_set_client = utf8; ) 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` -- @@ -35814,15 +31331,15 @@ DROP TABLE IF EXISTS `noticeCategory`; /*!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 DEFAULT NULL, + `keyName` varchar(50) DEFAULT NULL, + `name` varchar(50) NOT NULL, + `subject` varchar(50) DEFAULT NULL, + `description` text DEFAULT NULL, `isEnabled` tinyint(1) NOT NULL DEFAULT 1, `requiredRole` int(11) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `keyName_UNIQUE` (`keyName`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35839,7 +31356,7 @@ CREATE TABLE `noticeSubscription` ( 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35851,11 +31368,11 @@ DROP TABLE IF EXISTS `observationType`; /*!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, + `description` varchar(15) NOT NULL, + `code` varchar(45) 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35866,12 +31383,53 @@ 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, + `code` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `name` varchar(100) DEFAULT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Código de ocupación de la seguridad social'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Código de ocupación de la seguridad social'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `operator` +-- + +DROP TABLE IF EXISTS `operator`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `operator` ( + `workerFk` int(10) unsigned NOT NULL, + `numberOfWagons` int(11) DEFAULT 1, + `trainFk` int(11) NOT NULL DEFAULT 1, + `itemPackingTypeFk` varchar(1) NOT NULL DEFAULT 'H', + `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 60, + PRIMARY KEY (`workerFk`), + KEY `operator_FK` (`workerFk`), + KEY `operator_FK_1` (`trainFk`), + KEY `operator_FK_2` (`itemPackingTypeFk`), + KEY `operator_FK_3` (`warehouseFk`), + CONSTRAINT `operator_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `operator_FK_1` FOREIGN KEY (`trainFk`) REFERENCES `train` (`id`) ON UPDATE CASCADE, + CONSTRAINT `operator_FK_2` FOREIGN KEY (`itemPackingTypeFk`) REFERENCES `itemPackingType` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `operator_FK_3` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `operatorWorkerCode` +-- + +DROP TABLE IF EXISTS `operatorWorkerCode`; +/*!50001 DROP VIEW IF EXISTS `operatorWorkerCode`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `operatorWorkerCode` ( + `workerFk` tinyint NOT NULL, + `fullName` tinyint NOT NULL, + `code` tinyint NOT NULL, + `numberOfWagons` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `orderTicket` -- @@ -35886,7 +31444,7 @@ CREATE TABLE `orderTicket` ( 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35898,18 +31456,16 @@ DROP TABLE IF EXISTS `origin`; /*!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, + `code` varchar(3) NOT NULL, + `name` varchar(20) NOT NULL, `warehouseFk` smallint(5) unsigned DEFAULT 4, - `flag` blob DEFAULT NULL, - `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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35921,10 +31477,10 @@ DROP TABLE IF EXISTS `originI18n`; /*!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, + `lang` char(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `name` varchar(255) NOT NULL, PRIMARY KEY (`originFk`,`lang`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35941,6 +31497,33 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `osTicketConfig` +-- + +DROP TABLE IF EXISTS `osTicketConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `osTicketConfig` ( + `id` int(11) NOT NULL, + `host` varchar(100) DEFAULT NULL, + `user` varchar(100) DEFAULT NULL, + `password` varchar(100) DEFAULT NULL, + `oldStatus` varchar(100) DEFAULT NULL, + `newStatusId` int(11) DEFAULT NULL, + `day` int(11) DEFAULT NULL, + `comment` varchar(100) DEFAULT NULL, + `hostDb` varchar(100) DEFAULT NULL, + `userDb` varchar(100) DEFAULT NULL, + `passwordDb` varchar(100) DEFAULT NULL, + `portDb` int(11) DEFAULT NULL, + `responseType` varchar(100) DEFAULT NULL, + `fromEmailId` int(11) DEFAULT NULL, + `replyTo` varchar(100) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `outgoingInvoiceVat` -- @@ -35954,7 +31537,7 @@ CREATE TABLE `outgoingInvoiceVat` ( `equalizationTax` decimal(12,2) DEFAULT NULL, `Vat` decimal(12,2) DEFAULT NULL, PRIMARY KEY (`outgoingInvoice`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35970,7 +31553,7 @@ CREATE TABLE `packageChecked` ( PRIMARY KEY (`id`), UNIQUE KEY `entryFk_UNIQUE` (`itemFk`), KEY `fkItem_idx` (`itemFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -35981,13 +31564,13 @@ 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, + `packagingFk` varchar(10) NOT NULL, + `equivalentFk` varchar(10) 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'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */; -- @@ -36012,7 +31595,7 @@ 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, + `id` varchar(10) NOT NULL, `volume` decimal(10,2) DEFAULT 0.00, `width` decimal(10,2) DEFAULT 0.00, `depth` decimal(10,2) DEFAULT 0.00, @@ -36023,13 +31606,13 @@ CREATE TABLE `packaging` ( `packagingReturnFk` int(11) DEFAULT NULL, `lower` int(11) DEFAULT NULL, `upload` int(11) DEFAULT NULL, - `base` decimal(10,2) DEFAULT NULL, + `base` decimal(10,2) NOT NULL DEFAULT 0.00, `itemFk` int(11) DEFAULT NULL, - `price` decimal(10,2) NOT NULL, + `price` decimal(10,2) NOT NULL DEFAULT 0.00, `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, + `cmrName` varchar(45) 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, @@ -36039,11 +31622,53 @@ CREATE TABLE `packaging` ( KEY `packaging_fk1` (`itemFk`), KEY `packaging_fk2_idx` (`freightItemFk`), KEY `packaging_FK` (`conveyorBuildingClassFk`), + KEY `packaging_FK_1` (`packagingReturnFk`), CONSTRAINT `packaging_FK` FOREIGN KEY (`conveyorBuildingClassFk`) REFERENCES `conveyorBuildingClass` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `packaging_FK_1` FOREIGN KEY (`packagingReturnFk`) REFERENCES `returnBuckets` (`id`) 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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`.`packaging_beforeInsert` + BEFORE INSERT ON `packaging` + FOR EACH ROW +BEGIN + SET NEW.value = packaging_calculate(NEW.isPackageReturnable, NEW.packagingReturnFk, NEW.base, NEW.price, NEW.upload); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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`.`packaging_beforeUpdate` + BEFORE UPDATE ON `packaging` + FOR EACH ROW +BEGIN + SET NEW.value = packaging_calculate(NEW.isPackageReturnable, NEW.packagingReturnFk, NEW.base, NEW.price, NEW.upload); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `packagingConfig` @@ -36057,8 +31682,11 @@ CREATE TABLE `packagingConfig` ( `upperGap` int(11) NOT NULL, `previousPreparationMinimumSize` int(11) NOT NULL, `defaultConveyorBuildingClass` int(11) NOT NULL, + `palletPackaging` varchar(10) DEFAULT 'pallet USA', + `carryPackaging` varchar(10) DEFAULT 'cc', + `freightItemPackaging` int(11) DEFAULT 71, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Altura mínima para preparar pedidos en preparacion previa'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Altura mínima para preparar pedidos en preparacion previa'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36070,7 +31698,7 @@ DROP TABLE IF EXISTS `packagingGifts`; /*!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, + `description` varchar(255) NOT NULL, `photo` blob DEFAULT NULL, `started` date NOT NULL, `ended` date NOT NULL, @@ -36084,7 +31712,39 @@ CREATE TABLE `packagingGifts` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `packagingWithFreight` +-- + +DROP TABLE IF EXISTS `packagingWithFreight`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `packagingWithFreight` ( + `packagingFk` varchar(10) NOT NULL, + `priority` int(11) NOT NULL, + PRIMARY KEY (`packagingFk`), + UNIQUE KEY `packagingWithFreight_UN` (`priority`), + CONSTRAINT `packagingWithFreight_FK` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Embalajes con porte para encajado'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `packagingWithoutFreight` +-- + +DROP TABLE IF EXISTS `packagingWithoutFreight`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `packagingWithoutFreight` ( + `packagingFk` varchar(10) NOT NULL, + `priority` int(11) NOT NULL, + PRIMARY KEY (`packagingFk`), + UNIQUE KEY `packagingWithoutFreight_UN` (`priority`), + CONSTRAINT `packagingWithoutFreight_FK` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Embalajes sin porte para encajar'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36096,16 +31756,37 @@ DROP TABLE IF EXISTS `packingSite`; /*!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, + `code` varchar(10) DEFAULT NULL, `hostFk` int(11) NOT NULL, `printerFk` tinyint(3) unsigned DEFAULT NULL, + `collectionFk` int(11) DEFAULT NULL COMMENT 'Last collection packed on this site', + `monitorId` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `packingSite_UN` (`code`), KEY `packingSite_FK_1` (`printerFk`), KEY `packingSite_FK` (`hostFk`), + KEY `packingSite_FK_2` (`collectionFk`), 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; + CONSTRAINT `packingSite_FK_1` FOREIGN KEY (`printerFk`) REFERENCES `printer` (`id`), + CONSTRAINT `packingSite_FK_2` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `packingSiteConfig` +-- + +DROP TABLE IF EXISTS `packingSiteConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `packingSiteConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `shinobiUrl` varchar(255) NOT NULL, + `shinobiToken` varchar(255) NOT NULL, + `shinobiGroupKey` varchar(255) NOT NULL, + `avgBoxingTime` int(3) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36117,13 +31798,13 @@ DROP TABLE IF EXISTS `packingSiteLog`; /*!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, + `packingSiteFk` varchar(10) DEFAULT NULL, + `hostFk` varchar(15) 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, + `printerModelFk` varchar(50) DEFAULT NULL, + `typeErrorFk` varchar(30) DEFAULT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), - `description` text COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `packingSiteLog_UN` (`id`), KEY `packingSiteLog_FK` (`workerFk`), @@ -36134,7 +31815,7 @@ CREATE TABLE `packingSiteLog` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36145,10 +31826,25 @@ 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, + `code` varchar(30) NOT NULL, + `description` varchar(100) DEFAULT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `paperSize` +-- + +DROP TABLE IF EXISTS `paperSize`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `paperSize` ( + `code` varchar(100) NOT NULL, + `color` varchar(100) NOT NULL, + `alias` varchar(100) NOT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36160,16 +31856,16 @@ DROP TABLE IF EXISTS `parking`; /*!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 '--', + `column` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '--', + `row` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '--', `sectorFk` int(11) NOT NULL DEFAULT 2, - `code` varchar(8) CHARACTER SET utf8 DEFAULT NULL, + `code` varchar(8) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci 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'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -36208,7 +31904,7 @@ DELIMITER ;; BEGIN -- SET new.`code` = CONCAT(new.`column`,' - ',new.`row`) ; - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -36225,9 +31921,9 @@ DROP TABLE IF EXISTS `payDem`; /*!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, + `payDem` varchar(15) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36241,7 +31937,7 @@ 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36253,9 +31949,9 @@ DROP TABLE IF EXISTS `payMethod`; /*!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, + `code` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `name` varchar(20) NOT NULL, + `solution` varchar(1) DEFAULT NULL, `outstandingDebt` tinyint(3) unsigned zerofill NOT NULL DEFAULT 000, `graceDays` int(11) unsigned NOT NULL DEFAULT 0, `isIbanRequiredForClients` tinyint(3) DEFAULT 0, @@ -36264,7 +31960,7 @@ CREATE TABLE `payMethod` ( `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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36284,11 +31980,10 @@ CREATE TABLE `payment` ( `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, + `concept` varchar(30) 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`), @@ -36296,7 +31991,6 @@ CREATE TABLE `payment` ( 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`), @@ -36306,7 +32000,7 @@ CREATE TABLE `payment` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -36335,13 +32029,13 @@ BEGIN 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, @@ -36367,7 +32061,7 @@ BEGIN cuenta_banco CONTRA, NEW.amount EURODEBE, 0 EUROHABER) gf; - + IF NEW.bankingFees <> 0 THEN INSERT INTO XDiario ( ASIEN, FECHA, @@ -36389,7 +32083,7 @@ BEGIN FROM supplier s JOIN country c ON s.countryFk = c.id WHERE s.id = NEW.supplierFk; - END IF; + END IF; END IF; SET NEW.dueDated = IFNULL(NEW.dueDated, NEW.received); @@ -36397,15 +32091,15 @@ BEGIN 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 */ ; @@ -36427,12 +32121,12 @@ DELIMITER ;; 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 @@ -36493,7 +32187,7 @@ CREATE TABLE `pcs` ( `pallet` int(11) DEFAULT NULL, `box` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36515,7 +32209,7 @@ CREATE TABLE `pcs_graf` ( PRIMARY KEY (`id`), KEY `pcs_graf_index1` (`hh`), KEY `pcs_graf_index2` (`mm`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36530,7 +32224,7 @@ CREATE TABLE `pedidosInternos` ( `idArticle` int(11) DEFAULT NULL, `quantity` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36541,40 +32235,10 @@ 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, + `code` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `description` varchar(45) 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 DEFAULT NULL, - `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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36591,6 +32255,20 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `personalProtectionEquipment` +-- + +DROP TABLE IF EXISTS `personalProtectionEquipment`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `personalProtectionEquipment` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `pgc` -- @@ -36599,9 +32277,9 @@ 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, + `code` varchar(10) NOT NULL, `rate` decimal(10,2) NOT NULL, - `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `name` varchar(45) DEFAULT NULL, `cplusTaxBreakFk` int(10) unsigned DEFAULT 1, `mod340` tinyint(1) NOT NULL DEFAULT 0, `mod347` tinyint(1) NOT NULL DEFAULT 0, @@ -36612,7 +32290,7 @@ CREATE TABLE `pgc` ( 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'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Plan General Contable'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36623,13 +32301,13 @@ 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', + `vatFk` varchar(10) NOT NULL COMMENT 'Cuenta de IVA', + `equFk` varchar(10) 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'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */; -- @@ -36640,12 +32318,28 @@ 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, + `code` varchar(10) NOT NULL, + `description` varchar(100) DEFAULT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='tan solo tiene las cuentas de contaplus'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='tan solo tiene las cuentas de contaplus'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `phoneBook` +-- + +DROP TABLE IF EXISTS `phoneBook`; +/*!50001 DROP VIEW IF EXISTS `phoneBook`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `phoneBook` ( + `Tipo` tinyint NOT NULL, + `Id` tinyint NOT NULL, + `Cliente` tinyint NOT NULL, + `Telefono` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `plantpassport` -- @@ -36656,14 +32350,14 @@ DROP TABLE IF EXISTS `plantpassport`; CREATE TABLE `plantpassport` ( `producerFk` mediumint(3) unsigned NOT NULL, `plantpassportAuthorityFk` mediumint(3) unsigned NOT NULL, - `number` varchar(25) CHARACTER SET utf8 DEFAULT NULL, + `number` varchar(25) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci 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'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='tiene la asignacion de cada productor con la autoridad certificadora'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36675,13 +32369,13 @@ DROP TABLE IF EXISTS `plantpassportAuthority`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `plantpassportAuthority` ( `id` mediumint(3) unsigned NOT NULL, - `denomination` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `denomination` varchar(45) 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'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='entidades certificadoras'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36692,13 +32386,13 @@ 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, + `code` varchar(30) 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -36808,18 +32502,18 @@ CREATE TABLE `ppe` ( `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, + `account` varchar(10) DEFAULT NULL, + `endowment` varchar(10) DEFAULT NULL, + `elementAccount` varchar(10) DEFAULT NULL, + `nature` varchar(30) DEFAULT NULL, + `location` varchar(10) DEFAULT NULL, `discharged` date DEFAULT NULL, - `cause` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `cause` varchar(45) DEFAULT NULL, `photo` blob DEFAULT NULL, `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, + `description` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), KEY `ppe_fk1_idx` (`workerFk`), KEY `ppe_fk2_idx` (`planFk`), @@ -36828,6 +32522,8 @@ CREATE TABLE `ppe` ( KEY `ppe_fk5_idx` (`account`), KEY `ppe_fk6` (`endowment`), KEY `ppe_fk7` (`elementAccount`), + KEY `ppe_FK` (`location`), + CONSTRAINT `ppe_FK` FOREIGN KEY (`location`) REFERENCES `ppeLocation` (`code`) ON UPDATE CASCADE, 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, @@ -36835,7 +32531,7 @@ CREATE TABLE `ppe` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Property, plant & equipment\nInmvolizado, en español'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Property, plant & equipment\nInmvolizado, en español'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36855,7 +32551,7 @@ CREATE TABLE `ppeComponent` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36874,7 +32570,7 @@ CREATE TABLE `ppeDMS` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36886,9 +32582,23 @@ DROP TABLE IF EXISTS `ppeGroup`; /*!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, + `description` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tipo de inmovilizado'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tipo de inmovilizado'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ppeLocation` +-- + +DROP TABLE IF EXISTS `ppeLocation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ppeLocation` ( + `code` varchar(10) NOT NULL DEFAULT '', + `description` varchar(100) DEFAULT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36903,7 +32613,7 @@ CREATE TABLE `ppePlan` ( `rate` decimal(3,2) NOT NULL DEFAULT 1.00, `days` int(11) NOT NULL DEFAULT 365, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Plan de amortizacion para la tabla ppe'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Plan de amortizacion para la tabla ppe'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -36936,7 +32646,7 @@ CREATE TABLE `priceFixed` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -36990,67 +32700,98 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Table structure for table `printServerQueue` +-- Table structure for table `printQueue` -- -DROP TABLE IF EXISTS `printServerQueue`; +DROP TABLE IF EXISTS `printQueue`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `printServerQueue` ( +CREATE TABLE `printQueue` ( `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, + `priorityFk` tinyint(3) unsigned NOT NULL DEFAULT 3 COMMENT '1 - high, 2 - normal, 3 - low', + `reportFk` tinyint(3) unsigned DEFAULT NULL, + `statusCode` enum('queued','error','printing','printed') NOT NULL DEFAULT 'queued', `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 DEFAULT NULL, - `error` text COLLATE utf8_unicode_ci DEFAULT NULL, + `error` text DEFAULT NULL, + `errorNumber` int(11) DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), - `reportFk__` tinyint(3) unsigned DEFAULT NULL, + `serverId` int(10) unsigned DEFAULT NULL COMMENT 'Indica el id del servidor de impresión', 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; + KEY `statusCode` (`statusCode`), + KEY `printerFk` (`printerFk`), + KEY `priorityFk` (`priorityFk`), + KEY `workerFk` (`workerFk`), + KEY `printQueue_report` (`reportFk`), + CONSTRAINT `printQueue_printerFk` FOREIGN KEY (`printerFk`) REFERENCES `printer` (`id`) ON UPDATE CASCADE, + CONSTRAINT `printQueue_priorityFk` FOREIGN KEY (`priorityFk`) REFERENCES `queuePriority` (`id`) ON UPDATE CASCADE, + CONSTRAINT `printQueue_report` FOREIGN KEY (`reportFk`) REFERENCES `report` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `printServerQueue2` +-- Table structure for table `printQueueArgs` -- -DROP TABLE IF EXISTS `printServerQueue2`; +DROP TABLE IF EXISTS `printQueueArgs`; /*!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 DEFAULT NULL, - `error` text COLLATE utf8_unicode_ci DEFAULT NULL, +CREATE TABLE `printQueueArgs` ( + `printQueueFk` int(10) unsigned NOT NULL, + `name` varchar(255) NOT NULL, + `value` varchar(255) NOT NULL, + PRIMARY KEY (`printQueueFk`,`name`), + KEY `printQueueArgs_printQueueFk_idx` (`printQueueFk`), + CONSTRAINT `printQueueArgs_printQueueFk` FOREIGN KEY (`printQueueFk`) REFERENCES `printQueue` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Argumentos que se pasarán al informe para generarlos'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `printQueueConfig` +-- + +DROP TABLE IF EXISTS `printQueueConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `printQueueConfig` ( + `networkDrive` varchar(10) NOT NULL DEFAULT 'X:\\', + `dmsPath` varchar(45) NOT NULL DEFAULT ' \\\\server\\dms', + `printQueueLimit` int(11) NOT NULL DEFAULT 30 COMMENT 'Número máximo de filas de la cola de impresión a mostrar al enviar correo a través del evento vn.printQueue_check' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `printer` +-- + +DROP TABLE IF EXISTS `printer`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `printer` ( + `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(50) DEFAULT NULL, + `path` varchar(50) DEFAULT NULL, + `modelFk` varchar(50) DEFAULT NULL, + `macWifi` varchar(20) DEFAULT NULL, + `ipAddress` varchar(15) DEFAULT NULL, + `reference` varchar(50) DEFAULT NULL, + `isLabeler` tinyint(1) DEFAULT 0 COMMENT 'Indica si es impresora de etiquetas', + `sectorFk` int(11) DEFAULT NULL, + `paperSizeFk` varchar(100) DEFAULT NULL, 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; + UNIQUE KEY `printer_UN` (`reference`), + UNIQUE KEY `printer_UN1` (`macWifi`), + UNIQUE KEY `printer_UN2` (`name`), + KEY `printer_FK` (`modelFk`), + KEY `printer_sectorFk_idx` (`id`,`sectorFk`), + KEY `printer_sectorFk` (`sectorFk`), + KEY `printer_FK_1` (`paperSizeFk`), + CONSTRAINT `printer_FK` FOREIGN KEY (`modelFk`) REFERENCES `printerModel` (`code`) ON UPDATE CASCADE, + CONSTRAINT `printer_FK_1` FOREIGN KEY (`paperSizeFk`) REFERENCES `paperSize` (`code`), + CONSTRAINT `printer_sectorFk` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37061,51 +32802,8 @@ 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, + `code` varchar(50) 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; - --- --- Temporary table structure for view `printer` --- - -DROP TABLE IF EXISTS `printer`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `printer` ( - `id` tinyint(3) unsigned NOT NULL, - `name` varchar(50) COLLATE utf8mb3_unicode_ci DEFAULT NULL, - `path` varchar(50) COLLATE utf8mb3_unicode_ci DEFAULT NULL, - `modelFk` varchar(50) COLLATE utf8mb3_unicode_ci DEFAULT NULL, - `macWifi` varchar(20) COLLATE utf8mb3_unicode_ci DEFAULT NULL, - `ipAddress` varchar(15) COLLATE utf8mb3_unicode_ci DEFAULT NULL, - `reference` varchar(50) COLLATE utf8mb3_unicode_ci DEFAULT NULL, - `isLabeler` tinyint(1) DEFAULT 0 COMMENT 'Indica si es impresora de etiquetas', - PRIMARY KEY (`id`), - UNIQUE KEY `printer_UN` (`reference`), - UNIQUE KEY `printer_UN1` (`macWifi`), - UNIQUE KEY `printer_UN2` (`name`), - KEY `printer_FK` (`modelFk`), - CONSTRAINT `printer_FK` FOREIGN KEY (`modelFk`) REFERENCES `printerModel` (`code`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -37121,7 +32819,7 @@ CREATE TABLE `printingQueueCheck` ( `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'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Comprueba que el servidor de impresion no esta parado'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37133,12 +32831,12 @@ DROP TABLE IF EXISTS `producer`; /*!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, + `name` varchar(50) 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37149,20 +32847,26 @@ 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', + `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', + `hasUniqueCollectionTime` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Determina si los tickets de una colección deben de tener la misma hora y minuto', + `maxCollectionWithoutUser` int(11) NOT NULL DEFAULT 1 COMMENT 'Número máximo de colecciones que pueden estar sin usuario, haciendo de caché....', + `pendingCollectionsOrder` tinyint(3) unsigned DEFAULT 8, + `pendingCollectionsAge` tinyint(3) unsigned DEFAULT 6, + `maxNotAssignedCollectionLifeTime` time NOT NULL DEFAULT '00:10:00' COMMENT 'Tiempo de vida de las colecciones sin asignar. Cuando se supera son eliminadas', + `maxProductionScopeDays` int(11) NOT NULL DEFAULT 1 COMMENT 'maximo numero de dias en F11', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los parámetros que condicionan la producción'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Recoge los parámetros que condicionan la producción'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37205,31 +32909,12 @@ DROP TABLE IF EXISTS `professionalCategory`; /*!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, + `description` varchar(45) DEFAULT NULL, `salary` decimal(10,2) DEFAULT NULL, `salaryorSeniority` decimal(10,2) DEFAULT NULL, `year` int(2) 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 `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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37241,9 +32926,9 @@ DROP TABLE IF EXISTS `profileType`; /*!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, + `name` varchar(15) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37256,23 +32941,26 @@ DROP TABLE IF EXISTS `project`; 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, + `name` varchar(100) NOT NULL, `photo` blob DEFAULT NULL, `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, + `location` varchar(100) DEFAULT NULL, `amount` decimal(15,2) DEFAULT NULL, + `stateFk` varchar(25) DEFAULT 'open', PRIMARY KEY (`id`), KEY `project_FK` (`userFk`), KEY `project_FK_1` (`departmentFk`), KEY `project_FK_2` (`companyFk`), + KEY `project_FK_3` (`stateFk`), 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla master de proyectos'; + CONSTRAINT `project_FK_2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `project_FK_3` FOREIGN KEY (`stateFk`) REFERENCES `projectState` (`code`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tabla master de proyectos'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37285,7 +32973,7 @@ DROP TABLE IF EXISTS `projectNotes`; 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, + `txt` varchar(255) NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, `projectFk` int(11) NOT NULL, PRIMARY KEY (`id`), @@ -37293,7 +32981,7 @@ CREATE TABLE `projectNotes` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Historico de notas para project'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -37308,11 +32996,11 @@ DELIMITER ;; BEFORE INSERT ON projectNotes FOR EACH ROW BEGIN - + IF ISNULL(NEW.userFk) THEN - + SET NEW.userFk = account.myUser_getId(); - + END IF; END */;; @@ -37322,6 +33010,20 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `projectState` +-- + +DROP TABLE IF EXISTS `projectState`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `projectState` ( + `code` varchar(25) NOT NULL, + `description` varchar(100) NOT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `property` -- @@ -37331,12 +33033,12 @@ DROP TABLE IF EXISTS `property`; /*!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, + `name` varchar(250) NOT NULL, + `cadaster` varchar(200) DEFAULT NULL, `smallholding` int(11) DEFAULT NULL, - `area` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `area` varchar(100) DEFAULT NULL, `townFk` int(11) NOT NULL, - `registry` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, + `registry` varchar(200) DEFAULT NULL, `volume` int(11) DEFAULT NULL, `book` int(11) DEFAULT NULL, `page` int(11) DEFAULT NULL, @@ -37346,11 +33048,13 @@ CREATE TABLE `property` ( `propertyGroupFk` int(11) NOT NULL, `companyFk` smallint(5) unsigned NOT NULL, `photo` blob DEFAULT NULL, - `allocation` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, + `allocation` varchar(200) 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', + `url` varchar(250) DEFAULT NULL, + `protocol` varchar(100) DEFAULT NULL COMMENT 'numero de protocolo notarial de la escritura de compra venta', + `purchased` date NOT NULL DEFAULT util.VN_CURDATE() COMMENT 'date of purchase of the property', + `booked` date DEFAULT NULL COMMENT 'date of completion of property registration', PRIMARY KEY (`id`), KEY `property_FK` (`propertyGroupFk`), KEY `property_FK_1` (`townFk`), @@ -37358,7 +33062,7 @@ CREATE TABLE `property` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37375,9 +33079,9 @@ CREATE TABLE `propertyDms` ( 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` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `propertyDms_FK_1` FOREIGN KEY (`propertyFk`) REFERENCES `property` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37389,9 +33093,9 @@ DROP TABLE IF EXISTS `propertyGroup`; /*!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, + `description` varchar(100) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37404,15 +33108,15 @@ DROP TABLE IF EXISTS `propertyNotes`; 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, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `note` text 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37424,7 +33128,7 @@ DROP TABLE IF EXISTS `province`; /*!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, + `name` varchar(30) 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, @@ -37439,7 +33143,7 @@ CREATE TABLE `province` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -37454,10 +33158,10 @@ DELIMITER ;; 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 */;; @@ -37478,14 +33182,14 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_beforeUpdate` BEFORE UPDATE ON `province` FOR EACH ROW -BEGIN - +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 */ ; @@ -37533,7 +33237,7 @@ DELIMITER ;; AFTER DELETE ON `province` FOR EACH ROW BEGIN - CALL zoneGeo_delete(OLD.geoFk); + CALL zoneGeo_delete(OLD.geoFk); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -37553,7 +33257,7 @@ CREATE TABLE `punchState` ( `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'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Table for storing punches that have cars with errors'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37565,9 +33269,10 @@ DROP TABLE IF EXISTS `queuePriority`; /*!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, + `priority` varchar(50) DEFAULT NULL, + `code` varchar(6) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37580,41 +33285,9 @@ DROP TABLE IF EXISTS `rankBonus`; CREATE TABLE `rankBonus` ( `rank` int(11) DEFAULT NULL, `bonus` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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` -- @@ -37633,7 +33306,7 @@ CREATE TABLE `rate` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37650,7 +33323,7 @@ CREATE TABLE `rateConfig` ( `rate2` int(11) DEFAULT NULL, `rate3` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37662,9 +33335,8 @@ DROP TABLE IF EXISTS `receipt`; /*!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', + `invoiceFk` varchar(50) 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, @@ -37683,7 +33355,7 @@ CREATE TABLE `receipt` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -37705,7 +33377,7 @@ BEGIN FROM accounting a JOIN accountingType at2 ON at2.id = a.accountingTypeFk WHERE a.id = NEW.bankFk; - + SET NEW.isConciliate = vIsAutoConciliated; END IF; END */;; @@ -37810,18 +33482,20 @@ DROP TABLE IF EXISTS `recipe`; 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, + `name` varchar(50) 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, + `longName` varchar(50) 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, + `element` varchar(45) DEFAULT NULL, + `inkFk` varchar(3) DEFAULT NULL, PRIMARY KEY (`id`), KEY `recipe_ix_1` (`element`), - KEY `recipe_ix_2` (`itemFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + KEY `recipe_ix_2` (`itemFk`), + KEY `recipe_FK` (`inkFk`), + CONSTRAINT `recipe_FK` FOREIGN KEY (`inkFk`) REFERENCES `ink` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37834,13 +33508,15 @@ DROP TABLE IF EXISTS `recipe_log`; 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, + `element` varchar(45) 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena las decisiones tomadas al generar recetas'; + KEY `recipe_log_ix3` (`selected_ItemFk`), + CONSTRAINT `recipe_log_FK` FOREIGN KEY (`recipe_ItemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE, + CONSTRAINT `recipe_log_FK_1` FOREIGN KEY (`selected_ItemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Almacena las decisiones tomadas al generar recetas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37861,7 +33537,7 @@ CREATE TABLE `recovery` ( 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 '; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='En esta tabla apuntaremos los acuerdos de recobro semanal a '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37872,13 +33548,13 @@ 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, + `dated` date NOT NULL DEFAULT current_timestamp(), `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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37894,7 +33570,7 @@ CREATE TABLE `referenceRate` ( `value` float unsigned NOT NULL, PRIMARY KEY (`currencyFk`,`dated`), KEY `date` (`dated`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37907,7 +33583,66 @@ DROP TABLE IF EXISTS `referenceRateConfig`; CREATE TABLE `referenceRateConfig` ( `simulatedValue` float unsigned NOT NULL DEFAULT 1.2309, PRIMARY KEY (`simulatedValue`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `report` +-- + +DROP TABLE IF EXISTS `report`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `report` ( + `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(50) DEFAULT NULL, + `paperSizeFk` varchar(100) DEFAULT NULL, + `method` varchar(255) DEFAULT NULL COMMENT 'Salix method', + PRIMARY KEY (`id`), + KEY `report_FK` (`paperSizeFk`), + CONSTRAINT `report_FK` FOREIGN KEY (`paperSizeFk`) REFERENCES `paperSize` (`code`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `returnBuckets` +-- + +DROP TABLE IF EXISTS `returnBuckets`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `returnBuckets` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `freightContainerType` varchar(15) NOT NULL, + `freightPackagingEmpty` double NOT NULL DEFAULT 0, + `freightPackagingFull` double NOT NULL DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `roadmap` +-- + +DROP TABLE IF EXISTS `roadmap`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `roadmap` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `tractorPlate` varchar(10) DEFAULT NULL, + `trailerPlate` varchar(12) DEFAULT NULL, + `phone` varchar(15) DEFAULT NULL, + `supplierFk` int(11) DEFAULT NULL, + `etd` datetime DEFAULT NULL, + `observations` varchar(255) DEFAULT NULL, + `created` timestamp NULL DEFAULT current_timestamp(), + `userFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `supplierFk` (`supplierFk`), + KEY `userFk` (`userFk`), + CONSTRAINT `roadmap_ibfk_1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `roadmap_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -37941,18 +33676,19 @@ CREATE TABLE `route` ( `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, + `kmStart` mediumint(9) DEFAULT NULL, + `kmEnd` mediumint(9) DEFAULT 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 DEFAULT NULL, + `description` text DEFAULT NULL, `zoneFk` int(11) DEFAULT NULL, `priority` int(11) NOT NULL DEFAULT 0, `invoiceInFk` mediumint(8) unsigned DEFAULT NULL, `beachFk` int(11) DEFAULT NULL, + `commissionWorkCenterFk` int(11) DEFAULT NULL COMMENT 'WorkerCenter que gestiona la ruta', PRIMARY KEY (`id`), KEY `Id_Agencia` (`agencyModeFk`), KEY `Fecha` (`created`), @@ -37961,12 +33697,14 @@ CREATE TABLE `route` ( KEY `fk_route_1_idx` (`zoneFk`), KEY `asdfasdf_idx` (`invoiceInFk`), KEY `route_idxIsOk` (`isOk`), + KEY `route_WorkCenterFk_idx` (`commissionWorkCenterFk`), CONSTRAINT `fk_route_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `route_WorkCenterFk` FOREIGN KEY (`commissionWorkCenterFk`) REFERENCES `workCenter` (`id`) 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -37977,13 +33715,35 @@ CREATE TABLE `route` ( /*!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` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_beforeInsert` + BEFORE INSERT ON `route` + FOR EACH ROW +BEGIN + SET NEW.commissionWorkCenterFk = ( + SELECT IFNULL(b.workCenterFK, r.defaultWorkCenterFk) + FROM vn.routeConfig r + LEFT JOIN vn.business b ON b.workerFk = account.myUser_getId() + AND NEW.created BETWEEN b.started AND IFNULL(b.ended, NEW.created)); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_afterInsert` 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; + CALL route_calcCommission(NEW.id); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -38003,16 +33763,26 @@ DELIMITER ;; BEFORE UPDATE ON `route` FOR EACH ROW BEGIN + DECLARE vKmMax INT; + 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 + 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; + + SELECT kmMax INTO vKmMax + FROM routeConfig rc; + + IF ((NEW.kmEnd - NEW.kmStart) > vKmMax) AND NEW.kmEnd <> 0 THEN + CALL util.throw (CONCAT('The km can not exceed ', vKmMax)); + END IF; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -38032,19 +33802,29 @@ DELIMITER ;; 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 + -- Update del firmado + UPDATE ticket t + JOIN ticketDms tg ON t.id = tg.ticketFk SET isSigned = 1 WHERE t.routeFk = NEW.id; END IF; + + IF !(NEW.kmStart <=> OLD.kmStart) + OR !(NEW.kmEnd <=> OLD.kmEnd) + OR !(NEW.workerFk <=> OLD.workerFk) + OR !(NEW.m3 <=> OLD.m3) + OR !(NEW.agencyModeFk <=> OLD.agencyModeFk)THEN + CALL route_calcCommission(NEW.id); + END IF; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -38061,10 +33841,37 @@ DROP TABLE IF EXISTS `routeAction`; /*!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, + `name` varchar(45) NOT NULL, `price` decimal(10,2) DEFAULT NULL, + `isMainlineDelivered` tinyint(4) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `routeCommission` +-- + +DROP TABLE IF EXISTS `routeCommission`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routeCommission` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `routeFk` int(10) unsigned NOT NULL, + `workCenterFk` int(11) DEFAULT NULL, + `km` decimal(5,2) DEFAULT NULL, + `m3` decimal(5,2) DEFAULT NULL, + `yearlyKm` decimal(5,2) DEFAULT NULL, + `yearlyM3` decimal(5,2) DEFAULT NULL, + `cat4m3` decimal(5,2) DEFAULT NULL, + `cat5m3` decimal(5,2) DEFAULT NULL, + `freelanceYearlyM3` decimal(5,2) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `routeCommission_routeFk_idx` (`routeFk`), + KEY `routeCommission_workCenterFk_idx` (`workCenterFk`), + CONSTRAINT `routeCommission_routeFk` FOREIGN KEY (`routeFk`) REFERENCES `route` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `routeCommission_workCenterFk` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38085,7 +33892,7 @@ CREATE TABLE `routeComplement` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38115,75 +33922,36 @@ CREATE TABLE `routeConfig` ( `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, + `plusCategory1Concept` varchar(45) DEFAULT NULL, + `plusCategory2Concept` varchar(45) DEFAULT NULL, `defaultCompanyFk` smallint(5) unsigned DEFAULT 442, + `kmHeavy` decimal(5,2) DEFAULT NULL COMMENT 'Comisión por kilometro vehículo pesado', + `kmLight` decimal(5,2) DEFAULT NULL COMMENT 'Comisión por kilometro vehículo ligero', + `kmYearly` decimal(5,2) DEFAULT NULL COMMENT 'Comisión por kilometro objetivo anual', + `m3Yearly` decimal(5,2) DEFAULT NULL COMMENT 'Comisión por m3 objetivo anual', + `deliveryM3Cat4` decimal(5,2) DEFAULT NULL COMMENT 'Comisión por m3 repartido Cat.IV', + `deliveryM3Cat5` decimal(5,2) DEFAULT NULL COMMENT 'Comisión por m3 repartido Cat. V', + `plusCat2Fixed` decimal(5,2) DEFAULT NULL COMMENT 'Plus fijo Cat.II vehículo ligero', + `plusCat2Variable` decimal(5,2) DEFAULT NULL COMMENT 'Plus variable Cat.II vehículo ligero', + `plusCat3Fixed` decimal(5,2) DEFAULT NULL COMMENT 'Plus fijo Cat.III vehículo pesado', + `plusCat3Variable` decimal(5,2) DEFAULT NULL COMMENT 'Plus variable Cat.III vehículo pesado', + `distributionCat4M3` decimal(5,2) DEFAULT NULL COMMENT 'Comisión por gestión de la distribución Cat IV', + `distributionCat5M3` decimal(5,2) DEFAULT NULL COMMENT 'Comisión por gestión de la distribución Cat V', + `rateCat4` decimal(5,2) DEFAULT NULL COMMENT 'Ratio aplicado a la media de venta de los repartidores para el cálculo de las comisiones de enrutadores Cat IV', + `rateCat5` decimal(5,2) DEFAULT NULL COMMENT 'Ratio aplicado a la media de venta de los repartidores para el cálculo de las comisiones de enrutadores Cat V', + `freelanceM3` decimal(5,2) DEFAULT NULL COMMENT 'Comisión para enrutadores sobre rutas de autónomos', + `freelanceMinM3` decimal(5,2) DEFAULT NULL COMMENT 'Metros mínimos para considerar las rutas de autónomos', + `mainlineDelivered` decimal(5,2) DEFAULT NULL COMMENT 'Comisión para entregas troncales', + `cutoffDated` date DEFAULT NULL COMMENT 'Fecha a partir de la cual se autoriza calcular la comisión', + `defaultWorkCenterFk` int(11) DEFAULT 9 COMMENT 'Para el cálculo de las comisiones, en caso de el creador de la ruta no tenga workCenter', + `kmMax` int(11) DEFAULT 4000 COMMENT 'Máximo número de km validos para una ruta', + `truckerBusinessProfessionalCategoryFk` int(11) NOT NULL DEFAULT 42, 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 DEFAULT NULL, - `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=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`.`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` -- @@ -38198,7 +33966,7 @@ CREATE TABLE `routeLoadWorker` ( 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38212,20 +33980,52 @@ 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, + `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), - `description` text CHARACTER SET utf8 DEFAULT NULL, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, - `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` varchar(45) DEFAULT NULL, + `oldInstance` text DEFAULT NULL, + `newInstance` text DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `changedModelValue` varchar(45) 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `routeMaster` +-- + +DROP TABLE IF EXISTS `routeMaster`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routeMaster` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `warehoseFk` smallint(6) unsigned DEFAULT NULL, + `km` int(11) NOT NULL DEFAULT 0, + `packages` int(11) NOT NULL DEFAULT 0, + `vehicleCost` decimal(10,2) NOT NULL DEFAULT 0.00, + `staffCost` decimal(10,2) NOT NULL DEFAULT 0.00, + `vehicle` decimal(10,2) NOT NULL DEFAULT 0.00, + `staff` decimal(10,2) NOT NULL DEFAULT 0.00, + `fuel` int(11) NOT NULL DEFAULT 0, + `freelancers` decimal(10,2) NOT NULL DEFAULT 0.00, + `year` int(11) NOT NULL DEFAULT 0, + `mounth` int(11) NOT NULL DEFAULT 0, + `expense` decimal(10,2) NOT NULL DEFAULT 0.00, + `freelancersPackages` int(11) NOT NULL DEFAULT 0, + `kmCost` decimal(10,2) NOT NULL DEFAULT 0.00, + `packageCost` decimal(10,2) NOT NULL DEFAULT 0.00, + `freelancerPackageCost` decimal(10,2) NOT NULL DEFAULT 0.00, + `created` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `fk_rutas_warehouse_id_idx` (`warehoseFk`), + CONSTRAINT `routeMaster_FK` FOREIGN KEY (`warehoseFk`) REFERENCES `warehouse` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38238,17 +34038,17 @@ DROP TABLE IF EXISTS `routeRecalc`; 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'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='Queue of changed volume to recalc route volumen'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `routeUserPercentage` +-- Table structure for table `routeUserPercentage__` -- -DROP TABLE IF EXISTS `routeUserPercentage`; +DROP TABLE IF EXISTS `routeUserPercentage__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `routeUserPercentage` ( +CREATE TABLE `routeUserPercentage__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `workerFk` int(10) unsigned NOT NULL, `percentage` decimal(10,2) NOT NULL, @@ -38256,7 +34056,7 @@ CREATE TABLE `routeUserPercentage` ( PRIMARY KEY (`id`), KEY `routeUserPercentageFk_idx` (`workerFk`), CONSTRAINT `routeUserPercentageFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38268,15 +34068,15 @@ DROP TABLE IF EXISTS `routesMonitor`; /*!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, + `name` varchar(45) DEFAULT NULL, + `beachFk` varchar(45) 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, + `note` varchar(255) DEFAULT NULL, `dated` date DEFAULT NULL, - `dockFk` int(11) DEFAULT NULL, + `dockFk` varchar(10) DEFAULT NULL, `m3` decimal(10,1) DEFAULT NULL, `priority` int(11) NOT NULL DEFAULT 0, `etd` time DEFAULT NULL, @@ -38286,10 +34086,33 @@ CREATE TABLE `routesMonitor` ( `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; + KEY `routesMonitor_FK_2` (`beachFk`), + KEY `routesMonitor_FK_1` (`dockFk`), + CONSTRAINT `routesMonitor_FK` FOREIGN KEY (`bufferFk`) REFERENCES `srt`.`buffer` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `routesMonitor_FK_1` FOREIGN KEY (`dockFk`) REFERENCES `dock` (`code`) ON UPDATE CASCADE, + CONSTRAINT `routesMonitor_FK_2` FOREIGN KEY (`beachFk`) REFERENCES `beach` (`code`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `routesReduced` +-- + +DROP TABLE IF EXISTS `routesReduced`; +/*!50001 DROP VIEW IF EXISTS `routesReduced`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `routesReduced` ( + `description` tinyint NOT NULL, + `name` tinyint NOT NULL, + `routeFk` tinyint NOT NULL, + `ETD` tinyint NOT NULL, + `bufferFk` tinyint NOT NULL, + `beachFk` tinyint NOT NULL, + `itempackingTypeFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `sale` -- @@ -38301,10 +34124,10 @@ 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, + `concept` varchar(50) DEFAULT NULL, `quantity` decimal(10,2) NOT NULL DEFAULT 0.00, `originalQuantity` double(9,1) DEFAULT NULL, - `price` decimal(10,2) DEFAULT 0.00, + `price` decimal(10,2) NOT NULL 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, @@ -38317,7 +34140,7 @@ CREATE TABLE `sale` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -38332,7 +34155,6 @@ DELIMITER ;; 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; @@ -38340,26 +34162,31 @@ BEGIN CALL stock.log_add('sale', NEW.id, NULL); CALL ticket_requestRecalc(NEW.ticketFk); - IF NEW.quantity > 0 THEN - + IF NEW.quantity > 0 THEN + UPDATE vn.collection c - 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)) + 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 c.itemPackingTypeFk IS NULL) SET c.saleTotalCount = c.saleTotalCount + 1; - + INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id + 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 + WHERE r.isOk = FALSE AND s.id = NEW.id AND r.created >= util.VN_CURDATE() GROUP BY r.id; END IF; + IF NEW.quantity = 0 THEN + CALL util.debugAdd('saleZeroQuantity', + CONCAT('[', user(), ']', ' Inserted sale: ', NEW.id)); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -38379,7 +34206,7 @@ DELIMITER ;; 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; @@ -38390,7 +34217,7 @@ BEGIN IF old.discount > 0 AND NEW.discount = 0 THEN INSERT INTO ticketLog - SET originFk = NEW.ticketFk, userFk = account.myUser_getId(), `action` = 'insert', + 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 */;; @@ -38412,25 +34239,25 @@ DELIMITER ;; AFTER UPDATE ON `sale` FOR EACH ROW BEGIN - DECLARE vIsToSendMail BOOL; + 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 + 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 + 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; @@ -38439,68 +34266,69 @@ BEGIN 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') + SELECT COUNT(*) INTO vIsToSendMail + FROM ticketTracking tt + JOIN vn.state s ON s.id = tt.stateFk + WHERE s.code='PACKED' + AND tt.ticketFk = OLD.ticketFk + AND vUserRole IN ('salesPerson', 'salesTeamBoss') LIMIT 1; - - IF vIsToSendMail THEN + + 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, + '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; + END IF; IF (OLD.quantity > NEW.quantity) THEN INSERT INTO saleComponent(saleFk, componentFk, value) - SELECT NEW.id, cm.id, sc.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.* + 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 + 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 + WHERE r.isOk = FALSE AND s.id = NEW.id AND r.created >= util.VN_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; + + IF NEW.quantity = 0 THEN + CALL util.debugAdd('saleZeroQuantity', + CONCAT('[', user(), ']', ' Updated sale: ', NEW.id)); END IF; END */;; DELIMITER ; @@ -38523,11 +34351,11 @@ DELIMITER ;; BEGIN IF OLD.quantity > 0 THEN INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id + 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 + WHERE r.isOk = FALSE AND s.id = OLD.id AND r.created >= util.VN_CURDATE() GROUP BY r.id; @@ -38550,43 +34378,41 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_afterDelete` AFTER DELETE ON `sale` FOR EACH ROW -BEGIN +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 + SELECT COUNT(*) INTO vIsToSendMail + FROM ticketTracking tt + JOIN vn.state s ON s.id = tt.stateFk + WHERE s.code='PACKED' + AND tt.ticketFk = OLD.ticketFk AND vUserRole IN ('salesPerson', 'salesBoss') - LIMIT 1; + LIMIT 1; - IF vIsToSendMail THEN + 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 - + 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 + 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 ; @@ -38611,7 +34437,7 @@ CREATE TABLE `saleBuy` ( 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -38625,10 +34451,10 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`BEFORE_INSERT` BEFORE INSERT ON `saleBuy` FOR EACH ROW -BEGIN - +BEGIN + SET NEW.workerFk = vn.getUser(); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -38647,13 +34473,13 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleBuy_AI` AFTER INSERT ON `saleBuy` FOR EACH ROW -BEGIN +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 */ ; @@ -38661,21 +34487,6 @@ DELIMITER ; /*!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` -- @@ -38690,7 +34501,7 @@ CREATE TABLE `saleCloned` ( 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38710,7 +34521,7 @@ CREATE TABLE `saleComponent` ( 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38750,7 +34561,7 @@ CREATE TABLE `saleGoal` ( `goal` decimal(10,2) DEFAULT NULL, `goalType` smallint(6) DEFAULT NULL COMMENT 'grado', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38767,7 +34578,7 @@ CREATE TABLE `saleGroup` ( `parkingFk` int(11) DEFAULT NULL, `sectorFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='agrupa lineas de venta'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='agrupa lineas de venta'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38783,31 +34594,28 @@ CREATE TABLE `saleGroupDetail` ( `saleFk` int(11) NOT NULL, `saleGroupFk` int(11) NOT NULL, PRIMARY KEY (`id`), - KEY `saleGroupDetail_FK` (`saleFk`), + UNIQUE KEY `saleGroupDetail_UN` (`saleFk`,`saleGroupFk`), 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='relaciona sale y saleGroup'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='relaciona sale y saleGroup'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `saleItemShelving__` +-- Temporary table structure for view `saleLabel` -- -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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `saleLabel`; +/*!50001 DROP VIEW IF EXISTS `saleLabel`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `saleLabel` ( + `saleFk` tinyint NOT NULL, + `label` tinyint NOT NULL, + `stem` tinyint NOT NULL, + `created` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; -- -- Table structure for table `saleMistake` @@ -38829,7 +34637,7 @@ CREATE TABLE `saleMistake` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38851,24 +34659,6 @@ SET character_set_client = utf8; ) 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` -- @@ -38888,27 +34678,6 @@ SET character_set_client = utf8; ) 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=InnoDB DEFAULT 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` -- @@ -38936,7 +34705,7 @@ CREATE TABLE `saleState` ( 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'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='cahce para el estado de la linea'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -38951,19 +34720,22 @@ CREATE TABLE `saleTracking` ( `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, + `workerFk` int(10) unsigned NOT NULL, + `actionFk__` int(11) DEFAULT 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`), + UNIQUE KEY `saleTracking_UN` (`saleFk`,`workerFk`,`stateFk`), KEY `Id_Movimiento` (`saleFk`), KEY `fgnStateFk_idx` (`stateFk`), KEY `saleTracking_idx5` (`created`), - KEY `saleTracking_fk2_idx` (`actionFk`), + KEY `saleTracking_fk2_idx` (`actionFk__`), + KEY `saleTracking_FK_2` (`workerFk`), 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; + CONSTRAINT `saleTracking_FK` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `saleTracking_FK_1` FOREIGN KEY (`actionFk__`) REFERENCES `ticketTrackingState__` (`id`) ON UPDATE CASCADE, + CONSTRAINT `saleTracking_FK_2` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -38974,45 +34746,18 @@ CREATE TABLE `saleTracking` ( /*!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 - + + IF NEW.isChecked THEN + UPDATE vn.sale s - SET s.isPicked = TRUE + SET s.isPicked = TRUE WHERE s.id = NEW.saleFk AND s.isPicked = 0; - + END IF; END */;; @@ -39114,12 +34859,12 @@ 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 '', + `salesPersonName` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39149,7 +34894,6 @@ SET character_set_client = utf8; `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, @@ -39183,14 +34927,15 @@ DROP TABLE IF EXISTS `sample`; /*!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, + `code` varchar(25) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `description` varchar(105) 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, + `model` varchar(25) DEFAULT NULL COMMENT 'Model name in plural', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39202,30 +34947,29 @@ DROP TABLE IF EXISTS `sector`; /*!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, + `description` varchar(45) 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, + `code` varchar(15) DEFAULT NULL, `isPreviousPrepared` tinyint(1) NOT NULL DEFAULT 0, `isPackagingArea` tinyint(1) NOT NULL DEFAULT 0, - `labelReportFk` tinyint(3) unsigned DEFAULT NULL, + `reportFk` 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, + `itemPackingTypeFk` varchar(1) 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`), + KEY `sector_report` (`reportFk`), + KEY `sector_FK` (`sonFk`,`warehouseFk`), + CONSTRAINT `sector_FK` FOREIGN KEY (`sonFk`, `warehouseFk`) REFERENCES `sector` (`id`, `warehouseFk`) ON UPDATE CASCADE, 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; + CONSTRAINT `sector_report` FOREIGN KEY (`reportFk`) REFERENCES `report` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39245,7 +34989,7 @@ CREATE TABLE `sectorCollection` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Las lineas de preparacion de pedidos por sectores se agrupan bajo el identificador de esta tabla'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */; -- @@ -39265,7 +35009,7 @@ CREATE TABLE `sectorCollectionSaleGroup` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las lineas de venta con la coleccion del sector'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Relaciona las lineas de venta con la coleccion del sector'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39278,9 +35022,9 @@ DROP TABLE IF EXISTS `sectorProductivity`; 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, + `firstName` varchar(50) DEFAULT NULL, + `lastName` varchar(50) DEFAULT NULL, + `sector` varchar(50) DEFAULT NULL, `ticketCount` int(11) DEFAULT NULL, `saleCount` int(11) DEFAULT NULL, `error` int(11) DEFAULT NULL, @@ -39288,7 +35032,7 @@ CREATE TABLE `sectorProductivity` ( `hourWorked` decimal(10,2) DEFAULT NULL, `dated` date DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39310,7 +35054,7 @@ CREATE TABLE `sharingCart` ( 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=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -39328,9 +35072,9 @@ 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 + 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 */;; @@ -39355,14 +35099,14 @@ 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 + 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 + + 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; @@ -39385,9 +35129,9 @@ DELIMITER ;; 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 + 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 ; @@ -39414,7 +35158,7 @@ CREATE TABLE `sharingCartDaily` ( 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'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='para calcular las comisiones de las sustituciones de los comerciales'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39435,7 +35179,7 @@ CREATE TABLE `sharingClient` ( 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=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -39488,7 +35232,8 @@ 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, + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `parkingFk` int(11) DEFAULT NULL, `isPrinted` tinyint(4) NOT NULL DEFAULT 0, `priority` int(11) NOT NULL DEFAULT 0, @@ -39496,12 +35241,13 @@ CREATE TABLE `shelving` ( `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`), + PRIMARY KEY (`id`), + UNIQUE KEY `shelving_UN` (`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'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -39518,9 +35264,9 @@ DELIMITER ;; BEGIN IF NEW.code = "" THEN - + CALL util.throw('NOT_EMPTY_CODE_ALLOWED'); - + END IF; END */;; @@ -39543,23 +35289,12 @@ DELIMITER ;; 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 */ ; @@ -39576,22 +35311,21 @@ DROP TABLE IF EXISTS `shelvingLog`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `shelvingLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `originFk` varchar(10) CHARACTER SET utf8 NOT NULL, + `originFk` int(11) NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, - `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `action` set('insert','update','delete','select') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), - `description` text CHARACTER SET utf8 DEFAULT NULL, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, - `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` varchar(45) DEFAULT NULL, + `oldInstance` text DEFAULT NULL, + `newInstance` text DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `changedModelValue` varchar(45) 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39607,8 +35341,8 @@ CREATE TABLE `silexACL` ( `method` varchar(50) NOT NULL, `role` varchar(20) NOT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `module_UNIQUE` (`module`,`method`,`role`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; + UNIQUE KEY `module_UNIQUE` (`module`,`method`) USING BTREE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39637,7 +35371,7 @@ CREATE TABLE `sinister` ( 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'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Impago de cliente asegurado'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39663,7 +35397,7 @@ CREATE TABLE `sinisterDetail` ( 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39674,13 +35408,13 @@ 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, + `code` varchar(12) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `shelvingFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci 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; + CONSTRAINT `smartTag_FK` FOREIGN KEY (`shelvingFk`) REFERENCES `shelving` (`code`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39692,16 +35426,17 @@ DROP TABLE IF EXISTS `sms`; /*!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, + `senderFk` int(10) unsigned NOT NULL, + `sender` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '693474205', + `destination` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `message` varchar(160) NOT NULL, `statusCode` smallint(9) DEFAULT 0, - `status` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'OK', + `status` varchar(255) DEFAULT 'OK', `created` timestamp NOT NULL DEFAULT current_timestamp(), - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + PRIMARY KEY (`id`), + KEY `sms_FK` (`senderFk`), + CONSTRAINT `sms_FK` FOREIGN KEY (`senderFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39713,13 +35448,11 @@ DROP TABLE IF EXISTS `smsConfig`; /*!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, + `uri` varchar(255) NOT NULL, + `title` varchar(50) NOT NULL, + `apiKey` varchar(50) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='SMS configuration parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='SMS configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39737,7 +35470,7 @@ CREATE TABLE `solunionCAP` ( 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -39753,7 +35486,7 @@ DELIMITER ;; FOR EACH ROW BEGIN UPDATE vn2008.Clientes c - JOIN creditClassification cc ON c.Id_Cliente = cc.client + 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 */;; @@ -39777,12 +35510,12 @@ DELIMITER ;; BEGIN IF NEW.dateLeaving IS NOT NULL THEN UPDATE vn2008.Clientes c - JOIN creditClassification cc ON c.Id_Cliente = cc.client + 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 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; @@ -39806,7 +35539,7 @@ DELIMITER ;; FOR EACH ROW BEGIN UPDATE vn2008.Clientes c - JOIN creditClassification cc ON c.Id_Cliente = cc.client + 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 */;; @@ -39840,7 +35573,24 @@ CREATE TABLE `sorter` ( `palletOrder` int(5) DEFAULT NULL, `lungGrow` int(11) DEFAULT 0, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `specialLabels` +-- + +DROP TABLE IF EXISTS `specialLabels`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `specialLabels` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(100) NOT NULL, + `reportName` varchar(100) NOT NULL, + `isVisible` tinyint(1) NOT NULL DEFAULT 0, + `image` blob DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39860,10 +35610,8 @@ CREATE TABLE `specialPrice` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + CONSTRAINT `sp_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39875,10 +35623,10 @@ DROP TABLE IF EXISTS `specie`; /*!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, + `name` varchar(100) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `specie_UN` (`name`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -39941,7 +35689,29 @@ CREATE TABLE `specieGeoInvasive` ( 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=InnoDB DEFAULT 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'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Esta tabla recoge las prohibiciones de comerciar con especies invasoras de acuerdo con el Catálogo de Especies Exóticas Invasoras publicado por el Estado Español'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `splitFilter` +-- + +DROP TABLE IF EXISTS `splitFilter`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `splitFilter` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `autonomyFk` int(11) DEFAULT NULL, + `clientFk` int(11) DEFAULT NULL, + `nickname` varchar(100) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `splitFilter_UN` (`autonomyFk`), + UNIQUE KEY `splitFilter_UN1` (`clientFk`), + KEY `splitFilter_FK` (`autonomyFk`), + KEY `splitFilter_FK_1` (`clientFk`), + CONSTRAINT `splitFilter_FK` FOREIGN KEY (`autonomyFk`) REFERENCES `autonomy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `splitFilter_FK_1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='define los clientes que tienen split y el nombre a mostrar en la etiqueta'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39954,14 +35724,14 @@ DROP TABLE IF EXISTS `starredModule`; 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, + `moduleFk` varchar(45) 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -39973,27 +35743,45 @@ DROP TABLE IF EXISTS `state`; /*!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, + `name` varchar(20) NOT NULL, `order` tinyint(3) unsigned DEFAULT NULL, `alertLevel` int(11) NOT NULL DEFAULT 0, - `code` varchar(45) CHARACTER SET utf8 NOT NULL, + `code` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci 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, + `nextStateFk` tinyint(3) unsigned 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) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`), KEY `state_id3` (`semaphore`), KEY `alertLevel` (`alertLevel`), + KEY `state_FK` (`nextStateFk`), + CONSTRAINT `state_FK` FOREIGN KEY (`nextStateFk`) REFERENCES `state` (`id`) ON UPDATE CASCADE, CONSTRAINT `state_ibfk_1` FOREIGN KEY (`alertLevel`) REFERENCES `alertLevel` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `stateI18n` +-- + +DROP TABLE IF EXISTS `stateI18n`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `stateI18n` ( + `stateFk` tinyint(3) unsigned NOT NULL, + `lang` char(2) NOT NULL, + `name` varchar(255) NOT NULL, + PRIMARY KEY (`stateFk`,`lang`), + CONSTRAINT `stateI18n_state_id` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40011,11 +35799,11 @@ 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, + `description` varchar(100) 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40030,7 +35818,7 @@ CREATE TABLE `stowaway` ( `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'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tickets polizones y sus naves de embarque'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40042,35 +35830,34 @@ DROP TABLE IF EXISTS `supplier`; /*!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, + `name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_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, + `street` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL, + `city` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_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, + `nif` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_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, + `retAccount` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL, + `phone` varchar(16) CHARACTER SET utf8mb3 COLLATE utf8mb3_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, + `nickname` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL, + `payMethodFk` tinyint(3) unsigned DEFAULT 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 DEFAULT NULL, + `note` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL, `postcodeFk` int(11) unsigned DEFAULT NULL, - `postCode` char(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, - `isActive` tinyint(4) DEFAULT 1, + `postCode` char(8) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL, + `isActive` tinyint(4) NOT NULL 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', + `supplierActivityFk` varchar(45) DEFAULT NULL, `healthRegister` varchar(45) DEFAULT NULL, `isPayMethodChecked` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Se ha validado la forma de pago', PRIMARY KEY (`id`), @@ -40095,35 +35882,53 @@ CREATE TABLE `supplier` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_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 character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = '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 vHasChange BOOL; + DECLARE vPayMethodChanged BOOL; DECLARE vPayMethodHasVerified BOOL; + DECLARE vParams JSON; + DECLARE vOldPayMethodName VARCHAR(20); + DECLARE vNewPayMethodName VARCHAR(20); SELECT hasVerified INTO vPayMethodHasVerified FROM payMethod WHERE id = NEW.payMethodFk; - SET vHasChange = (NEW.payDemFk <> OLD.payDemFk) OR (NEW.payDay <> OLD.payDay); + SET vPayMethodChanged = NOT(NEW.payMethodFk <=> OLD.payMethodFk); - IF vPayMethodHasVerified AND !vHasChange THEN - SET vHasChange = (NEW.payMethodFk <> OLD.payMethodFk); + IF vPayMethodChanged THEN + SELECT name INTO vOldPayMethodName + FROM payMethod + WHERE id = OLD.payMethodFk; + SELECT name INTO vNewPayMethodName + FROM payMethod + WHERE id = NEW.payMethodFk; + + SET vParams = JSON_OBJECT( + 'name', NEW.name, + 'oldPayMethod', vOldPayMethodName, + 'newPayMethod', vNewPayMethodName + ); + SELECT util.notification_send('supplier-pay-method-update', vParams, NULL) INTO @id; END IF; - - IF vHasChange THEN + + SET vHasChange = NOT(NEW.payDemFk <=> OLD.payDemFk AND NEW.payDay <=> OLD.payDay) OR vPayMethodChanged; + + IF vHasChange AND vPayMethodHasVerified THEN SET NEW.isPayMethodChecked = FALSE; END IF; @@ -40143,27 +35948,50 @@ DROP TABLE IF EXISTS `supplierAccount`; /*!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, + `supplierFk` int(11) DEFAULT NULL, + `iban` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `office` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `DC` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `number` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `description` varchar(45) DEFAULT NULL COMMENT 'obsoleta(comprobar)', + `bankEntityFk` int(10) unsigned DEFAULT NULL, `bankFk` int(11) DEFAULT NULL COMMENT 'obsoleta(comprobar)', - `beneficiary` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `beneficiary` varchar(50) 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; + KEY `fk_banco_prov_account_idx` (`bankFk`), + CONSTRAINT `supplierAccount_FK` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `supplierAccount_FK_1` FOREIGN KEY (`bankEntityFk`) REFERENCES `bankEntity` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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`.`supplierAccount_afterInsert` + AFTER INSERT ON `supplierAccount` + FOR EACH ROW +BEGIN + UPDATE vn.supplier + SET isPayMethodChecked = FALSE + WHERE id = NEW.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 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!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' */ ; @@ -40178,7 +36006,7 @@ BEGIN 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 @@ -40191,6 +36019,28 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!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`.`supplierAccount_afterDelete` + AFTER DELETE ON `supplierAccount` + FOR EACH ROW +BEGIN + UPDATE vn.supplier + SET isPayMethodChecked = FALSE + WHERE id = OLD.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 */ ; -- -- Table structure for table `supplierActivity` @@ -40200,10 +36050,10 @@ 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, + `code` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `name` varchar(45) NOT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40216,17 +36066,17 @@ DROP TABLE IF EXISTS `supplierAddress`; 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, + `nickname` varchar(40) DEFAULT NULL, + `street` varchar(255) 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, + `postalCode` varchar(10) DEFAULT NULL, + `city` varchar(50) DEFAULT NULL, + `phone` varchar(15) DEFAULT NULL, + `mobile` varchar(15) DEFAULT NULL, PRIMARY KEY (`id`), KEY `supplierAddress_province_fk` (`provinceFk`), CONSTRAINT `supplierAddress_province_fk` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40250,31 +36100,7 @@ CREATE TABLE `supplierAgencyTerm` ( 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 `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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40287,15 +36113,28 @@ DROP TABLE IF EXISTS `supplierContact`; 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 DEFAULT NULL, - `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `phone` varchar(16) DEFAULT NULL, + `mobile` varchar(16) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `observation` text DEFAULT NULL, + `name` varchar(255) 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `supplierDebtConfig` +-- + +DROP TABLE IF EXISTS `supplierDebtConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supplierDebtConfig` ( + `dated` date NOT NULL DEFAULT '2014-12-31' COMMENT 'date from which we start counting', + `invalidBalances` double NOT NULL DEFAULT 0.5 COMMENT 'balances not to be paid' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40311,7 +36150,7 @@ CREATE TABLE `supplierExpense` ( `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, + `description` varchar(50) 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(), @@ -40328,7 +36167,7 @@ CREATE TABLE `supplierExpense` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40342,20 +36181,20 @@ 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, + `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), - `description` text CHARACTER SET utf8 DEFAULT NULL, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, - `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` varchar(45) DEFAULT NULL, + `oldInstance` text DEFAULT NULL, + `newInstance` text DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `changedModelValue` varchar(45) 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40388,12 +36227,12 @@ 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', + `uuid` varchar(100) NOT NULL, + `name` varchar(45) DEFAULT NULL, + `place` varchar(45) DEFAULT NULL, + `macwifi` varchar(45) DEFAULT '0', PRIMARY KEY (`uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40404,13 +36243,13 @@ 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, + `tabletFk` varchar(100) 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40422,19 +36261,18 @@ DROP TABLE IF EXISTS `tag`; /*!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, + `code` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `name` varchar(25) 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', + `sourceTable` varchar(255) DEFAULT NULL, + `unit` varchar(45) DEFAULT NULL, + `ediTypeFk` varchar(3) DEFAULT NULL, + `overwrite` varchar(45) 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'; + UNIQUE KEY `tagEdiTypeFkIdx` (`ediTypeFk`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -40467,10 +36305,13 @@ 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; + `value` varchar(20) NOT NULL, + `abbreviation` varchar(10) NOT NULL, + `tagFk` int(11) DEFAULT NULL, + PRIMARY KEY (`value`), + KEY `tagAbbreviation_FK` (`tagFk`), + CONSTRAINT `tagAbbreviation_FK` FOREIGN KEY (`tagFk`) REFERENCES `tag` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40482,10 +36323,10 @@ DROP TABLE IF EXISTS `tagI18n`; /*!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, + `lang` char(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `name` varchar(255) NOT NULL, PRIMARY KEY (`tagFk`,`lang`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40510,11 +36351,11 @@ 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, + `code` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `ClaveOperacionFactura` varchar(1) DEFAULT NULL, `CodigoTransaccion` int(2) DEFAULT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40526,11 +36367,11 @@ DROP TABLE IF EXISTS `taxClass`; /*!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', + `description` varchar(30) NOT NULL, + `code` varchar(1) NOT NULL DEFAULT 'R', PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40548,7 +36389,7 @@ CREATE TABLE `taxClassCode` ( 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40561,16 +36402,16 @@ DROP TABLE IF EXISTS `taxCode`; CREATE TABLE `taxCode` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `dated` date NOT NULL, - `code` varchar(10) CHARACTER SET utf8 NOT NULL, + `code` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci 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', + `type` char(1) 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', + `transactionCode` varchar(2) DEFAULT NULL COMMENT 'Código de Transacción de SAGE', + `operationCode` varchar(1) 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`), @@ -40579,7 +36420,7 @@ CREATE TABLE `taxCode` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40591,17 +36432,17 @@ DROP TABLE IF EXISTS `taxType`; /*!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, + `nickname` varchar(6) 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, + `serial` char(1) DEFAULT NULL, + `TIPOOPE` varchar(1) NOT NULL DEFAULT ' ' COMMENT 'respetar el nombre de la columna, se utiliza en contaplus', + `description` varchar(100) 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40612,11 +36453,11 @@ 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 DEFAULT NULL, - `name` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `description` text DEFAULT NULL, + `name` varchar(10) NOT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40627,10 +36468,10 @@ 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, + `id` varchar(45) NOT NULL, + `model` enum('TL30','SENSITECH','TREKVIEW1','TREKVIEW2','DISPOSABLE','TEMPMATE') NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40645,23 +36486,20 @@ CREATE TABLE `ticket` ( `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 DEFAULT NULL, - `refFk` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, - `invoiceOutFk` int(10) unsigned DEFAULT NULL COMMENT 'eliminar', - `isBooked` tinyint(1) NOT NULL DEFAULT 0, + `nickname` varchar(50) DEFAULT NULL, + `refFk` varchar(20) DEFAULT NULL, `addressFk` int(11) NOT NULL DEFAULT 0, `workerFk` int(11) DEFAULT NULL, - `observations` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'eliminar', + `observations` varchar(255) 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, + `location` varchar(15) 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, + `solution` varchar(5) DEFAULT NULL, `routeFk` int(10) unsigned DEFAULT NULL, `priority` tinyint(3) unsigned DEFAULT NULL, `hasPriority` tinyint(1) unsigned NOT NULL DEFAULT 1, @@ -40671,11 +36509,11 @@ CREATE TABLE `ticket` ( `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', + `weight` decimal(10,2) DEFAULT NULL COMMENT 'En caso de informar, se utilizará su valor para calcular el peso de la factura', PRIMARY KEY (`id`), KEY `Id_Cliente` (`clientFk`), KEY `Id_Consigna` (`addressFk`), @@ -40688,7 +36526,6 @@ CREATE TABLE `ticket` ( 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, @@ -40696,28 +36533,27 @@ CREATE TABLE `ticket` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`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 @@ -40729,9 +36565,9 @@ BEGIN SET vStateCode = 'FREE'; END IF; - INSERT INTO vncontrol.inter(Id_Ticket, state_id, Id_Trabajador) - SELECT NEW.id, id, account.myUser_getId() - FROM state + INSERT INTO ticketTracking(ticketFk, stateFk, workerFk) + SELECT NEW.id, id, account.myUser_getId() + FROM state WHERE `code` = vStateCode COLLATE utf8_general_ci; IF YEAR(NEW.shipped) > 2000 THEN @@ -40744,7 +36580,7 @@ BEGIN INSERT INTO bs.clientNewBorn(clientFk, firstShipped, lastShipped) VALUES(NEW.clientFk, IFNULL(vTransferorFirstShipped, util.VN_CURDATE()), util.VN_CURDATE()) ON DUPLICATE KEY UPDATE lastShipped = util.VN_CURDATE(); - + END IF; END */;; @@ -40767,18 +36603,17 @@ DELIMITER ;; FOR EACH ROW BEGIN DECLARE vNewTime TIME; - + IF !(NEW.routeFk <=> OLD.routeFk) THEN - INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id + INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) + SELECT r.id FROM vn.route r - WHERE r.isOk = FALSE + WHERE r.isOk = FALSE AND r.id IN (OLD.routeFk,NEW.routeFk) AND r.created >= util.VN_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' @@ -40790,13 +36625,13 @@ BEGIN END IF; END IF; - + IF !(NEW.isDeleted <=> OLD.isDeleted) AND NEW.isDeleted THEN - INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id + 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 + WHERE r.isOk = FALSE AND t.id = NEW.id AND r.created >= util.VN_CURDATE() GROUP BY r.id; @@ -40806,7 +36641,7 @@ BEGIN SET NEW.zoneFk = NULL; END IF; - IF NEW.routeFk AND NEW.isDeleted THEN + IF NEW.routeFk AND NEW.isDeleted THEN CALL util.throw ('This ticket is deleted'); END IF; @@ -40815,22 +36650,22 @@ BEGIN 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', + 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 + SELECT r.agencyModeFk, NEW.zoneFk FROM route r WHERE r.id = NEW.routeFk; - + CALL vn.routeUpdateM3(NEW.routeFk); END IF; END */;; @@ -40864,17 +36699,25 @@ BEGIN 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) + CONCAT(account.myUser_getName(), ' ha modificado el ticket ',NEW.id) ); END IF; + IF NEW.routeFk <> OLD.routeFk THEN + + UPDATE expedition + SET hasNewRoute = TRUE + WHERE ticketFk = NEW.id; + + END IF; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -40893,11 +36736,11 @@ 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 +BEGIN + INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) + SELECT r.id FROM vn.route r - WHERE r.isOk = FALSE + WHERE r.isOk = FALSE AND r.id = OLD.routeFk AND r.created >= util.VN_CURDATE() GROUP BY r.id; @@ -40926,7 +36769,7 @@ CREATE TABLE `ticketCollection` ( `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, + `smartTagFk` varchar(12) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_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', @@ -40936,44 +36779,45 @@ CREATE TABLE `ticketCollection` ( KEY `ticketCollection_fk2_idx` (`ticketFk`), KEY `ticketCollection_smartTagFk_IDX` (`smartTagFk`) USING BTREE, KEY `ticketCollection_created_IDX` (`created`) USING BTREE, + CONSTRAINT `ticketCollection_FK` FOREIGN KEY (`smartTagFk`) REFERENCES `smartTag` (`code`) ON UPDATE CASCADE, 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_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 - +BEGIN + DECLARE vSalesRemaining INT; SELECT count(*) INTO vSalesRemaining FROM vn.ticketCollection tc - JOIN sale s ON s.ticketFk = tc.ticketFk + 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 + + UPDATE vn.collection SET saleTotalCount = vSalesRemaining WHERE id = OLD.collectionFk; - + END IF; - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -40992,8 +36836,9 @@ 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', + `packagingInvoicingDated` date NOT NULL DEFAULT '2017-11-21' COMMENT 'Fecha desde la cual se gestiona el registro de embalajes de tickets (tabla vn.ticketPackaging)', PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41010,7 +36855,7 @@ CREATE TABLE `ticketDms` ( 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -41025,13 +36870,13 @@ DELIMITER ;; BEFORE DELETE ON `ticketDms` FOR EACH ROW BEGIN - UPDATE dms - SET dmsTypeFk = (SELECT id - FROM dmsType + 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 id = OLD.dmsFk AND ( SELECT IF(COUNT(*) > 0, FALSE, TRUE) + FROM ticketDms WHERE dmsFk = OLD.dmsFk ) ; END */;; @@ -41051,7 +36896,7 @@ DROP TABLE IF EXISTS `ticketDocumentation`; 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)'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */; -- @@ -41073,7 +36918,7 @@ CREATE TABLE `ticketDown` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Cola de impresion para los tickets que se van a solicitar al altillo'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Cola de impresion para los tickets que se van a solicitar al altillo'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41085,34 +36930,12 @@ DROP TABLE IF EXISTS `ticketDown_SelectionType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketDown_SelectionType` ( `id` int(11) NOT NULL, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(45) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `description_UNIQUE` (`description`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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` -- @@ -41123,12 +36946,12 @@ DROP TABLE IF EXISTS `ticketLastState`; CREATE TABLE `ticketLastState` ( `ticketFk` int(11) NOT NULL DEFAULT 0, `ticketTrackingFk` int(11) NOT NULL, - `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(15) 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; + CONSTRAINT `double_foreign` FOREIGN KEY (`ticketFk`, `ticketTrackingFk`) REFERENCES `ticketTracking` (`ticketFk`, `id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41170,22 +36993,50 @@ 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, + `action` set('insert','update','delete','select') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), - `description` text CHARACTER SET utf8 DEFAULT NULL, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, - `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` varchar(45) DEFAULT NULL, + `oldInstance` text DEFAULT NULL, + `newInstance` text DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `changedModelValue` varchar(45) 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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` -- @@ -41215,13 +37066,13 @@ 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, + `description` text 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'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41236,7 +37087,7 @@ CREATE TABLE `ticketPackage` ( `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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41249,7 +37100,7 @@ DROP TABLE IF EXISTS `ticketPackaging`; CREATE TABLE `ticketPackaging` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` int(11) NOT NULL, - `packagingFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + `packagingFk` varchar(10) NOT NULL, `quantity` int(10) DEFAULT 0, `created` timestamp NOT NULL DEFAULT current_timestamp(), `pvp` double DEFAULT NULL, @@ -41261,7 +37112,7 @@ CREATE TABLE `ticketPackaging` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -41295,7 +37146,7 @@ DROP TABLE IF EXISTS `ticketPackagingStartingStock`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketPackagingStartingStock` ( `clientFk` int(11) NOT NULL, - `packagingFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + `packagingFk` varchar(10) NOT NULL, `itemFk` int(11) NOT NULL, `sent` int(11) DEFAULT NULL, `returned` int(11) DEFAULT NULL, @@ -41306,7 +37157,7 @@ CREATE TABLE `ticketPackagingStartingStock` ( 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41350,7 +37201,7 @@ CREATE TABLE `ticketParking` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los distintos lugares donde puede estar aparcado cada uno de los prepedidos'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -41367,7 +37218,7 @@ DELIMITER ;; BEGIN SET NEW.workerFk = vn.getUser(); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -41404,10 +37255,11 @@ DROP TABLE IF EXISTS `ticketRecalc`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketRecalc` ( + `id` int(11) NOT NULL AUTO_INCREMENT, `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'; + PRIMARY KEY (`id`), + KEY `ticketRecalc_ibfk_1` (`ticketFk`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Queue of changed tickets to recalc its total'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41422,38 +37274,26 @@ CREATE TABLE `ticketRefund` ( `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, + KEY `ticketRefund_FK` (`refundTicketFk`), + CONSTRAINT `ticketRefund_FK` FOREIGN KEY (`refundTicketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketRefund_FK_1` FOREIGN KEY (`originalTicketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`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; + CALL ticketRefund_beforeUpsert(NEW.refundTicketFk, NEW.originalTicketFk); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -41463,29 +37303,17 @@ 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 ;; /*!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; + CALL ticketRefund_beforeUpsert(NEW.refundTicketFk, NEW.originalTicketFk); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -41502,21 +37330,18 @@ DROP TABLE IF EXISTS `ticketRequest`; /*!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, + `description` varchar(255) 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', + `salesPersonCode` varchar(3) DEFAULT NULL, + `buyerCode` varchar(3) 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 DEFAULT NULL, - `ok__` tinyint(1) NOT NULL DEFAULT 0, + `response` longtext DEFAULT NULL, `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, @@ -41537,7 +37362,7 @@ CREATE TABLE `ticketRequest` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -41609,7 +37434,7 @@ DROP TABLE IF EXISTS `ticketService`; /*!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, + `description` varchar(45) 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, @@ -41622,7 +37447,7 @@ CREATE TABLE `ticketService` ( 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'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -41639,7 +37464,7 @@ DELIMITER ;; BEGIN CALL ticket_requestRecalc(NEW.ticketFk); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -41703,12 +37528,29 @@ DROP TABLE IF EXISTS `ticketServiceType`; /*!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, + `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL, `expenceFk` varchar(10) NOT NULL DEFAULT '7050000000', PRIMARY KEY (`id`), - KEY `ticketServiceType_expenceFk` (`expenceFk`), + KEY `ticketServiceType_expenceFk_idx` (`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'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Lista de los posibles servicios a elegir'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ticketSms` +-- + +DROP TABLE IF EXISTS `ticketSms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketSms` ( + `smsFk` mediumint(8) unsigned NOT NULL, + `ticketFk` int(11) DEFAULT NULL, + PRIMARY KEY (`smsFk`), + KEY `ticketSms_FK_1` (`ticketFk`), + CONSTRAINT `ticketSms_FK` FOREIGN KEY (`smsFk`) REFERENCES `sms` (`id`) ON UPDATE CASCADE, + CONSTRAINT `ticketSms_FK_1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41756,21 +37598,195 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Temporary table structure for view `ticketTracking` +-- Table structure for table `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; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketTracking` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `stateFk` tinyint(3) unsigned NOT NULL, + `failFk` int(10) unsigned NOT NULL DEFAULT 21, + `notes` varchar(255) DEFAULT NULL, + `created` timestamp NULL DEFAULT current_timestamp(), + `ticketFk` int(11) DEFAULT NULL, + `workerFk` int(11) DEFAULT NULL, + `supervisorFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `currante` (`workerFk`), + KEY `responsable` (`supervisorFk`), + KEY `ticket` (`ticketFk`), + KEY `inter_state` (`stateFk`), + KEY `inter_id` (`ticketFk`,`id`) USING BTREE, + CONSTRAINT `inter_state` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) ON UPDATE CASCADE, + CONSTRAINT `responsable` FOREIGN KEY (`supervisorFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `ticketTracking_ibfk_1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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`.`ticketTracking_beforeInsert` + BEFORE INSERT ON `ticketTracking` + FOR EACH ROW +BEGIN + DECLARE vState VARCHAR(15); + DECLARE vZoneFk INT; + DECLARE vBoardingStateFk INT; + + SELECT s.code INTO vState + FROM state s + WHERE s.id = NEW.stateFk; + + SELECT t.zonefk INTO vZoneFk + FROM ticket t + WHERE t.id = NEW.ticketFk; + + 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 `vn`.`ticketTracking_afterInsert` + AFTER INSERT ON `ticketTracking` + FOR EACH ROW +BEGIN + DECLARE vNumTicketsPrepared INT; + + REPLACE vn.ticketLastState(ticketFk, ticketTrackingFk, name) + SELECT NEW.ticketFk, NEW.id, `name` + FROM state + WHERE id = NEW.stateFk; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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`.`ticketTracking_afterUpdate` + AFTER UPDATE ON `ticketTracking` + FOR EACH ROW +BEGIN + DECLARE vTicketFk INT; + DECLARE vTicketTrackingFk INT; + DECLARE vStateName VARCHAR(15); + + IF NEW.stateFk <> OLD.stateFk THEN + REPLACE vn.ticketLastState(ticketFk, ticketTrackingFk, name) + SELECT NEW.ticketFk, NEW.id, `name` + FROM state + WHERE id = NEW.stateFk; + END IF; + + IF NEW.ticketFk <> OLD.ticketFk THEN + SELECT i.ticketFk, i.id, s.`name` + INTO vTicketFk, vTicketTrackingFk, vStateName + FROM ticketTracking i + JOIN state s ON i.stateFk = s.id + WHERE ticketFk = NEW.ticketFk + ORDER BY created DESC + LIMIT 1; + + IF vTicketFk > 0 THEN + REPLACE INTO 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 `vn`.`ticketTracking_afterDelete` + AFTER DELETE ON `ticketTracking` + 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.ticketFk; + END; + + CALL util.debugAdd('deletedState', + CONCAT('interFk: ', OLD.id, + ' ticketFk: ', OLD.ticketFk, + ' stateFk: ', OLD.stateFk)); + + SELECT i.ticketFk, i.id, s.`name` + INTO vTicketFk, vTicketTrackingFk, vStateName + FROM ticketTracking i + JOIN state s ON i.stateFk = s.id + WHERE ticketFk = OLD.ticketFk + ORDER BY created DESC + LIMIT 1; + + IF vTicketFk > 0 THEN + REPLACE INTO 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 */ ; + +-- +-- Table structure for table `ticketTrackingState__` +-- + +DROP TABLE IF EXISTS `ticketTrackingState__`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketTrackingState__` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `action` varchar(15) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `ticketTrolley` @@ -41784,7 +37800,7 @@ CREATE TABLE `ticketTrolley` ( `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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41796,10 +37812,10 @@ DROP TABLE IF EXISTS `ticketUpdateAction`; /*!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, + `description` varchar(45) NOT NULL, + `code` varchar(45) 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'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */; -- @@ -41817,7 +37833,7 @@ CREATE TABLE `ticketWeekly` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41831,9 +37847,9 @@ 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, + `serie` varchar(2) DEFAULT NULL, `number` int(11) DEFAULT NULL, - `concept` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `concept` varchar(50) NOT NULL, `in` decimal(10,2) DEFAULT NULL, `out` decimal(10,2) DEFAULT NULL, `bankFk` int(11) DEFAULT 1, @@ -41845,7 +37861,7 @@ CREATE TABLE `till` ( `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, + `calculatedCode` varchar(255) DEFAULT NULL, `InForeignValue` decimal(10,2) DEFAULT NULL, `OutForeignValue` decimal(10,2) DEFAULT NULL, PRIMARY KEY (`id`), @@ -41858,7 +37874,7 @@ CREATE TABLE `till` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -41895,7 +37911,7 @@ CREATE TABLE `tillConfig` ( `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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41921,7 +37937,7 @@ CREATE TABLE `time` ( 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'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tabla de referencia para las semanas, años y meses'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -41940,7 +37956,7 @@ BEGIN `sender` = 'jgallego@verdnatura.es', `replyTo` = 'jgallego@verdnatura.es', `subject` = 'tabla time modificada', - `body` = CONCAT(account.myUserGetName(), ' ha modificado la tabla time ', + `body` = CONCAT(account.myUser_getName(), ' ha modificado la tabla time ', NEW.`dated`);*/ END */;; DELIMITER ; @@ -41949,6 +37965,22 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `timeControlDevice` +-- + +DROP TABLE IF EXISTS `timeControlDevice`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `timeControlDevice` ( + `id` int(10) NOT NULL AUTO_INCREMENT, + `name` varchar(255) DEFAULT NULL, + `key` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name_UNIQUE` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `town` -- @@ -41958,14 +37990,14 @@ DROP TABLE IF EXISTS `town`; /*!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, + `name` varchar(100) 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -42132,9 +38164,9 @@ DROP TABLE IF EXISTS `train`; /*!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, + `name` varchar(100) 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'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Define la configuración de los carros que se utilizan para sacar pedidos'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42146,9 +38178,9 @@ DROP TABLE IF EXISTS `trainingCenter`; /*!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, + `name` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42165,9 +38197,9 @@ CREATE TABLE `trainingCourse` ( `centerFk` int(11) DEFAULT NULL, `started` datetime NOT NULL, `ended` datetime NOT NULL, - `invoice` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `invoice` varchar(50) DEFAULT NULL, `amount` double DEFAULT NULL, - `remark` longtext COLLATE utf8_unicode_ci DEFAULT NULL, + `remark` longtext DEFAULT NULL, `hasDiscount` tinyint(1) NOT NULL DEFAULT 0, `hasDiploma` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), @@ -42177,7 +38209,7 @@ CREATE TABLE `trainingCourse` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de trabajadores que han realizado una formación'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Lista de trabajadores que han realizado una formación'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42189,9 +38221,9 @@ DROP TABLE IF EXISTS `trainingCourseType`; /*!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, + `name` varchar(255) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de las formaciones'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Lista de las formaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42210,7 +38242,7 @@ CREATE TABLE `travel` ( `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, + `ref` varchar(20) DEFAULT NULL, `isDelivered` tinyint(1) NOT NULL DEFAULT 0, `isReceived` tinyint(1) NOT NULL DEFAULT 0, `m3` decimal(10,2) unsigned DEFAULT NULL, @@ -42218,18 +38250,21 @@ CREATE TABLE `travel` ( `cargoSupplierFk` int(11) DEFAULT NULL, `totalEntries` tinyint(4) unsigned DEFAULT 0, `appointment` datetime DEFAULT NULL, + `agencyModeFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `shipment_2` (`shipped`,`landed`,`warehouseInFk`,`warehouseOutFk`,`agencyFk`,`ref`), + UNIQUE KEY `shipment_1` (`shipped`,`landed`,`warehouseInFk`,`warehouseOutFk`,`agencyFk`,`agencyModeFk`,`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`), + KEY `travel_FK` (`agencyModeFk`), + CONSTRAINT `travel_FK` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE, 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -42245,6 +38280,15 @@ DELIMITER ;; FOR EACH ROW BEGIN CALL travel_checkDates(NEW.shipped, NEW.landed); + + -- Actualizar agencyFk y agencyModeFk + IF NEW.agencyFk THEN + SET NEW.agencyModeFk = NEW.agencyFk; + END IF; + + IF NEW.agencyModeFk THEN + SET NEW.agencyFk = NEW.agencyModeFk; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -42268,6 +38312,15 @@ BEGIN OR !(NEW.shipped <=> OLD.shipped) THEN CALL travel_checkDates(NEW.shipped, NEW.landed); END IF; + + -- Actualizar agencyFk y agencyModeFk + IF !(NEW.agencyFk <=> OLD.agencyFk)THEN + SET NEW.agencyModeFk = NEW.agencyFk; + END IF; + + IF !(NEW.agencyModeFk <=> OLD.agencyModeFk) THEN + SET NEW.agencyFk = NEW.agencyModeFk; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -42290,7 +38343,7 @@ BEGIN CALL stock.log_add('travel', NEW.id, OLD.id); IF !(NEW.shipped <=> OLD.shipped) THEN - UPDATE entry + UPDATE entry SET commission = entry_getCommission(travelFk, currencyFk,supplierFk) WHERE travelFk = NEW.id; END IF; @@ -42327,7 +38380,7 @@ CREATE TABLE `travelClonedWeekly` ( `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, + `ref` varchar(50) 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', @@ -42342,7 +38395,7 @@ CREATE TABLE `travelClonedWeekly` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42356,20 +38409,20 @@ 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, + `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), - `description` text CHARACTER SET utf8 DEFAULT NULL, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, - `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` varchar(45) DEFAULT NULL, + `oldInstance` text DEFAULT NULL, + `newInstance` text DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `changedModelValue` varchar(45) 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42383,10 +38436,10 @@ 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, + `description` text NOT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de travel'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Observaciones de travel'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42399,7 +38452,7 @@ DROP TABLE IF EXISTS `travelRecalc`; 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'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Travels to recalc it''s entry count'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42411,14 +38464,13 @@ DROP TABLE IF EXISTS `travelThermograph`; /*!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, + `thermographFk` varchar(45) 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, + `result` varchar(45) 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.', + `temperatureFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci 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`), @@ -42430,7 +38482,7 @@ CREATE TABLE `travelThermograph` ( 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'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Registra cada termografo que se ha introducido en cada travel'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42447,28 +38499,9 @@ CREATE TABLE `trolley` ( PRIMARY KEY (`id`), KEY `trolley_FK` (`workerFk`), CONSTRAINT `trolley_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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` -- @@ -42482,8 +38515,9 @@ CREATE TABLE `userConfig` ( `companyFk` smallint(5) unsigned DEFAULT NULL, `created` timestamp NULL DEFAULT current_timestamp(), `updated` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `darkMode` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Salix interface dark mode', PRIMARY KEY (`userFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuración de usuario en Salix'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Configuración de usuario en Salix'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42497,20 +38531,20 @@ 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, + `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), - `description` text CHARACTER SET utf8 DEFAULT NULL, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, - `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` varchar(45) DEFAULT NULL, + `oldInstance` text DEFAULT NULL, + `newInstance` text DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `changedModelValue` varchar(45) 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42523,14 +38557,14 @@ DROP TABLE IF EXISTS `userPhone`; 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, + `typeFk` varchar(45) NOT NULL, + `phone` varchar(25) 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42541,10 +38575,10 @@ 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, + `code` varchar(45) NOT NULL, + `description` varchar(255) DEFAULT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42556,18 +38590,18 @@ DROP TABLE IF EXISTS `vehicle`; /*!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, + `numberPlate` varchar(10) NOT NULL, + `model` varchar(20) NOT NULL, + `tradeMark` varchar(20) 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', + `description` varchar(45) 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 DEFAULT NULL, + `chassis` varchar(100) DEFAULT NULL COMMENT 'numero de bastidor', `fuelTypeFk` int(11) DEFAULT NULL, `ppeFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), @@ -42581,7 +38615,19 @@ CREATE TABLE `vehicle` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vehicleConfig` +-- + +DROP TABLE IF EXISTS `vehicleConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vehicleConfig` ( + `eventEarlyDays` int(11) DEFAULT 15 COMMENT 'Previous days on which the expiration of an event must be notified' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42600,7 +38646,7 @@ CREATE TABLE `vehicleDms` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Gestion documental de vehicle'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Gestion documental de vehicle'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42615,15 +38661,16 @@ CREATE TABLE `vehicleEvent` ( `started` date DEFAULT NULL, `finished` date DEFAULT NULL, `vehicleStateFk` int(11) DEFAULT NULL, - `description` varchar(250) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(250) NOT NULL, `vehicleFk` int(11) NOT NULL, `userFk` int(10) unsigned NOT NULL, + `notified` datetime DEFAULT 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` FOREIGN KEY (`vehicleStateFk`) REFERENCES `vehicleState` (`id`), CONSTRAINT `vehicleEvent_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42643,7 +38690,7 @@ CREATE TABLE `vehicleInvoiceIn` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42657,14 +38704,14 @@ 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, + `note` text 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42675,10 +38722,11 @@ 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, + `id` int(11) NOT NULL AUTO_INCREMENT, + `state` varchar(100) NOT NULL, + `hasToNotify` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42699,8 +38747,9 @@ CREATE TABLE `volumeConfig` ( `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'; + `minTicketValue` int(11) NOT NULL DEFAULT 50, + `aerealVolumetricDensity` decimal(10,1) DEFAULT 167.0 COMMENT 'factor de conversión para calcular el peso tasable aereo' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='almacena el valor standard para volumenes convencionales de Verdnatura, en metros cúbicos'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42713,9 +38762,9 @@ DROP TABLE IF EXISTS `wagon`; 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', + `plate` varchar(10) NOT NULL COMMENT 'Matrícula', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42735,7 +38784,7 @@ CREATE TABLE `wagonVolumetry` ( PRIMARY KEY (`id`), KEY `wagonVolumetry_FK` (`wagonFk`), CONSTRAINT `wagonVolumetry_FK` FOREIGN KEY (`wagonFk`) REFERENCES `wagon` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42747,10 +38796,10 @@ DROP TABLE IF EXISTS `warehouse`; /*!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, + `name` varchar(20) NOT NULL, + `code` varchar(3) DEFAULT NULL, `isFeedStock` tinyint(1) unsigned NOT NULL DEFAULT 0, - `addressName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `addressName` varchar(45) 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, @@ -42774,16 +38823,19 @@ CREATE TABLE `warehouse` ( `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, + `isHalt` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Almacén en el que descargan nuestros troncales', 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`), + KEY `warehouse_FK_1` (`pickUpAgencyModeFk`), CONSTRAINT `warehouse_FK` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `warehouse_FK_1` FOREIGN KEY (`pickUpAgencyModeFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE, CONSTRAINT `warehouse_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`), CONSTRAINT `warehouse_ibfk_2` FOREIGN KEY (`aliasFk`) REFERENCES `warehouseAlias` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -42800,7 +38852,7 @@ DELIMITER ;; BEGIN IF NEW.isFeedStock THEN INSERT INTO warehouseAlias(`name`) VALUES(NEW.`name`); - INSERT INTO warehouseJoined(warehouseFk, warehouseAliasFk) + INSERT INTO warehouseJoined(warehouseFk, warehouseAliasFk) VALUES(NEW.id,LAST_INSERT_ID()); END IF; END */;; @@ -42824,7 +38876,7 @@ DELIMITER ;; BEGIN IF NEW.isFeedStock IS TRUE and OLD.isFeedStock IS FALSE then INSERT INTO warehouseAlias(`name`) VALUES(NEW.`name`); - INSERT INTO warehouseJoined(warehouseFk, warehouseAliasFk) + INSERT INTO warehouseJoined(warehouseFk, warehouseAliasFk) VALUES(NEW.id,LAST_INSERT_ID()); END IF; END */;; @@ -42843,10 +38895,10 @@ DROP TABLE IF EXISTS `warehouseAlias`; /*!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, + `name` varchar(15) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42859,15 +38911,16 @@ DROP TABLE IF EXISTS `workCenter`; CREATE TABLE `workCenter` ( `id` int(11) NOT NULL DEFAULT 0, `name` varchar(255) DEFAULT NULL, - `payrollCenterFk` int(11) DEFAULT NULL, + `payrollCenterFk` int(11) DEFAULT NULL COMMENT 'Campo workcenter en A3', `counter` bigint(20) DEFAULT NULL, `warehouseFk` smallint(6) DEFAULT NULL, `street` varchar(255) DEFAULT NULL, `geoFk` int(11) DEFAULT NULL, + `deliveryManAdjustment` decimal(4,2) DEFAULT NULL COMMENT 'Número de trabajadores para equilibrar los repartidores de diferentes centros. Utilizado en repartidores de grafana', 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42882,7 +38935,7 @@ CREATE TABLE `workCenterHoliday` ( `days` double NOT NULL, `year` smallint(6) NOT NULL, PRIMARY KEY (`workCenterFk`,`year`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42894,25 +38947,13 @@ DROP TABLE IF EXISTS `worker`; /*!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, + `code` varchar(3) NOT NULL, + `firstName` varchar(50) DEFAULT NULL, + `lastName` varchar(50) 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 DEFAULT NULL, - `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, + `phone` varchar(9) DEFAULT NULL, + `mobileExtension` int(4) DEFAULT NULL, `userFk` int(10) unsigned DEFAULT NULL, `bossFk` int(11) NOT NULL DEFAULT 103, `fiDueDate` datetime DEFAULT NULL, @@ -42921,27 +38962,91 @@ 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.', - `maritalStatus` enum('S','M') COLLATE utf8_unicode_ci NOT NULL, + `maritalStatus` enum('S','M') 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, + `SSN` varchar(15) DEFAULT NULL, + `fi` varchar(15) DEFAULT NULL, + `birth` date DEFAULT NULL, + `isDisable` tinyint(1) NOT NULL DEFAULT 0, + `isFreelance` tinyint(1) NOT NULL DEFAULT 0, + `isSsDiscounted` tinyint(1) NOT NULL DEFAULT 0, + `sex` enum('M','F') NOT NULL DEFAULT 'F' COMMENT 'M Masculino F Femenino', + `businessFk` int(11) DEFAULT NULL, + `balance` decimal(10,2) 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__`), + UNIQUE KEY `worker_business` (`businessFk`), 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_businessFk` FOREIGN KEY (`businessFk`) REFERENCES `business` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `worker_ibfk_1` FOREIGN KEY (`id`) REFERENCES `account`.`user` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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`.`worker_beforeInsert` +BEFORE INSERT +ON worker FOR EACH ROW +BEGIN + CALL vn.printer_checkSector(NEW.labelerFk, NEW.sectorFk); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`worker_beforeUpdate` +BEFORE UPDATE +ON worker FOR EACH ROW +BEGIN + IF NOT (NEW.labelerFk <=> OLD.labelerFk AND NEW.sectorFk <=> OLD.sectorFk) THEN + CALL vn.printer_checkSector(NEW.labelerFk, NEW.sectorFk); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `workerAppTester` +-- + +DROP TABLE IF EXISTS `workerAppTester`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerAppTester` ( + `workerFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`workerFk`), + KEY `workerAppTester_FK` (`workerFk`), + CONSTRAINT `workerAppTester_FK_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='La tabla incluye usuarios testers que actualizarán a una versión diferente que el resto para testear los cambios nuevos en las app'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42961,7 +39066,7 @@ CREATE TABLE `workerBosses` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42974,7 +39079,7 @@ 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, + `businessFk` tinyint NOT NULL, `workerFk` tinyint NOT NULL ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; @@ -42988,12 +39093,12 @@ DROP TABLE IF EXISTS `workerBusinessType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerBusinessType` ( `id` int(11) NOT NULL, - `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(255) 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43023,29 +39128,28 @@ 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, + `action` set('insert','update','delete','select') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), - `description` text COLLATE utf8_unicode_ci NOT NULL, + `description` text NOT NULL, PRIMARY KEY (`id`), KEY `logWorkerClockoriginFk` (`originFk`), KEY `logWorkerClockuserFk` (`userFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `workerConfig__` +-- Table structure for table `workerConfig` -- -DROP TABLE IF EXISTS `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; +CREATE TABLE `workerConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `businessUpdated` date DEFAULT NULL, + `roleFk` int(10) unsigned NOT NULL COMMENT 'Rol por defecto al dar de alta un trabajador nuevo', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43062,20 +39166,6 @@ SET character_set_client = utf8; ) 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` -- @@ -43088,7 +39178,7 @@ CREATE TABLE `workerDisableExcluded` ( `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'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='No se deshabilitan hasta la fecha especificada'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43105,7 +39195,7 @@ CREATE TABLE `workerDistributionCategory` ( PRIMARY KEY (`id`), KEY `workerDistributionCategory_workerFk_idx` (`workerFk`), CONSTRAINT `workerDistributionCategory_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43124,8 +39214,8 @@ CREATE TABLE `workerDocument` ( 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; + CONSTRAINT `workerDocument_ibfk_2` FOREIGN KEY (`document`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43137,10 +39227,10 @@ DROP TABLE IF EXISTS `workerEmergencyBoss`; /*!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', + `name` varchar(45) DEFAULT NULL, + `value` varchar(45) DEFAULT NULL COMMENT 'Table to save all responsible people phones', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43157,7 +39247,7 @@ CREATE TABLE `workerHourPrice` ( `nightInc` decimal(4,2) DEFAULT NULL, `extraInc` decimal(4,2) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los acuerdos de los distintos convenios'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Recoge los acuerdos de los distintos convenios'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43169,11 +39259,11 @@ DROP TABLE IF EXISTS `workerIrpf`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerIrpf` ( `workerFk` int(10) unsigned NOT NULL, - `spouseNif` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `spouseNif` varchar(45) 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', + `familySituation` enum('1','2','3') 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', @@ -43184,7 +39274,7 @@ CREATE TABLE `workerIrpf` ( 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 '; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Modelo 145 IRPF apartado 1 - 4 y 5 '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43216,11 +39306,11 @@ CREATE TABLE `workerJourney` ( 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`), + KEY `workerJourney_businessFk` (`businessFk`), 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + CONSTRAINT `workerJourney_businessFk` FOREIGN KEY (`businessFk`) REFERENCES `business` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43253,20 +39343,20 @@ 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, + `action` set('insert','update','delete') 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 DEFAULT NULL, - `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text NOT NULL, + `changedModel` varchar(45) DEFAULT NULL, + `oldInstance` text DEFAULT NULL, + `newInstance` text DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `changedModelValue` varchar(45) 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43287,7 +39377,7 @@ CREATE TABLE `workerMana` ( 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43301,28 +39391,9 @@ 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á'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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` -- @@ -43347,14 +39418,14 @@ DROP TABLE IF EXISTS `workerMistake`; 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, + `workerMistakeTypeFk` varchar(10) 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43365,10 +39436,10 @@ 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, + `code` varchar(10) NOT NULL, + `description` varchar(45) NOT NULL, PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43393,7 +39464,7 @@ CREATE TABLE `workerRelatives` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Modelo 145 IRPF apartado 2 y 3'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Modelo 145 IRPF apartado 2 y 3'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43406,7 +39477,7 @@ DROP TABLE IF EXISTS `workerShelving`; CREATE TABLE `workerShelving` ( `id` int(11) NOT NULL AUTO_INCREMENT, `workerFk` int(10) unsigned NOT NULL, - `shelvingFk` varchar(10) CHARACTER SET utf8 NOT NULL, + `shelvingFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `collectionFk` int(11) DEFAULT NULL, `created` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), @@ -43414,9 +39485,9 @@ CREATE TABLE `workerShelving` ( 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_FK_1` FOREIGN KEY (`shelvingFk`) REFERENCES `shelving` (`code`) ON UPDATE CASCADE, CONSTRAINT `workerShelving_worker_fk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='utilizaremos el id para establecer la prioridad de los carros a asignar'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='utilizaremos el id para establecer la prioridad de los carros a asignar'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43448,7 +39519,7 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE TABLE `workerSpeedSaleTracking` ( `warehouseFk` tinyint NOT NULL, - `accion` tinyint NOT NULL, + `state` tinyint NOT NULL, `workerCode` tinyint NOT NULL, `sumaLitros` tinyint NOT NULL, `started` tinyint NOT NULL, @@ -43474,7 +39545,7 @@ CREATE TABLE `workerTeam` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43505,21 +39576,22 @@ CREATE TABLE `workerTimeControl` ( `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', + `direction` enum('in','out','middle') 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`), + KEY `timed_idx` (`timed`), 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'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -43527,9 +39599,9 @@ DELIMITER ;; AFTER INSERT ON `workerTimeControl` FOR EACH ROW BEGIN - IF NEW.timed > DATE_ADD(util.VN_NOW(), INTERVAL 1 DAY) THEN + IF NEW.timed > DATE_ADD(util.VN_NOW(), INTERVAL 1 DAY) THEN CALL util.throw('date in the future'); - END IF; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -43551,11 +39623,11 @@ CREATE TABLE `workerTimeControlConfig` ( `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, + `mailPass` varchar(45) NOT NULL, + `mailHost` varchar(45) NOT NULL, + `mailSuccessFolder` varchar(45) NOT NULL, + `mailErrorFolder` varchar(45) NOT NULL, + `mailUser` varchar(45) 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', @@ -43565,8 +39637,12 @@ CREATE TABLE `workerTimeControlConfig` ( `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', + `shortWeekDays` int(11) DEFAULT NULL COMMENT 'Días a tener en cuenta para calcular el descanso corto', + `longWeekDays` int(11) DEFAULT NULL COMMENT 'Días a tener en cuenta para calcular el descanso largo', + `teleworkingStart` int(11) DEFAULT NULL COMMENT 'Hora comienzo jornada de los teletrabajdores expresada en segundos', + `teleworkingStartBreakTime` int(11) DEFAULT NULL COMMENT 'Hora comienzo descanso de los teletrabjadores expresada en segundos', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='All values in seconds'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='All values in seconds'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43579,11 +39655,11 @@ DROP TABLE IF EXISTS `workerTimeControlConfig_`; 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, + `host` varchar(45) NOT NULL, PRIMARY KEY (`id`), KEY `warehouseFk_1_idx` (`warehouseFk`), CONSTRAINT `warehouseFk_2` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43597,9 +39673,9 @@ 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, + `description` varchar(45) 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)'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */; -- @@ -43614,15 +39690,15 @@ CREATE TABLE `workerTimeControlMail` ( `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', + `state` enum('SENDED','CONFIRMED','REVISE') 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 DEFAULT NULL, + `reason` text DEFAULT NULL, 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Guarda las respuestas de mail de los correos generados automáticamente por la procedimiento workerTimeControl_sendMail'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */; -- @@ -43642,13 +39718,13 @@ CREATE TABLE `workerTimeControlParams` ( `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, + `mailPass` varchar(45) NOT NULL, + `mailHost` varchar(45) NOT NULL, + `mailSuccessFolder` varchar(45) NOT NULL, + `mailErrorFolder` varchar(45) NOT NULL, + `mailUser` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='All values in seconds'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='All values in seconds'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43660,10 +39736,10 @@ DROP TABLE IF EXISTS `workerTimeControlPin`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerTimeControlPin` ( `workerFk` int(10) unsigned NOT NULL, - `pin` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `pin` varchar(255) 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43678,7 +39754,7 @@ CREATE TABLE `workerTimeControlSchedule` ( `time` time DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `punique_trhf` (`time`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43701,45 +39777,6 @@ SET character_set_client = utf8; ) 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` -- @@ -43758,21 +39795,6 @@ SET character_set_client = utf8; ) 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` -- @@ -43799,19 +39821,19 @@ DROP TABLE IF EXISTS `workers20190711`; 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, + `Apellidos` varchar(60) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `Nombre` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `nif` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `Fecha_Inicio` date DEFAULT NULL, `Fecha_Fin` date DEFAULT NULL, - `departamento` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `departamento` varchar(45) 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43824,16 +39846,16 @@ DROP TABLE IF EXISTS `workers20190711_FichadasAbril`; 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, + `nif` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `Apellidos` varchar(60) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `Nombre` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43846,16 +39868,16 @@ DROP TABLE IF EXISTS `workers20190711_FichadasJulio11`; 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, + `nif` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `Apellidos` varchar(60) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `Nombre` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43868,16 +39890,16 @@ DROP TABLE IF EXISTS `workers20190711_FichadasJunio`; 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, + `nif` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `Apellidos` varchar(60) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `Nombre` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43890,16 +39912,16 @@ DROP TABLE IF EXISTS `workers20190711_FichadasMayo`; 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, + `nif` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `Apellidos` varchar(60) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `Nombre` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43912,16 +39934,16 @@ DROP TABLE IF EXISTS `workers20190711_FichadasOctubre`; 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, + `nif` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `Apellidos` varchar(60) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `Nombre` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43934,16 +39956,16 @@ DROP TABLE IF EXISTS `workers20190711_Garrote`; 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, + `nif` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `Apellidos` varchar(60) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `Nombre` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43961,7 +39983,7 @@ CREATE TABLE `workingHours` ( PRIMARY KEY (`id`), KEY `user_working_hour_idx` (`userId`), CONSTRAINT `user_working_hour` FOREIGN KEY (`userId`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena horas de Entrada y de Salida del personal'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -43986,6 +40008,20 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `zipConfig` +-- + +DROP TABLE IF EXISTS `zipConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zipConfig` ( + `id` double(10,2) NOT NULL, + `maxSize` int(11) DEFAULT NULL COMMENT 'in MegaBytes', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `zone` -- @@ -43995,9 +40031,8 @@ DROP TABLE IF EXISTS `zone`; /*!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, + `name` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_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, @@ -44008,12 +40043,10 @@ CREATE TABLE `zone` ( `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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44032,7 +40065,7 @@ CREATE TABLE `zoneAgencyMode` ( 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.'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='junta agencias con zonas para que al enrutar se puedan proponer tickets.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44047,7 +40080,7 @@ CREATE TABLE `zoneClosure` ( `dated` date NOT NULL, `hour` time NOT NULL, PRIMARY KEY (`zoneFk`,`dated`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44062,7 +40095,7 @@ CREATE TABLE `zoneConfig` ( `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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44108,7 +40141,7 @@ CREATE TABLE `zoneEvent` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44128,7 +40161,7 @@ CREATE TABLE `zoneExclusion` ( 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=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_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 */ ; @@ -44142,10 +40175,10 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_BI` BEFORE INSERT ON `zoneExclusion` FOR EACH ROW -BEGIN - +BEGIN + SET NEW.userFk = account.myUser_getId(); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -44164,10 +40197,10 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_BU` BEFORE UPDATE ON `zoneExclusion` FOR EACH ROW -BEGIN - +BEGIN + SET NEW.userFk = account.myUser_getId(); - + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -44175,6 +40208,25 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `zoneExclusionGeo` +-- + +DROP TABLE IF EXISTS `zoneExclusionGeo`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneExclusionGeo` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `zoneExclusionFk` int(11) NOT NULL, + `geoFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `zoneExclusionGeo_UN` (`zoneExclusionFk`,`geoFk`), + KEY `zoneExclusionGeo2_FK_1` (`geoFk`), + CONSTRAINT `zoneExclusionGeo_FK` FOREIGN KEY (`geoFk`) REFERENCES `zoneGeo` (`id`) ON UPDATE CASCADE, + CONSTRAINT `zoneExclusionGeo_FK_1` FOREIGN KEY (`zoneExclusionFk`) REFERENCES `zoneExclusion` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `zoneFilter` -- @@ -44191,8 +40243,8 @@ CREATE TABLE `zoneFilter` ( 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='recoge los parámetros para filtrar determinados productos según la zona'; + CONSTRAINT `zoneFilter_FK_1` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='recoge los parámetros para filtrar determinados productos según la zona'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44204,10 +40256,10 @@ DROP TABLE IF EXISTS `zoneGeo`; /*!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, + `type` set('country','province','town','postCode','autonomy') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + `name` varchar(100) DEFAULT NULL, `parentFk` int(10) unsigned DEFAULT NULL, - `path` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `path` varchar(255) DEFAULT NULL, `lft` int(11) DEFAULT NULL, `rgt` int(11) DEFAULT NULL, `depth` bigint(22) NOT NULL DEFAULT 0, @@ -44217,7 +40269,7 @@ CREATE TABLE `zoneGeo` ( KEY `name_idx` (`name`), KEY `parentFk` (`parentFk`), KEY `path` (`path`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */ ; @@ -44273,7 +40325,7 @@ CREATE TABLE `zoneGeoRecalc` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `isChanged` tinyint(4) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44291,7 +40343,26 @@ CREATE TABLE `zoneIncluded` ( 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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `zoneItemType` +-- + +DROP TABLE IF EXISTS `zoneItemType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneItemType` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `zoneFk` int(11) NOT NULL, + `itemTypeFk` smallint(5) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `zoneItemType_FK` (`zoneFk`), + KEY `zoneItemType_FK_1` (`itemTypeFk`), + CONSTRAINT `zoneItemType_FK` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `zoneItemType_FK_1` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Combinaciones prohibidas entre zone e itemType al calcular el catálogo de items'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44305,39 +40376,20 @@ 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, + `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), - `description` text CHARACTER SET utf8 DEFAULT NULL, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, - `newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` varchar(45) DEFAULT NULL, + `oldInstance` text DEFAULT NULL, + `newInstance` text DEFAULT NULL, `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `changedModelValue` varchar(45) 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=InnoDB DEFAULT 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=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44356,46 +40408,44 @@ CREATE TABLE `zoneWarehouse` ( 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; +) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!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` */; +/*!50106 DROP EVENT IF EXISTS `collection_make` */; 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 character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `collection_make` ON SCHEDULE EVERY 5 MINUTE STARTS '2022-09-15 00:00:00' ON COMPLETION PRESERVE DISABLE ON SLAVE DO CALL vn.collection_make */ ;; +/*!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 `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 = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_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 */ ;; +/*!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 DISABLE ON SLAVE 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 */ ;; @@ -44406,41 +40456,41 @@ 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 character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_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 +/*!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 DISABLE ON SLAVE DO BEGIN DECLARE vActualNumber BIGINT; DECLARE vEndRange BIGINT; DECLARE vIsAlreadyNotified BOOLEAN; DECLARE vNotificationThrehold INT; - SELECT actualNumber, endRange, isAlreadyNotified, notificationThrehold + SELECT actualNumber, endRange, isAlreadyNotified, notificationThrehold INTO vActualNumber, vEndRange, vIsAlreadyNotified, vNotificationThrehold FROM envialiaConfig; - + IF (vActualNumber+vNotificationThrehold) >= vEndRange AND vIsAlreadyNotified = FALSE THEN - CALL mail_insert( + 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 */ ;; @@ -44452,14 +40502,14 @@ 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 character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_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() */ ;; +/*!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 DISABLE ON SLAVE 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 */ ;; @@ -44470,49 +40520,54 @@ 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 character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_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 +/*!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 DISABLE ON SLAVE DO BEGIN DECLARE vCurrentCount INT; DECLARE vCheckSum INT; - DECLARE vIsAlreadyNotified BOOLEAN; - DECLARE vTableQueue TEXT; + DECLARE vIsAlreadyNotified BOOLEAN; + DECLARE vTableQueue TEXT; DECLARE vLineQueue TEXT; - DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vCur CURSOR FOR - SELECT CONCAT(' + DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vPrintQueueLimit INT; + + DECLARE vCur CURSOR FOR + SELECT CONCAT(' ', IFNULL(pq.id, ''), ' ', IFNULL(p.path, ''),' - ', IFNULL(lr.name, ''),' - ', IFNULL(e.Estado, ''),' + ', IFNULL(r.name, ''),' + ', IFNULL(pq.statusCode, ''),' ', 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; + FROM printQueue pq + LEFT JOIN worker w ON w.id = pq.workerFk + LEFT JOIN printer p ON p.id = pq.printerFk + LEFT JOIN report r ON r.id = pq.reportFk + JOIN printQueueConfig + LIMIT vPrintQueueLimit; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + SELECT printQueueLimit INTO vPrintQueueLimit + FROM printQueueConfig; SELECT COUNT(*), IFNULL(SUM(id),0) INTO vCurrentCount, vCheckSum - FROM vn.printingQueue WHERE state = 1; - - SELECT isAlreadyNotified INTO vIsAlreadyNotified - FROM printingQueueCheck; - + FROM printQueue WHERE statusCode = 'queued'; + + SELECT isAlreadyNotified INTO vIsAlreadyNotified + FROM printingQueueCheck; + IF (SELECT lastCount FROM printingQueueCheck) = vCurrentCount AND (SELECT lastCheckSum FROM printingQueueCheck) = vCheckSum AND - vIsAlreadyNotified = FALSE AND vCurrentCount > 0 + vIsAlreadyNotified = FALSE AND vCurrentCount > 0 THEN SELECT ' @@ -44523,46 +40578,46 @@ DELIMITER ;; - ' INTO vTableQueue; - + ' INTO vTableQueue; + OPEN vCur; - + l: LOOP - + SET vDone = FALSE; - + FETCH vCur INTO vLineQueue; - - IF vDone THEN + + IF vDone THEN LEAVE l; END IF; - - SELECT CONCAT(vTableQueue, vLineQueue) INTO vTableQueue; - + + 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, '
Estado Trabajador Error
') + + CLOSE vCur; + + CALL mail_insert( + 'cau@verdnatura.es', + NULL, + 'Servidor de impresion parado', + CONCAT('Hay ', vCurrentCount, ' lineas bloqueadas', vTableQueue, '') ); - - UPDATE printingQueueCheck SET isAlreadyNotified = TRUE; + + UPDATE printingQueueCheck SET isAlreadyNotified = TRUE; END IF; - - IF (SELECT lastCount FROM printingQueueCheck) > vCurrentCount AND - vIsAlreadyNotified = TRUE + + 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 */ ;; @@ -44574,14 +40629,14 @@ 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 character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_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 */ ;; +/*!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 DISABLE ON SLAVE 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 */ ;; @@ -44628,14 +40683,14 @@ 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 character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET sql_mode = '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 */ ;; +/*!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 DISABLE ON SLAVE 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 */ ;; @@ -44646,14 +40701,32 @@ 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 character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_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 */ ;; +/*!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 DISABLE ON SLAVE 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 `vehicle_notify` */;; +DELIMITER ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ;; +/*!50003 SET @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 `vehicle_notify` ON SCHEDULE EVERY 1 DAY STARTS '2022-01-01 00:07:00' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE COMMENT 'Notifies subscribed users of events in vehicles that are about t' DO CALL vn.vehicle_notifyEvents */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; /*!50003 SET character_set_client = @saved_cs_client */ ;; @@ -44664,22 +40737,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 = utf8mb4 */ ;; -/*!50003 SET character_set_results = utf8mb4 */ ;; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;; +/*!50003 SET character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_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 +/*!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 DISABLE ON SLAVE DO BEGIN DECLARE vWeek,vYear INT; SELECT week,year INTO vWeek,vYear - FROM vn.time + FROM vn.time WHERE dated IN (DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_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 */ ;; @@ -44687,19 +40760,37 @@ END */ ;; /*!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 `worker_updateChangedBusiness` */;; +DELIMITER ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ;; +/*!50003 SET @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 `worker_updateChangedBusiness` ON SCHEDULE EVERY 1 DAY STARTS '2000-01-01 00:00:05' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO CALL worker_updateChangedBusiness */ ;; +/*!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 character_set_client = utf8mb3 */ ;; +/*!50003 SET character_set_results = utf8mb3 */ ;; +/*!50003 SET collation_connection = utf8mb3_general_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 */ ;; +/*!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 DISABLE ON SLAVE 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 */ ;; @@ -44721,46 +40812,29 @@ DELIMITER ; /*!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 +CREATE DEFINER=`root`@`localhost` FUNCTION `addressTaxArea`(vAddresId INT, vCompanyId INT) RETURNS varchar(25) CHARSET utf8mb3 DETERMINISTIC BEGIN /** - * Devuelve el area de un Consignatario, + * Devuelve el area de un Consignatario, * intracomunitario, extracomunitario, nacional o recargo de equivalencia. - * Asumimos que no tenemos ninguna empresa + * 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; + + DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; + CREATE TEMPORARY TABLE tmp.addressCompany + SELECT vAddresId addressFk, vCompanyId companyFk; + + CALL vn.addressTaxArea(); + SELECT areaFk INTO vTaxArea FROM tmp.addressTaxArea; + DROP TEMPORARY TABLE + tmp.addressCompany, + tmp.addressTaxArea; RETURN vTaxArea; END ;; @@ -44791,7 +40865,7 @@ BEGIN DECLARE vGeoFk INT; SELECT p.geoFk INTO vGeoFk - FROM address a + 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 @@ -44818,12 +40892,12 @@ 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 */ @@ -44833,140 +40907,35 @@ BEGIN FROM vn.item WHERE id = vBarcode OR comment = vBarcode LIMIT 1; - - IF vItemFk THEN + + IF vItemFk THEN RETURN vItemFk; END IF; - SELECT itemFk INTO vItemFk - FROM buy + 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 + + IF vItemFk THEN RETURN vItemFk; END IF; - SELECT i.id INTO vItemFk + 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 */ ; @@ -44988,9 +40957,9 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `botanicExport_isUpdatable`(vEdiGenus DETERMINISTIC BEGIN DECLARE vIsUpdatable INTEGER; - SELECT COUNT(*) INTO vIsUpdatable - FROM botanicExport - WHERE ediGenusFk = vEdiGenusFk + 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; @@ -45069,50 +41038,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 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 */ ; @@ -45131,16 +41056,16 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `catalog_componentReverse`(vWarehouse DETERMINISTIC BEGIN /* Calcula los componentes para un cliente a partir de un coste y volumen - * @param vWarehouse + * @param vWarehouse * @param vCost Valor de coste del articulo * @param vM3 m3 del articulo - * @param vAddressFk + * @param vAddressFk * @param vZoneFk - * @return vRetailedPrice precio de venta sin iva + * @return vRetailedPrice precio de venta sin iva * @return tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) */ - - DECLARE vBoxVolume BIGINT; + + DECLARE vBoxVolume BIGINT; DECLARE vCustomer INT; DECLARE vComponentRecovery INT DEFAULT 17; DECLARE vComponentMana INT DEFAULT 39; @@ -45149,11 +41074,11 @@ BEGIN 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; @@ -45172,49 +41097,48 @@ BEGIN WHERE dated <= util.VN_CURDATE() AND warehouseFk = vWarehouse ORDER BY dated DESC - LIMIT 1; - - -- Margen - -- No se aplica margen, cau 12589 + 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 + SELECT vWarehouse, vItem, vComponentMargin, (vCost / ((100 - rate2) / 100)) - vCost FROM vn.rate WHERE dated <= util.VN_CURDATE() AND warehouseFk = vWarehouse ORDER BY dated DESC - LIMIT 1; - */ - -- Recobro + LIMIT 1; + */ + -- Recobro INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) - SELECT vWarehouse, vItem, vComponentRecovery, ROUND(LEAST(recobro,0.25), 3) + 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; - + SELECT vWarehouse, vItem, vComponentMana, ROUND(wm.pricesModifierRate, 3) + FROM client c + JOIN vn.workerMana wm ON c.salesPersonFk = wm.workerFk + WHERE wm.isPricesModifierActivated AND c.id = vCustomer LIMIT 1; + -- Reparto INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) SELECT vWarehouse, vItem, vDeliveryComponent, ROUND( - vM3 + vM3 * (z.price - z.bonus) - * z.inflation + * z.inflation / vBoxVolume, 4 ) - FROM zone z + FROM zone z WHERE z.id = vZoneFk; - + -- Precio de venta SELECT SUM(cost) INTO vRetailedPrice FROM tmp.catalog_component; - RETURN vRetailedPrice; - + RETURN vRetailedPrice; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -45235,54 +41159,14 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `clientGetDebt`(`vClient` INT, `vDate READS SQL DATA BEGIN /** - * Devuelve el saldo de un cliente. + * Returns the risk of a customer. * - * @param vClient Identificador del cliente - * @param vDate Fecha hasta la que tener en cuenta - * @return Saldo del cliente + * @param vClient client id + * @param vDate date to check the risk + * @return client risk */ - 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, util.VN_CURDATE()); - - SET vDateIni = TIMESTAMPADD(MONTH, -2, util.VN_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; - + SELECT vn.client_getDebt(vClient,vDate) INTO vDebt; RETURN vDebt; END ;; DELIMITER ; @@ -45316,30 +41200,30 @@ BEGIN 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 + FROM ( SELECT mana FROM clientManaCache WHERE clientFk = vClient - AND dated = vFromDated + AND dated = vFromDated UNION ALL SELECT s.quantity * value FROM ticket t @@ -45347,7 +41231,7 @@ BEGIN 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 > vFromDated AND t.shipped < TIMESTAMPADD(DAY,1,util.VN_CURDATE()) AND a.clientFk = vClient UNION ALL @@ -45411,34 +41295,66 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `clientTaxArea`(vClientId INT, vCompa READS SQL DATA BEGIN /** - * Devuelve el area de un cliente, + * 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; + DECLARE vTaxArea VARCHAR(25); + + SELECT addressTaxArea(defaultAddressFk, vCompanyId) + INTO vTaxArea + FROM client + WHERE id = vClientId; + + 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_getDebt` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = 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_getDebt`(`vClient` INT, `vDate` DATE) RETURNS decimal(10,2) + READS SQL DATA +BEGIN +/** + * Returns the risk of a customer. + * + * @param vClient client id + * @param vDate date to check the risk + * @return client risk + */ + 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; + + CREATE OR REPLACE TEMPORARY TABLE tmp.clientGetDebt (clientFk INT); + INSERT INTO tmp.clientGetDebt SET clientFk = vClient; + + CALL vn.client_getDebt(vDate); + + SELECT risk INTO vDebt FROM tmp.risk; + + RETURN vDebt; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -45481,11 +41397,9 @@ BEGIN 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 clientFk + FROM vn.clientContact + WHERE phone = vPhone; SELECT t.clientFk INTO vClient FROM tClient t @@ -45516,8 +41430,8 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPerson`(vClientFk INT 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 + * 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 @@ -45555,29 +41469,29 @@ BEGIN l: LOOP SELECT workerSubstitute INTO vWorkerSubstituteFk - FROM sharingCart + FROM sharingCart WHERE util.VN_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; @@ -45611,11 +41525,11 @@ BEGIN **/ DECLARE vClientFk INT; DECLARE vDated DATE; - + SELECT clientFk, shipped INTO vClientFk, vDated FROM ticket WHERE id = vTicketFk; - + RETURN client_getSalesPerson(vClientFk, vDated); END ;; DELIMITER ; @@ -45646,12 +41560,12 @@ BEGIN **/ DECLARE vWorkerCode CHAR(3); DECLARE vSalesPersonFk INT; - + SET vSalesPersonFk = client_getSalesPerson(vClientFk, vDated); SELECT code INTO vWorkerCode - FROM worker + FROM worker WHERE id = vSalesPersonFk; RETURN vWorkerCode; @@ -45684,11 +41598,11 @@ BEGIN **/ DECLARE vClientFk INT; DECLARE vDated DATE; - + SELECT clientFk, shipped INTO vClientFk, vDated FROM ticket WHERE id = vTicketFk; - + RETURN client_getSalesPersonCode(vClientFk, vDated); END ;; DELIMITER ; @@ -45709,28 +41623,92 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `collectionExpeditionLacks`(vCollectionFk INT) RETURNS varchar(100) CHARSET utf8 COLLATE utf8_unicode_ci DETERMINISTIC BEGIN - - DECLARE vExpeditionLacks BOOL; +/** + * Return message with tickets and collection if there is tickets of a collection without expeditions. + * + * @param vCollectionFk The collection to check + * @return An array with collection and tickets without expeditions + */ 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 + IF collection_isPacked(vCollectionFk) = FALSE 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); - + 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 `collection_isPacked` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = 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 `collection_isPacked`(vSelf INT) RETURNS tinyint(1) + DETERMINISTIC +BEGIN +/** + * Check if collection is packed. + * + * @param vSelf the collection to check + * @return true if the collection is packed + */ + DECLARE vTicketsWithoutExpeditions INT; + SELECT (COUNT(*) > 0) INTO vTicketsWithoutExpeditions + FROM vn.ticketCollection tc + LEFT JOIN vn.expedition e ON e.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vSelf + AND ISNULL(e.id); + + RETURN NOT vTicketsWithoutExpeditions; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 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 `currency_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 `currency_getCommission`(vSelf INT) RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Devuelve el tipo de cambio en el dia de hoy dada el tipo de moneda + * + * @param vSelf id del tipo de moneda + * @return devuelve la comision + */ + DECLARE vCommission INT; + + SELECT ROUND(-100 * (1 - (1 / r.value))) INTO vCommission + FROM referenceCurrent r + WHERE r.currencyFk = vSelf + AND r.`dated` <= util.VN_CURDATE() + ORDER BY r.`dated` DESC + LIMIT 1; + + RETURN vCommission; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -45752,7 +41730,7 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `currentRate`(vCurrencyFk INT, vDated BEGIN DECLARE curRate DECIMAL(10,4); - + SELECT value INTO curRate FROM referenceRate WHERE dated <= vDated @@ -45783,23 +41761,23 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `deviceProductionUser_accessGranted`( 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 + 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 + + SELECT COUNT(*) INTO vIsGranted + FROM vn.deviceProductionUser dpu + WHERE dpu.userFk = vUserFK AND dpu.deviceProductionFk = vDeviceProductionFk; - + RETURN vIsGranted; END IF;*/ RETURN TRUE; @@ -45823,20 +41801,21 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `duaTax_getRate`(vDua INT, vTaxClass 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 + FROM invoiceInTaxBookingAccount WHERE effectived <= util.VN_CURDATE() AND countryFk = vCountryFk AND taxClassFk = vTaxClass ORDER BY effectived DESC + LIMIT 10000000000000000000 ) ba1 GROUP BY taxClassFk); END ;; @@ -45858,77 +41837,68 @@ 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 - */ - +/** + * 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; + 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 + 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 AND + IFNULL(ea.auction, e.auction) <=> e.auction + WHERE e.id = vEktFk + ORDER BY + IF(ea.sub,1,0) * 1000 + + IF(ea.kop,1,0) * 100 + + IF(ea.pro,1,0) * 10 + + IF(ea.auction,1,0) 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 + + SET vTravelFk = vn.ekt_getTravel(vEntryAssignFk, vEktFk); + + IF vTravelFk THEN + + 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 + AND e.auction <=> ea.auction + AND e.companyFk <=> ea.companyFk; + + IF vEntryFk IS NULL THEN + INSERT INTO vn.entry(travelFk, supplierFk, companyFk, currencyFk, kop, sub, reference, pro, auction) + SELECT vTravelFk, ea.supplierFk, ea.companyFk, cu.id, ea.kop, ea.sub, ea.ref, ea.pro, ea.auction FROM vn.ektEntryAssign ea - JOIN vn.company c ON c.code = 'VNL' - JOIN vn.currency cu ON cu.code = 'EUR' + JOIN vn.currency cu ON cu.code = 'EUR' WHERE ea.id = vEntryAssignFk; - - SELECT MAX(id) INTO vEntryFk - FROM vn.entry - WHERE travelFk = vTravelFk; - + + SET vEntryFk = LAST_INSERT_ID(); END IF; - - UPDATE vn.ektEntryAssign - SET entryFk = vEntryFk - WHERE id = vEntryAssignFk; - + + UPDATE vn.ektEntryAssign + SET entryFk = vEntryFk + WHERE id = vEntryAssignFk; + ELSE - - SELECT ec.defaultEntry INTO vEntryFk + + SELECT ec.defaultEntry INTO vEntryFk FROM vn.entryConfig ec; - + INSERT IGNORE INTO vn.entry(id) VALUES(vEntryFk); - END IF; - + RETURN vEntryFk; END ;; DELIMITER ; @@ -45946,129 +41916,46 @@ DELIMITER ; /*!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) +CREATE DEFINER=`root`@`localhost` FUNCTION `ekt_getTravel`(vEntryAssignFk INT, vEktFk INT) RETURNS int(11) READS SQL DATA BEGIN - +/** + * Devuelve un vn.travel.id + * + * @param vEntryAssignFk Identificador de vn.entryAssign + */ 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 + IF vEntryAssignFk IS NOT NULL THEN + SELECT MAX(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 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; - + 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.agencyModeFk + AND tr.landed = e.fec; + + IF vTravelFk IS NULL THEN + + INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyModeFk) + 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 + IF(ea.sub,1,0) * 1000 + + IF(ea.kop,1,0) * 100 + + IF(ea.pro,1,0) * 10 + + IF(ea.auction,1,0) DESC + LIMIT 1; + + SET vTravelFk = LAST_INSERT_ID(); + + 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 `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 */ ; @@ -46085,7 +41972,8 @@ DELIMITER ; /*!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, +CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCommission`( + vTravelFk INT, vCurrencyFk INT, vSupplierFk INT ) RETURNS int(11) @@ -46095,36 +41983,36 @@ BEGIN 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 @@ -46133,57 +42021,11 @@ BEGIN 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 */ ; @@ -46200,7 +42042,8 @@ DELIMITER ; /*!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, +CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCurrency`( + vCurrency INT, vSupplierFk INT ) RETURNS int(11) READS SQL DATA @@ -46234,10 +42077,10 @@ 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 */ @@ -46245,47 +42088,81 @@ BEGIN 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 + + SELECT IFNULL(MAX(id),0) INTO vEntryFk FROM vn.entry - WHERE travelFk = vTravelFk + 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 + + SELECT MAX(id) INTO vEntryFk FROM vn.entry WHERE travelFk = vTravelFk; - - END IF; - - END IF; - SELECT entryFk INTO previousEntryFk + END IF; + + END IF; + + SELECT entryFk INTO previousEntryFk FROM edi.warehouseFloramondo wf WHERE wf.warehouseFk = vWarehouseFk; - + IF IFNULL(previousEntryFk,0) != vEntryFk THEN - + + UPDATE buy b + SET b.printedStickers = 0 + WHERE entryFk = previousEntryFk; + 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 `entry_isInventoryOrPrevious` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = 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_isInventoryOrPrevious`(vSelf INT) RETURNS int(11) + DETERMINISTIC +BEGIN + DECLARE vIsInventoryOrPrevious BOOL; + + SELECT ec.inventorySupplierFk = e.supplierFk OR t.landed < c.inventoried + INTO vIsInventoryOrPrevious + FROM entry e + JOIN travel t ON e.travelFk = t.id + JOIN entryConfig ec + JOIN config c + WHERE e.id = vSelf; + + RETURN vIsInventoryOrPrevious; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -46317,17 +42194,17 @@ BEGIN DECLARE vHasDistinctRoutes BOOL; SELECT t.routeFk INTO vRouteFk - FROM vn.expedition e + 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 ;; @@ -46388,27 +42265,27 @@ BEGIN DECLARE vDeliveryType INTEGER DEFAULT 0; DECLARE isWaitingForPickUp BOOLEAN DEFAULT FALSE; DECLARE vCode VARCHAR(45); - + SELECT am.deliveryMethodFk - INTO vDeliveryType + 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 + 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 @@ -46438,78 +42315,28 @@ BEGIN DECLARE vDeliveryType INTEGER DEFAULT 0; DECLARE isWaitingForPickUp BOOLEAN DEFAULT FALSE; DECLARE vCode VARCHAR(45); - - SELECT + + SELECT a.Vista - INTO vDeliveryType + 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 + 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 @@ -46551,19 +42378,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 FUNCTION IF EXISTS `getEnvironment` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 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 */ ; @@ -46630,16 +42444,16 @@ 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); + SET vDuaDate = TIMESTAMPADD (DAY , -1, vDuaDate); ELSEIF vDuaDate = CONCAT(YEAR(vDuaDate), '-02-29') THEN - SET vDuaDate = TIMESTAMPADD (DAY , -2, vDuaDate); + SET vDuaDate = TIMESTAMPADD (DAY , -2, vDuaDate); END IF; - IF MONTH(vDuaDate) = 2 AND vPayDay = 30 THEN + IF MONTH(vDuaDate) = 2 AND vPayDay = 30 THEN IF util.isLeapYear(YEAR(vDuaDate)) THEN SET vPayDay = 29; ELSE @@ -46647,7 +42461,7 @@ BEGIN END IF; END IF; - SELECT DAY(vDuaDate) INTO vDuaDateDay; + SELECT DAY(vDuaDate) INTO vDuaDateDay; RETURN TIMESTAMPADD(MONTH, (vDuaDateDay > vPayDay), DATE_FORMAT(vDuaDate, CONCAT('%y/%m/', vPayDay))); END ;; DELIMITER ; @@ -46655,33 +42469,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 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 */ ; @@ -46696,11 +42483,11 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `getShipmentHour`(vTicket INT) RETURN 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; @@ -46715,11 +42502,11 @@ BEGIN JOIN agencyMode am on am.id = t.agencyModeFk JOIN address a on a.id = t.addressFk WHERE t.id = vTicket; - - SELECT Hora INTO vShipmentHour + + SELECT Hora INTO vShipmentHour FROM tmp.production_buffer; END IF; - + RETURN vShipmentHour; END ;; DELIMITER ; @@ -46744,12 +42531,12 @@ BEGIN SELECT rate3 INTO price FROM vn.priceFixed - WHERE itemFk = vItemFk + WHERE itemFk = vItemFk AND util.VN_CURDATE() BETWEEN started AND ended ORDER BY created DESC LIMIT 1; - SELECT `value` INTO price + SELECT `value` INTO price FROM vn.specialPrice - WHERE itemFk = vItemFk + WHERE itemFk = vItemFk AND clientFk = vClientFk ; RETURN price; END ;; @@ -46774,61 +42561,40 @@ BEGIN /** * Devuelve el ticket que debe de preparar el trabajador * - * @param vWorker Id del 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 util.VN_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 > util.VN_CURDATE() - -- AND tst.`code` = 'ON_PREPARATION' - ) sub ON sub.ticketFk = i.Id_Ticket - WHERE odbc_date > util.VN_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 + DECLARE PREVIOUS_PREPARATION INT; + DECLARE vHasBeenPreviouslyPrepared INT DEFAULT 0; + + 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 + SELECT workerFk as worker FROM `grant` g + JOIN grantGroup gg ON g.`groupFk` = gg.id WHERE gg.description = 'Comerciales'; - - DELETE wc.* + + 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'; - + 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 @@ -46849,18 +42615,18 @@ BEGIN LEFT JOIN vn.zone z ON z.id = t.zoneFk WHERE t.shipped BETWEEN vYesterday AND vTodayvMidniight AND t.warehouseFk = vWarehouse - AND + AND ( (tls.code = 'PRINTED' AND wc.worker IS NULL) - OR + OR (tls.code ='PICKER_DESIGNED' AND tls.worker = vWorker) - OR + OR (tls.code = 'PRINTED_BACK') - OR + 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 @@ -46868,18 +42634,18 @@ BEGIN -- 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 - + FROM ticketTracking + WHERE ticketFk = vTicket + AND stateFk = PREVIOUS_PREPARATION; + + IF vHasBeenPreviouslyPrepared AND ticketWarehouseGet(vTicket) = 1 THEN + INSERT IGNORE INTO vn.ticketDown(ticketFk) VALUES(vTicket); - + END IF; -- END IF; - + RETURN vTicket; END ;; @@ -46903,7 +42669,7 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `getTicketTrolleyLabelCount`(vTicket BEGIN DECLARE vLabelCount INT DEFAULT 0; - SELECT labelCount INTO vLabelCount + SELECT labelCount INTO vLabelCount FROM ticketTrolley WHERE ticket = vTicket; @@ -46935,7 +42701,7 @@ BEGIN /** * @deprecated Use account.userGetId() */ - RETURN account.userGetId(); + RETURN account.myUser_getId(); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -46986,7 +42752,7 @@ BEGIN SELECT code INTO vUserCode FROM worker - WHERE userFk = account.userGetId(); + WHERE userFk = account.myUser_getId(); RETURN vUserCode; END ;; @@ -46995,35 +42761,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 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 */ ; @@ -47036,7 +42773,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `hasAnyNegativeBase`() RETURNS tinyint(1) DETERMINISTIC -BEGIN +BEGIN /* Calcula si existe alguna base imponible negativa * Requiere la tabla temporal vn.ticketToInvoice(id) @@ -47044,14 +42781,14 @@ BEGIN * 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 @@ -47064,59 +42801,9 @@ BEGIN 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 */ ; @@ -47138,17 +42825,17 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `hasItemsInSector`(vTicketFk INT, vSe BEGIN DECLARE vItemCount INT; - + SELECT count(*) INTO vItemCount - FROM vn.sale s + 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 */ ; @@ -47171,7 +42858,7 @@ BEGIN DECLARE vCountry INT; DECLARE hasSomeNegativeBase BOOLEAN; - SELECT s.countryFk + SELECT s.countryFk INTO vCountry FROM supplier s JOIN ticket t ON t.companyFk = s.id @@ -47180,9 +42867,9 @@ BEGIN SELECT COUNT(*) INTO hasSomeNegativeBase FROM ( SELECT SUM(ROUND(s.quantity * s.price * (100 - s.discount)/100,2)) taxableBase - FROM sale s + FROM sale s JOIN item i ON i.id = s.itemFk - JOIN itemTaxCountry itc + JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = vCountry WHERE s.ticketFk = vTicket GROUP BY itc.taxClassFk @@ -47212,12 +42899,12 @@ BEGIN DECLARE totalAmount DECIMAL(10,2); SELECT SUM(vat) INTO totalAmount - FROM ( + FROM ( SELECT iot.vat FROM invoiceOutTax iot JOIN invoiceOut io ON io.id = iot.invoiceOutFk WHERE io.ref = vInvoiceRef - UNION ALL + UNION ALL SELECT ioe.amount FROM invoiceOutExpence ioe JOIN invoiceOut io ON io.id = ioe.invoiceOutFk @@ -47247,7 +42934,7 @@ BEGIN DECLARE vIssued DATE; DECLARE vSerial VARCHAR(15); - SELECT issued, ref + SELECT issued, ref INTO vIssued, vSerial FROM invoiceOut WHERE id = vSelf; @@ -47264,6 +42951,46 @@ 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 `invoiceOut_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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceOut_getWeight`(vInvoice VARCHAR(15)) RETURNS decimal(10,2) + READS SQL DATA +BEGIN +/** + * Calcula el peso de una factura emitida + * + * @param vInvoice Id de la factura + * @return vTotalWeight peso de la factura + */ + DECLARE vTotalWeight DECIMAL(10,2); + + SELECT SUM(CAST(IFNULL(i.stems, 1) + * s.quantity + * IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000 AS DECIMAL(10,2))) + INTO vTotalWeight + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN itemCost ic ON ic.itemFk = i.id + AND ic.warehouseFk = t.warehouseFk + WHERE t.refFk = vInvoice + AND i.intrastatFk; + + RETURN vTotalWeight; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 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 */ ; @@ -47278,9 +43005,9 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceSerial`(vClientFk INT, vCompa DETERMINISTIC BEGIN /** - * Obtiene la serie de de una factura + * Obtiene la serie de de una factura * dependiendo del area del cliente. - * + * * @param vClientFk Id del cliente * @param vCompanyFk Id de la empresa * @param vType Tipo de factura ["R", "M", "G"] @@ -47312,47 +43039,34 @@ DELIMITER ; /*!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 +CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceSerialArea`(vType CHAR(1), vTaxArea VARCHAR(25)) RETURNS char(1) CHARSET utf8mb3 COLLATE utf8mb3_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 + SELECT + CASE vTaxArea + WHEN 'CEE' THEN 'H' + WHEN 'WORLD' THEN 'E' + ELSE '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; + SELECT + CASE vTaxArea + WHEN 'CEE' THEN 'H' + WHEN 'WORLD' THEN 'E' + ELSE '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; + SELECT + CASE vTaxArea + WHEN 'CEE' THEN 'V' + WHEN 'WORLD' THEN 'X' + ELSE 'A' + END INTO vSerie; END IF; RETURN vSerie; END ;; @@ -47392,7 +43106,7 @@ BEGIN 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; @@ -47417,18 +43131,18 @@ 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 + 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 */ ; @@ -47465,7 +43179,7 @@ BEGIN WHERE sl.scan_id = vScanId AND t.Id_Ruta ) t1; - + RETURN vDistinctRoutesInThePallet = 1; END ;; DELIMITER ; @@ -47489,20 +43203,20 @@ BEGIN DECLARE vPacking INTEGER DEFAULT 0; DECLARE vItemFk INTEGER; - + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - - SELECT IFNULL(packing,0) INTO vPacking - FROM vn.buy + + 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 + FROM (SELECT packing , created FROM vn.itemShelving WHERE itemFk = vItemFk @@ -47515,39 +43229,11 @@ BEGIN ) 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 */ ; @@ -47572,11 +43258,11 @@ BEGIN 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 ( @@ -47586,12 +43272,12 @@ BEGIN JOIN vn.itemPlacementSupplyList ipsl ON ipsl.sectorFk = ispss.sectorFk AND ipsl.itemFk = ispss.itemFk WHERE p.sectorFk = vSectorFk AND ipsl.saldo > 0 - ) sub + ) sub ORDER BY distance LIMIT 1; - + RETURN vClosestParkingFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -47613,17 +43299,17 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `itemsInSector_get`(vTicketFk INT, vS BEGIN DECLARE vItemCount INT; - + SELECT count(*) INTO vItemCount - FROM vn.sale s + 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 */ ; @@ -47696,29 +43382,29 @@ 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 + 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)), + 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 */ ; @@ -47755,7 +43441,7 @@ BEGIN FROM packaging p JOIN item i ON i.id = vSelf WHERE p.id = vPackaging; - + RETURN vVolume; END ;; @@ -47776,7 +43462,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `lastDayOfWeek`(vYear INT, vWeek INT) RETURNS date DETERMINISTIC -BEGIN +BEGIN /** * Returns the date of the last day of the week * @@ -47800,41 +43486,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 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,util.VN_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 */ ; @@ -47850,16 +43501,16 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `machine_checkPlate`(vPlate VARCHAR(1 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 + FROM machine m WHERE m.plate = vPlate - ) THEN + ) THEN RETURN TRUE; ELSE RETURN FALSE; @@ -47886,9 +43537,9 @@ BEGIN DECLARE result INT; DECLARE vSenderFk INT; - SELECT id INTO vSenderFk - FROM account.user WHERE `name` = account.userGetName(); - + SELECT id INTO vSenderFk + FROM account.user WHERE `name` = account.myUser_getName(); + RETURN (SELECT messageSendWithUser(vSenderFk, vRecipient, vMessage)); END ;; DELIMITER ; @@ -47915,9 +43566,9 @@ BEGIN DECLARE vSendDate DATETIME DEFAULT util.VN_NOW(); DECLARE vSender VARCHAR(255) CHARSET utf8; - SELECT `name` INTO vSender + SELECT `name` INTO vSender FROM account.user WHERE id = vSenderFK; - + SET vRecipient = LOWER(vRecipient); DROP TEMPORARY TABLE IF EXISTS tRecipients; @@ -47938,7 +43589,7 @@ BEGIN IF vCount = 0 THEN RETURN vCount; - END IF; + END IF; SET vUuid = UUID(); @@ -47949,7 +43600,7 @@ BEGIN message = vMessage, sendDate = vSendDate; - INSERT INTO messageInbox (uuid, sender, recipient, finalRecipient, message, sendDate) + INSERT INTO messageInbox (uuid, sender, recipient, finalRecipient, message, sendDate) SELECT vUuid, vSender, vRecipient, finalRecipient, vMessage, vSendDate FROM tRecipients; @@ -47981,38 +43632,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 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 */ ; @@ -48055,7 +43674,7 @@ 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 @@ -48106,6 +43725,45 @@ 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 `packaging_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 `packaging_calculate`(isPackageReturnable TINYINT(1), + packagingReturnFk INT(11), + base DECIMAL(10,2), + price DECIMAL(10,2), + upload VARCHAR(255)) RETURNS decimal(10,2) + DETERMINISTIC +BEGIN + DECLARE vAmount INT DEFAULT NULL; + DECLARE vValue DECIMAL(10,2); + + IF isPackageReturnable THEN + SELECT cb.freightPackagingFull INTO vAmount + FROM returnBuckets cb + WHERE cb.id = packagingReturnFk; + + SET vValue = IF (vAmount IS NULL, + IFNULL(base,0), + vAmount / IFNULL(upload, 0) + IFNULL(base, 0)); + ELSE + SET vValue = IFNULL(price, 0) + IFNULL(base, 0); + END IF; + + RETURN vValue; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP FUNCTION IF EXISTS `phytoPassport` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48120,7 +43778,7 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `phytoPassport`(vRef VARCHAR(15)) RET DETERMINISTIC BEGIN DECLARE vPhyto TEXT CHARSET utf8 COLLATE utf8_unicode_ci; -SELECT +SELECT GROUP_CONCAT(i.id, ':', ppa.denomination, @@ -48155,6 +43813,38 @@ WHERE ''), '%'); 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 `priceFixed_getRate2` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = 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 `priceFixed_getRate2`(vFixedPriceFk INT, vRate3 DOUBLE) RETURNS double +BEGIN + + DECLARE vWarehouse INT; + DECLARE vRate2 DOUBLE; + + SELECT round(vRate3 * (1 + ((r.rate2 - r.rate3)/100)), 2) INTO vRate2 + FROM vn.rate r + JOIN vn.priceFixed p ON p.id = vFixedPriceFk + WHERE r.dated <= p.started + AND r.warehouseFk = p.warehouseFk + ORDER BY r.dated DESC + LIMIT 1; + + RETURN vRate2; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -48177,20 +43867,20 @@ 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 + 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, + SELECT r.id routeFk, zf.friendship zoneFriendship FROM vn.route r JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk @@ -48198,16 +43888,16 @@ BEGIN 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 + 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 @@ -48219,7 +43909,7 @@ BEGIN ORDER BY zoneFriendship DESC, friendshipSum DESC ) sub LIMIT 1; - + RETURN vRouteFk; END ;; DELIMITER ; @@ -48244,9 +43934,9 @@ BEGIN DECLARE vRouteFk INT; DECLARE vAddressFk INT; DECLARE vShipped DATETIME; - + SELECT addressFk, date(shipped) INTO vAddressFk, vShipped - FROM vn.ticket + FROM vn.ticket WHERE id = vTicketFk; SELECT routeFk INTO vRouteFk @@ -48260,7 +43950,7 @@ BEGIN ORDER BY friendshipSum DESC ) sub LIMIT 1; - + RETURN vRouteFk; END ;; DELIMITER ; @@ -48284,20 +43974,20 @@ 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 + 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, + SELECT r.id routeFk, zf.friendship zoneFriendship FROM vn.route r JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk @@ -48305,16 +43995,16 @@ BEGIN 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 + 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 @@ -48326,7 +44016,7 @@ BEGIN ORDER BY zoneFriendship DESC, friendshipSum DESC ) sub LIMIT 1; - + RETURN vRouteFk; END ;; DELIMITER ; @@ -48347,26 +44037,26 @@ 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 + 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 + 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 + ORDER BY zg.`depth` DESC LIMIT 1; RETURN IFNULL(vIsForbbiden, FALSE); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -48386,7 +44076,7 @@ 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); @@ -48398,60 +44088,60 @@ BEGIN SET vLetraInicial = SUBSTR(vCIF, 1, 1); SET vLetraFinal = SUBSTR(vCIF, 9, 1); SET vParteNumerica = SUBSTR(vCIF, 2, 7); - - WHILE i < 7 DO - + + 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 */ ; @@ -48471,7 +44161,7 @@ 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); @@ -48480,45 +44170,45 @@ BEGIN 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 */ ; @@ -48543,23 +44233,62 @@ BEGIN 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 `ticketCollection_getNoPacked` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = 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 `ticketCollection_getNoPacked`(vCollectionFk INT) RETURNS varchar(100) CHARSET utf8 COLLATE utf8_unicode_ci + DETERMINISTIC +BEGIN + + /* + * return message with tickets and collection if there is tickets of a collection without expeditions + * + * @param vCollectionFk the collection to check + * @return an array with collection and tickets without expeditions + * + */ + + DECLARE vAnswer VARCHAR(100) DEFAULT ''; + + IF collection_isPacked(vCollectionFk) = FALSE 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 */ ; @@ -48600,9 +44329,9 @@ BEGIN DROP TEMPORARY TABLE tmp.ticket, tmp.ticketTotal; - + RETURN vTotal; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -48622,7 +44351,7 @@ 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; @@ -48634,7 +44363,7 @@ BEGIN DECLARE vExpeditionsCount INT; DECLARE vIsValenciaPath BOOLEAN DEFAULT FALSE; -SELECT `order` +SELECT `order` INTO PACKING_ORDER FROM state WHERE code = 'PACKING'; @@ -48645,7 +44374,7 @@ SELECT t.routeFk, t.warehouseFk, IFNULL(ts.productionOrder,0) LEFT JOIN ticketState ts on ts.ticket = t.id WHERE t.id = vTicketId; -SELECT (ag.`name` = 'VN_VALENCIA') +SELECT (ag.`name` = 'VN_VALENCIA') INTO vIsValenciaPath FROM vn2008.Rutas r JOIN vn2008.Agencias a on a.Id_Agencia = r.Id_Agencia @@ -48659,7 +44388,7 @@ IF vIsValenciaPath THEN -- Rutas Valencia 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 @@ -48668,7 +44397,7 @@ IF vIsValenciaPath THEN -- Rutas Valencia AND t.warehouseFk = vMyWarehouse AND t.id != vTicketid; - SELECT COUNT(*) + SELECT COUNT(*) INTO vRestTicketsPacking FROM ticket t LEFT JOIN ticketState ts on t.id = ts.ticket @@ -48715,17 +44444,17 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `ticketSplitCounter`(vTicketFk INT) R BEGIN DECLARE vSplitCounter VARCHAR(15); - SELECT CONCAT(OK,'/',Total, IF(OK = Total ,' LS','')) INTO vSplitCounter + SELECT CONCAT(printedStickers,'/',Total, IF(printedStickers = Total ,' LS','')) INTO vSplitCounter FROM ( - SELECT count(l.Id_Movimiento) as OK, COUNT(*) as Total + SELECT count(l.Id_Movimiento) as printedStickers, 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 */ ; @@ -48774,21 +44503,21 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `ticketTotalVolumeBoxes`(vTicketId IN 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 ;; @@ -48813,7 +44542,7 @@ BEGIN DECLARE vWarehouseFk INT; SELECT warehouseFk INTO vWarehouseFk - FROM ticket + FROM ticket WHERE id = vTicketFk; RETURN vWarehouseFk; @@ -48836,18 +44565,18 @@ 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 + 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 + JOIN vn.volumeConfig vc WHERE sv.ticketFk = vTicketFk; - + RETURN vCC; END ;; @@ -48869,44 +44598,44 @@ 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 + JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk WHERE sg.id = vParamFk AND sg.created > TIMESTAMPADD(WEEK,-1, util.VN_CURDATE()) LIMIT 1; - + IF vValidFk THEN - + RETURN vValidFk; - + LEAVE proc; - + END IF; -- Tabla vn.collection SELECT c.id INTO vValidFk - FROM vn.collection c + FROM vn.collection c WHERE c.id = vParamFk AND c.created > TIMESTAMPADD(WEEK,-1, util.VN_CURDATE()); - + IF vValidFk THEN - + RETURN vValidFk; - + LEAVE proc; - + END IF; -- Tabla vn.ticket @@ -48914,17 +44643,17 @@ proc:BEGIN FROM vn.ticket t WHERE t.id = vParamFk AND t.shipped > TIMESTAMPADD(WEEK,-1, util.VN_CURDATE()); - + IF vValidFk THEN - + RETURN vValidFk; - + LEAVE proc; - + END IF; RETURN NULL; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -48950,8 +44679,8 @@ BEGIN * @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 + + 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 @@ -48960,9 +44689,9 @@ BEGIN 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 + JOIN expeditionBoxVol ebv ON ebv.boxFk = e.freightItemFk WHERE t.id = vTicketFk; - + END IF; RETURN deliveryPrice; END ;; @@ -48986,16 +44715,16 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_getWeight`(vTicketFk INT) RET 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 ;; @@ -49026,10 +44755,10 @@ BEGIN * @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) @@ -49039,7 +44768,7 @@ BEGIN 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, @@ -49055,7 +44784,7 @@ BEGIN vTicket ); END IF; - + RETURN vTicket; END ;; DELIMITER ; @@ -49076,15 +44805,15 @@ 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 + WHERE rm.beachFk AND t.id = vTicketFk; - + RETURN hasUbication; END ;; @@ -49093,6 +44822,41 @@ 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 `ticket_isOutClosureZone` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = 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_isOutClosureZone`(vSelf INT) RETURNS tinyint(1) + DETERMINISTIC +BEGIN +/** + * Devuelve true/false si la hora actual supera la hora del cierre del ticket más el tiempo configurado en packingDelay + * + * @param vSelf Ticket id + * @return true o false + */ + DECLARE vIsTicketInTime BOOL; + + SELECT TIMEDIFF(util.VN_CURTIME(), zc.hour + INTERVAL tc.packingDelay HOUR) > 0 INTO vIsTicketInTime + FROM vn.ticket t + JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk + LEFT JOIN vn.ticketConfig tc ON TRUE + WHERE t.id = vSelf + AND zc.dated = util.VN_CURDATE(); + + RETURN vIsTicketInTime; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 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 */ ; @@ -49103,7 +44867,8 @@ DELIMITER ; /*!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 +CREATE DEFINER=`root`@`localhost` FUNCTION `till_new`( + vClient INT ,vBank INT ,vAmount DOUBLE ,vConcept VARCHAR(25) @@ -49198,7 +44963,7 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `timeWorkerControl_getDirection`(vUse READS SQL DATA BEGIN /** - * Verifica la dirección de la fichada + * 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' @@ -49211,40 +44976,40 @@ BEGIN 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 + 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 + 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 + 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 + IF vPreviousDirection = 'in' THEN RETURN 'out'; ELSE SELECT UNIX_TIMESTAMP(MAX(timed)) INTO vLastTimeIn - FROM vn.workerTimeControl - WHERE userFk = vUserFk + FROM vn.workerTimeControl + WHERE userFk = vUserFk AND direction ='in' AND timed < vPrevious; IF vTimedSeconds - vLastTimeIn <= vDayStayMax THEN @@ -49298,11 +45063,11 @@ 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 */ @@ -49310,26 +45075,26 @@ BEGIN DECLARE vTravelFk INT; IF vLanded THEN - - SELECT IFNULL(MAX(tr.id),0) INTO vTravelFk + + 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 + JOIN vn.agencyMode am ON am.id = tr.agencyModeFk 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, util.VN_CURDATE(), vWarehouseFk, wOut.id, am.id - FROM vn.warehouse wOut + + INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyModeFk) + SELECT vLanded, util.VN_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 + + 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 @@ -49337,11 +45102,11 @@ BEGIN AND wOut.name = 'Holanda' AND landed = vLanded; END IF; - + END IF; - + RETURN vTravelFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -49368,21 +45133,21 @@ BEGIN 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 */ ; @@ -49409,66 +45174,27 @@ BEGIN 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 `VN_CURDATE` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 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 `VN_CURTIME` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 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 `VN_NOW` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 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 */ ; @@ -49543,16 +45269,16 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `workerMachinery_isRegistered`(vWorke 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(*) + + IF (SELECT COUNT(*) FROM machineWorker m WHERE m.workerFk = vWorkerFk - AND m.inTimed >= TIMESTAMPADD(HOUR , -(SELECT maxHours from machineWorkerConfig), util.VN_NOW()) AND ISNULL(m.outTimed)) - THEN + AND m.inTimed >= TIMESTAMPADD(HOUR , -(SELECT maxHours from machineWorkerConfig), util.VN_NOW()) AND ISNULL(m.outTimed)) + THEN RETURN TRUE; ELSE RETURN FALSE; @@ -49584,15 +45310,15 @@ BEGIN * @param vTimeOut * @return vNigthlyHours */ - DECLARE vNigthlyHours DECIMAL(5,2); + 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), + IF(TIME(vTimeIn) BETWEEN endNightlyHours AND startNightlyHours, + CONCAT(DATE(vTimeIn), ' ', startNightlyHours), vTimeIn), - IF(TIME(vTimeOut) BETWEEN endNightlyHours AND startNightlyHours, - CONCAT(DATE(vTimeOut), ' ', endNightlyHours), + IF(TIME(vTimeOut) BETWEEN endNightlyHours AND startNightlyHours, + CONCAT(DATE(vTimeOut), ' ', endNightlyHours), vTimeOut))) / vSecondsPerHour INTO vNigthlyHours FROM vn.workerTimeControlConfig; @@ -49613,7 +45339,7 @@ DELIMITER ; /*!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) +CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_add`( vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) DETERMINISTIC BEGIN DECLARE vDirection VARCHAR(6); @@ -49624,47 +45350,47 @@ BEGIN 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 + 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 + + SELECT COUNT(*) INTO vHasDirectionOut FROM workerTimeControl wtc - WHERE userFk = vUserFk + WHERE userFk = vUserFk AND direction = 'out' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); + 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); + 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 ; @@ -49682,7 +45408,7 @@ DELIMITER ; /*!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) +CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_addDirection`( vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) DETERMINISTIC BEGIN DECLARE vDirection VARCHAR(6); @@ -49693,47 +45419,47 @@ BEGIN 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 + 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 + + SELECT COUNT(*) INTO vHasDirectionOut FROM workerTimeControl wtc - WHERE userFk = vUserFk + WHERE userFk = vUserFk AND direction = 'out' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); + 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); + 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 ; @@ -49759,17 +45485,17 @@ BEGIN * @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 + FROM vn.workerTimeControl WHERE userFk = vWorkerFk AND direction = 'in'; - IF (SELECT MOD(COUNT(*),2) - FROM vn.workerTimeControl - WHERE userFk = vWorkerFk AND + IF (SELECT MOD(COUNT(*),2) + FROM vn.workerTimeControl + WHERE userFk = vWorkerFk AND timed >= vLastIn - ) THEN + ) THEN RETURN TRUE; ELSE RETURN FALSE; @@ -49790,7 +45516,8 @@ DELIMITER ; /*!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, +CREATE DEFINER=`root`@`localhost` FUNCTION `xdiario_new`( + vAsiento INT, vDated DATE, vSubaccount VARCHAR(12), vAccount VARCHAR(12), @@ -49863,7 +45590,7 @@ BEGIN SET `type` = vType, `name` = vName, parentFk = vParentFk; - + SET vSelf = LAST_INSERT_ID(); UPDATE zoneGeoRecalc SET isChanged = TRUE; @@ -49887,7 +45614,7 @@ DELIMITER ; 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) @@ -49915,24 +45642,24 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `addressTaxArea`() READS SQL DATA BEGIN /** - * Devuelve el taxArea para un conjunto de Consignatarios y empresas, + * 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 + 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 + WHEN cClient.isUeeMember AND cSupplier.isUeeMember AND c.countryFk != s.countryFk AND c.isVies THEN 'CEE' - WHEN a.isEqualizated AND c.countryFk = vSpainCountryCode THEN + WHEN a.isEqualizated AND c.countryFk = vSpainCountryCode THEN 'EQU' ELSE 'NATIONAL' @@ -49969,27 +45696,27 @@ BEGIN * @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 util.VN_CURDATE(); SELECT agencyFk INTO vAgency FROM agencyMode WHERE id= vAgencyMode; l: LOOP - + CALL agencyHourGetShipped(vLanded,vAddress,vAgency); - SELECT shipped INTO vShipped + 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 ; @@ -50040,7 +45767,7 @@ BEGIN LIMIT 1 ) t WHERE IF(vDated = util.VN_CURDATE(), t.maxHour > HOUR(util.VN_NOW()), TRUE) AND t.substractDay < 225; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -50063,14 +45790,14 @@ 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 vDone BOOL DEFAULT FALSE; DECLARE vCur CURSOR FOR SELECT DISTINCT a.id FROM agency a @@ -50094,13 +45821,13 @@ BEGIN 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 @@ -50129,7 +45856,7 @@ BEGIN END WHILE; CLOSE vCur; - + SELECT * FROM tmp.agencyModeWarehouseList; DROP TEMPORARY TABLE tmp.agencyModeWarehouseList; END ;; @@ -50155,43 +45882,9 @@ BEGIN 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 */ ; @@ -50229,7 +45922,7 @@ BEGIN DECLARE cWarehouses CURSOR FOR SELECT warehouseFk, shipped FROM tmp.zoneGetShipped; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; @@ -50238,7 +45931,7 @@ BEGIN CALL vn.zone_getShipped (vDate, vAddress, vAgencyMode, FALSE); DROP TEMPORARY TABLE IF EXISTS tmp.availableCalc; - CREATE TEMPORARY TABLE tmp.availableCalc( + CREATE TEMPORARY TABLE tmp.availableCalc( calcFk INT UNSIGNED, PRIMARY KEY (calcFk) ) @@ -50249,7 +45942,7 @@ BEGIN l: LOOP SET vDone = FALSE; FETCH cWarehouses INTO vWarehouse, vShipment; - + IF vDone THEN LEAVE l; END IF; @@ -50268,7 +45961,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 `available_calc__` */; +/*!50003 DROP PROCEDURE IF EXISTS `bankEntity_checkBic` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -50278,60 +45971,22 @@ DELIMITER ; /*!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) +CREATE DEFINER=`root`@`localhost` PROCEDURE `bankEntity_checkBic`(vBic VARCHAR(255)) 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; + /** + * If the bic length is Incorrect throw exception + * + * @param vBic bic code + */ - DECLARE cWarehouses CURSOR FOR - SELECT warehouseFk, shipped FROM tmp.zoneGetShipped; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; + DECLARE vConfigBicLenght INT; - -- Establecemos los almacenes y las fechas que van a entrar al disponible + SELECT bicLength INTO vConfigBicLenght + FROM vn.bankEntityConfig bec; - 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; + IF LENGTH(vBic) <> vConfigBicLenght THEN + CALL util.throw(CONCAT('bic must be of length ', vConfigBicLenght )); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -50355,14 +46010,14 @@ 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 + FROM vn.bankPolicy bp + LEFT JOIN vn.supplier s ON s.id = bp.supplierFk LEFT JOIN vn.bank b ON b.id = bp.bankFk @@ -50436,7 +46091,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buyUltimateFromInterval`(vWarehouseFk SMALLINT, vStarted DATE, vEnded DATE) BEGIN /** - * Calcula las últimas compras realizadas + * Calcula las últimas compras realizadas * desde un rango de fechas. * * @param vWarehouseFk Id del almacén si es NULL se actualizan todos @@ -50444,42 +46099,46 @@ BEGIN * @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; + IF vEnded IS NULL THEN + SET vEnded = vStarted; + END IF; - -- Item - + 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; - + (PRIMARY KEY (itemFk, warehouseFk), INDEX(buyFk), INDEX(landed), INDEX(warehouseFk), INDEX(itemFk)) + ENGINE = MEMORY + SELECT itemFk, + warehouseFk, + buyFk, + MAX(landed) landed + FROM (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.price2 > 0 + AND NOT b.isIgnored + AND b.quantity > 0 + ORDER BY t.landed DESC, b.id DESC + LIMIT 10000000000000000000) sub + GROUP BY itemFk, warehouseFk; + INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) - SELECT - b.itemFk, - t.warehouseInFk warehouseFk, - b.id buyFk, - t.landed - FROM buy b + 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 @@ -50487,65 +46146,68 @@ BEGIN 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 + 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 + SELECT itemFk, + warehouseFk, + buyFk, + MAX(landed) landed + FROM (SELECT b.itemFk, + t.warehouseInFk warehouseFk, + b.id buyFk, + t.landed, + itemOriginalFk + 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 + ORDER BY t.landed DESC, b.id DESC + LIMIT 10000000000000000000) sub + GROUP BY itemOriginalFk, warehouseFk; + + 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 @@ -50553,58 +46215,6 @@ BEGIN 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, util.VN_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 */ ; @@ -50636,14 +46246,29 @@ BEGIN 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 + DECLARE vWeight DECIMAL(10,2); + DECLARE vPacking INT; + + SELECT b.entryFk, + b.itemFk, + i.packingOut, + ic.merchandise, + vc.standardFlowerBox, + b.weight, + b.packing + INTO + vEntryFk, + vItemFk, + vPackingOut, + vIsMerchandise, + vStandardFlowerBox, + vWeight, + vPacking 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 + LEFT JOIN packaging p ON p.id = b.packageFk AND NOT p.isBox JOIN volumeConfig vc ON TRUE WHERE b.id = vSelf; @@ -50661,17 +46286,16 @@ BEGIN 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; - + IF vWeight AND vPacking THEN + UPDATE itemCost SET + grams = vWeight * 1000 / vPacking + WHERE itemFk = vItemFk + AND warehouseFk = vWarehouse; + END IF; END IF; SELECT isFeedStock INTO vIsFeedStock - FROM warehouse WHERE id = vWarehouseOut AND id <> 13; + FROM warehouse WHERE id = vWarehouseOut; IF vIsFeedStock THEN INSERT IGNORE INTO producer(`name`) @@ -50682,7 +46306,7 @@ BEGIN WHERE b.id = vSelf; END IF; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -50716,6 +46340,145 @@ 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 `buy_getSplit` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_getSplit`(vSelf INT, vDated DATE) +BEGIN +/** + * Devuelve las ventas de una compra + * + * @param vSelf Identificador de vn.buy + */ + DECLARE vItemFk INT; + DECLARE vPacking INT; + DECLARE vRemaining INT; + DECLARE vLabels INT; + DECLARE vSaleFk INT; + DECLARE vAmount INT; + DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vCounter INT DEFAULT 1; + + DECLARE cur CURSOR FOR + SELECT s.id, s.quantity - IFNULL(l.stem, 0) + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + LEFT JOIN vn.saleLabel l ON l.saleFk = s.id + WHERE s.itemFk = vItemFk + AND t.shipped >= vDated + AND w.isLogiflora + AND IFNULL(l.stem, 0) < s.quantity + LOCK IN SHARE MODE; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + + -- Obtiene los datos de la compra + + SELECT itemFk, packing, quantity + INTO vItemFk, vPacking, vRemaining + FROM vn.buy WHERE id = vSelf; + + -- Crea splits de los tickets + CREATE OR REPLACE TEMPORARY TABLE tmp.split + ( + id INT, + labels INT DEFAULT 0, + counter INT DEFAULT 0 + ) + ENGINE = MEMORY; + + OPEN cur; + + l: LOOP + SET vDone = FALSE; + + FETCH cur INTO vSaleFk, vAmount; + + IF vDone OR vRemaining = 0 THEN + LEAVE l; + END IF; + + SET vAmount = LEAST(vAmount, vRemaining); + + SET vRemaining = vRemaining - vAmount; + + SET vLabels = vAmount DIV vPacking; + + INSERT INTO tmp.split + VALUES (vSaleFk, vLabels, 0); + + INSERT INTO vn.saleLabel + SET + saleFk = vSaleFk, + stem = vAmount, + label = vLabels + ON DUPLICATE KEY UPDATE + stem = stem + VALUES(stem), + label = label + VALUES(label); + + END LOOP; + + CLOSE cur; + + -- Aumentar las lineas de tmp.split para tener una por cada etiqueta + WHILE vLabels > vCounter DO + INSERT INTO tmp.split(id, labels, counter) + VALUES(vSaleFk, vLabels, vCounter); + SET vCounter = vCounter + 1; + END WHILE; + + UPDATE tmp.split + SET counter = counter + 1; + + -- Devuelve los splits creados + SELECT CONCAT(sp.counter,'/',sp.labels) labels, + COALESCE(sfc.nickname, sfa.nickname, a.nickname) destination, + s.itemFk, + i.longName, + i.`size`, + vn.ticketSplitCounter(t.id) counter, + IF(sfa.id OR sfc.id, + a.nickname, + CONCAT(a.id, ' ', p.`name`,' (', c.`code`,')')) destination2 + FROM tmp.split sp + JOIN vn.sale s ON sp.id = s.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.ticket t ON t.id = s.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 + LEFT JOIN vn.splitFilter sfa ON sfa.autonomyFk = p.autonomyFk + LEFT JOIN vn.splitFilter sfc ON sfc.clientFk = t.clientFk; + + -- Limpia y confirma cambios + + DROP TEMPORARY TABLE + tmp.split; + + 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 `buy_getVolume` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -50737,12 +46500,12 @@ BEGIN 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 + 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 + LEFT JOIN temperature t ON t.code = it.temperatureFk GROUP BY Temp; END ;; DELIMITER ; @@ -50762,21 +46525,21 @@ DELIMITER ; 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 + 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 + 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); + AND t.agencyModeFk IN (0, vAgencyFk); CALL buy_getVolume(); DROP TEMPORARY TABLE tmp.buy; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -50795,62 +46558,19 @@ DELIMITER ; 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 + + INSERT INTO tmp.buy SELECT b.id - FROM buy b - JOIN entry e ON e.id = b.entryFk + 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 */ ; @@ -50869,28 +46589,29 @@ DELIMITER ; 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 + DECLARE vWarehouseFk INT; + DECLARE vHasNotPrice BOOL; + DECLARE vBuyingValue DECIMAL(10,3); + DECLARE vPackageFk VARCHAR(10); + DECLARE vIsWarehouseFloramondo BOOL; + + SELECT t.landed, t.warehouseInFk, (w.`name` = 'Floramondo') + INTO vLanded, vWarehouseFk, vIsWarehouseFloramondo 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 + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + JOIN warehouse w ON w.id = t.warehouseInFk LIMIT 1; - CALL vn.rate_getPrices(vLanded, vWarehouseFk); - - -- quitado los cubos a floramondo revisar en buy_tarifas_entry + CALL rate_getPrices(vLanded, vWarehouseFk); + 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 @@ -50898,38 +46619,22 @@ BEGIN 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 agencyMode am ON am.id = tr.agencyModeFk JOIN tmp.rate r - SET b.freightValue = @PF:= - ROUND(IFNULL(((am.m3 * @cm3:= item_getVolume(b.itemFk, b.packageFk)) / 1000000) / b.packing,0),3), + JOIN volumeConfig vc + SET b.freightValue = @PF:= IFNULL(((am.m3 * @m3:= item_getVolume(b.itemFk, b.packageFk) / 1000000) + / b.packing) * IF(am.hasWeightVolumetric, GREATEST(b.weight / @m3 / vc.aerealVolumetricDensity, 1), 1), 0), 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.packageValue = @EF:= IF(vIsWarehouseFloramondo, 0, IFNULL(ROUND(IF(p.isPackageReturnable, p.returnCost / b.packing , p.`value` / b.packing), 3),0)), 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 + + SELECT (b.buyingValue = b.price2), b.buyingValue, b.packageFk + INTO vHasNotPrice, 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 ; @@ -50937,6 +46642,159 @@ 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 `buy_recalcPricesByAwb` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_recalcPricesByAwb`(IN awbFk varchar(18)) +BEGIN +/** + * inserta en tmp.buyRecalc las compras de un awb + * + * @param awbFk + */ + DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc; + + CREATE TEMPORARY TABLE tmp.buyRecalc + SELECT b.id + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN duaEntry de ON de.entryFk = e.id + JOIN dua d ON d.id = de.duaFk + JOIN awb a ON a.id = d.awbFk + WHERE a.code = awbFk; + + CALL buy_recalcPrices(); + + DROP TEMPORARY TABLE tmp.buyRecalc; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_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_recalcPricesByBuy` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_recalcPricesByBuy`(IN vBuyFk INT(11)) +BEGIN +/** + * Recalcula los precios de una compra + * + * @param vBuyFk + */ + DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc; + + CREATE TEMPORARY TABLE tmp.buyRecalc + SELECT vBuyFk id; + + CALL buy_recalcPrices(); + + DROP TEMPORARY TABLE tmp.buyRecalc; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_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_recalcPricesByEntry` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_recalcPricesByEntry`(IN vEntryFk INT(11)) +BEGIN +/** + * Recalcula los precios de una entrada + * + * @param vEntryFk + */ + DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc; + + CREATE TEMPORARY TABLE tmp.buyRecalc + SELECT b.id + FROM buy b + WHERE b.entryFk = vEntryFk; + + CALL buy_recalcPrices(); + + DROP TEMPORARY TABLE tmp.buyRecalc; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_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_scan` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_scan`(vBarcode VARCHAR(512)) +BEGIN +/** + * Busca compras a partir de un código de barras de subasta, las marca como + * escaneadas y como etiquetas impresas y las devuelve. + * + * @param vBarcode Código de compra de una etiqueta de subasta + * @select (buy, do_photo) Identificadores de compra escaneados + */ + CALL edi.ekt_scan(vBarcode); + + DROP TEMPORARY TABLE IF EXISTS tBuy; + CREATE TEMPORARY TABLE tBuy + SELECT id buyFk + FROM vn.buy b + LIMIT 0; + + INSERT INTO tBuy(buyFk) + SELECT b.id + FROM buy b + JOIN tmp.ekt t ON t.ektFk = b.ektFk + JOIN vn.entry en ON en.id = b.entryFk + JOIN vn.travel tr ON tr.id = en.travelFk + JOIN vn.warehouse w ON w.id = tr.warehouseInFk + JOIN vn.country c ON c.id = w.countryFk AND c.code = 'NL'; + + SELECT b.id buy, i.doPhoto do_photo, b.stickers - b.printedStickers stickersToPrint + FROM tBuy tb + JOIN vn.buy b ON tb.buyFk = b.id + JOIN vn.item i ON i.id = b.itemFk; + + UPDATE vn.buy b + JOIN tBuy tb ON tb.buyFk = b.id + SET b.printedStickers = b.stickers; + + DROP TEMPORARY TABLE tmp.ekt, tBuy; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_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 */ ; @@ -50955,14 +46813,14 @@ BEGIN * @param vWarehouseFk Id del almacén * @param vItemFk Id del Artículo * @param vGrouping Cantidad de grouping - */ - + */ + CALL vn.buyUltimate(vWarehouseFk, util.VN_CURDATE()); UPDATE vn.buy b JOIN tmp.buyUltimate bu ON b.id = bu.buyFk - SET b.`grouping` = vGrouping - WHERE bu.warehouseFk = vWarehouseFk + SET b.`grouping` = vGrouping + WHERE bu.warehouseFk = vWarehouseFk AND bu.itemFk = vItemFk; DROP TEMPORARY TABLE tmp.buyUltimate; @@ -50985,7 +46843,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_updatePacking`(vWarehouseFk INT, vItemFk INT, vPacking INT) BEGIN /** - * Actualiza packing + * Actualiza packing * * @param vWarehouseFk warehouse del item * @param vItemFk id del item @@ -50995,287 +46853,12 @@ BEGIN UPDATE buy b JOIN tmp.buyUltimate bu ON b.id = bu.buyFk - SET b.packing = vPacking - WHERE bu.warehouseFk = vWarehouseFk + 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 = util.VN_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 */ ; @@ -51310,7 +46893,7 @@ BEGIN */ DROP TEMPORARY TABLE IF EXISTS tmp.item; CREATE TEMPORARY TABLE tmp.item - ENGINE = MEMORY + ENGINE = MEMORY SELECT vItemFk itemFk; CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); @@ -51332,7 +46915,7 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_calculate`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT) -BEGIN +BEGIN /** * Calcula los articulos disponibles y sus precios * @@ -51340,13 +46923,12 @@ BEGIN * @param vLanded Fecha de recepcion de mercancia * @param vAddressFk Id del consignatario * @param vAgencyModeFk Id de la agencia - * @return tmp.ticketCalculateItem(itemFk, available, producer, + * @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; @@ -51376,22 +46958,22 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.ticketCalculateItem; CREATE TEMPORARY TABLE tmp.ticketCalculateItem( - itemFk INT(11) NOT NULL, + 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), + 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), + 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 @@ -51413,20 +46995,20 @@ BEGIN bu.buyFk, vZoneFk FROM `cache`.available a - LEFT JOIN cache.availableNoRaids anr ON anr.item_id = a.item_id + 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 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 + 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) @@ -51443,20 +47025,24 @@ BEGIN 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 + 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 + LEFT JOIN vn.zoneItemType zit + ON zit.zoneFk = vZoneFk + AND zit.itemTypeFk = itt.id + LEFT JOIN vn.agencyModeItemType ait + ON ait.agencyModeFk = vAgencyModeFk + AND ait.itemTypeFk = itt.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); - + AND (itc.isReclining OR it.`size` IS NULL OR it.`size` < z.itemMaxSize OR z.itemMaxSize IS NULL) + AND cit.id IS NULL + AND zit.id IS NULL + AND ait.id IS NULL; + DROP TEMPORARY TABLE tmp.buyUltimate; CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); @@ -51499,7 +47085,8 @@ BEGIN SELECT price, itemFk, priceKg, `grouping` FROM tmp.ticketComponentPrice WHERE warehouseFk = vWarehouseFk - ORDER BY (rate = 2) DESC + ORDER BY (rate = 2) DESC, price + LIMIT 10000000000000000000 ) sub GROUP BY itemFk ) bl ON bl.itemFk = tl.itemFk @@ -51510,7 +47097,6 @@ BEGIN END LOOP; CLOSE cTravelTree; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -51527,78 +47113,44 @@ DELIMITER ; /*!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) +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) - */ - +/** + * 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; + 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 + CREATE OR REPLACE TEMPORARY TABLE tmp.ticketComponentCalculate (PRIMARY KEY (itemFk, warehouseFk)) ENGINE = MEMORY - SELECT - tl.itemFk, - tl.warehouseFk, + 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, + tl.buyFk, i.typeFk, IF(i.hasKgPrice, b.weight / b.packing, NULL) weightGrouping FROM tmp.ticketLot tl @@ -51606,8 +47158,8 @@ BEGIN 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 specialPrice sp ON sp.itemFk = i.id + AND sp.clientFk = vClientFk LEFT JOIN ( SELECT * FROM ( SELECT pf.itemFk, @@ -51618,132 +47170,133 @@ BEGIN pf.rate3, zw.warehouseFk FROM priceFixed pf - JOIN zoneWarehouse zw ON zw.zoneFk = vZoneFk - AND zw.warehouseFk IN (pf.warehouseFk,0) + 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 + LIMIT 10000000000000000000 ) tpf GROUP BY tpf.itemFk, tpf.warehouseFk - ) pf ON pf.itemFk = tl.itemFk + ) pf ON pf.itemFk = tl.itemFk AND pf.warehouseFk = tl.warehouseFk - WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01 + WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01 AND ic.merchandise - AND tl.zoneFk = vZoneFk + AND tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk; -- Coste INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) - SELECT - tcc.warehouseFk, - tcc.itemFk, - c2.id, + SELECT tcc.warehouseFk, + tcc.itemFk, + c2.id, b.buyingValue + b.freightValue + b.packageValue + b.comissionValue - FROM tmp.ticketComponentCalculate tcc + 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, + SELECT tcc.warehouseFk, + tcc.itemFk, + c2.id, tcc.rate3 - b.buyingValue - b.freightValue - b.packageValue - b.comissionValue - FROM tmp.ticketComponentCalculate tcc + 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 + CREATE OR REPLACE 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 * + 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), + ), + cc.maxPriceIncreasingRatio), 3) FROM tmp.ticketComponentBase tcb JOIN vn.component c2 ON c2.code = 'debtCollection' + JOIN vn.clientConfig cc 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; + 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 + SELECT tcb.warehouseFk, + tcb.itemFk, + c2.id, + ROUND(base * (0.01 + wm.pricesModifierRate), 3) manaAuto FROM tmp.ticketComponentBase tcb JOIN `client` c on c.id = vClientFk - JOIN workerMana wm ON c.salesPersonFk = wm.workerFk + 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), + 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 + 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; - + + -- Individual + INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) + SELECT tcb.warehouseFk, + tcb.itemFk, + c2.id, + IFNULL(ROUND(tcb.base * c2.tax, 4), 0) cost + FROM tmp.ticketComponentBase tcb + JOIN vn.component c2 ON c2.code = 'individual' + JOIN vn.client c ON c.id = vClientFk + JOIN vn.businessType bt ON bt.code = c.businessTypeFk + WHERE bt.code = 'individual'; + -- Venta por paquetes INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcc.warehouseFk, tcc.itemFk, c2.id, tcc.rate2 - tcc.rate3 + 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)) + CREATE OR REPLACE TEMPORARY TABLE tmp.`zone` (INDEX (id)) ENGINE = MEMORY SELECT vZoneFk id; CALL zone_getOptionsForShipment(vShipped, TRUE); - + -- Reparto INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFK, + SELECT tcc.warehouseFK, tcc.itemFk, - c2.id, + 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 @@ -51752,30 +47305,20 @@ BEGIN 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 + LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk AND ic.itemFk = tcc.itemFk - HAVING cost <> 0; + 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 + + CREATE OR REPLACE TEMPORARY TABLE tmp.ticketComponentCopy ENGINE = MEMORY SELECT * FROM tmp.ticketComponent; -- Precio especial INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFk, - tcc.itemFk, - c2.id, + 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 @@ -51786,11 +47329,11 @@ BEGIN GROUP BY tcc.itemFk, tcc.warehouseFk HAVING ABS(sumCost) > 0.001; - -- Rappel + -- Rappel INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFk, - tcc.itemFk, - IFNULL(c.componentFk ,c2.id), + 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 @@ -51799,9 +47342,7 @@ BEGIN WHERE tcc.warehouseFk = vWarehouseFk GROUP BY tcc.itemFk, tcc.warehouseFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentSum; - CREATE TEMPORARY TABLE tmp.ticketComponentSum + CREATE OR REPLACE TEMPORARY TABLE tmp.ticketComponentSum (INDEX (itemFk, warehouseFk)) ENGINE = MEMORY SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, c.classRate @@ -51809,24 +47350,22 @@ BEGIN 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, + CREATE OR REPLACE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY + SELECT tcc.warehouseFk, + tcc.itemFk, 1 rate, - IF(tcc.groupingMode = 1, tcc.`grouping`, 1) `grouping`, + 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 + CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightGrouping priceKg FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk + JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk AND tcs.warehouseFk = tcc.warehouseFk - WHERE IFNULL(tcs.classRate, 1) = 1 + 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, + SELECT tcc.warehouseFk, tcc.itemFk, 2 rate, tcc.packing `grouping`, @@ -51835,37 +47374,36 @@ BEGIN 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 + 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`, + SELECT tcc.warehouseFk, + tcc.itemFk, + 3 rate, + tcc.available `grouping`, SUM(tcs.sumCost) price, - SUM(tcs.sumCost) / weightGrouping priceKg + SUM(tcs.sumCost) / weightGrouping priceKg FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk + JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk AND tcs.warehouseFk = tcc.warehouseFk - WHERE IFNULL(tcs.classRate, 3) = 3 + 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 + SELECT * FROM tmp.ticketComponentRate ORDER BY price LIMIT 10000000000000000000 ) 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 */ ; @@ -51884,7 +47422,7 @@ DELIMITER ; 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, @@ -51894,9 +47432,9 @@ BEGIN 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 ( + CREATE TEMPORARY TABLE tmp.ticketComponentPrice ( `warehouseFk` INT UNSIGNED NOT NULL, `itemFk` INT NOT NULL, `rate` INT NOT NULL, @@ -51905,7 +47443,7 @@ BEGIN `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; + )ENGINE=MEMORY DEFAULT CHARSET=utf8; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -51924,7 +47462,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_componentPurge`() BEGIN - DROP TEMPORARY TABLE + DROP TEMPORARY TABLE tmp.ticketComponentPrice, tmp.ticketComponent, tmp.ticketLot; @@ -51948,12 +47486,12 @@ 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, + * @return tmp.ticketCalculateItem(itemFk, available, producer, * item, size, stems, category, inkFk, image, origin, price) * @return tmp.ticketLot(warehouseFk, itemFk, available, buyFk) * @return tmp.ticketComponent @@ -51975,10 +47513,10 @@ proc: BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.item; CREATE TEMPORARY TABLE tmp.item - ENGINE = MEMORY + ENGINE = MEMORY SELECT 10 itemFk; -- Establece los almacenes y las fechas que van a entrar al disponible -SELECT 1; +SELECT 1; CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, FALSE); SELECT 2; DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; @@ -51993,25 +47531,25 @@ SELECT 2; 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, + 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), + 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), + origin VARCHAR(3), price DECIMAL(10,2), priceKg DECIMAL(10,2), PRIMARY KEY `itemFk` (`itemFk`) ) ENGINE = MEMORY DEFAULT CHARSET=utf8; - + OPEN cTravelTree; l: LOOP @@ -52038,35 +47576,35 @@ SELECT 5; 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, + itemFk, + available, + producer, + item, + size, + stems, + category, inkFk, image, origin, price, priceKg) - SELECT - tl.itemFk, + SELECT + tl.itemFk, SUM(tl.available) available, - p.name producer, - i.name item, - i.size size, - i.stems, - i.category, - i.inkFk, + p.name producer, + i.name item, + i.size size, + i.stems, + i.category, + i.inkFk, i.image, - o.code origin, + o.code origin, bl.price, bl.priceKg FROM tmp.ticketLot tl @@ -52074,11 +47612,12 @@ SELECT 6; LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible JOIN origin o ON o.id = i.originFk JOIN ( - SELECT * + SELECT * FROM (SELECT price, itemFk, priceKg FROM tmp.ticketComponentPrice WHERE warehouseFk = vWarehouseFk - ORDER BY (rate = 2) DESC) sub + ORDER BY (rate = 2) DESC + LIMIT 10000000000000000000) sub GROUP BY itemFk ) bl ON bl.itemFk = tl.itemFk WHERE tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk @@ -52089,8 +47628,8 @@ SELECT 6; CLOSE cTravelTree; DROP TEMPORARY TABLE tmp.item; -SELECT 7; - +SELECT 7; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -52115,104 +47654,113 @@ BEGIN DECLARE v18Month DATE; DECLARE v26Month DATE; DECLARE v3Month DATE; - DECLARE vTrashId varchar(15); + DECLARE vTrashId VARCHAR(15); + DECLARE v5Years DATE; - SET vDateShort = TIMESTAMPADD(MONTH, -2, util.VN_CURDATE()); - SET vOneYearAgo = TIMESTAMPADD(YEAR,-1,util.VN_CURDATE()); - SET vFourYearsAgo = TIMESTAMPADD(YEAR,-4,util.VN_CURDATE()); - SET v18Month = TIMESTAMPADD(MONTH, -18,util.VN_CURDATE()); - SET v26Month = TIMESTAMPADD(MONTH, -26,util.VN_CURDATE()); - SET v3Month = TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()); + SET vDateShort = util.VN_CURDATE() - INTERVAL 2 MONTH; + SET vOneYearAgo = util.VN_CURDATE() - INTERVAL 1 YEAR; + SET vFourYearsAgo = util.VN_CURDATE() - INTERVAL 4 YEAR; + SET v18Month = util.VN_CURDATE() - INTERVAL 18 MONTH; + SET v26Month = util.VN_CURDATE() - INTERVAL 26 MONTH; + SET v3Month = util.VN_CURDATE() - INTERVAL 3 MONTH; + SET v5Years = util.VN_CURDATE() - INTERVAL 5 YEAR; DELETE FROM ticketParking WHERE created < vDateShort; - DELETE FROM routesMonitor WHERE dated < vDateShort; - DELETE FROM workerTimeControlLog 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 < util.VN_CURDATE() AND visible = 0; DELETE FROM ticketDown WHERE created < TIMESTAMPADD(DAY,-1,util.VN_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 + 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 FROM ticketTracking WHERE created < v18Month; + DELETE tobs FROM ticketObservation tobs JOIN ticket t ON tobs.ticketFk = t.id WHERE t.shipped < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); 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 + 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; + -- Robert ubicacion anterior de trevelLog comentario para debug DELETE FROM zoneEvent WHERE `type` = 'day' AND dated < v3Month; DELETE bm - FROM buyMark bm - JOIN buy b ON b.id = bm.id + 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; - + DELETE b FROM vn.buy b + JOIN vn.entryConfig e ON e.defaultEntry = b.entryFk + WHERE b.created < vDateShort; + DELETE FROM vn.itemShelvingLog WHERE created < vDateShort; + DELETE FROM vn.stockBuyed WHERE creationDate < vDateShort; + DELETE FROM vn.itemCleanLog WHERE created < util.VN_NOW() - INTERVAL 1 YEAR; + DELETE FROM printQueue WHERE statusCode = 'printed' AND created < vDateShort; + -- Equipos duplicados - DELETE w.* + 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 + + 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 + + DELETE c FROM vn.claim c JOIN vn.claimState cs ON cs.id = c.claimStateFk WHERE cs.description = "Anulado" AND - c.created < vDateShort; + c.created < vDateShort; DELETE FROM vn.expeditionTruck - WHERE ETD < v3Month; - - -- borrar travels sin entradas + 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, util.VN_CURDATE()) AND e.travelFk IS NULL; - - SELECT dt.id into vTrashId - FROM vn.dmsType dt - WHERE dt.code = 'trash'; + WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL; - UPDATE tmp.thermographToDelete th + 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 + 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, util.VN_CURDATE()) AND e.travelFk IS NULL; - - -- borrar entradas sin compras - DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; + WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_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, util.VN_CURDATE()); + + -- borrar entradas sin compras + DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; CREATE TEMPORARY TABLE tmp.entryToDelete SELECT e.* FROM vn.entry e @@ -52222,29 +47770,29 @@ BEGIN 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; + 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,util.VN_CURDATE()); + WHERE created < TIMESTAMPADD(YEAR,-4,util.VN_CURDATE()); - UPDATE tmp.routeToDelete tmp + UPDATE tmp.routeToDelete tmp JOIN vn.dms d ON d.id = tmp.gestdocFk SET d.dmsTypeFk = vTrashId; - DELETE r + 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; + + -- 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,util.VN_CURDATE()); + SELECT * + FROM vn.dua + WHERE operated < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); UPDATE tmp.duaToDelete tm JOIN vn.dms d ON d.id = tm.gestdocFk @@ -52253,23 +47801,25 @@ BEGIN DELETE d FROM tmp.duaToDelete tmp JOIN vn.dua d ON d.id = tmp.id; - - DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,util.VN_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; + + DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); + + -- 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; - + + DELETE FROM travelLog WHERE creationDate < v3Month; + + CALL shelving_clean; + + DELETE FROM chat WHERE dated < v5Years; + + DELETE tt FROM ticketTracking tt JOIN vn.ticket t ON tt.ticketFk = t.id + WHERE t.shipped <= vDateShort; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -52288,16 +47838,17 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clean_logiflora`() BEGIN - /* partir en 2 procedimientos, uno que borre compras y otro articulos - * item_clean, buy_clean - * */ - +/** + * Partir en 2 procedimientos, uno que borre compras y otro articulos + * item_clean, buy_clean. + */ + DECLARE vMaxDated DATE DEFAULT TIMESTAMPADD(DAY, - 7, util.VN_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; @@ -52307,33 +47858,33 @@ BEGIN 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 + JOIN vn.travel tr ON tr.id = e.travelFk + JOIN vn.agencyMode am ON am.id = tr.agencyModeFk 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; + read_loop: LOOP - CLOSE cur1; - - DROP TEMPORARY TABLE tmp.buy; - - DROP TEMPORARY TABLE IF EXISTS tmp.item; + 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 @@ -52341,33 +47892,34 @@ BEGIN 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 + LEFT JOIN vn.buy b ON b.itemFk = i.id + LEFT JOIN bs.waste w ON w.itemFk = i.id + WHERE i.supplyResponseFk AND o.id IS NULL - AND b.id IS NULL + AND b.id IS NULL AND s.id IS NULL + AND w.rate 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; + read_loop: LOOP - CLOSE cur2; - - DROP TEMPORARY TABLE tmp.item; - + 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 */ ; @@ -52386,11 +47938,9 @@ DELIMITER ; 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; - + UPDATE vn.itemShelving + SET visible = 0 + WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk COLLATE utf8_unicode_ci; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -52409,9 +47959,9 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clientCreate`( vFirstname VARCHAR(50), - vSurnames VARCHAR(50), - vFi VARCHAR(9), - vAddress TEXT, + vSurnames VARCHAR(50), + vFi VARCHAR(9), + vAddress TEXT, vPostcode CHAR(5), vCity VARCHAR(25), vProvinceFk SMALLINT(5), @@ -52430,7 +47980,7 @@ BEGIN DECLARE vIsTaxDataChecked TINYINT(1) DEFAULT 1; DECLARE vHasCoreVnl BOOLEAN DEFAULT TRUE; DECLARE vMandateTypeFk INT DEFAULT 2; - + INSERT INTO `client` ( id, name, @@ -52458,21 +48008,21 @@ BEGIN vProvinceFk, vCity, vPostcode, - CONCAT(vSurnames, ' ', vFirstname), + CONCAT(vSurnames, ' ', vFirstname), vPayMethodFk, vDueDay, vDefaultCredit, vIsTaxDataChecked, vHasCoreVnl, FALSE - ) ON duplicate key update + ) 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); @@ -52502,21 +48052,21 @@ BEGIN */ DECLARE vClientDebt DOUBLE; - + SELECT vn.clientGetDebt(vClientFk, util.VN_CURDATE()) INTO vClientDebt; - + INSERT INTO vn.greuge(clientFk, description, amount, shipped, greugeTypeFk) VALUES (vClientFk, 'Saldo pendiente', vClientDebt, util.VN_CURDATE(), 5); - + CALL vn.clientGreugeSpray(vClientFk, TRUE, '', TRUE); - + INSERT INTO vn.greuge(clientFk, description, amount, shipped, greugeTypeFk) SELECT vClientFk, 'Liquidación cliente', sum(amount), util.VN_CURDATE(), 5 FROM vn.greuge WHERE clientFk = vClientFk; - - UPDATE vn.client - SET salesPersonFk = NULL + + UPDATE vn.client + SET salesPersonFk = NULL WHERE id = vClientFk; END ;; @@ -52529,56 +48079,52 @@ 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 `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 - */ +* 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%' + SELECT id into vIsRemittanced + FROM receipt + WHERE invoiceFk LIKE 'REMESA%' AND payed > util.firstDayOfMonth(util.VN_CURDATE()) - limit 1; - + LIMIT 1; + DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; CREATE TEMPORARY TABLE tmp.clientGetDebt SELECT clientFk - FROM bs.defaulter + FROM bs.defaulter WHERE created = util.VN_CURDATE() AND amount; - + CALL clientGetDebt(util.VN_CURDATE()); UPDATE client c - JOIN bi.defaulters d ON d.client = c.id AND d.date = util.VN_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 = util.VN_CURDATE(), - u.active = FALSE - WHERE (d.amount > config.defaultersMaxAmount - AND rk.risk > 0) + JOIN bi.defaulters d ON d.client = c.id AND d.date = util.VN_CURDATE() + JOIN config ON TRUE + 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 = util.VN_CURDATE() + WHERE (d.amount > config.defaultersMaxAmount + AND rk.risk > 0) AND c.typeFk = 'normal' - AND r.id IS NULL - AND w.id IS NULL + AND r.id IS NULL AND (vIsRemittanced OR pm.code <> 'bankDraft'); - + DROP TEMPORARY TABLE tmp.clientGetDebt; END ;; DELIMITER ; @@ -52590,66 +48136,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 `clientGetDebt`(vDate DATE) BEGIN /** - * Calcula el riesgo para los clientes activos + * Call client_getDebt * * @table tmp.clientGetDebt(clientFk) * @param vDate Fecha maxima de los registros * @return tmp.risk */ - DECLARE vStarted DATETIME DEFAULT TIMESTAMPADD(DAY, -35, util.VN_CURDATE()); - DECLARE vEnded DATETIME; - - SET vEnded = TIMESTAMP(IFNULL(vDate, util.VN_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; + CALL vn.client_getDebt(vDate); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -52681,33 +48183,33 @@ BEGIN DECLARE vIssued DATETIME; DECLARE vBalance DOUBLE DEFAULT 0.00; DECLARE cur CURSOR FOR - SELECT - created, - issued, + SELECT + created, + issued, ROUND(amount, 2) AS balance FROM invoiceOut - WHERE clientFk = vClientFk AND companyFk = vCompanyFk - UNION ALL - SELECT - created, - payed, + WHERE clientFk = vClientFk AND companyFk = vCompanyFk + UNION ALL + SELECT + created, + payed, ROUND(-1 * amountPaid, 2) AS balance - FROM receipt + 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; @@ -52719,66 +48221,66 @@ BEGIN SET vDone = TRUE; END IF; END LOOP; - + CLOSE cur; - - SELECT - issued, - CAST(debtOut AS DECIMAL(10,2)) debtOut, + + SELECT + issued, + CAST(debtOut AS DECIMAL(10,2)) debtOut, CAST(debtIn AS DECIMAL(10,2)) debtIn, - ref, - companyFk, + ref, + companyFk, priority FROM - (SELECT - NULL AS issued, - SUM(amountUnpaid) AS debtOut, - NULL AS debtIn, - 'Saldo Anterior' AS ref, + (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 + 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, + 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 + 1 + FROM invoiceOut + WHERE clientFk = vClientFK AND issued >= vDate - UNION ALL - - SELECT - r.payed, - NULL as debtOut, - r.amountPaid, - r.invoiceFk, + UNION ALL + + SELECT + r.payed, + NULL as debtOut, + r.amountPaid, + r.invoiceFk, r.companyFk, - 0 + 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 + 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 ; @@ -52803,25 +48305,25 @@ BEGIN 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 - + 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, + amount, + shipped, + greugeTypeFk) + VALUES( vClientFk, 'Desasignación', - -1 * vMana, - util.VN_CURDATE(), - vGreugeTypeMana); - - END IF; + -1 * vMana, + util.VN_CURDATE(), + vGreugeTypeMana); + + END IF; SELECT sum(amount) INTO vGreuge FROM vn.greuge @@ -52836,25 +48338,25 @@ BEGIN 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 + SELECT DISTINCT t.clientFk, floor(cr.yearSale / 12) 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.workerMana wm ON wm.workerFk = c.salesPersonFk JOIN vn.claimRatio cr ON cr.clientFk = c.id - WHERE ms.worker = IF(onlyForHisOwner, vOwner, ms.worker) + WHERE wm.workerFk = IF(onlyForHisOwner, vOwner, wm.workerFk) AND t.shipped >= TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()) AND c.id != vClientFk HAVING monthSale > 100; - + SELECT SUM(monthSale) INTO vTotalSale FROM tmp.clientList; @@ -52863,9 +48365,9 @@ BEGIN FROM tmp.clientList UNION ALL SELECT vClientFk, 'Reparto greuge', -vGreuge, util.VN_CURDATE(), vGreugeTypeFk; - + END IF; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -52886,12 +48388,12 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `clientPackagingOverstock`(vClientFk BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.clientPackagingOverstock; CREATE TEMPORARY TABLE tmp.clientPackagingOverstock - ENGINE = MEMORY - SELECT itemFk, - sum(GotfromClient) - sum(SenttoClient) as devueltos, + ENGINE = MEMORY + SELECT itemFk, + sum(GotfromClient) - sum(SenttoClient) as devueltos, sum(InvoicedtoClient) - sum(InvoicedfromClient) as facturados, - LEAST( - sum(GotfromClient) - sum(SenttoClient), + LEAST( + sum(GotfromClient) - sum(SenttoClient), sum(InvoicedtoClient) - sum(InvoicedfromClient) ) as abonables FROM @@ -52899,14 +48401,14 @@ BEGIN SELECT t.*, IF(@month = month, 0, 1) monthEnd, @month := month - FROM + 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, + 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, @@ -52925,11 +48427,11 @@ BEGIN @month := 0 month, t.companyFk FROM sale s - JOIN ticket t on t.id = s.ticketFk - JOIN packaging p ON p.itemFk = s.itemFk + 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 t.shipped > '2017-11-30' AND p.isPackageReturnable UNION ALL SELECT NULL, @@ -52942,7 +48444,7 @@ BEGIN 'Histórico', NULL, NULL - + FROM ticketPackagingStartingStock tps LEFT JOIN packageEquivalentItem pe ON pe.itemFk = tps.itemFk WHERE tps.clientFk = vClientFk @@ -52958,8 +48460,8 @@ BEGIN NULL AS refFk, NULL, t.companyFk - FROM ticketPackaging tp - JOIN ticket t on t.id = tp.ticketFk + 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 @@ -52969,6 +48471,7 @@ BEGIN GROUP BY x.id, x.itemFk ) t ORDER BY itemFk, shipped DESC + LIMIT 10000000000000000000 ) t2 GROUP BY itemFk; END ;; @@ -52995,11 +48498,11 @@ BEGIN -- SET vGraceDays = GREATEST(vGraceDays, 90); CALL vn.clientPackagingOverstock(vClientFk,vGraceDays); - + SELECT id INTO vWarehouseFk FROM vn.warehouse WHERE hasConfectionTeam; - + CALL vn.ticket_add( vClientFk ,util.VN_CURDATE() @@ -53012,78 +48515,22 @@ BEGIN ,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 */ ; @@ -53121,9 +48568,9 @@ BEGIN 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 + 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; @@ -53132,7 +48579,7 @@ BEGIN 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')); + VALUES (vClientFk, account.myUser_getId(), 'update', CONCAT('Se ha desasignado el cliente por que no ha comprado en 3 meses')); FETCH rs INTO vClientFk; END WHILE; CLOSE rs; @@ -53183,38 +48630,141 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `client_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL) BEGIN - +/** + * Compara los datos de nuestros clientes con + * los que hay en la base de datos de sage + * + * @param vDateTo + * @param vIsConciliated + * @table tmp.ledgerComparative (id, date, account, debit, credit, companyFk) + */ DECLARE vDateFrom DATE; - SET vDateTo = TIMESTAMP(vDateTo,'23:59:59'); - SELECT util.firstDayOfYear(vDateTo) INTO vDateFrom; + DECLARE vMaxTolerance DECIMAL(10,2); - SELECT s.nickname, c.id , c.accountingAccount , sub1.mysql , sub1.sage, sub1.mysql - sub1.sage diference, sub1.companyFk , c.name + SELECT util.firstDayOfYear(vDateTo), util.dayEnd(vDateTo), maxTolerance + INTO vDateFrom, vDateTo, vMaxTolerance + FROM vn.ledgerConfig; + + SELECT s.nickname, + c.id, + c.accountingAccount, + sub1.mysql, + sub1.sage, + sub1.mysql - sub1.sage difference, + 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 + JOIN (SELECT sub.companyFk, + sub.clientFk, + CAST(ROUND(SUM(sub.mysql), 2) AS DECIMAL(10,2)) mysql, + CAST(ROUND(SUM(sub.sage), 2) AS DECIMAL(10,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 + SELECT r.companyFk, + r.clientFk, + r.amountPaid, + 0 + FROM receipt r + WHERE payed BETWEEN vDateFrom AND vDateTo + AND IF(vIsConciliated,r.isConciliate, TRUE) = TRUE + UNION ALL + SELECT lc.companyFk, + c.id, + 0, + - (NZ(lc.credit) - NZ(lc.debit)) + FROM tmp.ledgerComparative lc + JOIN client c ON c.accountingAccount = lc.account + WHERE lc.`date` BETWEEN vDateFrom AND vDateTo )sub - GROUP BY companyFk, clientFk + 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; - + JOIN company co ON co.id = sub1.companyFk + LEFT JOIN clientUnpaid cu ON cu.clientFk = c.id + AND cu.dated BETWEEN vDateFrom AND vDateTo + WHERE pm.outstandingDebt + AND co.code <> 'BLK' + AND cu.clientFk IS NULL + HAVING ABS(difference) > vMaxTolerance + 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_getDebt` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_getDebt`(vDate DATE) +BEGIN +/** + * Calculates the risk for active clients + * + * @table tmp.clientGetDebt(clientFk) + * @param vDate maximum date of records + * @return tmp.risk + */ + + DECLARE vStarted DATETIME; + DECLARE vEnded DATETIME; + + SELECT TIMESTAMPADD(MONTH, -riskScope, util.VN_CURDATE()) INTO vStarted FROM clientConfig; + SET vEnded = TIMESTAMP(IFNULL(vDate, util.VN_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 */ ; @@ -53237,9 +48787,9 @@ 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, @@ -53247,40 +48797,40 @@ BEGIN 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, util.VN_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 + + 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 @@ -53293,7 +48843,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 `clonTravelComplete__` */; +/*!50003 DROP PROCEDURE IF EXISTS `cmrPallet_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -53303,136 +48853,40 @@ DELIMITER ; /*!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)) +CREATE DEFINER=`root`@`localhost` PROCEDURE `cmrPallet_add`(vExpeditionPalletFk INT, vCmrFk INT) 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; +/** + * Añade registro a tabla cmrPallet. + * + * @param vExpeditionPalletFk Id de expeditionPallet + * @param vCmrFk Id de cmrPallet + */ + DECLARE vIsACurrentExpeditionPallet BOOL; + DECLARE vIsACurrentCMR BOOL; + DECLARE vYesterday DATE; + + SET vYesterday = util.yesterday(); + + SELECT COUNT(*) INTO vIsACurrentExpeditionPallet + FROM vn.expeditionPallet cp + WHERE cp.id = vExpeditionPalletFk + AND cp.built >= vYesterday; + + IF !vIsACurrentExpeditionPallet THEN + CALL util.throw('expeditionPalletNotExist'); + END IF; + + SELECT COUNT(*) INTO vIsACurrentCMR + FROM vn.cmr c + WHERE c.id = vCmrFk + AND c.created >= vYesterday; + + IF vIsACurrentCMR THEN + INSERT INTO cmrPallet (cmrFk, expeditionPalletFk) + VALUES(vCmrFk, vExpeditionPalletFk); + ELSE + Call util.throw('cmrNotExist'); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -53452,38 +48906,36 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `cmr_getByTicket`(vTicketFk INT) BEGIN - DECLARE vLandingDays INT; - - SELECT landingDays INTO vLandingDays - FROM vn.cmrConfig; + DECLARE vLanded DATE; + + SELECT DATE_ADD(util.VN_CURDATE(), INTERVAL landingDays DAY) INTO vLanded + 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 + + INSERT INTO vn.cmr(ticketFk, companyFk, addressFromFk, addressToFk, ead) + SELECT vTicketFk, t.companyFk, a.id, t.addressFk, vLanded 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 + 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(util.VN_NOW(), util.VN_NOW() + INTERVAL vLandingDays DAY); - + + INSERT INTO vn.cmr(ead) VALUES(vLanded); + SELECT LAST_INSERT_ID(); - + END IF; END ;; DELIMITER ; @@ -53491,55 +48943,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 `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(util.VN_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 */ ; @@ -53555,7 +48958,7 @@ BEGIN /** * Insert the monthly CMR summary in vn.mail on the 5th of each month. */ - + SET SESSION group_concat_max_len = 1000000; -- IF (DAY(util.VN_CURDATE()) = 5) THEN INSERT INTO @@ -53583,7 +48986,7 @@ BEGIN CMR Ticket ' - , GROUP_CONCAT(' ', c.id, ' ', c.ticketFk, ' ' ORDER BY c.id SEPARATOR '' ), + , GROUP_CONCAT(' ', c.id, ' ', c.ticketFk, ' ' ORDER BY c.id SEPARATOR '' ), '

@@ -53601,54 +49004,10 @@ BEGIN -- Actualizamos el estado a 'Enviado' UPDATE vn.cmr c SET c.state = 'Sent' - WHERE c.state = 'Pending' + WHERE c.state = 'Pending' AND MONTH(c.created) = MONTH(util.VN_CURDATE() - INTERVAL 1 MONTH) AND YEAR(c.created) = YEAR(util.VN_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 */ ; @@ -53667,77 +49026,59 @@ DELIMITER ; 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 - */ +/** 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(util.VN_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 + DECLARE vWarehouseFk INT; + DECLARE vCurrentYear INT DEFAULT YEAR(util.VN_NOW()); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + + CREATE TEMPORARY TABLE tmp.sale + ENGINE = MEMORY + SELECT s.ticketFk, s.id saleFk, s.itemFk, s.quantity + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vParamFk + UNION ALL + SELECT s.ticketFk, s.id, s.itemFk, s.quantity + FROM vn.sale s + WHERE s.ticketFk = vParamFk; + + + SELECT t.warehouseFk + INTO vWarehouseFk + FROM vn.ticket t JOIN tmp.sale ts ON ts.ticketFk = t.id - JOIN vn.warehouse w ON w.id = t.warehouseFk - LIMIT 1; - + 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 + + 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` + CREATE TEMPORARY TABLE tmp.`grouping` (INDEX(itemFk)) - ENGINE = MEMORY + ENGINE = MEMORY SELECT b.itemFk, - CASE b.groupingMode - WHEN 0 THEN 1 + CASE b.groupingMode + WHEN 0 THEN 1 WHEN 2 THEN b.packing ELSE b.`grouping` - END AS `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 @@ -53747,132 +49088,96 @@ BEGIN CREATE TEMPORARY TABLE tmp.salePlacementList ENGINE MEMORY - SELECT ts.saleFk, + 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,util.VN_NOW())) */ ) as priority, - CONCAT( - IF( iss.id, - CONCAT('< ', IFNULL(wk.`code`, '---'),' > '), - ''), - p.`code`) COLLATE utf8_general_ci as placement , - sh.priority shelvingPriority, + 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,util.VN_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 + sc.isPreviousPrepared, + iss.id as itemShelvingSaleFk, + ts.ticketFk + ,iss.id + , st.saleFk as salePreviousPrepared + , iss.userFk + , ts.quantity + FROM tmp.sale ts + LEFT JOIN (SELECT DISTINCT saleFk FROM vn.saleTracking st - JOIN vn.state s ON s.id = st.stateFk + 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 - ; - - + 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.id = vWarehouseFk + 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 + 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, + ORDER BY isPreviousPrepared DESC, + itemShelvingSaleFk IS NULL DESC, + visible >= quantity DESC, + visible > 0 DESC, + IFNULL(shelvingPriority,0) DESC, priority + LIMIT 10000000000000000000 ) sub - GROUP BY saleFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList_3; + 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 + 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_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; - + SET s1.saleOrder = s3.saleOrder; + + -- Anula el orden de antigüedad y ordena por ubicación + UPDATE tmp.salePlacementList + SET saleOrder = `order`; + + SELECT spl.* + FROM tmp.salePlacementList spl + JOIN vn.sale s ON s.id = spl.saleFk + ORDER BY saleOrder, + isPreviousPrepared DESC, + itemShelvingSaleFk DESC, + IF(vIsPicker, visible = 0, TRUE), + s.quantity <= spl.visible DESC, + 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; - + tmp.sale2, + tmp.`grouping`, + tmp.salePlacementList, + tmp.grouping2, + tmp.salePlacementList_2, + tmp.salePlacementList_3; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -53894,27 +49199,112 @@ 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(util.VN_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) + + 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_assign` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_assign`(vUserFk INT, OUT vCollectionFk INT) +proc:BEGIN +/* Comprueba si existen colecciones libres que se ajustan al perfil del usuario + * y le asigna la más antigua. + * Añade un registro al semillero de colecciones + */ + DECLARE vHasTooMuchCollections BOOL; + DECLARE vLockTime INT DEFAULT 15; + + -- Si hay colecciones sin terminar, sale del proceso + CALL vn.collection_get(vUserFk); + + SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0 + INTO vHasTooMuchCollections + FROM tCollection + JOIN vn.productionConfig pc ; + + DROP TEMPORARY TABLE tCollection; + + IF vHasTooMuchCollections THEN + CALL util.throw('Hay colecciones pendientes'); + LEAVE proc; + END IF; + + IF NOT GET_LOCK('collection_assign',vLockTime) THEN + LEAVE proc; + END IF; + + -- Se eliminan las colecciones sin asignar que estan obsoletas + INSERT INTO ticketTracking(stateFk, ticketFk) + SELECT s.id, tc.ticketFk + FROM vn.collection c + JOIN vn.ticketCollection tc ON tc.collectionFk = c.id + JOIN vn.state s ON s.code = 'PRINTED_AUTO' + JOIN vn.productionConfig pc + WHERE c.workerFk IS NULL + AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime; + + DELETE c.* + FROM vn.collection c + JOIN vn.productionConfig pc + WHERE c.workerFk IS NULL + AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime; + + -- Se a�ade registro al semillero + INSERT INTO vn.collectionHotbed(userFk) + VALUES(vUserFk); + + -- Comprueba si hay colecciones disponibles que se ajustan a su configuracion + SELECT MIN(c.id) + INTO vCollectionFk + FROM vn.collection c + JOIN vn.operator o + ON (o.itemPackingTypeFk = c.itemPackingTypeFk OR c.itemPackingTypeFk IS NULL) + AND o.numberOfWagons = c.wagons + AND o.trainFk = c.trainFk + AND o.warehouseFk = c.warehouseFk + AND c.workerFk IS NULL + WHERE o.workerFk = vUserFk; + + IF vCollectionFk IS NULL THEN + CALL vn.collection_new(vUserFk, vCollectionFk); + END IF; + + UPDATE vn.collection + SET workerFk = vUserFk + WHERE id = vCollectionFk; + + DO RELEASE_LOCK('collection_assign'); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -53927,30 +49317,40 @@ 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 `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,util.VN_NOW()) - AND s.quantity != 0 + /* Obtiene colección del sacador si tiene líneas pendientes + * + * @param vWorkerFk id del worker + * + * @table Devuelve tabla temporal con las colecciones pendientes. + */ + DROP TEMPORARY TABLE IF EXISTS tCollection; + + CREATE TEMPORARY TABLE tCollection + SELECT c.id collectionFk, + date(c.created) created + FROM collection c + JOIN ticketCollection tc ON tc.collectionFk = c.id + JOIN sale s ON s.ticketFk = tc.ticketFk + JOIN ticketState ts ON ts.ticketFk = tc.ticketFk + JOIN state s2 ON s2.id = ts.stateFk + JOIN productionConfig pc + 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 TIMESTAMPDIFF(HOUR, c.created , util.VN_NOW()) < pc.pendingCollectionsAge + AND s.quantity != 0 + AND s2.order < pc.pendingCollectionsOrder GROUP BY c.id - HAVING totalRow > pickedRow; - + HAVING COUNT(*) > COUNT(DISTINCT st.id); + + SELECT * FROM tCollection; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -53973,88 +49373,59 @@ 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 + FROM vn.collection WHERE id = vParamFk; - SELECT t.id ticketFk, + 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 + IFNULL(tob.description,'') observaciones, + cc.rgb 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` + 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.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 + LEFT JOIN vn.ticketObservation tob ON tob.ticketFk = t.id AND tob.observationTypeFk = 1 - WHERE t.id = vParamFk + WHERE t.id = vParamFk AND t.shipped >= util.yesterday() UNION ALL - SELECT t.id ticketFk, + 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 + IFNULL(tob.description, '') observaciones, + IF(!(vItemPackingTypeFk <=> 'V'), cc.rgb, NULL) `rgb` 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` + 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.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 + 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,util.VN_NOW()); - - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -54073,27 +49444,27 @@ DELIMITER ; 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) + + INSERT INTO ticketTracking(stateFk, ticketFk) SELECT s.id, ticketFk FROM vn.ticketCollection tc JOIN vn.state s ON s.code = 'OK' WHERE tc.collectionFk = vSelf; - - DELETE FROM vn.collection + + 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 DROP PROCEDURE IF EXISTS `collection_make` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -54103,59 +49474,389 @@ DELIMITER ; /*!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; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_make`() +proc:BEGIN +/** + * Genera colecciones de tickets sin asignar trabajador a partir de la tabla + * vn.collectionHotbed. + */ + DECLARE vUserFk INT; + DECLARE vCounter INT; + DECLARE vMaxCollectionWithoutUser INT; + DECLARE vHasEnoughFreeCollections BOOL; + DECLARE vDone INT DEFAULT FALSE; - IF vIsTrash THEN - SELECT 200 INTO vClientFk; + DECLARE cur1 CURSOR FOR + SELECT DISTINCT userFk + FROM vn.collectionHotbed; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + SELECT maxCollectionWithoutUser + INTO vMaxCollectionWithoutUser + FROM vn.productionConfig pc; + + SELECT (vMaxCollectionWithoutUser - COUNT(*)) <= 0 + INTO vHasEnoughFreeCollections + FROM vn.collection c + JOIN vn.operator o + ON o.numberOfWagons = c.wagons + AND o.trainFk = c.trainFk + AND o.itemPackingTypeFk = c.itemPackingTypeFk + WHERE c.workerFk IS NULL + AND o.workerFk = vUserFk; + + IF vHasEnoughFreeCollections THEN + LEAVE proc; 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(util.VN_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, - util.VN_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(util.VN_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(util.VN_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; - + OPEN cur1; + + read_loop: LOOP + + SET vDone = FALSE; + + FETCH cur1 INTO vUserFk; + + IF vDone THEN + LEAVE read_loop; + END IF; + + SET vCounter = vMaxCollectionWithoutUser; + + WHILE vCounter > 0 DO + + SET vCounter = vCounter - 1; + + CALL vn.collection_new(vUserFk, @vCollectionFk); + + END WHILE; + + DELETE + FROM vn.collectionHotbed + WHERE userFk = vUserFk; + + 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 `collection_new` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_new`(vUserFk INT, OUT vCollectionFk INT) +proc:BEGIN +/** + * Genera colecciones de tickets sin asignar trabajador. + * + * @param vUserFk Identificador de account.user + */ + DECLARE vWarehouseFk INT; + DECLARE vWagons INT; + DECLARE vTrainFk INT; + DECLARE vMaxTickets INT; + DECLARE vStateFk INT; + DECLARE vFirstTicketFk INT; + DECLARE vHour INT; + DECLARE vMinute INT; + DECLARE vWorkerCode VARCHAR(3); + DECLARE vWagonCounter INT DEFAULT 0; + DECLARE vTicketFk INT; + DECLARE vItemPackingTypeFk VARCHAR(1); + DECLARE vHasAssignedTickets BOOLEAN; + DECLARE vHasUniqueCollectionTime BOOL; + DECLARE vDone INT DEFAULT FALSE; + DECLARE vLockName VARCHAR(215); + DECLARE vLockTime INT DEFAULT 15; + DECLARE vFreeWagonFk INT; + DECLARE cur1 CURSOR FOR + SELECT ticketFk + FROM tmp.productionBuffer + WHERE ticketFk <> vFirstTicketFk + ORDER BY + HH, + mm, + productionOrder DESC, + m3 DESC, + agency, + zona, + routeFk, + ticketFk + LIMIT vMaxTickets; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + SELECT + pc.ticketTrolleyMax * o.numberOfWagons, + pc.hasUniqueCollectionTime, + w.code, + o.warehouseFk, + o.itemPackingTypeFk, + st.id, + CONCAT('collection_new', o.warehouseFk, ':',o.itemPackingTypeFk), + o.numberOfWagons, + o.trainFk + INTO + vMaxTickets, + vHasUniqueCollectionTime, + vWorkerCode, + vWarehouseFk, + vItemPackingTypeFk, + vStateFk, + vLockName, + vWagons, + vTrainFk + FROM vn.productionConfig pc + JOIN vn.worker w ON w.id = vUserFk + JOIN vn.state st ON st.`code` = 'ON_PREPARATION' + JOIN vn.operator o ON o.workerFk = vUserFk; + + IF NOT GET_LOCK(vLockName,vLockTime) THEN + LEAVE proc; + END IF; + + -- Se prepara el tren, con tantos vagones como sea necesario. + CREATE OR REPLACE TEMPORARY TABLE tTrain + (wagon INT, + shelve INT, + liters INT, + `lines`INT, + height INT, + ticketFk INT, + PRIMARY KEY(wagon, shelve)) + ENGINE = MEMORY; + + WHILE vWagons > vWagonCounter DO + SET vWagonCounter = vWagonCounter + 1; + + INSERT INTO tTrain(wagon, shelve, liters, `lines`, height) + SELECT vWagonCounter, cv.`level` , cv.liters , cv.`lines` , cv.height + FROM vn.collectionVolumetry cv + WHERE cv.trainFk = vTrainFk + AND cv.itemPackingTypeFk = vItemPackingTypeFk; + END WHILE; + + -- Esto desaparecerá cuando tengamos la table cache.ticket + CALL vn.productionControl(vWarehouseFk, 0); + + ALTER TABLE tmp.productionBuffer + ADD COLUMN liters INT, + ADD COLUMN height INT; + + -- Se obtiene nº de colección. + INSERT INTO vn.collection + SET itemPackingTypeFk = vItemPackingTypeFk, + trainFk = vTrainFk, + wagons = vWagons, + warehouseFk = vWarehouseFk; + + SELECT LAST_INSERT_ID() INTO vCollectionFk; + + -- Los tickets de recogida en Algemesí sólo se sacan si están asignados. + -- Los pedidos con riesgo no se sacan aunque se asignen. + 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') + OR 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 vHasAssignedTickets + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + WHERE s.code = 'PICKER_DESIGNED' + AND pb.workerCode = vWorkerCode; + + -- Se dejan en la tabla tmp.productionBuffer sólo aquellos tickets adecuados + IF vHasAssignedTickets THEN + DELETE pb.* + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + WHERE s.code <> 'PICKER_DESIGNED' + OR pb.workerCode <> vWorkerCode; + ELSE + DELETE pb.* + 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 <> util.VN_CURDATE() + OR (pb.ubicacion IS NULL AND a.isOwn = TRUE) + OR (s.isPreparable = FALSE AND s.isPrintable = FALSE) + OR pb.collectionH IS NOT NULL + OR pb.collectionV IS NOT NULL + OR pb.collectionN IS NOT NULL + OR (pb.H = 0 AND pb.V > 0 AND vItemPackingTypeFk = 'H') + OR (pb.V = 0 AND vItemPackingTypeFk = 'V') + OR (pc.isPreviousPreparationRequired AND pb.previousWithoutParking) + OR LENGTH(pb.problem) > 0; + END IF; + + -- Es importante que el primer ticket se coja en todos los casos + SELECT ticketFk, HH, mm + INTO vFirstTicketFk, vHour, vMinute + FROM tmp.productionBuffer + ORDER BY + HH, + mm, + productionOrder DESC, + m3 DESC, + agency, + zona, + routeFk, + ticketFk + LIMIT 1; + + -- Hay que excluir aquellos que no tengan la misma hora de preparacion, si procede + IF vHasUniqueCollectionTime THEN + DELETE + FROM tmp.productionBuffer + WHERE HH <> vHour + OR mm <> vMinute; + END IF; + + SET vTicketFk = vFirstTicketFk; + + OPEN cur1; + + read_loop: LOOP + SET vDone = FALSE; + + CALL vn.ticket_splitItemPackingType(vTicketFk, vItemPackingTypeFk); + + DROP TEMPORARY TABLE tmp.ticketIPT; + + UPDATE tmp.productionBuffer pb + JOIN (SELECT @litros:= SUM(litros) liters, COUNT(*) `lines`, MAX(i.`size`) height + FROM vn.saleVolume sv + JOIN vn.sale s ON s.id = sv.saleFk + JOIN vn.item i ON i.id = s.itemFk + WHERE sv.ticketFk = vTicketFk ) sub + SET pb.liters = sub.liters, pb.`lines` = sub.`lines`, pb.height = sub.height + WHERE pb.ticketFk = vTicketFk; + + UPDATE tTrain tt + JOIN tmp.productionBuffer pb ON pb.ticketFk = vTicketFk + SET tt.ticketFk = pb.ticketFk + WHERE tt.liters >= pb.liters + AND tt.`lines` >= pb.`lines` + AND (tt.height >= pb.height OR vItemPackingTypeFk <> 'V') + AND tt.ticketFk IS NULL + ORDER BY + wagon, + shelve, + tt.liters, + tt.`lines`, + tt.height + LIMIT 1; + + -- Si no le encuentra una balda adecuada, intentamos darle un carro entero + -- si queda alguno libre + + IF NOT (SELECT COUNT(*) FROM tTrain WHERE ticketFk) THEN + SELECT tt.wagon + INTO vFreeWagonFk + FROM tTrain tt + LEFT JOIN (SELECT DISTINCT wagon + FROM tTrain + WHERE ticketFk IS NOT NULL + ) nn ON nn.wagon = tt.wagon + WHERE nn.wagon IS NULL + ORDER BY wagon + LIMIT 1; + + IF vFreeWagonFk THEN + UPDATE tTrain + SET ticketFk = vFirstTicketFk + WHERE wagon = vFreeWagonFk; + + -- Se anulan el resto de carros libres para que sólo uno lleve un pedido excesivo + DELETE tt.* + FROM tTrain tt + LEFT JOIN (SELECT DISTINCT wagon + FROM tTrain + WHERE ticketFk IS NOT NULL + ) nn ON nn.wagon = tt.wagon + WHERE nn.wagon IS NULL; + END IF; + END IF; + + FETCH cur1 INTO vTicketFk; + + IF vDone OR NOT (SELECT COUNT(*) FROM tTrain WHERE ticketFk IS NULL) THEN + LEAVE read_loop; + END IF; + END LOOP; + + CLOSE cur1; + + IF (SELECT COUNT(*) FROM tTrain WHERE ticketFk) THEN + 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 + INSERT IGNORE INTO vn.ticketCollection(ticketFk, collectionFk, `level`, wagon, liters) + SELECT tt.ticketFk, vCollectionFk, tt.shelve, tt.wagon, tt.liters + FROM tTrain tt + WHERE tt.ticketFk IS NOT NULL + ORDER BY tt.wagon, tt.shelve; + + -- Actualiza el estado de los tickets + INSERT INTO ticketTracking(stateFk, ticketFk, workerFk) + 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; + + CALL vn.sales_mergeByCollection(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; + + ELSE + + -- CALL util.throw('No ha sido posible obtener colección'); + DELETE FROM vn.collection WHERE id = vCollectionFk; + SET vCollectionFk = NULL; + + END IF; + + DO RELEASE_LOCK(vLockName); + + DROP TEMPORARY TABLE + tTrain, + tmp.productionBuffer; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -54174,512 +49875,50 @@ DELIMITER ; 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 vWorkerFk INT; DECLARE vWagons INT; - - SELECT w.code, w.id INTO vWorkerCode, vWorker + DECLARE vCollectionFk INT; + + SELECT w.id INTO vWorkerFk 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,util.VN_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; + SELECT COUNT(ws.id) INTO vWagons + FROM workerShelving ws + WHERE ws.workerFk = vWorkerFk + AND ws.collectionFk IS NULL; - -- 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; + CALL collection_newWithWagon(vSectorFk, vWagons); - 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 = util.VN_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 = util.VN_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, util.VN_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; + SELECT id INTO vCollectionFk + FROM collection + WHERE workerFk = vWorkerFk + ORDER BY created DESC + LIMIT 1; - -- 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 + UPDATE workerShelving ws + SET ws.collectionFk = vCollectionFk + WHERE ws.workerFk = vWorkerFk + AND ws.collectionFk IS NULL; + + SET @wagon := 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.smartTags; + CREATE TEMPORARY TABLE tmp.smartTags + SELECT s.code, sub.wagon, s.level 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 + 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; + WHERE ws.collectionFk = vCollectionFk) sub + JOIN smartTag s ON s.shelvingFk = sub.shelvingFk + ORDER BY wagon ASC, level ASC; - -- 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; - + UPDATE vn.ticketCollection tc + JOIN tmp.smartTags ts ON tc.wagon = ts.wagon AND tc.level = ts.level + SET tc.smartTagFk = ts.code + WHERE tc.collectionFk = vCollectionFk; + + DROP TEMPORARY TABLE tmp.smartTags; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -54722,63 +49961,63 @@ proc:BEGIN 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(); + WHERE w.id =account.myUser_getId(); -- 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 + + 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 + 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 + WHERE c.workerFk = vUserFk AND c.created >= TIMESTAMPADD(HOUR , -6,util.VN_NOW()) AND s.quantity != 0 GROUP BY c.id - HAVING totalRow > pickedRow) sub; + 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'; @@ -54790,37 +50029,37 @@ proc:BEGIN END IF; - CALL vn.productionControl(vWarehouseFk, 0); + 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.* + + DELETE pb.* FROM tmp.productionBuffer pb - JOIN vn.volumeConfig vc + 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 + -- 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 @@ -54833,13 +50072,13 @@ proc:BEGIN 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 + + UPDATE vn.collection + SET itemPackingTypeFk = NULL WHERE id = vCollectionFk; - + DROP TEMPORARY TABLE IF EXISTS tmp.ticketToSplit; CREATE TEMPORARY TABLE tmp.ticketToSplit SELECT pb.ticketFk @@ -54847,42 +50086,42 @@ proc:BEGIN 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, + ORDER BY HH, + mm, + s.`order` DESC, pb.m3 DESC; - - WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO - + + WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO + SELECT MIN(ticketFk) INTO vTicketToSplit FROM tmp.ticketToSplit; - - CALL vn.ticket_splitItemPackingType(vTicketToSplit); - + + CALL vn.ticket_splitItemPackingType(vTicketToSplit,IFNULL(vItemPackingTypeFk, 'H')); + INSERT INTO vn.ticketCollection(ticketFk, collectionFk) SELECT ticketFk, vCollectionFk FROM tmp.ticketIPT - WHERE (itemPackingTypeFk = vItemPackingTypeFk) ; - + 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 + JOIN vn.productionConfig pc WHERE pb.shipped = util.VN_CURDATE() - AND (pb.ubicacion IS NOT NULL + AND (pb.ubicacion IS NOT NULL OR a.isOwn = FALSE ) AND s.isPreparable AND ( @@ -54890,27 +50129,27 @@ proc:BEGIN 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 + AND (pc.isPreviousPreparationRequired = FALSE OR pb.previousWithoutParking = FALSE); SET vMaxTicketPrinted = vMaxTicketPrinted - vPrintedTickets; -- AutoPRINT - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + INSERT INTO ticketTracking(stateFk, ticketFk, workerFk) 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.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 = util.VN_CURDATE() - AND (LENGTH(pb.problem) = 0 + AND (LENGTH(pb.problem) = 0 OR (pb.problem = 'PEQUEÑO' AND vTrainFk = 2)) - AND (pb.ubicacion IS NOT NULL + AND (pb.ubicacion IS NOT NULL OR a.isOwn = FALSE ) AND s.isPrintable AND s.isOK @@ -54920,23 +50159,23 @@ proc:BEGIN 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 , util.VN_NOW()) - AND (pc.isPreviousPreparationRequired = FALSE + AND (pc.isPreviousPreparationRequired = FALSE OR pb.previousWithoutParking = FALSE) - ORDER BY HH, + 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.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 @@ -54945,46 +50184,46 @@ proc:BEGIN 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 + AND (pb.ubicacion IS NOT NULL OR a.isOwn = FALSE ) AND LENGTH(pb.problem) = 0 AND s.isPreparable - AND (pc.isPreviousPreparationRequired = FALSE + 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 - + + WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO + SELECT MIN(ticketFk) INTO vTicketToSplit FROM tmp.ticketToSplit; - - - IF (SELECT isNeutral - 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); - + + CALL vn.ticket_splitItemPackingType(vTicketToSplit, vItemPackingTypeFk); + 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 @@ -55011,20 +50250,20 @@ proc:BEGIN 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.item i ON i.id = s.itemFk JOIN vn.volumeConfig vc - WHERE i.packingShelve + WHERE i.packingShelve GROUP BY t.ticketFk; - UPDATE tmp.ticket t + 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 + SELECT ticketFk, HH, mm INTO vFirstTicketFk, vHour, vMinute FROM tmp.ticket ORDER BY productionOrder DESC, HH, mm @@ -55032,47 +50271,47 @@ proc:BEGIN -- Hay que excluir aquellos que no tengan la misma hora de preparación IF vHourMatters THEN - - DELETE + + DELETE FROM tmp.ticket - WHERE HH != vHour + 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 + JOIN vn.volumeConfig vc WHERE t.ticketFk = vFirstTicketFk) THEN - DELETE - FROM tmp.ticket + DELETE + FROM tmp.ticket WHERE ticketFk != vFirstTicketFk; - + ELSE - + DELETE t.* - FROM tmp.ticket t - JOIN vn.volumeConfig vc + 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.* + 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, + ( SELECT MAX(i.size) maxHeigth, tc.ticketFk FROM vn.ticketCollection tc JOIN vn.sale s ON s.ticketFk = tc.ticketFk @@ -55081,11 +50320,11 @@ proc:BEGIN 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, + SELECT cv.`level` as shelve, 1 as wagon, cv.`lines`, cv.liters, @@ -55101,7 +50340,7 @@ proc:BEGIN SET vWagonCounter = vWagonCounter + 1; INSERT INTO tmp.wagonsVolumetry(shelve, wagon, `lines`, liters, height) - SELECT cv.`level` as shelve, + SELECT cv.`level` as shelve, vWagonCounter as wagon, cv.`lines`, cv.liters, @@ -55117,11 +50356,11 @@ proc:BEGIN SELECT ticketFk, shelve, wagon, linesDif, LitersDif, heightDif FROM ( SELECT t.ticketFk, - wv.shelve, + 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.`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 @@ -55130,14 +50369,14 @@ proc:BEGIN 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 @@ -55153,57 +50392,57 @@ proc:BEGIN 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 + ORDER BY heightDif, litersDif, linesDif LIMIT 1; END IF; IF vShelve > 0 THEN - - UPDATE tmp.ticket + + 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 + + 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 + + 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; @@ -55212,68 +50451,68 @@ proc:BEGIN DELETE FROM tmp.ticket WHERE shelve = 0; -- Elimina los tickets bloqueados que no se van a preparar - DELETE tc.* + 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.* + DELETE tc.* FROM vn.ticketCollection tc - JOIN vn.ticketCollection tc2 ON tc2.ticketFk = tc.ticketFk + 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; + 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, + 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) + INSERT INTO ticketTracking(stateFk, ticketFk, workerFk) SELECT vStateFk, ticketFk, vUserFk - FROM vn.ticketCollection tc + 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 + IF (SELECT count(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk) THEN - CALL vn.salesMerge_byCollection(vCollectionFk); + CALL vn.sales_mergeByCollection(vCollectionFk); UPDATE vn.collection c - JOIN (SELECT count(*) saleTotalCount , + 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, + ) sub + SET c.saleTotalCount = sub.saleTotalCount, c.salePickedCount = sub.salePickedCount WHERE c.id = vCollectionFk; - - SELECT 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 @@ -55283,640 +50522,8 @@ proc:BEGIN 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 , util.VN_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,util.VN_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 = util.VN_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 = util.VN_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 , util.VN_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 */ ; @@ -55933,38 +50540,64 @@ DELIMITER ; /*!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) +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_printSticker`( + vSelf INT, + vLabelCount 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; - +/** + * Prints a yellow label from a collection or a ticket + * + * @param vSelf collection or ticket + * @param vLabelCount number of times the collection has been printed + */ + DECLARE vPrintArgs JSON DEFAULT JSON_OBJECT('collectionOrTicketFk', vSelf); - 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) + IF vLabelCount IS NULL THEN + INSERT INTO ticketTrolley 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; - + FROM ticketCollection + WHERE collectionFk = vSelf + ON DUPLICATE KEY UPDATE labelCount = labelCount + 1; + ELSE + SET vPrintArgs = JSON_MERGE_PATCH(vPrintArgs, JSON_OBJECT('labelCount', vLabelCount)); END IF; - + + CALL report_print( + 'LabelCollection', + (SELECT w.labelerFk FROM worker w WHERE w.id = account.myUser_getId()), + account.myUser_getId(), + vPrintArgs, + 'high' + ); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_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_setParking` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_setParking`(IN `vCollectionFk` VARCHAR(8), IN `vParkingFk` INT) +proc: BEGIN +/** + * Aparca una colección en un parking. + * + * @param vCollectionFk Id de la colección + * @param vParkingFk Id del parking + */ + REPLACE vn.ticketParking(ticketFk, parkingFk) + SELECT tc.ticketFk, vParkingFk + FROM vn.ticketCollection tc + WHERE tc.collectionFk = vCollectionFk; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -55983,39 +50616,39 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_updateSale`( vSaleFk INT, - vOriginalQuantity INT, - vWorkerFk INT, - vStateFk INT, - vTicketFk INT) + vOriginalQuantity INT, + vWorkerFk INT, + vStateFk INT, + vTicketFk INT) BEGIN - - DECLARE vNumPrepared INT; + + 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; - + REPLACE INTO vn.saleTracking(saleFk, isChecked, originalQuantity, workerFk, stateFk) + VALUES(vSaleFk,1,vOriginalQuantity,vWorkerFk,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); - + 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 ticketTracking + SET stateFk = vStateFk, ticketFk = vTicketFk, workerFk = vWorkerFk; + + CALL vn.collection_update(vTicketFk); + END IF; - - + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -56034,25 +50667,25 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `company_getFiscaldata`(workerFk INT) BEGIN - + DECLARE vCompanyFk INT; - - SELECT IFNULL(uc.companyFk, rc.defaultCompanyFk) + + 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 + 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 + JOIN vn.supplier s ON s.id = c.id WHERE c.id = vCompanyFk; END ;; DELIMITER ; @@ -56060,6 +50693,215 @@ 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 `company_getSuppliersDebt` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_getSuppliersDebt`(vSelf INT, vMonthsAgo INT) +BEGIN +/** + * Generates a temporary table containing outstanding payments to suppliers. + * + * @param vSelf company id + * @param vMonthAgo time interval to be consulted + */ + DECLARE vStartingDate DATETIME DEFAULT TIMESTAMPADD (MONTH,- vMonthsAgo,util.VN_CURDATE()); + DECLARE vCurrencyEuroFk INT; + DECLARE vStartDate DATE; + DECLARE vInvalidBalances DOUBLE; + + SELECT dated, invalidBalances INTO vStartDate, vInvalidBalances FROM supplierDebtConfig; + SELECT id INTO vCurrencyEuroFk FROM currency WHERE code = 'EUR'; + + DROP TEMPORARY TABLE IF EXISTS tOpeningBalances; + CREATE TEMPORARY TABLE tOpeningBalances ( + supplierFk INT NOT NULL, + companyFk INT NOT NULL, + openingBalances DOUBLE NOT NULL, + closingBalances DOUBLE NOT NULL, + currencyFk INT NOT NULL, + PRIMARY KEY (supplierFk, companyFk, currencyFk) + ) ENGINE = MEMORY; + + -- Calculates the opening and closing balance for each supplier + INSERT INTO tOpeningBalances + SELECT supplierFk, + companyFk, + SUM(amount * isBeforeStarting) AS openingBalances, + SUM(amount) closingBalances, + currencyFk + FROM ( + SELECT p.supplierFk, + p.companyFk, + IF (p.currencyFk = vCurrencyEuroFk, p.amount, p.divisa) AS amount, + p.dueDated < vStartingDate isBeforeStarting, + p.currencyFk + FROM payment p + WHERE p.received > vStartDate + AND p.companyFk = vSelf + UNION ALL + SELECT r.supplierFk, + r.companyFk, + - IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue) AS Total, + rv.dueDated < vStartingDate isBeforeStarting, + r.currencyFk + FROM invoiceIn r + INNER JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk + WHERE r.issued > vStartDate + AND r.isBooked + AND r.companyFk = vSelf + ) sub GROUP BY companyFk, supplierFk, currencyFk; + + DROP TEMPORARY TABLE IF EXISTS tPendingDuedates; + CREATE TEMPORARY TABLE tPendingDuedates ( + id INT auto_increment, + expirationId INT, + dated DATE, + supplierFk INT NOT NULL, + companyFk INT NOT NULL, + amount DECIMAL(10, 2) NOT NULL, + currencyFk INT NOT NULL, + pending DECIMAL(10, 2) DEFAULT 0, + balance DECIMAL(10, 2) DEFAULT 0, + endingBalance DECIMAL(10, 2) DEFAULT 0, + isPayment BOOLEAN, + isReconciled BOOLEAN, + PRIMARY KEY (id), + INDEX (supplierFk, companyFk, currencyFk) + ) ENGINE = MEMORY; + + INSERT INTO tPendingDuedates ( + expirationId, + dated, + supplierFk, + companyFk, + amount, + currencyFk, + isPayment, + isReconciled + )SELECT p.id, + p.dueDated, + p.supplierFk, + p.companyFk, + IF (p.currencyFk = vCurrencyEuroFk, p.amount, p.divisa), + p.currencyFk, + TRUE isPayment, + p.isConciliated + FROM payment p + WHERE p.dueDated >= vStartingDate + AND p.companyFk = vSelf + UNION ALL + SELECT r.id, + rv.dueDated, + r.supplierFk, + r.companyFk, + -IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue), + r.currencyFk, + FALSE isPayment, + TRUE + FROM invoiceIn r + LEFT JOIN tOpeningBalances si ON r.companyFk = si.companyFk + AND r.supplierFk = si.supplierFk + AND r.currencyFk = si.currencyFk + JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk + WHERE rv.dueDated >= vStartingDate + AND (si.closingBalances IS NULL OR si.closingBalances <> 0) + AND r.isBooked + AND r.companyFk = vSelf + ORDER BY supplierFk, companyFk, companyFk, dueDated, isPayment DESC, id; + -- util.VN_NOW, we calculate the outstanding amount for each receipt in descending order + SET @risk := 0.0; + SET @supplier := 0.0; + SET @company := 0.0; + SET @moneda := 0.0; + SET @pending := 0.0; + SET @day := util.VN_CURDATE(); + + UPDATE tPendingDuedates vp + LEFT JOIN tOpeningBalances si ON vp.companyFk = si.companyFk + AND vp.supplierFk = si.supplierFk + AND vp.currencyFk = si.currencyFk + SET vp.balance = @risk := ( + IF ( + @company <> vp.companyFk + OR @supplier <> vp.supplierFk + OR @moneda <> vp.currencyFk, + IFNULL(si.openingBalances, 0), + @risk + ) + + vp.amount + ), + -- if there is a change of company or supplier or currency, the balance is reset + vp.pending = @pending := IF ( + @company <> vp.companyFk + OR @supplier <> vp.supplierFk + OR @moneda <> vp.currencyFk + OR @day <> vp.dated, + vp.amount * (NOT vp.isPayment), + @pending + vp.amount + ), + vp.companyFk = @company := vp.companyFk, + vp.supplierFk = @supplier := vp.supplierFk, + vp.currencyFk = @moneda := vp.currencyFk, + vp.dated = @day := vp.dated, + vp.balance = @risk, + vp.pending = @pending; + + CREATE OR REPLACE TEMPORARY TABLE tRowsToDelete ENGINE = MEMORY + SELECT expirationId, + dated, + supplierFk, + companyFk, + currencyFk, + balance + FROM tPendingDuedates + WHERE balance < vInvalidBalances + AND balance > - vInvalidBalances; + + DELETE vp.* + FROM tPendingDuedates vp + JOIN tRowsToDelete rd ON ( + vp.dated < rd.dated + OR (vp.dated = rd.dated AND vp.expirationId <= rd.expirationId) + ) + AND vp.supplierFk = rd.supplierFk + AND vp.companyFk = rd.companyFk + AND vp.currencyFk = rd.currencyFk + WHERE vp.isPayment = FALSE; + + SELECT vp.expirationId, + vp.dated, + vp.supplierFk, + vp.companyFk, + vp.currencyFk, + vp.amount, + vp.pending, + vp.balance, + s.payMethodFk, + vp.isPayment, + vp.isReconciled, + vp.endingBalance, + cr.amount clientRiskAmount + FROM tPendingDuedates vp + LEFT JOIN supplier s ON s.id = vp.supplierFk + LEFT JOIN vn.client c ON c.fi = s.nif + LEFT JOIN vn.clientRisk cr ON cr.clientFk = c.id; + + DROP TEMPORARY TABLE tOpeningBalances; + DROP TEMPORARY TABLE tPendingDuedates; + DROP TEMPORARY TABLE tRowsToDelete; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_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 */ ; @@ -56073,7 +50915,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `conveyorExpedition_Add`(vStarted DATETIME, vEnded DATETIME) BEGIN - + DECLARE startingMinute INT; TRUNCATE vn.conveyorExpedition; @@ -56090,23 +50932,23 @@ BEGIN conveyorBuildingClassFk) SELECT e.id, e.created, - 10 * p.depth as depth, + 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) + 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 + 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 @@ -56115,8 +50957,8 @@ BEGIN SELECT MIN(productionMinute) INTO startingMinute FROM vn.conveyorExpedition ce ; - - UPDATE vn.conveyorExpedition + + UPDATE vn.conveyorExpedition SET productionMinute = productionMinute - startingMinute; END ;; @@ -56185,7 +51027,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `createPedidoInterno`(vItemFk INT,vQuantity INT) BEGIN - + UPDATE vn.item SET upToDown = vQuantity WHERE id = vItemFk; END ;; @@ -56194,115 +51036,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 `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 util.VN_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 util.VN_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 */ ; @@ -56317,52 +51050,52 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `crypt`(vText VARCHAR(255), vKey VAR 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 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); @@ -56387,49 +51120,49 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `cryptOff`(vText VARCHAR(255), vKey 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 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; @@ -56440,93 +51173,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 `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, util.VN_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 */ ; @@ -56612,7 +51258,7 @@ BEGIN OR (vSelf IS NOT NULL AND parentFk = vSelf); DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + SET vSons = 0; OPEN vChildren; @@ -56623,11 +51269,11 @@ BEGIN 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, '/'), @@ -56682,7 +51328,7 @@ proc: BEGIN SELECT isChanged INTO vIsChanged FROM department_recalc; - + IF vIsChanged THEN UPDATE department_recalc SET isChanged = FALSE; CALL vn.department_calcTree; @@ -56707,17 +51353,17 @@ DELIMITER ; 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 */ ; @@ -56776,19 +51422,19 @@ BEGIN 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; @@ -56830,10 +51476,10 @@ 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 + * @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); @@ -56856,12 +51502,12 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProductionUser_exists`(vUserFk INT) BEGIN - + /* SELECT COUNT(*) AS UserExists - FROM vn.deviceProductionUser dpu + FROM vn.deviceProductionUser dpu WHERE dpu.userFk = vUserFk;*/ SELECT TRUE; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -56881,17 +51527,15 @@ 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 - * + * 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;*/ - + 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 */ ; @@ -56912,14 +51556,14 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProduction_getnameDevice`(vAn BEGIN /** * Selecciona el id del dispositivo que corresponde al vAndroid_id - * - * @param vAndroid_id el número android_id del dispositivo - * + * + * @param vAndroid_id el número android_id del dispositivo + * */ - SELECT dp.id + SELECT dp.id FROM deviceProduction dp - WHERE dp.android_id = vAndroid_id; + WHERE dp.android_id = vAndroid_id; END ;; DELIMITER ; @@ -56939,10 +51583,10 @@ DELIMITER ; 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 */ @@ -56954,20 +51598,20 @@ BEGIN SELECT dpc.isAllUsersallowed INTO vIsAllUsersAllowed FROM vn.deviceProductionConfig dpc; - IF NOT vIsAllUsersAllowed THEN - + IF NOT vIsAllUsersAllowed THEN + SELECT COUNT(*) INTO vIsDepartment - FROM vn.workerDepartment dp + 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 + 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; @@ -56977,61 +51621,6 @@ BEGIN 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 */ ; @@ -57052,15 +51641,15 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `duaEntryValueUpdate`(vDuaFk INT) BEGIN UPDATE duaEntry de - JOIN + 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 + + LEFT JOIN (SELECT e.id, sum(iit.taxableBase) as euros FROM entry e JOIN invoiceInTax iit ON iit.invoiceInFk = e.invoiceInFk @@ -57068,11 +51657,11 @@ BEGIN 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 */ ; @@ -57096,7 +51685,7 @@ BEGIN DECLARE vInvoiceFk INT; DECLARE vASIEN BIGINT DEFAULT 0; DECLARE vCounter INT DEFAULT 0; - + DECLARE rs CURSOR FOR SELECT e.invoiceInFk FROM entry e @@ -57109,7 +51698,7 @@ BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN rs; - + UPDATE invoiceIn ii JOIN entry e ON e.invoiceInFk = ii.id JOIN duaEntry de ON de.entryFk = e.id @@ -57121,123 +51710,41 @@ BEGIN 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 + + 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 */ ; @@ -57263,9 +51770,9 @@ BEGIN 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 @@ -57294,29 +51801,29 @@ BEGIN DECLARE vBookDated DATE; DECLARE vDiff DECIMAL(10,2); DECLARE vApunte BIGINT; - + SELECT ASIEN, IFNULL(bookEntried, util.VN_CURDATE()) INTO vBookNumber, vBookDated - FROM dua + 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, + CONCEPTO, EUROHABER, SERIE, empresa_id, CLAVE, FACTURA) - SELECT + SELECT vBookNumber, d.bookEntried, '4700000999', @@ -57329,20 +51836,20 @@ BEGIN 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, + CONTRA, EURODEBE, BASEEURO, - CONCEPTO, - FACTURA, + CONCEPTO, + FACTURA, IVA, - AUXILIAR, + AUXILIAR, SERIE, FECHA_EX, FECHA_OP, @@ -57362,17 +51869,17 @@ BEGIN FECREGCON ) - SELECT + SELECT vBookNumber ASIEN, vBookDated FECHA, tr.account SUBCTA, '4330002067' CONTRA, sum(dt.tax) EURODEBE, - sum(dt.base) BASEEURO, + sum(dt.base) BASEEURO, CONCAT('DUA nº',d.code) CONCEPTO, d.id FACTURA, dt.rate IVA, - '*' AUXILIAR, + '*' AUXILIAR, 'D' SERIE, d.issued FECHA_EX, d.operated FECHA_OP, @@ -57399,9 +51906,10 @@ BEGIN WHERE ta.effectived <= vBookDated AND taxAreaFk = 'WORLD' ORDER BY ta.effectived DESC + LIMIT 10000000000000000000 ) tba GROUP BY rate - ) tr ON tr.rate = dt.rate + ) tr ON tr.rate = dt.rate JOIN supplier s ON s.id = d.companyFk WHERE d.id = vDuaFk GROUP BY dt.rate; @@ -57409,260 +51917,16 @@ BEGIN 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 + 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, util.VN_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, util.VN_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 */ ; @@ -57683,21 +51947,21 @@ 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) + + INSERT INTO duaTax(duaFk, supplierFk, taxClassFk, base) SELECT vDuaFk, supplierFk, taxClassFk, sum(sub.Base) as Base FROM intrastat ist JOIN (SELECT - e.supplierFk, + 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 + 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 @@ -57705,15 +51969,15 @@ BEGIN ( SELECT i.intrastatFk, CAST(sum(b.quantity * b.buyingValue * de.customsValue / de.value) AS DECIMAL(10,2)) as Base - FROM buy b + 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 + JOIN ( SELECT intrastatFk, sum(amount) as amount FROM duaIntrastat @@ -57722,7 +51986,7 @@ BEGIN ) di ON di.intrastatFk = i.intrastatFk WHERE de.duaFk = vDuaFk GROUP BY e.supplierFk, i.intrastatFk - HAVING Base + HAVING Base ) sub ON ist.id = sub.intrastatFk GROUP BY ist.taxClassFk, sub.supplierFk; END ;; @@ -57743,13 +52007,13 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ediTables_Update`() BEGIN - - INSERT IGNORE INTO vn.genus(name) + + INSERT IGNORE INTO vn.genus(name) SELECT latin_genus_name FROM edi.genus ; - INSERT IGNORE INTO vn.specie(name) - SELECT LCASE(latin_species_name) + INSERT IGNORE INTO vn.specie(name) + SELECT LCASE(latin_species_name) FROM edi.specie ; END ;; DELIMITER ; @@ -57789,71 +52053,71 @@ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; 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 + JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk AND ea.warehouseInFk = tr.warehouseInFk - AND ea.agencyModeFk = tr.agencyFk + AND ea.agencyModeFk = tr.agencyModeFk 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 + JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk AND ea.warehouseInFk = tr.warehouseInFk - AND ea.agencyModeFk = tr.agencyFk + AND ea.agencyModeFk = tr.agencyModeFk 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 + + SELECT IFNULL(MAX(tr.id),0) INTO vTravelFk FROM vn.travel tr - JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk + JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk AND ea.warehouseInFk = tr.warehouseInFk - AND ea.agencyModeFk = tr.agencyFk + AND ea.agencyModeFk = tr.agencyModeFk WHERE ea.id = vId AND tr.landed = vLanded; - + IF NOT vTravelFk THEN - - INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyFk) + + INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyModeFk) SELECT vLanded, vLanded, warehouseInFk, warehouseOutFk, agencyModeFk - FROM vn.ektEntryAssign + FROM vn.ektEntryAssign WHERE id = vId; - - SELECT MAX(tr.id) INTO vTravelFk + + SELECT MAX(tr.id) INTO vTravelFk FROM vn.travel tr - JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk + 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 @@ -57861,13 +52125,13 @@ OPEN cur1; 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 + + SELECT MAX(id) INTO vEntryFk FROM vn.entry WHERE travelFk = vTravelFk; - + END IF; - + UPDATE vn.ektEntryAssign SET entryFk = vEntryFk WHERE id = vId; @@ -57875,83 +52139,7 @@ OPEN cur1; 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 , - util.VN_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 */ ; @@ -57971,247 +52159,20 @@ 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(util.VN_NOW(), '%Y-%m-%d %H:00:00'), + INSERT INTO vn.energyMeter + SET + `input` = vInput, + `period` = DATE_FORMAT(util.VN_NOW(), '%Y-%m-%d %H:00:00'), `activeTime` = vActiveTime, `consumption` = CAST(IFNULL((vConsumption / 3600) * vActiveTime, 0) AS DECIMAL(10,2)) - ON DUPLICATE KEY UPDATE + 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 */ ; @@ -58232,149 +52193,30 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `entryDelivered`(vDated DATE, vEntry BEGIN DECLARE vTravelFk INT; - + SELECT travelFk INTO vTravelFk - FROM vn.entry + 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 + + INSERT INTO vn.travel(shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, ref, isDelivered, isReceived) + SELECT LEAST(shipped, vDated), vDated, warehouseInFk, warehouseOutFk, agencyModeFk, CONCAT(account.myUser_getName(),' ', vEntryFk), TRUE, TRUE FROM vn.travel WHERE id = vTravelFk; - + SELECT LAST_INSERT_ID() INTO vTravelFk; - - UPDATE vn.entry - SET travelFk = 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 > util.VN_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 > util.VN_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 */ ; @@ -58401,40 +52243,7 @@ BEGIN 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 */ ; @@ -58458,29 +52267,29 @@ BEGIN 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; - + WHERE t.landed = vInOutDate AND t.shipped = vInOutDate AND t.warehouseOutFk = vShipmentWarehouse + AND t.warehouseInFk = vLandingWarehouse AND t.agencyModeFk 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 @@ -58490,7 +52299,7 @@ BEGIN 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) + INSERT INTO buy(itemFk,quantity, entryFk, packageFk, packing, stickers, buyingValue, price2, price3) SELECT itemFk, quantity, vEntry, @@ -58508,121 +52317,171 @@ 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 `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 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 `entry_clone`(vSelf INT) BEGIN - -/* - * Clona una entrada +/** + * clones an entry. + * + * @param vSelf The entry id + */ + DECLARE vNewEntryFk INT; + + START TRANSACTION; + + CALL entry_cloneHeader(vSelf, vNewEntryFk, NULL); + CALL entry_copyBuys(vSelf, vNewEntryFk); + + COMMIT; + + 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_cloneHeader` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_cloneHeader`( + vSelf INT, + OUT vNewEntryFk INT, + vTravelFk INT +) +BEGIN +/** + * Clones an entry header. + * + * @param vSelf The entry id + * @param vTravelFk Travel for the new entry or %NULL to use the source entry travel + * @param vNewEntryFk The new entry id + */ + INSERT INTO entry( + travelFk, + supplierFk, + dated, + isExcludedFromAvailable, + notes, + isRaid, + commission, + currencyFk, + companyFk + ) + SELECT IFNULL(vTravelFk, travelFk), + supplierFk, + dated, + isExcludedFromAvailable, + notes, + isRaid, + commission, + currencyFk, + companyFk + FROM entry + WHERE id = vSelf; + + SET vNewEntryFk = LAST_INSERT_ID(); + + CALL logAdd(vNewEntryFk, 'insert', 'entry', CONCAT('clona entrada ', 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 `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_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_cloneWithoutBuy`(vSelf INT, OUT vNewEntryFk INT) +BEGIN +/** + * Clona una entrada sin compras * * @param vSelf Identificador de vn.entry + * @param vNewEntryFk Identificador de la nueva entrada */ - - DECLARE vNewEntryFk INT; - - CALL vn.entry_cloneWithoutBuy(vSelf, vNewEntryFk); + START TRANSACTION; - 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, + CALL entry_cloneHeader(vSelf, vNewEntryFk, NULL); + + UPDATE entry d JOIN entry s ON s.id = vSelf + SET d.`reference` = s.`reference`, + d.loadPriority = s.loadPriority + WHERE d.id = vNewEntryFk; + + 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_copyBuys` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_copyBuys`(vSelf INT, vCopyTo INT) +BEGIN +/** + * Copies an entry buys to another buy. + * + * @param vSelf The entry id + * @param vCopyTo The destination entry id + */ + INSERT INTO buy( + entryFk, + itemFk, + quantity, + buyingValue, + freightValue, + isIgnored, + stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + packageFk, + price1, + price2, + price3, + minPrice, + isChecked, + location, + weight, + itemOriginalFk + ) + SELECT vCopyTo, itemFk, quantity, buyingValue, @@ -58640,71 +52499,12 @@ BEGIN price2, price3, minPrice, - producer, - workerFk, + isChecked, + location, 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; - + FROM buy + WHERE entryFk = vSelf; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -58734,27 +52534,28 @@ BEGIN 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) + + INSERT INTO vn.buy( + entryFk, + itemFk, + quantity, + buyingValue, + freightValue, + isIgnored, + stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + location, + packageFk, + price1, + price2, + price3, + minPrice, + weight) SELECT vSelf, itemFk, (printedStickers - stickers) * packing quantity, @@ -58774,7 +52575,7 @@ BEGIN price2, price3, minPrice, - producer + weight FROM vn.buy b WHERE b.entryFk = vSelf AND b.printedStickers != b.stickers; @@ -58801,7 +52602,7 @@ BEGIN -- Obtiene fecha de llegada y almacén entrante - SELECT landed, warehouseInFk INTO vLanded, vWarehouseFk + SELECT landed, warehouseInFk INTO vLanded, vWarehouseFk FROM vn.travel t JOIN vn.entry e ON t.id = e.travelFk WHERE e.id = vEntry; @@ -58814,13 +52615,13 @@ BEGIN 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 @@ -58844,62 +52645,66 @@ DELIMITER ; /*!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) +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 + * Crea una entrada a futuro y divide las lineas de buy de + * la entrada original en función de las etiquetas impresas * - * @param vSelf Identificador de vn.entry + * @param vSelf Identificador de 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; + DECLARE vInvoiceAmountOldEntryFk DECIMAL(10,2); + DECLARE vInvoiceAmountNewEntry DECIMAL(10,2); SELECT travelFk INTO vTravelFk - FROM vn.entry - WHERE id = vSelf; + FROM entry + WHERE id = vSelf; - CALL vn.travel_clone(vTravelFk, vDays, vNewTravelFk); - CALL vn.entry_cloneWithoutBuy(vSelf, vNewEntryFk); + CALL travel_clone(vTravelFk, vDays, vNewTravelFk); + CALL entry_cloneWithoutBuy(vSelf, vNewEntryFk); - UPDATE vn.entry e + UPDATE 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 + UPDATE 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, + + INSERT INTO buy(entryFk, + itemFk, + quantity, + buyingValue, + freightValue, + isIgnored, + stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + packageFk, + price1, + price2, + price3, + minPrice, + workerFk, + weight, + itemOriginalFk) + SELECT vNewEntryFk, itemFk, ((stickers - printedStickers) * packing) quantity, buyingValue, @@ -58917,27 +52722,26 @@ BEGIN price2, price3, minPrice, - producer, workerFk, weight, itemOriginalFk - FROM vn.buy b + FROM buy b WHERE b.entryFk = vSelf AND b.printedStickers != b.stickers; - + IF vChangeEntry THEN - UPDATE vn.buy + UPDATE buy SET stickers = printedStickers, quantity = printedStickers * packing WHERE entryFk = vSelf; ELSE - INSERT INTO vn.buy(entryFk, itemFk) + INSERT INTO buy(entryFk, itemFk) SELECT vSelf, i.id - FROM vn.item i + FROM item i WHERE i.description = 'MISFIT' LIMIT 1; - - INSERT INTO vn.buy(entryFk, + + INSERT INTO buy(entryFk, itemFk, quantity, buyingValue, @@ -58955,8 +52759,7 @@ BEGIN price1, price2, price3, - minPrice, - producer) + minPrice) SELECT vSelf, itemFk, (printedStickers - stickers) * packing quantity, @@ -58975,12 +52778,95 @@ BEGIN price1, price2, price3, - minPrice, - producer - FROM vn.buy + minPrice + FROM buy WHERE entryFk = vSelf AND printedStickers != stickers; END IF; + + SELECT SUM(IFNULL(b.buyingValue * b.quantity, 0)) INTO vInvoiceAmountOldEntryFk + FROM buy b + WHERE b.entryFk = vSelf; + + UPDATE entry e + JOIN buy b ON b.entryFk = e.id + SET e.reference = CONCAT(e.reference,'(1)'), + e.invoiceAmount = vInvoiceAmountOldEntryFk + WHERE e.id = vSelf; + + SELECT SUM(IFNULL(b.buyingValue * b.quantity, 0)) INTO vInvoiceAmountNewEntry + FROM buy b + WHERE b.entryFk = vNewEntryFk; + + UPDATE entry e + JOIN buy b ON b.entryFk = e.id + SET e.reference = CONCAT(e.reference,'(2)'), + e.invoiceAmount = vInvoiceAmountNewEntry + WHERE e.id = vNewEntryFk; + + INSERT INTO entryLog + SET `action` = 'update', + description = CONCAT('Se ha creado la entrada ', vNewEntryFk,' transferida desde la ', vSelf), + userFk = account.myUser_getId(), + originFk = vSelf; + + INSERT INTO entryLog + SET `action` = 'update', + description = CONCAT('Se ha creado la entrada ', vNewEntryFk,' transferida desde la ', vSelf), + userFk = account.myUser_getId(), + originFk = vNewEntryFk; + + UPDATE entry + SET gestDocFk = (SELECT gestDocFk FROM entry WHERE id = vSelf LIMIT 1) + WHERE id = vNewEntryFk; + + INSERT INTO duaEntry (duaFk, entryFk) + SELECT duaFk, vNewEntryFk FROM duaEntry WHERE entryFk = vSelf 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_notifyChanged` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_notifyChanged`(vSelf INT, vBuyFk INT, vOldValues VARCHAR(512), vNewValues VARCHAR(512)) +BEGIN + DECLARE vEmail VARCHAR(255); + DECLARE vFields VARCHAR(100); + DECLARE vMessage TEXT; + + SELECT e.mailToNotify INTO vEmail + FROM entryConfig e + LIMIT 1; + + SET vFields = CONCAT_WS(',', + 'entryFk', + 'itemFk', + 'quantity', + 'price1', + 'price2', + 'price3' + ); + SET vMessage = util.formatTable(vFields, vOldValues, vNewValues); + + CALL mail_insert( + vEmail, + NULL, + CONCAT( + 'Se ha modificado una línea de la entrada ', vSelf + ,' siendo inventario o anterior al mismo' + ), + vMessage + ); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -59007,12 +52893,12 @@ BEGIN */ 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; + SET v_done = TRUE; OPEN vCur; @@ -59023,7 +52909,7 @@ BEGIN IF v_done THEN LEAVE l; END IF; - + CALL vn2008.buy_tarifas_entry(vEntryFk); END LOOP; @@ -59048,7 +52934,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_splitByShelving`(vShelvingFk 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 @@ -59058,47 +52944,49 @@ BEGIN DECLARE buyStickers INT; DECLARE vDone BOOLEAN DEFAULT FALSE; - DECLARE cur CURSOR FOR + 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 + 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 + ORDER BY b.stickers DESC + LIMIT 10000000000000000000) 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, + + -- 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 + 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 + ORDER BY b.stickers DESC + LIMIT 10000000000000000000) 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 @@ -59106,9 +52994,9 @@ BEGIN ELSE UPDATE vn.buy SET stickers = stickers - ishStickers, - quantity = stickers * packing + quantity = stickers * packing WHERE id = vBuyFk; - + INSERT INTO vn.buy(entryFk, itemFk, quantity, @@ -59128,7 +53016,6 @@ BEGIN price2, price3, minPrice, - producer, printedStickers, workerFk, isChecked, @@ -59157,7 +53044,6 @@ BEGIN price2, price3, minPrice, - producer, ishStickers, workerFk, isChecked, @@ -59168,7 +53054,7 @@ BEGIN itemOriginalFk FROM vn.buy WHERE id = vBuyFk; - + END IF; END LOOP; @@ -59191,16 +53077,16 @@ DELIMITER ; 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 + FROM vn.buy b JOIN vn.item i ON i.id = b.itemFk WHERE b.entryFk = vSelf AND i.description = 'MISFIT'; @@ -59209,17 +53095,55 @@ BEGIN 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 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 `entry_updateComission` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_updateComission`(vCurrency INT) +BEGIN +/** + * Actualiza la comision de las entradas de hoy a futuro y las recalcula + * + * @param vCurrency id del tipo de moneda(SAR,EUR,USD,GBP,JPY) + */ + CREATE OR REPLACE TEMPORARY TABLE tmp.recalcEntryCommision + SELECT e.id + FROM vn.entry e + JOIN vn.travel t ON t.id = e.travelFk + JOIN vn.warehouse w ON w.id = t.warehouseInFk + WHERE t.shipped >= util.VN_CURDATE() + AND e.currencyFk = vCurrency; + + UPDATE vn.entry e + JOIN tmp.recalcEntryCommision tmp ON tmp.id = e.id + SET e.commission = currency_getCommission(vCurrency); + + CALL entry_recalc(); + + DROP TEMPORARY TABLE tmp.recalcEntryCommision; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -59232,26 +53156,24 @@ 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 `errorProduction_add`(vAction VARCHAR(25), vDatedFrom DATETIME, vDatedTo DATETIME) +CREATE DEFINER=`root`@`localhost` PROCEDURE `errorProduction_add`( + vAction VARCHAR(25), + vDatedFrom DATETIME, + vDatedTo DATETIME) BEGIN - /** - * Fill in the errorProduction table - */ - + * Rellena la tabla vn.errorProduction + * + * @param vAction Accion que se quiere añadir + * @param vDatedFrom Fecha desde + * @param vDatedTo Fecha hasta + */ 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'; @@ -59262,7 +53184,7 @@ BEGIN END CASE; IF (vDepartment = 'Encajadores') THEN - CREATE TEMPORARY TABLE tmp.total + CREATE OR REPLACE TEMPORARY TABLE total ENGINE = MEMORY SELECT e.workerFk, COUNT(DISTINCT t.id) ticketCount, @@ -59273,23 +53195,23 @@ BEGIN WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo GROUP BY e.workerFk; ELSE - CREATE TEMPORARY TABLE tmp.total + CREATE OR REPLACE TEMPORARY TABLE 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 `state` s2 ON s2.id = st.stateFk 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 + WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) + AND s2.code IN ('OK','PREVIOUS_PREPARATION','PREPARED','CHECKED') GROUP BY st.workerFk; END IF; CALL timeControl_calculateAll(vDatedFrom, vDatedTo); - - CREATE TEMPORARY TABLE tmp.errorsByClaim + CREATE OR REPLACE TEMPORARY TABLE errorsByClaim ENGINE = MEMORY SELECT COUNT(c.ticketFk) errors, cd.workerFk @@ -59300,8 +53222,8 @@ BEGIN WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo AND cr.description = vDepartment GROUP BY cd.workerFk; - - CREATE TEMPORARY TABLE tmp.volume + + CREATE OR REPLACE TEMPORARY TABLE volume ENGINE = MEMORY SELECT SUM(w.volume) volume, w.workerFk @@ -59309,46 +53231,74 @@ BEGIN WHERE w.dated BETWEEN vDatedFrom AND vDatedTo GROUP BY w.workerFk; - CREATE TEMPORARY TABLE tmp.errorsByChecker + CREATE OR REPLACE TEMPORARY TABLE errorsByChecker ENGINE = MEMORY - SELECT sub1.workerFk, COUNT(id) errors + 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 + JOIN saleTracking st ON sm.saleFk = st.saleFk + JOIN `state` s2 ON s2.id = st.stateFk + 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 + AND s2.code IN ('OK','PREVIOUS_PREPARATION','PREPARED','CHECKED') 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; - + + CREATE OR REPLACE TEMPORARY TABLE expeditionErrors + ENGINE = MEMORY + SELECT COUNT(t.id) errors, + e.workerFk + FROM vn.expeditionMistake pm + JOIN vn.expedition e ON e.id = pm.expeditionFk + JOIN vn.ticket t ON t.id = e.ticketFk + WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo + GROUP BY e.workerFk; + IF (vDepartment = 'Sacadores') THEN - CREATE TEMPORARY TABLE tmp.itemPickerErrors -- Errores de los sacadores, derivadores de los revisadores + + 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 total t + LEFT JOIN worker w ON w.id = t.workerFk + LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = t.workerFk + LEFT JOIN errorsByClaim ec ON ec.workerFk = t.workerFk + LEFT JOIN volume v ON v.workerFk = t.workerFk + LEFT JOIN errorsByChecker ec2 ON ec2.workerFk = t.workerFk + JOIN (SELECT DISTINCT w.id -- Verificamos que son sacadores + FROM vn.collection c + JOIN vn.state s ON s.id = c.stateFk + JOIN vn.train tn ON tn.id = c.trainFk + JOIN vn.worker w ON w.id = c.workerFk + WHERE c.created BETWEEN vDatedFrom AND vDatedTo) sub ON sub.id = w.id + GROUP BY w.id; + + CREATE OR REPLACE TEMPORARY TABLE itemPickerErrors -- Errores de los sacadores, derivadores de los revisadores ENGINE = MEMORY SELECT COUNT(c.ticketFk) errors, tt.workerFk @@ -59357,26 +53307,58 @@ BEGIN 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 + 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 + JOIN 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; + DROP TEMPORARY TABLE itemPickerErrors; + ELSE + 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) + IFNULL(pe.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 total t + LEFT JOIN worker w ON w.id = t.workerFk + LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = t.workerFk + LEFT JOIN errorsByClaim ec ON ec.workerFk = t.workerFk + LEFT JOIN volume v ON v.workerFk = t.workerFk + LEFT JOIN errorsByChecker ec2 ON ec2.workerFk = t.workerFk + LEFT JOIN expeditionErrors pe ON pe.workerFk = t.workerFk + GROUP BY w.id; + END IF; + + DROP TEMPORARY TABLE total, + errorsByClaim, + volume, + errorsByChecker, + expeditionErrors; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -59397,7 +53379,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `errorProduction_addLauncher`() BEGIN DECLARE vDatedFrom DATETIME; DECLARE vDatedTo DATETIME; - + SELECT DATE_SUB(util.VN_CURDATE(),INTERVAL 1 DAY), CONCAT(DATE_SUB(util.VN_CURDATE(),INTERVAL 1 DAY),' 23:59:59') INTO vDatedFrom, vDatedTo; CALL vn.errorProduction_add('SACAR', vDatedFrom, vDatedTo); @@ -59409,128 +53391,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 `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(util.VN_CURDATE()) = 5) THEN - SELECT util.firstDayOfMonth(DATE_SUB(util.VN_CURDATE(),INTERVAL 1 MONTH)), CONCAT(LAST_DAY(DATE_SUB(util.VN_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 */ ; @@ -59547,21 +53407,142 @@ 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; - + 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, + t.routeFk, + t.packages bultos, + ts.alertLevel, + a.street, + a.city, + a.postalCode, + a.id addressFk, + w.name 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.freightItemFk > 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_build` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_build`(IN vExpeditions JSON, IN vArcId INT, IN vWorkerFk INT, OUT vPalletFk INT) +BEGIN +/** Construye un pallet de expediciones. + * + * Primero comprueba si esas expediciones ya pertenecen a otro pallet, + * en cuyo caso actualiza ese pallet. + * + * @param vExpeditions JSON_ARRAY con esta estructura [exp1, exp2, exp3, ...] + * @param vArcId INT Identificador de vn.arcRead + * @param vWorkerFk INT Identificador de vn.worker + * @param out vPalletFk Identificador de vn.expeditionPallet + */ + DECLARE vCounter INT; + DECLARE vExpeditionFk INT; + DECLARE vTruckFk INT; + DECLARE vPrinterFk INT; + + DROP TEMPORARY TABLE IF EXISTS tExpedition; + CREATE TEMPORARY TABLE tExpedition + SELECT + e.id expeditionFk, + r.id routeFk, + ep.id palletFk + FROM + vn.expedition e, + vn.route r, + vn.expeditionPallet ep + LIMIT 0; + + ALTER TABLE tExpedition ADD PRIMARY KEY (expeditionFk); + + SET vCounter = JSON_LENGTH(vExpeditions); + + WHILE vCounter DO + SET vCounter = vCounter - 1; + + SET vExpeditionFk = JSON_EXTRACT(vExpeditions,CONCAT("$[", vCounter, "]")); + + INSERT IGNORE INTO tExpedition(expeditionFk, routeFk, palletFk) + SELECT vExpeditionFk, t.routeFk, es.palletFk + FROM vn.expedition e + LEFT JOIN vn.ticket t ON t.id = e.ticketFk + LEFT JOIN vn.expeditionScan es ON es.expeditionFk = e.id + WHERE e.id = vExpeditionFk; + END WHILE; + + SELECT palletFk INTO vPalletFk + FROM ( + SELECT palletFk, count(*) n + FROM tExpedition + WHERE palletFk > 0 + GROUP BY palletFk + ORDER BY n DESC + LIMIT 100 ) sub + LIMIT 1; + + IF vPalletFk IS NULL THEN + SELECT expeditionTruckFk + INTO vTruckFk + FROM ( + SELECT rm.expeditionTruckFk, count(*) n + FROM vn.routesMonitor rm + JOIN tExpedition e ON e.routeFk = rm.routeFk + GROUP BY expeditionTruckFk + ORDER BY n DESC + LIMIT 1) sub; + + IF vTruckFk IS NULL THEN + CALL util.throw ('TRUCK_NOT_AVAILABLE'); + END IF; + + INSERT INTO vn.expeditionPallet(truckFk) + VALUES(vTruckFk); + + SET vPalletFk = LAST_INSERT_ID(); + END IF; + + INSERT INTO vn.expeditionScan(expeditionFk, palletFk, workerFk) + SELECT expeditionFk, vPalletFk, vWorkerFk + FROM tExpedition + ON DUPLICATE KEY UPDATE palletFk = vPalletFk, workerFk = vWorkerFk; + + SELECT printerFk INTO vPrinterFk + FROM vn.arcRead + WHERE id = vArcId; + + CALL vn.report_print( + 'LabelPalletExpedition', + vPrinterFk, + account.myUser_getId(), + JSON_OBJECT('palletFk', vPalletFk, 'userFk', account.myUser_getId()), + 'high' + ); + + UPDATE vn.expeditionPallet SET isPrint = TRUE WHERE id = vPalletFk; + + DROP TEMPORARY TABLE tExpedition; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -59629,65 +53610,32 @@ DELIMITER ; /*!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) +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_printLabel`(vSelf INT) BEGIN - - DECLARE vLabel INT; +/** + * Calls the report_print procedure and passes it + * the necessary parameters for printing. + * + * @param vSelf expeditioPallet id. + */ DECLARE vPrinterFk INT; + DECLARE vUserFk INT DEFAULT account.myUser_getId(); + + SELECT w.labelerFk INTO vPrinterFk + FROM worker w + WHERE w.id = vUserFk; + + CALL vn.report_print( + 'LabelPalletExpedition', + vPrinterFk, + account.myUser_getId(), + JSON_OBJECT('palletFk', vSelf, 'userFk', vUserFk), + 'high' + ); 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); - - + SET isPrint = TRUE + WHERE id = vSelf; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -59698,9 +53646,9 @@ 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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -59739,22 +53687,22 @@ BEGIN DECLARE vTotal INT DEFAULT 0; IF vPalletFk = 0 THEN -- Nuevo pallet - - INSERT INTO vn.expeditionPallet(truckFk) + + 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, + SELECT expeditionFk, palletFk - FROM vn.expeditionScan + FROM vn.expeditionScan WHERE palletFk = vPalletFk; - ELSE + ELSE SELECT 0 expeditionFk,vPalletFk palletFk; END IF; END ;; @@ -59827,12 +53775,12 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_Put`(vPalletFk INT, vExpeditionFk INT) BEGIN - - REPLACE vn.expeditionScan(expeditionFk, palletFk) + + REPLACE vn.expeditionScan(expeditionFk, palletFk) VALUES(vExpeditionFk, vPalletFk); - + SELECT LAST_INSERT_ID() INTO vPalletFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -59843,40 +53791,40 @@ 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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_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 */ ; @@ -59908,7 +53856,7 @@ BEGIN 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 + JOIN vn.ticket t ON t.id = e.ticketFk WHERE t.addressFk = vAdressFk AND t.routeFk = vRouteFk; END ;; @@ -59921,22 +53869,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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_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 @@ -59962,22 +53910,30 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_addByPallet`(vPalle 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 + DECLARE hasExpeditions BOOL; + + DROP TEMPORARY TABLE IF EXISTS tExpeditionScan; + CREATE TEMPORARY TABLE tExpeditionScan SELECT expeditionFk, est.id typeFk FROM vn.expeditionScan e JOIN vn.expeditionStateType est ON est.code = vStateCode WHERE e.palletFk = vPalletFk; + SELECT COUNT(*) INTO hasExpeditions FROM tExpeditionScan; + + IF NOT hasExpeditions THEN + DROP TEMPORARY TABLE tExpeditionScan; + CALL util.throw('palletDoesNotExist'); + END IF; + INSERT INTO vn.expeditionState(expeditionFk, typeFk) SELECT expeditionFk, typeFk - FROM tmp.expeditionScan; - - DROP TEMPORARY TABLE IF EXISTS tmp.expeditionScan; + FROM tExpeditionScan; + DROP TEMPORARY TABLE tExpeditionScan; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -59988,29 +53944,29 @@ 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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_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 */ ; @@ -60052,8 +54008,8 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionTruck_List`() BEGIN - SELECT id truckFk, - ETD, + SELECT id truckFk, + ETD, description Destino FROM vn.expeditionTruck WHERE ETD BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) @@ -60064,33 +54020,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 `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 */ ; @@ -60107,25 +54036,24 @@ BEGIN * Obtiene las expediciones a partir de una ruta * @param vRouteFk Id de la ruta */ - - SELECT e.id, - e.ticketFk, - e.checked, + SELECT e.id, + e.ticketFk, t.routeFk, - ts.alertLevel, - a.street, + ts.alertLevel, + a.street, a.city, a.postalCode, - t.addressFk, + t.addressFk, a.nickname, sub2.itemPackingTypeConcat, - est.code - FROM expedition e + 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 + JOIN route r ON r.id = t.routeFk LEFT JOIN warehouse w ON t.warehouseFk = w.id - LEFT JOIN (SELECT sub.ticketFk, + 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 @@ -60136,8 +54064,8 @@ BEGIN 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; - + WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE + ORDER BY r.created, t.priority DESC; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60156,7 +54084,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expedition_getState`(vExpeditionFk INT) BEGIN - + DECLARE vTicketsPendientes INT; DECLARE vEtiquetasTotales INT; DECLARE vEtiquetasEscaneadas INT; @@ -60166,24 +54094,24 @@ BEGIN 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 + 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 + FROM vn.expeditionScan es JOIN vn.expedition e ON e.id = es.expeditionFk - JOIN vn.ticket t ON t.id = e.ticketFk + JOIN vn.ticket t ON t.id = e.ticketFk WHERE t.routeFk = vRouteFk; - + SELECT e.ticketFk ticket, t.nickname cliente, a.city ciudad, @@ -60197,17 +54125,17 @@ BEGIN 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 + 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 */ ; @@ -60226,12 +54154,12 @@ DELIMITER ; 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 + * + * param vExpeditionFk */ - + DECLARE vTicketsPendientes INT; DECLARE vEtiquetasTotales INT; DECLARE vEtiquetasEscaneadas INT; @@ -60242,34 +54170,34 @@ BEGIN 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 + 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 + FROM vn.expeditionScan es JOIN vn.expedition e ON e.id = es.expeditionFk - JOIN vn.ticket t ON t.id = e.ticketFk + JOIN vn.ticket t ON t.id = e.ticketFk WHERE t.routeFk = vRouteFk; - + SELECT COUNT(*) INTO vEtiquetasLeidasSorter - FROM srt.expedition e + 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 + JOIN vn.ticket t ON t.id = ve.ticketFk WHERE t.routeFk = vRouteFk AND e.created != e.updated - AND ISNULL(es.expeditionFk); - - + AND ISNULL(es.expeditionFk); + + SELECT e.ticketFk ticket, t.nickname cliente, a.city ciudad, @@ -60284,17 +54212,17 @@ BEGIN 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 + 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 */ ; @@ -60315,14 +54243,14 @@ 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 + ENGINE = MEMORY SELECT iss.itemFk, i.size, i.subName producer, @@ -60335,7 +54263,7 @@ BEGIN 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 @@ -60350,7 +54278,7 @@ BEGIN AND t.warehouseFk = vWarehouseFk ) sub ON sub.itemFk = ishr.itemFk ; - + END ;; DELIMITER ; @@ -60398,14 +54326,15 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `freelance_getInfo`(workerFk INT) BEGIN - SELECT s.name, s.street, s.city, s.nif, s.postCode + 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; + JOIN agencyMode am ON r.agencyModeFk = am.id + JOIN agency a ON am.agencyFk = a.id + JOIN supplierAgencyTerm sat ON a.id = sat.agencyFk + JOIN supplier s ON sat.supplierFk = s.id + WHERE r.workerFk = workerFk + ORDER BY r.id DESC + LIMIT 1; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60424,7 +54353,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `fustControl`(vFromDated DATE, vToDated DATE) BEGIN - + DECLARE vSijsnerClientFk INT DEFAULT 19752; DECLARE vDateStart DATETIME; @@ -60433,68 +54362,68 @@ BEGIN 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, + 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 + 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 + 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 + 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 + 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 + 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 p.isPackageReturnable AND c.country = 'FRANCIA' AND t.clientFk != vSijsnerClientFk - AND tp.quantity > 0) sub + 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 + 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 + AND p.isPackageReturnable + AND t.clientFk = vSijsnerClientFk) sub GROUP BY FustCode) sj ON sj.FustCode = p.id - WHERE sent.stucks + WHERE sent.stucks OR tp.stucks OR sj.stucks; @@ -60516,7 +54445,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `fustControlDetail`(vFromDated DATE, vToDated DATE) BEGIN - + DECLARE vSijsnerClientFk INT DEFAULT 19752; DECLARE vDateStart DATETIME; @@ -60524,29 +54453,29 @@ BEGIN SET vDateStart = vFromDated; SET vDateEnd = util.Dayend(vToDated); - + SELECT a.nickname shopName, - a.city , - IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, + 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 + 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 + 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 p.isPackageReturnable AND c.country = 'FRANCIA' AND t.clientFk != vSijsnerClientFk AND tp.quantity > 0; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60572,8 +54501,8 @@ DECLARE vTicketFk INT; DECLARE vSaleFk INT; DECLARE vClonTicket INT DEFAULT 0; -DECLARE cur1 CURSOR FOR -SELECT s.ticketFk, s.id +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 @@ -60589,17 +54518,17 @@ 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, @@ -60627,12 +54556,12 @@ FETCH cur1 INTO vTicketFk, vSaleFk; zonePrice, zoneBonus, routeFk - + FROM ticket WHERE id = vTicketFk; SET vClonTicket = LAST_INSERT_ID(); - + SELECT 'lstID', vClonTicket; /* INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) @@ -60642,20 +54571,20 @@ FETCH cur1 INTO vTicketFk, vSaleFk; WHERE t.id = vClonTicket; */ INSERT INTO ticketLog - SET originFk = vTicketFk, userFk = account.myUser_getId(), `action` = 'insert', + 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; @@ -60680,8 +54609,8 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `getDayExpeditions`() BEGIN - SELECT - e.expeditions_id as expeditionFk, + 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 @@ -60695,43 +54624,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 `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 */ ; @@ -60767,12 +54659,12 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `getItemUbication`(vItemFk VARCHAR(22)) BEGIN - + /* * @deprecated Utilizar itemShelving_getInfo - * + * */ - + CALL itemshelving_getInfo(vItemFk); END ;; @@ -60781,30 +54673,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 `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 */ ; @@ -60826,7 +54694,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 `intrastat_data_neto_Update` */; +/*!50003 DROP PROCEDURE IF EXISTS `greuge_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -60836,26 +54704,25 @@ DELIMITER ; /*!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) +CREATE DEFINER=`root`@`localhost` PROCEDURE `greuge_add`() BEGIN +/** + * Group inserts into vn.greuge and then deletes the records just inserted + */ + DECLARE vDated DATE; - 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; - + SELECT DATE_SUB(util.VN_CURDATE(), INTERVAL yearsToDelete YEAR) INTO vDated + FROM vn.greugeConfig; + INSERT INTO vn.greuge(clientFk, description, amount, shipped, created, greugeTypeFk) + SELECT clientFk, 'Suma agrupada', SUM(amount), MAX(shipped), MAX(created), greugeTypeFk + FROM vn.greuge + WHERE shipped <= vDated AND description <> 'Suma agrupada' + GROUP BY clientFk, greugeTypeFk; + + DELETE + FROM vn.greuge + WHERE shipped <= vDated AND description <> 'Suma agrupada'; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60879,8 +54746,8 @@ DECLARE done BOOL DEFAULT FALSE; DECLARE vTicketFk INT; DECLARE rs CURSOR FOR - SELECT id FROM vn.ticket - WHERE shipped = util.yesterday() + SELECT id FROM vn.ticket + WHERE shipped = util.yesterday() AND clientFk = 400 AND warehouseFk IN (1,44); @@ -60891,13 +54758,13 @@ 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, + SELECT t.shipped, + s.itemFk, + s.quantity, b.buyingValue + b.freightValue + b.packageValue + b.comissionValue, - t.warehouseFk, + t.warehouseFk, w.id FROM vn.ticket t JOIN vn.sale s ON s.ticketFk = t.id @@ -60908,7 +54775,7 @@ WHILE NOT done DO AND s.quantity > 0; FETCH rs INTO vTicketFk; - + END WHILE; @@ -60936,22 +54803,23 @@ 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 - */ - +* 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 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); + SELECT id + FROM warehouse + WHERE isInventory + AND vWh IN (0,id); DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; @@ -60971,53 +54839,53 @@ proc: BEGIN SELECT MAX(landed) INTO vDateLastInventory FROM travel tr - JOIN entry e ON e.travelFk = tr.id - JOIN buy b ON b.entryFk = e.id + 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 e.supplierFk = 4 AND warehouseInFk = vWh - AND NOT isRaid; - + 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 + END IF; + + -- Generamos travel, si no existe. + SET vTravelFK = 0; + + SELECT id INTO vTravelFk FROM travel - WHERE warehouseOutFk = 13 + WHERE warehouseOutFk = 13 AND warehouseInFk = vWh - AND landed = vDate - AND agencyFk = 53 - AND ref = 'inventario' + AND landed = vDate + AND agencyModeFk = 53 + AND ref = 'inventario' LIMIT 1; - - IF NOT vTravelFK THEN - + + IF NOT vTravelFK THEN + INSERT INTO travel SET warehouseOutFk = 13, warehouseInFk = vWh, shipped = vDate, landed = vDate, - agencyFk = 53, + agencyModeFk = 53, ref = 'inventario', isDelivered = TRUE, isReceived = TRUE; - SELECT LAST_INSERT_ID() INTO vTravelFk; - + SELECT LAST_INSERT_ID() INTO vTravelFk; + END IF; - - -- Generamos entrada si no existe, o la vaciamos. - SET vEntryFk = 0; - - SELECT id INTO vEntryFk + + -- Generamos entrada si no existe, o la vaciamos. + SET vEntryFk = 0; + + SELECT id INTO vEntryFk FROM entry - WHERE supplierFk = 4 - AND travelFk = vTravelFk; + WHERE supplierFk = 4 + AND travelFk = vTravelFk; IF NOT vEntryFk THEN @@ -61028,82 +54896,84 @@ proc: BEGIN 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 + + 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, + 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) + 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 + 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; + SELECT vDateLastInventory , vDateYesterday; + -- Traslados - INSERT INTO tmp.inventory(itemFk,quantity) + INSERT INTO tmp.inventory(itemFk,quantity) SELECT itemFk, quantityOut - FROM ( + 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 tr.shipped BETWEEN vDateLastInventory + AND vDateYesterday AND NOT isRaid GROUP BY b.itemFk - ) sub + ) sub ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.quantityOut; - + -- Ventas - INSERT INTO tmp.inventory(itemFk,quantity) + INSERT INTO tmp.inventory(itemFk,quantity) SELECT itemFk, saleOut - FROM ( + 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 + ) 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 + JOIN buy b ON b.id = lb.buy_id + JOIN item i ON i.id = b.itemFk + LEFT JOIN producer p ON p.id = i.producerFk SET inv.buyingValue = b.buyingValue, inv.freightValue = b.freightValue, @@ -61117,9 +54987,8 @@ proc: BEGIN inv.price2 = b.price2, inv.price3 = b.price3, inv.minPrice = b.minPrice, - inv.producer = b.producer; + inv.producer = p.name; - INSERT INTO buy( itemFk, quantity, buyingValue, @@ -61134,8 +55003,7 @@ proc: BEGIN price2, price3, minPrice, - producer, - entryFk) + entryFk) SELECT itemFk, GREATEST(quantity,0), buyingValue, @@ -61150,20 +55018,25 @@ proc: BEGIN price2, price3, minPrice, - producer, - vEntryFk + vEntryFk FROM tmp.inventory; SELECT vWh, count(*), util.VN_NOW() FROM tmp.inventory; - + + -- Actualizamos el campo lastUsed de vn.item + UPDATE vn.item i + JOIN tmp.inventory i2 ON i2.itemFk = i.id + SET i.lastUsed = util.VN_NOW() + WHERE i2.quantity; + -- DROP TEMPORARY TABLE tmp.inventory; - + END LOOP; CLOSE cWarehouses; UPDATE config SET inventoried = vDate; - SET @isModeInventory := FALSE; + SET @isModeInventory := FALSE; DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; CREATE TEMPORARY TABLE tmp.entryToDelete @@ -61171,11 +55044,11 @@ proc: BEGIN SELECT e.id as entryId, t.id as travelId FROM vn.travel t - JOIN vn.entry e ON e.travelFk = t.id + JOIN vn.entry e ON e.travelFk = t.id WHERE e.supplierFk = 4 AND t.shipped <= TIMESTAMPADD(DAY, -2, TIMESTAMPADD(DAY, -10, util.VN_CURDATE())) AND (DAY(t.shipped) <> 1 OR shipped < TIMESTAMPADD(MONTH, -12, util.VN_CURDATE())); - + DELETE e FROM vn.entry e JOIN tmp.entryToDelete tmp ON tmp.entryId = e.id; @@ -61207,257 +55080,6 @@ BEGIN call vn.inventoryMake(TIMESTAMPADD(DAY, -10, util.VN_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(*), util.VN_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, util.VN_CURDATE())); - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -61488,7 +55110,7 @@ BEGIN b.id AS buyFk, b.entryFk, b.isIgnored, - b.price2, + b.price2, b.price3, b.stickers, b.packing, @@ -61502,20 +55124,20 @@ BEGIN s.id AS supplierFk, s.name AS supplier FROM itemType it - RIGHT JOIN (entry e + 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 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,util.VN_CURDATE())) AND s.name = 'INVENTARIO'; - + DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOk; - CREATE TEMPORARY TABLE tmp.lastEntryOk + CREATE TEMPORARY TABLE tmp.lastEntryOk (PRIMARY KEY (buyFk)) SELECT i.id AS itemFk, @@ -61525,7 +55147,7 @@ BEGIN b.id AS buyFk, b.entryFk, b.isIgnored, - b.price2, + b.price2, b.price3, b.stickers, b.packing, @@ -61539,11 +55161,11 @@ BEGIN s.id AS supplierFk, s.name AS supplier FROM itemType it - RIGHT JOIN (entry e + 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 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 @@ -61551,34 +55173,34 @@ BEGIN 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,util.VN_CURDATE())) ORDER BY tr.landed DESC; - + DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOkGroup; - CREATE TEMPORARY TABLE 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; @@ -61616,7 +55238,7 @@ BEGIN 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, @@ -61624,48 +55246,7 @@ BEGIN 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; + HAVING amount != 0; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -61683,19 +55264,19 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromAddress`(vMaxTicketDate DATETIME,vAddress INT,vCompany INT) -BEGIN +BEGIN DECLARE vMinDateTicket DATE DEFAULT TIMESTAMPADD(MONTH, -3, util.VN_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 vMaxTicketDate) AND Id_Consigna = vAddress AND Factura IS NULL AND empresa_id = vCompany; END ;; @@ -61714,20 +55295,25 @@ DELIMITER ; /*!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) +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromClient`( + IN vMaxTicketDate datetime, + IN vClientFk INT, + IN vCompanyFk INT) BEGIN - DECLARE vMinTicketDate DATE DEFAULT TIMESTAMPADD(YEAR, -3, util.VN_CURDATE()); - SET vMaxTicketDate = util.dayend(vMaxTicketDate); - + DECLARE vMinTicketDate DATE; + + SET vMinTicketDate = util.firstDayOfYear(vMaxTicketDate - INTERVAL 1 YEAR); + 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); + 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 */ ; @@ -61745,10 +55331,10 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromTicket`(IN vTicket INT) -BEGIN +BEGIN DROP TEMPORARY TABLE IF EXISTS `ticketToInvoice`; - + CREATE TEMPORARY TABLE `ticketToInvoice` (PRIMARY KEY (`id`)) ENGINE = MEMORY @@ -61777,10 +55363,10 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS newInvoiceIn; CREATE TEMPORARY TABLE newInvoiceIn - SELECT + SELECT i.*, YEAR(i.booked) datedYear, - CONCAT('s/fra',RIGHT(i.supplierRef,8),':',LEFT(s.name, 10)) conceptWithSupplier, + CONCAT('s/fra',RIGHT(i.supplierRef,8),':',LEFT(s.name, 10)) conceptWithSupplier, (cc.id = c.id) isSameCountry, cit.id invoicesCount FROM invoiceIn i @@ -61793,7 +55379,7 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS newSupplier; CREATE TEMPORARY TABLE newSupplier - SELECT + SELECT s.*, REPLACE(s.account,' ','') supplierAccount, IF(c.CEE < 2, TRUE, FALSE) isUeeMember @@ -61806,11 +55392,11 @@ BEGIN CALL util.throw('INACTIVE_PROVIDER'); END IF; - SELECT IFNULL(MAX(i.serialNumber) + 1,1) + SELECT IFNULL(MAX(i.serialNumber) + 1,1) INTO vSerialNumber FROM invoiceIn i JOIN newInvoiceIn n - WHERE i.serial LIKE n.serial + WHERE i.serial LIKE n.serial AND YEAR(i.booked) = n.datedYear AND i.companyFk = n.companyFk GROUP BY i.companyFk; @@ -61839,7 +55425,7 @@ BEGIN CALL invoiceInBookingCommon(vInvoiceInId,vSerialNumber); - SELECT SUM(iit.taxableBase * IF( i.serial= 'R' AND ti.Iva <> 'HP DEVENGADO 21 ISP', 1 +(ti.PorcentajeIva/100),1)), + 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 @@ -61862,7 +55448,7 @@ BEGIN CLAVE, empresa_id ) - SELECT + SELECT vBookNumber, n.bookEntried, s.supplierAccount, @@ -61873,7 +55459,7 @@ BEGIN n.invoicesCount, vInvoiceInId, n.companyFk - FROM newInvoiceIn n + FROM newInvoiceIn n JOIN newSupplier s; -- Línea de Gastos @@ -61883,7 +55469,7 @@ BEGIN CONTRA, EURODEBE, EUROHABER, - CONCEPTO, + CONCEPTO, CAMBIO, DEBEME, HABERME, @@ -61903,7 +55489,7 @@ BEGIN n.invoicesCount NFACTICK, n.companyFk empresa_id FROM newInvoiceIn n - JOIN newSupplier s + 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' @@ -61914,13 +55500,13 @@ BEGIN INSERT INTO XDiario( ASIEN, FECHA, SUBCTA, - CONTRA, + CONTRA, EURODEBE, BASEEURO, - CONCEPTO, - FACTURA, + CONCEPTO, + FACTURA, IVA, - AUXILIAR, + AUXILIAR, SERIE, TIPOOPE, FECHA_EX, @@ -61969,34 +55555,34 @@ BEGIN n.booked FECREGCON, n.companyFk FROM newInvoiceIn n - JOIN newSupplier s + 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 + 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 + ) 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, + CONTRA, EUROHABER, BASEEURO, - CONCEPTO, - FACTURA, + CONCEPTO, + FACTURA, IVA, - AUXILIAR, + AUXILIAR, SERIE, TIPOOPE, FECHA_EX, @@ -62042,575 +55628,36 @@ BEGIN s.nif AS TERNIF, s.name AS TERNOM, n.companyFk - FROM newInvoiceIn n - JOIN newSupplier s + 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 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 + + -- 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 - + 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 + SELECT SUM(IFNULL(ROUND(EURODEBE, 2),0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) difference FROM XDiario WHERE ASIEN = vBookNumber )sub ) - WHERE ASIEN = vBookNumber + 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 ; @@ -62632,95 +55679,43 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInDueDay_calculate`(vInvoice BEGIN IF !(SELECT COUNT(*) - FROM invoiceInDueDay iid + FROM invoiceInDueDay iid WHERE iid.invoiceInFk = vInvoiceInFk) THEN - INSERT INTO invoiceInDueDay (invoiceInFk, - dueDated, - amount, - foreignValue) + INSERT INTO invoiceInDueDay (invoiceInFk, + dueDated, + amount, + foreignValue) SELECT vInvoiceInFk, - IF(payDay, + 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)), + 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, + 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, + 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 + 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 (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 */ ; @@ -62742,9 +55737,9 @@ BEGIN DELETE FROM invoiceInDueDay WHERE invoiceInFk = vInvoiceInFk; - + CALL invoiceInDueDay_calculate(vInvoiceInFk); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -62783,7 +55778,7 @@ BEGIN CALL vn2008.recibidaIvaInsert(vInvoiceInFk); CALL vn2008.recibidaVencimientoReplace(vInvoiceInFk); - + FETCH rs INTO vInvoiceInFk; END WHILE; @@ -62828,7 +55823,7 @@ BEGIN CALL invoiceInTax_getFromEntries(vInvoiceInFk); CALL invoiceInDueDay_calculate(vInvoiceInFk); - + FETCH rs INTO vInvoiceInFk; END WHILE; @@ -62860,7 +55855,7 @@ BEGIN SELECT MAX(rr.dated) INTO vDated FROM referenceRate rr JOIN invoiceIn ii ON ii.id = vId - WHERE rr.dated <= ii.issued + WHERE rr.dated <= ii.issued AND rr.currencyFk = ii.currencyFk ; IF vDated THEN @@ -62869,13 +55864,13 @@ BEGIN WHERE dated = vDated; END IF; - SELECT id INTO vExpenceFk - FROM vn.expence - WHERE `name` = 'Adquisición mercancia Extracomunitaria' - GROUP BY id + SELECT id INTO vExpenceFk + FROM vn.expence + WHERE `name` = 'Adquisición mercancia Extracomunitaria' + GROUP BY id LIMIT 1; - - DELETE FROM invoiceInTax + + DELETE FROM invoiceInTax WHERE invoiceInFk = vId; INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, foreignValue, taxTypeSageFk, transactionTypeSageFk) @@ -62889,9 +55884,9 @@ BEGIN 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 + LEFT JOIN referenceRate rr ON rr.currencyFk = ii.currencyFk AND rr.dated = ii.issued - WHERE ii.id = vId + WHERE ii.id = vId HAVING taxableBase IS NOT NULL; END ;; DELIMITER ; @@ -62922,15 +55917,15 @@ BEGIN DECLARE vCountry INT; DECLARE vTaxArea VARCHAR(15); DECLARE vSpainCountryCode INT DEFAULT 1; - + SELECT id INTO vInvoiceFk - FROM invoiceOut + FROM invoiceOut WHERE ref = vInvoiceRef; - - UPDATE invoiceOut + + UPDATE invoiceOut SET hasPdf = 0 WHERE id = vInvoiceFk; - + SELECT s.countryFk INTO vCountry FROM supplier s JOIN invoiceOut io ON io.companyFk = s.id @@ -62939,30 +55934,30 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS ticketToInvoice; CREATE TEMPORARY TABLE ticketToInvoice - SELECT id - FROM ticket + 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 + FROM invoiceOutExpence WHERE invoiceOutFk = vInvoiceFk ) base JOIN ( SELECT SUM(vat) AS total - FROM invoiceOutTax + 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 */ ; @@ -63007,7 +56002,7 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS rs; CREATE TEMPORARY TABLE rs - SELECT + SELECT c.accountingAccount AS clientBookingAccount, io.amount as totalAmount, CONCAT('n/fra ', io.ref) as simpleConcept, @@ -63041,19 +56036,19 @@ BEGIN WHERE io.id = vInvoice; CALL vn.ledger_next(vBookNumber); - + -- Linea del cliente INSERT INTO XDiario( ASIEN, FECHA, - SUBCTA, + SUBCTA, EURODEBE, - CONCEPTO, + CONCEPTO, FECHA_EX, FECHA_OP, empresa_id ) - SELECT + SELECT vBookNumber AS ASIEN, rs.FECHA, rs.clientBookingAccount AS SUBCTA, @@ -63069,14 +56064,14 @@ BEGIN ASIEN, FECHA, SUBCTA, - CONTRA, + CONTRA, EUROHABER, - CONCEPTO, + CONCEPTO, FECHA_EX, FECHA_OP, empresa_id ) - SELECT + SELECT vBookNumber AS ASIEN, rs.FECHA, ioe.expenceFk AS SUBCTA, @@ -63090,8 +56085,8 @@ BEGIN JOIN invoiceOutExpence ioe WHERE ioe.invoiceOutFk = vInvoice; - SELECT GROUP_CONCAT(`name` SEPARATOR ',') - INTO vExpenceConcept + SELECT GROUP_CONCAT(`name` SEPARATOR ',') + INTO vExpenceConcept FROM expence e JOIN invoiceOutExpence ioe ON ioe.expenceFk = e.id WHERE ioe.invoiceOutFk = vInvoice; @@ -63101,7 +56096,7 @@ BEGIN ASIEN, FECHA, SUBCTA, - CONTRA, + CONTRA, EUROHABER, BASEEURO, CONCEPTO, @@ -63129,7 +56124,7 @@ BEGIN TIPORECTIF, empresa_id ) - SELECT + SELECT vBookNumber AS ASIEN, rs.FECHA, iot.pgcFk AS SUBCTA, @@ -63149,11 +56144,11 @@ BEGIN rs.FECHA_OP, rs.FECHA_EX, rs.TIPOOPE, - rs.NFACTICK, + rs.NFACTICK, rs.TERIDNIF, rs.TERNIF, rs.TERNOM, - pgc.mod340 AS L340, + pgc.mod340 AS L340, pgc.cplusTrascendency477Fk AS TIPOCLAVE, pgc.cplusTaxBreakFk as TIPOEXENCI, rs.TIPONOSUJE, @@ -63161,13 +56156,13 @@ BEGIN rs.TIPORECTIF, rs.companyFk AS empresa_id FROM rs - JOIN invoiceOutTax iot + 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 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 = util.VN_CURDATE() WHERE id = vInvoice; @@ -63199,7 +56194,7 @@ BEGIN DECLARE done BOOL DEFAULT FALSE; - DECLARE rs CURSOR FOR + DECLARE rs CURSOR FOR SELECT io.id FROM invoiceOut io WHERE RIGHT(ref,7) BETWEEN 1724215 AND 1724224 @@ -63214,15 +56209,15 @@ BEGIN 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; @@ -63252,14 +56247,14 @@ BEGIN DECLARE vAsien INTEGER; DECLARE vSendMail BOOL; DECLARE vBody TEXT; - + SELECT ASIEN INTO vAsien - FROM XDiario + 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), + SELECT IF(enlazado OR enlazadoSage, TRUE, FALSE), CONCAT( ' @@ -63268,7 +56263,7 @@ BEGIN - ', + ', GROUP_CONCAT( CONCAT(' @@ -63281,14 +56276,14 @@ BEGIN ) SEPARATOR ' ' ), '
FECHACONCEPTO EURODEBE EUROHABER
', IFNULL(FECHA,''), '
' - ) + ) INTO vSendMail, vBody - FROM XDiario + FROM XDiario WHERE ASIEN = vAsien; - DELETE FROM XDiario + DELETE FROM XDiario WHERE ASIEN = vAsien; - + IF vSendMail THEN CALL mail_insert( 'administracion@verdnatura.es', @@ -63306,130 +56301,10 @@ BEGIN SET refFk = NULL WHERE refFk = vRef; - DELETE + 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 */ ; @@ -63449,7 +56324,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutListByCompany`(vCompany INT, vStarted DATE, vEnded DATE) BEGIN -SELECT +SELECT c.socialName as RazonSocial, c.fi as NIF, io.ref as Factura, @@ -63461,7 +56336,7 @@ SELECT 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 @@ -63502,10 +56377,10 @@ BEGIN DECLARE done BOOL DEFAULT FALSE; - DECLARE rs CURSOR FOR + DECLARE rs CURSOR FOR SELECT id,ref FROM invoiceOut io - + WHERE issued >= '2017-07-01' AND companyFk = 1381 AND io.amount IS NULL @@ -63520,37 +56395,37 @@ BEGIN WHILE NOT done DO - SELECT s.countryFk + 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 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 + 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; @@ -63565,234 +56440,291 @@ 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 `invoiceOut_exportationFromClient` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_exportationFromClient`( + vMaxTicketDate DATETIME, + vClientFk INT, + vCompanyFk INT) +BEGIN +/** + * Genera tabla temporal ticketToInvoice necesaría para el proceso de facturación + * Los abonos quedan excluidos en las exportaciones + * + * @param vMaxTicketDate Fecha hasta la cual cogerá tickets para facturar + * @param vClientFk Id del cliente a facturar + * @param vCompanyFk Id de la empresa desde la que se factura + */ + DECLARE vMinTicketDate DATE; + SET vMinTicketDate = util.firstDayOfYear(vMaxTicketDate - INTERVAL 1 YEAR); + SET vMaxTicketDate = util.dayend(vMaxTicketDate); + + DROP TEMPORARY TABLE IF EXISTS `ticketToInvoice`; + CREATE TEMPORARY TABLE `ticketToInvoice` + (PRIMARY KEY (`id`)) + ENGINE = MEMORY + SELECT t.id + FROM ticket t + JOIN agencyMode am ON am.id = t.agencyModeFk + WHERE t.clientFk = vClientFk + AND t.refFk IS NULL + AND t.companyFk = vCompanyFk + AND t.shipped BETWEEN vMinTicketDate AND vMaxTicketDate + AND (am.`code` IS NULL OR am.`code` <> 'refund'); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_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 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 `invoiceOut_new`( vSerial VARCHAR(255), vInvoiceDate DATETIME, - vTaxArea VARCHAR(25), + 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; +/** + * 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 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 vCompanyFk INT; + DECLARE vInterCompanyFk INT; + DECLARE vClientFk 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; - + DECLARE vNewInvoiceInFk INT; + DECLARE vIsInterCompany BOOL DEFAULT FALSE; + DECLARE vIsCEESerial BOOL DEFAULT FALSE; + SET vInvoiceDate = IFNULL(vInvoiceDate,util.VN_CURDATE()); SELECT t.clientFk, t.companyFk - INTO vClient, vCompany + INTO vClientFk, vCompanyFk FROM ticketToInvoice tt JOIN ticket t ON t.id = tt.id - LIMIT 1; + 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 + -- 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 sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN supplier su ON su.id = t.companyFk + JOIN client c ON c.id = t.clientFk + LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = su.countryFk + WHERE YEAR(t.shipped) < 2001 OR c.isTaxDataChecked = FALSE - OR t.isDeleted - OR c.hasToInvoice = FALSE; + OR t.isDeleted + OR c.hasToInvoice = FALSE + OR itc.id IS NULL; - 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; + 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()) + 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 - ( + INSERT INTO invoiceOut( ref, serial, issued, clientFk, dued, companyFk, - cplusInvoiceType477Fk + cplusInvoiceType477Fk ) - SELECT - 1, - vSerial, - vInvoiceDate, - vClient, - getDueDate(vInvoiceDate, dueDay), - vCompany, - IF(vSerial = vCorrectingSerial, - vCplusCorrectingInvoiceTypeFk, - IF(vSerial = vSimplifiedSerial, - vCplusSimplifiedInvoiceTypeFk, - vCplusStandardInvoiceTypeFk)) - FROM client - WHERE id = vClient; - + SELECT + 1, + vSerial, + vInvoiceDate, + vClientFk, + getDueDate(vInvoiceDate, dueDay), + vCompanyFk, + IF(vSerial = vCorrectingSerial, + vCplusCorrectingInvoiceTypeFk, + IF(vSerial = vSimplifiedSerial, + vCplusSimplifiedInvoiceTypeFk, + vCplusStandardInvoiceTypeFk)) + FROM client + WHERE id = vClientFk; SET vNewInvoiceId = LAST_INSERT_ID(); - + SELECT `ref` - INTO vNewRef + INTO vNewRef FROM invoiceOut WHERE id = vNewInvoiceId; UPDATE ticket t - JOIN ticketToInvoice ti ON ti.id = t.id - SET t.refFk = vNewRef; + 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 + 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; - + LEFT JOIN ticketState ts ON ti.id = ts.ticket + JOIN state s + WHERE IFNULL(ts.alertLevel,0) < 3 and s.`code` = getAlert3State(ti.id); - INSERT INTO ticketLog (action, userFk,originFk, description) - SELECT 'UPDATE',account.userGetId(),ti.id, CONCAT('Crea factura ',vNewRef) + INSERT INTO ticketTracking(stateFk,ticketFk,workerFk) + SELECT * FROM tmp.updateInter; + + INSERT INTO ticketLog (action, userFk, originFk, description) + SELECT 'UPDATE', account.myUser_getId(), 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 + SELECT SUM(amount) total + FROM invoiceOutExpence WHERE invoiceOutFk = vNewInvoiceId ) base JOIN ( - SELECT SUM(vat) AS total - FROM invoiceOutTax + SELECT SUM(vat) 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; - + SELECT COUNT(*), id + INTO vIsInterCompany, vInterCompanyFk + FROM company + WHERE clientFk = vClientFk; + 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(); - + SELECT vCompanyFk, vNewRef, vInvoiceDate, vInterCompanyFk; + + SET vNewInvoiceInFk = 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 + + INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) + SELECT vNewInvoiceInFk, + @vTaxableBaseServices, + sub.expenceFk, + sub.taxTypeSageFk, + sub.transactionTypeSageFk FROM ( - SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase, i.expenceFk, i.taxTypeSageFk , i.transactionTypeSageFk, @vTaxCodeGeneral := i.taxClassCodeFk + 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 + JOIN 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 + + INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) + SELECT vNewInvoiceInFk, + 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; - - + JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tt.code + WHERE !i.isService + GROUP BY tt.pgcFk + HAVING taxableBase + ORDER BY tt.priority; + + CALL invoiceInDueDay_calculate(vNewInvoiceInFk); + + SELECT COUNT(*) INTO vIsCEESerial + FROM invoiceOutSerial + WHERE code = vSerial; + + IF vIsCEESerial THEN + + INSERT INTO invoiceInIntrastat ( + invoiceInFk, + intrastatFk, + amount, + stems, + countryFk, + net) + SELECT + vNewInvoiceInFk, + i.intrastatFk, + SUM(CAST((s.quantity * s.price * (100 - s.discount) / 100 ) AS DECIMAL(10, 2))), + SUM(CAST(IFNULL(i.stems, 1) * s.quantity AS DECIMAL(10, 2))), + su.countryFk, + CAST(SUM(IFNULL(i.stems, 1) + * s.quantity + * IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000) AS DECIMAL(10, 2)) + FROM sale s + JOIN ticket t ON s.ticketFk = t.id + JOIN supplier su ON su.id = t.companyFk + JOIN item i ON i.id = s.itemFk + LEFT JOIN itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk + WHERE t.refFk = vNewRef + GROUP BY i.intrastatFk; + + END IF; 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 ; @@ -63810,13 +56742,18 @@ DELIMITER ; /*!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) +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 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 @@ -63824,8 +56761,8 @@ BEGIN * @param vRef Referencia de la factura en caso que se quiera forzar, NULL por defecto * @return vInvoiceId factura */ - DECLARE vIsRefEditable BOOLEAN; + DECLARE vIsExportation BOOLEAN; IF vRef IS NOT NULL THEN SELECT isRefEditable INTO vIsRefEditable @@ -63835,19 +56772,29 @@ BEGIN IF NOT vIsRefEditable THEN CALL util.throw('serial non editable'); END IF; - END IF; - - CALL invoiceFromClient(vMaxShipped, vClientFk, vCompanyFk); + END IF; + + SELECT COUNT(*) INTO vIsExportation + FROM vn.invoiceOutSerial + WHERE taxAreaFk = 'WORLD' + AND `code` = vSerial; + + IF vIsExportation THEN + CALL invoiceOut_exportationFromClient(vMaxShipped, vClientFk, vCompanyFk); + ELSE + CALL invoiceFromClient(vMaxShipped, vClientFk, vCompanyFk); + END IF; + CALL invoiceOut_new(vSerial, util.VN_CURDATE(), vTaxArea, vInvoiceId); UPDATE invoiceOut SET `ref` = vRef - WHERE id = vInvoiceId + WHERE id = vInvoiceId AND vRef IS NOT NULL; - IF vSerial <> 'R' AND NOT ISNULL(vInvoiceId) AND vInvoiceId <> 0 THEN + IF vSerial <> 'R' AND NOT ISNULL(vInvoiceId) AND vInvoiceId <> 0 THEN CALL invoiceOutBooking(vInvoiceId); - END IF; + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -63871,7 +56818,7 @@ 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, + * @param vTaxArea Area de la factura en caso de querer forzarlo, * en la mayoria de los casos poner NULL * @return vInvoiceId */ @@ -63886,11 +56833,11 @@ BEGIN IF NOT vIsRefEditable THEN CALL util.throw('serial non editable'); END IF; - - UPDATE invoiceOut + + UPDATE invoiceOut SET `ref` = vRef WHERE id = vInvoiceId; - END IF; + END IF; IF vSerial <> 'R' AND NOT ISNULL(vInvoiceId) AND vInvoiceId <> 0 THEN CALL invoiceOutBooking(vInvoiceId); @@ -63901,158 +56848,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 `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,util.VN_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 */ ; @@ -64075,14 +56870,14 @@ BEGIN */ DELETE FROM invoiceOutTax WHERE invoiceOutFk = vInvoice; - + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; CREATE TEMPORARY TABLE tmp.ticket (KEY (ticketFk)) ENGINE = MEMORY SELECT id ticketFk FROM ticketToInvoice; - + CALL ticket_getTax(vTaxArea); INSERT INTO invoiceOutTax( @@ -64099,63 +56894,7 @@ BEGIN 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; @@ -64180,325 +56919,10 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `itemBarcode_update`(vItemFk INT,vCo BEGIN IF vDelete THEN DELETE FROM vn.itemBarcode WHERE itemFk = vItemFk AND code = vCode; -ELSE +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, util.VN_CURDATE()); - - SELECT SUM(visible) INTO vVisibleAltillo - FROM vn.itemShelvingStock - WHERE itemFk = vItemFk AND warehouseFk = vWarehouseFk; - - CALL vn.buyUltimate(vWarehouseFk, util.VN_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, util.VN_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 util.VN_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 */ ; @@ -64517,8 +56941,8 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemFreight_Show`(vItemFk INT, vWarehouseFk INT) BEGIN - - SELECT cm3 Volumen_Entrada, + + SELECT cm3 Volumen_Entrada, cm3delivery Volumen_Salida, p.volume Volumen_del_embalaje, p.width Ancho_del_embalaje, @@ -64531,11 +56955,11 @@ BEGIN 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 + 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; @@ -64559,33 +56983,33 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `itemFuentesBalance`(vDaysInFuture I 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 + FROM vn.sector s WHERE s.code = 'FUENTES_PICASSE'; - + CALL cache.stock_refresh(FALSE); - SELECT i.id itemFk, + SELECT i.id itemFk, i.longName, i.size, i.subName, - v.amount - IFNULL(fue.Fuentes,0) - IFNULL(alb.albenfruit,0) as visible, - fue.Fuentes, + 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) + 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 + 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 @@ -64593,7 +57017,7 @@ BEGIN 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 + 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 @@ -64602,7 +57026,7 @@ BEGIN 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 + 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 ( @@ -64627,9 +57051,9 @@ BEGIN AND warehouse_id = vWarehouseFk GROUP BY item_id ) mov ON mov.item_id = i.id - WHERE (v.amount OR fue.Fuentes OR alb.Albenfruit) + WHERE (v.amount OR fue.Fuentes OR alb.Albenfruit) AND i.itemPackingTypeFk = 'H' - AND ic.shortLife + AND ic.shortLife ; END ;; @@ -64638,80 +57062,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 `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(util.VN_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 */ ; @@ -64725,7 +57075,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementFromTicket`(vTicket INT) BEGIN /** - * Llama a itemPlacementUpdateVisible + * Llama a itemPlacementUpdateVisible * de los articulos de la tabla temporal tmp.itemPlacement(itemFk) * @treturn tmp.itemPlacement * @param vTicket Id del Ticket @@ -64739,76 +57089,9 @@ BEGIN 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 util.VN_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 ; @@ -64816,39 +57099,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 `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 = util.VN_NOW(); - ELSE - INSERT INTO itemPlacement(itemFk, warehouseFk, code) - VALUES(vItemFk, vWarehouseFk, vPlacement) - ON DUPLICATE KEY UPDATE code = vPlacement, modificationDate = util.VN_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 */ ; @@ -64874,7 +57124,7 @@ BEGIN CAST(FLOOR(LEAST(ish.stock,quantity) / ish.packing) AS DECIMAL(10,0)), ' x ', ish.packing, - IF ( + IF ( LEAST(ish.stock,quantity) MOD ish.packing, CONCAT(' + ',CAST(LEAST(ish.stock,quantity) MOD ish.packing AS DECIMAL(10,0))), '' @@ -64905,7 +57155,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyCloseOrder`(vId INT, vQuantity INT) BEGIN - UPDATE vn.itemPlacementSupply + UPDATE vn.itemPlacementSupply SET priority = 10 WHERE id = vId; @@ -64931,7 +57181,7 @@ 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 @@ -64939,9 +57189,9 @@ BEGIN 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 @@ -64950,13 +57200,13 @@ BEGIN 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 + + SELECT * FROM vn.itemPlacementSupplyList + WHERE id = vId AND sectorFk = vSector; END ;; @@ -64976,117 +57226,36 @@ DELIMITER ; /*!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. + * 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 vCalc INT; - DECLARE vTodayIni DATE DEFAULT util.VN_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; + DECLARE vWarehouseAliasFk INT; -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 w.aliasFk INTO vWarehouseAliasFk + FROM vn.sector s + JOIN vn.warehouse w ON w.id = s.warehouseFk + WHERE s.id = vSectorFk; -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; + 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 (sc.id = vSectorFk) DESC, sh.priority DESC; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -65112,20 +57281,20 @@ BEGIN * @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); @@ -65135,16 +57304,16 @@ BEGIN 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, @@ -65177,7 +57346,7 @@ BEGIN 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.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, @@ -65185,7 +57354,7 @@ BEGIN (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 ; @@ -65211,7 +57380,7 @@ BEGIN * @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; @@ -65220,41 +57389,41 @@ BEGIN 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; @@ -65283,13 +57452,13 @@ BEGIN 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); @@ -65299,16 +57468,16 @@ BEGIN 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 + 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, @@ -65326,7 +57495,7 @@ BEGIN (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8, a.available, IFNULL(ip.counter,0) counter - FROM vn.item i + 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 @@ -65340,181 +57509,7 @@ BEGIN (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.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, @@ -65550,7 +57545,7 @@ BEGIN CREATE TEMPORARY TABLE tmp.item SELECT vItem id; - + CALL item_refreshTags(); DROP TEMPORARY TABLE tmp.item; @@ -65573,24 +57568,24 @@ DELIMITER ; 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 + FROM `time` t WHERE CONCAT(vYear, LPAD(vWeek, 2, 0)) = t.period; SELECT t.shipped, w.name warehouse, - s.ticketFk, + s.ticketFk, c.quality, t.nickname client, - am.name agencyName, + am.name agencyName, wk.code salesPerson, s.itemFk, - IFNULL(CONCAT(ig.longName,' ',ig.`size`,' ',ig.subName), s.concept) AS concept, - s.quantity, + IFNULL(CONCAT(ig.longName,' ',ig.`size`,' ',ig.subName), s.concept) AS concept, + s.quantity, s.price, s.priceFixed, s.discount, @@ -65600,80 +57595,20 @@ BEGIN wk.id salesPersonFk FROM sale s JOIN ticket t ON t.id = s.ticketFk - JOIN warehouse w ON w.id = t.warehouseFk + 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 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 + 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 */ ; @@ -65695,9 +57630,9 @@ BEGIN DECLARE vItemFk INT; SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - + UPDATE vn.item SET minimum = min WHERE id = vItemFk; - + END ;; @@ -65719,8 +57654,8 @@ 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 + FROM vn.shelving s + JOIN parking p ON s.parkingFk = p.id WHERE s.`code` = vShelvingFk COLLATE utf8_general_ci; END ;; DELIMITER ; @@ -65761,36 +57696,36 @@ DELIMITER ; 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 - * + * @param vShelvingFk Matrícula del carro + * */ - - SELECT isl.itemShelvingFk, - isl.created, - isl.accion, - isl.itemFk, - isl.shelvingFk, - isl.quantity, + + 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.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 + 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 */ ; @@ -65807,9 +57742,9 @@ 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 `vQuantity` INT, IN `vPackagingFk` VARCHAR(10), IN `vGrouping` INT, IN `vPacking` INT, IN `vWarehouseFk` INT, `vCreated` VARCHAR(22)) +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingMakeFromDate`(IN `vShelvingFk` VARCHAR(8), IN `vBarcode` VARCHAR(22), 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; @@ -65828,9 +57763,9 @@ BEGIN END IF; - IF (SELECT COUNT(*) FROM vn.itemShelving - WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk - AND itemFk = vItemFk + IF (SELECT COUNT(*) FROM vn.itemShelving + WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk + AND itemFk = vItemFk AND packing = vPacking) = 1 THEN UPDATE vn.itemShelving @@ -65844,7 +57779,6 @@ BEGIN CALL cache.last_buy_refresh(FALSE); INSERT INTO itemShelving( itemFk, shelvingFk, - shelve, visible, created, `grouping`, @@ -65852,7 +57786,6 @@ BEGIN packagingFk) SELECT vItemFk, vShelvingFk, - vShelve, vQuantity, vCreated, IF(vGrouping = 0, IFNULL(b.packing, vPacking), vGrouping) `grouping`, @@ -65862,8 +57795,8 @@ BEGIN 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 IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -65884,9 +57817,9 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingMatch`(vEntryFk INT, vA BEGIN DECLARE vTravelFk INT; - - SELECT travelFk INTO vTravelFk - FROM entry + + SELECT travelFk INTO vTravelFk + FROM entry WHERE id = vEntryFk; SELECT i.id, i.longName, i.size, i.subName, b.stickers, ish.etiquetas, b.printed @@ -65899,7 +57832,7 @@ BEGIN GROUP BY itemFk ) b ON b.itemFk = i.id LEFT JOIN ( - SELECT itemFk, sum(cast(visible / packing AS DECIMAL(10,0))) AS etiquetas + 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 @@ -65939,7 +57872,7 @@ BEGIN UPDATE vn.itemShelving SET visible = visible - vQuantity WHERE id = vItemShelvingFk; - + END ;; DELIMITER ; @@ -65962,47 +57895,47 @@ 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, + + 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, + 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 + 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 + JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id LEFT JOIN - (SELECT itemFk, sum(saldo) as transit - FROM vn.itemPlacementSupplyList - WHERE saldo > 0 + (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 + 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.isPicked = FALSE AND s.reserved = FALSE - AND t.shipped BETWEEN util.VN_CURDATE() AND MIDNIGHT(util.VN_CURDATE()) + AND t.shipped BETWEEN util.VN_CURDATE() AND MIDNIGHT(util.VN_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 */ ; @@ -66021,7 +57954,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar`(vSectorFk INT) proc:BEGIN - + DECLARE vCalcVisibleFk INT; DECLARE vCalcAvailableFk INT; DECLARE hasFatherSector BOOLEAN; @@ -66029,25 +57962,25 @@ proc:BEGIN DECLARE vWarehouseFk INT DEFAULT 0; DECLARE vSonSectorFk INT; DECLARE vWorkerFk INT; - - SELECT s.workerFk - INTO vWorkerFk + + 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 + 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 @@ -66057,21 +57990,21 @@ proc:BEGIN 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, util.VN_CURDATE()); - + DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingRadar; - + IF hasFatherSector THEN - + CREATE TEMPORARY TABLE tmp.itemShelvingRadar (PRIMARY KEY (itemFk)) - ENGINE = MEMORY + ENGINE = MEMORY SELECT * FROM ( SELECT iss.itemFk, i.longName, @@ -66082,7 +58015,7 @@ proc:BEGIN 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 @@ -66091,11 +58024,11 @@ proc:BEGIN 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, @@ -66105,7 +58038,7 @@ proc:BEGIN 0 downstairs, IF(it.isPackaging, NULL, v.visible) visible, vSectorFk as sectorFk - FROM cache.visible v + 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 @@ -66114,8 +58047,8 @@ proc:BEGIN AND iss.itemFk IS NULL AND it.isInventory ) sub GROUP BY itemFk; - - SELECT ishr.*, + + 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 @@ -66130,17 +58063,17 @@ proc:BEGIN ) sub ON sub.itemFk = ishr.itemFk ORDER BY i.typeFk, i.longName ; - - + + ELSE - + CREATE TEMPORARY TABLE tmp.itemShelvingRadar (PRIMARY KEY (itemFk)) - ENGINE = MEMORY + ENGINE = MEMORY SELECT iss.itemFk, 0 `hour`, 0 `minute`, - IFNULL(ip.`code`,'--') itemPlacementCode, + '--' itemPlacementCode, i.longName, i.size, i.subName producer, @@ -66148,7 +58081,7 @@ proc:BEGIN 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(v.visible - iss.visible,0) itemPlacementVisible, IFNULL(i.minimum * b.packing,0) itemPlacementSize, ips.onTheWay, iss.visible itemShelvingStock, @@ -66157,19 +58090,18 @@ proc:BEGIN 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 + 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; - /* + 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, @@ -66180,10 +58112,10 @@ proc:BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.itemOutTime; CREATE TEMPORARY TABLE tmp.itemOutTime SELECT *,SUM(amount) quantity - FROM + FROM (SELECT item_id itemFk, - amount, - IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) as hours, + 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 @@ -66191,23 +58123,23 @@ proc:BEGIN JOIN vn.ticketState ts on ts.ticketFk = io.ticketFk JOIN vn.state s ON s.id = ts.stateFk LEFT JOIN vn.zone z ON z.id = t.zoneFk - LEFT JOIN (SELECT DISTINCT saleFk - FROM vn.saleTracking st - WHERE st.created > util.VN_CURDATE() + LEFT JOIN (SELECT DISTINCT saleFk + FROM vn.saleTracking st + WHERE st.created > util.VN_CURDATE() AND st.isChecked ) stPrevious ON `stPrevious`.`saleFk` = io.saleFk WHERE t.warehouseFk = vWarehouseFk - AND s.isPicked = 0 - AND NOT io.Reservado + AND s.isPicked = 0 + AND NOT io.Reservado AND stPrevious.saleFk IS NULL - AND io.dat >= util.VN_CURDATE() + AND io.dat >= util.VN_CURDATE() AND io.dat < util.VN_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, + 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); @@ -66217,13 +58149,13 @@ proc:BEGIN 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 */ ; @@ -66247,24 +58179,24 @@ BEGIN DECLARE vCalcVisibleFk INT; DECLARE vCalcAvailableFk INT; DECLARE vTodayDayEnd DATETIME DEFAULT util.dayEnd(util.VN_CURDATE()); - + CALL cache.visible_refresh(vCalcVisibleFk, FALSE, 1); CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE()); - + DROP TEMPORARY TABLE IF EXISTS tmp.item; CREATE TEMPORARY TABLE tmp.item ENGINE = MEMORY SELECT DISTINCT itemFk - FROM vn.buy + 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, + + 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, @@ -66284,11 +58216,11 @@ BEGIN 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 */ ; @@ -66312,34 +58244,34 @@ BEGIN DECLARE vCalcVisibleFk INT; DECLARE vCalcAvailableFk INT; DECLARE vTodayDayEnd DATETIME DEFAULT util.dayEnd(util.VN_CURDATE()); - + CALL cache.visible_refresh(vCalcVisibleFk, FALSE, 1); CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE()); - + DROP TEMPORARY TABLE IF EXISTS tmp.item; CREATE TEMPORARY TABLE tmp.item ENGINE = MEMORY SELECT DISTINCT itemFk - FROM vn.buy + 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, + + 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 */ ; @@ -66366,7 +58298,7 @@ BEGIN CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); - SELECT * FROM + SELECT * FROM (SELECT sub.itemFk, sub.longName, CONCAT(DATE_FORMAT(sub2.etd,'%H:%i'), ' salen ', CAST(sub2.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, @@ -66384,14 +58316,14 @@ BEGIN 0 upstairs, SUM(IFNULL(iss.visible,0)) downstairs, IF(it.isPackaging, null, IFNULL(v.visible,0)) visible, - IFNULL(iss.sectorFk,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 WHERE s.warehouseFk = vWarehouseFk - GROUP BY itemFk + 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 @@ -66403,8 +58335,8 @@ BEGIN AND ISNULL(st.saleFk) AND ct.code IN ('normal', 'trust') GROUP BY s.itemFk - ) sub2 ON sub2.itemFk = sub.itemFk - UNION ALL + ) 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`, @@ -66418,7 +58350,7 @@ BEGIN 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 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 @@ -66432,7 +58364,7 @@ BEGIN GROUP BY s.itemFk ) sub5 ON sub5.itemFk = v.item_id WHERE v.calc_id = @vCalcVisibleFk - AND ISNULL(iss.itemFk) + AND ISNULL(iss.itemFk) ) sub3 WHERE nicho ORDER BY LEFT(producer,3), etd, producer; @@ -66442,7 +58374,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 `itemShelvingSaleAdd` */; +/*!50003 DROP PROCEDURE IF EXISTS `itemShelvingSale_Add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -66452,55 +58384,21 @@ DELIMITER ; /*!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) +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSale_Add`(vItemShelvingFk INT, vSaleFk 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 + * @param vSaleFk Id de sale + * @param vQuantity cantidad a regularizar */ INSERT INTO itemShelvingSale(itemShelvingFk, saleFk, quantity, userFk) VALUES (vItemShelvingFk, - saleFk, + vSaleFk, vQuantity, getUser()); @@ -66508,9 +58406,9 @@ BEGIN SET visible = visible - vQuantity WHERE id = vItemShelvingFk; - UPDATE vn2008.Movimientos_mark - SET valor = 1 - WHERE Id_Movimiento = saleFk; + UPDATE vn.saleTracking + SET isChecked = 1 + WHERE saleFk = vSaleFk; END ;; DELIMITER ; @@ -66528,15 +58426,48 @@ DELIMITER ; /*!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)) +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingTransfer`(vItemShelvingFk INT, vShelvingFk VARCHAR(3)) BEGIN - - UPDATE vn.itemShelving - SET shelvingFk = shelvingFkD - WHERE id = vItemShelvingFk; - - SELECT true; +/** + * Transfiere producto de una ubicación a otra, fusionando si coincide el + * packing y la fecha. + * + * @param vItemShelvingFk Identificador de itemShelving + * @param vShelvingFk Identificador de shelving + */ + DECLARE vNewItemShelvingFk INT DEFAULT 0; + SELECT MAX(ish.id) + INTO vNewItemShelvingFk + FROM itemShelving ish + JOIN ( + SELECT + itemFk, + packing, + created + FROM itemShelving + WHERE id = vItemShelvingFk + ) ish2 + ON ish2.itemFk = ish.itemFk + AND ish2.packing = ish.packing + AND date(ish2.created) = date(ish.created) + WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci; + + IF vNewItemShelvingFk THEN + UPDATE itemShelving ish + JOIN itemShelving ish2 ON ish2.id = vItemShelvingFk + SET ish.visible = ish.visible + ish2.visible + WHERE ish.id = vNewItemShelvingFk; + + DELETE FROM itemShelving + WHERE id = vItemShelvingFk; + ELSE + UPDATE itemShelving + SET shelvingFk = vShelvingFk + WHERE id = vItemShelvingFk; + END IF; + + SELECT true; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -66553,22 +58484,21 @@ DELIMITER ; /*!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) +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_add`(IN vShelvingFk VARCHAR(8), IN vBarcode VARCHAR(22), 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; @@ -66578,27 +58508,26 @@ BEGIN 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 + 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 + 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; + 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, @@ -66606,7 +58535,6 @@ BEGIN SELECT vItemFk, vShelvingFk, - vShelve, vQuantity, IFNULL(vGrouping, b.grouping), IFNULL(vPacking, b.packing), @@ -66665,6 +58593,66 @@ 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 `itemShelving_addList` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_addList`(vShelvingFk VARCHAR(3), vList TEXT, vIsChecking BOOL, vWarehouseFk INT) +BEGIN +/* Recorre cada elemento en la colección vList. + * Si el parámetro isChecking = FALSE, llama a itemShelving_add. + * + * Cuando es TRUE sólo inserta los elementos de la colección que no están ya en + * ese shelving, actualizando los valores del campo vn.itemShelving.isChecked + * + * param vShelvingFk Identificador de vn.shelving + * param vList JSON array con esta estructura: '[value1, value2, ...]' + * param vIsChecking Define si hay que añadir o comprobar los items + * param vWarehouseFk Identificador de vn.warehouse + */ + DECLARE vListLength INT DEFAULT JSON_LENGTH(vList); + DECLARE vCounter INT DEFAULT 0; + DECLARE vBarcode VARCHAR(22); + DECLARE vPath VARCHAR(6); + DECLARE vItemFk INT; + DECLARE vIsChecked BOOL; + + WHILE vCounter < vListLength DO + SET vPath = CONCAT('$[',vCounter,']'); + SET vBarcode = JSON_EXTRACT(vList,vPath); + SET vIsChecked = NULL; + IF vIsChecking THEN + SELECT barcodeToItem(vBarcode) INTO vItemFk; + + SELECT COUNT(*) INTO vIsChecked + FROM vn.itemShelving + WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk + AND itemFk = vItemFk; + END IF; + + IF NOT (vIsChecking AND vIsChecked) THEN + CALL vn.itemShelving_add(vShelvingFk, vBarcode, 1, NULL, NULL, NULL, vWarehouseFk); + END IF; + + UPDATE vn.itemShelving + SET isChecked = vIsChecked + WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk + AND itemFk = vItemFk; + + SET vCounter = vCounter + 1; + END WHILE; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `itemShelving_BuyerGet` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -66679,46 +58667,7 @@ 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 */ ; @@ -66745,15 +58694,15 @@ proc:BEGIN * @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(); + CALL vn.itemShelvingRadar_Urgent(); LEAVE proc; END IF; CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); - SELECT * FROM + SELECT * FROM (SELECT sub.itemFk, sub.longName, CONCAT('Hoy saldrán ', CAST(sub2.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, @@ -66770,7 +58719,7 @@ proc:BEGIN 0 upstairs, SUM(IFNULL(iss.visible,0)) downstairs, IF(it.isPackaging, null, IFNULL(v.visible,0)) visible, - IFNULL(iss.sectorFk,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 @@ -66778,19 +58727,19 @@ proc:BEGIN 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 + 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 ticket t ON t.id = s.ticketFk JOIN client c on c.id = t.clientFk JOIN clientType ct ON ct.id = c.clientTypeFk WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND ISNULL(st.saleFk) AND ct.code IN ('normal', 'trust') GROUP BY s.itemFk - ) sub2 ON sub2.itemFk = sub.itemFk - UNION ALL + ) 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`, @@ -66803,11 +58752,11 @@ proc:BEGIN 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 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 ticket t ON t.id = s.ticketFk JOIN client c on c.id = t.clientFk JOIN clientType ct ON ct.id = c.clientTypeFk WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) @@ -66816,7 +58765,7 @@ proc:BEGIN GROUP BY s.itemFk ) sub5 ON sub5.itemFk = v.item_id WHERE v.calc_id = vCalcVisibleFk - AND ISNULL(iss.itemFk) + AND ISNULL(iss.itemFk) AND it.workerFk = vBuyerFk ) sub3 WHERE nicho @@ -66837,32 +58786,65 @@ DELIMITER ; /*!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)) +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_get`(IN vSelf 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 +* Lista artículos de itemshelving +* +* @param vSelf matrícula del carro +**/ + SELECT ish.itemFk item, + IFNULL(i.longName, CONCAT(i.name, ' ', i.size)) description, + ish.visible, + CEIL(ish.visible/ish.packing) stickers, + ish.packing, + ish.grouping, + IF (p.column IS NULL, '', p.column) col, + IF (p.row IS NULL, '', p.row) row, + IF (p.code IS NULL, '', p.code) code, + ish.id, + s.priority, + ish.isChecked 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; - + JOIN shelving s ON vSelf = s.code COLLATE utf8_unicode_ci + LEFT JOIN parking p ON s.parkingFk = p.id + WHERE ish.shelvingFk COLLATE utf8_unicode_ci = 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 `itemShelving_getAlternatives` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_getAlternatives`(vShelvingFk VARCHAR(10)) +BEGIN +/** + * Devuelve un listado de posibles ubicaciones alternativas a ubicar los item de la matricula + * del carro que se le ha pasado. + * + * @param vShelvingFk matricula del carro + */ + SELECT is2.id,is2.shelvingFk , p.code, is2.itemFk , is2.visible, p.pickingOrder + FROM itemShelving is2 + JOIN shelving sh ON sh.code = is2.shelvingFk + JOIN parking p ON p.id = sh.parkingFk + JOIN sector s ON s.id = p.sectorFk + LEFT JOIN worker w ON w.sectorFk = s.id AND w.id = account.myUser_getId() + JOIN warehouse wh ON wh.id = s.warehouseFk + JOIN itemShelving is3 ON is3.itemFk = is2.itemFk AND is3.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci + WHERE is2.shelvingFk <> vShelvingFk COLLATE utf8_unicode_ci + GROUP BY is2.id + ORDER BY p.pickingOrder DESC; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -66918,35 +58900,35 @@ DELIMITER ; 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 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 + FROM vn.itemShelving WHERE shelvingFk = vShelvingFk COLLATE utf8_unicode_ci - GROUP BY itemFk; - + 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)) @@ -66957,16 +58939,16 @@ BEGIN FROM ( SELECT * FROM ( SELECT t2.* FROM ( - SELECT item_id itemFk, amount, util.VN_CURDATE() dated - FROM cache.stock + SELECT item_id itemFk, amount, util.VN_CURDATE() dated + FROM cache.stock WHERE warehouse_id = vWarehouseFk UNION ALL SELECT ish.itemFk, - sum(visible), util.VN_CURDATE() - FROM vn.itemShelving ish - JOIN shelving sh ON sh.code = ish.shelvingFk - JOIN parking p ON sh.parkingFk = p.id + 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 + WHERE s.isReserve GROUP BY ish.itemFk UNION ALL SELECT item_id, sum(iei.amount), dat @@ -66975,9 +58957,9 @@ BEGIN AND warehouse_id = vWarehouseFk AND isVirtualStock = FALSE GROUP BY item_id, dat - UNION ALL + UNION ALL SELECT item_id, sum(ieo.amount), dat - FROM vn2008.item_entry_out ieo + FROM vn2008.item_entry_out ieo WHERE dat >= util.VN_CURDATE() AND warehouse_id = vWarehouseFk GROUP BY item_id, dat @@ -66988,11 +58970,11 @@ BEGIN WHERE io.dat >= util.VN_CURDATE() AND io.warehouse_id = vWarehouseFk GROUP BY io.item_id, io.dat - ) t2 + ) 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 + + 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 @@ -67021,14 +59003,14 @@ DELIMITER ; 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; @@ -67036,53 +59018,30 @@ BEGIN 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, + SELECT p.code parking , + ish.shelvingFk , + ish.itemFk, i.longName, - ish.visible , + ish.visible , ish.visible / ish.packing packs, - ish.packing, + 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 + 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 */ ; @@ -67110,9 +59069,9 @@ BEGIN * @param vGrouping el grouping del producto en itemShelving */ UPDATE itemShelving - SET visible = vVisible, - packing = vPacking, - grouping = vGrouping + SET visible = vVisible, + packing = vPacking, + grouping = vGrouping WHERE id = vShelf; END ;; @@ -67139,34 +59098,34 @@ BEGIN * @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 + SELECT itemFk, quantity FROM itemTicketOut WHERE shipped >= util.VN_CURDATE() AND shipped < vDated AND warehouseFk = vWarehouseFk AND (vItemFk IS NULL OR itemFk = vItemFk) UNION ALL - SELECT itemFk, quantity + SELECT itemFk, quantity FROM itemEntryIn i - LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = i.entryFk + LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = i.entryFk WHERE i.landed >= util.VN_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 + SELECT itemFk, quantity FROM itemEntryOut WHERE shipped >= util.VN_CURDATE() AND shipped < vDated AND warehouseOutFk = vWarehouseFk @@ -67177,7 +59136,7 @@ BEGIN CALL `cache`.stock_refresh (FALSE); INSERT INTO tmp.itemList (itemFk,stock,visible,available) - SELECT item_id,amount,amount,amount + 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 @@ -67190,90 +59149,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 `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) = util.VN_CURDATE() - AND a.isDefaultAddress - LIMIT 1; - - IF vTicketFk IS NULL THEN - - CALL ticket_add( - vClientFk, - util.VN_CURDATE(), - vWarehouseFk, - vCompanyVnlFk, - NULL, - NULL, - NULL, - util.VN_CURDATE(), - account.userGetId(), - FALSE, - vTicketFk); - - END IF; - - INSERT INTO sale(ticketFk, itemFk, concept, quantity, price, discount) - SELECT vTicketFk, vItemFk, CONCAT(longName,' ', getWorkerCode(), ' ',LEFT(CAST(util.VN_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 */ ; @@ -67287,7 +59162,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagMake`(vItemFk INT) BEGIN -/* * Crea los tags usando la tabla plantilla itemTag +/* * 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 */ @@ -67297,33 +59172,33 @@ BEGIN DECLARE vProducer VARCHAR(50); DECLARE vOrigin VARCHAR(20); DECLARE vTypeFk INTEGER; - - DELETE FROM itemTag + + DELETE FROM itemTag WHERE itemFk = vItemFk; - - SELECT typeFk INTO vTypeFk + + 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 + 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); @@ -67332,11 +59207,11 @@ BEGIN 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 */ ; @@ -67347,9 +59222,9 @@ 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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -67357,12 +59232,12 @@ 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 + FROM vn.item i WHERE i.typeFk = itemTypeFk; UPDATE itemTag it @@ -67371,8 +59246,8 @@ BEGIN 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(); + + CALL item_refreshTags(); SET @isTriggerDisabled = FALSE; @@ -67397,12 +59272,12 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagReorderByName`(vName VARCHAR 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 + FROM vn.item i WHERE i.`name` LIKE CONCAT(vName,'%'); UPDATE itemTag it @@ -67411,8 +59286,8 @@ BEGIN 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(); + + CALL item_refreshTags(); SET @isTriggerDisabled = FALSE; @@ -67423,142 +59298,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 `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 */ ; @@ -67571,36 +59310,36 @@ DELIMITER ; 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 + DELETE FROM vn.itemTag WHERE itemFk = vItemToFk; - + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) SELECT vItemToFk, tagFk, value, priority - FROM vn.itemTag + FROM vn.itemTag WHERE itemFk = vItemFromFk; - + IF ISNULL(vPicture) THEN - - SELECT image INTO vPicture - FROM vn.item + + SELECT image INTO vPicture + FROM vn.item WHERE id = vItemFromFk; - + END IF; - UPDATE vn.item i + 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 */ ; @@ -67625,9 +59364,9 @@ BEGIN SELECT DISTINCT id FROM vn.itemCategory WHERE merchandise <> FALSE; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN + DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN RESIGNAL; END; @@ -67638,45 +59377,45 @@ BEGIN INNER JOIN bs.ventas v ON v.Id_Movimiento = s.id WHERE v.fecha BETWEEN TIMESTAMPADD(DAY, - 7, util.VN_CURDATE()) AND util.VN_CURDATE() GROUP BY s.itemFk; - + DROP TABLE IF EXISTS tmp.topSeller; - CREATE TEMPORARY TABLE 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; + 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 */ ; @@ -67694,9 +59433,9 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTrash`( - vItemFk INT, - vWarehouseFk INT, - vQuantity INT, + vItemFk INT, + vWarehouseFk INT, + vQuantity INT, vIsTrash BOOLEAN) BEGIN @@ -67704,51 +59443,51 @@ BEGIN DECLARE vClientFk INT; DECLARE vCompanyVnlFk INT DEFAULT 442; DECLARE vCalc INT; - - SELECT barcodeToItem(vItemFk) INTO vItemFk; - + + 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 + JOIN address a ON a.id=t.addressFk WHERE t.warehouseFk = vWarehouseFk AND t.clientFk = vClientFk AND DATE(t.shipped) = util.VN_CURDATE() AND a.isDefaultAddress - LIMIT 1; - + LIMIT 1; + CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk); - - IF vTicketFk IS NULL THEN - + + IF vTicketFk IS NULL THEN + CALL ticket_add( - vClientFk, + vClientFk, util.VN_CURDATE(), - vWarehouseFk, - vCompanyVnlFk, - NULL, - NULL, - NULL, - util.VN_CURDATE(), - account.userGetId(), + vWarehouseFk, + vCompanyVnlFk, + NULL, + NULL, + NULL, + util.VN_CURDATE(), + account.myUser_getId(), FALSE, vTicketFk); END IF; - + INSERT INTO sale(ticketFk, itemFk, concept, quantity) - SELECT vTicketFk, + SELECT vTicketFk, vItemFk, - CONCAT(longName,' ',getWorkerCode(), ' ', LEFT(CAST(util.VN_NOW() AS TIME),5)), + CONCAT(longName,' ',getWorkerCode(), ' ', LEFT(CAST(util.VN_NOW() AS TIME),5)), vQuantity - FROM item + FROM item WHERE id = vItemFk; - - UPDATE cache.visible + + UPDATE cache.visible SET visible = visible - vQuantity - WHERE calc_id = vCalc + WHERE calc_id = vCalc AND item_id = vItemFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -67789,7 +59528,7 @@ SET tag6 = t.name, value6 = it.value WHERE it.priority = 2 AND (vItem IS NULL OR vItem = it.itemFk); -UPDATE item i +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 @@ -67815,246 +59554,297 @@ 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 `item_clean`(vItemFrom INT, vItemTo INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_clean`() BEGIN - -/* - * Elimina todos los items repetidos y los sustituye por el que tiene menor id +/** + * Elimina todos los items repetidos y los + * sustituye por el que tiene menor id */ + DECLARE vItemOld INT; + DECLARE vItemNew INT; + DECLARE vCounter INT DEFAULT 0; + DECLARE vDone BOOL DEFAULT FALSE; + DECLARE curItemClean CURSOR FOR + 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 isFloramondo + AND (ISNULL(i.supplyResponseFk) + OR sub.NumberOfUnits = 0 + OR sub.lodt < util.VN_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 isFloramondo + AND i.id <> i2.id + ORDER BY i.id; - START TRANSACTION; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET vDone = TRUE; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; SET @isModeInventory:= TRUE; - -- Deletes + OPEN curItemClean; + curItemClean: LOOP - UPDATE IGNORE vn.itemCost ic - JOIN tmp.itemsToReplace itr ON ic.itemFk = itr.idOld - SET ic.itemFk = itr.idNew; + FETCH curItemClean INTO vItemOld, vItemNew; - DELETE ic.* - FROM vn.itemCost ic - JOIN tmp.itemsToReplace itr ON ic.itemFk = itr.idOld; + START TRANSACTION; - DELETE rt.* - FROM vn2008.rec_translator rt - JOIN tmp.itemsToReplace itr ON rt.Id_Article = itr.idOld; + # Deletes + UPDATE IGNORE vn.itemCost + SET itemFk = vItemNew + WHERE itemFk = vItemOld; - DELETE w.* - FROM bs.waste w - JOIN tmp.itemsToReplace itr ON w.itemFk = itr.idOld; + DELETE FROM vn.itemCost + WHERE itemFk = vItemOld; - DELETE pf.* - FROM vn.priceFixed pf - JOIN tmp.itemsToReplace itr ON pf.itemFk = itr.idOld; + DELETE FROM vn2008.rec_translator + WHERE Id_Article = vItemOld; - DELETE imp.* - FROM vn.itemMatchProperties imp - JOIN tmp.itemsToReplace itr ON imp.itemFk = itr.idOld; + DELETE FROM bs.waste + WHERE itemFk = vItemOld; - DELETE ib.* - FROM vn.itemBotanical ib - JOIN tmp.itemsToReplace itr ON ib.itemFk = itr.idOld; + DELETE FROM vn.priceFixed + WHERE itemFk = vItemOld; - DELETE ip.* - FROM vn.itemProposal ip - JOIN tmp.itemsToReplace itr ON ip.itemFk = itr.idOld; + DELETE FROM vn.itemMatchProperties + WHERE itemFk = vItemOld; - DELETE it.* - FROM vn.itemTag it - JOIN tmp.itemsToReplace itr ON it.itemFk = itr.idOld; + DELETE FROM vn.itemBotanical + WHERE itemFk = vItemOld; - DELETE ib.* - FROM vn.itemBarcode ib - JOIN tmp.itemsToReplace itr ON ib.itemFk = itr.idOld; + DELETE FROM vn.itemProposal + WHERE itemFk = vItemOld; - DELETE itc.* - FROM vn.itemTaxCountry itc - JOIN tmp.itemsToReplace itr ON itc.itemFk = itr.idOld; + SET @isTriggerDisabled := TRUE; + DELETE FROM vn.itemTag + WHERE itemFk = vItemOld; + SET @isTriggerDisabled := FALSE; - DELETE ip.* - FROM vn.itemPlacement ip - JOIN tmp.itemsToReplace itr ON ip.itemFk = itr.idOld; + DELETE FROM vn.itemBarcode + WHERE itemFk = vItemOld; - -- Updates + DELETE FROM vn.itemTaxCountry + WHERE itemFk = vItemOld; - UPDATE vn.buy b - JOIN tmp.itemsToReplace itr ON b.itemFk = itr.idOld - SET b.itemFk = itr.idNew; + # Updates + UPDATE vn.buy + SET itemFk = vItemNew + WHERE itemFk = vItemOld; - UPDATE vn.sale s - JOIN tmp.itemsToReplace itr ON s.itemFk = itr.idOld - SET s.itemFk = itr.idNew; + UPDATE vn.sale + SET itemFk = vItemNew + WHERE itemFk = vItemOld; - UPDATE vn.specialPrice sp - JOIN tmp.itemsToReplace itr ON sp.itemFk = itr.idOld - SET sp.itemFk = itr.idNew; + UPDATE vn.specialPrice + SET itemFk = vItemNew + WHERE itemFk = vItemOld; - UPDATE vn.packaging p - JOIN tmp.itemsToReplace itr ON p.itemFk = itr.idOld - SET p.itemFk = itr.idNew; + UPDATE vn.packaging + SET itemFk = vItemNew + WHERE itemFk = vItemOld; - UPDATE vn.packaging p - JOIN tmp.itemsToReplace itr ON p.freightItemFk = itr.idOld - SET p.freightItemFk = itr.idNew; + UPDATE vn.packaging + SET freightItemFk = vItemNew + WHERE freightItemFk = vItemOld; - UPDATE hedera.orderRow o - JOIN tmp.itemsToReplace itr ON o.itemFk = itr.idOld - SET o.itemFk = itr.idNew; + UPDATE hedera.orderRow + SET itemFk = vItemNew + WHERE itemFk = vItemOld; - UPDATE vn.itemLog il - JOIN tmp.itemsToReplace itr ON il.originFk = itr.idOld - SET il.originFk = itr.idNew; + UPDATE vn.itemLog + SET originFk = vItemNew + WHERE originFk = vItemOld; - UPDATE vn.itemShelving ish - JOIN tmp.itemsToReplace itr ON ish.itemFk = itr.idOld - SET ish.itemFk = itr.idNew; + UPDATE vn.itemShelving + SET itemFk = vItemNew + WHERE itemFk = vItemOld; - UPDATE vn.ticketPackagingStartingStock tpss - JOIN tmp.itemsToReplace itr ON tpss.itemFk = itr.idOld - SET tpss.itemFk = itr.idNew; + UPDATE vn.ticketPackagingStartingStock + SET itemFk = vItemNew + WHERE itemFk = vItemOld; - UPDATE vn.inventoryFailure ifa - JOIN tmp.itemsToReplace itr ON ifa.itemFk = itr.idOld - SET ifa.itemFk = itr.idNew; + UPDATE vn.inventoryFailure + SET itemFk = vItemNew + WHERE itemFk = vItemOld; - UPDATE vn.genericAllocation ga - JOIN tmp.itemsToReplace itr ON ga.itemFk = itr.idOld - SET ga.itemFk = itr.idNew; + UPDATE vn.genericAllocation + SET itemFk = vItemNew + WHERE itemFk = vItemOld; - UPDATE vn.itemPlacementSupply ips - JOIN tmp.itemsToReplace itr ON ips.itemFk = itr.idOld - SET ips.itemFk = itr.idNew; + UPDATE vn.itemPlacementSupply + SET itemFk = vItemNew + WHERE itemFk = vItemOld; - -- Eliminamos los items repetidos + # Eliminamos el item sustituido + DELETE FROM vn.item + WHERE id = vItemOld; - DELETE i.* - FROM vn.item i - JOIN tmp.itemsToReplace itr ON i.id = itr.idOld; + COMMIT; + + IF vDone THEN + LEAVE curItemClean; + END IF; + + SET vCounter = vCounter + 1; + + END LOOP; + CLOSE curItemClean; + + INSERT INTO itemCleanLog (itemDeleted) + VALUES (vCounter); 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 DROP PROCEDURE IF EXISTS `item_deactivateUnused` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!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 `item_cleanLauncher`() +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_deactivateUnused`() BEGIN - - DECLARE vItemTo INT DEFAULT 0; - DECLARE vStep INT DEFAULT 500; - DECLARE vCounter INT DEFAULT 0; - DECLARE vItemFrom INT; - DECLARE vItemEnd INT; +/** + * Cambia a false el campo isActive de la tabla vn.item para todos aquellos + * items que no se han comprado en los últimos meses configurados en + * @vn.itemConfig.monthToDeactivate + */ + DECLARE vMonthToDeactivate INT; - SELECT itemFrom INTO vItemFrom - FROM tmp.itemCleanCount - ORDER BY created DESC - LIMIT 1; + SELECT monthToDeactivate INTO vMonthToDeactivate + FROM vn.itemConfig; - SET vItemEnd = vItemFrom + 100000; + DROP TEMPORARY TABLE IF EXISTS tmp.buyMaxCreated; + CREATE TEMPORARY TABLE tmp.buyMaxCreated + ENGINE = MEMORY + SELECT b.itemFk, + MAX(b.created) created + FROM vn.buy b + JOIN vn.item i ON i.id = b.itemFk + WHERE i.isActive + GROUP BY itemFk; - 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 < util.VN_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; + UPDATE vn.item i + JOIN tmp.buyMaxCreated bmc ON bmc.itemFk = i.id + SET i.isActive = FALSE + WHERE bmc.created < util.VN_CURDATE() - INTERVAL vMonthToDeactivate MONTH; - DROP TEMPORARY TABLE IF EXISTS tmp.itemsToReplace; - DROP TEMPORARY TABLE IF EXISTS tmp.itemsToReplaceSource; + DROP TEMPORARY TABLE IF EXISTS tmp.buyMaxCreated; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_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_getAtp` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_getAtp`(vDated DATE) +BEGIN +/** + * Calcula el valor mínimo acumulado para cada artículo ordenado por fecha y + * almacén. + * + * @param vDated Si no hay movimientos en la fecha indicada, debe devolver 0 + * @table tmp.itemCalc(itemFk, wareHouseFk, dated, quantity) + * @return tmp.itemAtp(itemFk, warehouseFk, quantity) + */ + DROP TEMPORARY TABLE IF EXISTS tItemOrdered; + CREATE TEMPORARY TABLE tItemOrdered + (UNIQUE(itemFk, warehouseFk, dated)) + ENGINE = MEMORY + SELECT itemFk, warehouseFk, dated, SUM(quantity) quantity + FROM ( + SELECT itemFk, warehouseFk, dated, quantity + FROM tmp.itemCalc + UNION ALL + SELECT itemFk, warehouseFk, vDated, 0 + FROM (SELECT DISTINCT itemFk, warehouseFk FROM tmp.itemCalc) t2 + ) t1 + GROUP BY itemFk, warehouseFk, dated + ORDER BY itemFk, warehouseFk, dated; + SET @lastItemFk := 0; + SET @lastWareHouseFk := 0; + SET @lastQuantity := 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.itemAtp; + CREATE TEMPORARY TABLE tmp.itemAtp + SELECT itemFk, wareHouseFk, MIN(quantityAccumulated) quantity + FROM ( + SELECT + itemFk, + IF(itemFk <> @lastItemFk OR wareHouseFk <> @lastWareHouseFk, + @lastQuantity := quantity, + @lastQuantity := @lastQuantity + quantity) quantityAccumulated, + wareHouseFk, + @lastItemFk := itemFk, + @lastWareHouseFk := wareHouseFk + FROM tItemOrdered + )sub + GROUP BY itemFk, wareHouseFk; + + DROP TEMPORARY TABLE tItemOrdered; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -68092,7 +59882,7 @@ BEGIN `in` AS invalue, `out`, @a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance, - @currentLineFk := IF (@shipped < util.VN_CURDATE() + @currentLineFk := IF (@shipped < util.VN_CURDATE() OR (@shipped = util.VN_CURDATE() AND (isPicked OR alertLevel >= 2)), lineFk,@currentLineFk) lastPreparedLineFk, isTicket, @@ -68107,7 +59897,7 @@ BEGIN al.id AS alertLevel, st.name AS stateName, s.name AS name, - e.ref AS reference, + e.invoiceNumber AS reference, e.id AS origin, s.id AS clientFk, IF(al.id = 3, TRUE, FALSE) isPicked, @@ -68120,7 +59910,7 @@ BEGIN 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 = + JOIN alertLevel al ON al.id = CASE WHEN tr.landed < util.VN_CURDATE() THEN 3 WHEN tr.landed = util.VN_CURDATE() AND tr.isReceived = TRUE THEN 3 @@ -68128,9 +59918,9 @@ BEGIN END JOIN state st ON st.code = al.code WHERE tr.landed >= vDateInventory - AND vWarehouse = tr.warehouseInFk + AND vWarehouse = tr.warehouseInFk AND b.itemFk = vItemId - AND e.isInventory = FALSE + AND e.isExcludedFromAvailable = FALSE AND e.isRaid = FALSE UNION ALL @@ -68140,7 +59930,7 @@ BEGIN al.id, st.name, s.name, - e.ref, + e.invoiceNumber, e.id, s.id, IF(al.id = 3, TRUE, FALSE), @@ -68154,7 +59944,7 @@ BEGIN 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 = + JOIN alertLevel al ON al.id = CASE WHEN tr.shipped < util.VN_CURDATE() THEN 3 WHEN tr.shipped = util.VN_CURDATE() AND tr.isReceived = TRUE THEN 3 @@ -68165,7 +59955,7 @@ BEGIN AND vWarehouse =tr.warehouseOutFk AND s.id <> 4 AND b.itemFk = vItemId - AND e.isInventory = FALSE + AND e.isExcludedFromAvailable = FALSE AND w.isFeedStock = FALSE AND e.isRaid = FALSE UNION ALL @@ -68191,7 +59981,7 @@ BEGIN 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 = + JOIN alertLevel al ON al.id = CASE WHEN t.shipped < util.VN_CURDATE() THEN 3 WHEN t.shipped > util.dayEnd(util.VN_CURDATE()) THEN 0 @@ -68199,7 +59989,7 @@ BEGIN 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 + LEFT JOIN claimBeginning cb ON s.id = cb.saleFk WHERE t.shipped >= vDateInventory AND s.itemFk = vItemId AND vWarehouse =t.warehouseFk @@ -68224,70 +60014,73 @@ DELIMITER ; 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 - */ - +/** + * 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, util.VN_CURDATE()); + DECLARE vCacheAvailableFk INT; + DECLARE vVisibleItemShelving INT; + DECLARE vItemFk INT; - SELECT SUM(visible) INTO vVisibleItemShelving - FROM vn.itemShelvingStock - WHERE itemFk = vItemFk AND warehouseFk = vWarehouseFk; - - CALL vn.buyUltimate(vWarehouseFk, util.VN_CURDATE()); + CALL cache.visible_refresh(vCacheVisibleFk, FALSE, vWarehouseFk); + CALL cache.available_refresh(vCacheAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE()); + CALL buyUltimate(vWarehouseFk, util.VN_CURDATE()); - SELECT i.id, + SELECT barcodeToItem(vBarcode) INTO vItemFk; + SELECT SUM(visible) INTO vVisibleItemShelving + FROM itemShelvingStock + WHERE itemFk = vItemFk + AND warehouseFk = vWarehouseFk; + + SELECT i.id, i.longName, - i.tag5, + 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 + i.tag6, + i.value6, + i.tag7, + i.value7, + i.image, + i.`size`, + i.stems, + i.category, + i.minimum `min`, + p.name producer, + o.code origin, + v.visible - IFNULL(vVisibleItemShelving, 0) unlocated, + a.available, + vVisibleItemShelving, + v.visible, + b.`grouping`, + b.packing, + CONCAT('http:', ic.url, '/catalog/200x200/', i.image) urlImage200, + CONCAT('http:', ic.url, '/catalog/1600x900/', i.image) urlImage, + i.itemPackingTypeFk, + i.comment reference, + u.name buyer, + IFNULL(b.buyingValue, 0) + + IFNULL(b.freightValue, 0) + + IFNULL(b.comissionValue, 0) + + IFNULL(b.packageValue, 0) itemCost + FROM item i + LEFT JOIN producer p ON p.id = i.producerFk + LEFT JOIN 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 tmp.buyUltimate bu ON bu.itemFk = i.id + LEFT JOIN buy b ON b.id = bu.buyFk + AND bu.warehouseFk = vWarehouseFk + JOIN itemType it ON it.id = i.typeFk + JOIN account.user u ON u.id = it.workerFk + JOIN hedera.imageConfig ic WHERE i.id = vItemFk; - - DROP TEMPORARY TABLE tmp.buyUltimate; + DROP TEMPORARY TABLE tmp.buyUltimate; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -68308,7 +60101,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getLack`(IN vForce BOOLEAN, IN 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 **/ @@ -68317,35 +60110,34 @@ BEGIN CALL item_getMinacum(NULL, util.VN_CURDATE(), vDays, NULL); CALL item_getMinETD(); - SELECT i.id itemFk, + SELECT i.id itemFk, i.longName, w.id warehouseFk, - p.`name` producer, + p.`name` producer, i.`size`, i.category, - w.name warehouse, + w.name warehouse, SUM(IFNULL(sub.amount,0)) lack, i.inkFk, - IFNULL(im.timed, util.midnight()) timed - FROM (SELECT item_id, - warehouse_id, + IFNULL(im.timed, util.midnight()) timed + FROM (SELECT item_id, + warehouse_id, amount FROM cache.stock WHERE amount > 0 UNION ALL - SELECT itemFk, - warehouseFk, + 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 + 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 @@ -68372,7 +60164,8 @@ 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 + * Cálculo del mínimo acumulado, para un item/almacén especificado, en caso de + * NULL para todo. * * @param vWarehouseFk -> warehouseFk * @param vDatedFrom -> fecha inicio @@ -68380,67 +60173,70 @@ BEGIN * @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; + DROP TEMPORARY TABLE IF EXISTS tmp.itemCalc; + CREATE TEMPORARY TABLE tmp.itemCalc + (INDEX (itemFk, warehouseFk)) + SELECT sub.itemFk, + sub.dated, + CAST(SUM(sub.quantity) AS SIGNED) quantity, + sub.warehouseFk + FROM (SELECT s.itemFk, + DATE(t.shipped) dated, + -s.quantity quantity, + 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.isExcludedFromAvailable + 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.isExcludedFromAvailable + AND b.quantity != 0 + AND (vItemFk IS NULL OR b.itemFk = vItemFk) + AND !e.isRaid + ) sub + GROUP BY sub.itemFk, sub.warehouseFk, sub.dated; + CALL item_getAtp(vDatedFrom); + DROP TEMPORARY TABLE tmp.itemCalc; + + 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 + SELECT i.itemFk, + i.warehouseFk, + i.quantity amount + FROM tmp.itemAtp i HAVING amount != 0; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -68459,12 +60255,12 @@ DELIMITER ; 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; @@ -68475,7 +60271,7 @@ BEGIN 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 + LEFT JOIN `zone` z ON z.id = t.zoneFk WHERE t.shipped BETWEEN util.VN_CURDATE() AND vMidnight GROUP BY s.itemFk; END ;; @@ -68505,33 +60301,33 @@ BEGIN * @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, @@ -68564,7 +60360,7 @@ BEGIN ORDER BY counter DESC, (t1.name = vTag1) DESC, (it1.value = vValue1) DESC, - (i.tag6 = vTag6) DESC, + (i.tag6 = vTag6) DESC, (i.value6 = vValue6) DESC, (i.tag5 = vTag5) DESC, (i.value5 = vValue5) DESC, @@ -68573,7 +60369,7 @@ BEGIN (i.tag8 = vTag8) DESC, (i.value8 = vValue8) DESC LIMIT 30; - + END ;; DELIMITER ; @@ -68594,18 +60390,18 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_GetVisible`(vWarehouse SMALLINT, vItem INT) BEGIN DECLARE vTomorrow DATETIME DEFAULT TIMESTAMPADD(DAY, 1, util.VN_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 + SELECT i.itemFk AS item_id, quantity AS amount FROM itemTicketOut i - LEFT JOIN ticketState ts ON ts.ticketFk = i.ticketFk + 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 + LEFT JOIN (SELECT DISTINCT saleFk + FROM saleTracking st JOIN state s ON s.id = st.stateFk - WHERE st.created > util.VN_CURDATE() + WHERE st.created > util.VN_CURDATE() AND (s.isPicked OR st.isChecked) ) stPrevious ON `stPrevious`.`saleFk` = i.saleFk WHERE i.warehouseFk = vWarehouse @@ -68613,16 +60409,15 @@ BEGIN AND (s.isPicked OR i.reserved OR stPrevious.saleFk ) AND i.shipped >= util.VN_CURDATE() AND i.shipped < vTomorrow UNION ALL - SELECT iei.itemFk, quantity + 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 > util.VN_CURDATE()*/ ) + WHERE (iei.isReceived != FALSE /*OR ip.modificationDate > util.VN_CURDATE()*/) AND iei.landed >= util.VN_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 + SELECT itemFk, quantity FROM itemEntryOut WHERE isDelivered != FALSE AND shipped >= util.VN_CURDATE() AND shipped < vTomorrow @@ -68638,84 +60433,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `item_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 */ ; @@ -68733,7 +60450,7 @@ BEGIN * * @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; @@ -68743,13 +60460,13 @@ BEGIN 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 @@ -68761,57 +60478,57 @@ BEGIN 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 tagAbbreviation ta2 ON ta2.`value` = it2.`value` AND ta2.tagFk IS NULL 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`))) + SET i.`name` = CONCAT_WS(' ', + IFNULL(ta1.abbreviation,it1.`value`), + IFNULL(ta2.abbreviation,it2.`value`), + IF(i.isFloramondo,'',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 + 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 + -- 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 @@ -68826,7 +60543,7 @@ BEGIN 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' @@ -68841,28 +60558,28 @@ BEGIN 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 */ ; @@ -68886,7 +60603,7 @@ BEGIN * * @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; @@ -68896,13 +60613,13 @@ BEGIN 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 @@ -68917,54 +60634,54 @@ BEGIN 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`))) + SET i.`name` = CONCAT_WS(' ', + IFNULL(ta1.abbreviation,it1.`value`), + IFNULL(ta2.abbreviation,it2.`value`), + IF(i.isFloramondo,'',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 + 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 + -- 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 @@ -68979,7 +60696,7 @@ BEGIN 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' @@ -68994,147 +60711,18 @@ BEGIN 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 */ ; @@ -69160,11 +60748,11 @@ BEGIN * @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 ;; @@ -69173,70 +60761,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `item_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 */ ; @@ -69251,23 +60775,23 @@ 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, + 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) @@ -69275,19 +60799,19 @@ BEGIN +!ISNULL(ga.category) +!ISNULL(ga.productor) maxMatches FROM vn.item i - JOIN vn.itemTag it ON it.itemFk = i.id + 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 + AND NOT i.isFloramondo) sub GROUP BY gaid HAVING `match`) sub2; - UPDATE vn.item - SET genericFk = vGenericFk + UPDATE vn.item + SET genericFk = vGenericFk WHERE id = vSelf; END ;; DELIMITER ; @@ -69299,26 +60823,26 @@ 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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_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 + + UPDATE vn.item i SET i.packingShelve = vPacking WHERE i.id = vSelf; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -69368,9 +60892,9 @@ BEGIN 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 @@ -69380,7 +60904,7 @@ BEGIN LIMIT 1; SET vHasNotInventory = IF (vInventoried is null, TRUE, FALSE); - + IF vHasNotInventory THEN SELECT landed INTO vInventoried2 @@ -69401,13 +60925,13 @@ BEGIN CREATE TEMPORARY TABLE inv (warehouseFk SMALLINT, Id_Article BIGINT, - cantidad INT, + 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) @@ -69484,7 +61008,7 @@ BEGIN AND it.isInventory ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,0,1); - END IF; + END IF; -- Mercancia en transito INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) @@ -69502,7 +61026,7 @@ BEGIN AND t.isInventory AND e.isConfirmed ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity); - + CALL vn.buyUltimate(NULL,vDateDayEnd); UPDATE inv i @@ -69517,215 +61041,20 @@ BEGIN IF vIsDetailed THEN SELECT inv.warehouseFk, - i.id itemFk, - i.longName , - i.size, - inv.Cantidad, + i.id itemFk, + i.longName , + i.size, + inv.Cantidad, tp.name Tipo, - ic.name Reino, - inv.coste, + 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 = util.VN_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 = util.VN_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 + JOIN itemCategory ic ON ic.id = tp.categoryFk WHERE w.valuatedInventory and inv.total > 0 order by inv.total desc; @@ -69772,37 +61101,37 @@ BEGIN * @param vConcept descripcion * @param vAmount cantidad que se compensa * @param vCompany empresa - * @param vOriginalAccount cuenta contable desde la cual se compensa - * - */ + * @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 + 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, + 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, + (vIsOriginalAClient AND vAmount > 0) OR + (NOT vIsOriginalAClient AND vAmount < 0), + 0, ABS(vAmount) ), @vAmount2:= IF(@vAmount1, @@ -69811,20 +61140,20 @@ BEGIN ), vCompanyFk ), - ( vNewBookEntry, - vDated, - vCompensationAccount, - vOriginalAccount, - vConcept, + ( 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) + INSERT INTO receipt(invoiceFk, amountPaid, payed, bankFk, companyFk, clientFk, isConciliate) VALUES (vConcept, vAmount, vDated, vBankFk, vCompanyFk, vClientFk, TRUE); ELSE IF NOT vIsOriginalAClient THEN @@ -69832,7 +61161,7 @@ BEGIN 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; @@ -69854,10 +61183,10 @@ DELIMITER ; 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 */ ; @@ -69884,8 +61213,8 @@ BEGIN * @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); + + CALL logAddWithUser(vOriginFk, account.myUser_getId(), vActionCode, vEntity, vDescription); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -69952,15 +61281,15 @@ BEGIN * @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 ;; @@ -69985,9 +61314,9 @@ BEGIN SET @buildingOrder := 0; SET @route := 0; set @cajas := 0; - + UPDATE tmp.sorter - SET buildingOrder = @buildingOrder := IF(@route = @route := routeFk, @buildingOrder, 0) + 1 + SET buildingOrder = @buildingOrder := IF(@route = @route := routeFk, @buildingOrder, 0) + 1 where date(created) = vDate order by routeFk, created, weight DESC; @@ -70005,23 +61334,23 @@ set @cajas := 0; 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 + from tmp.sorter where date(created) = vDate group by hora ) sub; - + SELECT * FROM tmp.lungSize WHERE dia = vDate; - - + + END ;; @@ -70042,23 +61371,23 @@ DELIMITER ; 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 + * @param vWorkerFk id del worker + * +*/ + UPDATE vn.machineWorker mw + JOIN vn.machine m ON m.id = mw.machineFk SET mw.outTimed = util.VN_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; + WHERE m.plate= vPlate; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -70078,21 +61407,21 @@ 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, + * 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 - * + * @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 + 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; + ORDER BY mw.inTimed DESC; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -70111,13 +61440,13 @@ DELIMITER ; 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, - * + * 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 - * + * @param vWorkerFk id del trabajador + * */ DECLARE vMachineFk INT(10); @@ -70126,24 +61455,24 @@ BEGIN SELECT m.id INTO vMachineFk FROM machine m WHERE m.plate = vPlate; - + SELECT maxHours INTO vMaxHours FROM machineWorkerConfig; - IF (SELECT COUNT(*) + IF (SELECT COUNT(*) FROM machineWorker m WHERE m.workerFk = vWorkerFk - AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, util.VN_NOW()) AND ISNULL(m.outTimed)) THEN - + AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, util.VN_NOW()) AND ISNULL(m.outTimed)) THEN + UPDATE machineWorker m SET m.outTimed = CURRENT_TIMESTAMP() - WHERE m.workerFk = vWorkerFk - AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, util.VN_NOW()) + WHERE m.workerFk = vWorkerFk + AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, util.VN_NOW()) AND ISNULL(m.outTimed) AND m.machineFk = vMachineFk; - + END IF; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -70163,18 +61492,18 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `machine_getWorkerPlate`(vWorkerFk INT) BEGIN /** - * Selecciona la matrícula del vehículo del workerfk - * + * 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,util.VN_NOW()) - AND ISNULL(mw.outTimed) + FROM machine m + JOIN machineWorker mw ON mw.machineFk = m.id + WHERE mw.inTimed >= TIMESTAMPADD(HOUR , -12,util.VN_NOW()) + AND ISNULL(mw.outTimed) AND mw.workerFk = vWorkerFk; END ;; @@ -70189,9 +61518,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 `mail_insert`( vReceiver VARCHAR(255), @@ -70202,12 +61531,12 @@ BEGIN /** * Inserta en la tabla vn.mail * - * @param vReceiver Receptor del correo + * @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 @@ -70224,7 +61553,7 @@ BEGIN `receiver` = vReceiver, `replyTo` = vReplyTo, `subject` = vSubject, - `body` = vBody; + `body` = IFNULL(vBody,vSubject); END IF; @@ -70248,12 +61577,12 @@ 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; @@ -70281,34 +61610,34 @@ BEGIN 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 */ ; @@ -70319,11 +61648,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 `manaSpellersRequery`(vWorkerFk INTEGER) BEGIN @@ -70331,41 +61660,41 @@ 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,util.VN_CURDATE()); + DECLARE vToDated DATE DEFAULT TIMESTAMPADD(DAY,1,util.VN_CURDATE()); DECLARE vMana INT; - DECLARE vAutoMana INT; - DECLARE vClaimMana INT; - DECLARE vManaBank INT; - DECLARE vManaGreugeType INT; - - SELECT COUNT(*) INTO vWorkerIsExcluded + 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 + SELECT id INTO vMana FROM `component` WHERE code = 'mana'; - - SELECT id INTO vAutoMana + + SELECT id INTO vAutoMana FROM `component` WHERE code = 'autoMana'; - - SELECT id INTO vClaimMana + + SELECT id INTO vClaimMana FROM `component` WHERE code = 'manaClaim'; - - SELECT id INTO vManaBank + + SELECT id INTO vManaBank FROM `bank` WHERE code = 'mana'; - - SELECT id INTO vManaGreugeType + + SELECT id INTO vManaGreugeType FROM `greugeType` WHERE code = 'mana'; - SELECT max(dated) INTO vFromDated + SELECT max(dated) INTO vFromDated FROM clientManaCache; - - REPLACE workerMana (workerFk, amount) - SELECT vWorkerFk, sum(mana) FROM + + REPLACE workerMana (workerFk, amount) + SELECT vWorkerFk, sum(mana) FROM ( SELECT s.quantity * sc.value as mana FROM ticket t @@ -70386,8 +61715,8 @@ BEGIN 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 < util.VN_CURDATE() - UNION ALL + AND g.shipped > vFromDated and g.shipped < util.VN_CURDATE() + UNION ALL SELECT cc.mana FROM clientManaCache cc JOIN client c ON c.id = cc.clientFk @@ -70400,153 +61729,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 `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 */ ; @@ -70561,20 +61743,20 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqlConnectionsSorter_kill`() BEGIN /** - * Elimina conexiones del usuario sorter con tiempo >= 30seg. Asociado al evento con el mismo nombre - */ - + * 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 + SELECT p.id FROM information_schema.processlist p - WHERE USER = 'sorter' + WHERE USER = 'sorter' AND TIME >= 30; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + OPEN vCursor; l: LOOP @@ -70611,7 +61793,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqlPreparedCount_check`() BEGIN DECLARE vPreparedCount INTEGER; - SELECT VARIABLE_VALUE INTO vPreparedCount + SELECT VARIABLE_VALUE INTO vPreparedCount FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE '%prepared_stmt_count%'; @@ -70619,7 +61801,7 @@ BEGIN 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: ', + 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.') ); @@ -70631,188 +61813,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 `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 */ ; @@ -70828,37 +61828,37 @@ 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 ;; @@ -70887,18 +61887,18 @@ BEGIN * @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, '")' + ' VALUES (', vOriginFk, ', ', account.myUser_getId(), ', "', vDescription, '")' ); - + PREPARE stmt FROM @qryLog; EXECUTE stmt; DEALLOCATE PREPARE stmt; @@ -70928,15 +61928,15 @@ BEGIN DECLARE vDeliveryMethod INT; DECLARE vClient INT; - + SELECT deliveryMethodFk INTO vDeliveryMethod - FROM vn.agencyMode + 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); @@ -70962,7 +61962,7 @@ 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 */ ; @@ -70989,7 +61989,7 @@ BEGIN DECLARE vOrderId INT; CALL vn.orderCreate(vLanded,vAgencyMode,vAddress,vSourceApp,vOrderId); SELECT vOrderId; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -71009,7 +62009,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `orderListVolume`(IN vOrderId INT) BEGIN - SELECT + SELECT o.id, o.itemFk, i.description, @@ -71035,7 +62035,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `packageInvoicing`( +CREATE DEFINER=`root`@`localhost` PROCEDURE `packageInvoicing`( IN vClient INT, IN vDate DATE, IN vCompany INT, @@ -71054,20 +62054,20 @@ BEGIN SET vGraceDays = IF(vIsAllInvoiceable ,0, 30); SET vGraceDate = TIMESTAMPADD(DAY, - vGraceDays, vDate); - - /* Clientes especiales: + + /* 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; @@ -71091,22 +62091,22 @@ BEGIN FROM tmp.packageToInvoice GROUP BY itemFk HAVING totalQuantity > 0; - + SELECT COUNT(*) INTO vIsInvoiceable FROM tmp.packageToInvoicePositives; IF vIsInvoiceable THEN - CALL ticket_add(vClient, + CALL ticket_add(vClient, vDateEnd, - vWarehouse, - vCompany, - NULL, - NULL, - NULL, - vDateEnd, - account.userGetId(), + vWarehouse, + vCompany, + NULL, + NULL, + NULL, + vDateEnd, + account.myUser_getId(), TRUE, vNewTicket); @@ -71115,44 +62115,44 @@ BEGIN packagingFk, quantity, pvp) - SELECT vNewTicket, - pti.packagingFk, - - SUM(pti.quantity) AS totalQuantity, + 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 + 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, + itemFk, + concept, + quantity, price ) - SELECT vNewTicket, - pti.itemFk, - i.name as concept, - sum(pti.quantity) as totalQuantity, + 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 + 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 */ ; @@ -71178,7 +62178,7 @@ BEGIN 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 */ ; @@ -71200,18 +62200,64 @@ BEGIN DECLARE valueFk INT; DECLARE encajando INT DEFAULT 9; - - SELECT valor INTO valueFk - FROM vn2008.Movimientos_mark - WHERE Id_Movimiento = saleFk + + 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) + + 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 `packingSite_startCollection` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `packingSite_startCollection`(vSelf INT, vTicketFk INT) +BEGIN +/** + * @param vSelf packingSite id + * @param vTicketFk A ticket id from the collection to start + */ + DECLARE vNewCollectionFk INT; + DECLARE vOldCollectionFk INT; + DECLARE vIsPackingByOther BOOL; + + SELECT collectionFk INTO vNewCollectionFk + FROM ticketCollection WHERE ticketFk = vTicketFk; + + SELECT collectionFk INTO vOldCollectionFk + FROM packingSite WHERE id = vSelf; + + IF NOT (vOldCollectionFk <=> vNewCollectionFk) THEN + SELECT COUNT(*) > 0 + INTO vIsPackingByOther + FROM packingSite + WHERE id <> vSelf + AND collectionFk = vOldCollectionFk; + + IF NOT vIsPackingByOther AND NOT collection_isPacked(vOldCollectionFk) AND vSelf IS NOT NULL THEN + CALL util.throw('cannotChangeCollection'); + END IF; + END IF; + + UPDATE packingSite SET collectionFk = vNewCollectionFk + WHERE id = vSelf; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -71236,88 +62282,34 @@ BEGIN 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 ;; @@ -71342,59 +62334,59 @@ 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 */ ; @@ -71418,73 +62410,28 @@ BEGIN 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 */ ; @@ -71503,11 +62450,11 @@ DELIMITER ; 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, @@ -71516,281 +62463,15 @@ BEGIN 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 + 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.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 + 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(util.VN_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,util.VN_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 */ ; @@ -71809,17 +62490,17 @@ DELIMITER ; 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; + FROM tmp.ticket; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -71838,8 +62519,8 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `prepareTicketList`(vStartingDate DATETIME, vEndingDate DATETIME) BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.productionTicket; + + DROP TEMPORARY TABLE IF EXISTS tmp.productionTicket; CREATE TEMPORARY TABLE tmp.productionTicket (PRIMARY KEY (ticketFk)) ENGINE = MEMORY @@ -71862,46 +62543,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 `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 */ ; @@ -71916,11 +62557,12 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `previousSticker_get`(vSaleGroupFk I 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 - * + * 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; @@ -71931,46 +62573,48 @@ BEGIN JOIN vn.sale s ON s.id = sgd.saleFk WHERE sgd.saleGroupFk = vSaleGroupFk LIMIT 1; - - SELECT sg.parkingFk, sc.sectorFk + + 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 + JOIN vn.sale s ON s.id = sgd.saleFk WHERE s.ticketFk = vTicketFk - AND sg.parkingFk IS NOT NULL + 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; + + 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, + sc.description sector + 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.sector sc ON sc.id = sg.sectorFk + 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 DROP PROCEDURE IF EXISTS `printer_checkSector` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -71980,274 +62624,25 @@ DELIMITER ; /*!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) +CREATE DEFINER=`root`@`localhost` PROCEDURE `printer_checkSector`(vLabelerFk tinyint(3) unsigned, vSector INT(11)) BEGIN /** - * Inserta en la cola de impresion una nueva etiqueta de carro, para el sacador + * Comprueba si la impresora pertenece al sector * - * @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); + * @param vLabelerFk id de la impresora + * @param vSector sector a comprobar + */ + DECLARE isPrinterInNewSector BOOL; - SELECT getTicketTrolleyLabelCount(vTicket) INTO vLabelCount; - SELECT account.myUser_getId() INTO vWorker; - SELECT CONCAT(getShipmentHour(vTicket),':00') INTO vShipmentHour; + IF vLabelerFk IS NOT NULL THEN + SELECT COUNT(sectorFK) INTO isPrinterInNewSector + FROM vn.printer p + WHERE id = vLabelerFk AND sectorFk = vSector; - 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(util.VN_CURDATE())); - - DECLARE vIsTodayRelative BOOLEAN; - - SELECT isTodayRelative INTO vIsTodayRelative - FROM vn.worker - WHERE userFk = vn.getUser(); - - CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,util.VN_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,util.VN_CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,util.VN_CURDATE())) - AND wp.warehouse_id = vWarehouseFk; -*/ - DROP TEMPORARY TABLE tmp.productionTicket; - DROP TEMPORARY TABLE tmp.ticket; - DROP TEMPORARY TABLE IF EXISTS tmp.risk; - + IF !isPrinterInNewSector THEN + CALL util.throw("PrinterNotInSameSector"); + END IF; + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -72266,83 +62661,81 @@ DELIMITER ; 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(util.VN_CURDATE())); - +/** + * 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; DECLARE vIsTodayRelative BOOLEAN; + SELECT TIMESTAMPADD(DAY, LEAST(vScopeDays, pc.maxProductionScopeDays), util.dayEnd(util.VN_CURDATE())) + INTO vEndingDate + FROM vn.productionConfig pc; + SELECT isTodayRelative INTO vIsTodayRelative - FROM vn.worker + FROM vn.worker WHERE userFk = vn.getUser(); - CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,util.VN_CURDATE()), vEndingDate); + CALL vn.prepareTicketList(TIMESTAMPADD(DAY, -1, util.VN_CURDATE()), vEndingDate); - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket + CREATE OR REPLACE 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 + CREATE OR REPLACE 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 + + CREATE OR REPLACE 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 + SELECT tt.ticketFk, + tt.clientFk, + t.warehouseFk, + t.nickname, + t.packages, + IF(HOUR(t.shipped), HOUR(t.shipped),COALESCE(HOUR(zc.hour),HOUR(z.hour))) HH, + COALESCE(HOUR(zc.hour),HOUR(z.hour)) Departure, + COALESCE(MINUTE(t.shipped), MINUTE(zc.hour), MINUTE(z.hour)) mm, + t.routeFk, + IF(am.deliveryMethodFk = 2,z.`id`,0) zona, + t.nickname addressNickname, + a.postalCode, + a.city, + p.name province, + CONCAT(z.`name`,' ',IFNULL(RIGHT(t.routeFk,3),'')) agency, + am.id agencyModeFk, + 0 `lines`, + CAST( 0 AS DECIMAL(5,2)) m3, + CAST( 0 AS DECIMAL(5,2)) preparationRate, + "" problem, + IFNULL(tls.state,2) state, + w.code workerCode, + DATE(t.shipped) shipped, + wk.code salesPersonCode, + p.id provinceFk, + tls.productionOrder, + IFNULL(tls.alertLevel,0) alertLevel, + t.isBoxed palletized, + IF(rm.isPickingAllowed ,rm.bufferFk, NULL) ubicacion, + tlu.lastUpdated, + ifnull(st.graphCategory,0) graphCategory, + pk.code parking, + 0 H, + 0 V, + 0 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 @@ -72352,38 +62745,39 @@ proc: BEGIN 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 + 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.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 + 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(util.VN_NOW()) < pb.HH AND tp.isTooLittle,' PEQUEÑO', '') - ) as char(255))); - + 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(util.VN_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 @@ -72391,16 +62785,16 @@ proc: BEGIN 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 + COUNT(*) `lines`, + SUM(sv.volume) m3, + IFNULL(SUM(IF(sv.isPicked,sv.volume,0)) / SUM(sv.volume),0) rate FROM tmp.productionTicket tt - JOIN vn.saleVolume sv on sv.ticketFk = tt.ticketFk + JOIN vn.saleVolume sv ON sv.ticketFk = tt.ticketFk GROUP BY tt.ticketFk ) m on m.ticketFk = pb.ticketFk SET pb.`lines` = m.`lines`, @@ -72412,61 +62806,60 @@ proc: BEGIN -- Lineas por linea de encajado UPDATE tmp.productionBuffer pb - JOIN ( SELECT ticketFk, - sum(sub.H) H, - sum(sub.V) V, - sum(sub.N) N + 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 + 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 t.ticketFk, i.itemPackingTypeFk) sub GROUP BY ticketFk - ) sub2 ON sub2.ticketFk = pb.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 + -- 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), + 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 + + CREATE OR REPLACE 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 + -- 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 + 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) + AND (ISNULL(sc.itemPackingTypeFk) + OR (ISNULL(i.itemPackingTypeFk) AND NOT pb.V) 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 + 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 @@ -72476,329 +62869,16 @@ proc: BEGIN SET twp.salesInParkingCount = sub.salesInParkingCount; -- Marcamos como pendientes aquellos que no coinciden las cantidades - UPDATE tmp.productionBuffer pb + 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,util.VN_CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,util.VN_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(util.VN_CURDATE())); - - DECLARE vIsTodayRelative BOOLEAN; - - SELECT isTodayRelative INTO vIsTodayRelative - FROM vn.worker - WHERE userFk = vn.getUser(); - - CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,util.VN_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(util.VN_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,util.VN_CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,util.VN_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 */ ; @@ -72809,29 +62889,27 @@ 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 `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 - */ - +/** + * 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; + FROM vn.sector + WHERE id = vSectorFk; DROP TEMPORARY TABLE IF EXISTS tmp.whiteTicket; - CREATE TEMPORARY TABLE 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 @@ -72840,9 +62918,9 @@ BEGIN WHERE t.shipped BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(HOUR, 23, util.VN_CURDATE()) GROUP BY s.ticketFk HAVING saleNum = iptNull; - + DROP TEMPORARY TABLE IF EXISTS tmp.sectorTypeTicket; - CREATE TEMPORARY TABLE tmp.sectorTypeTicket + CREATE TEMPORARY TABLE tmp.sectorTypeTicket (ticketFk INT PRIMARY KEY) SELECT s.ticketFk , sum(i.itemPackingTypeFk <=> sc.itemPackingTypeFk) iptSector FROM vn.sale s @@ -72854,77 +62932,74 @@ BEGIN 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; - + 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 + LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = isa.saleFk + 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 sgd.saleFk IS NULL + 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 LIMIT 10000000000000000000 + ) sub; + DROP TEMPORARY TABLE tmp.whiteTicket; + DROP TEMPORARY TABLE tmp.sectorTypeTicket; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -72962,7 +63037,7 @@ BEGIN `yearMonth` INT ) ENGINE = MEMORY; - + WHILE vDated <= vEnded DO INSERT INTO tmp.rangeDate SET `dated` = vDated, @@ -72972,7 +63047,7 @@ BEGIN `day` = DAY(vDated), `week` = WEEK(vDated, 1), `yearMonth` = YEAR(vDated) * 100 + MONTH(vDated); - + SET vDated = DATE_ADD(vDated, INTERVAL 1 DAY); END WHILE; END ;; @@ -72981,87 +63056,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 `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 */ ; @@ -73080,7 +63074,7 @@ BEGIN * @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 @@ -73088,13 +63082,13 @@ BEGIN 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 + SELECT * FROM tRate UNION ALL SELECT rate0, rate1, rate2, rate3 FROM rateConfig ) sub2 @@ -73127,13 +63121,13 @@ BEGIN 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 + SELECT * FROM tRate UNION ALL SELECT rate0, rate1, rate2, rate3 FROM rateConfig ) sub2 @@ -73145,47 +63139,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 `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 */ ; @@ -73208,7 +63161,7 @@ BEGIN 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, @@ -73226,22 +63179,22 @@ BEGIN 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.longName LIKE CONCAT('%',r.longName,'%')),0) + IFNULL((i.typeFk = r.typeFk),0) as matches, i.typeFk, rl.previousSelected - FROM vn.recipe r + 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 + 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 + AND a.available > vBunchesQuantity * r.quantity UNION ALL SELECT 100 itemFk, CONCAT('? ',r.element,' ',IFNULL(r.size,''),' ',IFNULL(r.inkFk,'')) as longName, @@ -73258,15 +63211,15 @@ BEGIN WHERE r.itemFk = vItemFk GROUP BY r.element ) sub - + ORDER BY element, matches DESC, previousSelected DESC; - - SELECT * + + SELECT * FROM tmp.recipeCook WHERE counter < 6 - OR itemFk = 100 + OR itemFk = 100 ; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -73291,71 +63244,71 @@ BEGIN DECLARE vShipped DATE; DECLARE vEntryFk INT; DECLARE vTravelFk INT; - + CALL cache.last_buy_refresh(FALSE); - - SELECT warehouseFk, shipped + + SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped - FROM vn.ticket + 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 + FROM vn.warehouse w + JOIN vn.agencyMode am WHERE w.name = 'Confeccion' AND am.name = 'DIRECTO PROVEEDOR'; - + SET vTravelFk = LAST_INSERT_ID(); - - END IF; - + + 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' + 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 @@ -73374,15 +63327,15 @@ 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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_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; @@ -73397,26 +63350,26 @@ BEGIN DECLARE vSaleNew INT; DECLARE vSaleMain INT; DECLARE vZoneFk INT; - + DECLARE vRsMainTicket CURSOR FOR SELECT id, itemFk, - quantity, concept, price, discount - FROM vn.sale + 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 + SELECT clientFk, warehouseFk, companyFk, addressFk INTO vCustomer, vWarehouse, vCompany, vAddress - FROM ticket + FROM ticket WHERE id = vOriginTicket; - - SELECT id INTO vZoneFk + + SELECT id INTO vZoneFk FROM zone WHERE agencyModeFk = vRefundAgencyMode LIMIT 1; - + INSERT INTO vn2008.Tickets ( Id_Cliente, Fecha, @@ -73443,26 +63396,26 @@ BEGIN SET vNewTicket = LAST_INSERT_ID(); - SET vDone := 0; + 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 + + 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; + CLOSE vRsMainTicket; END ;; DELIMITER ; @@ -73497,12 +63450,12 @@ BEGIN * usar vn.saleTracking_Replace * */ - - REPLACE INTO vn2008.Movimientos_mark(Id_Movimiento, valor, original_quantity, Id_Trabajador, stateFk) + + 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) + /*INSERT INTO vn.ticketLog (originFk, userFk, action , description) VALUES(originFk, userFk, actionString, description);*/ - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -73519,53 +63472,154 @@ DELIMITER ; /*!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 +CREATE DEFINER=`root`@`localhost` PROCEDURE `reportLabelCollection_get`( + vParam INT, + vLabelCount INT +) +BEGIN /** - * Obtiene los datos de etiquetas a partir de de un ticket o colección. + * Obtains tag data from a ticket or collection. * - * @param vParam Ticket/Colección del que sacar los datos + * @param vParam Ticket/Collection from which data is to be taken. + * @param vLabelCount number of times the collection has been printed. */ - DECLARE vIsTicket BOOL; + DECLARE vIsCollection BOOL; - SELECT IF(id, TRUE, FALSE) INTO vIsTicket - FROM ticket - WHERE created > (CURRENT_DATE() - INTERVAL 1 MONTH) - AND id = vParam; + SELECT IF(id, TRUE, FALSE) INTO vIsCollection + FROM vn.collection c + WHERE id = vParam; SELECT c.itemPackingTypeFk, CONCAT(tc.collectionFk, ' ', LEFT(cc.code, 4)) color, - CONCAT(tc.collectionFk, ' ', SUBSTRING('ABCDEFGH',tc.wagon, 1), '-', tc.`level`) levelV, + 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, + LEFT(COALESCE(et.description, zo.name, am.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, + 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, + IF(vLabelCount IS NULL, tt.labelCount, vLabelCount) 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` + LEFT 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 + 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) + LEFT JOIN zone zo ON t.zoneFk = zo.id + LEFT JOIN routesMonitor rm ON rm.routeFk = t.routeFk + LEFT JOIN expeditionTruck et ON et.id = rm.expeditionTruckFk + WHERE IF(vIsCollection, tc.collectionFk = vParam, tc.ticketFk = vParam) GROUP BY t.id - ORDER BY cc.`code`; + 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 `report_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 `report_print`( + vReportName VARCHAR(100), + vPrinterFk INT, + vUserFk INT, + vParams JSON, + vPriorityName VARCHAR(100) + ) +BEGIN +/** + * Inserts in the print queue the report to be printed and the necessary parameters for this + * one taking into account the paper size of both the printer and the report. + * + * @param vReportName the report to be printed. + * @param vPrinterFk the printer selected. + * @param vUserFk user id. + * @param vParams JSON with report parameters. + * @param vPriorityName the printing priority. + */ + DECLARE vI INT DEFAULT 0; + DECLARE vKeys TEXT DEFAULT JSON_KEYS(vParams); + DECLARE vLength INT DEFAULT JSON_LENGTH(vKeys); + DECLARE vKey VARCHAR(255); + DECLARE vVal VARCHAR(255); + DECLARE vPrintQueueFk INT; + DECLARE vReportSize VARCHAR(255); + DECLARE vIsThePrinterReal INT; + DECLARE vPrinteSize VARCHAR(255); + DECLARE vPriorityFk INT; + DECLARE vReportFk INT; + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + SELECT id, paperSizeFk INTO vReportFk, vReportSize + FROM report + WHERE name = vReportName; + + SELECT id, paperSizeFk INTO vIsThePrinterReal, vPrinteSize + FROM printer + WHERE id = vPrinterFk; + + SELECT id INTO vPriorityFk + FROM queuePriority + WHERE code = vPriorityName; + + IF vIsThePrinterReal IS NULL THEN + CALL util.throw('printerNotExists'); + END IF; + + IF vReportFk IS NULL THEN + CALL util.throw('reportNotExists'); + END IF; + + IF vReportSize <> vPrinteSize THEN + CALL util.throw('incorrectSize'); + END IF; + + START TRANSACTION; + INSERT INTO printQueue + SET printerFk = vPrinterFk, + priorityFk = vPriorityFk, + reportFk = vReportFk, + workerFk = vUserFk; + + SET vPrintQueueFk = LAST_INSERT_ID(); + + WHILE vI < vLength DO + SET vKey = JSON_VALUE(vKeys, CONCAT('$[', vI ,']')); + SET vVal = JSON_VALUE(vParams, CONCAT('$.', vKey)); + + INSERT INTO printQueueArgs + SET printQueueFk = vPrintQueueFk, + name = vKey, + value = vVal; + + SET vI = vI + 1; + END WHILE; + COMMIT; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -73584,16 +63638,16 @@ DELIMITER ; 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 + + SELECT c.RazonSocial, c.Id_Cliente, c.Credito, @@ -73605,7 +63659,7 @@ BEGIN 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 ;; @@ -73614,134 +63668,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 `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 util.VN_CURDATE() AND util.dayend(util.VN_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 */ ; @@ -73792,25 +63718,25 @@ BEGIN DECLARE vM3 INT; DECLARE vKg INT; DECLARE vMatricula varchar(50); - + SELECT sum(packages) as bultos INTO vPackages - FROM vn.ticket t + 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 + FROM vn.route r JOIN vn.vehicle v ON r.vehicleFk = v.id WHERE r.id = vRouteFk; - + SELECT vRouteFk as Ruta, - vPackages as Bultos, + vPackages as Bultos, vM3 as m3, vKg as Kg, vMatricula as Matricula; @@ -73840,12 +63766,12 @@ BEGIN 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 + FROM vn.ticket t WHERE t.shipped BETWEEN vDate AND vDateEND AND t.routeFk IS NOT NULL; @@ -73856,7 +63782,7 @@ BEGIN UPDATE routesMonitor rm JOIN route r ON r.id = rm.routeFk JOIN agencyMode a ON a.id = r.agencyModeFk - SET rm.`name` = a.name, + SET rm.`name` = a.name, rm.ticketFree = 0, rm.ticketProduction = 0, rm.ticketPacked = 0, @@ -73873,7 +63799,7 @@ BEGIN ) sub ON sub.routeFk = rm.routeFk SET rm.ticketFree = sub.ticketFree; - UPDATE routesMonitor rm + UPDATE routesMonitor rm JOIN(SELECT t.routeFk, COUNT(*) AS ticketPacked FROM vn.ticket t JOIN tmp.routesMonitor rm ON rm.routeFk = t.routeFk @@ -73881,7 +63807,7 @@ BEGIN 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 + ) sub ON sub.routeFk = rm.routeFk SET rm.ticketPacked = sub.ticketPacked; UPDATE routesMonitor rm @@ -73908,7 +63834,7 @@ BEGIN 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 + JOIN vn.saleVolume sv ON sv.ticketFk = t.id GROUP BY t.routeFk ) sub ON sub.routeFk = rm.routeFk SET rm.m3 = sub.m3; @@ -73918,15 +63844,15 @@ BEGIN 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 + JOIN vn.packaging pk ON pk.id = e.packagingFk GROUP BY t.routeFk - ) sub ON sub.routeFk = rm.routeFk - SET rm.m3boxes = sub.m3boxes; + ) sub ON sub.routeFk = rm.routeFk + SET rm.m3boxes = sub.m3boxes; UPDATE routesMonitor rm - JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk SET rm.etd = et.ETD; - + DROP TEMPORARY TABLE tmp.routesMonitor; END ;; DELIMITER ; @@ -73947,11 +63873,11 @@ 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 */ ; @@ -73980,6 +63906,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 `route_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` PROCEDURE `route_calcCommission`(vSelf INT) +proc: BEGIN +/** + * Calcula las comisión para una ruta y guarda los valores en la tabla routeCommission + * + * @param vSelf id de ruta + */ + DECLARE vIsUpdatable BOOL; + DECLARE vIsFreelance BOOL; + + SELECT r.created >= rc.cutoffDated INTO vIsUpdatable + FROM route r + JOIN routeConfig rc + WHERE r.id = vSelf; + + IF vIsUpdatable THEN + DELETE FROM routeCommission + WHERE routeFk = vSelf; + + SELECT w.isFreelance INTO vIsFreelance + FROM route r + JOIN worker w ON w.id = r.workerFk + WHERE r.id = vSelf; + + IF vIsFreelance THEN + INSERT INTO routeCommission ( + routeFk, + workCenterFk, + freelanceYearlyM3, + cat4m3, + cat5m3 + ) + SELECT vSelf, + r.commissionWorkCenterFk, + rc.freelanceM3 * IF( + IFNULL(r.m3, 0) >= rc.freelanceMinM3, + IFNULL(r.m3, 0), + 0), + rc.distributionCat4M3 * IFNULL(r.m3, 0), + rc.distributionCat5M3 * IFNULL(r.m3, 0) + FROM route r + JOIN vehicle v ON v.id = r.vehicleFk + JOIN routeConfig rc + WHERE r.id = vSelf + AND r.workerFk + AND r.commissionWorkCenterFk; + ELSE + INSERT INTO routeCommission ( + routeFk, + workCenterFk, + km, + m3, + yearlyKm, + yearlyM3, + cat4m3, + cat5m3 + ) + SELECT vSelf, + r.commissionWorkCenterFk, + (r.kmEnd - r.kmStart) * + IF(v.isKmTruckRate, rc.kmHeavy, rc.kmLight), + IFNULL(r.m3, 0) * + IF(v.isKmTruckRate, rc.deliveryM3Cat5, rc.deliveryM3Cat4), + (r.kmEnd - r.kmStart) * rc.kmYearly, + IFNULL(r.m3, 0) * rc.m3Yearly, + rc.distributionCat4M3 * IFNULL(r.m3, 0), + rc.distributionCat5M3 * IFNULL(r.m3, 0) + FROM route r + JOIN vehicle v ON v.id = r.vehicleFk + JOIN routeConfig rc + WHERE r.id = vSelf + AND r.kmStart + AND r.kmEnd + AND r.workerFk + AND r.commissionWorkCenterFk; + 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 `route_doRecalc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73995,7 +64014,7 @@ proc: BEGIN /** * Recalculates modified route. */ - + DECLARE vDone BOOL; DECLARE vRouteFk INT; @@ -74004,7 +64023,7 @@ proc: BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN DO RELEASE_LOCK('vn.route_doRecalc'); @@ -74062,42 +64081,40 @@ BEGIN * @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 + SELECT + t.id Id, + t.clientFk Client, + a.id Address, + a.nickname ClientName, + t.packages Packages, + a.street AddressName, + a.postalCode PostalCode, + a.city City, + sub2.itemPackingTypeFk PackingType, + c.phone ClientPhone, + c.mobile ClientMobile, + a.phone AddressPhone, + a.mobile AddressMobile, + d.longitude Longitude, + d.latitude Latitude, + wm.mediaValue SalePersonPhone, + tob.Note Note, + t.isSigned Signed 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 delivery d ON d.addressFk = a.id LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk - LEFT JOIN - (SELECT tob.description AS Note, t.id + LEFT JOIN + (SELECT tob.description 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, + 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 @@ -74156,16 +64173,17 @@ 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 -*/ +/** + * 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, + -- 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, @@ -74173,36 +64191,37 @@ BEGIN km, Dia, Fecha, - Bultos, + m3, + bultos, Matricula, Tipo, - Terceros) - SELECT YEAR(r.created), + Terceros) + SELECT YEAR(r.created), MONTH(r.created), - GREATEST(1,a.warehouseFk), + IFNULL(GREATEST(1,a.warehouseFk), 0), r.id, r.agencyModeFk, - r.kmEnd - r.kmStart, + IFNULL(r.kmEnd, 0) - IFNULL(r.kmStart, 0), DAYNAME(r.created), r.created, + SUM(r.m3), 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 + IFNULL(r.cost,0) + FROM route r + JOIN ticket t ON t.routeFk = r.id + LEFT JOIN zone z ON z.id = t.zoneFk + LEFT JOIN agencyMode am ON am.id = r.agencyModeFk + LEFT JOIN agency a ON a.id = am.agencyFk + LEFT JOIN vehicle v ON v.id = r.vehicleFk + JOIN saleVolume sv ON sv.ticketFk = t.id + JOIN 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, + -- 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, @@ -74210,111 +64229,112 @@ BEGIN km, Dia, Fecha, + m3, Bultos, Matricula, Tipo, - Terceros) - SELECT YEAR(r.created), + Terceros) + SELECT YEAR(r.created), MONTH(r.created), - GREATEST(1,a.warehouseFk), + IFNULL(GREATEST(1,a.warehouseFk), 0), r.id, r.agencyModeFk, - r.kmEnd - r.kmStart, + IFNULL(r.kmEnd, 0) - IFNULL(r.kmStart,0), DAYNAME(r.created), r.created, + SUM(r.m3), 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 + IFnULL(r.cost,0) + FROM route r + JOIN ticket t ON t.routeFk = r.id + LEFT JOIN zone z ON z.id = t.zoneFk + LEFT JOIN agencyMode am ON am.id = r.agencyModeFk + LEFT JOIN agency a ON a.id = am.agencyFk + LEFT JOIN 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 + + -- 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 + + -- 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 + FROM route r + JOIN time tm ON tm.dated = r.created + JOIN ticket t ON t.routeFk = r.id + JOIN sale s ON s.ticketFk = t.id + 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 = 'agencia' - AND tm.year = vYear + 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; - + SET r.practico = IFNULL(sub.practicoTotal / r.Bultos, 0); + -- 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, + 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 + FROM ticket t + JOIN route r ON r.id = t.routeFk + JOIN time tm ON tm.dated = r.created + JOIN expedition e ON e.ticketFk = t.id + JOIN expeditionBoxVol ebv ON ebv.boxFk = e.freightItemFk + JOIN address ad ON ad.id = t.addressFk + JOIN client c ON c.id = ad.clientFk + LEFT JOIN zone z ON z.id = t.zoneFk + WHERE tm.year = vYear AND tm.month = vMonth - AND z.isVolumetric = FALSE + AND z.isVolumetric = FALSE GROUP BY t.routeFk) sub ON r.Id_Ruta = sub.routeFk - SET r.teorico = sub.BultoTeoricoMedio; + SET r.teorico = IFNULL(sub.BultoTeoricoMedio, 0); - -- Coste VOLUMETRICO TEORICO de una caja "virtual" para cada ruta + -- Coste VOLUMETRICO TEORICO de una caja "virtual" para cada ruta UPDATE bi.rutasBoard r JOIN ( - SELECT t.routeFk, + 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 + FROM ticket t + JOIN route r ON r.id = t.routeFk + JOIN time tm ON tm.dated = r.created + JOIN saleVolume sf ON sf.ticketFk = t.id + JOIN client c ON c.id = t.clientFk + JOIN zone z ON z.id = t.zoneFk + WHERE tm.year = vYear AND tm.month = vMonth - AND z.isVolumetric != FALSE + AND z.isVolumetric != FALSE GROUP BY t.routeFk) sub ON r.Id_Ruta = sub.routeFk - SET r.teorico = sub.BultoTeoricoMedio / r.Bultos; + SET r.teorico = IFNULL(sub.BultoTeoricoMedio / r.Bultos, 0); - -- La diferencia entre el teorico y el practico se deberia de cobrar en greuges, cada noche - UPDATE bi.rutasBoard r + -- La diferencia entre el teorico y el practico se deberia de cobrar en greuges, cada noche + UPDATE bi.rutasBoard r JOIN ( - SELECT t.routeFk, + 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 + FROM ticket t + JOIN route r ON r.id = t.routeFk + JOIN time tm ON tm.dated = r.created + JOIN greuge g ON g.ticketFk = t.id + JOIN greugeType gt ON gt.id = g.greugeTypeFk + WHERE tm.year = vYear AND tm.month = vMonth - AND gt.name = 'Diferencia portes' + 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 */ ; @@ -74333,27 +64353,27 @@ DELIMITER ; 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(*) + /*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 + 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 - + + 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 */ ; @@ -74377,7 +64397,7 @@ BEGIN * * @param vSectorFk Identificador de vn.sector */ - INSERT INTO vn.saleGroup(userFk, sectorFk) + INSERT INTO vn.saleGroup(userFk, sectorFk) VALUES (account.myUser_getId(), vSectorFk); SELECT LAST_INSERT_ID(); @@ -74387,7 +64407,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 `saleItemShelvingDelete__` */; +/*!50003 DROP PROCEDURE IF EXISTS `saleGroup_setParking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -74397,142 +64417,20 @@ DELIMITER ; /*!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); - +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleGroup_setParking`(IN `vSaleGroupFk` VARCHAR(8), IN `vParkingFk` INT) +proc: BEGIN +/** + * Aparca una preparación previa en un parking + * + * @param vSaleGroupFk id de la preparación previa + * @param vParkingFk id del parking + */ + UPDATE vn.saleGroup sg + SET sg.parkingFk = vParkingFk + WHERE sg.id = vSaleGroupFk + AND sg.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()); + CALL vn.ticket_setNextState(vn.ticket_get(vSaleGroupFk)); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -74598,19 +64496,19 @@ BEGIN IF vClientTypeFk <> 'handMaking' THEN SELECT t.id INTO vNewTicket - FROM ticket t + FROM ticket t JOIN ticketState ts ON ts.ticketFk = t.id WHERE t.addressFk = vAddressFk - AND t.warehouseFk = vWarehouseFk + AND t.warehouseFk = vWarehouseFk AND t.agencyModeFk = vAgencyModeFk AND t.landed <=> vLanded - AND t.shipped BETWEEN vShipped AND vShippedDayEnd + AND t.shipped BETWEEN vShipped AND vShippedDayEnd AND t.refFk IS NULL AND t.id <> vTicketOriginalFk AND IFNULL(ts.alertLevel,0) = 0 - LIMIT 1; + LIMIT 1; END IF; - + IF vNewTicket IS NULL THEN CALL vn.ticket_Clone(vTicketOriginalFk, vNewTicket); END IF; @@ -74619,64 +64517,33 @@ BEGIN 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) + + 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 + FROM saleComponent WHERE saleFk = vSaleFk; - + ELSE - UPDATE sale + 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 */ ; @@ -74693,140 +64560,49 @@ DELIMITER ; /*!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) +CREATE DEFINER=`root`@`localhost` PROCEDURE `salePreparingList`(IN vTicketFk BIGINT) BEGIN +/** + * Devuelve un listado con las lineas de vn.sale y los distintos estados de prepacion + * + * @param vTicketFk Identificador de vn.ticket + */ + CALL cache.last_buy_refresh(FALSE); -CALL cache.last_buy_refresh(FALSE); - - SELECT t.clientFk, - t.shipped, - a.nickname, + SELECT t.clientFk, + t.shipped, + a.nickname, s.ticketFk, - s.itemFk, - s.quantity, - s.concept, + s.itemFk, + s.quantity, + s.concept, s.reserved, s.id saleFk, - i.size, + 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, + 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; - - + stPrepared.isChecked as isPrepared, + stControled.isChecked as isControled, + ib.code as barcode, + (MAX(sgd.id) IS NOT NULL) AS hasSaleGroupDetail + 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 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 + LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id + WHERE t.id = vTicketFk + GROUP BY s.id; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -74846,43 +64622,135 @@ 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, + + INSERT INTO vn.sale(itemFk, + concept, + price, + discount, + quantity, + ticketFk, isPriceFixed) - SELECT s.itemFk, - i.longName, - s.price, - s.discount, + SELECT s.itemFk, + i.longName, + s.price, + s.discount, vQuantity, - s.ticketFk, - s.isPriceFixed + 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, + + INSERT INTO vn.saleComponent( saleFk, + componentFk, value) - SELECT vNewSaleFk, - componentFk, + SELECT vNewSaleFk, + componentFk, value - FROM vn.saleComponent + 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 `sales_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 `sales_merge`(vTicketFk INT) +BEGIN + DROP TEMPORARY TABLE IF EXISTS salesToPreserve; + CREATE TEMPORARY TABLE salesToPreserve + SELECT s.id, s.itemFk, sum(s.quantity) as newQuantity + FROM vn.sale s + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + WHERE s.ticketFk = vTicketFk + AND it.isMergeable + GROUP BY s.itemFk, s.price, s.discount; + + UPDATE vn.sale s + JOIN salesToPreserve stp ON stp.id = s.id + SET quantity = newQuantity + WHERE s.ticketFk = vTicketFk; + + DELETE s.* + FROM vn.sale s + LEFT JOIN salesToPreserve stp ON stp.id = s.id + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + WHERE s.ticketFk = vTicketFk + AND stp.id IS NULL + AND it.isMergeable; + + DROP TEMPORARY TABLE salesToPreserve; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `sales_mergeByCollection` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sales_mergeByCollection`(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.sales_merge(vTicketFk); + + END LOOP; + + CLOSE cCur; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -74893,35 +64761,31 @@ 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 `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 , +/** Inserta en vn.saleTracking las lineas de una previa + * + * @param vSaleGroupFk Identificador de vn.saleGroup + */ + REPLACE vn.saleTracking( + saleFk, + isChecked, + workerFk, + 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 */ ; @@ -74932,28 +64796,24 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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 `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 +/** + * 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, stateFk) + SELECT sgd.saleFk, TRUE, account.myUser_getId(), 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 */ ; @@ -74964,38 +64824,34 @@ 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 `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, +/** + * 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, + stateFk + ) + SELECT sgd.saleFk, TRUE, sc.userFk, - a.accion_id, s.id - FROM vn.sectorCollection sc + FROM vn.sectorCollection sc JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id - JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk + 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 */ ; @@ -75021,9 +64877,9 @@ BEGIN DELETE st.* FROM vn.saleTracking st JOIN vn.state s ON s.id = st.stateFk - WHERE st.saleFk = vSaleFk + WHERE st.saleFk = vSaleFk AND s.code = vState COLLATE utf8_unicode_ci; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -75040,30 +64896,35 @@ DELIMITER ; /*!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), +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_new`( vSaleFK INT, + vIsChecked BOOLEAN, + vOriginalQuantity INT, + vWorkerFk INT, + vAction VARCHAR(50), vState VARCHAR(50)) BEGIN +/** + * Modifica registro de saleTracking - REPLACE vn.saleTracking(saleFk, - isChecked, - originalQuantity, - workerFk, - actionFk, - stateFk) + * @param vSaleFK Identificador del registro a modificar + * @param vIsChecked Indica si la línea ha sido pulsada + * @param vOriginalQuantity Cantidad original + * @param vWorkerFk Identificador del trabajador + * @param vAction Identificador de la acción realizada + * @param vState Identificador del estado a modificar + */ + REPLACE vn.saleTracking(saleFk, + isChecked, + originalQuantity, + workerFk, + 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; + FROM vn.state s + WHERE s.code = vState COLLATE utf8_unicode_ci; END ;; DELIMITER ; @@ -75083,7 +64944,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_Replace`(vSaleFk INT, vIsChecked INT, vOriginalQuantity INT, vStateFk INT) BEGIN - REPLACE vn.saleTracking(saleFk, isChecked, originalQuantity, stateFk) + REPLACE vn.saleTracking(saleFk, isChecked, originalQuantity, stateFk) VALUES(vSaleFk, vIsChecked, vOriginalQuantity, vStateFk); END ;; DELIMITER ; @@ -75103,26 +64964,26 @@ DELIMITER ; 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 + + DELETE FROM vn.itemShelvingSale WHERE saleFk = vSaleFk; - + END IF; END ;; @@ -75148,15 +65009,15 @@ proc: BEGIN * * @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 ; @@ -75164,219 +65025,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 `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 */ ; @@ -75416,7 +65064,7 @@ BEGIN GROUP BY s.id; DECLARE CONTINUE HANDLER FOR NOT FOUND - SET v_done = TRUE; + SET v_done = TRUE; DROP TEMPORARY TABLE IF EXISTS tmp.coste; @@ -75424,7 +65072,7 @@ BEGIN CREATE TEMPORARY TABLE tmp.coste (PRIMARY KEY (id)) ENGINE = MEMORY SELECT s.id - FROM sale s + 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 @@ -75443,120 +65091,17 @@ BEGIN 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(util.VN_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(util.VN_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 ; - + DROP TEMPORARY TABLE tmp.coste; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -75578,10 +65123,9 @@ 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 @@ -75591,7 +65135,7 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.ticket; DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; - IF vIsCollection THEN + IF vIsCollection THEN CREATE TEMPORARY TABLE tmp.ticket (INDEX (id)) ENGINE = MEMORY @@ -75599,7 +65143,7 @@ BEGIN FROM ticketCollection tc JOIN ticket t ON t.id = tc.ticketFk WHERE tc.collectionFk = vParam; - + CREATE TEMPORARY TABLE tmp.ticket2 (INDEX (id)) ENGINE = MEMORY @@ -75607,7 +65151,7 @@ BEGIN FROM ticketCollection tc JOIN ticket t ON t.id = tc.ticketFk WHERE tc.collectionFk = vParam; - ELSE + ELSE CREATE TEMPORARY TABLE tmp.ticket (INDEX (id)) ENGINE = MEMORY @@ -75643,7 +65187,7 @@ BEGIN 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, + 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, @@ -75654,30 +65198,31 @@ BEGIN IFNULL(c.workerFk,getUser()) as workerFk, IFNULL(SUM(iss.quantity),0) as pickedQuantity, i.packingShelve, - MIN(iss.created) picked + 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 + 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 + 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 + ORDER BY st.id DESC + LIMIT 10000000000000000000) 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 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 + LEFT JOIN parking p ON p.id = sg.parkingFk GROUP BY s.id; DROP TEMPORARY TABLE @@ -75726,10 +65271,10 @@ BEGIN 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' + 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), @@ -75738,7 +65283,6 @@ BEGIN 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), @@ -75761,7 +65305,7 @@ BEGIN -- Too Little INSERT INTO tmp.sale_problems(ticketFk, isTooLittle) - SELECT tp.ticketFk, TRUE + 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 @@ -75781,16 +65325,20 @@ BEGIN -- 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; + SELECT sub.ticketFk, sub.hasComponentLack, sub.saleFk + FROM( + SELECT tl.ticketFk, (COUNT(DISTINCT s.id) * vComponentCount > COUNT(c.id)) hasComponentLack, s.id saleFk + 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 s.id + LIMIT 10000000000000000) sub + WHERE sub.hasComponentLack; -- Cliente congelado INSERT INTO tmp.sale_problems(ticketFk, isFreezed) @@ -75840,43 +65388,25 @@ BEGIN -- 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 + -- 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, + 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 + 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 + 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 @@ -75889,7 +65419,7 @@ BEGIN 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 @@ -75902,7 +65432,7 @@ BEGIN 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 + 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 @@ -75915,7 +65445,7 @@ BEGIN 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 @@ -75929,7 +65459,7 @@ BEGIN 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 + 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 @@ -75946,7 +65476,7 @@ BEGIN END WHILE; CLOSE vCursor; - + INSERT INTO tmp.sale_problems(ticketFk, isTaxDataChecked) SELECT DISTINCT tl.ticketFk, FALSE FROM tmp.ticket_list tl @@ -75976,16 +65506,16 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getProblemsByTicket`(IN vTicketFk INT, IN vIsTodayRelative TINYINT(1)) BEGIN /** - * Calcula los problemas de cada venta + * 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 + CREATE TEMPORARY TABLE tmp.sale_getProblems (INDEX (ticketFk)) ENGINE = MEMORY - SELECT t.id ticketFk, t.clientFk, t.warehouseFk, t.shipped + SELECT t.id ticketFk, t.clientFk, t.warehouseFk, t.shipped FROM ticket t WHERE t.id = vTicketFk; @@ -76002,225 +65532,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 `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, util.VN_CURDATE(), date(tt.shipped)) - FROM tmp.sale_getProblems tt - WHERE DATE(tt.shipped) BETWEEN util.VN_CURDATE() - AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), util.VN_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 = util.VN_CURDATE() - WHERE util.VN_NOW() < TIMESTAMPADD(MINUTE,MINUTE(zc.`hour`) ,TIMESTAMPADD(HOUR,HOUR(zc.`hour`),util.VN_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(util.VN_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 util.VN_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 util.VN_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 */ ; @@ -76233,7 +65544,7 @@ DELIMITER ; 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 @@ -76268,56 +65579,56 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_recalcComponent`(vOption INT) proc: BEGIN -/** +/** * Actualiza los componentes * * @table tmp.recalculateSales - */ - DECLARE vShipped DATE; + */ + DECLARE vShipped DATE; DECLARE vWarehouseFk SMALLINT; DECLARE vAgencyModeFk INT; DECLARE vAddressFk INT; DECLARE vTicketFk BIGINT; DECLARE vItemFk BIGINT; - DECLARE vLanded DATE; + 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; - + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + OPEN vCur; l: LOOP SET vDone = FALSE; - FETCH vCur INTO vSale; - + 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, + + 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, + INTO vIsEditable, + vTicketFk, + vItemFk, + vZoneFk, + vWarehouseFk, + vShipped, + vAddressFk, + vAgencyModeFk, vLanded FROM ticket t JOIN sale s ON s.ticketFk = t.id @@ -76325,59 +65636,59 @@ proc: BEGIN 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) + 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); - + + -- 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 + 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_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 ticketComponentUpdateSale(vOption); CALL catalog_componentPurge(); - + DROP TEMPORARY TABLE tmp.buyUltimate; DROP TEMPORARY TABLE tmp.sale; - + END LOOP; - CLOSE vCur; + CLOSE vCur; END ;; DELIMITER ; @@ -76399,28 +65710,28 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_setQuantity`(vSaleFk INT, vQua 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 + FROM sale WHERE id = vSaleFk; SELECT ticketFk INTO vOrigin FROM sale WHERE id = vSaleFk; CALL logAdd(vOrigin, 'update', 'ticket', vDescription); - - UPDATE sale + + UPDATE sale SET originalQuantity = quantity, quantity = vQuantity WHERE id = vSaleFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -76445,73 +65756,6 @@ 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 */ ; @@ -76524,53 +65768,50 @@ 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 `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 - */ - + +/** + * 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 + 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.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 + 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 */ ; @@ -76589,15 +65830,15 @@ DELIMITER ; 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 + 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 @@ -76605,10 +65846,10 @@ BEGIN LEFT JOIN vn.sale sl ON sl.id = st.saleFk WHERE sc.userFk = account.myUser_getId() AND (ISNULL(scsg.sectorCollectionFk) - OR + OR (NOT st.isChecked AND sl.quantity > 0)) AND sc.created > util.VN_CURDATE(); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -76619,35 +65860,33 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = 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_getSale`(vSelf INT) BEGIN - - /** - * Devuelve las lineas de venta correspondientes a esa coleccion de sector - * - * @param vSelf Identificador de vn.sectorCollection - */ - +/** + * 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, + itemPackingTypeFk, + subName, s.quantity, w.code workerCode, sgd.saleFk, - IFNULL(iss.quantity,0) pickedQuantity, - c.salesPersonFk + iss.quantity pickedQuantity, + c.salesPersonFk FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk + 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.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 @@ -76655,7 +65894,6 @@ BEGIN 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 */ ; @@ -76674,12 +65912,11 @@ DELIMITER ; 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 + * + * @param vSectorFk Identificador de #vn.sector */ DECLARE hasEmptyCollections BOOL; DECLARE vUserFk INT; @@ -76687,13 +65924,13 @@ BEGIN 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 + 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 >= util.VN_CURDATE(); - + IF NOT hasEmptyCollections THEN INSERT INTO vn.sectorCollection(userFk, sectorFk) VALUES(vUserFk, vSectorFk); @@ -76710,41 +65947,35 @@ 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 `sectorProductivity_add`() BEGIN - DECLARE vDatedFrom DATETIME; DECLARE vDatedTo DATETIME; SELECT DATE_SUB(util.VN_CURDATE(),INTERVAL 1 DAY), CONCAT(DATE_SUB(util.VN_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; + 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; - + SELECT sc.userFk workerFk, COUNT(DISTINCT s.ticketFk) errorsByChecker + FROM saleMistake sm + JOIN vn.saleGroupDetail sgd on sgd.saleFk = sm.saleFk + JOIN vn.sectorCollectionSaleGroup scsg on scsg.saleGroupFk = sgd.saleGroupFk + JOIN vn.sectorCollection sc on sc.id = scsg.sectorCollectionFk + JOIN sale s ON s.id = sm.saleFk + JOIN ticket t on t.id = s.ticketFk + WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) + GROUP BY sc.userFk ; + CREATE TEMPORARY TABLE tmp.previousErrors -- Errores de previa, derivadores de los revisadores (por reclamación) ENGINE = MEMORY SELECT tt.workerFk, COUNT(c.ticketFk) errorsByClaim @@ -76752,42 +65983,45 @@ BEGIN 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 + 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; + DELETE FROM sectorProductivity + WHERE dated = vDatedFrom + AND sector IN ('Algemesi Artificial','Algemesi Complementos'); + 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, + COUNT(DISTINCT s.ticketFk) ticketCount, + COUNT(sgd.id) saleCount, IFNULL(ec2.errorsByChecker,0) + IFNULL(pe.errorsByClaim, 0) errors, wp.volume, - IFNULL(CAST(tc.timeWorkDecimal AS DECIMAL (10,2)) , 0) AS hourWorked, + 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 + FROM vn.saleGroupDetail sgd + JOIN vn.saleGroup sg on sg.id = sgd.saleGroupFk + JOIN vn.sectorCollectionSaleGroup scsg on scsg.saleGroupFk = sgd.saleGroupFk + JOIN vn.sectorCollection sc on sc.id = scsg.sectorCollectionFk + join vn.sector se on se.id = sc.sectorFk + JOIN vn.worker w ON w.id = sc.userFk + LEFT JOIN vn.sale s ON s.id = sgd.saleFk 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 bs.workerProductivity wp ON wp.workerFk = w.id + LEFT JOIN `state` s2 ON s2.id = wp.stateFk AND s2.code = 'OK PREVIOUS' 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') + WHERE DATE(sc.created) = vDatedFrom AND wp.dated = vDatedFrom GROUP BY w.id; - + DROP TEMPORARY TABLE tmp.timeControlCalculate; DROP TEMPORARY TABLE tmp.errorsByChecker; - DROP TEMPORARY TABLE tmp.previousErrors; - + DROP TEMPORARY TABLE tmp.previousErrors; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -76836,14 +66070,14 @@ 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 DROP PROCEDURE IF EXISTS `setParking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -76853,33 +66087,64 @@ DELIMITER ; /*!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 +CREATE DEFINER=`root`@`localhost` PROCEDURE `setParking`(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 vIsSaleGroup BOOL; + DECLARE vIsTicket BOOL; + DECLARE vIsCollection BOOL; - 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; - + SET vParkingCode = replace(vParkingCode,' ',''); + + SELECT id INTO vParkingFk + FROM vn.parking + WHERE code = vParkingCode COLLATE utf8_unicode_ci; + + IF vParkingFk IS NULL THEN + CALL util.throw('parkingNotExist'); + LEAVE proc; END IF; - - REPLACE itemPlacement(itemFk, warehouseFk, code,reserve) - VALUES(vItemFk, vWarehouseFk, vPlacement, vReserve); + -- Se comprueba si es una preparación previa + SELECT COUNT(*) INTO vIsSaleGroup + FROM vn.saleGroup sg + WHERE sg.id = vParam; + IF vIsSaleGroup THEN + CALL vn.saleGroup_setParking(vParam, vParkingFk); + 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,util.VN_CURDATE()); + + IF vIsTicket THEN + CALL vn.ticket_setParking(vParam, vParkingFk); + 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,util.VN_CURDATE()); + + IF vIsCollection THEN + CALL vn.collection_setParking(vParam, vParkingFk); + LEAVE proc; + END IF; + + -- Por descarte, se considera una matrícula + CALL vn.shelving_setParking(vParam, vParkingFk); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -76900,189 +66165,10 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingChange`(IN `vShelvingO` VAR 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 + SET shelvingFk = vShelvingD COLLATE utf8_unicode_ci + WHERE shelvingFk = vShelvingO COLLATE utf8_unicode_ci; - 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 util.VN_CURDATE() AND util.dayEnd(util.VN_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 */ ; @@ -77101,159 +66187,19 @@ DELIMITER ; 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 + JOIN account.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,util.VN_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,util.VN_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,util.VN_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 = util.VN_NOW(), isPrinted = TRUE - WHERE `code` = vParam COLLATE utf8_unicode_ci; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -77273,135 +66219,23 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingParking_get`(vShelvingFk VARCHAR(10), vWarehouseFk INT, vDayRange INT) BEGIN - -SELECT s.itemFk, + +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 + 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 util.VN_CURDATE() AND util.dayend(TIMESTAMPADD(DAY, GREATEST(0,vDayRange), util.VN_CURDATE())) + WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(TIMESTAMPADD(DAY, GREATEST(0,vDayRange), util.VN_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,util.VN_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,util.VN_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,util.VN_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 = util.VN_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 */ ; @@ -77433,9 +66267,9 @@ 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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -77445,12 +66279,12 @@ BEGIN DELETE FROM vn.shelving WHERE length(code) > 3 AND parked < TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()); - + DELETE FROM vn.itemShelving WHERE visible <= 0 AND created < TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()); - DELETE ish.* + DELETE ish.* FROM vn.itemShelving ish JOIN vn.shelving sh ON sh.code = ish.shelvingFk WHERE sh.parkingFk IS NULL @@ -77458,12 +66292,12 @@ BEGIN UPDATE vn.shelving sh LEFT JOIN vn.itemShelving its ON its.shelvingFk = sh.`code` - SET isPrinted = 0, + SET isPrinted = 0, parkingFk = NULL WHERE its.id IS NULL - AND sh.isRecyclable - AND ( sh.parked IS NULL - OR + AND sh.isRecyclable + AND ( sh.parked IS NULL + OR sh.parked < TIMESTAMPADD(MONTH,-1,util.VN_CURDATE()) ); @@ -77485,28 +66319,28 @@ DELIMITER ; 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, + 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 + 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 @@ -77515,7 +66349,7 @@ BEGIN JOIN vn.sector s ON s.id = p.sectorFk WHERE s.code = 'FUENTES_PICASSE' OR sh.isSpam - GROUP BY ish.itemFk + 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 ( @@ -77541,27 +66375,27 @@ BEGIN GROUP BY item_id ) mov ON mov.item_id = i.id WHERE v.amount; - - SELECT ish.shelvingFk matricula, + + SELECT ish.shelvingFk matricula, i.longName articulo, ish.visible, - count(*) lineas, - sum(ish.visible <= s.saldo) spam, + count(*) lineas, + sum(ish.visible <= s.saldo) spam, p.code parking, - s.description sector , + s.description sector , w.name AS almacen, sh.isSpam - FROM vn.itemShelving ish + 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 + 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 < util.VN_CURDATE())) + AND ish.visible + GROUP BY ish.shelvingFk HAVING lineas = spam OR isSpam; DROP TEMPORARY TABLE tmp.stock; @@ -77572,7 +66406,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 `silla_algemesi__` */; +/*!50003 DROP PROCEDURE IF EXISTS `shelving_setParking` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -77582,123 +66416,24 @@ DELIMITER ; /*!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 +CREATE DEFINER=`root`@`localhost` PROCEDURE `shelving_setParking`(IN `vShelvingCode` VARCHAR(8), IN `vParkingFk` INT) +proc: BEGIN +/** + * Aparca una matrícula en un parking + * + * @param vShelvingCode code de la matrícula + * @param vParkingFk id del parking + */ + INSERT INTO vn.shelvingLog (originFk, userFk, action , description) + SELECT s.id, account.myUser_getId(), 'update', CONCAT("Cambio parking ",vShelvingCode," de ", p.code," a ", pNew.code) + FROM parking p + JOIN shelving s ON s.parkingFk = p.id + JOIN parking pNew ON pNew.id = vParkingFk + WHERE s.code = vShelvingCode COLLATE utf8_unicode_ci; -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; - + UPDATE vn.shelving + SET parkingFk = vParkingFk, parked = util.VN_NOW(), isPrinted = TRUE + WHERE code = vShelvingCode COLLATE utf8_unicode_ci; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -77739,19 +66474,20 @@ DELIMITER ; 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 + 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; - + ORDER BY ci.creationDate DESC + LIMIT 10000000000000000000) t1 GROUP BY Id_Cliente; + CALL vn2008.risk_vs_client_list(util.VN_CURDATE()); - - SELECT + + 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 @@ -77761,7 +66497,7 @@ BEGIN 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 ;; @@ -77776,67 +66512,46 @@ 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 @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) +CREATE DEFINER=`root`@`localhost` PROCEDURE `stockBuyedByWorker`(vDate DATE, vWorker INT) BEGIN - +/** + * Calculates the space reserved by buyers of the same container + * + * @param vdate date of container delivery + * @param vWorker buyer reserving space in the container + */ 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; + DECLARE vWarehouseFk INT; + DECLARE vCompressionRatio DECIMAL(1,1); + + CALL stockTraslation(vDate); + + SELECT warehosueFk, conversionCoefficient INTO vWarehouseFk, vCompressionRatio FROM auctionConfig; + SELECT volume INTO vVolume FROM vn.packaging WHERE id = 'cc'; + + SELECT b.entryFk Id_Entrada, + i.id Id_Article, + i.name Article, + ti.amount Cantidad, + (vCompressionRatio * (ti.amount / b.packing) * vn.buy_getVolume(b.id))/vVolume buyed, + b.packageFk id_cubo, + b.packing + FROM tmp_item ti + JOIN item i ON i.id = ti.item_id + JOIN itemType it ON i.typeFk = it.id + JOIN itemCategory ic ON ic.id = it.categoryFk + JOIN worker w ON w.id = it.workerFk + JOIN tmp.buyUltimate bu ON bu.itemFk = i.id AND bu.warehouseFk = vWarehouseFk + JOIN buy b ON b.id = bu.buyFk + WHERE ic.display AND w.id = vWorker; + + DROP TEMPORARY TABLE + tmp.buyUltimate, + tmp_item; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -77862,15 +66577,15 @@ BEGIN */ CALL vn.stockTraslation(vDated); - DELETE - FROM vn.stockBuyed + 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, + SELECT it.workerFk, + SUM(( ti.amount / b.packing ) * vn.buy_getVolume(b.id)) / vc.palletM3 / 1000000 buyed, vDated, - u.name + 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 @@ -77882,18 +66597,18 @@ BEGIN 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.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) + WHERE ito.shipped BETWEEN vDated AND util.dayend(vDated) AND wh.code = 'VNH' GROUP BY destiny; @@ -77912,17 +66627,17 @@ 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 `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 - **/ +/** + * 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; @@ -77932,21 +66647,21 @@ BEGIN CREATE TEMPORARY TABLE tmp_item (UNIQUE INDEX i USING HASH (item_id)) ENGINE = MEMORY - SELECT item_id, SUM(amount) amount + SELECT item_id, SUM(amount) amount FROM vn2008.item_entry_in - WHERE dat = vDate - AND vDate >= util.VN_CURDATE() + WHERE dat = vDate + AND vDate >= util.VN_CURDATE() AND warehouse_id = vWarehouse AND isVirtualStock is FALSE - GROUP BY item_id + GROUP BY item_id HAVING amount != 0; CALL `cache`.stock_refresh (FALSE); INSERT INTO tmp_item (item_id,amount) - SELECT item_id,s.amount + SELECT item_id,s.amount FROM `cache`.stock s - WHERE warehouse_id = vWarehouse + WHERE warehouse_id = vWarehouse ON DUPLICATE KEY UPDATE amount = tmp_item.amount + VALUES(amount); CALL buyUltimate(vWarehouse,vDate); @@ -77957,202 +66672,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 `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 >= util.VN_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 */ ; @@ -78170,10 +66689,10 @@ BEGIN DECLARE vBossId INT; DECLARE vDone BOOL; DECLARE workerCur CURSOR FOR - SELECT workerFk - FROM tmp.subordinate + SELECT workerFk + FROM tmp.subordinate WHERE NOT isChecked; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE EXIT HANDLER FOR 1062 BEGIN @@ -78181,29 +66700,29 @@ BEGIN 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 + + INSERT INTO tmp.subordinate + SELECT id, 0 + FROM worker WHERE bossFk = vBossId; - - UPDATE tmp.subordinate + + UPDATE tmp.subordinate SET isChecked = 1 WHERE workerFk = vBossId; END LOOP; @@ -78243,13 +66762,13 @@ BEGIN -- Calcula el balance inicial y final de cada proveedor INSERT INTO openingBalance SELECT MAX(dueDated), - supplierFk, - companyFk, + supplierFk, + companyFk, sum(amount) eurAmount, sum(divisa) foreignAmount FROM ( SELECT p.dueDated, - p.supplierFk, + p.supplierFk, p.companyFk, p.amount, p.divisa @@ -78265,7 +66784,7 @@ BEGIN SELECT iidd.dueDated, ii.supplierFk, ii.companyFk, - - iidd.amount, + - iidd.amount, - iidd.foreignValue FROM invoiceIn ii JOIN invoiceInDueDay iidd ON ii.id = iidd.invoiceInFk @@ -78273,14 +66792,14 @@ BEGIN 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 ii.isBooked AND co.`code` = 'VNL' AND c.`code` <> 'EUR' UNION ALL SELECT se.dueDated, se.supplierFk, se.companyFk, - - se.amount, + - se.amount, 0 FROM supplierExpense se JOIN currency c ON c.id = se.currencyFk @@ -78290,7 +66809,7 @@ BEGIN AND co.`code` = 'VNL' AND c.`code` <> 'EUR' ) sub GROUP BY companyFk, supplierFk; - + SELECT ob.dueDated , ob.supplierFk , ob.companyFk @@ -78377,7 +66896,7 @@ BEGIN SELECT MAX(`row`) INTO vMaxRow FROM tmp.supplierPackagingList; - + DROP TEMPORARY TABLE IF EXISTS tmp.supplierPackaging; CREATE TEMPORARY TABLE tmp.supplierPackaging( supplierFk INT, @@ -78391,7 +66910,7 @@ BEGIN warehouse INT, buyingValue INT, balance INT); - + l1: LOOP IF vCounter = vMaxRow THEN @@ -78400,12 +66919,12 @@ BEGIN 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, @@ -78433,9 +66952,9 @@ BEGIN WHERE supplierFk = vSupplierFk AND landed >= vFromDated AND itemFk = vItemFk - + UNION ALL - + SELECT vSupplierFk, itemFk, longName, @@ -78482,42 +67001,74 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `supplier_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL) BEGIN - +/** + * Compara los datos de nuestros proveedores con + * los que hay en la base de datos de sage + * + * @param vDateTo + * @param vIsConciliated + * @table tmp.ledgerComparative (id, date, account, debit, credit, companyFk) + */ DECLARE vDateFrom DATE; + DECLARE vMaxTolerance DECIMAL(10,2); SET vDateTo = TIMESTAMP(vDateTo,'23:59:59'); SELECT util.firstDayOfYear(vDateTo) INTO vDateFrom; + SELECT maxTolerance INTO vMaxTolerance + FROM vn.ledgerConfig; - SELECT c.code, s.id , s.account, mysql, sage, mysql - sage difference, sub1.companyFk, s.name + SELECT c.code, + s.id supplierFk, + s.account, + sub1.mysql, + sub1.sage, + sub1.mysql - sub1.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 + JOIN (SELECT companyFk, + supplierFk, + CAST(ROUND(SUM(mysql),2) AS DECIMAL(10,2)) mysql, + CAST(ROUND(SUM(sage),2) AS DECIMAL(10,2)) sage + FROM (SELECT companyFk, + supplierFk, + - SUM(iid.amount) mysql, + 0 sage FROM invoiceInDueDay iid - JOIN invoiceIn ii ON ii.id = iid.invoiceInFk + 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 + 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 lc.companyFk, + s.id, + 0, + - (NZ(lc.debit) - NZ(lc.credit)) + FROM tmp.ledgerComparative lc + JOIN supplier s ON s.account = lc.account + WHERE lc.`date` 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 + HAVING ABS(difference) > vMaxTolerance ORDER BY s.name; END ;; DELIMITER ; @@ -78525,6 +67076,36 @@ 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 `supplier_checkIsActive` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_checkIsActive`(vSelf INT) +BEGIN +/** + * Comprueba si un proveedor esta activo. + */ + DECLARE vIsActive BOOL; + + SELECT isActive INTO vIsActive + FROM vn.supplier + WHERE id = vSelf; + + IF NOT vIsActive THEN + CALL util.throw('INACTIVE_PROVIDER'); + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_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 */ ; @@ -78592,15 +67173,15 @@ DELIMITER ; 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, + + SELECT s.id, + s.itemFk, + s.concept, + floor(s.quantity / b.packing) as Cajas, + b.packing, + s.isPicked, i.size - FROM ticket t + 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 @@ -78611,7 +67192,7 @@ BEGIN AND p.isBox GROUP BY s.itemFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -78633,7 +67214,7 @@ 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 @@ -78646,20 +67227,21 @@ BEGIN SELECT ticketFk, builtTime FROM ( - SELECT - Id_Ticket as ticketFk, - odbc_date as builtTime + SELECT + ticketFk, + created as builtTime FROM - vncontrol.inter - WHERE odbc_date BETWEEN vDateStart AND vDateEnd - ORDER BY Id_Ticket, odbc_date DESC - ) sub + ticketTracking + WHERE created BETWEEN vDateStart AND vDateEnd + ORDER BY ticketFk, created DESC + LIMIT 10000000000000000000 + ) 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 ;; @@ -78696,10 +67278,10 @@ BEGIN DECLARE vZoneFk INT; REPLACE INTO orderTicket(orderFk,ticketFk) - SELECT orderFk, vTicketNew - FROM orderTicket + 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 @@ -78709,47 +67291,47 @@ BEGIN 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 + 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); + CALL buyUltimate(vWarehouse, vShipped); DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE 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_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 + 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 + 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 @@ -78757,107 +67339,11 @@ BEGIN -- Limpieza CALL catalog_componentPurge(); - DROP TEMPORARY TABLE IF EXISTS - tmp.buyUltimate, - tmp.sale, + 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 */ ; @@ -78880,12 +67366,12 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateFromType`( vLanded D vTypeFk INT) BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item - (INDEX (itemFk)) - ENGINE = MEMORY + 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; @@ -78907,7 +67393,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculatePurge`() BEGIN - DROP TEMPORARY TABLE + DROP TEMPORARY TABLE tmp.ticketCalculateItem, tmp.ticketComponentPrice, tmp.ticketComponent, @@ -78919,231 +67405,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 `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 */ ; @@ -79156,56 +67417,56 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClon`(vTicketFk INT, vNewShipped DATE) BEGIN - + DECLARE done INT DEFAULT FALSE; - DECLARE vNewTicketFk INT; + 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, util.VN_CURDATE()); - + CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); - - UPDATE vn.ticket + + 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 */ ; @@ -79227,18 +67488,18 @@ BEGIN DECLARE vShipped DATE; DECLARE vMaxDated DATE; - - SELECT shipped, TIMESTAMPADD(YEAR,1,shipped) + + 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 ;; @@ -79247,170 +67508,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 `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 */ ; @@ -79424,10 +67521,10 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCollection_get`(vTicketFk INT) BEGIN - SELECT tc.collectionFk + SELECT tc.collectionFk FROM vn.ticketCollection tc WHERE ticketFk = vTicketFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -79446,18 +67543,18 @@ DELIMITER ; 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 */ ; @@ -79495,18 +67592,18 @@ BEGIN END; START TRANSACTION; - + IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN - - UPDATE ticket t + + 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 + SET t.clientFk = vClientFk, t.agencyModeFk = vAgencyModeFk, t.addressFk = vAddressFk, @@ -79517,12 +67614,12 @@ BEGIN 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 @@ -79564,104 +67661,104 @@ BEGIN DECLARE vComponentFk INT; DECLARE vRenewComponents BOOLEAN; DECLARE vKeepPrices BOOLEAN; - + CASE vOption - WHEN 1 THEN + WHEN 1 THEN SET vRenewComponents = TRUE; SET vKeepPrices = FALSE; WHEN 2 THEN - SELECT id INTO vComponentFk FROM component WHERE `code` = 'debtCollection'; + 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'; + WHEN 3 THEN + SELECT id INTO vComponentFk FROM component WHERE `code` = 'mana'; SET vRenewComponents = TRUE; SET vKeepPrices = TRUE; - /* WHEN 5 THEN + 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 + 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) + 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 + 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) + 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 + 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.* + 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) + 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 + WHEN 9 THEN SET vRenewComponents = TRUE; SET vKeepPrices = TRUE; END CASE; IF vRenewComponents THEN - DELETE sc.* - FROM tmp.sale tmps + 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 + 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 + 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 + + -- Añadir componente venta por paquete DROP TEMPORARY TABLE IF EXISTS tmp.sale2; CREATE TEMPORARY TABLE tmp.sale2 (PRIMARY KEY (saleFk)) - ENGINE = MEMORY + 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 * 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 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' + JOIN `component` c ON c.id = tc.componentFk AND c.code = 'salePerPackage' LEFT JOIN ( SELECT s.id FROM vn.sale s @@ -79672,8 +67769,8 @@ BEGIN ) tp ON tp.id = s.id WHERE tp.id IS NULL HAVING resto <> 0) t; - - DROP TEMPORARY TABLE IF EXISTS + + DROP TEMPORARY TABLE IF EXISTS tmp.sale2, tmp.ticketComponent2; END IF; @@ -79691,26 +67788,26 @@ BEGIN 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 + 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' ; - + 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 + GROUP BY s.id HAVING ROUND(saleValue, 4) <> 0; END IF; - + UPDATE sale s JOIN ( - SELECT SUM(sc.value) sumValue, sc.saleFk + 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 @@ -79724,10 +67821,10 @@ BEGIN 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'; - + WHERE it.code = 'PRT'; + INSERT INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 15, s.price + 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 @@ -79760,7 +67857,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCreate`( ,vlanded DATE ,OUT vNewTicket INT) BEGIN - CALL `ticketCreateWithUser`(vClientId, vShipped, vWarehouseId, vCompanyFk, vAddressFk, vAgencyType, vRouteFk, vlanded, account.userGetId(), vNewTicket); + CALL `ticketCreateWithUser`(vClientId, vShipped, vWarehouseId, vCompanyFk, vAddressFk, vAgencyType, vRouteFk, vlanded, account.myUser_getId(), vNewTicket); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -79843,254 +67940,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 `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, util.VN_CURDATE(), date(tt.shipped)), w.hasUbications - FROM tmp.ticketGetProblems tt - JOIN vn.warehouse w ON w.id = tt.warehouseFk - WHERE DATE(tt.shipped) BETWEEN util.VN_CURDATE() - AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), util.VN_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(util.VN_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 util.VN_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 util.VN_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 */ ; @@ -80111,24 +67960,24 @@ BEGIN CREATE TEMPORARY TABLE tmp.ticket ENGINE = MEMORY SELECT vTicketFk ticketFk; - + CALL vn.ticket_getTax(NULL); - SELECT + 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.*, + 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 */ ; @@ -80166,29 +68015,29 @@ BEGIN 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) + 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 + JOIN tmp.addressTaxArea ata ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk - JOIN itemTaxCountry itc + JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = su.countryFk - JOIN bookingPlanner bp + JOIN bookingPlanner bp ON bp.countryFk = su.countryFk AND bp.taxAreaFk = ata.areaFk AND bp.taxClassFk = itc.taxClassFk @@ -80196,7 +68045,7 @@ BEGIN 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)) @@ -80207,134 +68056,7 @@ BEGIN 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 */ ; @@ -80371,7 +68093,7 @@ BEGIN 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 ;; @@ -80438,21 +68160,21 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketManaToPromo`(vTicketFk INT) BEGIN - + DECLARE vManaComponent INT; - + DECLARE vPromoComponent INT; SELECT id INTO vManaComponent - FROM vn.component c + FROM vn.component c WHERE c.code = 'mana'; - + SELECT id INTO vPromoComponent - FROM vn.component c + FROM vn.component c WHERE c.code = 'floramondoPromo'; - + UPDATE vn.saleComponent sc - JOIN vn.sale s ON s.id = sc.saleFk + JOIN vn.sale s ON s.id = sc.saleFk SET componentFk = vPromoComponent WHERE componentFk = vManaComponent AND s.ticketFk = vTicketFk; @@ -80479,18 +68201,18 @@ BEGIN DECLARE vParked DATETIME; DECLARE vLevel INT; DECLARE vCollectionFk INT; - - SELECT IFNULL(`level`,0), IFNULL(collectionFk,0) + + SELECT IFNULL(`level`,0), IFNULL(collectionFk,0) INTO vLevel, vCollectionFk FROM vn.ticketCollection WHERE ticketFk = vTicketFk LIMIT 1; - - SELECT created, parkingFk + + 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 @@ -80517,7 +68239,7 @@ BEGIN AND sc.isPackagingArea AND tp.created < vParked AND t.packages <=> 0); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -80538,7 +68260,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketNotInvoicedByClient`(vClientF BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - + CREATE TEMPORARY TABLE tmp.ticket SELECT id ticketFk FROM ticket @@ -80548,7 +68270,7 @@ BEGIN CALL vn.ticketGetTotal; - SELECT c.id, + SELECT c.id, c.name as Cliente, t.shipped as Fecha, t.id as Id_Ticket, @@ -80559,7 +68281,7 @@ BEGIN DROP TEMPORARY TABLE tmp.ticket, - tmp.ticketTotal; + tmp.ticketTotal; END ;; DELIMITER ; @@ -80579,28 +68301,28 @@ DELIMITER ; 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); - + 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 DROP PROCEDURE IF EXISTS `ticketPackaging_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -80610,59 +68332,138 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketPackagingRecovery__`() +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketPackaging_add`( + vDated DATE, + vCompanyFk INT, + vWithoutPeriodGrace BOOLEAN) BEGIN - - /* Recupera los embalajes que han caido en el cliente 31 */ - - DECLARE done BOOL DEFAULT FALSE; +/** + * Genera nuevos tickets de embalajes para los clientes no han los han retornado + * y actualiza los valores para la tabla ticketPackaging + * + * @param vDated Fecha hasta la cual se revisan los embalajes + * @param vCompanyFk Empresa de la cual se comprobaran sus clientes + * @param vWithoutPeriodGrace si no se aplica el periodo de gracia de un mes + */ + DECLARE vNewTicket INT; + DECLARE vDateStart DATE; + DECLARE vDateEnd DATE; + DECLARE vGraceDate DATE DEFAULT vDated; + DECLARE vWarehouseInventory INT; + DECLARE vComponentCost INT; + DECLARE vDone INT 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 vCursor CURSOR FOR + SELECT DISTINCT clientFk + FROM ( + SELECT clientFk, SUM(quantity) totalQuantity + FROM tmp.packagingToInvoice + GROUP BY itemFk, clientFk + HAVING totalQuantity > 0)sub; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - OPEN rs; + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; - FETCH rs INTO vTicketFk, vClientFk, vWarehouseFk, vShipped, vCompanyFk; + SELECT id INTO vWarehouseInventory + FROM warehouse + WHERE `code`= 'inv'; - WHILE NOT done DO + SELECT id INTO vComponentCost + FROM component + WHERE `code`= 'purchaseValue'; - CALL vn.ticket_add(vClientFk, - vShipped, - vWarehouseFk, - vCompanyFk, - NULL, - NULL, - NULL, - vShipped, - account.userGetId(), - TRUE, - vTicketNewFk); + SELECT packagingInvoicingDated INTO vDateStart + FROM ticketConfig; - UPDATE vn.ticketPackaging set ticketFk = vTicketNewFk WHERE ticketFk = vTicketFk; + IF vWarehouseInventory IS NULL THEN + CALL util.throw('Warehouse inventory not set'); + END IF; - CALL vn.ticketStateUpdate(vTicketNewFk, 'DELIVERED'); + IF vComponentCost IS NULL THEN + CALL util.throw('Component cost not set'); + END IF; - INSERT INTO vn.sale(ticketFk, itemFk, concept) VALUES(vTicketNewFk,90,CONCAT('Embalajes ',vTicketFk)); - - FETCH rs INTO vTicketFk, vClientFk, vWarehouseFk, vShipped, vCompanyFk; + SET vDateEnd = vDated + INTERVAL 1 DAY; - END WHILE; + IF NOT vWithoutPeriodGrace THEN + SET vGraceDate = vGraceDate -INTERVAL 1 MONTH; + END IF; - CLOSE rs; + DROP TEMPORARY TABLE IF EXISTS tmp.packagingToInvoice; + CREATE TEMPORARY TABLE tmp.packagingToInvoice + (INDEX (clientFk)) + ENGINE = MEMORY + SELECT p.itemFk, + tp.packagingFk, + tp.quantity, + tp.ticketFk, + p.price, + t.clientFk + FROM ticketPackaging tp + JOIN packaging p ON p.id = tp.packagingFk + JOIN ticket t ON t.id = tp.ticketFk + JOIN client c ON c.id = t.clientFk + WHERE c.isActive + AND t.shipped BETWEEN vDateStart AND vDateEnd + AND (tp.quantity < 0 OR (tp.quantity > 0 AND t.shipped < vGraceDate)) + AND tp.quantity + AND p.itemFk; + OPEN vCursor; + l: LOOP + + FETCH vCursor INTO vClientFk; + + IF vDone THEN + LEAVE l; + END IF; + + START TRANSACTION; + + CALL ticket_add( + vClientFk, + vDateEnd, + vWarehouseInventory, + vCompanyFk, + NULL, + NULL, + NULL, + vDateEnd, + account.myUser_getId(), + TRUE, + vNewTicket); + + INSERT INTO ticketPackaging(ticketFk, packagingFk, quantity, pvp) + SELECT vNewTicket, packagingFk, - SUM(quantity) totalQuantity, price + FROM tmp.packagingToInvoice + WHERE clientFk = vClientFk + GROUP BY packagingFk + HAVING IF(vWithoutPeriodGrace, totalQuantity <> 0, totalQuantity < 0); + + INSERT INTO sale(ticketFk, itemFk, concept, quantity, price) + SELECT vNewTicket, pti.itemFk, i.name, SUM(pti.quantity) totalQuantity, pti.price + FROM tmp.packagingToInvoice pti + JOIN item i ON i.id = pti.itemFk + WHERE pti.clientFk = vClientFk + GROUP BY pti.itemFk + HAVING IF(vWithoutPeriodGrace, totalQuantity <> 0, totalQuantity > 0); + + INSERT INTO saleComponent(saleFk, componentFk, value) + SELECT id, vComponentCost, price + FROM sale + WHERE ticketFk = vNewTicket; + + COMMIT; + END LOOP; + CLOSE vCursor; + + DROP TEMPORARY TABLE tmp.packagingToInvoice; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -80681,37 +68482,37 @@ DELIMITER ; 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) + + 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 + + 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 + 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 @@ -80728,9 +68529,9 @@ BEGIN AND ( ( IFNULL(tc.collectionFk,-1) != IFNULL(@vCollectionFk,0) AND tp.created < vParked ) OR - ( tc.collectionFk = vCollectionFk + ( 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))) + 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 @@ -80738,7 +68539,7 @@ BEGIN (s.alertLevel > 1 AND tp.parkingFk = vParkingFk AND sc.isPackagingArea - AND tp.created < vParked + AND tp.created < vParked AND t.packages <=> 0); END ;; DELIMITER ; @@ -80746,6 +68547,37 @@ 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 `ticketRefund_beforeUpsert` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketRefund_beforeUpsert`(vRefundTicketFk INT, vOriginalTicketFk INT) +BEGIN + DECLARE vAlreadyExists BOOLEAN DEFAULT FALSE; + + IF vRefundTicketFk = vOriginalTicketFk THEN + CALL util.throw('Original ticket and refund ticket has same id'); + END IF; + + SELECT COUNT(*) INTO vAlreadyExists + FROM ticketRefund + WHERE originalTicketFk = vOriginalTicketFk; + + 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 DROP PROCEDURE IF EXISTS `ticketRequest_Add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -80759,11 +68591,11 @@ 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, + INSERT INTO vn.ticketRequest(description, + quantity, + price, + ticketFk, + buyerCode, requesterFk) VALUES(vDescription, vQuantity, @@ -80771,181 +68603,6 @@ BEGIN 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 ; @@ -80965,26 +68622,26 @@ DELIMITER ; 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 + + 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 ;; @@ -81005,26 +68662,26 @@ DELIMITER ; 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 + 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) + + IF !(vStateCode = 'ON_CHECKING' AND vAlertLevel > 1) THEN + + INSERT INTO ticketTracking(stateFk, ticketFk, workerFk) SELECT id, vTicketFk, account.myUser_getId() - FROM vn.state - WHERE `code` = vStateCode collate utf8_unicode_ci; - - END IF; + FROM vn.state + WHERE `code` = vStateCode collate utf8_unicode_ci; + + END IF; END ;; DELIMITER ; @@ -81126,202 +68783,38 @@ BEGIN DECLARE vCountry INT; DECLARE vTaxArea VARCHAR(15); DECLARE vSpainCountryCode INT DEFAULT 1; - - SELECT id - INTO vInvoice - FROM vn.invoiceOut + + SELECT id + INTO vInvoice + FROM vn.invoiceOut WHERE ref = vInvoiceRef; - - SELECT s.countryFk + + 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 + 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.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 + 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, util.VN_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 > util.VN_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 */ ; @@ -81354,120 +68847,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 `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 */ ; @@ -81479,45 +68858,59 @@ DELIMITER ; /*!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) + 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'); + DECLARE vPrice DECIMAL(10,2); + DECLARE vBonus DECIMAL(10,2); + DECLARE vIsActive BOOL; + DECLARE vNickname VARCHAR(100); + DECLARE vNewInstance JSON; + + IF vClientId IS NULL THEN + CALL util.throw ('CLIENT_NOT_ESPECIFIED'); + END IF; + + SELECT isActive INTO vIsActive + FROM vn.client + WHERE id = vClientId; + + IF NOT vIsActive THEN + CALL util.throw ('CLIENT_NOT_ACTIVE'); END IF; IF NOT vAddressFk OR vAddressFk IS NULL THEN - SELECT id INTO vAddressFk - FROM address - WHERE clientFk = vClientId AND isDefaultAddress; - END IF; - + 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 + + SELECT zoneFk, price, bonus + INTO vZoneFk, vPrice, vBonus FROM tmp.zoneGetShipped - WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1; - + 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'); + CALL util.throw ('NOT_ZONE_WITH_THIS_PARAMETERS'); END IF; END IF; + INSERT INTO ticket ( clientFk, shipped, @@ -81528,48 +68921,65 @@ BEGIN routeFk, companyFk, landed, - zoneFk, - zonePrice, - zoneBonus + zoneFk, + zonePrice, + zoneBonus ) - SELECT - vClientId, - vShipped, - a.id, - vAgencyModeFk, - a.nickname, - vWarehouseFk, - IF(vRouteFk,vRouteFk,NULL), - vCompanyFk, - vlanded, - vZoneFk, - vPrice, - vBonus + 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; + SELECT a.nickname INTO vNickname + FROM address a + WHERE a.id = vAddressFk; + SET vNewTicket = LAST_INSERT_ID(); + SET vNewInstance = JSON_OBJECT( + 'clientFk', vClientId, + 'shipped', vShipped, + 'addressFk', vAddressFk, + 'agencyModeFk', vAgencyModeFk, + 'nickname', vNickname, + 'warehouseFk', vWarehouseFk, + 'routeFk', vRouteFk, + 'companyFk', vCompanyFk, + 'landed', vlanded, + 'zoneFk', vZoneFk, + 'zonePrice', vPrice, + 'zoneBonus', vBonus + ); + CALL util.log_addWithUser('vn', 'ticket', + 'Ticket', vNewTicket, vNewTicket, 'insert', NULL, vNewInstance, vUserId); + 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 - + + 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) + INSERT INTO ticketTracking(stateFk, ticketFk, workerFk) SELECT id, vNewTicket, account.myUser_getId() FROM state WHERE `code` = 'DELIVERED'; @@ -81592,20 +69002,20 @@ DELIMITER ; 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 + 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 + 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 */ ; @@ -81616,26 +69026,25 @@ 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 character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canAdvance`(vDated DATE, vWarehouseFk INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canAdvance`(vDateFuture DATE, vDateToAdvance 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 vDateFuture Fecha de los tickets que se quieren adelantar. + * @param vDateToAdvance Fecha a cuando se quiere adelantar. * @param vWarehouseFk Almacén */ - DECLARE vDateInventory DATE; - DECLARE vDateToAdvance DATE; - SELECT inventoried INTO vDateInventory FROM vn.config; - - SET vDateToAdvance = TIMESTAMPADD(DAY,-1,vDated); + DECLARE vDateInventory DATE; + + SELECT inventoried INTO vDateInventory FROM config; DROP TEMPORARY TABLE IF EXISTS tmp.stock; CREATE TEMPORARY TABLE tmp.stock @@ -81647,57 +69056,102 @@ BEGIN SELECT itemFk, SUM(quantity) amount FROM ( SELECT itemFk, quantity - FROM vn.itemTicketOut + FROM itemTicketOut WHERE shipped >= vDateInventory - AND shipped < vDated + AND shipped < vDateFuture AND warehouseFk = vWarehouseFk UNION ALL SELECT itemFk, quantity - FROM vn.itemEntryIn + FROM itemEntryIn WHERE landed >= vDateInventory - AND landed < vDated + AND landed < vDateFuture AND isVirtualStock = FALSE AND warehouseInFk = vWarehouseFk UNION ALL SELECT itemFk, quantity - FROM vn.itemEntryOut - WHERE shipped >= vDateInventory - AND shipped < vDated + FROM itemEntryOut + WHERE shipped >= vDateInventory + AND shipped < vDateFuture 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 IF EXISTS tmp.filter; + CREATE TEMPORARY TABLE tmp.filter + (INDEX (id)) + + SELECT + origin.ticketFk futureId, + dest.ticketFk id, + dest.state, + origin.futureState, + origin.futureIpt, + dest.ipt, + origin.workerFk, + origin.futureLiters, + origin.futureLines, + dest.shipped, + origin.shipped futureShipped, + dest.totalWithVat, + origin.totalWithVat futureTotalWithVat, + dest.agency, + origin.futureAgency, + dest.lines, + dest.liters, + origin.futureLines - origin.hasStock AS notMovableLines, + (origin.futureLines = origin.hasStock) AS isFullMovable + FROM ( + SELECT + s.ticketFk, + t.workerFk, + t.shipped, + t.totalWithVat, + st.name futureState, + t.addressFk, + am.name futureAgency, + count(s.id) futureLines, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt, + CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters, + SUM((s.quantity <= IFNULL(st.amount,0))) hasStock + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN saleVolume sv ON sv.saleFk = s.id + JOIN item i ON i.id = s.itemFk + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN state st ON st.id = ts.stateFk + JOIN agencyMode am ON t.agencyModeFk = am.id + LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + LEFT JOIN tmp.stock st ON st.itemFk = i.id + WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture) + AND t.warehouseFk = vWarehouseFk + GROUP BY t.id + ) origin + JOIN ( + SELECT + t.id ticketFk, + t.addressFk, + st.name state, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt, + t.shipped, + t.totalWithVat, + am.name agency, + CAST(SUM(litros) AS DECIMAL(10,0)) liters, + CAST(COUNT(*) AS DECIMAL(10,0)) `lines` + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN saleVolume sv ON sv.saleFk = s.id + JOIN item i ON i.id = s.itemFk + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN state st ON st.id = ts.stateFk + JOIN agencyMode am ON t.agencyModeFk = am.id + LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + WHERE t.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance) + AND t.warehouseFk = vWarehouseFk + AND st.order <= 5 + GROUP BY t.id + ) dest ON dest.addressFk = origin.addressFk + WHERE origin.hasStock != 0; + DROP TEMPORARY TABLE tmp.stock; END ;; DELIMITER ; @@ -81705,133 +69159,161 @@ 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_canbePostponed` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vWarehouseFk INT) +BEGIN +/** + * Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro + * + * @param vOriginDated Fecha en cuestión + * @param vFutureDated Fecha en el futuro a sondear + * @param vWarehouseFk Identificador de vn.warehouse + */ + DROP TEMPORARY TABLE IF EXISTS tmp.filter; + CREATE TEMPORARY TABLE tmp.filter + (INDEX (id)) + SELECT sv.ticketFk id, + sub2.id futureId, + 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.iptd futureIpt, + sub2.state futureState, + t.clientFk, + t.warehouseFk, + ts.alertLevel, + t.shipped, + sub2.shipped futureShipped, + t.workerFk, + st.code stateCode, + sub2.code futureStateCode + 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, + st.code code, + 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 vFutureDated + AND util.dayend(vFutureDated) + 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 vOriginDated AND util.dayend(vOriginDated) + AND t.warehouseFk = vWarehouseFk + AND al.code = 'FREE' + AND tp.ticketFk IS NULL + GROUP BY sv.ticketFk + HAVING futureId; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_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 character_set_client = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = '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`, + 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 + 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 + 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 + 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.alertLevel al ON al.id = st.alertLevel + 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 + AND al.code = 'FREE' + 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; - + GROUP BY sv.ticketFk + HAVING liters <= vLitersMax + AND `lines` <= vLinesMax + AND ticketFuture; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -81850,35 +69332,25 @@ DELIMITER ; 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; - + 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; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -81898,35 +69370,36 @@ 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 + * 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 + 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 (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 >= util.VN_CURDATE() + LEFT JOIN (SELECT tc.collectionFk + FROM ticketCollection tc + WHERE ticketFk = vTicketFk + AND tc.created >= util.VN_CURDATE() )sub ON sub.collectionFk = tc.collectionFk - WHERE ts.workerFk = vWorkerFk - AND sub.collectionFk IS NULL - AND tc.created >= util.VN_CURDATE() + WHERE ts.workerFk = vWorkerFk + AND sub.collectionFk IS NULL + AND tc.created >= util.VN_CURDATE() GROUP BY tc.collectionFk - )sub ON sub.collectionFk = 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') + JOIN state s2 ON s2.id = ts.stateFk + WHERE s2.code IN ('ON_PREPARATION', 'PREPARED', 'PREVIOUS_PREPARATION', 'OK PREVIOUS') AND t.shipped >= util.VN_CURDATE() AND s.quantity <>0 LIMIT 1; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -81949,7 +69422,7 @@ BEGIN /** * Comprueba que los tickets entre un rango de fechas tienen componentes * - * @param vShippedFrom rango inicial de fecha + * @param vShippedFrom rango inicial de fecha * @param vShippedTo rango final de fecha */ DECLARE v_done BOOL DEFAULT FALSE; @@ -81968,9 +69441,9 @@ BEGIN AND clt.isActive != 0 AND ic.merchandise != 0 GROUP BY s.id; - + DECLARE CONTINUE HANDLER FOR NOT FOUND - SET v_done = TRUE; + SET v_done = TRUE; DROP TEMPORARY TABLE IF EXISTS tmp.coste; @@ -81989,7 +69462,7 @@ BEGIN JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 1 WHERE t.shipped >= vShippedFrom AND ic.merchandise != 0; - + OPEN vCur; l: LOOP @@ -82003,8 +69476,8 @@ BEGIN CALL sale_calculateComponent(vSaleFk, 1); END LOOP; - CLOSE vCur; - DROP TEMPORARY TABLE tmp.coste; + CLOSE vCur; + DROP TEMPORARY TABLE tmp.coste; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -82028,7 +69501,7 @@ BEGIN * * @param vOriginalTicket ticket Original * @param vNewTicket ticket creado - */ + */ DECLARE vStateFk INT; INSERT INTO ticket ( @@ -82041,11 +69514,11 @@ BEGIN companyFk, landed, zoneFk, - zonePrice, - zoneBonus, - routeFk, - priority, - hasPriority + zonePrice, + zoneBonus, + routeFk, + priority, + hasPriority ) SELECT clientFk, @@ -82061,31 +69534,31 @@ BEGIN zoneBonus, routeFk, priority, - hasPriority + 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', + SET originFk = vNewTicket, 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; + INSERT INTO ticketLog + SET originFk = vOriginalTicket, userFk = account.myUser_getId(), `action` = 'insert', + description = CONCAT('Ha creado el ticket:', ' ', vNewTicket, ' clonando el ', vOriginalTicket); + + INSERT INTO ticketTracking(ticketFk, stateFk, workerFk, created) + SELECT vNewTicket, stateFk, workerFk , created + FROM ticketTracking + WHERE ticketFk = vOriginalTicket + ORDER BY created; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -82116,16 +69589,16 @@ BEGIN 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 + 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(util.VN_CURDATE()) + IF(vWeek < WEEK(util.VN_CURDATE()),1, 0); - + OPEN rsTicket; myLoop: LOOP BEGIN @@ -82141,7 +69614,7 @@ BEGIN LEAVE myLoop; END IF; - SELECT dated INTO vShipment + SELECT dated INTO vShipment FROM `time` WHERE `year` = vYear AND `week` = vWeek AND WEEKDAY(dated) = vWeekDay; @@ -82152,52 +69625,52 @@ BEGIN 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 + 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 + 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, + vClientFk, + vShipment, + vWarehouseFk, + vCompanyFk, + vAddressFk, + vAgencyModeFk, + NULL, + vLanding, + account.myUser_getId(), + 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, + 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 + FROM vn.mail + WHERE receiver = vSalesPersonEmail AND subject = vSubject; IF NOT vMailSent THEN @@ -82205,37 +69678,37 @@ BEGIN 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; - + FROM vn.sale saleOrig + WHERE saleOrig.ticketFk = vTicketFk; + INSERT IGNORE INTO vn.saleCloned(saleOriginalFk, saleClonedFk) - SELECT saleOriginal.id, saleClon.id + 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) + total,buyed,requesterFk,attenderFk,ticketFk) SELECT description,ordered,shipped,quantity,price,itemFk,clientFk,response, - total,buyed,requesterFk,attenderFk,vNewTicket + 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),' '); - + 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),' '); - + 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 */ ; @@ -82255,7 +69728,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_close`() BEGIN /** - * Realiza el cierre de todos los + * Realiza el cierre de todos los * tickets de la tabla tmp.ticket_close. * * @table tmp.ticket_close(ticketFk) Identificadores de los tickets a cerrar @@ -82273,7 +69746,7 @@ BEGIN 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; @@ -82283,7 +69756,7 @@ BEGIN proc: LOOP SET vDone = FALSE; - + FETCH cur INTO vCurTicketFk; IF vDone THEN @@ -82301,12 +69774,12 @@ BEGIN c.hasToInvoice INTO vClientFk, vIsTaxDataChecked, - vCompanyFk, + vCompanyFk, vShipped, vHasDailyInvoice, vWithPackage, vHasToInvoice - FROM ticket t + 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 @@ -82315,22 +69788,22 @@ BEGIN INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity) (SELECT vCurTicketFk, p.id, COUNT(*) - FROM expedition e - JOIN packaging p ON p.itemFk = e.itemFk + FROM expedition e + JOIN packaging p ON p.itemFk = e.freightItemFk 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 + INSERT INTO sale (itemFk, ticketFk, concept, quantity, price, isPriceFixed) + (SELECT e.freightItemFk, vCurTicketFk, i.name, COUNT(*) AS amount, getSpecialPrice(e.freightItemFk, vClientFk), 1 + FROM expedition e + JOIN item i ON i.id = e.freightItemFk 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); - + AND getSpecialPrice(e.freightItemFk, vClientFk) > 0 + GROUP BY e.freightItemFk); + IF(vHasDailyInvoice) AND vHasToInvoice THEN -- Facturacion rapida @@ -82338,10 +69811,10 @@ BEGIN -- Facturar si está contabilizado IF vIsTaxDataChecked THEN CALL invoiceOut_newFromClient( - vClientFk, - (SELECT invoiceSerial(vClientFk, vCompanyFk, 'M')), - vShipped, - vCompanyFk, + vClientFk, + (SELECT invoiceSerial(vClientFk, vCompanyFk, 'M')), + vShipped, + vCompanyFk, NULL, NULL, vNewInvoiceId); @@ -82358,133 +69831,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 `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 */ ; @@ -82497,31 +69843,28 @@ DELIMITER ; 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 + SELECT t.id AS ticketFk - FROM expedition e - INNER JOIN ticket t ON t.id = e.ticketFk + FROM ticket t + JOIN agencyMode am ON am.id = t.agencyModeFk 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 + JOIN alertLevel al ON al.id = ts.alertLevel + WHERE al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered') + AND t.id = vTicketFk AND t.refFk IS NULL - GROUP BY e.ticketFk); - + GROUP BY t.id); + CALL ticket_close(); - DROP TEMPORARY TABLE tmp.ticket_close; + DROP TEMPORARY TABLE tmp.ticket_close; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -82545,11 +69888,11 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_componentMakeUpdate`(IN vTic 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 @@ -82564,29 +69907,29 @@ BEGIN * @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 + + 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 + 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 + SET t.clientFk = vClientFk, t.nickname = vNickname, t.agencyModeFk = vAgencyModeFk, @@ -82601,12 +69944,12 @@ BEGIN 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 @@ -82644,7 +69987,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_componentPreview`( vTicketFk INT, - vLanded DATE, + vLanded DATE, vAddressFk INT, vZoneFk INT, vWarehouseFk SMALLINT) @@ -82660,7 +70003,7 @@ BEGIN * * @return tmp.ticketComponentPreview (warehouseFk, itemFk, componentFk, cost) */ - DECLARE vHasDataChanged BOOL DEFAULT FALSE; + DECLARE vHasDataChanged BOOL DEFAULT FALSE; DECLARE vHasAddressChanged BOOL; DECLARE vHasZoneChanged BOOL DEFAULT FALSE; DECLARE vHasWarehouseChanged BOOL DEFAULT FALSE; @@ -82671,8 +70014,8 @@ BEGIN DECLARE vHasChangeAll BOOL DEFAULT FALSE; - SELECT DATE(landed) <> vLanded, - addressFk <> vAddressFk, + SELECT DATE(landed) <> vLanded, + addressFk <> vAddressFk, zoneFk <> vZoneFk, warehouseFk <> vWarehouseFk INTO @@ -82695,15 +70038,15 @@ BEGIN SET vAgencyModeTypeRateFk = 6; END IF; - SELECT TIMESTAMPADD(DAY, -travelingDays, vLanded) INTO vShipped + 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 + CREATE TEMPORARY TABLE tmp.ticketLot ENGINE = MEMORY ( + SELECT vWarehouseFk AS warehouseFk, NULL AS available, s.itemFk, @@ -82723,9 +70066,9 @@ BEGIN 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 + WHERE s.ticketFk = vTicketFk + AND (c.isRenewable = FALSE + OR (NOT vHasChangeAll AND (NOT (c.typeFk <=> vAddressTypeRateFk OR c.typeFk <=> vAgencyModeTypeRateFk)))); @@ -82746,213 +70089,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 `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 < util.VN_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 */ ; @@ -82965,7 +70101,7 @@ DELIMITER ; 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; @@ -82978,7 +70114,7 @@ BEGIN CREATE TEMPORARY TABLE tmp.ticket SELECT ticketFk FROM tmp.productionBuffer - WHERE shipped = curdate() + WHERE shipped = util.VN_CURDATE() AND problem LIKE '%I:%' AND (HH <= vHour OR HH = vHour AND mm < vMinute) AND alertLevel = 0; @@ -82986,19 +70122,19 @@ BEGIN 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 */ ; @@ -83017,52 +70153,52 @@ DELIMITER ; 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 + 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 + 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 + + 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 ;; @@ -83086,39 +70222,34 @@ proc: BEGIN /** * Recalculates modified ticket. */ - DECLARE vDone BOOL; DECLARE vTicketFk INT; DECLARE vError INT; DECLARE cCur CURSOR FOR - SELECT ticketFk FROM ticketRecalc; + SELECT DISTINCT ticketFk FROM tTicket; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION - 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; + SET vError = IFNULL(@errno, 0); + RESIGNAL; END; IF !GET_LOCK('vn.ticket_doRecalc', 0) THEN LEAVE proc; END IF; + DROP TEMPORARY TABLE IF EXISTS tTicket; + CREATE TEMPORARY TABLE tTicket + ENGINE = MEMORY + SELECT id, ticketFk FROM ticketRecalc; + OPEN cCur; myLoop: LOOP @@ -83129,27 +70260,15 @@ proc: BEGIN 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; + CALL ticket_recalc(vTicketFk); END LOOP; CLOSE cCur; + + DELETE tr FROM ticketRecalc tr JOIN tTicket t ON tr.id = t.id; + + DROP TEMPORARY TABLE tTicket; + DO RELEASE_LOCK('vn.ticket_doRecalc'); END ;; DELIMITER ; @@ -83161,48 +70280,70 @@ 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 `ticket_doRefund`(IN vOriginTicket INT, OUT vNewTicket INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_doRefund`(OUT vNewTicket INT) BEGIN - +/** + * Crea un ticket de abono a partir de tmp.sale y/o tmp.ticketService + * + * @return vNewTicket + */ DECLARE vDone BIT DEFAULT 0; - DECLARE vCustomer MEDIUMINT; + DECLARE vClientFk 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 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 + DECLARE vSaleMain INT; + DECLARE vZoneFk INT; + DECLARE vDescription VARCHAR(50); + DECLARE vTaxClassFk INT; + DECLARE vTicketServiceTypeFk INT; + DECLARE vOriginTicket INT; + + DECLARE cSales CURSOR FOR + SELECT s.id, s.itemFk, - s.quantity, s.concept, s.price, s.discount + FROM tmp.sale s; + + DECLARE cTicketServices CURSOR FOR + SELECT ts.description, - ts.quantity, ts.price, ts.taxClassFk, ts.ticketServiceTypeFk + FROM tmp.ticketService ts; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + SELECT sub.ticketFk INTO vOriginTicket + FROM ( + SELECT s.ticketFk + FROM tmp.sale s + UNION ALL + SELECT ts.ticketFk + FROM tmp.ticketService ts + ) sub + LIMIT 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 + SELECT clientFk, warehouseFk, companyFk, addressFk + INTO vClientFk, vWarehouse, vCompany, vAddress + FROM ticket + WHERE id = vOriginTicket; + + SELECT id INTO vZoneFk FROM zone WHERE agencyModeFk = vRefundAgencyMode - LIMIT 1; - + LIMIT 1; + INSERT INTO vn.ticket ( clientFk, shipped, @@ -83212,47 +70353,57 @@ BEGIN warehouseFk, companyFk, landed, - zoneFk + zoneFk ) SELECT - vCustomer, - util.VN_CURDATE(), - vAddress, - vRefundAgencyMode, - a.nickname, - vWarehouse, - vCompany, - util.VN_CURDATE(), - vZoneFk + vClientFk, + util.VN_CURDATE(), + vAddress, + vRefundAgencyMode, + a.nickname, + vWarehouse, + vCompany, + util.VN_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; + SET vDone := FALSE; + OPEN cSales; + FETCH cSales 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; - + + SET vSaleNew = LAST_INSERT_ID(); + + INSERT INTO vn.saleComponent(saleFk,componentFk,`value`) + SELECT vSaleNew,componentFk,`value` + FROM vn.saleComponent + WHERE saleFk = vSaleMain; + + FETCH cSales INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount; END WHILE; - CLOSE vRsMainTicket; + CLOSE cSales; + + SET vDone := FALSE; + OPEN cTicketServices; + FETCH cTicketServices INTO vDescription, vQuantity, vPrice, vTaxClassFk, vTicketServiceTypeFk; + + WHILE NOT vDone DO + INSERT INTO vn.ticketService(description, quantity, price, taxClassFk, ticketFk, ticketServiceTypeFk) + VALUES(vDescription, vQuantity, vPrice, vTaxClassFk, vNewTicket, vTicketServiceTypeFk); + + FETCH cTicketServices INTO vDescription, vQuantity, vPrice, vTaxClassFk, vTicketServiceTypeFk; + END WHILE; + + CLOSE cTicketServices; INSERT INTO vn.ticketRefund(refundTicketFk, originalTicketFk) VALUES(vNewTicket, vOriginTicket); - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -83265,45 +70416,69 @@ 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_getFromFloramondo`(vDateFrom DATE, vDateTo DATE) BEGIN - /** - * Genera una tabla con la lista de tickets de Floramondo para una fecha determinada + * 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) + * @table tmp.ticketFloramondo(ticketFk, clientName, agencyName, + * agencyModeFk, supplierName, supplierFk, freight, expeditionCount, + * margin, trolleys, pallets, shipped, created) */ - DROP TEMPORARY TABLE IF EXISTS tmp.ticketFloramondo; CREATE TEMPORARY TABLE tmp.ticketFloramondo (ticketFk INT PRIMARY KEY, clientName VARCHAR(50), agencyName VARCHAR(50), + agencyModeFk INT, + supplierName VARCHAR(50), + supplierFk INT, freight DECIMAL(10,2) DEFAULT 0, expeditionCount INT, margin DECIMAL(10,3) DEFAULT 0, trolleys INT DEFAULT 0, + pallets INT DEFAULT 0, shipped DATE, - pallets INT DEFAULT 0) + created DATE) ENGINE = MEMORY; - - INSERT INTO tmp.ticketFloramondo(ticketFk, clientName, agencyName, shipped) - SELECT t.id ticketFk, t.nickname , am.name, t.shipped + + INSERT INTO tmp.ticketFloramondo(ticketFk, + clientName, + agencyName, + agencyModeFk, + shipped, + supplierName, + supplierFk, + created) + SELECT t.id ticketFk, + t.nickname, + am.name, + am.id, + t.shipped, + s.name, + sat.supplierFk, + t.created 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); - + JOIN vn.warehouse w ON w.id = t.warehouseFk + AND w.code IN ('VNH','FLM') + AND t.shipped BETWEEN vDateFrom AND util.dayend(vDateTo) + JOIN vn.agency a ON a.id = am.agencyFk + LEFT JOIN vn.supplierAgencyTerm sat ON sat.agencyFk = a.id + LEFT JOIN vn.supplier s ON s.id = sat.supplierFk; + 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 @@ -83323,7 +70498,7 @@ BEGIN 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 @@ -83331,7 +70506,7 @@ BEGIN 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, @@ -83344,17 +70519,17 @@ BEGIN 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 + JOIN vn.packaging p ON p.id = tp.packagingFk WHERE p.isTrolley - GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk + 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 @@ -83364,12 +70539,11 @@ BEGIN 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 */ ; @@ -83386,7 +70560,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ticket_getMovable`(vTicketFk INT, vDatedNew DATETIME, vWarehouseFk INT) +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 @@ -83396,37 +70570,37 @@ BEGIN * @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 + FROM ticket t WHERE t.id = vTicketFk; - CALL itemStock(vWarehouseFk, vDatedNew, NULL); + 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, + + SELECT s.id, + s.itemFk, + s.quantity, + s.concept, + s.price, s.reserved, - s.discount, - i.image, - i.subName, + 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 + 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; - + DROP TEMPORARY TABLE IF EXISTS tmp.itemMinacum; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -83455,16 +70629,15 @@ BEGIN CALL sale_getProblems(vIsTodayRelative); DROP TEMPORARY TABLE IF EXISTS tmp.ticket_problems; - CREATE TEMPORARY TABLE tmp.ticket_problems + CREATE TEMPORARY TABLE tmp.ticket_problems (PRIMARY KEY (ticketFk)) ENGINE = MEMORY - SELECT + 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, @@ -83476,12 +70649,11 @@ BEGIN GROUP BY ticketFk; UPDATE tmp.ticket_problems tp - SET tp.totalProblems = + SET tp.totalProblems = ( (tp.isFreezed) + IF(tp.risk, TRUE, FALSE) + (tp.hasTicketRequest) + - (tp.isAvailable = 0) + (tp.isTaxDataChecked = 0) + (tp.hasComponentLack) + (tp.itemDelay) + @@ -83498,85 +70670,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 `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 */ ; @@ -83609,17 +70702,17 @@ BEGIN (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 + 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 + 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 @@ -83629,16 +70722,16 @@ BEGIN AND t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_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 + 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 + 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 @@ -83648,7 +70741,7 @@ BEGIN AND t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_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 @@ -83658,7 +70751,7 @@ BEGIN 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 + 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 @@ -83669,7 +70762,7 @@ BEGIN AND t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND NOT i.generic AND t.warehouseFk = vWarehouseFk; - + DROP TEMPORARY TABLE IF EXISTS tmp.ticketsToSplit; CREATE TEMPORARY TABLE tmp.ticketsToSplit @@ -83690,11 +70783,11 @@ BEGIN 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 + LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk GROUP BY ss.ticketFk; - - SELECT - ts.*, + + SELECT + ts.*, t.id ticketFuture, st.name state, zc.`hour` tfEtd, @@ -83703,23 +70796,23 @@ BEGIN 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 + 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.ticketState tst ON tst.ticketFk = t.id LEFT JOIN vn.state st2 ON st2.id = tst.stateFk - WHERE (t.id IS NULL + WHERE (t.id IS NULL OR (vDated > util.VN_CURDATE()) OR (vDated = util.VN_CURDATE() AND vHour >= zc.`hour`)) AND ts.etd <= vHour GROUP BY ts.ticketFk, t.id ORDER BY ts.etd, ts.ticketFk; - - DROP TEMPORARY TABLE + + DROP TEMPORARY TABLE tmp.ticketsToSplit; END ;; DELIMITER ; @@ -83756,7 +70849,7 @@ BEGIN JOIN ticket t ON t.id = tmpTicket.ticketFk; CALL addressTaxArea (); - + IF vTaxArea > '' THEN UPDATE tmp.addressTaxArea SET areaFk = vTaxArea; @@ -83828,8 +70921,8 @@ BEGIN CREATE TEMPORARY TABLE tmp.ticketAmount (INDEX (ticketFk)) ENGINE = MEMORY - SELECT ticketFk, - taxableBase, + SELECT ticketFk, + taxableBase, SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax, code FROM tmp.ticketTax @@ -83843,118 +70936,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 `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 */ ; @@ -83973,24 +70954,24 @@ BEGIN DECLARE vAddressFk INT; DECLARE vAgencyModeFk INT; DECLARE vWarehouseFk INT; - DECLARE vCursor CURSOR FOR + 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 ; @@ -84010,23 +70991,23 @@ DELIMITER ; 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 + + UPDATE vn.sale s SET s.ticketFk = vTicketTargetFk WHERE s.ticketFk = vSelf; - - UPDATE vn.ticket t + + UPDATE vn.ticket t SET t.shipped = TIMESTAMPADD(YEAR, - YEAR(util.VN_NOW()) MOD 2000, t.shipped ) WHERE t.id = vSelf; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -84045,14 +71026,14 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_priceDifference`( vTicketFk INT, - vLanded DATE, + 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 @@ -84061,26 +71042,26 @@ BEGIN */ 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, + 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 + 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 + 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) + 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; @@ -84143,7 +71124,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalcComponents`(IN vTicket proc: BEGIN /** - * Este procedimiento recalcula los componentes de un ticket, + * Este procedimiento recalcula los componentes de un ticket, * eliminando los componentes existentes e insertandolos de nuevo * * @param vTicketFk Id del ticket @@ -84155,7 +71136,7 @@ proc: BEGIN 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 @@ -84163,10 +71144,10 @@ proc: BEGIN WHERE id = vTicketFk; END IF; - SELECT t.warehouseFk, - t.shipped, - t.addressFk, - t.agencyModeFk, + SELECT t.warehouseFk, + t.shipped, + t.addressFk, + t.agencyModeFk, t.landed, t.zoneFk INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded, vZoneFk @@ -84182,7 +71163,7 @@ proc: BEGIN IF vLanded IS NULL OR vZoneFk IS NULL THEN UPDATE ticket t - SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1) + SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1) WHERE t.id = vTicketFk AND t.landed IS NULL; IF vZoneFk IS NULL THEN @@ -84191,23 +71172,23 @@ proc: BEGIN 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); - + -- rellena la tabla buyUltimate con la ultima compra + CALL buyUltimate (vWarehouseFk, vShipped); + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE 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 + WHERE s.ticketFk = vTicketFk GROUP BY s.itemFk; - + CALL catalog_componentPrepare(); CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); @@ -84216,209 +71197,14 @@ proc: BEGIN (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)); - + 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, + DROP TEMPORARY TABLE + tmp.buyUltimate, tmp.sale; END ;; DELIMITER ; @@ -84430,11 +71216,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 `ticket_requestRecalc`(vSelf INT) proc: BEGIN @@ -84447,7 +71233,7 @@ proc: BEGIN LEAVE proc; END IF; - INSERT IGNORE INTO ticketRecalc SET ticketFk = vSelf; + INSERT INTO ticketRecalc SET ticketFk = vSelf; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -84476,16 +71262,69 @@ BEGIN SELECT stateFk INTO vStateFk FROM ticketState - WHERE ticketFk = vSelf; + WHERE ticketFk = vSelf; SELECT nextStateFk INTO vNewStateFk FROM state - WHERE id = vStateFk; + WHERE id = vStateFk; - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - VALUES (vNewStateFk, vSelf, account.myUser_getId()); + INSERT INTO ticketTracking(stateFk, ticketFk, workerFk) + VALUES (vNewStateFk, vSelf, 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 `ticket_setParking` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_setParking`(IN `vTicketFk` VARCHAR(8), IN `vParkingFk` INT) +proc: BEGIN +/** + * Aparca un ticket en un parking + * + * @param vTicketFk id del ticket + * @param vParkingFk id del parking + */ + DECLARE vDone INT DEFAULT FALSE; + DECLARE vCollectionTicketFk 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 = vTicketFk; - SELECT TRUE AS IsUpdated; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + 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 = vTicketFk + ON DUPLICATE KEY UPDATE parkingFk = vParkingFk; + + OPEN vCursor; + l: LOOP + FETCH vCursor INTO vCollectionTicketFk; + + IF vDone THEN + LEAVE l; + END IF; + + CALL vn.ticket_setNextState(vCollectionTicketFk); + END LOOP; + + CLOSE vCursor; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -84504,39 +71343,33 @@ DELIMITER ; 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; - + + SELECT MAX(id) INTO vControlFk + FROM ticketTracking + WHERE ticketFk = vTicketFk; + IF (SELECT s.code - FROM vn.state s - JOIN vncontrol.inter i ON i.state_id = s.id - WHERE i.inter_id = vControlFk) + FROM vn.state s + JOIN ticketTracking tt ON tt.stateFk = s.id + WHERE tt.id = vControlFk) = 'PREVIOUS_PREPARATION' THEN - - SELECT inter_id + SELECT 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; - + FROM ticketTracking tt + JOIN vn.state s ON tt.stateFk = s.id + WHERE ticketFk = vTicketFk + AND id < vControlFk + AND s.code != 'PREVIOUS_PREPARATION' + ORDER BY id DESC + LIMIT 1; + + INSERT INTO ticketTracking(stateFk, ticketFk, workerFk) + SELECT s.nextStateFk, tt.ticketFk, account.myUser_getId() + FROM ticketTracking tt + JOIN vn.state s ON tt.stateFk = s.id + WHERE id = vControlFk; + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -84553,31 +71386,41 @@ DELIMITER ; /*!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)) +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setState`(vSelf INT, vStateCode VARCHAR(255)) BEGIN - - /* Modifica el estado de un ticket - * - * @param vTicketFk el id del ticket - * @param vStateCode estado a modificar del ticket - * - */ - +/** + * Modifica el estado de un ticket si se cumplen las condiciones necesarias. + * + * @param vSelf el id del ticket + * @param vStateCode estado a modificar del ticket + */ DECLARE vAlertLevel INT; + DECLARE vCurrentStateCode VARCHAR(255); + DECLARE vCanChangeState BOOL; + DECLARE vPackedState 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; + SELECT s.alertLevel, s.`code` + INTO vAlertLevel, vCurrentStateCode + FROM state s + JOIN ticketState ts ON ts.stateFk = s.id + WHERE ts.ticketFk = vSelf; + + SELECT id INTO vPackedState + FROM alertLevel + WHERE code = 'PACKED'; + + SET vCanChangeState = (vStateCode <> 'ON_CHECKING' OR vAlertLevel < vPackedState) + AND NOT ( + vCurrentStateCode IN ('CHECKED', 'CHECKING') + AND vStateCode IN ('PREPARED', 'ON_PREPARATION') + ); + + IF vCanChangeState THEN + INSERT INTO ticketTracking(stateFk, ticketFk, workerFk) + SELECT id, vSelf, account.myUser_getId() + FROM state + WHERE `code` = vStateCode COLLATE utf8_unicode_ci; + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -84611,40 +71454,40 @@ proc:BEGIN SELECT COUNT(*) INTO vProblemLines FROM tmp.salesToSplit WHERE ticketFk = vTicketFk; - + SELECT count(*) INTO vTotalLines - FROM vn.sale s + FROM vn.sale s WHERE s.ticketFk = vTicketFk; - + SET vHasFullProblem = (vTotalLines = vProblemLines); -- Ticket completo IF vHasFullProblem THEN - + UPDATE vn.ticket - SET landed = vDated + 1, + SET landed = vDated + INTERVAL 1 DAY, shipped = vDated, - nickname = CONCAT('(',DAY(curdate()),') ', nickname ) + nickname = CONCAT('(',DAY(util.VN_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 + + 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, + + SELECT CONCAT("Se han movido lineas del ticket ", vTicketFk, " al ticket existente ", vTicketFutureFk,"(", vDated,")"); LEAVE proc; - + END IF; -- Ticket nuevo @@ -84652,21 +71495,22 @@ proc:BEGIN UPDATE vn.ticket t JOIN vn.productionConfig pc - SET t.landed = vDated + 1, + SET t.routeFk = IF(t.shipped = vDated , t.routeFk, NULL), + t.landed = vDated + INTERVAL 1 DAY, t.shipped = vDated, t.agencyModeFk = pc.defautlAgencyMode, - t.zoneFk = pc.defaultZone + t.zoneFk = pc.defaultZone WHERE t.id = vTicketFutureFk; - - UPDATE vn.sale s - JOIN tmp.salesToSplit sts ON sts.saleFk = s.id + + 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, + SELECT CONCAT("Se han movido lineas del ticket ", vTicketFk, " al nuevo ticket ", vTicketFutureFk,"(", vDated,")"); END ;; DELIMITER ; @@ -84684,119 +71528,109 @@ DELIMITER ; /*!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) +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_splitItemPackingType`(vTicketFk INT, vOriginalItemPackingTypeFk VARCHAR(1)) 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); - +/** + * Clona y reparte las ventas de un ticket en funcion del tipo de empaquetado. + * Respeta el id inicial para el tipo propuesto. + * + * @param vTicketFk Identificador de vn.ticket + * @param vOriginalItemPackingTypeFk Tipo para el que se reserva el número de ticket original + * @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk) + */ + DECLARE vItemPackingTypeFk VARCHAR(1) DEFAULT 'H'; 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 cur1 CURSOR FOR + SELECT itemPackingTypeFk + FROM tmp.saleGroup + WHERE itemPackingTypeFk IS NOT NULL + ORDER BY (itemPackingTypeFk = vOriginalItemPackingTypeFk) DESC; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + DELETE FROM vn.sale + WHERE quantity = 0 + AND ticketFk = vTicketFk; + DROP TEMPORARY TABLE IF EXISTS tmp.sale; CREATE TEMPORARY TABLE tmp.sale (PRIMARY KEY (id)) - SELECT s.id, i.itemPackingTypeFk , sv.litros + SELECT s.id, i.itemPackingTypeFk , IFNULL(sv.litros, 0) 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); - + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id + WHERE s.ticketFk = vTicketFk; + DROP TEMPORARY TABLE IF EXISTS tmp.saleGroup; CREATE TEMPORARY TABLE tmp.saleGroup SELECT itemPackingTypeFk , sum(litros) AS totalLitros FROM tmp.sale - GROUP BY itemPackingTypeFk; - + 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'); - + VALUES(vTicketFk, vItemPackingTypeFk); 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) + + 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 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 ts.itemPackingTypeFk IS NULL; END CASE; - + DROP TEMPORARY TABLE tmp.sale; DROP TEMPORARY TABLE tmp.saleGroup; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -84815,43 +71649,43 @@ DELIMITER ; 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 + FROM vn.ticket t JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk + 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 + JOIN vn.packagingConfig pc WHERE t.id = vTicketFk AND ( s.quantity MOD IFNULL(iss.packing,1) != 0 - OR + OR IFNULL(iss.packing,1) = 1 - OR + OR i.`size` <= pc.previousPreparationMinimumSize ); - - SELECT COUNT(*) + + SELECT COUNT(*) INTO vNeedToSplit - FROM tmpSale; - + FROM tmpSale; + IF vNeedToSplit THEN - + CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); - + UPDATE vn.sale s - JOIN vn.tmpSale ts ON ts.id = s.id + 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 */ ; @@ -84882,7 +71716,7 @@ BEGIN 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 @@ -84891,9 +71725,9 @@ BEGIN 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 @@ -84914,7 +71748,7 @@ BEGIN AND t.shipped BETWEEN vDated AND util.dayend(vDated) GROUP BY ib.ediBotanic, o.code; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -84933,22 +71767,20 @@ DELIMITER ; 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. + * 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, + (INDEX (departmentFk)) + SELECT dated, businessFk, - userFk, - departmentFk, + userFk, + departmentFk, hourStart, hourEnd, timeTable, @@ -84958,68 +71790,63 @@ BEGIN timeWorkSeconds timeBusinessSeconds, SEC_TO_TIME(timeWorkSeconds) timeBusinessSexagesimal, timeWorkSeconds / 3600 timeBusinessDecimal, - type, + name type, permissionRate, hoursWeek, discountRate, isAllowedToWork FROM(SELECT t.dated, - b.business_id businessFk, + b.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 , + b.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, + IF(j.start = NULL, 0, IFNULL(SUM(TIME_TO_SEC(j.end)) - SUM(TIME_TO_SEC(j.start)), 0)) timeWorkSeconds, + at2.name, + at2.permissionRate, + at2.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 + at2.isAllowedToWork + FROM time t + LEFT JOIN business b ON t.dated BETWEEN b.started AND IFNULL(b.ended, vDatedTo) + LEFT JOIN worker w ON w.id = b.workerFk 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 + LEFT JOIN workCenter wc ON wc.id = b.workcenterFK + LEFT JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = b.calendarTypeFk + LEFT JOIN postgresql.journey j ON j.business_id = b.id AND j.day_id = WEEKDAY(t.dated) + 1 + LEFT JOIN postgresql.calendar_employee ce ON ce.businessFk = b.id AND ce.date = t.dated + LEFT JOIN absenceType at2 ON at2.id = ce.calendar_state_id WHERE t.dated BETWEEN vDatedFrom AND vDatedTo - GROUP BY w.userFk,dated + GROUP BY w.userFk, t.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.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.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 + 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; + 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 + UPDATE tmp.timeBusinessCalculate t + JOIN calendarHolidays ch ON ch.dated = t.dated + JOIN business b ON b.id = t.businessFk + AND b.workcenterFk = ch.workcenterFk SET t.timeWorkSeconds = 0, - t.timeWorkSexagesimal = 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 */ ; @@ -85046,16 +71873,16 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - CREATE TEMPORARY TABLE IF NOT 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 + JOIN account.`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 */ ; @@ -85074,32 +71901,25 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) BEGIN - /** - * @param vDepartmentFk + * @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`; + DROP TEMPORARY TABLE IF EXISTS tmp.`user`; + + CREATE TEMPORARY TABLE tmp.`user` + SELECT DISTINCT b.workerFk userFk + FROM business AS b + WHERE (b.started BETWEEN vDatedFrom AND vDatedTo + OR IFNULL(b.ended, vDatedTo) BETWEEN vDatedFrom AND vDatedTo + OR (b.started <= vDatedFrom AND b.ended >= vDatedTo) + ) AND b.departmentFk = vDepartmentFk + ORDER BY b.ended DESC; + + CALL timeBusiness_calculate(vDatedFrom, vDatedTo); + + DROP TEMPORARY TABLE tmp.`user`; END ;; DELIMITER ; @@ -85121,19 +71941,19 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateByUser`(vUser BEGIN /** - * @param vUserFk + * @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; + FROM account.user + WHERE id = vUserFk; CALL vn.timeBusiness_calculate(vDatedFrom, vDatedTo); - + DROP TEMPORARY TABLE tmp.`user`; END ;; @@ -85160,127 +71980,19 @@ BEGIN * @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 + FROM account.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 */ ; @@ -85293,29 +72005,29 @@ 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 `timeControl_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME) BEGIN /* * @param vDatedFrom - * @param vDatedTo + * @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 vDatedToTomorrow DATETIME; DECLARE vTimeToBreakTime INT; DECLARE vBreakTime INT; - - SELECT DATE_SUB(vDatedFrom, INTERVAL 1 DAY), DATE_ADD(vDatedTo, INTERVAL 1 DAY) + + SELECT DATE_SUB(vDatedFrom, INTERVAL 1 DAY), DATE_ADD(vDatedTo, INTERVAL 1 DAY) INTO vDatedFromYesterday, vDatedToTomorrow; - - SELECT timeToBreakTime, breakTime INTO vTimeToBreakTime, vBreakTime + + SELECT timeToBreakTime, breakTime INTO vTimeToBreakTime, vBreakTime FROM workerTimeControlConfig LIMIT 1; CALL timeControl_getError(vDatedFrom, vDatedTo); @@ -85324,9 +72036,9 @@ BEGIN CREATE TEMPORARY TABLE tmp.workerTimeControl (INDEX (userFk), INDEX (timed)) ENGINE = MEMORY - SELECT DISTINCT(wtc.id), - wtc.userFk, - wtc.timed, + SELECT DISTINCT(wtc.id), + wtc.userFk, + wtc.timed, wtc.direction, TRUE isReal FROM workerTimeControl wtc @@ -85336,10 +72048,10 @@ BEGIN AND tce.id IS NULL ORDER BY wtc.userFk, wtc.timed ASC; - SELECT MAX(id) INTO @vCont + SELECT MAX(id) INTO @vCont FROM tmp.workerTimeControl; - DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux; + DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux; CREATE TEMPORARY TABLE tmp.workerTimeControlAux ( `id` int(11) , `userFk` int(10) unsigned , @@ -85361,6 +72073,7 @@ BEGIN @lastTimed := wtc.timed FROM tmp.workerTimeControl wtc ORDER BY wtc.userFk, wtc.timed + LIMIT 10000000000000000000 )sub WHERE hasBreak; @@ -85376,6 +72089,7 @@ BEGIN @lastTimed := wtc.timed FROM tmp.workerTimeControl wtc ORDER BY wtc.userFk, wtc.timed + LIMIT 10000000000000000000 )sub WHERE hasBreak; @@ -85426,7 +72140,8 @@ BEGIN IF(direction='in', @vDated := DATE(wtc.timed), @vDated) dated, wtc.userFk FROM tmp.workerTimeControl wtc - ORDER BY wtc.userFk, wtc.timed, wtc.id + ORDER BY wtc.userFk, wtc.timed, wtc.id + LIMIT 10000000000000000000 )sub GROUP BY sub.userFk, sub.dated HAVING SUM(sub.timeWork) >= vTimeToBreakTime; @@ -85435,9 +72150,15 @@ BEGIN SET @vDated := 0; SET @vLastTimed := 0; - DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; + DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux2; + CREATE TEMPORARY TABLE tmp.workerTimeControlAux2 + SELECT * + FROM tmp.workerTimeControl + WHERE timed BETWEEN vDatedFromYesterday AND vDatedTo + ORDER BY userFk, timed, id; - CREATE TEMPORARY TABLE tmp.timeControlCalculate + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; + CREATE OR REPLACE TEMPORARY TABLE tmp.timeControlCalculate (INDEX (userFk, dated)) ENGINE = MEMORY SELECT sub.userFk, @@ -85454,9 +72175,7 @@ BEGIN userFk, DATE(timed) dated, IF(isReal, timed, NULL) realTimed - FROM tmp.workerTimeControl - WHERE timed BETWEEN vDatedFromYesterday AND vDatedTo - ORDER BY userFk, timed, id + FROM tmp.workerTimeControlAux2 )sub LEFT JOIN tmp.workerBreakDays wb ON wb.userFk = sub.userFk AND wb.dated = sub.dated WHERE sub.timed BETWEEN vDatedFrom AND vDatedTo @@ -85465,6 +72184,7 @@ BEGIN DROP TEMPORARY TABLE tmp.workerBreakDays; DROP TEMPORARY TABLE tmp.timeControlError; DROP TEMPORARY TABLE tmp.workerTimeControlAux; + DROP TEMPORARY TABLE tmp.workerTimeControlAux2; DROP TEMPORARY TABLE tmp.workerTimeControl; END ;; DELIMITER ; @@ -85492,16 +72212,16 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - CREATE TEMPORARY TABLE IF NOT 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 + JOIN account.`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 */ ; @@ -85520,32 +72240,25 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) BEGIN - /** - * @param vDepartmentFk + * @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`; + DROP TEMPORARY TABLE IF EXISTS tmp.`user`; + + CREATE TEMPORARY TABLE tmp.`user` + SELECT DISTINCT b.workerFk userFk + FROM business AS b + WHERE (b.started BETWEEN vDatedFrom AND vDatedTo + OR IFNULL(b.ended, vDatedTo) BETWEEN vDatedFrom AND vDatedTo + OR (b.started <= vDatedFrom AND b.ended >= vDatedTo) + ) AND b.departmentFk = vDepartmentFk + ORDER BY b.ended DESC; + + CALL timeControl_calculate(vDatedFrom, vDatedTo); + + DROP TEMPORARY TABLE tmp.`user`; END ;; DELIMITER ; @@ -85567,19 +72280,19 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateByUser`(vUserF BEGIN /** - * @param vUserFk + * @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; + FROM account.user + WHERE id = vUserFk; CALL vn.timeControl_calculate(vDatedFrom, vDatedTo); - + DROP TEMPORARY TABLE tmp.`user`; END ;; @@ -85602,21 +72315,21 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateByWorker`(vWor BEGIN /** - * @param vWorkerFk + * @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 + FROM account.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 ;; @@ -85625,81 +72338,26 @@ 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 `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 character_set_client = utf8mb4 */ ; +/*!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 `timeControl_getError`(vDatedFrom DATETIME, vDatedTo DATETIME) BEGIN /* * @param vDatedFrom - * @param vDatedTo + * @param vDatedTo * @table tmp.`user`(userFk) * Fichadas incorrectas de las cuales no se puede calcular horas trabajadas * @return tmp.timeControlError (id) */ - DECLARE vDayMaxTime INTEGER; + DECLARE vDayMaxTime INTEGER; SET @journeyCounter := 0; SET @lastUserFk := NULL; @@ -85707,16 +72365,16 @@ BEGIN SELECT dayMaxTime INTO vDayMaxTime FROM workerTimeControlConfig LIMIT 1; - DROP TEMPORARY TABLE IF EXISTS tmp.timeControl; - CREATE TEMPORARY TABLE tmp.timeControl + DROP TEMPORARY TABLE IF EXISTS tmp.timeControl; + CREATE TEMPORARY TABLE tmp.timeControl (INDEX(id), INDEX(journeyCounter)) ENGINE = MEMORY SELECT sub.id, - sub.direction, + 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) + @lastUserFk := sub.userFk workerFk, + IF(sub.direction = 'out', @hasOut:= TRUE, @hasOut:= FALSE) FROM ( SELECT DISTINCT wtc.id, wtc.direction, @@ -85727,36 +72385,36 @@ BEGIN 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; + + 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 + 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 + 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; + DROP TEMPORARY TABLE IF EXISTS tmp.timeControl; + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlAux; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -85779,7 +72437,7 @@ proc: BEGIN * deprecated call workerTimeControl_check */ CALL vn.workerTimeControl_check(vUserFk,vDated,vTabletFk); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -85799,7 +72457,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `tpvTransaction_checkStatus`() BEGIN /** - * + * * Envia mail con los cobros web no * trasladados a la ficha del cliente. * @@ -85836,31 +72494,31 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travelVolume`(vTravelFk INT) BEGIN - - SELECT w1.name AS ORI, - w2.name AS DES, + + SELECT w1.name AS ORI, + w2.name AS DES, tr.shipped shipment, tr.landed landing, - a.name Agencia, + a.name Agencia, s.name Proveedor, e.id Id_Entrada, - e.REF Referencia, + e.invoiceNumber 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 + 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.agencyModeFk + 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 */ ; @@ -85879,20 +72537,18 @@ DELIMITER ; 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, + 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 + JOIN vn.agencyMode a ON a.id = tr.agencyModeFk + 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 */ ; @@ -85918,11 +72574,11 @@ BEGIN * @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 IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -85933,41 +72589,37 @@ 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 `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 - */ - +/** + * 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`) + JOIN vn.travel tr2 USING(shipped, warehouseInFk, warehouseOutFk, agencyModeFk, `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, + agencyModeFk, `ref`, cargoSupplierFk) SELECT shipped, @@ -85976,18 +72628,16 @@ BEGIN landingHour, warehouseInFk, warehouseOutFk, - agencyFk, + agencyModeFk, `ref`, cargoSupplierFk - FROM vn.travel + FROM vn.travel WHERE id = vSelf; - - SELECT LAST_INSERT_ID() INTO vNewTravelFk; - + + SELECT LAST_INSERT_ID() INTO vNewTravelFk; + COMMIT; - END IF; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -86005,13 +72655,13 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_cloneWithEntries`( - IN vTravelFk INT, - IN vDateStart DATE, + IN vTravelFk INT, + IN vDateStart DATE, IN vDateEnd DATE, IN vWarehouseOutFk INT, - IN vWarehouseInFk INT, - IN vRef VARCHAR(255), - IN vAgencyModeFk INT, + IN vWarehouseInFk INT, + IN vRef VARCHAR(255), + IN vAgencyModeFk INT, OUT vNewTravelFk INT) BEGIN /** @@ -86026,265 +72676,62 @@ BEGIN * @param vAgencyModeFk del nuevo travel * @param vNewTravelFk id del nuevo travel */ - DECLARE vEntryNew INT; - DECLARE vDone BOOLEAN DEFAULT FALSE; + DECLARE vNewEntryFk INT; + DECLARE vEvaNotes VARCHAR(255); + DECLARE vDone BOOL; DECLARE vAuxEntryFk INT; DECLARE vRsEntry CURSOR FOR SELECT e.id FROM entry e - JOIN travel t - ON t.id = e.travelFk + 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; - + + 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, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3, kg + + INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg) + SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, 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 + + OPEN vRsEntry; + + l: LOOP + SET vDone = FALSE; + FETCH vRsEntry INTO vAuxEntryFk; + + IF vDone THEN + LEAVE l; + END IF; + + CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk); + CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk); + + SELECT evaNotes INTO vEvaNotes 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; + + UPDATE entry + SET evaNotes = vEvaNotes + WHERE id = vNewEntryFk; + END LOOP; + 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 ; @@ -86330,11 +72777,11 @@ BEGIN 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; @@ -86360,7 +72807,7 @@ BEGIN /* * Desplaza al dia siguiente los travels que contengan redadas y avisa a los compradores - * + * */ DECLARE vDone BOOL DEFAULT FALSE; DECLARE vWorkerName VARCHAR(50); @@ -86372,7 +72819,7 @@ BEGIN 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 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 @@ -86380,19 +72827,19 @@ BEGIN GROUP BY u.name; DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; + 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 + JOIN entry e ON e.travelFk = tr.id WHERE tr.landed = util.tomorrow() AND e.isRaid GROUP BY tr.id; @@ -86404,7 +72851,7 @@ BEGIN 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()) + SELECT ttr.id, account.myUser_getId(), 'update', CONCAT('Se ha cambiado la fecha del travel al dia ', util.tomorrow()) FROM tmp.travel ttr; OPEN vCur; @@ -86454,7 +72901,7 @@ proc: BEGIN IF vSelf IS NULL THEN LEAVE proc; END IF; - + INSERT IGNORE INTO travelRecalc SET travelFk = vSelf; END ;; DELIMITER ; @@ -86475,12 +72922,11 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_weeklyClone`(vSinceWeek INT, vToWeek INT) BEGIN /** - * Clona los travels plantilla para las semanas pasadas por parámetros + * Clona los traslados 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; @@ -86489,10 +72935,11 @@ BEGIN DECLARE vWarehouseOutFk INT; DECLARE vAgencyModeFk INT; DECLARE vRef VARCHAR(255); - DECLARE vDone BOOLEAN DEFAULT FALSE; + DECLARE vNewTravelFk INT; + DECLARE vDone BOOL; DECLARE vRsTravel CURSOR FOR - SELECT travelFk, - @a := TIMESTAMPADD(DAY,vCounter * 7 - WEEKDAY(util.VN_CURDATE()) - 1 + weekDay,util.VN_CURDATE()), + SELECT travelFk, + @a := TIMESTAMPADD(DAY,vCounter * 7 - WEEKDAY(util.VN_CURDATE()) - 1 + weekDay, util.VN_CURDATE()), @a := TIMESTAMPADD(DAY,duration,@a), warehouseOutFk, warehouseInFk, @@ -86501,12 +72948,13 @@ BEGIN FROM travelClonedWeekly WHERE travelFk; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + 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(util.VN_CURDATE()) - 1 + weekDay,util.VN_CURDATE()), + INSERT IGNORE INTO travel (shipped, landed, warehouseOutFk, warehouseInFk, agencyModeFk, ref, cargoSupplierFk, kg) + SELECT @a := TIMESTAMPADD(DAY, vCounter * 7 - WEEKDAY(util.VN_CURDATE()) - 1 + weekDay, util.VN_CURDATE()), @a := TIMESTAMPADD(DAY, duration, @a), warehouseOutFk, warehouseInFk, @@ -86516,22 +72964,31 @@ BEGIN 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); + + l: LOOP + SET vDone = FALSE; FETCH vRsTravel INTO vCurrentTravelFk, vShipped, vLanded, vWarehouseOutFk, vWarehouseInFk, vRef, vAgencyModeFk; - END WHILE; + + IF vDone THEN + LEAVE l; + END IF; + + BEGIN + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RESIGNAL SQLSTATE '01000'; + CALL travel_cloneWithEntries(vCurrentTravelFk, vShipped, vLanded, vWarehouseOutFk, vWarehouseInFk, vRef, vAgencyModeFk, vNewTravelFk); + END; + END LOOP; + CLOSE vRsTravel; IF vCounter = vToWeek THEN LEAVE vWeekLoop; END IF; - SET vCounter = vCounter + 1; + SET vCounter = vCounter + 1; END LOOP vWeekLoop; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -86553,12 +73010,12 @@ 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 + DELETE it.* + FROM itemTag it JOIN item i ON i.id = it.itemFk WHERE i.typeFk = vTypeFk; @@ -86567,40 +73024,40 @@ BEGIN 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; - + 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; - */ + WHERE i.typeFk = vTypeFk; + */ -- CALL itemTagArrangedUpdate(NULL); END ;; @@ -86623,7 +73080,71 @@ 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 `vehicle_notifyEvents` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `vehicle_notifyEvents`() +proc:BEGIN +/** + * Query the vehicleEvent table to see if there are any events that need to be notified. + * + */ + DECLARE vEventEarlyDays INT; + DECLARE vHasEvents INT; + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + SELECT eventEarlyDays INTO vEventEarlyDays + FROM vehicleConfig; + + DROP TEMPORARY TABLE IF EXISTS tEvents; + CREATE TEMPORARY TABLE tEvents + SELECT e.id + FROM vehicleEvent e + JOIN vehicleState s ON e.vehicleStateFk = s.id + WHERE e.finished BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY, vEventEarlyDays, util.VN_CURDATE()) + AND e.notified IS NULL + AND s.hasToNotify; + + SELECT COUNT(id) INTO vHasEvents FROM tEvents; + + IF NOT vHasEvents THEN + LEAVE proc; + END IF; + + START TRANSACTION; + + SELECT util.notification_send('vehicle-event-expired', + JSON_OBJECT('eventIds', JSON_ARRAYAGG(id)), + account.myUser_getId() + ) + FROM tEvents; + + UPDATE vehicleEvent e + JOIN tEvents s ON e.id = s.id + SET e.notified = util.VN_NOW() + WHERE e.id = s.id; + COMMIT; + + DROP TEMPORARY TABLE IF EXISTS tEvents; END ;; DELIMITER ; @@ -86643,21 +73164,21 @@ DELIMITER ; 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 + FROM vn.sector s WHERE s.id = vSectorFk; - + CALL cache.visible_refresh(vCalcVisibleFk, FALSE, vWarehouseFk); DROP TEMPORARY TABLE IF EXISTS tmp.stockMisfit; @@ -86670,17 +73191,17 @@ BEGIN 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 + 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 + 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; @@ -86704,17 +73225,17 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `warehouseFitting`(IN vWhOrigin 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 @@ -86743,13 +73264,13 @@ 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 */ ; @@ -86809,129 +73330,55 @@ DELIMITER ; 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 + * @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 vPayedHolidays 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), + SELECT IF(b.started < CONCAT(vYear,"-01-01"), CONCAT(vYear,"-01-01"),b.started), + IF(b.ended IS NULL OR YEAR(b.ended)>vYear , CONCAT(vYear,"-12-31"), b.ended), 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 + c.hours_week, + IF(YEAR(b.ended) = vYear, b.payedHolidays, 0) payedHolidays + INTO vStarted, + vEnded, + vDaysHoliday, + vHoursWeek, + vPayedHolidays + FROM business b + JOIN workerBusinessType wbt ON wbt.id = b.workerBusinessTypeFk + JOIN workCenterHoliday w ON w.workcenterFk = b.workcenterFk + LEFT JOIN postgresql.calendar_labour_type c ON c.calendar_labour_type_id = b.calendarTypeFk + WHERE b.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 + SELECT IFNULL(SUM(holidayEntitlementRate), 0), + SUM(-(discountRate - 1)) + vPayedHolidays + 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 + 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, @@ -86959,35 +73406,32 @@ BEGIN /** * Calcula los días y horas de vacaciones en función de un trabajador y año * - * @param vYear - * @param vWorkerFk + * @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; + SELECT b.id + FROM business b + WHERE vYear BETWEEN YEAR(b.started) AND IFNULL(YEAR(b.ended), vYear) + AND b.workerFk = vWorkerFk; DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - + SET vDone = TRUE; + DROP TEMPORARY TABLE IF EXISTS tmp.workerCalendarCalculateYear; CREATE TEMPORARY TABLE tmp.workerCalendarCalculateYear - (days DEC(5,2), + (days DEC(5,2), hours DEC(5,2), - daysEnjoyed DEC(5,2), - hoursEnjoyed 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 @@ -87000,12 +73444,12 @@ BEGIN CALL workerCalendar_calculateBusiness(vYear, vBusinessFk); UPDATE tmp.workerCalendarCalculateYear w - JOIN tmp.workerCalendarCalculateBusiness wc + 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; @@ -87029,19 +73473,21 @@ DELIMITER ; /*!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 + vFirstname VARCHAR(50), + vLastName VARCHAR(50), + vCode CHAR(3), + vBossFk INT, + vUserFk INT, + vFi VARCHAR(15) , + vBirth DATE ) BEGIN /** * Create new worker * */ - INSERT INTO worker(id, code, firstName, lastName, userFk, bossFk) - VALUES (vUserFk, vWorkerCode, vFirstname, vSurnames, vUserFk, vBossFk); + INSERT INTO worker(id, code, firstName, lastName, userFk, bossFk, fi, birth) + VALUES (vUserFk, vCode, vFirstname, vLastName, vUserFk, vBossFk, vFi, vBirth); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -87059,68 +73505,32 @@ DELIMITER ; /*!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) - ) + 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); + DECLARE vSurnames VARCHAR(100); + + INSERT INTO account.user(name, password, role) + SELECT vUser, MD5(vPassword), vRole; - 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 + + IF vSurname2 IS NULL THEN SET vSurnames = vSurname1; - ELSE + 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 IF; + + INSERT INTO worker(firstName, lastName, code, userFk, isFreelance) + SELECT vFirstName, vSurnames, vWorkerCode, vUserId, TRUE; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -87143,30 +73553,21 @@ 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; - + SELECT w.userFk, + w.lastName name, + w.firstName firstname, + d.name department, + d.id departmentFk, + b.started, + d.isProduction, + CAST(12 * b.amount / clt.hours_week / 52 AS DECIMAL(10,2)) costeHora, + w.fi nif + FROM business b + JOIN postgresql.calendar_labour_type clt ON clt.calendar_labour_type_id = b.calendarTypeFk + JOIN department d ON d.id = b.departmentFk + JOIN worker w ON w.id = b.workerFk + WHERE b.started <= vDate + AND (b.ended > vDate OR b.ended IS NULL); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -87177,9 +73578,9 @@ 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 = utf8mb3 */ ; +/*!50003 SET character_set_results = utf8mb3 */ ; +/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -87192,18 +73593,18 @@ mainLabel:BEGIN DELETE FROM account.account WHERE id = vUserId; - UPDATE account.user + UPDATE account.user SET role = 2 - WHERE id = vUserId; + WHERE id = vUserId; - DELETE FROM pbx.sip - WHERE user_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; @@ -87229,21 +73630,19 @@ BEGIN 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) < util.VN_CURDATE() - AND (b.date_end) > TIMESTAMPADD(DAY, -70,util.VN_CURDATE()) ); - + SELECT b.workerFk + FROM business b + JOIN vn.worker w ON w.id = b.workerFk + JOIN account.account a ON a.id = b.workerFk + LEFT JOIN (SELECT b.workerFk + FROM business b + WHERE (ended IS NULL OR ended >=util.VN_CURDATE()) + )sub ON sub.workerFk = a.id + LEFT JOIN vn.workerDisableExcluded wd ON wd.workerFk = b.workerFk + WHERE sub.workerFk IS NULL + AND wd.workerFk IS NULL + GROUP BY w.id; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN rs; @@ -87257,43 +73656,7 @@ BEGIN 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 */ ; @@ -87340,322 +73703,6 @@ BEGIN 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,util.VN_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,util.VN_CURDATE()) - WHERE b.date_start <= vToDate - AND IFNULL(b.date_end, util.VN_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,util.VN_CURDATE()) - WHERE b.date_start <= vToDate - AND IFNULL(b.date_end, util.VN_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 */ ; @@ -87672,85 +73719,90 @@ DELIMITER ; /*!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) +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. + * 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 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 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) + 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 + + SELECT minHoursToBreak, breakHours, maxTimePerDay INTO vMinHoursToBreak, vBreakHours, vMaxTimePerDay FROM workerTimeControlConfig; DELETE FROM workerJourney - WHERE dated BETWEEN vDatedFrom AND vDatedTo + WHERE dated BETWEEN vDatedFrom AND vDatedTo AND NOT isPaid AND NOT isUpdated - AND (vWorkerFk IS NULL OR userFK = vWorkerFk); + AND (vWorkerFk IS NULL OR userFK = vWorkerFk); - -- Se inserta todos los días del periodo por worker y business en el rango de fechas. + -- 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,util.VN_CURDATE()) + SELECT b.workerFk, t.dated, b.id + FROM business b + JOIN time t ON t.dated BETWEEN b.started AND IFNULL(b.ended,util.VN_CURDATE()) WHERE t.dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR w.workerFk = vWorkerFk) - ORDER BY w.workerFk, t.dated, w.businessFk; - + AND (vWorkerFk IS NULL OR b.workerFk = vWorkerFk) + ORDER BY b.workerFk, t.dated, b.id; + 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; + 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` + CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` SELECT id userFk - FROM vn.worker w; - END IF; + FROM 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)), + 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); + + -- NOCTURNIDAD + CALL 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, + SELECT DISTINCT(wtc.id), + wtc.userFk, + wtc.timed, wtc.direction FROM workerTimeControl wtc JOIN tmp.`user` w ON w.userFk = wtc.userFk @@ -87760,10 +73812,10 @@ BEGIN AND (vWorkerFk IS NULL OR wtc.userFk = vWorkerFk) ORDER BY wtc.userFk, wtc.timed ASC; - SELECT MAX(id) INTO @vCont + SELECT MAX(id) INTO @vCont FROM tmp.workerTimeControl; - DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux; + DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux; CREATE TEMPORARY TABLE tmp.workerTimeControlAux ( `id` int(11) , `userFk` int(10) unsigned , @@ -87771,68 +73823,89 @@ BEGIN `direction` enum('in', 'out','middle') ) ENGINE=MEMORY; - SET @counter := 0; - SET @vIsOdd := FALSE; + SET @vIsOdd := TRUE; + SET @lastUserFk := NULL; + SET @lastDirection := NULL; -- 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, + SELECT @vCont:= @vCont + 1, + lastUserFk, + util.dayEnd(dated), + 'middle' + FROM (SELECT IF(@lastUserFk <> userFk, @vIsOdd := TRUE, NULL), DATE(@lastTimed) dated, - (@vIsOdd := NOT @vIsOdd) isOdd, - IF(@vIsOdd AND wtc.direction = 'middle' AND DATE(timed) <> DATE(@lastTimed), TRUE, FALSE) hasBreak, - @lastTimed := wtc.timed + @lastUserFk lastUserFk, + IF(direction ='middle', @vIsOdd := NOT @vIsOdd, FALSE) isOdd, + IF(@vIsOdd + AND @lastDirection = 'middle' + AND (DATE(@lastTimed) <> date(timed) + OR @lastUserFk <> userFk), TRUE, FALSE) hasBreak, + @lastTimed := wtc.timed, + @lastUserFk := userFk, + @lastDirection := direction FROM tmp.workerTimeControl wtc - ORDER BY wtc.userFk, wtc.timed - )sub + ORDER BY wtc.userFk, wtc.timed)sub WHERE hasBreak; - SET @counter := 0; - SET @vIsOdd := FALSE; + SET @vIsOdd := TRUE; + SET @lastUserFk := NULL; + SET @lastDirection := NULL; 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, + SELECT @vCont:= @vCont + 1, + lastUserFk, + DATE_ADD(sub.dated, INTERVAL 1 DAY), + 'middle' + FROM (SELECT IF(@lastUserFk <> userFk, @vIsOdd := TRUE, NULL), DATE(@lastTimed) dated, - (@vIsOdd := NOT @vIsOdd) isOdd, - IF(@vIsOdd AND wtc.direction = 'middle' AND DATE(timed) <> DATE(@lastTimed), TRUE, FALSE) hasBreak, - @lastTimed := wtc.timed + @lastUserFk lastUserFk, + IF(direction ='middle', @vIsOdd := NOT @vIsOdd, FALSE) isOdd, + IF(@vIsOdd + AND @lastDirection = 'middle' + AND (DATE(@lastTimed)<>date(timed) + OR @lastUserFk<>userFk), TRUE, FALSE) hasBreak, + @lastTimed := wtc.timed, + @lastUserFk := userFk, + @lastDirection := direction FROM tmp.workerTimeControl wtc - ORDER BY wtc.userFk, wtc.timed - )sub + 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'; + SELECT @vCont:= @vCont + 1, + wtc.userFk, + util.dayEnd(date(wtc.timed)), + 'out' + 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 wtc.direction <> 'out' + GROUP BY wtc.userFk, DATE(wtc.timed); 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'; + SELECT @vCont:= @vCont + 1, + wtc.userFk, + DATE_ADD(date(wtc.timed), INTERVAL 1 DAY), + 'in' + 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 wtc.direction <> 'out' + GROUP BY wtc.userFk, DATE(wtc.timed); INSERT INTO tmp.workerTimeControl (id, userFk, timed, direction) SELECT id, userFk, timed, direction FROM tmp.workerTimeControlAux; + SET @lastUserFk := NULL; + SET @vIsOdd := TRUE; + SET @vDated := NULL; + SET @vLastTimed := NULL; + UPDATE workerJourney wj JOIN (SELECT sub.dated, userFk, SUM(NigthlyHours) NigthlyHours FROM(SELECT (@vIsOdd := NOT @vIsOdd) isOdd, @@ -87840,18 +73913,21 @@ BEGIN 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 + IF(UNIX_TIMESTAMP(timed)- @vLastTimed < vMaxTimePerDay, + workerNigthlyHours_calculate(FROM_UNIXTIME(@vLastTimed), wtc.timed), + 0) NigthlyHours, + @lastUserFk := userFk 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 + LIMIT 10000000000000000000 ) wtc + ORDER BY wtc.userFk, wtc.timed )sub - WHERE sub.dated BETWEEN vDatedFrom AND vDatedTo + 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 @@ -87861,17 +73937,19 @@ BEGIN -- 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), + JOIN business b ON b.id = wj.businessFk + JOIN postgresql.calendar_labour_type cl + ON cl.calendar_labour_type_id = b.calendarTypeFk + SET wj.priceOrdinaryHour = + (vMonthsByYear * b.amount) / + (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 + -- Precio Extras, Vacaciones y Nocturnas UPDATE workerJourney wj JOIN(SELECT MAX(w.dated), t.dated, w.holidayInc, w.nightInc, w.extraInc FROM time t @@ -87889,20 +73967,21 @@ BEGIN -- 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 + JOIN business b ON b.id = wj.businessFk + JOIN postgresql.calendar_labour_type cl + ON cl.calendar_labour_type_id = b.calendarTypeFk 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.isPaid AND NOT wj.isUpdated; -- Ausencias UPDATE workerJourney wj - JOIN businessCalendar bc ON bc.businessFk = wj.businessFk AND bc.dated = wj.dated + 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 @@ -87915,7 +73994,7 @@ BEGIN UPDATE workerJourney SET holiday = IF(DAYNAME(dated)='sábado', 0, total), contractJourney = 0 - WHERE DAYNAME(dated) IN ('sábado', 'domingo') + WHERE DAYNAME(dated) IN ('sábado', 'domingo') AND dated BETWEEN vDatedFrom AND vDatedTo AND (vWorkerFk IS NULL OR userFk = vWorkerFk) AND NOT isPaid @@ -87924,8 +74003,8 @@ BEGIN -- 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 + JOIN business b ON b.id = wj.businessFk + AND b.workcenterFk = ch.workcenterFk SET wj.holiday = wj.total, wj.permission = wj.contractJourney, wj.contractJourney = 0 @@ -87935,7 +74014,7 @@ BEGIN AND NOT wj.isUpdated; -- Horas extras - UPDATE workerJourney + UPDATE workerJourney SET extra = lunch + total - contractJourney WHERE dated BETWEEN vDatedFrom AND vDatedTo AND (vWorkerFk IS NULL OR userFk = vWorkerFk) @@ -87953,194 +74032,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 `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,util.VN_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 */ ; @@ -88153,15 +74044,15 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerMistakeType_get`() BEGIN - + /** * Obtiene los tipos de error para los trabajadores */ - - SELECT code, description - FROM workerMistakeType + + SELECT code, description + FROM workerMistakeType ORDER BY description; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -88178,27 +74069,17 @@ DELIMITER ; /*!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 ) +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerMistake_add`(vWorkerFk INT, vWorkerMistakeTypeFk VARCHAR(10)) 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; + INSERT INTO vn.workerMistake(userFk, workerMistakeTypeFk) + VALUES(vWorkerFk, vWorkerMistakeTypeFk); END ;; DELIMITER ; @@ -88226,7 +74107,7 @@ BEGIN DECLARE vIsShelvingFk BOOL; SELECT COUNT(*) > 0 INTO vIsShelvingFk - FROM vn.shelving s + FROM vn.shelving s WHERE s.code = vBarcode COLLATE utf8_general_ci; IF NOT vIsShelvingFk THEN @@ -88234,7 +74115,7 @@ BEGIN 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) @@ -88266,20 +74147,20 @@ BEGIN SELECT COUNT(*) > 0 INTO vIsShelvingFk - FROM vn.shelving s + 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 + + DELETE FROM vn.workerShelving + WHERE shelvingFk = vBarcode COLLATE utf8_general_ci AND workerFk = vWorkerFk ; END ;; @@ -88303,51 +74184,12 @@ BEGIN /*INSERT INTO workerTimeControl(userFk, timed, manual, warehouseFk) VALUES(vUserFk, vDated, FALSE, vWarehouseFk); - - CALL vn.workerTimeControlSOWP(vUserFk , vDated);*/ - - CALL vn.workerTimeControl_add(vUserFk,vWarehouseFk,util.VN_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,util.VN_CURDATE()) AND util.VN_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; + CALL vn.workerTimeControlSOWP(vUserFk , vDated);*/ + + CALL vn.workerTimeControl_add(vUserFk,vWarehouseFk,util.VN_NOW(),FALSE); + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -88372,8 +74214,8 @@ BEGIN * */ - - + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -88450,13 +74292,13 @@ 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 + + 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 */ ; @@ -88475,8 +74317,8 @@ DELIMITER ; 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 ; @@ -88484,70 +74326,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 `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 */ ; @@ -88560,31 +74338,36 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_calculateOddDays`() BEGIN -/* - * Calculo de las fichadas impares por empleado y dia +/** + * 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 + + 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 ( + 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,util.VN_CURDATE()) AND util.dayEnd(util.VN_CURDATE()) - ORDER BY userFk, timed)sub - GROUP BY cont - HAVING cont2 MOD 2 = 1)sub2 - JOIN worker w ON w.userFk = sub2.userFk; - + ORDER BY userFk, timed + LIMIT 10000000000000000000)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 */ ; @@ -88610,153 +74393,146 @@ proc: BEGIN * @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 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 + 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 + 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 + + 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); - + 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(util.VN_NOW()) - UNIX_TIMESTAMP(vLastIn) > vDayStayMax THEN -- NUEVA JORNADA - - -- VERIFICAR DESCANSO DIARIO - IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastOut) < vDayBreak THEN - SELECT "Descansos 12 h" AS problem; - -- ENVIAMOS CORREO AL BOSSFK + WHERE w.id = vUserFk; + + + IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastIn) > vDayStayMax THEN -- NUEVA JORNADA + + -- VERIFICAR DESCANSO DIARIO + IF UNIX_TIMESTAMP(util.VN_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 + 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 + ) THEN SELECT "Dias con fichadas impares" AS problem; - -- ENVIAMOS CORREO AL BOSSFK + -- 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; + 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 = util.VN_CURDATE() - AND cs.isAllowedToWork = FALSE - AND w.userFk = vUserFk + + -- VERIFICAR VACACIONES + SELECT at2.name INTO vCalendarStateType + FROM calendar c + JOIN business b ON b.id = c.businessFk + JOIN absenceType at2 ON at2.id = c.dayOffTypeFk + WHERE c.dated = util.VN_CURDATE() + AND at2.isAllowedToWork = FALSE + AND b.workerFk = vUserFk LIMIT 1; - - IF(LENGTH(vCalendarStateType)) THEN + + IF(LENGTH(vCalendarStateType)) THEN SELECT vCalendarStateType AS problem; - -- ENVIAMOS CORREO AL BOSSFK + -- 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; - + LEAVE proc; + END IF; - -- VERIFICAR DESCANSO SEMANAL + -- VERIFICAR CONTRATO EN VIGOR + IF (SELECT COUNT(*) + FROM business b + WHERE b.workerFk = vUserFk + AND b.started <= vDated + AND IFNULL(b.ended, 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((util.VN_NOW() - INTERVAL vWeekScope SECOND)); - + SET @vLastTimed:= UNIX_TIMESTAMP((util.VN_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, + SELECT IF(vWeekBreak-(UNIX_TIMESTAMP(timed)-@vLastTimed) <= 0, @vHasBreakWeek:=TRUE, TRUE) alias, @vLastTimed:= UNIX_TIMESTAMP(timed) - FROM workerTimeControl + FROM workerTimeControl WHERE timed>= (util.VN_NOW() - INTERVAL vWeekScope SECOND) AND userFk= vUserFk AND direction IN ('in','out') - ORDER BY timed ASC; - - IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastOut) < vWeekBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA + ORDER BY timed ASC; + + IF UNIX_TIMESTAMP(util.VN_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 + -- 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; + LEAVE proc; END IF; - - DROP TEMPORARY TABLE tmp.trash; - - ELSE -- DIA ACTUAL - + + 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(util.VN_NOW()), 0) INTO vTimedWorked + SELECT IFNULL(SUM(if( mod(wtc.order,2)=1, -UNIX_TIMESTAMP(timed), UNIX_TIMESTAMP(timed))),0) - IF( MOD(COUNT(*),2), UNIX_TIMESTAMP(util.VN_NOW()), 0) INTO vTimedWorked FROM workerTimeControl wtc - WHERE userFk = vUserFk + WHERE userFk = vUserFk AND timed >= vLastIn ORDER BY timed; - IF vTimedWorked > vDayWorkMax THEN - SELECT "Jornadas" AS problem; - -- ENVIAMOS CORREO AL BOSSFK + 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; + LEAVE proc; END IF; END IF; - - -- VERIFICAR DEPARTAMENTO + + -- VERIFICAR DEPARTAMENTO /* IF vTabletFk IS NOT NULL THEN SELECT wtcu.departmentFk INTO vDepartmentFk FROM workerTimeControlUserInfo wtcu @@ -88766,20 +74542,20 @@ proc: BEGIN WHERE td.tabletFk = vTabletFk AND td.departmentFk = vDepartmentFk ) = 0 THEN SELECT "No perteneces a este departamento." AS problem; - -- ENVIAMOS CORREO AL BOSSFK + -- 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; + 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 DROP PROCEDURE IF EXISTS `workerTimeControl_checkBreak` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -88789,370 +74565,157 @@ DELIMITER ; /*!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)) +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_checkBreak`(vStarted DATE) 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 + * Retorna los trabajadores que no han respetado el descanso semanal de 36/72 horas + * El sistema verificará el descanso corto en la siguiente semana + * o el largo en las 2 siguientes semanas a partir de la fecha dada + * @param vStarted día inicio de la semana en el que se quiere verificar + * @return tmp.workerWithoutWeekBreak (workerFk) */ - 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; + DECLARE vShortEnded DATETIME; + DECLARE vLongEnded DATETIME; + DECLARE vShortWeekBreak INT; + DECLARE vLongWeekBreak INT; - IF (vTimed IS NULL) THEN - SET vTimed = util.VN_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 util.dayEnd(DATE_ADD(vStarted, INTERVAL shortWeekDays DAY)), + util.dayEnd(DATE_ADD(vStarted, INTERVAL longWeekDays DAY)), + shortWeekBreak, + longWeekBreak + INTO vShortEnded, vLongEnded, vShortWeekBreak, vLongWeekBreak + FROM workerTimeControlConfig; - SELECT MAX(timed) INTO vLastIn - FROM vn.workerTimeControl - WHERE userFk = vUserFk AND - direction = 'in'; + SET @previousTimed:= UNIX_TIMESTAMP(vStarted); + SET @lastUserFk := NULL; - SELECT MAX(timed) INTO vLastOut - FROM vn.workerTimeControl - WHERE userFk = vUserFk AND - direction = 'out'; + -- Descanso corto en la semana - - SELECT email INTO vTo - FROM account.user w - WHERE w.id = (SELECT bossFk FROM vn.worker WHERE id = vUserFk); + DROP TEMPORARY TABLE IF EXISTS tmp.worker; + CREATE TEMPORARY TABLE tmp.worker + (PRIMARY KEY(workerFk)) + ENGINE = MEMORY + SELECT DISTINCT userFk workerFk + FROM workerTimeControl + WHERE timed BETWEEN vStarted AND vShortEnded + AND direction IN ('in', 'out'); - 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 <= util.VN_CURDATE() AND - IFNULL(b.date_end,util.VN_CURDATE()) >= util.VN_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; + DROP TEMPORARY TABLE IF EXISTS tmp.worker2; + CREATE TEMPORARY TABLE tmp.worker2 + (PRIMARY KEY(workerFk)) + ENGINE = MEMORY + SELECT workerFk + FROM tmp.worker; - -- 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 = util.VN_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; + DROP TEMPORARY TABLE IF EXISTS tmp.workerWithoutShortWeekBreak; + CREATE TEMPORARY TABLE tmp.workerWithoutShortWeekBreak + SELECT sub2.userFk workerFk + FROM(SELECT sub.userFk, + IF(sub.userFk <> @lastUserFk, + @previousTimed:= sub.timed, + FALSE), + IF(sub.timed - @previousTimed >= vShortWeekBreak, + TRUE, + FALSE) hasShortWeekBreak, + @previousTimed:= sub.timed, + @lastUserFk:= sub.userFk + FROM ( + SELECT userFk, UNIX_TIMESTAMP(timed) timed + FROM workerTimeControl + WHERE timed BETWEEN vStarted AND vShortEnded + AND direction IN ('in', 'out') + UNION + SELECT w.workerFk, + UNIX_TIMESTAMP(IFNULL( + MIN(wtc.timed), + DATE_ADD(vShortEnded, INTERVAL vShortWeekBreak SECOND))) + FROM tmp.worker w + LEFT JOIN workerTimeControl wtc + ON wtc.userFk = w.workerFk + AND wtc.timed BETWEEN vShortEnded + AND DATE_ADD(vShortEnded, INTERVAL vShortWeekBreak SECOND) + GROUP BY w.workerFk + UNION + SELECT w.workerFk, + UNIX_TIMESTAMP(IFNULL( + MAX(wtc.timed), + DATE_SUB(vStarted, INTERVAL vShortWeekBreak SECOND))) + FROM tmp.worker2 w + LEFT JOIN workerTimeControl wtc + ON wtc.userFk = w.workerFk + AND wtc.timed BETWEEN + DATE_SUB(vStarted, INTERVAL vShortWeekBreak SECOND) + AND vStarted + GROUP BY w.workerFk + ORDER BY userFk, timed + LIMIT 10000000000000000000 + )sub + )sub2 + GROUP BY sub2.userFk + HAVING NOT SUM(hasShortWeekBreak); - -- 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; + -- Descanso largo en las 2 siguientes semanas + DROP TEMPORARY TABLE tmp.worker; + CREATE TEMPORARY TABLE tmp.worker + (PRIMARY KEY(workerFk)) + ENGINE = MEMORY + SELECT workerFk + FROM tmp.workerWithoutShortWeekBreak; - 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(util.VN_NOW()) - UNIX_TIMESTAMP(vLastIn) > vDayStayMax THEN -- NUEVA JORNADA - - -- VERIFICAR DESCANSO DIARIO - IF UNIX_TIMESTAMP(util.VN_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 = util.VN_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; + DROP TEMPORARY TABLE tmp.worker2; + CREATE TEMPORARY TABLE tmp.worker2 + (PRIMARY KEY(workerFk)) + ENGINE = MEMORY + SELECT workerFk + FROM tmp.workerWithoutShortWeekBreak; - -- VERIFICAR DESCANSO SEMANAL - SET @vHasBreakWeek:= FALSE; - SET @vLastTimed:= UNIX_TIMESTAMP((util.VN_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>= (util.VN_NOW() - INTERVAL vWeekScope SECOND) - AND userFk= vUserFk - AND direction IN ('in','out') - ORDER BY timed ASC; - - IF UNIX_TIMESTAMP(util.VN_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(util.VN_NOW()), 0) INTO vTimedWorked - FROM workerTimeControl wtc - WHERE userFk = vUserFk - AND timed >= vLastIn - ORDER BY timed; + DROP TEMPORARY TABLE IF EXISTS tmp.workerWithoutWeekBreak; + CREATE TEMPORARY TABLE tmp.workerWithoutWeekBreak + (PRIMARY KEY(workerFk)) + ENGINE = MEMORY + SELECT sub2.userFk workerFk + FROM(SELECT userFk, + IF(userFk <> @lastUserFk, + @previousTimed:= timed, + TRUE), + IF(timed - @previousTimed >= vLongWeekBreak, + TRUE, + FALSE) hasLongWeekBreak, + @previousTimed:= timed, + @lastUserFk:= userFk + FROM (SELECT userFk, UNIX_TIMESTAMP(timed) timed + FROM workerTimeControl wtc + JOIN tmp.workerWithoutShortWeekBreak wws ON wws.workerFk = wtc.userFk + WHERE timed BETWEEN vStarted AND vLongEnded + AND direction IN ('in', 'out') + UNION + SELECT w.workerFk, + UNIX_TIMESTAMP(IFNULL(MIN(wtc.timed), + DATE_ADD(vLongEnded, INTERVAL vLongWeekBreak SECOND))) + FROM tmp.worker w + LEFT JOIN workerTimeControl wtc + ON wtc.userFk = w.workerFk + AND timed BETWEEN vLongEnded + AND DATE_ADD(vLongEnded, INTERVAL vLongWeekBreak SECOND) + GROUP BY w.workerFk + UNION + SELECT w.workerFk, + UNIX_TIMESTAMP(IFNULL(MAX(wtc.timed), + DATE_SUB(vStarted, INTERVAL vLongWeekBreak SECOND))) + FROM tmp.worker2 w + LEFT JOIN workerTimeControl wtc + ON wtc.userFk = w.workerFk + AND timed BETWEEN DATE_SUB(vStarted, INTERVAL vLongWeekBreak SECOND) + AND vStarted + GROUP BY w.workerFk + ORDER BY userFk, timed + LIMIT 10000000000000000000 + )sub + )sub2 + GROUP BY userFk + HAVING NOT SUM(hasLongWeekBreak); - 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; - + DROP TEMPORARY TABLE tmp.workerWithoutShortWeekBreak, tmp.worker, tmp.worker2; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -89169,15 +74732,21 @@ DELIMITER ; /*!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)) +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 = util.VN_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 + * @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; @@ -89197,48 +74766,45 @@ BEGIN DECLARE vDated DATE; DECLARE vIsAllowedToWork VARCHAR(50); DECLARE vDepartmentFk INT; - DECLARE vTimedLoop INT; - DECLARE vTimedLoopPrevious INT; + DECLARE vTimedLoop BIGINT; + DECLARE vTimedLoopPrevious BIGINT; DECLARE vHasBreakWeek BOOLEAN DEFAULT FALSE; DECLARE vManual BOOLEAN DEFAULT TRUE; DECLARE vDone INT DEFAULT FALSE; DECLARE vCursor CURSOR FOR - SELECT UNIX_TIMESTAMP(util.VN_NOW() - INTERVAL vGap SECOND) - UNION - SELECT UNIX_TIMESTAMP(util.VN_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(util.VN_NOW() - INTERVAL vGap SECOND) - UNION - SELECT UNIX_TIMESTAMP(util.VN_NOW()) + SELECT UNIX_TIMESTAMP(vTimed) timed 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; - + 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(vTimed) timed + 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' + DECLARE EXIT HANDLER FOR SQLSTATE '45000' BEGIN - SELECT CONCAT(u.name, '@verdnatura.es'), CONCAT(w.firstName, ' ', w.lastName) + 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 + JOIN worker w ON w.bossFk = u.id WHERE w.id = vWorker; - CASE vErrorCode + CASE vErrorCode WHEN 'IS_NOT_ALLOWED_FUTURE' THEN SELECT 'No se permite fichar a futuro' INTO vErrorMessage; WHEN 'INACTIVE_BUSINESS' THEN @@ -89248,235 +74814,251 @@ BEGIN WHEN 'ODD_WORKERTIMECONTROL' THEN SELECT 'Fichadas impares' INTO vErrorMessage; WHEN 'BREAK_DAY' THEN - SELECT CONCAT('Descanso diario ', FORMAT(vDayBreak/3600, 0) , 'h.') INTO vErrorMessage; + SELECT CONCAT('Descanso diario ', FORMAT(vDayBreak/3600, 0), 'h.') + INTO vErrorMessage; WHEN 'BREAK_WEEK' THEN - SELECT CONCAT('Descanso semanal ', + 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 + 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; + 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 + IF (vTimed IS NULL) THEN SET vTimed = util.VN_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 + + SELECT IF(pc.category_name = 'Conductor +3500kg', + wc.dayBreakDriver, + wc.dayBreak), + wc.shortWeekBreak, + wc.longWeekBreak, + wc.weekScope + INTO vDayBreak, + vShortWeekBreak, + vLongWeekBreak, + vWeekScope + FROM business b + JOIN postgresql.professional_category pc + ON pc.professional_category_id = b.workerBusinessProfessionalCategoryFk JOIN workerTimeControlConfig wc ON TRUE - WHERE w.workerFk = vWorker - AND vDated BETWEEN w.started AND IFNULL(w.ended, vDated); + WHERE b.workerFk = vWorker + AND vDated BETWEEN b.started AND IFNULL(b.ended, vDated); SELECT timed INTO vLastIn - FROM workerTimeControl + FROM workerTimeControl WHERE userFk = vWorker - AND direction = 'in' + AND direction = 'in' AND timed < vTimed ORDER BY timed DESC - LIMIT 1; + LIMIT 1; SELECT timed INTO vLastOut - FROM workerTimeControl + FROM workerTimeControl WHERE userFk = vWorker - AND direction = 'out' + AND direction = 'out' AND timed < vTimed ORDER BY timed DESC LIMIT 1; SELECT timed INTO vNextIn - FROM workerTimeControl + FROM workerTimeControl WHERE userFk = vWorker - AND direction = 'in' + AND direction = 'in' AND timed > vTimed ORDER BY timed ASC LIMIT 1; SELECT direction INTO vNextDirection - FROM workerTimeControl + FROM workerTimeControl WHERE userFk = vWorker AND timed > vTimed ORDER BY timed ASC LIMIT 1; - + SELECT direction INTO vLastDirection - FROM workerTimeControl + FROM workerTimeControl WHERE userFk = vWorker AND timed < vTimed ORDER BY timed DESC - LIMIT 1; + LIMIT 1; -- FICHADAS A FUTURO - IF vTimed > DATE_ADD(util.VN_NOW(), INTERVAL 60 SECOND) THEN + IF vTimed > DATE_ADD(util.VN_NOW(), INTERVAL 60 SECOND) THEN SET vErrorCode = 'IS_NOT_ALLOWED_FUTURE'; - CALL util.throw(vErrorCode); + CALL util.throw(vErrorCode); END IF; - + -- CONTRATO EN VIGOR IF vDayBreak IS NULL THEN SET vErrorCode = 'INACTIVE_BUSINESS'; - CALL util.throw(vErrorCode); + CALL util.throw(vErrorCode); END IF; -- VERIFICAR SI ESTÁ PERMITIDO TRABAJAR CALL timeBusiness_calculateByWorker(vWorker, vDated, vDated); - SELECT isAllowedToWork INTO vIsAllowedToWork + SELECT isAllowedToWork INTO vIsAllowedToWork FROM tmp.timeBusinessCalculate; DROP TEMPORARY TABLE tmp.timeBusinessCalculate; - + IF NOT vIsAllowedToWork THEN - SET vErrorCode = 'IS_NOT_ALLOWED_WORK'; + 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 + + -- DIRECCION CORRECTA + CALL 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); + SET vErrorCode = 'WRONG_DIRECTION'; + CALL util.throw(vErrorCode); END IF; - -- DESCANSO DIARIO + -- 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 + 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 + 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); + 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 + 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 + IF vDone THEN LEAVE l; END IF; - IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN + IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) <= 0 THEN SET vHasBreakWeek = TRUE; LEAVE l; END IF; SET vTimedLoopPrevious = vTimedLoop; - END LOOP l; + 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 vTimedLoopPrevious = UNIX_TIMESTAMP(vTimed - INTERVAL vGap SECOND); SET vDone = FALSE; OPEN vCursor; l:LOOP FETCH vCursor INTO vTimedLoop; - IF vDone THEN + 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 + IF vLongWeekBreak - (vTimedLoop - vTimedLoopPrevious) <= 0 THEN SET vHasBreakWeek = TRUE; LEAVE l; END IF; SET vTimedLoopPrevious = vTimedLoop; - END LOOP l; + 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 vCursor2; + l:LOOP + FETCH vCursor2 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 vCursor2; -- 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; + OPEN vCursor2; l:LOOP - FETCH vCursor INTO vTimedLoop; - IF vDone THEN + FETCH vCursor2 INTO vTimedLoop; + IF vDone THEN LEAVE l; END IF; - IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN + IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) <= 0 THEN SET vHasBreakWeek = TRUE; LEAVE l; END IF; SET vTimedLoopPrevious = vTimedLoop; - END LOOP l; - CLOSE vCursor; + END LOOP l; + CLOSE vCursor2; END IF; END IF; IF NOT vHasBreakWeek THEN - SET vErrorCode = 'BREAK_WEEK'; - CALL util.throw(vErrorCode); - END IF; + 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 ; @@ -89500,27 +75082,27 @@ 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') + * Los valores posibles de retorno son ('in', 'inMiddle', 'outMiddle', 'out') */ DECLARE vLastIn DATETIME ; DECLARE vIsMiddleOdd BOOLEAN ; - IF (vTimed IS NULL) THEN + IF (vTimed IS NULL) THEN SET vTimed = util.VN_NOW(); END IF; - + SELECT timed INTO vLastIn - FROM workerTimeControl + FROM workerTimeControl WHERE userFk = vWorkerFk - AND direction = 'in' + AND direction = 'in' AND timed < vTimed ORDER BY timed DESC LIMIT 1; - + SELECT (COUNT(*)mod 2 = 1) INTO vIsMiddleOdd - FROM workerTimeControl + FROM workerTimeControl WHERE userFk = vWorkerFk - AND direction = 'middle' + AND direction = 'middle' AND timed BETWEEN vLastIn AND util.VN_NOW(); DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlDirection; @@ -89552,77 +75134,6 @@ BEGIN 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 = util.VN_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 util.VN_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 */ ; @@ -89639,93 +75150,81 @@ DELIMITER ; /*!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) +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 - * + * y las fichadas de cada día, en columnas por día + * @param vUserFk Identificador del trabajador + * @param vDated Fecha proporcionada */ + CALL timeControl_calculateByWorker( + vUserFk, + DATE_SUB(vDated, INTERVAL 6 DAY), util.dayEnd(vDated)); - CALL workerTimeControl_setOrder(vUserFk,TIMESTAMPADD(DAY,-8,vDated),vDated); + SET @position := 0; + SET @lastDated := NULL; - 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 + SELECT * + FROM( SELECT MAX(6daysAgo) 6daysAgo, + MAX(6daysAgoDirection) 6daysAgoDirection, + MAX(5daysAgo) 5daysAgo, + MAX(5daysAgoDirection) 5daysAgoDirection, + MAX(4daysAgo) 4daysAgo, + MAX(4daysAgoDirection) 4daysAgoDirection, + MAX(3daysAgo) 3daysAgo, + MAX(3daysAgoDirection) 3daysAgoDirection, + MAX(2daysAgo) 2daysAgo, + MAX(2daysAgoDirection) 2daysAgoDirection, + MAX(1daysAgo) 1daysAgo, + MAX(1daysAgoDirection) 1daysAgoDirection, + MAX(0daysAgo) 0daysAgo, + MAX(0daysAgoDirection) 0daysAgoDirection + FROM(SELECT IF(daysAgo = 6, timed, '') 6daysAgo, + IF(daysAgo = 5, timed, '') 5daysAgo, + IF(daysAgo = 4, timed, '') 4daysAgo, + IF(daysAgo = 3, timed, '') 3daysAgo, + IF(daysAgo = 2, timed, '') 2daysAgo, + IF(daysAgo = 1, timed, '') 1daysAgo, + IF(daysAgo = 0, timed, '') 0daysAgo, + IF(daysAgo = 6, direction, '') 6daysAgoDirection, + IF(daysAgo = 5, direction, '') 5daysAgoDirection, + IF(daysAgo = 4, direction, '') 4daysAgoDirection, + IF(daysAgo = 3, direction, '') 3daysAgoDirection, + IF(daysAgo = 2, direction, '') 2daysAgoDirection, + IF(daysAgo = 1, direction, '') 1daysAgoDirection, + IF(daysAgo = 0, direction, '') 0daysAgoDirection, - 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; + direction, + position + FROM(SELECT DATEDIFF(vDated, timed) daysAgo, + TIME_FORMAT(timed,'%H:%i') timed, + IF(DATE(timed) <> @lastDated, @position := 0, NULL), + @position := @position+1 position, + @lastDated := DATE(timed), + direction + FROM workerTimeControl wtc + WHERE wtc.userFk = vUserFk + AND wtc.timed >= TIMESTAMPADD(DAY, -6,vDated) + ORDER BY wtc.timed + LIMIT 10000000000000000000 + )sub + )sub2 + GROUP BY position) sub3 + JOIN (SELECT MAX(IF(daysAgo = 6, timeWorkSeconds, 0)) 6daysAgoTotal, + MAX(IF(daysAgo = 5, timeWorkSeconds, 0)) 5daysAgoTotal, + MAX(IF(daysAgo = 4, timeWorkSeconds, 0)) 4daysAgoTotal, + MAX(IF(daysAgo = 3, timeWorkSeconds, 0)) 3daysAgoTotal, + MAX(IF(daysAgo = 2, timeWorkSeconds, 0)) 2daysAgoTotal, + MAX(IF(daysAgo = 1, timeWorkSeconds, 0)) 1daysAgoTotal, + MAX(IF(daysAgo = 0, timeWorkSeconds, 0)) 0daysAgoTotal + FROM (SELECT DATEDIFF(vDated, dated) daysAgo, + timeWorkSeconds + FROM tmp.timeControlCalculate) sub4)sub5 ON TRUE; + DROP TEMPORARY TABLE tmp.timeControlCalculate; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -89788,45 +75287,45 @@ BEGIN DECLARE vDirectionPrevious VARCHAR(6); DECLARE vTimedPrevious DATETIME; - SELECT direction INTO vDirectionRemove - FROM vn.workerTimeControl - WHERE userFk = vUserFk + 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 + FROM vn.workerTimeControl + WHERE userFk = vUserFk AND timed < vTimed ORDER BY timed DESC - LIMIT 1; - + LIMIT 1; + IF vDirectionPrevious = "middle" THEN - UPDATE vn.workerTimeControl + UPDATE vn.workerTimeControl SET direction = "out" WHERE userFk = vUserFk AND timed = vTimedPrevious; END IF; - + ELSE IF vDirectionRemove = 'in' THEN - UPDATE vn.workerTimeControl + UPDATE vn.workerTimeControl SET direction = "in" WHERE userFk = vUserFk AND timed > vTimed ORDER BY timed ASC - LIMIT 1; + LIMIT 1; END IF; - + END IF; - + DELETE FROM vn.workerTimeControl - WHERE userFk = vUserFk + WHERE userFk = vUserFk AND timed = vTimed; - + CALL vn.workerTimeControlSOWP(vUserFk, vTimed); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -89854,31 +75353,31 @@ proc: BEGIN UPDATE vn.workerTimeControl SET direction = 'middle'; /*2- poner los out*/ -UPDATE vn.workerTimeControl wtc - JOIN +UPDATE vn.workerTimeControl wtc + JOIN (SELECT userFk,MAX(timed) maxTimed FROM (SELECT id, userFk, timed, date(timed) dated - FROM vn.workerTimeControl - ) sub + FROM vn.workerTimeControl + ) sub GROUP BY userFk,dated )sub SET direction = "out" - WHERE wtc.userFk = sub.userFk + WHERE wtc.userFk = sub.userFk AND wtc.timed = sub.maxTimed; - - /*3- poner los in*/ -UPDATE vn.workerTimeControl wtc - JOIN + + /*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 + FROM vn.workerTimeControl + ) sub GROUP BY userFk,dated )sub SET direction = "in" - WHERE wtc.userFk = sub.userFk - AND wtc.timed = sub.maxTimed ; - + WHERE wtc.userFk = sub.userFk + AND wtc.timed = sub.maxTimed ; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -89895,14 +75394,18 @@ DELIMITER ; /*!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) +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 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 vWeek + * @param vYear * @param vWorkerFk -> En el caso de querer generarlo para todos los empleados deberá de informarse como NULL */ DECLARE vStarted VARCHAR(25); @@ -89929,68 +75432,84 @@ BEGIN DECLARE vPermissionRate DECIMAL(5,2); DECLARE vIsTeleworking BOOL; DECLARE vIsTeleworkingOld BOOL; - + DECLARE vError BOOL DEFAULT FALSE; + 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 + 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 account.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 + JOIN business b ON b.id = tb.businessFk LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = tb.userFk AND tc.dated = tb.dated + LEFT JOIN worker w ON w.id = u.id + LEFT JOIN account.`user` u2 ON u2.id = w.bossFk 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 + SUM(IF(tb.type IS NULL, + IF(tc.timeWorkDecimal > 0, FALSE, IF(tb.timeWorkDecimal > 0, TRUE, FALSE)), + TRUE))isTeleworkingWeek + FROM tmp.timeBusinessCalculate tb + LEFT JOIN tmp.timeControlCalculate 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; + WHERE d.hasToRefill + AND IFNULL(vWorkerFk, u.id) = u.id + AND b.companyCodeFk = 'VNL' + AND w.businessFk + ORDER BY u.id, tb.dated; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + SET vError = TRUE; + + INSERT INTO tmp.error(workerFk) + SELECT vWorkerFk; + END; + 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; + DROP TEMPORARY TABLE IF EXISTS tmp.error; - SELECT CONCAT (MIN(dated), ' 00:00:00'), CONCAT (MAX(dated), ' 23:59:59') INTO vStarted, vEnded - FROM time - WHERE year = vYear AND - week = vWeek; + CREATE TEMPORARY TABLE tmp.error (workerFk INT); - DELETE FROM workerTimeControl + SELECT MIN(dated), util.dayEnd(MAX(dated)) INTO vStarted, vEnded + FROM time + WHERE period = CONCAT(vYear, LPAD(vWeek, 2, '0')); + + DELETE FROM workerTimeControl WHERE IFNULL(vWorkerFk, userFk) = userFk AND - timed BETWEEN vStarted AND vEnded AND + timed BETWEEN vStarted AND vEnded AND isSendMail; UPDATE workerTimeControlMail SET updated = util.VN_NOW(), state = 'SENDED' - WHERE year = vYear AND + 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); + 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; @@ -90002,9 +75521,12 @@ proc: LOOP IF vDone THEN LEAVE proc; END IF; - + + START TRANSACTION; + SET vError = FALSE; + IF vTimeWorkDecimal>0 AND vTimeWorkedDecimal IS NULL AND IFNULL(vPermissionRate, TRUE) THEN - IF vTimeTable IS NULL 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 @@ -90017,63 +75539,63 @@ proc: LOOP 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; + 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 + 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; + 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; + 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; - + 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; + 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; + 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 + 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' ; - + SET direction = 'in' ; + UPDATE workerTimeControl wtc - JOIN (SELECT id FROM workerTimeControl - WHERE userFk = vWorkerFk AND + JOIN (SELECT id FROM workerTimeControl + WHERE userFk = vWorkerFk AND timed BETWEEN vDated AND CONCAT(vDated, ' 23:59:59') - ORDER BY timed DESC + ORDER BY timed DESC LIMIT 1)sub on sub.id= wtc.id - SET direction = 'out' ; - + SET direction = 'out' ; + END IF; END IF; @@ -90092,26 +75614,27 @@ proc: LOOP ", 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 + 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; + IF vWorkerFk <> vWorkerFkOld OR vDone THEN + SELECT CONCAT_WS(' ', fi, firstName, lastName) INTO vWorkerInfo + FROM worker + WHERE id = vWorkerFkOld; + SET vHeader = CONCAT("


-

", vWorkerInfo , "

+

", vWorkerInfo , "

@@ -90132,16 +75655,18 @@ proc: LOOP
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. + Rogamos nos conteste lo antes posible.

"); - IF vIsTeleworkingOld THEN + IF vIsTeleworkingOld AND NOT vError THEN CALL mail_insert( - vReceiverOld, + vReceiverOld, 'timecontrol@verdnatura.es', - CONCAT('Registro de horas semana ', vWeek, ' año ', vYear) , + CONCAT('Registro de horas semana ', vWeek, ' año ', vYear) , CONCAT(vHeader, ' ' , vBody, ' ', vFooter) ); INSERT IGNORE INTO workerTimeControlMail (workerFk, year, week) VALUES(vWorkerFkOld, vYear, vWeek); + ELSE + ROLLBACK; END IF; SET vBody = ''; @@ -90150,13 +75675,22 @@ proc: LOOP SET vIsTeleworkingOld = vIsTeleworking; SET vReceiverOld = vReceiver; END IF; + COMMIT; END LOOP; CLOSE vCursor; + INSERT INTO mail (receiver, replyTo, subject, body) + SELECT CONCAT(u.name, '@verdnatura.es'), + CONCAT('Error registro de horas semana ', vWeek, ' año ', vYear) , + CONCAT('No se ha podido enviar el registro de horas al empleado/s: ', GROUP_CONCAT(DISTINCT CONCAT('
', w.id, ' ', w.firstName, ' ', w.lastName))) + FROM tmp.error e + JOIN worker w ON w.id = e.workerFk + JOIN account.user u ON u.id = w.bossFk + GROUP BY w.bossFk; + DROP TABLE tmp.timeControlCalculate; DROP TABLE tmp.timeBusinessCalculate; - DROP TABLE tmp.timeControlCalculate1; - DROP TABLE tmp.timeBusinessCalculate1; + DROP TABLE tmp.error; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -90211,24 +75745,25 @@ BEGIN w.userFk, tm.hoursWeek, tm.type, - wl.started, - wl.ended, + b.started, + b.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 business b ON b.workerFk = tm.userFk AND b.id = tm.businessFk + LEFT JOIN workCenter wc ON wc.id = b.workcenterFk + LEFT JOIN department d ON d.id = b.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 + AND w.businessFk 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(' @@ -90320,7 +75855,7 @@ BEGIN IF (DAYNAME(util.VN_CURDATE()) = 'miércoles') THEN SELECT DATE_SUB(util.VN_CURDATE(), INTERVAL 9 DAY), CONCAT(DATE_SUB(util.VN_CURDATE(), INTERVAL 3 DAY), ' 23:59:59') INTO vDatedFrom, vDatedTo; - + CALL vn.workerTimeControl_sendMailByDepartment(vDatedFrom, vDatedTo, NULL); END IF; END ;; @@ -90357,6 +75892,55 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_weekCheckBreak` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_weekCheckBreak`(vStarted DATE, vEnded DATE) +BEGIN +/** + * Retorna los trabajadores que no han respetado el descanso semanal de 36/72 horas + * El sistema verificará el descanso corto en la siguiente semana + * o el largo en las 2 siguientes semanas a partir de las fechas dadas + * @param vStarted día inicio para verificar + * @param vEnded día final para verificar + * @return tmp.workerWithoutWeekBreak (workerFk) + */ + DECLARE vDone INT DEFAULT FALSE; + + IF(vStarted > vEnded) then + CALL util.throw ('Date end can not be greater then start'); + END IF; + + DROP TEMPORARY TABLE IF EXISTS tmp.workerWithoutWeekBreakInWeek; + CREATE TEMPORARY TABLE tmp.workerWithoutWeekBreakInWeek + (workerFk INT, + PRIMARY KEY(workerFk)) + ENGINE = MEMORY; + + + WHILE vStarted <= vEnded DO + + CALL workerTimeControl_checkBreak(vStarted); + INSERT IGNORE INTO tmp.workerWithoutWeekBreakInWeek + SELECT workerFk + FROM tmp.workerWithoutWeekBreak; + DROP TEMPORARY TABLE IF EXISTS tmp.workerWithoutWeekBreak; + SET vStarted = DATE_ADD(vStarted, 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 `workerWeekControl` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -90369,172 +75953,134 @@ DELIMITER ; 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 +/* +* 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; -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 workerTimeControl WHERE timed >= vDated AND userFk = vUserFk; + SET @day := 0; + SET @lastTimed := util.VN_NOW(); -SELECT COUNT(*) INTO vHasSignedToday - FROM vn.workerTimeControl WHERE timed >= vDated AND userFk = vUserFk; + 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, util.VN_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', util.VN_NOW()) as timed, vUserFk + ) sub4 + ORDER BY timed + ) sub -SET @day := 0; -SET @lastTimed := util.VN_NOW(); + ) sub2 + WHERE fichada_actual >= TIMESTAMPADD(WEEK, -1, vDated) + ) sub3 ; -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, util.VN_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', util.VN_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; -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 at2.name INTO vCantWork + FROM calendar c + JOIN business b ON b.id = c.businessFk + JOIN absenceType at2 ON at2.id = c.dayOffTypeFk + WHERE c.dated = util.VN_CURDATE() + AND at2.isAllowedToWork = FALSE + AND b.workerFk = vUserFk + LIMIT 1; --- 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 = util.VN_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; - + -- Contrato en vigor + SELECT IF(COUNT(*),vCantWork,'Sin contrato') INTO vCantWork + FROM business b + WHERE b.workerFk = vUserFk + AND b.started <= vDated + AND IFNULL(b.ended, vDated) >= vDated; - -IF vJornadas IS NOT NULL THEN - - SELECT 'Jornadas' as Item, vJornadas as Cantidad, 'Correcto' AS Análisis + -- 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 workerTimeControlUserInfo wtcu + WHERE wtcu.userFk = vUserFk; + -- 2 Comprobar si la tablet pertenece al departamento + SELECT COUNT(td.tabletFk) INTO isEnabled + FROM tabletDepartment td + WHERE td.tabletFk = vTabletFk AND td.departmentFk = vDepartmentFk; - UNION ALL + END IF; - SELECT 'Descansos 12 h' as Item, vDescansos12h as Cantidad, IF(vDescansos12h >= vJornadas, 'Correcto','Error: 1 por jornada') as Análisis + IF vJornadas IS NOT NULL THEN - 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; + 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 */ ; @@ -90565,7 +76111,7 @@ CALL vn.workerTimeControlSetOrder_by_User_and_dateRange(vUserFk,TIMESTAMPADD(DAY DROP TEMPORARY TABLE IF EXISTS tmp.workerWeekTiming; CREATE TEMPORARY TABLE tmp.workerWeekTiming SELECT orden `orden`, - max(hace7dias) 7_dias_antes, + max(hace7dias) 7_dias_antes, max(hace6dias) 6_dias_antes, max(hace5dias) 5_dias_antes, max(hace4dias) 4_dias_antes, @@ -90595,16 +76141,16 @@ SELECT orden `orden`, )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, +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'),''), @@ -90614,7 +76160,7 @@ SELECT 0, 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) + @@ -90626,799 +76172,19 @@ SELECT 0, ROUND(( IFNULL(TIME_TO_SEC(1_dia_antes),0) ) / 3600,1) FROM tmp.workerWeekTiming - WHERE orden = 0; + 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, util.VN_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, util.VN_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, util.VN_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, util.VN_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 */ ; @@ -91443,11 +76209,11 @@ BEGIN * @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 + + 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; @@ -91478,7 +76244,7 @@ BEGIN (PRIMARY KEY (workerFk)) ENGINE = MEMORY SELECT vBoss AS workerFk; - + DROP TEMPORARY TABLE IF EXISTS tmp.workerHierarchyList; CREATE TEMPORARY TABLE tmp.workerHierarchyList (PRIMARY KEY (workerFk)) @@ -91489,7 +76255,7 @@ BEGIN WHILE (SELECT COUNT(*) FROM tmp.workerHierarchyList WHERE NOT isChecked) > 0 DO INSERT INTO tmp.workerHierarchyList - SELECT w.id, 0 + SELECT w.id, 0 FROM worker w JOIN workerHierarchy wh ON wh.workerFk = w.bossFk; @@ -91500,12 +76266,12 @@ BEGIN TRUNCATE workerHierarchy; INSERT INTO workerHierarchy - SELECT workerFk + SELECT workerFk FROM tmp.workerHierarchyList WHERE NOT isChecked; END WHILE; - + DROP TEMPORARY TABLE IF EXISTS workerHierarchy; END ;; DELIMITER ; @@ -91513,153 +76279,15 @@ 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 `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 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 `worker_getSector`() BEGIN @@ -91670,8 +76298,8 @@ BEGIN SELECT s.id,s.description,s.warehouseFk FROM sector s - JOIN worker w ON w.sectorFk = s.id - WHERE w.id = account.userGetId(); + JOIN worker w ON w.sectorFk = s.id + WHERE w.id = account.myUser_getId(); END ;; DELIMITER ; @@ -91679,29 +76307,134 @@ 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 `worker_updateBalance` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_updateBalance`(vSelfFk INT(11), vCredit DECIMAL(10,2), vDebit DECIMAL(10,2)) +BEGIN +/** + * Actualiza la columna balance de worker. + * + * @param selfFk, credit, debit + */ + UPDATE worker + SET balance = IFNULL(balance, 0) + IFNULL(vCredit, 0) - IFNULL(vDebit, 0) + WHERE id = vSelfFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_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_updateBusiness` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_updateBusiness`(vSelf INT) +BEGIN +/** + * Actualiza en la tabla @worker el contrato actual del trabajador. + * + * @param vSelf Id del trabajador + */ + UPDATE worker w + LEFT JOIN business b ON b.workerFk = w.id + AND util.VN_CURDATE() BETWEEN b.started AND IFNULL(b.ended, util.VN_CURDATE()) + SET w.businessFk = b.id + WHERE w.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 `worker_updateChangedBusiness` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_updateChangedBusiness`() +BEGIN +/** + * Actualiza el contrato actual de todos los trabajadores cuyo contracto ha + * empezado/vencido. + */ + DECLARE vBusinessUpdated DATE; + DECLARE vCurdate DATE DEFAULT util.VN_CURDATE(); + DECLARE vWorkerFk INT; + DECLARE vDone BOOL; + + DECLARE vCursor CURSOR FOR + SELECT DISTINCT b.workerFk + FROM business b + WHERE b.started > vBusinessUpdated AND b.started <= vCurdate + OR b.ended >= vBusinessUpdated AND b.ended < vCurdate; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + SELECT businessUpdated INTO vBusinessUpdated + FROM workerConfig; + + OPEN vCursor; + + l: LOOP + SET vDone = FALSE; + + FETCH vCursor INTO vWorkerFk; + + IF vDone THEN + LEAVE l; + END IF; + + CALL worker_updateBusiness(vWorkerFk); + END LOOP; + + UPDATE workerConfig SET businessUpdated = vCurdate; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_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 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 `worker_updateSector`(vSectorFk INT) BEGIN - /** - * ACtualiza el sector del usuario conectado + * Actualiza el sector del usuario conectado y borra la impresora asociada al usuario * - * @param vSectorFk id del sector -*/ + * @param vSectorFk id del sector + */ UPDATE worker - SET sectorFk = vSectorFk - WHERE id = account.userGetId(); - - + SET sectorFk = vSectorFk, + labelerFk = NULL + WHERE id = account.myUser_getId(); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -91721,10 +76454,10 @@ 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 userid IS NOT NULL THEN IF (logon) THEN CALL vn.workingHoursTimeIn(userid); ELSE @@ -91793,17 +76526,17 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `wrongEqualizatedClient`() BEGIN SELECT clientFk, c.name, c.isActive, c.isTaxDataChecked, count(ie) as num FROM vn.client c - JOIN + JOIN ( - SELECT DISTINCT + 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 @@ -91819,7 +76552,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 `xdiarioNextId__` */; +/*!50003 DROP PROCEDURE IF EXISTS `XDiario_checkDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -91829,30 +76562,27 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `xdiarioNextId__`() -BEGIN +CREATE DEFINER=`root`@`localhost` PROCEDURE `XDiario_checkDate`(vDate DATE) +proc: BEGIN /** - * @deprecated Use ledger_next + * Comprueba si la fecha pasada esta en el rango + * de fecha de contabilidad + * + * @param vDate Fecha para comparar */ - DECLARE vNewAsien INT; - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; + DECLARE vIsInvalid BOOL; - START TRANSACTION; - - SELECT bookFk + 1 INTO vNewAsien FROM config FOR UPDATE; - UPDATE config SET bookFk = vNewAsien; - COMMIT; + IF vDate IS NULL THEN + LEAVE proc; + END IF; - SELECT vNewAsien; - - DROP TEMPORARY TABLE IF EXISTS tmp.xdiarioNextId; - CREATE TEMPORARY TABLE tmp.xdiarioNextId AS - SELECT vNewAsien ; - + SELECT COUNT(*) = 0 INTO vIsInvalid + FROM accountingConfig + WHERE vDate BETWEEN minDate AND maxDate; + + IF vIsInvalid THEN + CALL util.throw ('Fecha fuera de rango'); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -91890,93 +76620,27 @@ proc: BEGIN 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` + 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 util.VN_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 ;; @@ -92070,7 +76734,7 @@ BEGIN OR (vSelf IS NOT NULL AND parentFk = vSelf); DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + SET vSons = 0; OPEN vChildren; @@ -92081,11 +76745,11 @@ BEGIN 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, '/'), @@ -92188,7 +76852,7 @@ proc: BEGIN SELECT isChanged INTO vIsChanged FROM zoneGeoRecalc; - + IF vIsChanged THEN UPDATE zoneGeoRecalc SET isChanged = FALSE; CALL vn.zoneGeo_calcTree; @@ -92250,7 +76914,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 `zone_doCalcInitialize` */; +/*!50003 DROP PROCEDURE IF EXISTS `zone_excludeFromGeo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -92260,87 +76924,23 @@ DELIMITER ; /*!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`() +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_excludeFromGeo`(vZoneGeo INT) 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; - +/** + * Excluye zonas a partir un geoFk. + * + * @table tmp.zoneOption(zoneFk, hour, travelingDays, price, bonus, landed, shipped) The computed options + * @param vZoneGeo The zone geo + * @return tmp.zoneOption The computed options + */ + DELETE t + FROM tmp.zoneOption t + JOIN zoneExclusion e ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed + LEFT JOIN zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id + JOIN zoneGeo zg1 ON zg1.id = eg.geoFk + JOIN zoneGeo zg2 ON zg2.id = vZoneGeo + WHERE zg2.`path` LIKE CONCAT(zg1.`path`, zg1.id,'/%') + OR zg2.id = zg1.id; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -92360,7 +76960,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getAgency`(vAddress INT, vLanded DATE) BEGIN /** - * Devuelve el listado de agencias disponibles para la fecha + * 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 @@ -92369,13 +76969,14 @@ BEGIN */ CALL zone_getFromGeo(address_getGeo(vAddress)); CALL zone_getOptionsForLanding(vLanded, FALSE); + CALL vn.zone_excludeFromGeo(address_getGeo(vAddress)); DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetAgency; CREATE TEMPORARY TABLE tmp.zoneGetAgency (INDEX (agencyModeFk)) ENGINE = MEMORY - SELECT am.name agencyMode, + SELECT am.name agencyMode, am.description, - z.agencyModeFk, + z.agencyModeFk, am.deliveryMethodFk, TIMESTAMPADD(DAY,-zo.travelingDays, vLanded) shipped, TRUE isIncluded, @@ -92385,7 +76986,7 @@ BEGIN 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; @@ -92439,7 +77040,7 @@ proc:BEGIN * @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, @@ -92481,7 +77082,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getCollisions`() BEGIN /** - * Calcula si para un mismo codigo postal y dia + * Calcula si para un mismo codigo postal y dia * hay mas de una zona configurada y manda correo * */ @@ -92490,16 +77091,16 @@ BEGIN 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 + 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'); + WHERE dm.code IN ('AGENCY','DELIVERY'); CALL zone_getOptionsForShipment(util.VN_CURDATE(),FALSE); @@ -92514,7 +77115,7 @@ BEGIN PRIMARY KEY zoneFkk (zoneFk, geoFk), INDEX(geoFk)) ENGINE = MEMORY; - + OPEN cur1; cur1Loop: LOOP SET vIsDone = FALSE; @@ -92522,40 +77123,40 @@ BEGIN IF vIsDone THEN LEAVE cur1Loop; END IF; - + CALL zone_getLeaves2(vZoneFk, NULL, NULL); - myLoop: LOOP + myLoop: LOOP SET vGeoFk = NULL; - SELECT geoFk INTO vGeoFk + 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 + SET isChecked = TRUE WHERE geoFk = vGeoFk; END LOOP; END LOOP; CLOSE cur1; - DELETE FROM tmp.zoneNodes + 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 + JOIN zoneWarehouse zw ON z.id = zw.zoneFk GROUP BY z.agencyModeFk, zn.geoFk, zw.warehouseFk HAVING count(*) > 1; - + SELECT ' @@ -92565,39 +77166,39 @@ BEGIN ' INTO vTableCollisions; - - INSERT INTO mail (receiver,replyTo,subject,body) + + INSERT INTO mail (receiver,replyTo,subject,body) SELECT 'pepe@verdnatura.es' receiver, 'noreply@verdnatura.es' replyTo, CONCAT('Colisiones en zonas ', util.VN_CURDATE()) subject, CONCAT(vTableCollisions, GROUP_CONCAT(sub.td SEPARATOR ''), '
C.PostalAlmacén Salix
') body - FROM(SELECT + FROM(SELECT CONCAT(' ', zn.name, ' ', zoneFk,' ', z.price,' ', z.name,' ', w.name, ' - ', CONCAT('' - 'https://salix.verdnatura.es/#!/zone/', + 'https://salix.verdnatura.es/#!/zone/', zoneFk, '/location?q=%7B%22search%22:%22', - zn.name, + 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, + + DROP TEMPORARY TABLE + geoCollision, tmp.zone, tmp.zoneNodes; END ;; @@ -92627,17 +77228,17 @@ BEGIN * @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 @@ -92654,24 +77255,28 @@ BEGIN WHERE z.agencyModeFk = vAgencyModeFk; ELSE INSERT INTO tZone - SELECT t.id + SELECT t.id FROM tmp.zone t JOIN zone z ON z.id = t.id - JOIN agencyMode am ON am.id = z.agencyModeFk + 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; - + JOIN zoneExclusion e ON e.zoneFk = t.id + LEFT JOIN zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id + JOIN zoneGeo zg1 ON zg1.id = eg.geoFk + JOIN zoneGeo zg2 ON zg2.id = vGeoFk + WHERE eg.zoneExclusionFk IS NULL OR zg2.`path` LIKE CONCAT(zg1.`path`,'%'); + DROP TEMPORARY TABLE tZone; END ;; DELIMITER ; @@ -92700,18 +77305,18 @@ BEGIN 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; @@ -92719,7 +77324,7 @@ BEGIN SELECT vChildFk, vLevel FROM DUAL WHERE vChildFk IS NOT NULL; - + IF ROW_COUNT() = 0 THEN LEAVE myLoop; END IF; @@ -92736,6 +77341,7 @@ BEGIN FROM tNodes n JOIN zoneIncluded i ON i.geoFk = n.id ORDER BY zoneFk, n.`level` + LIMIT 10000000000000000000 ) t GROUP BY id HAVING isIncluded ) t; @@ -92769,10 +77375,13 @@ BEGIN * @param vWarehouseFk vWarehouseFk * @table tmp.zoneGetLanded Datos de recepción */ - CALL vn.zone_getFromGeo(address_getGeo(vAddressFk)); + DECLARE vZoneGeo INT; + SELECT address_getGeo(vAddressFk) INTO vZoneGeo; + + CALL vn.zone_getFromGeo(vZoneGeo); CALL vn.zone_getOptionsForShipment(vShipped, vShowExpiredZones); - + CALL vn.zone_excludeFromGeo(vZoneGeo); CALL vn.zone_getClosed(); DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded; @@ -92784,13 +77393,15 @@ BEGIN 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 + LEFT JOIN tmp.closedZones cz ON cz.warehouseFk = zw.warehouseFk AND cz.zoneFk = zw.zoneFk AND zo.shipped = util.VN_CURDATE() WHERE z.agencyModeFk = vAgencyModeFk AND zw.warehouseFk = vWarehouseFk - AND (ISNULL(cz.zoneFk) OR vShowExpiredZones); + AND (ISNULL(cz.zoneFk) OR vShowExpiredZones) + ORDER BY z.price DESC, zo.zoneFk + LIMIT 1; DROP TEMPORARY TABLE tmp.`zone`, @@ -92813,7 +77424,7 @@ DELIMITER ; /*!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 +BEGIN /** * Devuelve las ubicaciones incluidas en la ruta y que sean hijos de parentFk. * @param vSelf Id de la zona @@ -92827,23 +77438,23 @@ BEGIN CREATE TEMPORARY TABLE tNodes (UNIQUE (id)) ENGINE = MEMORY - SELECT id - FROM zoneGeo + SELECT id + FROM zoneGeo LIMIT 0; IF vIsSearch THEN SET vIsNumber = vSearch REGEXP '^[0-9]+$'; - + INSERT INTO tNodes - SELECT id + 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 + SELECT geoFk FROM zoneIncluded WHERE zoneFk = vSelf; END IF; @@ -92852,14 +77463,14 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tChilds; CREATE TEMPORARY TABLE tChilds ENGINE = MEMORY - SELECT id + SELECT id FROM tNodes; DROP TEMPORARY TABLE IF EXISTS tParents; CREATE TEMPORARY TABLE tParents ENGINE = MEMORY - SELECT id - FROM zoneGeo + SELECT id + FROM zoneGeo LIMIT 0; myLoop: LOOP @@ -92869,27 +77480,27 @@ BEGIN FROM zoneGeo g JOIN tChilds c ON c.id = g.id WHERE g.parentFk IS NOT NULL; - + INSERT IGNORE INTO tNodes - SELECT id + SELECT id FROM tParents; - + IF ROW_COUNT() = 0 THEN LEAVE myLoop; END IF; - + DELETE FROM tChilds; INSERT INTO tChilds - SELECT id + SELECT id FROM tParents; END LOOP; - + DROP TEMPORARY TABLE tChilds, tParents; END IF; IF !vIsSearch THEN INSERT IGNORE INTO tNodes - SELECT id + SELECT id FROM zoneGeo WHERE parentFk <=> vParentFk; END IF; @@ -92922,13 +77533,13 @@ 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 +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) * */ @@ -92939,23 +77550,23 @@ BEGIN CREATE TEMPORARY TABLE tNodes (UNIQUE (id)) ENGINE = MEMORY - SELECT id - FROM zoneGeo + SELECT id + FROM zoneGeo LIMIT 0; IF vIsSearch THEN SET vIsNumber = vSearch REGEXP '^[0-9]+$'; INSERT INTO tNodes - SELECT id + 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 + SELECT geoFk FROM zoneIncluded WHERE zoneFk = vSelf; END IF; @@ -92965,15 +77576,15 @@ BEGIN CREATE TEMPORARY TABLE tChilds (INDEX(id)) ENGINE = MEMORY - SELECT id + SELECT id FROM tNodes; DROP TEMPORARY TABLE IF EXISTS tParents; CREATE TEMPORARY TABLE tParents (INDEX(id)) ENGINE = MEMORY - SELECT id - FROM zoneGeo + SELECT id + FROM zoneGeo LIMIT 0; myLoop: LOOP @@ -92983,27 +77594,27 @@ BEGIN FROM zoneGeo g JOIN tChilds c ON c.id = g.id WHERE g.parentFk IS NOT NULL; - + INSERT IGNORE INTO tNodes - SELECT id + SELECT id FROM tParents; - + IF ROW_COUNT() = 0 THEN LEAVE myLoop; END IF; - + DELETE FROM tChilds; INSERT INTO tChilds - SELECT id + SELECT id FROM tParents; END LOOP; - + DROP TEMPORARY TABLE tChilds, tParents; END IF; IF !vIsSearch THEN INSERT IGNORE INTO tNodes - SELECT id + SELECT id FROM zoneGeo WHERE parentFk <=> vParentFk; END IF; @@ -93018,112 +77629,8 @@ BEGIN 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 + 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 ;; @@ -93150,7 +77657,7 @@ BEGIN * @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 @@ -93160,6 +77667,7 @@ BEGIN travelingDays, price, bonus, + vLanded landed, TIMESTAMPADD(DAY, -travelingDays, vLanded) shipped FROM ( SELECT t.id zoneFk, @@ -93188,12 +77696,14 @@ BEGIN THEN 2 ELSE 3 END + LIMIT 10000000000000000000 ) t GROUP BY zoneFk; DELETE t FROM tmp.zoneOption t - JOIN zoneExclusion e - ON e.zoneFk = t.zoneFk AND e.`dated` = vLanded; + JOIN zoneExclusion e ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed + LEFT JOIN zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id + WHERE eg.zoneExclusionFk IS NULL; IF NOT vShowExpiredZones THEN DELETE FROM tmp.zoneOption @@ -93226,7 +77736,7 @@ BEGIN * @return tmp.zoneOption(zoneFk, hour, travelingDays, price, bonus, specificity) The computed options */ DECLARE vHour TIME DEFAULT TIME(util.VN_NOW()); - + DROP TEMPORARY TABLE IF EXISTS tLandings; CREATE TEMPORARY TABLE tLandings (INDEX (eventFk)) @@ -93272,14 +77782,16 @@ BEGIN THEN 2 ELSE 3 END + LIMIT 10000000000000000000 ) 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; + JOIN zoneExclusion e ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed + LEFT JOIN zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id + WHERE eg.zoneExclusionFk IS NULL; IF NOT vShowExpiredZones THEN DELETE FROM tmp.zoneOption @@ -93292,6 +77804,70 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `zone_getPostalCode` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_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_getPostalCode`(vSelf INT) +BEGIN +/** + * Devuelve los códigos postales incluidos en una zona + */ + DECLARE vGeoFk INT DEFAULT NULL; + + 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 zoneNodesPk (zoneFk, geoFk), + INDEX(geoFk)) + ENGINE = MEMORY; + + CALL zone_getLeaves2(vSelf, NULL , NULL); + + UPDATE tmp.zoneNodes zn + SET isChecked = 0 + WHERE parentFk IS NULL; + + myLoop: LOOP + SET vGeoFk = NULL; + SELECT geoFk INTO vGeoFk + FROM tmp.zoneNodes zn + WHERE NOT isChecked + LIMIT 1; + + CALL zone_getLeaves2(vSelf, vGeoFk, NULL); + UPDATE tmp.zoneNodes + SET isChecked = TRUE + WHERE geoFk = vGeoFk; + + IF vGeoFk IS NULL THEN + LEAVE myLoop; + END IF; + END LOOP; + + DELETE FROM tmp.zoneNodes + WHERE sons > 0; + + SELECT zn.geoFk, zn.name + FROM tmp.zoneNodes zn + JOIN zone z ON z.id = zn.zoneFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_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 */ ; @@ -93313,8 +77889,13 @@ BEGIN * @param vAgencyModeFk Id de la agencia * @return tmp.zoneGetShipped */ - CALL vn.zone_getFromGeo(address_getGeo(vAddressFk)); + DECLARE vZoneGeo INT; + + SELECT address_getGeo(vAddressFk) INTO vZoneGeo; + + CALL vn.zone_getFromGeo(vZoneGeo); CALL vn.zone_getOptionsForLanding(vLanded, vShowExpiredZones); + CALL vn.zone_excludeFromGeo(vZoneGeo); CALL vn.zone_getClosed(); DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetShipped; @@ -93331,13 +77912,14 @@ BEGIN 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 + LEFT JOIN tmp.closedZones cz ON cz.warehouseFk = zw.warehouseFk AND cz.zoneFk = zw.zoneFk AND zo.shipped = util.VN_CURDATE() WHERE z.agencyModeFk = vAgencyModeFk AND (ISNULL(cz.zoneFk) OR vShowExpiredZones) - ORDER BY shipped) t + ORDER BY shipped + LIMIT 10000000000000000000) t GROUP BY warehouseFk; DROP TEMPORARY TABLE @@ -93364,9 +77946,9 @@ 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 ( @@ -93380,21 +77962,21 @@ BEGIN CALL vn.zone_getOptionsForShipment(vDated, TRUE); CALL vn.zone_getClosed(); - + SELECT zo.zoneFk, zo.`hour`etd, - (zo.`hour` <= TIME(now())) isLate, + (zo.`hour` <= TIME(util.VN_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 + LEFT JOIN tmp.closedZones cz + ON cz.warehouseFk = zw.warehouseFk AND cz.zoneFk = zo.zoneFk; - - DROP TEMPORARY TABLE + + DROP TEMPORARY TABLE tmp.closedZones, tmp.zoneOption, tmp.zone; @@ -93420,21 +78002,21 @@ 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, + + SELECT am.id agencyModeFk, + am.name agencyMode, + am.description, am.deliveryMethodFk, - TIMESTAMPADD(DAY, -zo.travelingDays, vLanded) shipped, + TIMESTAMPADD(DAY, -zo.travelingDays, vLanded) shipped, zw.warehouseFk, z.id zoneFk FROM tmp.zoneOption zo @@ -93444,11 +78026,11 @@ BEGIN 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 */ ; @@ -93461,15 +78043,15 @@ 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 `zone_upcomingDeliveries`() BEGIN DECLARE vForwardDays INT; - + SELECT forwardDays INTO vForwardDays FROM zoneConfig; CALL util.time_createTable(util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL vForwardDays DAY)); @@ -93485,7 +78067,7 @@ BEGIN JOIN zoneEvent e ON e.zoneFk = z.id JOIN tmp.time ti ON ti.dated BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY, vForwardDays, util.VN_CURDATE()); - DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; + DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; CREATE TEMPORARY TABLE tmp.zoneOption ENGINE = MEMORY SELECT * @@ -93518,13 +78100,15 @@ BEGIN THEN 2 ELSE 3 END + LIMIT 10000000000000000000 ) t GROUP BY zoneFk, landed; DELETE t FROM tmp.zoneOption t - JOIN zoneExclusion e - ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed; - + JOIN zoneExclusion e ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed + LEFT JOIN zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id + WHERE eg.zoneExclusionFk IS NULL; + SELECT MAX(zo.`hour`) `hour`, zg.`name`, zo.shipped, zo.zoneFk FROM tmp.zoneOption zo JOIN `zone` z ON z.id = zo.zoneFk @@ -93535,7 +78119,7 @@ BEGIN WHERE dm.code = 'DELIVERY' GROUP BY shipped, zg.`name` ORDER BY shipped, zg.`name`; - + DROP TEMPORARY TABLE tmp.time, tLandings; END ;; DELIMITER ; @@ -93544,251 +78128,6 @@ DELIMITER ; /*!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, util.VN_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` -- @@ -93809,7 +78148,7 @@ USE `account`; /*!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` <> 0 */; +/*!50001 VIEW `accountDovecot` AS select `u`.`name` AS `name`,`u`.`bcryptPassword` AS `password` from (`user` `u` join `account` `a` on(`a`.`id` = `u`.`id`)) where `u`.`active` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -93866,7 +78205,7 @@ USE `account`; /*!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`() */ +/*!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` = `myUser_getName`() */ /*!50002 WITH CASCADED CHECK OPTION */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -93892,7 +78231,7 @@ USE `bs`; /*!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`,util.VN_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` >= util.VN_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` >= util.VN_CURDATE() */; +/*!50001 VIEW `bajasLaborales` AS select `w`.`firstName` AS `firstname`,`w`.`lastName` AS `name`,`b`.`id` AS `businessFk`,max(`ce`.`date`) AS `lastDate`,max(ifnull(`b`.`ended`,util.VN_CURDATE())) AS `endContract`,`at`.`name` AS `type`,cast(count(0) as decimal(10,0)) AS `dias`,`w`.`id` AS `userFk` from (((`postgresql`.`calendar_employee` `ce` join `vn`.`business` `b` on(`b`.`id` = `ce`.`businessFk`)) join `vn`.`worker` `w` on(`w`.`id` = `b`.`workerFk`)) join `vn`.`absenceType` `at` on(`at`.`id` = `ce`.`calendar_state_id`)) where `ce`.`date` >= util.VN_CURDATE() + interval -1 year and `at`.`name` not in ('Vacaciones','Vacaciones 1/2 día','Compensar','Festivo') group by `w`.`id`,`at`.`id` having `endContract` >= util.VN_CURDATE() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -93911,102 +78250,7 @@ USE `bs`; /*!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 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`.`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 */; @@ -94068,63 +78312,6 @@ USE `bs`; /*!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 `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` -- @@ -94144,25 +78331,6 @@ USE `bs`; /*!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` -- @@ -94175,6 +78343,25 @@ USE `cache`; USE `edi`; +-- +-- Final view structure for view `ektRecent` +-- + +/*!50001 DROP TABLE IF EXISTS `ektRecent`*/; +/*!50001 DROP VIEW IF EXISTS `ektRecent`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ektRecent` AS select `e`.`id` AS `id`,`e`.`barcode` AS `barcode`,`e`.`entryYear` AS `entryYear`,`e`.`batchNumber` AS `batchNumber`,`e`.`deliveryNumber` AS `deliveryNumber`,`e`.`vendorOrderNumber` AS `vendorOrderNumber`,`e`.`fec` AS `fec`,`e`.`hor` AS `hor`,`e`.`util.VN_NOW` AS `util.VN_NOW`,`e`.`ptj` AS `ptj`,`e`.`ref` AS `ref`,`e`.`item` AS `item`,`e`.`pac` AS `pac`,`e`.`qty` AS `qty`,`e`.`ori` AS `ori`,`e`.`cat` AS `cat`,`e`.`agj` AS `agj`,`e`.`kop` AS `kop`,`e`.`ptd` AS `ptd`,`e`.`sub` AS `sub`,`e`.`pro` AS `pro`,`e`.`pri` AS `pri`,`e`.`package` AS `package`,`e`.`auction` AS `auction`,`e`.`klo` AS `klo`,`e`.`k1` AS `k1`,`e`.`k2` AS `k2`,`e`.`k3` AS `k3`,`e`.`k4` AS `k4`,`e`.`s1` AS `s1`,`e`.`s2` AS `s2`,`e`.`s3` AS `s3`,`e`.`s4` AS `s4`,`e`.`s5` AS `s5`,`e`.`s6` AS `s6`,`e`.`ok` AS `ok`,`e`.`trolleyFk` AS `trolleyFk`,`e`.`putOrderFk` AS `putOrderFk`,`e`.`scanned` AS `scanned`,`e`.`cps` AS `cps`,`e`.`dp` AS `dp`,`e`.`sender` AS `sender`,`ec`.`usefulAuctionLeftSegmentLength` AS `usefulAuctionLeftSegmentLength`,`ec`.`standardBarcodeLength` AS `standardBarcodeLength`,`ec`.`floridayBarcodeLength` AS `floridayBarcodeLength`,`ec`.`floramondoBarcodeLength` AS `floramondoBarcodeLength`,`ec`.`defaultKlo` AS `defaultKlo`,`ec`.`ektRecentScopeDays` AS `ektRecentScopeDays` from (`ekt` `e` join `ektConfig` `ec`) where `e`.`entryYear` = year(util.VN_CURDATE()) and `e`.`fec` >= util.VN_CURDATE() + interval -`ec`.`ektRecentScopeDays` 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 `errorList` -- @@ -94208,7 +78395,7 @@ USE `edi`; /*!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 current_timestamp() 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 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 current_timestamp() 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`) and `sr`.`NumberOfItemsPerCask` > 1 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 */; @@ -94587,12 +78774,6 @@ USE `hedera`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Current Database: `nst` --- - -USE `nst`; - -- -- Current Database: `pbx` -- @@ -94733,26 +78914,7 @@ USE `postgresql`; /*!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 VIEW `calendar_employee` AS select `ce`.`id` AS `id`,`ce`.`businessFk` AS `businessFk`,`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 */; @@ -94802,11 +78964,11 @@ USE `sage`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `providerLastThreeMonths` +-- Final view structure for view `supplierLastThreeMonths` -- -/*!50001 DROP TABLE IF EXISTS `providerLastThreeMonths`*/; -/*!50001 DROP VIEW IF EXISTS `providerLastThreeMonths`*/; +/*!50001 DROP TABLE IF EXISTS `supplierLastThreeMonths`*/; +/*!50001 DROP VIEW IF EXISTS `supplierLastThreeMonths`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -94815,7 +78977,7 @@ USE `sage`; /*!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` > util.VN_CURDATE() - interval 3 month union select `vn`.`payment`.`supplierFk` AS `supplierFk`,`vn`.`payment`.`companyFk` AS `companyFk` from `vn`.`payment` where `vn`.`payment`.`received` > util.VN_CURDATE() + interval -3 month */; +/*!50001 VIEW `supplierLastThreeMonths` AS select `vn`.`invoiceIn`.`supplierFk` AS `supplierFk`,`vn`.`invoiceIn`.`companyFk` AS `companyFk` from `vn`.`invoiceIn` where `vn`.`invoiceIn`.`issued` > util.VN_CURDATE() - interval 3 month union select `vn`.`payment`.`supplierFk` AS `supplierFk`,`vn`.`payment`.`companyFk` AS `companyFk` from `vn`.`payment` where `vn`.`payment`.`received` > util.VN_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 */; @@ -94914,6 +79076,25 @@ USE `stock`; USE `util`; +-- +-- Final view structure for view `eventLogGrouped` +-- + +/*!50001 DROP TABLE IF EXISTS `eventLogGrouped`*/; +/*!50001 DROP VIEW IF EXISTS `eventLogGrouped`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb3 */; +/*!50001 SET character_set_results = utf8mb3 */; +/*!50001 SET collation_connection = utf8mb3_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `eventLogGrouped` AS select max(`t`.`date`) AS `lastHappened`,count(0) AS `nErrors`,`t`.`event` AS `event`,`t`.`error` AS `error` from `eventLog` `t` group by `t`.`event`,`t`.`error` order by max(`t`.`date`) desc */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Current Database: `vn` -- @@ -94934,17 +79115,17 @@ USE `vn`; /*!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` < util.VN_CURDATE() + interval (-`pc`.`rookieDays`) day)) group by `c`.`id` having `lastShipped` is null or `lastShipped` < util.VN_CURDATE() + interval (-`notBuyingMonths`) month */; +/*!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` < util.VN_CURDATE() + interval -`pc`.`rookieDays` day)) group by `c`.`id` having `lastShipped` is null or `lastShipped` < util.VN_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 `absenceType` +-- Final view structure for view `__coolerPathDetail` -- -/*!50001 DROP TABLE IF EXISTS `absenceType`*/; -/*!50001 DROP VIEW IF EXISTS `absenceType`*/; +/*!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 */; @@ -94953,7 +79134,7 @@ USE `vn`; /*!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 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 */; @@ -94967,28 +79148,9 @@ 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 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 `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 SET character_set_client = utf8mb3 */; +/*!50001 SET character_set_results = utf8mb3 */; +/*!50001 SET collation_connection = utf8mb3_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` */; @@ -95015,6 +79177,25 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `awbVolume` +-- + +/*!50001 DROP TABLE IF EXISTS `awbVolume`*/; +/*!50001 DROP VIEW IF EXISTS `awbVolume`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awbVolume` AS select `d`.`awbFk` AS `awbFk`,`b`.`stickers` * `i`.`density` * if(`p`.`volume` > 0,`p`.`volume`,`p`.`width` * `p`.`depth` * if(`p`.`height` = 0,`i`.`size` + 10,`p`.`height`)) / (`vc`.`aerealVolumetricDensity` * 1000) AS `volume`,`b`.`id` AS `buyFk` from ((((((((`buy` `b` join `item` `i` on(`b`.`itemFk` = `i`.`id`)) join `itemType` `it` on(`i`.`typeFk` = `it`.`id`)) join `packaging` `p` on(`p`.`id` = `b`.`packageFk`)) join `entry` `e` on(`b`.`entryFk` = `e`.`id`)) join `travel` `t` on(`t`.`id` = `e`.`travelFk`)) join `duaEntry` `de` on(`de`.`entryFk` = `e`.`id`)) join `dua` `d` on(`d`.`id` = `de`.`duaFk`)) join `volumeConfig` `vc`) where `t`.`shipped` > makedate(year(util.VN_CURDATE()) - 1,1) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `bank` -- @@ -95034,6 +79215,25 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `bankPolicy` +-- + +/*!50001 DROP 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` -- @@ -95048,7 +79248,7 @@ USE `vn`; /*!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 VIEW `businessCalendar` AS select `ce`.`id` AS `id`,`ce`.`businessFk` 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 */; @@ -95091,25 +79291,6 @@ USE `vn`; /*!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 `clientLost` -- @@ -95124,26 +79305,7 @@ USE `vn`; /*!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` < util.VN_CURDATE() + interval (-`pc`.`rookieDays`) day)) group by `c`.`id` having `lastShipped` is null or `lastShipped` < util.VN_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 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` < util.VN_CURDATE() + interval -`pc`.`rookieDays` day)) group by `c`.`id` having `lastShipped` is null or `lastShipped` < util.VN_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 */; @@ -95186,63 +79348,6 @@ USE `vn`; /*!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 `defaulter` -- @@ -95276,7 +79381,7 @@ USE `vn`; /*!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 VIEW `departmentTree` AS select `node`.`id` AS `id`,concat(convert(repeat(repeat(' ',5),count(`parent`.`id`) - 1) using utf8mb3),`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 */; @@ -95338,25 +79443,6 @@ USE `vn`; /*!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 util.VN_CURDATE() + interval -1 week and util.VN_CURDATE() + interval 3 month order by `tr`.`landed` < util.VN_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` -- @@ -95376,6 +79462,25 @@ USE `vn`; /*!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` -- @@ -95395,6 +79500,25 @@ USE `vn`; /*!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` -- @@ -95414,6 +79538,25 @@ USE `vn`; /*!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` > util.VN_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`)) 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` -- @@ -95428,7 +79571,7 @@ USE `vn`; /*!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(`e`.`id` is null,`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 `st`.`id` is null group by `r`.`id` */; +/*!50001 VIEW `expeditionRoute_Monitor` AS select `r`.`id` AS `routeFk`,count(distinct if(`e`.`id` is null,`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`)) where `r`.`created` >= `util`.`yesterday`() 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 */; @@ -95447,7 +79590,7 @@ USE `vn`; /*!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 `st`.`id` is null */; +/*!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 (((((`ticketState` `tss` join `ticket` `t` on(`t`.`id` = `tss`.`ticket`)) join `warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) join `state` `s` on(`s`.`id` = `tss`.`state`)) left join `ticketParking` `tp` on(`tp`.`ticketFk` = `t`.`id`)) left join `parking` `p` on(`p`.`id` = `tp`.`parkingFk`)) where ifnull(`t`.`packages`,0) = 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95485,26 +79628,7 @@ USE `vn`; /*!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 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(',right(`t`.`routeFk`,3),')') AS `routeFk`,`rm`.`beachFk` AS `beachFk`,if(`t`.`routeFk`,ifnull(`et`.`description`,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 `expeditionTruck` `et` on(`et`.`id` = `rm`.`expeditionTruckFk`)) left join `beach` `b` on(`b`.`code` = `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 */; @@ -95642,82 +79766,6 @@ USE `vn`; /*!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` -- @@ -95827,7 +79875,7 @@ USE `vn`; /*!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 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`.`isExcludedFromAvailable` = 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 */; @@ -95846,7 +79894,7 @@ USE `vn`; /*!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 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`.`isExcludedFromAvailable` = 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 */; @@ -95941,7 +79989,7 @@ USE `vn`; /*!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`(util.VN_CURDATE()) and `stk`.`id` is null and `stock`.`visible` > 0 and `stk`.`saleFk` is null and `st`.`isPreviousPreparable` <> 0 */; +/*!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 (((((((((`sale` `s` join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `agencyMode` `am` on(`am`.`id` = `t`.`agencyModeFk`)) join `ticketStateToday` `tst` on(`tst`.`ticket` = `t`.`id`)) join `state` `st` on(`st`.`id` = `tst`.`state`)) join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `itemShelvingStock` `stock` on(`stock`.`itemFk` = `i`.`id`)) left join `saleTracking` `stk` on(`stk`.`saleFk` = `s`.`id`)) left join `zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `saleVolume` `sv` on(`sv`.`saleFk` = `s`.`id`)) where `t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(util.VN_CURDATE()) and `stk`.`id` is null and `stock`.`visible` > 0 and `stk`.`saleFk` is null and `st`.`isPreviousPreparable` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95979,7 +80027,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`.`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 */; @@ -96150,7 +80198,7 @@ USE `vn`; /*!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 `i2`.`id` is null and `i1`.`id` > 400000 */; +/*!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 `i2`.`id` is null and `i1`.`isFloramondo` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96207,7 +80255,7 @@ USE `vn`; /*!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 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`.`invoiceNumber` 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 */; @@ -96289,11 +80337,11 @@ USE `vn`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `newBornSales__` +-- Final view structure for view `operatorWorkerCode` -- -/*!50001 DROP TABLE IF EXISTS `newBornSales__`*/; -/*!50001 DROP VIEW IF EXISTS `newBornSales__`*/; +/*!50001 DROP TABLE IF EXISTS `operatorWorkerCode`*/; +/*!50001 DROP VIEW IF EXISTS `operatorWorkerCode`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -96302,7 +80350,7 @@ USE `vn`; /*!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 VIEW `operatorWorkerCode` AS select `o`.`workerFk` AS `workerFk`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `fullName`,`w`.`code` AS `code`,`o`.`numberOfWagons` AS `numberOfWagons` from ((`worker` `w` join `operator` `o` on(`o`.`workerFk` = `w`.`id`)) join `sector` `s` on(`w`.`sectorFk` = `s`.`id`)) where `w`.`sectorFk` is not null and `s`.`code` in ('H2','H2','PEQUES_H','ALTILLO COMP','ALTILLO ARTI') */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96345,44 +80393,6 @@ USE `vn`; /*!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` -- @@ -96397,7 +80407,26 @@ USE `vn`; /*!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 VIEW `personMedia` AS select `c`.`id` AS `workerFk`,ifnull(`c`.`mobile`,`c`.`phone`) AS `mediaValue` from (`client` `c` join `worker` `w` on(`w`.`id` = `c`.`id`)) having `mediaValue` is not null */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `phoneBook` +-- + +/*!50001 DROP TABLE IF EXISTS `phoneBook`*/; +/*!50001 DROP VIEW IF EXISTS `phoneBook`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `phoneBook` AS select 'C' AS `Tipo`,`client`.`id` AS `Id`,`client`.`name` AS `Cliente`,`client`.`phone` AS `Telefono` from `client` where `client`.`phone` is not null union select 'C' AS `Tipo`,`client`.`id` AS `Id`,`client`.`name` AS `Cliente`,`client`.`mobile` AS `Movil` from `client` where `client`.`mobile` is not null union select 'C' AS `Tipo`,`clientContact`.`clientFk` AS `clientFk`,`clientContact`.`name` AS `name`,`clientContact`.`phone` AS `phone` from `clientContact` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96416,7 +80445,7 @@ USE `vn`; /*!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 util.VN_CURDATE() and `util`.`dayend`(util.VN_CURDATE()) and `c`.`isRelevant` <> 0 */; +/*!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`.`id` = `e`.`packagingFk`)) join `ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) join `client` `c` on(`c`.`id` = `t`.`clientFk`)) where `e`.`created` between util.VN_CURDATE() and `util`.`dayend`(util.VN_CURDATE()) and `c`.`isRelevant` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96440,44 +80469,6 @@ USE `vn`; /*!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`,current_timestamp() 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`,current_timestamp() AS `time_sec` from (`bs`.`vendedores` `v` join `account`.`user` `u` on(`u`.`id` = `v`.`Id_Trabajador`)) where `v`.`año` = year(util.VN_CURDATE()) and quarter(concat(year(util.VN_CURDATE()),'-',`v`.`mes`,'-01')) = quarter(util.VN_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 `role` -- @@ -96497,6 +80488,25 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `routesReduced` +-- + +/*!50001 DROP TABLE IF EXISTS `routesReduced`*/; +/*!50001 DROP VIEW IF EXISTS `routesReduced`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `routesReduced` AS select `et`.`description` AS `description`,`rm`.`name` AS `name`,`t`.`routeFk` AS `routeFk`,`et`.`ETD` AS `ETD`,`rm`.`bufferFk` AS `bufferFk`,`rm`.`beachFk` AS `beachFk`,`i`.`itemPackingTypeFk` AS `itempackingTypeFk` from (((((((`expeditionTruck` `et` join `routesMonitor` `rm` on(`rm`.`expeditionTruckFk` = `et`.`id`)) join `ticket` `t` on(`t`.`routeFk` = `rm`.`routeFk`)) join `ticketState` `ts` on(`ts`.`ticketFk` = `t`.`id`)) join `state` `st` on(`st`.`id` = `ts`.`stateFk`)) join `sale` `s` on(`s`.`ticketFk` = `t`.`id`)) join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `config` `c`) where `et`.`ETD` > `util`.`yesterday`() group by `t`.`routeFk` order by `et`.`ETD`,`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 `saleCost` -- @@ -96516,6 +80526,25 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `saleLabel` +-- + +/*!50001 DROP TABLE IF EXISTS `saleLabel`*/; +/*!50001 DROP VIEW IF EXISTS `saleLabel`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `saleLabel` AS select `ml`.`Id_movimiento` AS `saleFk`,`ml`.`label` AS `label`,`ml`.`stem` AS `stem`,`ml`.`created` AS `created` from `vn2008`.`movement_label` `ml` */; +/*!50001 SET character_set_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` -- @@ -96530,26 +80559,7 @@ USE `vn`; /*!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 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 (((((`saleTracking` `st` join `worker` `w2` on(`w2`.`id` = `st`.`workerFk`)) join `state` `s` on(`s`.`id` = `st`.`stateFk` and `s`.`code` in ('PREVIOUS_PREPARATION','PREPARED','OK'))) left join `saleMistake` `sm` on(`st`.`saleFk` = `sm`.`saleFk`)) left join `mistakeType` `mt` on(`mt`.`id` = `sm`.`typeFk`)) left join `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 */; @@ -96568,7 +80578,7 @@ USE `vn`; /*!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 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 (((((`saleTracking` `st` join `worker` `w2` on(`w2`.`id` = `st`.`workerFk`)) join `state` `s` on(`s`.`id` = `st`.`stateFk` and `s`.`code` in ('PREVIOUS_PREPARATION','PREPARED','OK'))) left join `saleMistake` `sm` on(`st`.`saleFk` = `sm`.`saleFk`)) left join `mistakeType` `mt` on(`mt`.`id` = `sm`.`typeFk`)) left join `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 */; @@ -96625,7 +80635,7 @@ USE `vn`; /*!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 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(`ic`.`grams` / `ic`.`cm3delivery`,`vc`.`aerealVolumetricDensity`) / 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 */; @@ -96682,7 +80692,7 @@ USE `vn`; /*!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 VIEW `salesPersonSince` AS select `b`.`workerFk` AS `workerFk`,min(`b`.`started`) AS `started` from ((`vn`.`business` `b` join `vn`.`worker` `w` on(`w`.`id` = `b`.`workerFk`)) left join `postgresql`.`professional_category` `pc` on(`pc`.`professional_category_id` = `b`.`workerBusinessProfessionalCategoryFk`)) where `pc`.`category_name` = 'Aux ventas' group by `b`.`workerFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96701,7 +80711,7 @@ USE `vn`; /*!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` > current_timestamp() + interval -1 hour and `prevPrepSales`.`saleFk` is null and `d`.`name` not like 'EQUIPO%' */; +/*!50001 VIEW `salesPreparedLastHour` AS select `t`.`warehouseFk` AS `warehouseFk`,`st`.`saleFk` AS `saleFk`,`st`.`isChecked` AS `isChecked`,`st`.`originalQuantity` AS `originalQuantity`,`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 ((((((((`saleTracking` `st` left join `salesPreviousPreparated` `prevPrepSales` on(`prevPrepSales`.`saleFk` = `st`.`saleFk`)) join `sale` `s` on(`s`.`id` = `st`.`saleFk`)) join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `itemCost` `ic` on(`ic`.`warehouseFk` = `t`.`warehouseFk` and `ic`.`itemFk` = `s`.`itemFk`)) join `worker` `w` on(`w`.`id` = `st`.`workerFk`)) join `state` `e` on(`e`.`id` = `st`.`stateFk`)) join `workerDepartment` `wd` on(`wd`.`workerFk` = `st`.`workerFk`)) join `department` `d` on(`d`.`id` = `wd`.`departmentFk`)) where `st`.`created` > current_timestamp() + interval -1 hour and `prevPrepSales`.`saleFk` is null and `d`.`name` not 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 */; @@ -96763,25 +80773,6 @@ USE `vn`; /*!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(current_timestamp() + 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`(util.VN_CURDATE()) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `ticketLastUpdated` -- @@ -96796,7 +80787,7 @@ USE `vn`; /*!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 VIEW `ticketLastUpdated` AS select `ticketLastUpdatedList`.`ticketFk` AS `ticketFk`,max(`ticketLastUpdatedList`.`created`) AS `lastUpdated` from `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 */; @@ -96815,26 +80806,7 @@ USE `vn`; /*!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 VIEW `ticketLastUpdatedList` AS select `s`.`ticketFk` AS `ticketFk`,`st`.`created` AS `created` from (`saleTracking` `st` join `sale` `s` on(`s`.`id` = `st`.`saleFk`)) where `st`.`created` > util.VN_CURDATE() union all select `tt`.`ticketFk` AS `Id_Ticket`,`tt`.`created` AS `odbc_date` from `ticketTracking` `tt` where `tt`.`created` > util.VN_CURDATE() union all select `s`.`ticketFk` AS `ticketFk`,`iss`.`created` AS `created` from (`itemShelvingSale` `iss` join `sale` `s` on(`s`.`id` = `iss`.`saleFk`)) where `iss`.`created` > util.VN_CURDATE() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96853,7 +80825,7 @@ USE `vn`; /*!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 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 */; @@ -96910,7 +80882,7 @@ USE `vn`; /*!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` >= util.VN_CURDATE() + interval 0.1 day group by `sg`.`id` */; +/*!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 (((((((`saleGroup` `sg` join `saleGroupDetail` `sgd` on(`sgd`.`saleGroupFk` = `sg`.`id`)) join `sale` `s` on(`s`.`id` = `sgd`.`saleFk`)) join `ticketState` `tls` on(`tls`.`ticketFk` = `s`.`ticketFk`)) join `alertLevel` `al` on(`al`.`id` = `tls`.`alertLevel`)) join `worker` `w` on(`w`.`id` = `sg`.`userFk`)) left join `parking` `p` on(`p`.`id` = `sg`.`parkingFk`)) join `itemShelvingStock` `iss` on(`iss`.`itemFk` = `s`.`itemFk`)) where `sg`.`created` >= util.VN_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 */; @@ -96929,7 +80901,7 @@ USE `vn`; /*!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 VIEW `ticketState` AS select `tt`.`created` AS `updated`,`tt`.`stateFk` AS `stateFk`,`tt`.`workerFk` 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`,`tt`.`workerFk` AS `worker`,`s`.`isPreviousPreparable` AS `isPreviousPreparable`,`s`.`isPicked` AS `isPicked` from ((`ticketLastState` `tls` join `ticketTracking` `tt` on(`tt`.`id` = `tls`.`ticketTrackingFk`)) join `state` `s` on(`s`.`id` = `tt`.`stateFk`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96948,26 +80920,7 @@ USE `vn`; /*!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 util.VN_CURDATE() and `MIDNIGHT`(util.VN_CURDATE()) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- 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 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 (`ticketState` `ts` join `ticket` `t` on(`t`.`id` = `ts`.`ticket`)) where `t`.`shipped` between util.VN_CURDATE() and `MIDNIGHT`(util.VN_CURDATE()) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -96986,7 +80939,7 @@ USE `vn`; /*!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 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`.`agencyModeFk` 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 */; @@ -97029,25 +80982,6 @@ USE `vn`; /*!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` -- @@ -97062,7 +80996,7 @@ USE `vn`; /*!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`,util.VN_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` > util.VN_CURDATE() + interval -2 year */; +/*!50001 VIEW `workerBusinessDated` AS select `t`.`dated` AS `dated`,`b`.`id` AS `businessFk`,`b`.`workerFk` AS `workerFk` from (`time` `t` left join `business` `b` on(`t`.`dated` between `b`.`started` and ifnull(`b`.`ended`,util.VN_CURDATE()))) where `t`.`dated` > util.VN_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 */; @@ -97081,7 +81015,7 @@ USE `vn`; /*!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 VIEW `workerCalendar` AS select `b`.`id` AS `businessFk`,`b`.`workerFk` AS `workerFk`,`ce`.`calendar_state_id` AS `absenceTypeFk`,`ce`.`date` AS `dated` from (`vn`.`business` `b` join `postgresql`.`calendar_employee` `ce` on(`ce`.`businessFk` = `b`.`id`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97100,26 +81034,7 @@ USE `vn`; /*!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 `b`.`date_end` is null and `b`.`date_start` <= util.VN_CURDATE() or `b`.`date_end` >= util.VN_CURDATE() and `b`.`date_start` <= util.VN_CURDATE() */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- 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 util.VN_CURDATE() between `b`.`date_start` and ifnull(`b`.`date_end`,util.VN_CURDATE()) */; +/*!50001 VIEW `workerDepartment` AS select `b`.`workerFk` AS `workerFk`,`b`.`departmentFk` AS `departmentFk` from (`business` `b` join `worker` `w` on(`w`.`businessFk` = `b`.`id`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97138,26 +81053,7 @@ USE `vn`; /*!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 VIEW `workerLabour` AS select `b`.`id` AS `businessFk`,`b`.`workerFk` AS `workerFk`,`b`.`workcenterFk` AS `workCenterFk`,`b`.`started` AS `started`,`b`.`ended` AS `ended`,`b`.`departmentFk` AS `departmentFk`,`b`.`payedHolidays` AS `payedHolidays` from `business` `b` order by `b`.`started` desc */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97176,7 +81072,7 @@ USE `vn`; /*!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 VIEW `workerMedia` AS select `w`.`id` AS `workerFk`,`w`.`phone` AS `mediaValue` from `worker` `w` where `w`.`phone` is not null */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97214,7 +81110,7 @@ USE `vn`; /*!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` >= current_timestamp() + 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 VIEW `workerSpeedSaleTracking` AS select `salesPreparedLastHour`.`warehouseFk` AS `warehouseFk`,`salesPreparedLastHour`.`code` AS `state`,`salesPreparedLastHour`.`workerCode` AS `workerCode`,sum(`salesPreparedLastHour`.`litros`) AS `sumaLitros`,min(`salesPreparedLastHour`.`created`) AS `started`,max(`salesPreparedLastHour`.`created`) AS `finished`,sum(if(`salesPreparedLastHour`.`created` >= current_timestamp() + 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 `salesPreparedLastHour` group by `salesPreparedLastHour`.`warehouseFk`,`salesPreparedLastHour`.`code`,`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 */; @@ -97257,44 +81153,6 @@ USE `vn`; /*!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) = util.VN_CURDATE() group by `wtc`.`userFk` having `maxOrder` MOD 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` MOD 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` -- @@ -97314,25 +81172,6 @@ USE `vn`; /*!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` > util.VN_CURDATE() and `dpu`.`userFk` is null 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` -- @@ -97366,35 +81205,10 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,cast(util.VN_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` = util.VN_CURDATE())) left join `cache`.`departure_limit` `dl` on(`dl`.`warehouse_id` = `t`.`warehouseFk` and `dl`.`fecha` = util.VN_CURDATE())) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = util.VN_CURDATE() group by `t`.`zoneFk` */; +/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,cast(util.VN_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` = util.VN_CURDATE())) left join `cache`.`departure_limit` `dl` on(`dl`.`warehouse_id` = `t`.`warehouseFk` and `dl`.`fecha` = util.VN_CURDATE())) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = util.VN_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 */; @@ -97405,4 +81219,5 @@ USE `vncontrol`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 15:56:23 +-- Dump completed on 2023-02-21 8:14:30 + diff --git a/db/export-data.sh b/db/export-data.sh index 900e630f7..bdf8049e0 100755 --- a/db/export-data.sh +++ b/db/export-data.sh @@ -41,6 +41,7 @@ dump_tables ${TABLES[@]} TABLES=( vn + agencyTermConfig alertLevel bookingPlanner businessType @@ -58,6 +59,7 @@ TABLES=( componentType continent department + docuware itemPackingType pgc sample @@ -65,6 +67,7 @@ TABLES=( ticketUpdateAction time volumeConfig + workCenter ) dump_tables ${TABLES[@]} @@ -101,7 +104,6 @@ TABLES=( media_type professional_category profile_type - workcenter ) dump_tables ${TABLES[@]} @@ -111,4 +113,4 @@ TABLES=( TiposTransacciones TiposRetencion ) -dump_tables ${TABLES[@]} \ No newline at end of file +dump_tables ${TABLES[@]} diff --git a/db/export-structure.sh b/db/export-structure.sh index 1ecbcb3f0..80a2efc41 100755 --- a/db/export-structure.sh +++ b/db/export-structure.sh @@ -6,7 +6,6 @@ SCHEMAS=( cache edi hedera - nst pbx postgresql sage @@ -14,7 +13,6 @@ SCHEMAS=( stock util vn - vncontrol ) IGNORETABLES=( @@ -85,7 +83,6 @@ IGNORETABLES=( --ignore-table=vn.warehouseJoined --ignore-table=vn.workerTeam__ --ignore-table=vn.XDiario__ - --ignore-table=sage.movConta --ignore-table=sage.movContaCopia ) mysqldump \ @@ -96,12 +93,12 @@ mysqldump \ --databases \ ${SCHEMAS[@]} \ ${IGNORETABLES[@]} \ - | sed 's/\bCURDATE\b/vn.VN_CURDATE/ig'\ - | sed 's/\bCURTIME\b/vn.VN_CURTIME/ig' \ - | sed 's/\bNOW\b/vn.VN_NOW/ig' \ - | sed 's/\bCURRENT_DATE\b/vn.VN_CURDATE/ig' \ - | sed 's/\bCURRENT_TIME\b/vn.VN_CURTIME/ig' \ - | sed 's/\bLOCALTIME\b/vn.VN_NOW/ig' \ - | sed 's/\bLOCALTIMESTAMP\b/vn.VN_NOW/ig' \ + | sed 's/\bCURDATE\b/util.VN_CURDATE/ig'\ + | sed 's/\bCURTIME\b/util.VN_CURTIME/ig' \ + | sed 's/\bNOW\b/util.VN_NOW/ig' \ + | sed 's/\bCURRENT_DATE\b/util.VN_CURDATE/ig' \ + | sed 's/\bCURRENT_TIME\b/util.VN_CURTIME/ig' \ + | sed 's/\bLOCALTIME\b/util.VN_NOW/ig' \ + | sed 's/\bLOCALTIMESTAMP\b/util.VN_NOW/ig' \ | sed 's/ AUTO_INCREMENT=[0-9]* //g' \ - > dump/structure.sql \ No newline at end of file + > dump/structure.sql diff --git a/db/import-changes.sh b/db/import-changes.sh index 2b80654d3..5461f003b 100755 --- a/db/import-changes.sh +++ b/db/import-changes.sh @@ -81,9 +81,9 @@ N_CHANGES=0 for DIR_PATH in "$DIR/changes/"*; do DIR_NAME=$(basename $DIR_PATH) - DIR_VERSION=${DIR_NAME:0:5} + DIR_VERSION=${DIR_NAME:0:6} - if [[ ! "$DIR_NAME" =~ ^[0-9]{5}(-[a-zA-Z0-9]+)?$ ]]; then + if [[ ! "$DIR_NAME" =~ ^[0-9]{6}$ ]]; then echo "[WARN] Ignoring wrong directory name: $DIR_NAME" continue fi diff --git a/db/tests/vn/buyUltimate.spec.js b/db/tests/vn/buyUltimate.spec.js index e0b3fa568..4c98945c1 100644 --- a/db/tests/vn/buyUltimate.spec.js +++ b/db/tests/vn/buyUltimate.spec.js @@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server'); const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; describe('buyUltimate()', () => { - const today = new Date(); + const today = Date.vnNew(); it(`should create buyUltimate temporal table and update it's values`, async() => { let stmts = []; let stmt; diff --git a/db/tests/vn/buyUltimateFromInterval.spec.js b/db/tests/vn/buyUltimateFromInterval.spec.js index b5e6970f7..7a4a79d47 100644 --- a/db/tests/vn/buyUltimateFromInterval.spec.js +++ b/db/tests/vn/buyUltimateFromInterval.spec.js @@ -5,7 +5,7 @@ describe('buyUltimateFromInterval()', () => { let today; let future; beforeAll(() => { - let now = new Date(); + let now = Date.vnNew(); now.setHours(0, 0, 0, 0); today = now; diff --git a/db/tests/vn/orderConfirmWithUser.spec.js b/db/tests/vn/orderConfirmWithUser.spec.js deleted file mode 100644 index f2a3d0c4e..000000000 --- a/db/tests/vn/orderConfirmWithUser.spec.js +++ /dev/null @@ -1,37 +0,0 @@ -const app = require('vn-loopback/server/server'); -const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; - -// #1885 -xdescribe('order_confirmWithUser()', () => { - it('should confirm an order', async() => { - let stmts = []; - let stmt; - - stmts.push('START TRANSACTION'); - - let params = { - orderFk: 10, - userId: 9 - }; - // problema: la funcion order_confirmWithUser tiene una transacción, por tanto esta nunca hace rollback - stmt = new ParameterizedSQL('CALL hedera.order_confirmWithUser(?, ?)', [ - params.orderFk, - params.userId - ]); - stmts.push(stmt); - - stmt = new ParameterizedSQL('SELECT confirmed FROM hedera.order WHERE id = ?', [ - params.orderFk - ]); - let orderIndex = stmts.push(stmt) - 1; - - stmts.push('ROLLBACK'); - - let sql = ParameterizedSQL.join(stmts, ';'); - let result = await app.models.Ticket.rawStmt(sql); - - savedDescription = result[orderIndex][0].confirmed; - - expect(savedDescription).toBeTruthy(); - }); -}); diff --git a/db/tests/vn/ticketCalculateClon.spec.js b/db/tests/vn/ticketCalculateClon.spec.js index 03814682d..9116d805f 100644 --- a/db/tests/vn/ticketCalculateClon.spec.js +++ b/db/tests/vn/ticketCalculateClon.spec.js @@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server'); const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; describe('ticket ticketCalculateClon()', () => { - const today = new Date(); + const today = Date.vnNew(); it('should add the ticket to the order containing the original ticket', async() => { let stmts = []; let stmt; @@ -22,7 +22,7 @@ describe('ticket ticketCalculateClon()', () => { originalTicketId: 11 }; - stmt = new ParameterizedSQL('CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @result)', [ + stmt = new ParameterizedSQL('CALL vn.ticket_add(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, @result)', [ params.clientFk, params.shipped, params.warehouseFk, @@ -31,7 +31,8 @@ describe('ticket ticketCalculateClon()', () => { params.agencyType, params.routeFk, params.landed, - params.userId + params.userId, + true ]); stmts.push(stmt); @@ -71,7 +72,7 @@ describe('ticket ticketCalculateClon()', () => { originalTicketId: 11 }; - stmt = new ParameterizedSQL('CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @result)', [ + stmt = new ParameterizedSQL('CALL vn.ticket_add(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, @result)', [ params.clientFk, params.shipped, params.warehouseFk, @@ -80,7 +81,8 @@ describe('ticket ticketCalculateClon()', () => { params.agencyType, params.routeFk, params.landed, - params.userId + params.userId, + true ]); stmts.push(stmt); diff --git a/db/tests/vn/ticketCreateWithUser.spec.js b/db/tests/vn/ticketCreateWithUser.spec.js index 1c13be1b3..5dd84d397 100644 --- a/db/tests/vn/ticketCreateWithUser.spec.js +++ b/db/tests/vn/ticketCreateWithUser.spec.js @@ -1,8 +1,8 @@ const app = require('vn-loopback/server/server'); const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; -describe('ticket ticketCreateWithUser()', () => { - const today = new Date(); +describe('ticket ticket_add()', () => { + const today = Date.vnNew(); it('should confirm the procedure creates the expected ticket', async() => { let stmts = []; let stmt; @@ -21,7 +21,7 @@ describe('ticket ticketCreateWithUser()', () => { userId: 18 }; - stmt = new ParameterizedSQL(`CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)`, [ + stmt = new ParameterizedSQL(`CALL vn.ticket_add(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)`, [ params.clientFk, params.shipped, params.warehouseFk, @@ -30,7 +30,8 @@ describe('ticket ticketCreateWithUser()', () => { params.agencyModeFk, params.routeFk, params.landed, - params.userId + params.userId, + true ]); stmts.push(stmt); @@ -70,7 +71,7 @@ describe('ticket ticketCreateWithUser()', () => { userId: 18 }; - stmt = new ParameterizedSQL('CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)', [ + stmt = new ParameterizedSQL('CALL vn.ticket_add(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)', [ params.clientFk, params.shipped, params.warehouseFk, @@ -79,7 +80,8 @@ describe('ticket ticketCreateWithUser()', () => { params.agencyModeFk, params.routeFk, params.landed, - params.userId + params.userId, + true ]); stmts.push(stmt); @@ -120,7 +122,7 @@ describe('ticket ticketCreateWithUser()', () => { userId: 18 }; - stmt = new ParameterizedSQL(`CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)`, [ + stmt = new ParameterizedSQL(`CALL vn.ticket_add(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)`, [ params.clientFk, params.shipped, params.warehouseFk, @@ -129,7 +131,8 @@ describe('ticket ticketCreateWithUser()', () => { params.agencyModeFk, params.routeFk, params.landed, - params.userId + params.userId, + true ]); stmts.push(stmt); @@ -172,7 +175,7 @@ describe('ticket ticketCreateWithUser()', () => { ]); stmts.push(stmt); - stmt = new ParameterizedSQL(`CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)`, [ + stmt = new ParameterizedSQL(`CALL vn.ticket_add(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)`, [ params.clientFk, params.shipped, params.warehouseFk, @@ -181,7 +184,8 @@ describe('ticket ticketCreateWithUser()', () => { params.agencyModeFk, params.routeFk, params.landed, - params.userId + params.userId, + true ]); stmts.push(stmt); stmts.push(`select @newTicketId`); diff --git a/db/tests/vn/timeBusiness_calculateByUser.spec.js b/db/tests/vn/timeBusiness_calculateByUser.spec.js index 441f567ac..5fe51d8f8 100644 --- a/db/tests/vn/timeBusiness_calculateByUser.spec.js +++ b/db/tests/vn/timeBusiness_calculateByUser.spec.js @@ -3,9 +3,9 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; describe('timeBusiness_calculateByUser()', () => { it('should return the expected hours for today', async() => { - let start = new Date(); + let start = Date.vnNew(); start.setHours(0, 0, 0, 0); - let end = new Date(); + let end = Date.vnNew(); end.setHours(0, 0, 0, 0); let stmts = []; diff --git a/db/tests/vn/timeControl_calculateByUser.spec.js b/db/tests/vn/timeControl_calculateByUser.spec.js index 2aa16c7a4..73e00ec3a 100644 --- a/db/tests/vn/timeControl_calculateByUser.spec.js +++ b/db/tests/vn/timeControl_calculateByUser.spec.js @@ -3,11 +3,11 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; describe('timeControl_calculateByUser()', () => { it(`should return today's worked hours`, async() => { - let start = new Date(); + let start = Date.vnNew(); start.setHours(0, 0, 0, 0); start.setDate(start.getDate() - 1); - let end = new Date(); + let end = Date.vnNew(); end.setHours(0, 0, 0, 0); end.setDate(end.getDate() + 1); @@ -17,7 +17,7 @@ describe('timeControl_calculateByUser()', () => { stmts.push('START TRANSACTION'); stmts.push(` - DROP TEMPORARY TABLE IF EXISTS + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate, tmp.timeBusinessCalculate `); @@ -48,14 +48,14 @@ describe('timeControl_calculateByUser()', () => { }); it(`should return the worked hours between last sunday and monday`, async() => { - let lastSunday = new Date(); + let lastSunday = Date.vnNew(); let daysSinceSunday = lastSunday.getDay(); if (daysSinceSunday === 0) // this means today is sunday but you need the previous sunday :) daysSinceSunday = 7; lastSunday.setHours(23, 0, 0, 0); lastSunday.setDate(lastSunday.getDate() - daysSinceSunday); - let monday = new Date(); + let monday = Date.vnNew(); let daysSinceMonday = daysSinceSunday - 1; // aiming for monday (today could be monday) monday.setHours(7, 0, 0, 0); monday.setDate(monday.getDate() - daysSinceMonday); @@ -66,7 +66,7 @@ describe('timeControl_calculateByUser()', () => { stmts.push('START TRANSACTION'); stmts.push(` - DROP TEMPORARY TABLE IF EXISTS + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate, tmp.timeBusinessCalculate `); diff --git a/db/tests/vn/workerTimeControlCheck.spec.js b/db/tests/vn/workerTimeControlCheck.spec.js index 6838665f1..9140628e6 100644 --- a/db/tests/vn/workerTimeControlCheck.spec.js +++ b/db/tests/vn/workerTimeControlCheck.spec.js @@ -239,7 +239,7 @@ xdescribe('worker workerTimeControl_check()', () => { stmts.push('START TRANSACTION'); - stmt = new ParameterizedSQL(`INSERT INTO postgresql.calendar_employee(business_id,calendar_state_id,date) + stmt = new ParameterizedSQL(`INSERT INTO postgresql.calendar_employee(businessFk,calendar_state_id,date) VALUES (?,1,CURDATE())`, [ workerId @@ -282,7 +282,7 @@ xdescribe('worker workerTimeControl_check()', () => { stmts.push('START TRANSACTION'); - stmt = new ParameterizedSQL(`UPDATE postgresql.business SET date_end=DATE_ADD(CURDATE(), INTERVAL -1 DAY) WHERE business_id=?`, [ + stmt = new ParameterizedSQL(`UPDATE vn.business SET ended = DATE_ADD(CURDATE(), INTERVAL -1 DAY) WHERE id = ?`, [ workerId ]); stmts.push(stmt); diff --git a/db/tests/vn/zone_getLanded.spec.js b/db/tests/vn/zone_getLanded.spec.js index 5f82156d3..888d7c132 100644 --- a/db/tests/vn/zone_getLanded.spec.js +++ b/db/tests/vn/zone_getLanded.spec.js @@ -6,7 +6,7 @@ describe('zone zone_getLanded()', () => { let stmts = []; let stmt; stmts.push('START TRANSACTION'); - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); let params = { @@ -40,7 +40,7 @@ describe('zone zone_getLanded()', () => { it(`should return data for a shipped tomorrow`, async() => { let stmts = []; let stmt; - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); stmts.push('START TRANSACTION'); diff --git a/docker-compose.yml b/docker-compose.yml index 4fc5dc811..13a7bc751 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,9 @@ services: placement: constraints: - node.role == worker + resources: + limits: + memory: 1G back: image: registry.verdnatura.es/salix-back:${BRANCH_NAME:?} build: . @@ -38,6 +41,9 @@ services: placement: constraints: - node.role == worker + resources: + limits: + memory: 4G configs: datasources: external: true diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 7bf56e2c8..7d80c69ee 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -436,7 +436,7 @@ let actions = { }, pickDate: async function(selector, date) { - date = date || new Date(); + date = date || Date.vnNew(); const timeZoneOffset = date.getTimezoneOffset() * 60000; const localDate = (new Date(date.getTime() - timeZoneOffset)) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 2cebffe02..32a60a4e2 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -22,6 +22,7 @@ export default { userConfigSecondAutocomplete: '#localBank', userConfigThirdAutocomplete: '#localCompany', acceptButton: '.vn-confirm.shown button[response=accept]', + cancelButton: '.vn-confirm.shown input[response=cancel]', searchButton: 'vn-searchbar vn-icon[icon="search"]' }, moduleIndex: { @@ -29,6 +30,11 @@ export default { firstModulePinIcon: 'vn-home a:nth-child(1) vn-icon[icon="push_pin"]', firstModuleRemovePinIcon: 'vn-home a:nth-child(1) vn-icon[icon="remove_circle"]' }, + recoverPassword: { + recoverPasswordButton: 'vn-login a[ui-sref="recover-password"]', + email: 'vn-recover-password vn-textfield[ng-model="$ctrl.user"]', + sendEmailButton: 'vn-recover-password vn-submit', + }, accountIndex: { addAccount: 'vn-user-index button vn-icon[icon="add"]', newName: 'vn-user-create vn-textfield[ng-model="$ctrl.user.name"]', @@ -51,14 +57,13 @@ export default { accountDescriptor: { menuButton: 'vn-user-descriptor vn-icon-button[icon="more_vert"]', deleteAccount: '.vn-menu [name="deleteUser"]', - changeRole: '.vn-menu [name="changeRole"]', setPassword: '.vn-menu [name="setPassword"]', activateAccount: '.vn-menu [name="enableAccount"]', + disableAccount: '.vn-menu [name="disableAccount"]', activateUser: '.vn-menu [name="activateUser"]', deactivateUser: '.vn-menu [name="deactivateUser"]', newPassword: 'vn-textfield[ng-model="$ctrl.newPassword"]', repeatPassword: 'vn-textfield[ng-model="$ctrl.repeatPassword"]', - newRole: 'vn-autocomplete[ng-model="$ctrl.newRole"]', activeAccountIcon: 'vn-icon[icon="contact_mail"]', activeUserIcon: 'vn-icon[icon="icon-disabled"]', acceptButton: 'button[response="accept"]', @@ -143,6 +148,11 @@ export default { verifyCert: 'vn-account-samba vn-check[ng-model="$ctrl.config.verifyCert"]', save: 'vn-account-samba vn-submit' }, + accountPrivileges: { + checkHasGrant: 'vn-user-privileges vn-check[ng-model="$ctrl.user.hasGrant"]', + role: 'vn-user-privileges vn-autocomplete[ng-model="$ctrl.user.roleFk"]', + save: 'vn-user-privileges vn-submit' + }, clientsIndex: { createClientButton: `vn-float-button` }, @@ -276,6 +286,7 @@ export default { clientWebAccess: { enableWebAccessCheckbox: 'vn-check[label="Enable web access"]', userName: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.name"]', + email: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.email"]', saveButton: 'button[type=submit]' }, clientNotes: { @@ -302,10 +313,12 @@ export default { firstMandateText: 'vn-client-mandate vn-card vn-table vn-tbody > vn-tr' }, clientLog: { - lastModificationPreviousValue: 'vn-client-log vn-table vn-td.before', - lastModificationCurrentValue: 'vn-client-log vn-table vn-td.after', - penultimateModificationPreviousValue: 'vn-client-log vn-table vn-tr:nth-child(2) vn-td.before', - penultimateModificationCurrentValue: 'vn-client-log vn-table vn-tr:nth-child(2) vn-td.after' + lastModificationPreviousValue: 'vn-client-log vn-tr table tr td.before', + lastModificationCurrentValue: 'vn-client-log vn-tr table tr td.after', + namePreviousValue: 'vn-client-log vn-tr table tr:nth-child(1) td.before', + nameCurrentValue: 'vn-client-log vn-tr table tr:nth-child(1) td.after', + activePreviousValue: 'vn-client-log vn-tr:nth-child(2) table tr:nth-child(2) td.before', + activeCurrentValue: 'vn-client-log vn-tr:nth-child(2) table tr:nth-child(2) td.after' }, clientBalance: { @@ -320,7 +333,8 @@ export default { anyBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr', firstLineBalance: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)', firstLineReference: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable', - firstLineReferenceInput: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable > div > field > vn-textfield' + firstLineReferenceInput: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable > div > field > vn-textfield', + compensationButton: 'vn-client-balance-index vn-icon-button[vn-dialog="send_compensation"]' }, webPayment: { confirmFirstPaymentButton: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon-button[icon="done_all"]', @@ -391,23 +405,32 @@ export default { originCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Origin"]', buyerCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Buyer"]', densityCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Density"]', + openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]', + advancedSearchItemType: 'vn-item-search-panel vn-autocomplete[ng-model="filter.typeFk"]', + advancedSearchButton: 'vn-item-search-panel button[type=submit]', + advancedSmartTableButton: 'vn-item-index vn-button[icon="search"]', + advancedSmartTableGrouping: 'vn-item-index vn-textfield[name=grouping]', + weightByPieceCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Weight/Piece"]', saveFieldsButton: '.vn-popover.shown vn-button[label="Save"] > button' }, itemFixedPrice: { add: 'vn-fixed-price vn-icon-button[icon="add_circle"]', + firstItemID: 'vn-fixed-price tr:nth-child(2) vn-autocomplete[ng-model="price.itemFk"]', fourthFixedPrice: 'vn-fixed-price tr:nth-child(5)', fourthItemID: 'vn-fixed-price tr:nth-child(5) vn-autocomplete[ng-model="price.itemFk"]', fourthWarehouse: 'vn-fixed-price tr:nth-child(5) vn-autocomplete[ng-model="price.warehouseFk"]', - fourthPPU: 'vn-fixed-price tr:nth-child(5) > td:nth-child(4)', - fourthPPP: 'vn-fixed-price tr:nth-child(5) > td:nth-child(5)', + fourthGroupingPrice: 'vn-fixed-price tr:nth-child(5) > td:nth-child(4)', + fourthPackingPrice: 'vn-fixed-price tr:nth-child(5) > td:nth-child(5)', fourthHasMinPrice: 'vn-fixed-price tr:nth-child(5) > td:nth-child(6) > vn-check[ng-model="price.hasMinPrice"]', fourthMinPrice: 'vn-fixed-price tr:nth-child(5) > td:nth-child(6) > vn-input-number[ng-model="price.minPrice"]', fourthStarted: 'vn-fixed-price tr:nth-child(5) vn-date-picker[ng-model="price.started"]', fourthEnded: 'vn-fixed-price tr:nth-child(5) vn-date-picker[ng-model="price.ended"]', - fourthDeleteIcon: 'vn-fixed-price tr:nth-child(5) > td:nth-child(9) > vn-icon-button[icon="delete"]' + fourthDeleteIcon: 'vn-fixed-price tr:nth-child(5) > td:nth-child(9) > vn-icon-button[icon="delete"]', + orderColumnId: 'vn-fixed-price th[field="itemFk"]' }, itemCreateView: { temporalName: 'vn-item-create vn-textfield[ng-model="$ctrl.item.provisionalName"]', + priority: 'vn-autocomplete[ng-model="$ctrl.item.priority"]', type: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]', intrastat: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]', origin: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]', @@ -443,6 +466,7 @@ export default { generic: 'vn-autocomplete[ng-model="$ctrl.item.genericFk"]', isFragile: 'vn-check[ng-model="$ctrl.item.isFragile"]', longName: 'vn-textfield[ng-model="$ctrl.item.longName"]', + packingOut: 'vn-input-number[ng-model="$ctrl.item.packingOut"]', isActiveCheckbox: 'vn-check[label="Active"]', priceInKgCheckbox: 'vn-check[label="Price in kg"]', newIntrastatButton: 'vn-item-basic-data vn-icon-button[vn-tooltip="New intrastat"] > button', @@ -500,7 +524,6 @@ export default { }, itemLog: { anyLineCreated: 'vn-item-log > vn-log vn-tbody > vn-tr', - fifthLineCreatedProperty: 'vn-item-log > vn-log vn-tbody > vn-tr:nth-child(5) > vn-td > vn-one:nth-child(3) > div span:nth-child(2)', }, ticketSummary: { header: 'vn-ticket-summary > vn-card > h5', @@ -539,14 +562,15 @@ export default { payoutBank: '.vn-dialog vn-autocomplete[ng-model="$ctrl.bankFk"]', payoutDescription: 'vn-textfield[ng-model="$ctrl.receipt.description"]', submitPayout: '.vn-dialog button[response="accept"]', - searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr', + searchWeeklyResult: 'vn-ticket-weekly-index vn-card smart-table slot-table table tbody tr', searchResultDate: 'vn-ticket-summary [label=Landed] span', topbarSearch: 'vn-searchbar', moreMenu: 'vn-ticket-index vn-icon-button[icon=more_vert]', - sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6)', - weeklyTicket: 'vn-ticket-weekly-index vn-table > div > vn-tbody > vn-tr', - firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]', - firstWeeklyTicketAgency: 'vn-ticket-weekly-index vn-tr:nth-child(1) [ng-model="weekly.agencyModeFk"]', + fourthWeeklyTicket: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(4)', + fiveWeeklyTicket: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(5)', + weeklyTicket: 'vn-ticket-weekly-index vn-card smart-table slot-table table tbody tr', + firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(1) vn-icon-button[icon="delete"]', + firstWeeklyTicketAgency: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(1) [ng-model="weekly.agencyModeFk"]', acceptDeleteTurn: '.vn-confirm.shown button[response="accept"]' }, createTicketView: { @@ -563,8 +587,6 @@ export default { isDeletedIcon: 'vn-ticket-descriptor vn-icon[icon="icon-deletedTicket"]', goBackToModuleIndexButton: 'vn-ticket-descriptor a[ui-sref="ticket.index"]', moreMenu: 'vn-ticket-descriptor vn-ticket-descriptor-menu > vn-icon-button[icon=more_vert]', - moreMenuAddStowaway: '.vn-menu [name="addStowaway"]', - moreMenuDeleteStowawayButton: '.vn-menu [name="deleteStowaway"]', moreMenuAddToTurn: '.vn-menu [name="addTurn"]', moreMenuDeleteTicket: '.vn-menu [name="deleteTicket"]', moreMenuRestoreTicket: '.vn-menu [name="restoreTicket"]', @@ -577,8 +599,6 @@ export default { sendSMSbutton: 'button[response="accept"]', changeShippedHourDialog: '.vn-dialog.shown', changeShippedHour: '.vn-dialog.shown vn-input-time[ng-model="$ctrl.newShipped"]', - addStowawayDialogFirstTicket: '.vn-dialog.shown vn-table vn-tbody vn-tr', - shipButton: 'vn-ticket-descriptor vn-icon[icon="icon-stowaway"]', thursdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(4)', saturdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(6)', acceptDialog: '.vn-dialog.shown button[response="accept"]', @@ -586,7 +606,6 @@ export default { descriptorDeliveryDate: 'vn-ticket-descriptor slot-body > .attributes > vn-label-value:nth-child(4) > section > span', descriptorDeliveryAgency: 'vn-ticket-descriptor slot-body > .attributes > vn-label-value:nth-child(5) > section > span', acceptInvoiceOutButton: '.vn-confirm.shown button[response="accept"]', - acceptDeleteStowawayButton: '.vn-dialog.shown button[response="accept"]' }, ticketNotes: { firstNoteRemoveButton: 'vn-icon[icon="delete"]', @@ -596,7 +615,14 @@ export default { submitNotesButton: 'button[type=submit]' }, ticketExpedition: { - secondExpeditionRemoveButton: 'vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button[icon="delete"]', + firstSaleCheckbox: 'vn-ticket-expedition vn-tr:nth-child(1) vn-check[ng-model="expedition.checked"]', + thirdSaleCheckbox: 'vn-ticket-expedition vn-tr:nth-child(3) vn-check[ng-model="expedition.checked"]', + deleteExpeditionButton: 'vn-ticket-expedition vn-tool-bar > vn-button[icon="delete"]', + moveExpeditionButton: 'vn-ticket-expedition vn-tool-bar > vn-button[icon="keyboard_arrow_down"]', + moreMenuWithoutRoute: 'vn-item[name="withoutRoute"]', + moreMenuWithRoute: 'vn-item[name="withRoute"]', + newRouteId: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newRoute"]', + saveButton: '.vn-dialog.shown [response="accept"]', expeditionRow: 'vn-ticket-expedition vn-table vn-tbody > vn-tr' }, ticketPackages: { @@ -655,7 +681,10 @@ export default { moveToTicketButton: '.vn-popover.shown vn-icon[icon="arrow_forward_ios"]', moveToNewTicketButton: '.vn-popover.shown vn-button[label="New ticket"]', stateMenuButton: 'vn-ticket-sale vn-tool-bar > vn-button-menu[label="State"]', - moreMenuState: 'body > div > div > div.content > div.filter.ng-scope > vn-textfield' + moreMenuState: 'body > div > div > div.content > div.filter.ng-scope > vn-textfield', + firstSaleHistoryButton: 'vn-ticket-sale vn-tr:nth-child(1) vn-icon-button[icon="history"]', + firstSaleHistory: 'form vn-table div > vn-tbody > vn-tr', + closeHistory: 'div.window vn-button[icon="clear"]' }, ticketTracking: { createStateButton: 'vn-float-button' @@ -690,9 +719,10 @@ export default { ticketLog: { firstTD: 'vn-ticket-log vn-table vn-td:nth-child(1)', logButton: 'vn-left-menu a[ui-sref="ticket.card.log"]', - firstLogEntry: 'vn-ticket-log vn-data-viewer vn-tbody vn-tr', - changes: 'vn-ticket-log vn-data-viewer vn-tbody > vn-tr > vn-td:nth-child(7)', - id: 'vn-ticket-log vn-tr:nth-child(1) vn-one:nth-child(1) span' + user: 'vn-ticket-log vn-tbody vn-tr vn-td:nth-child(2)', + action: 'vn-ticket-log vn-tbody vn-tr vn-td:nth-child(4)', + changes: 'vn-ticket-log vn-data-viewer vn-tbody vn-tr table tr:nth-child(2) td.after', + id: 'vn-ticket-log vn-tr:nth-child(1) table tr:nth-child(1) td.before' }, ticketService: { addServiceButton: 'vn-ticket-service vn-icon-button[vn-tooltip="Add service"] > button', @@ -712,6 +742,55 @@ export default { saveImport: 'button[response="accept"]', anyDocument: 'vn-ticket-dms-index > vn-data-viewer vn-tbody vn-tr' }, + ticketFuture: { + openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]', + originDated: 'vn-date-picker[label="Origin date"]', + futureDated: 'vn-date-picker[label="Destination date"]', + linesMax: 'vn-textfield[label="Max Lines"]', + litersMax: 'vn-textfield[label="Max Liters"]', + ipt: 'vn-autocomplete[label="Origin IPT"]', + futureIpt: 'vn-autocomplete[label="Destination IPT"]', + tableIpt: 'vn-autocomplete[name="ipt"]', + tableFutureIpt: 'vn-autocomplete[name="futureIpt"]', + state: 'vn-autocomplete[label="Origin Grouped State"]', + futureState: 'vn-autocomplete[label="Destination Grouped State"]', + warehouseFk: 'vn-autocomplete[label="Warehouse"]', + problems: 'vn-check[label="With problems"]', + tableButtonSearch: 'vn-button[vn-tooltip="Search"]', + moveButton: 'vn-button[vn-tooltip="Future tickets"]', + acceptButton: '.vn-confirm.shown button[response="accept"]', + firstCheck: 'tbody > tr:nth-child(1) > td > vn-check', + multiCheck: 'vn-multi-check', + tableId: 'vn-textfield[name="id"]', + tableFutureId: 'vn-textfield[name="futureId"]', + tableLiters: 'vn-textfield[name="liters"]', + tableLines: 'vn-textfield[name="lines"]', + submit: 'vn-submit[label="Search"]', + table: 'tbody > tr:not(.empty-rows)' + }, + ticketAdvance: { + openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]', + dateFuture: 'vn-date-picker[label="Origin date"]', + dateToAdvance: 'vn-date-picker[label="Destination date"]', + linesMax: 'vn-textfield[label="Max Lines"]', + litersMax: 'vn-textfield[label="Max Liters"]', + futureIpt: 'vn-autocomplete[label="Origin IPT"]', + ipt: 'vn-autocomplete[label="Destination IPT"]', + tableIpt: 'vn-autocomplete[name="ipt"]', + tableFutureIpt: 'vn-autocomplete[name="futureIpt"]', + isFullMovable: 'vn-check[ng-model="filter.isFullMovable"]', + warehouseFk: 'vn-autocomplete[label="Warehouse"]', + tableButtonSearch: 'vn-button[vn-tooltip="Search"]', + moveButton: 'vn-button[vn-tooltip="Advance tickets"]', + acceptButton: '.vn-confirm.shown button[response="accept"]', + firstCheck: 'tbody > tr:nth-child(1) > td > vn-check', + tableId: 'vn-textfield[name="id"]', + tableFutureId: 'vn-textfield[name="futureId"]', + tableLiters: 'vn-textfield[name="liters"]', + tableLines: 'vn-textfield[name="lines"]', + submit: 'vn-submit[label="Search"]', + table: 'tbody > tr:not(.empty-rows)' + }, createStateView: { state: 'vn-autocomplete[ng-model="$ctrl.stateFk"]', worker: 'vn-autocomplete[ng-model="$ctrl.workerFk"]', @@ -728,7 +807,7 @@ export default { claimSummary: { header: 'vn-claim-summary > vn-card > h5', state: 'vn-claim-summary vn-label-value[label="State"] > section > span', - observation: 'vn-claim-summary vn-textarea[ng-model="$ctrl.summary.claim.observation"]', + observation: 'vn-claim-summary vn-horizontal.text', firstSaleItemId: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(5) vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(1) > span', firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img', itemDescriptorPopover: '.vn-popover.shown vn-item-descriptor', @@ -740,7 +819,6 @@ export default { }, claimBasicData: { claimState: 'vn-claim-basic-data vn-autocomplete[ng-model="$ctrl.claim.claimStateFk"]', - observation: 'vn-textarea[ng-model="$ctrl.claim.observation"]', packages: 'vn-input-number[ng-model="$ctrl.claim.packages"]', hasToPickUpCheckbox: 'vn-claim-basic-data vn-check[ng-model="$ctrl.claim.hasToPickUp"]', saveButton: `button[type=submit]` @@ -770,6 +848,12 @@ export default { secondClaimRedelivery: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]', saveDevelopmentButton: 'button[type=submit]' }, + claimNote: { + addNoteFloatButton: 'vn-float-button', + note: 'vn-textarea[ng-model="$ctrl.note.text"]', + saveButton: 'button[type=submit]', + firstNoteText: 'vn-claim-note .text' + }, claimAction: { importClaimButton: 'vn-claim-action vn-button[label="Import claim"]', anyLine: 'vn-claim-action vn-tbody > vn-tr', @@ -833,14 +917,16 @@ export default { confirmButton: '.vn-confirm.shown button[response="accept"]', }, routeIndex: { - anyResult: 'vn-table a', - firstRouteCheckbox: 'a:nth-child(1) vn-td:nth-child(1) > vn-check', + anyResult: 'vn-route-index tbody > tr', + firstRouteCheckbox: 'vn-route-index tbody > tr:nth-child(1) > td:nth-child(1) > vn-check', addNewRouteButton: 'vn-route-index a[ui-sref="route.create"]', cloneButton: 'vn-route-index button > vn-icon[icon="icon-clone"]', submitClonationButton: 'tpl-buttons > button[response="accept"]', openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]', searchAgencyAutocomlete: 'vn-route-search-panel vn-autocomplete[ng-model="filter.agencyModeFk"]', advancedSearchButton: 'vn-route-search-panel button[type=submit]', + previewButton: 'vn-route-index tbody > tr:nth-child(7) > td:nth-child(11) > vn-icon-button[icon="preview"]', + }, createRouteView: { worker: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.workerFk"]', @@ -856,10 +942,12 @@ export default { routeSummary: { header: 'vn-route-summary > vn-card > h5', cost: 'vn-route-summary vn-label-value[label="Cost"]', - firstTicketID: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(2) > span', + firstTicketID: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(10) > span', firstTicketDescriptor: '.vn-popover.shown vn-ticket-descriptor', - firstAlias: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(3) > span', + firstAlias: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(5) > span', firstClientDescriptor: '.vn-popover.shown vn-client-descriptor', + goToRouteSummaryButton: 'vn-route-summary > vn-card > h5 > a', + }, routeBasicData: { worker: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.workerFk"]', @@ -880,10 +968,12 @@ export default { confirmButton: '.vn-confirm.shown button[response="accept"]' }, workerSummary: { + summaryIcon: 'vn-worker-descriptor a[title="Go to module summary"]', header: 'vn-worker-summary h5', id: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(3) > section > span', email: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(4) > section > span', department: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(5) > section > span', + locker: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(10) > section > span', userId: 'vn-worker-summary vn-one:nth-child(2) > vn-label-value:nth-child(2) > section > span', userName: 'vn-worker-summary vn-one:nth-child(2) > vn-label-value:nth-child(3) > section > span', role: 'vn-worker-summary vn-one:nth-child(2) > vn-label-value:nth-child(4) > section > span', @@ -894,6 +984,7 @@ export default { name: 'vn-worker-basic-data vn-textfield[ng-model="$ctrl.worker.firstName"]', surname: 'vn-worker-basic-data vn-textfield[ng-model="$ctrl.worker.lastName"]', phone: 'vn-worker-basic-data vn-textfield[ng-model="$ctrl.worker.phone"]', + locker: 'vn-worker-basic-data vn-input-number[ng-model="$ctrl.worker.locker"]', saveButton: 'vn-worker-basic-data button[type=submit]' }, workerPbx: { @@ -904,52 +995,16 @@ export default { dialogTimeInput: '.vn-dialog.shown vn-input-time[ng-model="$ctrl.newTimeEntry.timed"]', dialogTimeDirection: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.newTimeEntry.direction"]', mondayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button', - tuesdayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(2) > vn-icon-button', - wednesdayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(3) > vn-icon-button', - thursdayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-icon-button', - fridayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(5) > vn-icon-button', - saturdayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(6) > vn-icon-button', - sundayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(7) > vn-icon-button', firstEntryOfMonday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(1) > vn-chip > div:nth-child(2)', - firstEntryOfTuesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(1) > vn-chip > div:nth-child(2)', - firstEntryOfWednesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(1) > vn-chip > div:nth-child(2)', - firstEntryOfThursday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(1) > vn-chip > div:nth-child(2)', - firstEntryOfFriday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(1) > vn-chip > div:nth-child(2)', - firstEntryOfSaturday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(1) > vn-chip > div:nth-child(2)', - firstEntryOfSunday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(1) > vn-chip > div:nth-child(2)', + firstEntryOfMondayDelete: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(1) > vn-chip > vn-icon[icon="cancel"]', secondEntryOfMonday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(2) > vn-chip > div:nth-child(2)', - secondEntryOfTuesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(2) > vn-chip > div:nth-child(2)', - secondEntryOfWednesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(2) > vn-chip > div:nth-child(2)', - secondEntryOfThursday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(2) > vn-chip > div:nth-child(2)', - secondEntryOfFriday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(2) > vn-chip > div:nth-child(2)', - secondEntryOfSaturday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(2) > vn-chip > div:nth-child(2)', - secondEntryOfSunday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(2) > vn-chip > div:nth-child(2)', - thirdEntryOfMonday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(3) > vn-chip > div:nth-child(2)', - thirdEntryOfMondayDelete: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(3) > vn-chip > vn-icon[icon="cancel"]', - thirdEntryOfTuesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(3) > vn-chip > div:nth-child(2)', - thirdEntryOfWednesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(3) > vn-chip > div:nth-child(2)', - thirdEntryOfThursday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(3) > vn-chip > div:nth-child(2)', - thirdEntryOfFriday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(3) > vn-chip > div:nth-child(2)', - thirdEntryOfSaturday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(3) > vn-chip > div:nth-child(2)', - thirdEntryOfSunday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(3) > vn-chip > div:nth-child(2)', - fourthEntryOfMonday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(4) > vn-chip > div:nth-child(2)', - fourthEntryOfTuesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(4) > vn-chip > div:nth-child(2)', - fourthEntryOfWednesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(4) > vn-chip > div:nth-child(2)', - fourthEntryOfThursday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(4) > vn-chip > div:nth-child(2)', - fourthEntryOfFriday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(4) > vn-chip > div:nth-child(2)', - fourthEntryOfSaturday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(4) > vn-chip > div:nth-child(2)', - fourthEntryOfSunday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(4) > vn-chip > div:nth-child(2)', mondayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(1)', - tuesdayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(2)', - wednesdayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(3)', - thursdayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(4)', - fridayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(5)', - saturdayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(6)', - sundayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(7)', weekWorkedHours: 'vn-worker-time-control vn-side-menu vn-label-value > section > span', nextMonthButton: 'vn-worker-time-control vn-side-menu vn-calendar vn-button[icon=keyboard_arrow_right]', previousMonthButton: 'vn-worker-time-control vn-side-menu vn-calendar vn-button[icon=keyboard_arrow_left]', + monthName: 'vn-worker-time-control vn-side-menu vn-calendar div > .title', secondWeekDay: 'vn-worker-time-control vn-side-menu vn-calendar .day:nth-child(8) > .day-number', + thrirdWeekDay: 'vn-worker-time-control vn-side-menu vn-calendar .day:nth-child(15) > .day-number', navigateBackToIndex: 'vn-worker-descriptor [name="goToModuleIndex"]' }, workerCalendar: { @@ -968,22 +1023,49 @@ export default { furlough: 'vn-worker-calendar > vn-side-menu [name="absenceTypes"] > vn-chip:nth-child(4)', halfFurlough: 'vn-worker-calendar > vn-side-menu [name="absenceTypes"] > vn-chip:nth-child(5)', }, + workerCreate: { + newWorkerButton: 'vn-worker-index a[ui-sref="worker.create"]', + firstname: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.firstName"]', + lastname: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.lastNames"]', + birth: 'vn-worker-create vn-date-picker[ng-model="$ctrl.worker.birth"]', + fi: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.fi"]', + code: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.code"]', + phone: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.phone"]', + city: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.city"]', + postcode: 'vn-worker-create vn-datalist[ng-model="$ctrl.worker.postcode"]', + street: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.street"]', + user: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.name"]', + email: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.email"]', + boss: 'vn-worker-create vn-autocomplete[ng-model="$ctrl.worker.bossFk"]', + role: 'vn-worker-create vn-autocomplete[ng-model="$ctrl.worker.roleFk"]', + iban: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.iban"]', + createButton: 'vn-worker-create vn-submit[label="Create"]', + }, + workerPda: { + currentPDA: 'vn-worker-pda vn-textfield[ng-model="$ctrl.currentPDA.description"]', + newPDA: 'vn-worker-pda vn-autocomplete[ng-model="$ctrl.newPDA"]', + delete: 'vn-worker-pda vn-icon-button[icon=delete]', + submit: 'vn-worker-pda vn-submit[label="Assign"]', + }, invoiceOutIndex: { topbarSearch: 'vn-searchbar', searchResult: 'vn-invoice-out-index vn-card > vn-table > div > vn-tbody > a.vn-tr', - createInvoice: 'vn-invoice-out-index > div > vn-vertical > vn-button > button vn-icon[icon="add"]', - createManualInvoice: 'vn-item[name="manualInvoice"]', - createGlobalInvoice: 'vn-item[name="globalInvoice"]', + createInvoice: 'vn-invoice-out-index > div > vn-button > button vn-icon[icon="add"]', manualInvoiceForm: '.vn-invoice-out-manual', manualInvoiceTicket: 'vn-autocomplete[ng-model="$ctrl.invoice.ticketFk"]', manualInvoiceClient: 'vn-autocomplete[ng-model="$ctrl.invoice.clientFk"]', manualInvoiceSerial: 'vn-autocomplete[ng-model="$ctrl.invoice.serial"]', manualInvoiceTaxArea: 'vn-autocomplete[ng-model="$ctrl.invoice.taxArea"]', - saveInvoice: 'button[response="accept"]', - globalInvoiceForm: '.vn-invoice-out-global-invoicing', - globalInvoiceDate: '[ng-model="$ctrl.invoice.invoiceDate"]', - globalInvoiceFromClient: '[ng-model="$ctrl.invoice.fromClientId"]', - globalInvoiceToClient: '[ng-model="$ctrl.invoice.toClientId"]', + saveInvoice: 'button[response="accept"]' + }, + invoiceOutGlobalInvoicing: { + oneClient: 'vn-invoice-out-global-invoicing vn-side-menu form > vn-vertical > vn-vertical > vn-radio[val="one"]', + allClients: 'vn-invoice-out-global-invoicing vn-side-menu form > vn-vertical > vn-vertical > vn-radio[val="all"]', + clientId: 'vn-invoice-out-global-invoicing vn-side-menu form > vn-vertical > vn-autocomplete[ng-model="$ctrl.clientId"]', + printer: 'vn-invoice-out-global-invoicing vn-side-menu form > vn-vertical > vn-autocomplete[ng-model="$ctrl.printerFk"]', + makeInvoice: 'vn-invoice-out-global-invoicing vn-side-menu form > vn-vertical > vn-submit', + invoiceDate: 'vn-invoice-out-global-invoicing vn-side-menu form > vn-vertical > vn-date-picker[ng-model="$ctrl.invoiceDate"]', + maxShipped: 'vn-invoice-out-global-invoicing vn-side-menu form > vn-vertical > vn-date-picker[ng-model="$ctrl.maxShipped"]' }, invoiceOutDescriptor: { moreMenu: 'vn-invoice-out-descriptor vn-icon-button[icon=more_vert]', @@ -1021,6 +1103,17 @@ export default { booked: 'vn-invoice-in-basic-data vn-date-picker[ng-model="$ctrl.invoiceIn.booked"]', currency: 'vn-invoice-in-basic-data vn-autocomplete[ng-model="$ctrl.invoiceIn.currencyFk"]', company: 'vn-invoice-in-basic-data vn-autocomplete[ng-model="$ctrl.invoiceIn.companyFk"]', + dms: 'vn-invoice-in-basic-data vn-textfield[ng-model="$ctrl.invoiceIn.dmsFk"]', + download: 'vn-invoice-in-basic-data vn-textfield[ng-model="$ctrl.invoiceIn.dmsFk"] > div.container > div.prepend > prepend > vn-icon-button', + edit: 'vn-invoice-in-basic-data vn-textfield[ng-model="$ctrl.invoiceIn.dmsFk"] > div.container > div.append > append > vn-icon-button[icon="edit"]', + create: 'vn-invoice-in-basic-data vn-textfield[ng-model="$ctrl.invoiceIn.dmsFk"] > div.container > div.append > append > vn-icon-button[icon="add_circle"]', + reference: 'vn-textfield[ng-model="$ctrl.dms.reference"]', + companyId: 'vn-autocomplete[ng-model="$ctrl.dms.companyId"]', + warehouseId: 'vn-autocomplete[ng-model="$ctrl.dms.warehouseId"]', + dmsTypeId: 'vn-autocomplete[ng-model="$ctrl.dms.dmsTypeId"]', + description: 'vn-textarea[ng-model="$ctrl.dms.description"]', + inputFile: 'vn-input-file[ng-model="$ctrl.dms.files"]', + confirm: 'button[response="accept"]', save: 'vn-invoice-in-basic-data button[type=submit]' }, invoiceInTax: { @@ -1034,6 +1127,15 @@ export default { saveButton: 'vn-invoice-in-tax vn-submit', }, + invoiceInIndex: { + topbarSearchParams: 'vn-searchbar div.search-params > span', + }, + invoiceInSerial: { + daysAgo: 'vn-invoice-in-serial-search-panel vn-input-number[ng-model="$ctrl.filter.daysAgo"]', + serial: 'vn-invoice-in-serial-search-panel vn-textfield[ng-model="$ctrl.filter.serial"]', + chip: 'vn-chip > vn-icon', + goToIndex: 'vn-invoice-in-serial vn-icon-button[icon="icon-invoice-in"]', + }, travelIndex: { anySearchResult: 'vn-travel-index vn-tbody > a', firstSearchResult: 'vn-travel-index vn-tbody > a:nth-child(1)', @@ -1045,12 +1147,21 @@ export default { landingDate: 'vn-travel-create vn-date-picker[ng-model="$ctrl.travel.landed"]', warehouseOut: 'vn-travel-create vn-autocomplete[ng-model="$ctrl.travel.warehouseOutFk"]', warehouseIn: 'vn-travel-create vn-autocomplete[ng-model="$ctrl.travel.warehouseInFk"]', - save: 'vn-travel-create vn-submit > button' + save: 'vn-travel-create vn-submit > button', + generalSearchFilter: 'vn-travel-search-panel vn-textfield[ng-model="$ctrl.search"]', + agencyFilter: 'vn-travel-search-panel vn-autocomplete[ng-model="$ctrl.filter.agencyModeFk"]', + warehouseOutFilter: 'vn-travel-search-panel vn-autocomplete[ng-model="$ctrl.filter.warehouseOutFk"]', + warehouseInFilter: 'vn-travel-search-panel vn-autocomplete[ng-model="$ctrl.filter.warehouseInFk"]', + scopeDaysFilter: 'vn-travel-search-panel vn-input-number[ng-model="$ctrl.filter.scopeDays"]', + continentFilter: 'vn-travel-search-panel vn-autocomplete[ng-model="$ctrl.filter.continent"]', + totalEntriesFilter: 'vn-travel-search-panel vn-input-number[ng-model="$ctrl.totalEntries"]', + chip: 'vn-travel-search-panel vn-chip > vn-icon', + }, travelExtraCommunity: { - anySearchResult: 'vn-travel-extra-community > vn-data-viewer div > vn-tbody > vn-tr', - firstTravelReference: 'vn-travel-extra-community vn-tbody:nth-child(2) vn-td-editable[name="reference"]', - firstTravelLockedKg: 'vn-travel-extra-community vn-tbody:nth-child(2) vn-td-editable[name="lockedKg"]', + anySearchResult: 'vn-travel-extra-community > vn-card div > tbody > tr[ng-attr-id="{{::travel.id}}"]', + firstTravelReference: 'vn-travel-extra-community tbody:nth-child(2) vn-td-editable[name="reference"]', + firstTravelLockedKg: 'vn-travel-extra-community tbody:nth-child(2) vn-td-editable[name="lockedKg"]', removeContinentFilter: 'vn-searchbar > form > vn-textfield > div.container > div.prepend > prepend > div > span:nth-child(3) > vn-icon > i' }, travelBasicData: { @@ -1066,7 +1177,7 @@ export default { undoChanges: 'vn-travel-basic-data vn-button[label="Undo changes"]' }, travelLog: { - firstLogFirstTD: 'vn-travel-log vn-tbody > vn-tr > vn-td:nth-child(1) > div' + firstLogFirstTD: 'vn-travel-log vn-tbody > vn-tr > vn-td:nth-child(5)' }, travelThermograph: { add: 'vn-travel-thermograph-index vn-float-button[icon="add"]', @@ -1127,7 +1238,8 @@ export default { anyBuyLine: 'vn-entry-summary tr.dark-row' }, entryBasicData: { - reference: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.ref"]', + reference: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.reference"]', + invoiceNumber: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.invoiceNumber"]', notes: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.notes"]', observations: 'vn-entry-basic-data vn-textarea[ng-model="$ctrl.entry.observation"]', supplier: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.supplierFk"]', @@ -1136,7 +1248,7 @@ export default { company: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.companyFk"]', ordered: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isOrdered"]', confirmed: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isConfirmed"]', - inventory: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isInventory"]', + inventory: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isExcludedFromAvailable"]', raid: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isRaid"]', booked: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isBooked"]', save: 'vn-entry-basic-data button[type=submit]', @@ -1173,6 +1285,21 @@ export default { importBuysButton: 'vn-entry-buy-import button[type="submit"]' }, entryLatestBuys: { + table: 'tbody > tr:not(.empty-rows)', + chip: 'vn-chip > vn-icon', + generalSearchInput: 'vn-textfield[ng-model="$ctrl.filter.search"]', + firstReignIcon: 'vn-horizontal.item-category vn-one', + typeInput: 'vn-autocomplete[ng-model="$ctrl.filter.typeFk"]', + salesPersonInput: 'vn-autocomplete[ng-model="$ctrl.filter.salesPersonFk"]', + supplierInput: 'vn-autocomplete[ng-model="$ctrl.filter.supplierFk"]', + fromInput: 'vn-date-picker[ng-model="$ctrl.filter.from"]', + toInput: 'vn-date-picker[ng-model="$ctrl.filter.to"]', + activeCheck: 'vn-check[ng-model="$ctrl.filter.active"]', + floramondoCheck: 'vn-check[ng-model="$ctrl.filter.floramondo"]', + visibleCheck: 'vn-check[ng-model="$ctrl.filter.visible"]', + addTagButton: 'vn-icon-button[vn-tooltip="Add tag"]', + itemTagInput: 'vn-autocomplete[ng-model="itemTag.tagFk"]', + itemTagValueInput: 'vn-autocomplete[ng-model="itemTag.value"]', 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"]', diff --git a/e2e/helpers/tests.js b/e2e/helpers/tests.js index aac9963dd..992ec051f 100644 --- a/e2e/helpers/tests.js +++ b/e2e/helpers/tests.js @@ -1,6 +1,7 @@ require('@babel/register')({presets: ['@babel/env']}); require('core-js/stable'); require('regenerator-runtime/runtime'); +require('vn-loopback/server/boot/date')(); const axios = require('axios'); const Docker = require('../../db/docker.js'); diff --git a/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js b/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js new file mode 100644 index 000000000..ad558ace2 --- /dev/null +++ b/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js @@ -0,0 +1,105 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('SmartTable SearchBar integration', () => { + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesPerson', 'item'); + await page.waitToClick(selectors.globalItems.searchButton); + }); + + afterAll(async() => { + await browser.close(); + }); + + describe('as filters in smart-table section', () => { + it('should search by type in searchBar', async() => { + await page.waitToClick(selectors.itemsIndex.openAdvancedSearchButton); + await page.autocompleteSearch(selectors.itemsIndex.advancedSearchItemType, 'Anthurium'); + await page.waitToClick(selectors.itemsIndex.advancedSearchButton); + await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 3); + }); + + it('should reload page and have same results', async() => { + await page.reload({ + waitUntil: 'networkidle2' + }); + + await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 3); + }); + + it('should search by grouping in smartTable', async() => { + await page.waitToClick(selectors.itemsIndex.advancedSmartTableButton); + await page.write(selectors.itemsIndex.advancedSmartTableGrouping, '1'); + await page.keyboard.press('Enter'); + await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2); + }); + + it('should now reload page and have same results', async() => { + await page.reload({ + waitUntil: 'networkidle2' + }); + + await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2); + }); + }); + + describe('as filters in section without smart-table', () => { + it('go to zone section', async() => { + await page.loginAndModule('salesPerson', 'zone'); + await page.waitToClick(selectors.globalItems.searchButton); + }); + + it('should search in searchBar first time', async() => { + await page.doSearch('A'); + const count = await page.countElement(selectors.zoneIndex.searchResult); + + expect(count).toEqual(7); + }); + + it('should search in searchBar second time', async() => { + await page.doSearch('A'); + const count = await page.countElement(selectors.zoneIndex.searchResult); + + expect(count).toEqual(7); + }); + + it('should search in searchBar third time', async() => { + await page.doSearch('A'); + const count = await page.countElement(selectors.zoneIndex.searchResult); + + expect(count).toEqual(7); + }); + }); + + describe('as orders', () => { + it('should order by first id', async() => { + await page.loginAndModule('developer', 'item'); + await page.accessToSection('item.fixedPrice'); + await page.doSearch(); + + const result = await page.waitToGetProperty(selectors.itemFixedPrice.firstItemID, 'value'); + + expect(result).toEqual('1'); + }); + + it('should order by last id', async() => { + await page.waitToClick(selectors.itemFixedPrice.orderColumnId); + const result = await page.waitToGetProperty(selectors.itemFixedPrice.firstItemID, 'value'); + + expect(result).toEqual('13'); + }); + + it('should reload page and have same order', async() => { + await page.reload({ + waitUntil: 'networkidle2' + }); + const result = await page.waitToGetProperty(selectors.itemFixedPrice.firstItemID, 'value'); + + expect(result).toEqual('13'); + }); + }); +}); diff --git a/e2e/paths/01-salix/04_recoverPassword.spec.js b/e2e/paths/01-salix/04_recoverPassword.spec.js new file mode 100644 index 000000000..aa0389648 --- /dev/null +++ b/e2e/paths/01-salix/04_recoverPassword.spec.js @@ -0,0 +1,52 @@ +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; + +describe('RecoverPassword path', async() => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + + await page.waitToClick(selectors.recoverPassword.recoverPasswordButton); + await page.waitForState('recover-password'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should not throw error if not exist user', async() => { + await page.write(selectors.recoverPassword.email, 'fakeEmail@mydomain.com'); + await page.waitToClick(selectors.recoverPassword.sendEmailButton); + + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Notification sent!'); + }); + + it('should send email using email', async() => { + await page.waitForState('login'); + await page.waitToClick(selectors.recoverPassword.recoverPasswordButton); + + await page.write(selectors.recoverPassword.email, 'BruceWayne@mydomain.com'); + await page.waitToClick(selectors.recoverPassword.sendEmailButton); + const message = await page.waitForSnackbar(); + await page.waitForState('login'); + + expect(message.text).toContain('Notification sent!'); + }); + + it('should send email using username', async() => { + await page.waitForState('login'); + await page.waitToClick(selectors.recoverPassword.recoverPasswordButton); + + await page.write(selectors.recoverPassword.email, 'BruceWayne'); + await page.waitToClick(selectors.recoverPassword.sendEmailButton); + const message = await page.waitForSnackbar(); + await page.waitForState('login'); + + expect(message.text).toContain('Notification sent!'); + }); +}); diff --git a/e2e/paths/02-client/03_edit_fiscal_data.spec.js b/e2e/paths/02-client/03_edit_fiscal_data.spec.js index 4ae1d4eca..2a56cb535 100644 --- a/e2e/paths/02-client/03_edit_fiscal_data.spec.js +++ b/e2e/paths/02-client/03_edit_fiscal_data.spec.js @@ -276,7 +276,7 @@ describe('Client Edit fiscalData path', () => { // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2 it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, async() => { await page.waitToClick(selectors.clientAddresses.firstEditAddress); - await page.waitForTextInField(selectors.clientAddresses.city, 'Silla'); + await page.waitForTextInField(selectors.clientAddresses.city, 'Gotham'); await page.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox); await page.waitToClick(selectors.clientAddresses.saveButton); const message = await page.waitForSnackbar(); diff --git a/e2e/paths/02-client/05_add_address.spec.js b/e2e/paths/02-client/05_add_address.spec.js index c35237ab4..0581635d0 100644 --- a/e2e/paths/02-client/05_add_address.spec.js +++ b/e2e/paths/02-client/05_add_address.spec.js @@ -45,7 +45,7 @@ describe('Client Add address path', () => { expect(province).toContain('Province five'); }); - it(`should receive an error after clicking save button as consignee, incoterms and customsAgent are empty`, async() => { + it(`should throw after clicking save button as consignee, incoterms and customsAgent are empty`, async() => { await page.write(selectors.clientAddresses.consignee, 'Bruce Bunner'); await page.write(selectors.clientAddresses.streetAddress, '320 Park Avenue New York'); await page.waitToClick(selectors.clientAddresses.saveButton); diff --git a/e2e/paths/02-client/07_edit_web_access.spec.js b/e2e/paths/02-client/07_edit_web_access.spec.js index 70ec4b5ea..29b39f788 100644 --- a/e2e/paths/02-client/07_edit_web_access.spec.js +++ b/e2e/paths/02-client/07_edit_web_access.spec.js @@ -1,3 +1,4 @@ +/* eslint max-len: ["error", { "code": 150 }]*/ import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; @@ -7,8 +8,8 @@ describe('Client Edit web access path', () => { beforeAll(async() => { browser = await getBrowser(); page = browser.page; - await page.loginAndModule('employee', 'client'); - await page.accessToSearchResult('1105'); + await page.loginAndModule('salesPerson', 'client'); + await page.accessToSearchResult('max'); await page.accessToSection('client.card.webAccess'); }); @@ -33,6 +34,15 @@ describe('Client Edit web access path', () => { expect(message.text).toContain('Data saved!'); }); + it(`should update the email`, async() => { + await page.clearInput(selectors.clientWebAccess.email); + await page.write(selectors.clientWebAccess.email, 'legion@marvel.com'); + await page.waitToClick(selectors.clientWebAccess.saveButton); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); + it('should reload the section and confirm web access is now unchecked', async() => { await page.reloadSection('client.card.webAccess'); const result = await page.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox); @@ -46,27 +56,33 @@ describe('Client Edit web access path', () => { expect(result).toEqual('Legion'); }); + it('should confirm web access email have been updated', async() => { + const result = await page.waitToGetProperty(selectors.clientWebAccess.email, 'value'); + + expect(result).toEqual('legion@marvel.com'); + }); + it(`should navigate to the log section`, async() => { await page.accessToSection('client.card.log'); }); it(`should confirm the last log shows the updated client name and no modifications on active checkbox`, async() => { - let lastModificationPreviousValue = await page - .waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText'); - let lastModificationCurrentValue = await page - .waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText'); + let namePreviousValue = await page + .waitToGetProperty(selectors.clientLog.namePreviousValue, 'innerText'); + let nameCurrentValue = await page + .waitToGetProperty(selectors.clientLog.nameCurrentValue, 'innerText'); - expect(lastModificationPreviousValue).toEqual('name MaxEisenhardt active false'); - expect(lastModificationCurrentValue).toEqual('name Legion active false'); + expect(namePreviousValue).toEqual('MaxEisenhardt'); + expect(nameCurrentValue).toEqual('Legion'); }); it(`should confirm the penultimate log shows the updated active and no modifications on client name`, async() => { - let penultimateModificationPreviousValue = await page - .waitToGetProperty(selectors.clientLog.penultimateModificationPreviousValue, 'innerText'); - let penultimateModificationCurrentValue = await page - .waitToGetProperty(selectors.clientLog.penultimateModificationCurrentValue, 'innerText'); + let activePreviousValue = await page + .waitToGetProperty(selectors.clientLog.activePreviousValue, 'innerText'); + let activeCurrentValue = await page + .waitToGetProperty(selectors.clientLog.activeCurrentValue, 'innerText'); - expect(penultimateModificationPreviousValue).toEqual('name MaxEisenhardt active true'); - expect(penultimateModificationCurrentValue).toEqual('name MaxEisenhardt active false'); + expect(activePreviousValue).toEqual('✓'); + expect(activeCurrentValue).toEqual('✗'); }); }); diff --git a/e2e/paths/02-client/13_log.spec.js b/e2e/paths/02-client/13_log.spec.js index 9b047a47c..8f186d842 100644 --- a/e2e/paths/02-client/13_log.spec.js +++ b/e2e/paths/02-client/13_log.spec.js @@ -43,7 +43,7 @@ describe('Client log path', () => { let lastModificationCurrentValue = await page. waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText'); - expect(lastModificationPreviousValue).toEqual('name DavidCharlesHaller'); - expect(lastModificationCurrentValue).toEqual('name this is a test'); + expect(lastModificationPreviousValue).toEqual('DavidCharlesHaller'); + expect(lastModificationCurrentValue).toEqual('this is a test'); }); }); diff --git a/e2e/paths/02-client/20_credit_insurance.spec.js b/e2e/paths/02-client/20_credit_insurance.spec.js index 904a51145..a4f148b8f 100644 --- a/e2e/paths/02-client/20_credit_insurance.spec.js +++ b/e2e/paths/02-client/20_credit_insurance.spec.js @@ -4,7 +4,7 @@ import getBrowser from '../../helpers/puppeteer'; describe('Client credit insurance path', () => { let browser; let page; - let previousMonth = new Date(); + let previousMonth = Date.vnNew(); previousMonth.setMonth(previousMonth.getMonth() - 1); beforeAll(async() => { diff --git a/e2e/paths/02-client/23_send_compensation.spec.js b/e2e/paths/02-client/23_send_compensation.spec.js new file mode 100644 index 000000000..6ec8936a8 --- /dev/null +++ b/e2e/paths/02-client/23_send_compensation.spec.js @@ -0,0 +1,27 @@ +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Client Send balance compensation', () => { + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + await page.accessToSearchResult('Clark Kent'); + await page.accessToSection('client.card.balance.index'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it(`should click on send compensation button`, async() => { + await page.autocompleteSearch(selectors.clientBalance.company, 'VNL'); + await page.waitToClick(selectors.clientBalance.compensationButton); + await page.waitToClick(selectors.clientBalance.saveButton); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Notification sent!'); + }); +}); diff --git a/e2e/paths/03-worker/01_summary.spec.js b/e2e/paths/03-worker/01_summary.spec.js index 4ea87481a..51992b41d 100644 --- a/e2e/paths/03-worker/01_summary.spec.js +++ b/e2e/paths/03-worker/01_summary.spec.js @@ -2,68 +2,33 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Worker summary path', () => { + const workerId = 3; let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('employee', 'worker'); + const httpDataResponse = page.waitForResponse(response => { + return response.status() === 200 && response.url().includes(`Workers/${workerId}`); + }); await page.accessToSearchResult('agencyNick'); + await httpDataResponse; }); afterAll(async() => { await browser.close(); }); - it('should reach the employee summary section', async() => { - await page.waitForState('worker.card.summary'); - }); - - it('should check the summary contains the name and userName on the header', async() => { - const result = await page.waitToGetProperty(selectors.workerSummary.header, 'innerText'); - - expect(result).toEqual('agency agency'); - }); - - it('should check the summary contains the basic data id', async() => { - const result = await page.waitToGetProperty(selectors.workerSummary.id, 'innerText'); - - expect(result).toEqual('3'); - }); - - it('should check the summary contains the basic data email', async() => { - const result = await page.waitToGetProperty(selectors.workerSummary.email, 'innerText'); - - expect(result).toEqual('agency@verdnatura.es'); - }); - - it('should check the summary contains the basic data department', async() => { - const result = await page.waitToGetProperty(selectors.workerSummary.department, 'innerText'); - - expect(result).toEqual('CAMARA'); - }); - - it('should check the summary contains the user data id', async() => { - const result = await page.waitToGetProperty(selectors.workerSummary.userId, 'innerText'); - - expect(result).toEqual('3'); - }); - - it('should check the summary contains the user data name', async() => { - const result = await page.waitToGetProperty(selectors.workerSummary.userName, 'innerText'); - - expect(result).toEqual('agency'); - }); - - it('should check the summary contains the user data role', async() => { - const result = await page.waitToGetProperty(selectors.workerSummary.role, 'innerText'); - - expect(result).toEqual('agency'); - }); - - it('should check the summary contains the user data extension', async() => { - const result = await page.waitToGetProperty(selectors.workerSummary.extension, 'innerText'); - - expect(result).toEqual('1101'); + it('should reach the employee summary section and check all properties', async() => { + expect(await page.getProperty(selectors.workerSummary.header, 'innerText')).toEqual('agency agency'); + expect(await page.getProperty(selectors.workerSummary.id, 'innerText')).toEqual('3'); + expect(await page.getProperty(selectors.workerSummary.email, 'innerText')).toEqual('agency@verdnatura.es'); + expect(await page.getProperty(selectors.workerSummary.department, 'innerText')).toEqual('CAMARA'); + expect(await page.getProperty(selectors.workerSummary.userId, 'innerText')).toEqual('3'); + expect(await page.getProperty(selectors.workerSummary.userName, 'innerText')).toEqual('agency'); + expect(await page.getProperty(selectors.workerSummary.role, 'innerText')).toEqual('agency'); + expect(await page.getProperty(selectors.workerSummary.extension, 'innerText')).toEqual('1101'); + expect(await page.getProperty(selectors.workerSummary.locker, 'innerText')).toEqual('-'); }); }); diff --git a/e2e/paths/03-worker/02_basicData.spec.js b/e2e/paths/03-worker/02_basicData.spec.js index c367c8706..381375dc7 100644 --- a/e2e/paths/03-worker/02_basicData.spec.js +++ b/e2e/paths/03-worker/02_basicData.spec.js @@ -2,13 +2,18 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Worker basic data path', () => { + const workerId = 1106; let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('hr', 'worker'); + const httpDataResponse = page.waitForResponse(response => { + return response.status() === 200 && response.url().includes(`Workers/${workerId}`); + }); await page.accessToSearchResult('David Charles Haller'); + await httpDataResponse; await page.accessToSection('worker.card.basicData'); }); @@ -16,35 +21,22 @@ describe('Worker basic data path', () => { await browser.close(); }); - it('should edit the form', async() => { - await page.clearInput(selectors.workerBasicData.name); - await page.write(selectors.workerBasicData.name, 'David C.'); - await page.clearInput(selectors.workerBasicData.surname); - await page.write(selectors.workerBasicData.surname, 'H.'); - await page.clearInput(selectors.workerBasicData.phone); - await page.write(selectors.workerBasicData.phone, '444332211'); - await page.waitToClick(selectors.workerBasicData.saveButton); + it('should edit the form and then reload the section and check the data was edited', async() => { + await page.overwrite(selectors.workerBasicData.name, 'David C.'); + await page.overwrite(selectors.workerBasicData.surname, 'H.'); + await page.overwrite(selectors.workerBasicData.phone, '444332211'); + await page.overwrite(selectors.workerBasicData.locker, '1'); + await page.click(selectors.workerBasicData.saveButton); + const message = await page.waitForSnackbar(); expect(message.text).toContain('Data saved!'); - }); - it('should reload the section then check the name was edited', async() => { await page.reloadSection('worker.card.basicData'); - const result = await page.waitToGetProperty(selectors.workerBasicData.name, 'value'); - expect(result).toEqual('David C.'); - }); - - it('should the surname was edited', async() => { - const result = await page.waitToGetProperty(selectors.workerBasicData.surname, 'value'); - - expect(result).toEqual('H.'); - }); - - it('should the phone was edited', async() => { - const result = await page.waitToGetProperty(selectors.workerBasicData.phone, 'value'); - - expect(result).toEqual('444332211'); + expect(await page.waitToGetProperty(selectors.workerBasicData.name, 'value')).toEqual('David C.'); + expect(await page.waitToGetProperty(selectors.workerBasicData.surname, 'value')).toEqual('H.'); + expect(await page.waitToGetProperty(selectors.workerBasicData.phone, 'value')).toEqual('444332211'); + expect(await page.waitToGetProperty(selectors.workerBasicData.locker, 'value')).toEqual('1'); }); }); diff --git a/e2e/paths/03-worker/03_pbx.spec.js b/e2e/paths/03-worker/03_pbx.spec.js index f5d2711d1..0e8003c47 100644 --- a/e2e/paths/03-worker/03_pbx.spec.js +++ b/e2e/paths/03-worker/03_pbx.spec.js @@ -16,19 +16,16 @@ describe('Worker pbx path', () => { await browser.close(); }); - it('should receive an error when the extension exceeds 4 characters', async() => { + it('should receive an error when the extension exceeds 4 characters and then sucessfully save the changes', async() => { await page.write(selectors.workerPbx.extension, '55555'); - await page.waitToClick(selectors.workerPbx.saveButton); - const message = await page.waitForSnackbar(); + await page.click(selectors.workerPbx.saveButton); + let message = await page.waitForSnackbar(); expect(message.text).toContain('Extension format is invalid'); - }); - it('should sucessfully save the changes', async() => { - await page.clearInput(selectors.workerPbx.extension); - await page.write(selectors.workerPbx.extension, '4444'); - await page.waitToClick(selectors.workerPbx.saveButton); - const message = await page.waitForSnackbar(); + await page.overwrite(selectors.workerPbx.extension, '4444'); + await page.click(selectors.workerPbx.saveButton); + message = await page.waitForSnackbar(); expect(message.text).toContain('Data saved! User must access web'); }); diff --git a/e2e/paths/03-worker/04_time_control.spec.js b/e2e/paths/03-worker/04_time_control.spec.js index 5709e6207..5f64aa6ce 100644 --- a/e2e/paths/03-worker/04_time_control.spec.js +++ b/e2e/paths/03-worker/04_time_control.spec.js @@ -1,3 +1,4 @@ +/* eslint max-len: ["error", { "code": 150 }]*/ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; @@ -10,414 +11,112 @@ describe('Worker time control path', () => { await page.loginAndModule('salesBoss', 'worker'); await page.accessToSearchResult('HankPym'); await page.accessToSection('worker.card.timeControl'); - await page.waitToClick(selectors.workerTimeControl.previousMonthButton); - await page.waitToClick(selectors.workerTimeControl.secondWeekDay); }); afterAll(async() => { await browser.close(); }); - describe('as salesBoss', () => { - describe('on Monday', () => { - it('should scan in Hank Pym', async() => { - const scanTime = '07:00'; + const eightAm = '08:00'; + const fourPm = '16:00'; + const hankPymId = 1107; - await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText'); + it('should go to the next month, go to current month and go 1 month in the past', async() => { + let date = Date.vnNew(); + date.setDate(1); + date.setMonth(date.getMonth() + 1); + let month = date.toLocaleString('default', {month: 'long'}); - expect(result).toEqual(scanTime); - }); + await page.waitToClick(selectors.workerTimeControl.nextMonthButton); + let result = await page.getProperty(selectors.workerTimeControl.monthName, 'innerText'); - it(`should scan out Hank Pym for break`, async() => { - const scanTime = '10:00'; + expect(result).toContain(month); - await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText'); + date = Date.vnNew(); + date.setDate(1); + month = date.toLocaleString('default', {month: 'long'}); - expect(result).toEqual(scanTime); - }); + await page.waitToClick(selectors.workerTimeControl.previousMonthButton); + result = await page.getProperty(selectors.workerTimeControl.monthName, 'innerText'); - it(`should scan in Hank Pym for a wrong hour and forget to scan in from the break`, async() => { - const scanTime = '18:00'; + expect(result).toContain(month); - await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText'); + date = Date.vnNew(); + date.setDate(1); + date.setMonth(date.getMonth() - 1); + const timestamp = Math.round(date.getTime() / 1000); + month = date.toLocaleString('default', {month: 'long'}); - expect(result).toEqual(scanTime); - }); + await page.loginAndModule('salesBoss', 'worker'); + await page.goto(`http://localhost:5000/#!/worker/${hankPymId}/time-control?timestamp=${timestamp}`); + await page.waitToClick(selectors.workerTimeControl.secondWeekDay); - it(`should delete the wrong entry for Hank Pym`, async() => { - const wrongScanTime = '18:00'; + result = await page.getProperty(selectors.workerTimeControl.monthName, 'innerText'); - await page.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime); - await page.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete); - await page.respondToDialog('accept'); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Entry removed'); - }); - - it(`should scan out Hank Pym to leave early`, async() => { - const scanTime = '14:00'; - - await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should add the break's scan in for Hank Pym and be in the right order`, async() => { - const scanTime = '10:20'; - - await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText'); - - expect(result).toEqual('14:00'); - }); - - it(`should the third entry be the scan in from break`, async() => { - const scanTime = '10:20'; - - const result = await page - .waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should check Hank Pym worked 6:40 hours`, async() => { - await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '06:40 h.'); - }); - }); - - describe('on Tuesday', () => { - it('should happily scan in Hank Pym', async() => { - const scanTime = '08:00'; - - await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should happily scan out Hank Pym for break`, async() => { - const scanTime = '10:00'; - - await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should happily scan in Hank Pym from the break`, async() => { - const scanTime = '10:20'; - - await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should happily scan out Hank Pym for the day`, async() => { - const scanTime = '16:00'; - - await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should check Hank Pym worked 7:40 hours`, async() => { - await page.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '07:40 h.'); - }); - }); - - describe('on Wednesday', () => { - it('should cheerfully scan in Hank Pym', async() => { - const scanTime = '09:00'; - - await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should cheerfully scan out Hank Pym for break`, async() => { - const scanTime = '10:00'; - - await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should cheerfully scan in Hank Pym from the break`, async() => { - const scanTime = '10:20'; - - await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should cheerfully scan out Hank Pym for the day`, async() => { - const scanTime = '17:00'; - - await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should check Hank Pym worked 7:40 cheerfull hours`, async() => { - await page.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '07:40 h.'); - }); - }); - - describe('on Thursday', () => { - it('should joyfully scan in Hank Pym', async() => { - const scanTime = '09:59'; - - await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should joyfully scan out Hank Pym for break`, async() => { - const scanTime = '10:00'; - await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should joyfully scan in Hank Pym from the break`, async() => { - const scanTime = '10:20'; - await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should joyfully scan out Hank Pym for the day`, async() => { - const scanTime = '17:59'; - await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should check Hank Pym worked 7:40 joyfull hours`, async() => { - await page.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '07:40 h.'); - }); - }); - - describe('on Friday', () => { - it('should smilingly scan in Hank Pym', async() => { - const scanTime = '07:30'; - await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should smilingly scan out Hank Pym for break`, async() => { - const scanTime = '10:00'; - await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should smilingly scan in Hank Pym from the break`, async() => { - const scanTime = '10:20'; - await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should smilingly scan out Hank Pym for the day`, async() => { - const scanTime = '15:30'; - await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should check Hank Pym worked 7:40 hours with a smile on his face`, async() => { - await page.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '07:40 h.'); - }); - }); + expect(result).toContain(month); }); - describe('as HHRR', () => { - describe('on Saturday', () => { - it('should log in as hr and pick the worker module', async() => { - await page.loginAndModule('hr', 'worker'); - }); + it(`should return error when insert 'out' of first entry`, async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm); + await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out'); + await page.respondToDialog('accept'); + const message = await page.waitForSnackbar(); - it('should search for a worker and access to its summary', async() => { - await page.accessToSearchResult('HankPym'); - await page.waitForState('worker.card.summary'); - }); - - it('should access to the time control section', async() => { - await page.accessToSection('worker.card.timeControl'); - await page.waitForState('worker.card.timeControl'); - await page.waitToClick(selectors.workerTimeControl.previousMonthButton); - await page.waitToClick(selectors.workerTimeControl.secondWeekDay); - }); - - it('should lovingly scan in Hank Pym', async() => { - const scanTime = '06:00'; - await page.waitForTimeout(1000); // without this timeout the dialog doesn't pop up - await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should lovingly scan out Hank Pym for the day with no break to leave a bit early`, async() => { - const scanTime = '13:40'; - await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should check Hank Pym worked 7:40 hours with all his will`, async() => { - await page.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '07:40 h.'); - }); - }); - - describe('on Sunday', () => { - it('should gladly scan in Hank Pym', async() => { - const scanTime = '05:00'; - await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should gladly scan out Hank Pym for the day with no break to leave a bit early`, async() => { - const scanTime = '12:40'; - await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton); - await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime); - await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out'); - await page.respondToDialog('accept'); - const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText'); - - expect(result).toEqual(scanTime); - }); - - it(`should check Hank Pym worked 7:40 glad hours`, async() => { - await page.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '07:40 h.'); - }); - - it(`should check Hank Pym doesn't have hours set on the next months second week`, async() => { - await page.waitToClick(selectors.workerTimeControl.nextMonthButton); - await page.waitToClick(selectors.workerTimeControl.secondWeekDay); - await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.'); - }); - - it(`should check he didn't scan in this week yet`, async() => { - await page.waitToClick(selectors.workerTimeControl.navigateBackToIndex); - await page.accessToSearchResult('salesBoss'); - await page.accessToSection('worker.card.timeControl'); - - const wholeWeekHours = await page - .waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText'); - - expect(wholeWeekHours).toEqual('00:00 h.'); - }); - }); + expect(message.text).toBeDefined(); }); - describe('after all this amazing week', () => { - it('should log in Hank', async() => { - await page.loginAndModule('HankPym', 'worker'); - await page.accessToSearchResult('HankPym'); - await page.accessToSection('worker.card.timeControl'); - await page.waitToClick(selectors.workerTimeControl.previousMonthButton); - await page.waitToClick(selectors.workerTimeControl.secondWeekDay); - }); + it(`should insert 'in' monday`, async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm); + await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in'); + await page.respondToDialog('accept'); + const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText'); - it('should check his weekly hours are alright', async() => { - await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '52:40 h.'); - }); + expect(result).toEqual(eightAm); + }); + + it(`should insert 'out' monday`, async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); + await page.pickTime(selectors.workerTimeControl.dialogTimeInput, fourPm); + await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out'); + await page.respondToDialog('accept'); + const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText'); + + expect(result).toEqual(fourPm); + }); + + it(`should check Hank Pym worked 8:20 hours`, async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '08:20 h.'); + await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '08:20 h.'); + }); + + it('should remove first entry of monday', async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + await page.waitForTextInElement(selectors.workerTimeControl.firstEntryOfMonday, eightAm); + await page.waitForTextInElement(selectors.workerTimeControl.secondEntryOfMonday, fourPm); + await page.waitToClick(selectors.workerTimeControl.firstEntryOfMondayDelete); + await page.respondToDialog('accept'); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Entry removed'); + }); + + it(`should be the 'out' the first entry of monday`, async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText'); + + expect(result).toEqual(fourPm); + }); + + it('should change week of month', async() => { + await page.click(selectors.workerTimeControl.thrirdWeekDay); + const result = await page.getProperty(selectors.workerTimeControl.mondayWorkedHours, 'innerText'); + + expect(result).toEqual('00:00 h.'); }); }); diff --git a/e2e/paths/03-worker/05_calendar.spec.js b/e2e/paths/03-worker/05_calendar.spec.js index e97b7fe7c..f0af0a053 100644 --- a/e2e/paths/03-worker/05_calendar.spec.js +++ b/e2e/paths/03-worker/05_calendar.spec.js @@ -1,16 +1,25 @@ +/* eslint-disable max-len */ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Worker calendar path', () => { - let reasonableTimeBetweenClicks = 400; + const reasonableTimeBetweenClicks = 300; + const date = Date.vnNew(); + const lastYear = (date.getFullYear() - 1).toString(); + let browser; let page; + + async function accessAs(user) { + await page.loginAndModule(user, 'worker'); + await page.accessToSearchResult('Charles Xavier'); + await page.accessToSection('worker.card.calendar'); + } + beforeAll(async() => { browser = await getBrowser(); page = browser.page; - await page.loginAndModule('hr', 'worker'); - await page.accessToSearchResult('Charles Xavier'); - await page.accessToSection('worker.card.calendar'); + accessAs('hr'); }); afterAll(async() => { @@ -21,48 +30,40 @@ describe('Worker calendar path', () => { it('should set two days as holidays on the calendar and check the total holidays increased by 1.5', async() => { await page.waitToClick(selectors.workerCalendar.holidays); await page.waitForTimeout(reasonableTimeBetweenClicks); - await page.waitToClick(selectors.workerCalendar.penultimateMondayOfJanuary); + await page.click(selectors.workerCalendar.penultimateMondayOfJanuary); await page.waitForTimeout(reasonableTimeBetweenClicks); - await page.waitToClick(selectors.workerCalendar.absence); + await page.click(selectors.workerCalendar.absence); await page.waitForTimeout(reasonableTimeBetweenClicks); - await page.waitToClick(selectors.workerCalendar.lastMondayOfMarch); + await page.click(selectors.workerCalendar.lastMondayOfMarch); await page.waitForTimeout(reasonableTimeBetweenClicks); - await page.waitToClick(selectors.workerCalendar.halfHoliday); + await page.click(selectors.workerCalendar.halfHoliday); await page.waitForTimeout(reasonableTimeBetweenClicks); - await page.waitToClick(selectors.workerCalendar.fistMondayOfMay); + await page.click(selectors.workerCalendar.fistMondayOfMay); await page.waitForTimeout(reasonableTimeBetweenClicks); - await page.waitToClick(selectors.workerCalendar.furlough); + await page.click(selectors.workerCalendar.furlough); await page.waitForTimeout(reasonableTimeBetweenClicks); - await page.waitToClick(selectors.workerCalendar.secondTuesdayOfMay); + await page.click(selectors.workerCalendar.secondTuesdayOfMay); await page.waitForTimeout(reasonableTimeBetweenClicks); - await page.waitToClick(selectors.workerCalendar.secondWednesdayOfMay); + await page.click(selectors.workerCalendar.secondWednesdayOfMay); await page.waitForTimeout(reasonableTimeBetweenClicks); - await page.waitToClick(selectors.workerCalendar.secondThursdayOfMay); + await page.click(selectors.workerCalendar.secondThursdayOfMay); await page.waitForTimeout(reasonableTimeBetweenClicks); - await page.waitToClick(selectors.workerCalendar.halfFurlough); - await page.waitForTimeout(reasonableTimeBetweenClicks); - await page.waitToClick(selectors.workerCalendar.secondFridayOfJun); + await page.click(selectors.workerCalendar.halfFurlough); await page.waitForTimeout(reasonableTimeBetweenClicks); + await page.click(selectors.workerCalendar.secondFridayOfJun); - const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); - - expect(result).toContain(' 1.5 '); + expect(await page.getProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText')).toContain(' 1.5 '); }); }); describe(`as salesBoss`, () => { - it(`should log in and get to Charles Xavier's calendar`, async() => { - await page.loginAndModule('salesBoss', 'worker'); - await page.accessToSearchResult('Charles Xavier'); - await page.accessToSection('worker.card.calendar'); - }); + it(`should log in, get to Charles Xavier's calendar, undo what was done here, and check the total holidays used are back to what it was`, async() => { + accessAs('salesBoss'); - it('should undo what was done here', async() => { - await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.holidays); await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.penultimateMondayOfJanuary); @@ -90,45 +91,24 @@ describe('Worker calendar path', () => { await page.waitToClick(selectors.workerCalendar.halfFurlough); await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitToClick(selectors.workerCalendar.secondFridayOfJun); - }); - it('should check the total holidays used are back to what it was', async() => { - const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); - - expect(result).toContain(' 0 '); + expect(await page.getProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText')).toContain(' 0 '); }); }); describe(`as Charles Xavier`, () => { - it(`should log in and get to his calendar`, async() => { - await page.loginAndModule('CharlesXavier', 'worker'); - await page.accessToSearchResult('Charles Xavier'); - await page.accessToSection('worker.card.calendar'); - }); - - it('should make a futile attempt to add holidays', async() => { - await page.waitForTimeout(reasonableTimeBetweenClicks); + it('should log in and get to his calendar, make a futile attempt to add holidays, check the total holidays used are now the initial ones and use the year selector to go to the previous year', async() => { + accessAs('CharlesXavier'); await page.waitToClick(selectors.workerCalendar.holidays); await page.waitForTimeout(reasonableTimeBetweenClicks); - await page.waitToClick(selectors.workerCalendar.penultimateMondayOfJanuary); - }); - it('should check the total holidays used are now the initial ones', async() => { - const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); + await page.click(selectors.workerCalendar.penultimateMondayOfJanuary); - expect(result).toContain(' 0 '); - }); - - it('should use the year selector to go to the previous year', async() => { - const date = new Date(); - const lastYear = (date.getFullYear() - 1).toString(); + expect(await page.getProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText')).toContain(' 0 '); await page.autocompleteSearch(selectors.workerCalendar.year, lastYear); - await page.waitForTimeout(reasonableTimeBetweenClicks); - const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); - - expect(result).toContain(' 0 '); + expect(await page.getProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText')).toContain(' 0 '); }); }); }); diff --git a/e2e/paths/03-worker/06_create.spec.js b/e2e/paths/03-worker/06_create.spec.js new file mode 100644 index 000000000..98e67edbf --- /dev/null +++ b/e2e/paths/03-worker/06_create.spec.js @@ -0,0 +1,73 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Worker create path', () => { + let browser; + let page; + let newWorker; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('hr', 'worker'); + await page.waitToClick(selectors.workerCreate.newWorkerButton); + await page.waitForState('worker.create'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should insert default data', async() => { + await page.write(selectors.workerCreate.firstname, 'Victor'); + await page.write(selectors.workerCreate.lastname, 'Von Doom'); + await page.write(selectors.workerCreate.fi, '78457139E'); + await page.write(selectors.workerCreate.phone, '12356789'); + await page.write(selectors.workerCreate.postcode, '46680'); + await page.write(selectors.workerCreate.street, 'S/ Doomstadt'); + await page.write(selectors.workerCreate.email, 'doctorDoom@marvel.com'); + await page.write(selectors.workerCreate.iban, 'ES9121000418450200051332'); + + // should check for autocompleted worker code and worker user name + const workerCode = await page + .waitToGetProperty(selectors.workerCreate.code, 'value'); + + newWorker = await page + .waitToGetProperty(selectors.workerCreate.user, 'value'); + + expect(workerCode).toEqual('VVD'); + expect(newWorker).toContain('victorvd'); + + // should fail if necessary data is void + await page.waitToClick(selectors.workerCreate.createButton); + let message = await page.waitForSnackbar(); + + expect(message.text).toContain('is a required argument'); + + // should create a new worker and go to worker basic data' + await page.pickDate(selectors.workerCreate.birth, new Date(1962, 8, 5)); + await page.autocompleteSearch(selectors.workerCreate.boss, 'deliveryBoss'); + await page.waitToClick(selectors.workerCreate.createButton); + message = await page.waitForSnackbar(); + await page.waitForState('worker.card.basicData'); + + expect(message.text).toContain('Data saved!'); + + // 'rollback' + await page.loginAndModule('sysadmin', 'account'); + await page.accessToSearchResult(newWorker); + + await page.waitToClick(selectors.accountDescriptor.menuButton); + await page.waitToClick(selectors.accountDescriptor.deactivateUser); + await page.waitToClick(selectors.accountDescriptor.acceptButton); + message = await page.waitForSnackbar(); + + expect(message.text).toContain('User deactivated!'); + + await page.waitToClick(selectors.accountDescriptor.menuButton); + await page.waitToClick(selectors.accountDescriptor.disableAccount); + await page.waitToClick(selectors.accountDescriptor.acceptButton); + message = await page.waitForSnackbar(); + + expect(message.text).toContain('Account disabled!'); + }); +}); diff --git a/e2e/paths/03-worker/07_pda.spec.js b/e2e/paths/03-worker/07_pda.spec.js new file mode 100644 index 000000000..2b743823e --- /dev/null +++ b/e2e/paths/03-worker/07_pda.spec.js @@ -0,0 +1,41 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Worker pda path', () => { + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('hr', 'worker'); + await page.accessToSearchResult('employeeNick'); + await page.accessToSection('worker.card.pda'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should check if worker has already a PDA allocated', async() => { + expect(await page.waitToGetProperty(selectors.workerPda.currentPDA, 'value')).toContain('serialNumber1'); + }); + + it('should deallocate the PDA', async() => { + await page.waitToClick(selectors.workerPda.delete); + let message = await page.waitForSnackbar(); + + expect(message.text).toContain('PDA deallocated'); + }); + + it('should allocate a new PDA', async() => { + await page.autocompleteSearch(selectors.workerPda.newPDA, 'serialNumber2'); + await page.waitToClick(selectors.workerPda.submit); + let message = await page.waitForSnackbar(); + + expect(message.text).toContain('PDA allocated'); + }); + + it('should check if a new PDA has been allocated', async() => { + expect(await page.waitToGetProperty(selectors.workerPda.currentPDA, 'value')).toContain('serialNumber2'); + }); +}); diff --git a/e2e/paths/04-item/02_basic_data.spec.js b/e2e/paths/04-item/02_basic_data.spec.js index a663ea3bb..3cf142816 100644 --- a/e2e/paths/04-item/02_basic_data.spec.js +++ b/e2e/paths/04-item/02_basic_data.spec.js @@ -35,6 +35,7 @@ describe('Item Edit basic data path', () => { await page.waitToClick(selectors.itemBasicData.isActiveCheckbox); await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox); await page.waitToClick(selectors.itemBasicData.isFragile); + await page.write(selectors.itemBasicData.packingOut, '5'); await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); const message = await page.waitForSnackbar(); @@ -128,4 +129,11 @@ describe('Item Edit basic data path', () => { expect(result).toBe('checked'); }); + + it(`should confirm the item packingOut was edited`, async() => { + const result = await page + .waitToGetProperty(selectors.itemBasicData.packingOut, 'value'); + + expect(result).toEqual('5'); + }); }); diff --git a/e2e/paths/04-item/07_create.spec.js b/e2e/paths/04-item/07_create.spec.js index 0820f2db7..33324cdba 100644 --- a/e2e/paths/04-item/07_create.spec.js +++ b/e2e/paths/04-item/07_create.spec.js @@ -36,11 +36,20 @@ describe('Item Create', () => { await page.waitForState('item.create'); }); - it('should create the Infinity Gauntlet item', async() => { + it('should throw an error when insert an invalid priority', async() => { await page.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet'); await page.autocompleteSearch(selectors.itemCreateView.type, 'Crisantemo'); await page.autocompleteSearch(selectors.itemCreateView.intrastat, 'Coral y materiales similares'); await page.autocompleteSearch(selectors.itemCreateView.origin, 'Holand'); + await page.clearInput(selectors.itemCreateView.priority); + await page.waitToClick(selectors.itemCreateView.createButton); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Valid priorities'); + }); + + it('should create the Infinity Gauntlet item', async() => { + await page.autocompleteSearch(selectors.itemCreateView.priority, '2'); await page.waitToClick(selectors.itemCreateView.createButton); const message = await page.waitForSnackbar(); diff --git a/e2e/paths/04-item/08_regularize.spec.js b/e2e/paths/04-item/08_regularize.spec.js index 400df666f..9b3074776 100644 --- a/e2e/paths/04-item/08_regularize.spec.js +++ b/e2e/paths/04-item/08_regularize.spec.js @@ -127,8 +127,8 @@ describe('Item regularize path', () => { await page.waitForState('ticket.index'); }); - it('should search for the ticket with id 28 once again', async() => { - await page.accessToSearchResult('28'); + it('should search for the ticket missing once again', async() => { + await page.accessToSearchResult('Missing'); await page.waitForState('ticket.card.summary'); }); diff --git a/e2e/paths/04-item/09_index.spec.js b/e2e/paths/04-item/09_index.spec.js index f9262863d..6e0a4bd5c 100644 --- a/e2e/paths/04-item/09_index.spec.js +++ b/e2e/paths/04-item/09_index.spec.js @@ -31,7 +31,7 @@ describe('Item index path', () => { await page.waitToClick(selectors.itemsIndex.intrastadCheckbox); await page.waitToClick(selectors.itemsIndex.originCheckbox); await page.waitToClick(selectors.itemsIndex.buyerCheckbox); - await page.waitToClick(selectors.itemsIndex.densityCheckbox); + await page.waitToClick(selectors.itemsIndex.weightByPieceCheckbox); await page.waitToClick(selectors.itemsIndex.saveFieldsButton); const message = await page.waitForSnackbar(); @@ -64,7 +64,7 @@ describe('Item index path', () => { await page.waitToClick(selectors.itemsIndex.intrastadCheckbox); await page.waitToClick(selectors.itemsIndex.originCheckbox); await page.waitToClick(selectors.itemsIndex.buyerCheckbox); - await page.waitToClick(selectors.itemsIndex.densityCheckbox); + await page.waitToClick(selectors.itemsIndex.weightByPieceCheckbox); await page.waitToClick(selectors.itemsIndex.saveFieldsButton); const message = await page.waitForSnackbar(); diff --git a/e2e/paths/04-item/10_item_log.spec.js b/e2e/paths/04-item/10_item_log.spec.js index 2a885fe6f..6a7bd7ae2 100644 --- a/e2e/paths/04-item/10_item_log.spec.js +++ b/e2e/paths/04-item/10_item_log.spec.js @@ -48,17 +48,17 @@ describe('Item log path', () => { await page.accessToSection('item.card.log'); }); - it(`should confirm the log is showing 5 entries`, async() => { + it(`should confirm the log is showing 4 entries`, async() => { await page.waitForSelector(selectors.itemLog.anyLineCreated); const anyLineCreatedCount = await page.countElement(selectors.itemLog.anyLineCreated); - expect(anyLineCreatedCount).toEqual(5); + expect(anyLineCreatedCount).toEqual(4); }); - it(`should confirm the log is showing the intrastat for the created item`, async() => { + xit(`should confirm the log is showing the intrastat for the created item`, async() => { const fifthLineCreatedProperty = await page .waitToGetProperty(selectors.itemLog.fifthLineCreatedProperty, 'innerText'); - expect(fifthLineCreatedProperty).toEqual('Coral y materiales similares'); + expect(fifthLineCreatedProperty).toEqual('05080000'); }); }); diff --git a/e2e/paths/04-item/13_fixedPrice.spec.js b/e2e/paths/04-item/13_fixedPrice.spec.js index fc7aac3d0..1b0f82d83 100644 --- a/e2e/paths/04-item/13_fixedPrice.spec.js +++ b/e2e/paths/04-item/13_fixedPrice.spec.js @@ -22,10 +22,10 @@ describe('Item fixed prices path', () => { }); it('should fill the fixed price data', async() => { - const now = new Date(); + const now = Date.vnNew(); await page.autocompleteSearch(selectors.itemFixedPrice.fourthWarehouse, 'Warehouse one'); - await page.write(selectors.itemFixedPrice.fourthPPU, '1'); - await page.write(selectors.itemFixedPrice.fourthPPP, '1'); + await page.writeOnEditableTD(selectors.itemFixedPrice.fourthGroupingPrice, '1'); + await page.writeOnEditableTD(selectors.itemFixedPrice.fourthPackingPrice, '1'); await page.write(selectors.itemFixedPrice.fourthMinPrice, '1'); await page.pickDate(selectors.itemFixedPrice.fourthStarted, now); await page.pickDate(selectors.itemFixedPrice.fourthEnded, now); diff --git a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js index d776f417d..f9b520981 100644 --- a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js +++ b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js @@ -196,6 +196,17 @@ describe('Ticket Edit sale path', () => { expect(result).toContain('22.50'); }); + it('should check in the history that logs has been added', async() => { + pending('https://redmine.verdnatura.es/issues/5455'); + await page.reload({waitUntil: ['networkidle0', 'domcontentloaded']}); + await page.waitToClick(selectors.ticketSales.firstSaleHistoryButton); + await page.waitForSelector(selectors.ticketSales.firstSaleHistory); + const result = await page.countElement(selectors.ticketSales.firstSaleHistory); + + expect(result).toBeGreaterThan(0); + await page.waitToClick(selectors.ticketSales.closeHistory); + }); + it('should recalculate price of sales', async() => { await page.waitToClick(selectors.ticketSales.firstSaleCheckbox); await page.waitToClick(selectors.ticketSales.secondSaleCheckbox); @@ -217,9 +228,21 @@ describe('Ticket Edit sale path', () => { await page.waitToClick(selectors.ticketSales.firstSaleCheckbox); await page.waitToClick(selectors.ticketSales.moreMenu); await page.waitToClick(selectors.ticketSales.moreMenuRefund); + await page.waitForSnackbar(); await page.waitForState('ticket.card.sale'); }); + it('should show error trying to delete a ticket with a refund', async() => { + await page.accessToSearchResult('16'); + await page.waitToClick(selectors.ticketDescriptor.moreMenu); + await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket); + await page.waitToClick(selectors.globalItems.acceptButton); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Tickets with associated refunds can\'t be deleted'); + await page.waitToClick(selectors.globalItems.cancelButton); + }); + it('should select the third sale and create a claim of it', async() => { await page.accessToSearchResult('16'); await page.accessToSection('ticket.card.sale'); @@ -291,7 +314,7 @@ describe('Ticket Edit sale path', () => { it('should confirm the transfered quantity is the correct one', async() => { const result = await page.waitToGetProperty(selectors.ticketSales.secondSaleQuantityCell, 'innerText'); - expect(result).toContain('10'); + expect(result).toContain('20'); }); it('should go back to the original ticket sales section', async() => { diff --git a/e2e/paths/05-ticket/01_observations.spec.js b/e2e/paths/05-ticket/01_observations.spec.js index 45b4ebb3e..cf37f9ff1 100644 --- a/e2e/paths/05-ticket/01_observations.spec.js +++ b/e2e/paths/05-ticket/01_observations.spec.js @@ -9,7 +9,7 @@ describe('Ticket Create notes path', () => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('employee', 'ticket'); - await page.accessToSearchResult('1'); + await page.accessToSearchResult('5'); await page.accessToSection('ticket.card.observation'); }); diff --git a/e2e/paths/05-ticket/02_expeditions_and_log.spec.js b/e2e/paths/05-ticket/02_expeditions_and_log.spec.js index 0e6482c94..ae5e2fb0c 100644 --- a/e2e/paths/05-ticket/02_expeditions_and_log.spec.js +++ b/e2e/paths/05-ticket/02_expeditions_and_log.spec.js @@ -18,7 +18,8 @@ describe('Ticket expeditions and log path', () => { }); it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async() => { - await page.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton); + await page.waitToClick(selectors.ticketExpedition.thirdSaleCheckbox); + await page.waitToClick(selectors.ticketExpedition.deleteExpeditionButton); await page.waitToClick(selectors.globalItems.acceptButton); await page.reloadSection('ticket.card.expedition'); @@ -31,14 +32,17 @@ describe('Ticket expeditions and log path', () => { it(`should confirm the expedition deleted is shown now in the ticket log`, async() => { await page.accessToSection('ticket.card.log'); - const firstLogEntry = await page - .waitToGetProperty(selectors.ticketLog.firstLogEntry, 'innerText'); + const user = await page + .waitToGetProperty(selectors.ticketLog.user, 'innerText'); + + const action = await page + .waitToGetProperty(selectors.ticketLog.action, 'innerText'); const id = await page .waitToGetProperty(selectors.ticketLog.id, 'innerText'); - expect(firstLogEntry).toContain('production'); - expect(firstLogEntry).toContain('Deletes'); + expect(user).toContain('production'); + expect(action).toContain('Deletes'); expect(id).toEqual('2'); }); }); diff --git a/e2e/paths/05-ticket/06_basic_data_steps.spec.js b/e2e/paths/05-ticket/06_basic_data_steps.spec.js index fa118c25d..55aec45fb 100644 --- a/e2e/paths/05-ticket/06_basic_data_steps.spec.js +++ b/e2e/paths/05-ticket/06_basic_data_steps.spec.js @@ -42,7 +42,7 @@ describe('Ticket Edit basic data path', () => { expect(disabled).toBeFalsy(); }); - it(`should check the zone is for Silla247`, async() => { + it(`should check the zone is for Gotham247`, async() => { let zone = await page .waitToGetProperty(selectors.ticketBasicData.zone, 'value'); @@ -63,7 +63,7 @@ describe('Ticket Edit basic data path', () => { let zone = await page .waitToGetProperty(selectors.ticketBasicData.agency, 'value'); - expect(zone).toContain('Silla247Expensive'); + expect(zone).toContain('Gotham247Expensive'); }); it(`should click next`, async() => { @@ -92,8 +92,8 @@ describe('Ticket Edit basic data path', () => { }); it(`should split ticket without negatives`, async() => { - const newAgency = 'Silla247'; - const newDate = new Date(); + const newAgency = 'Gotham247'; + const newDate = Date.vnNew(); newDate.setDate(newDate.getDate() - 1); await page.accessToSearchResult('14'); @@ -104,7 +104,6 @@ describe('Ticket Edit basic data path', () => { await page.waitToClick(selectors.ticketBasicData.nextStepButton); - await page.waitToClick(selectors.ticketBasicData.withoutNegatives); await page.waitToClick(selectors.ticketBasicData.finalizeButton); await page.waitForState('ticket.card.summary'); @@ -128,7 +127,7 @@ describe('Ticket Edit basic data path', () => { }); it(`should old ticket have old date and agency`, async() => { - const oldDate = new Date(); + const oldDate = Date.vnNew(); const oldAgency = 'Super-Man delivery'; await page.accessToSearchResult('14'); diff --git a/e2e/paths/05-ticket/09_weekly.spec.js b/e2e/paths/05-ticket/09_weekly.spec.js index 2392de28f..0ba57aa9d 100644 --- a/e2e/paths/05-ticket/09_weekly.spec.js +++ b/e2e/paths/05-ticket/09_weekly.spec.js @@ -19,7 +19,7 @@ describe('Ticket descriptor path', () => { it('should count the amount of tickets in the turns section', async() => { const result = await page.countElement(selectors.ticketsIndex.weeklyTicket); - expect(result).toEqual(5); + expect(result).toEqual(6); }); it('should go back to the ticket index then search and access a ticket summary', async() => { @@ -45,7 +45,7 @@ describe('Ticket descriptor path', () => { it('should confirm the ticket 11 was added to thursday', async() => { await page.accessToSection('ticket.weekly.index'); - const result = await page.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value'); + const result = await page.waitToGetProperty(selectors.ticketsIndex.fourthWeeklyTicket, 'value'); expect(result).toEqual('Thursday'); }); @@ -80,7 +80,7 @@ describe('Ticket descriptor path', () => { it('should confirm the ticket 11 was added on saturday', async() => { await page.accessToSection('ticket.weekly.index'); - const result = await page.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value'); + const result = await page.waitToGetProperty(selectors.ticketsIndex.fiveWeeklyTicket, 'value'); expect(result).toEqual('Saturday'); }); @@ -104,11 +104,11 @@ describe('Ticket descriptor path', () => { await page.doSearch(); const nResults = await page.countElement(selectors.ticketsIndex.searchWeeklyResult); - expect(nResults).toEqual(5); + expect(nResults).toEqual(6); }); it('should update the agency then remove it afterwards', async() => { - await page.autocompleteSearch(selectors.ticketsIndex.firstWeeklyTicketAgency, 'Silla247'); + await page.autocompleteSearch(selectors.ticketsIndex.firstWeeklyTicketAgency, 'Gotham247'); let message = await page.waitForSnackbar(); expect(message.text).toContain('Data saved!'); diff --git a/e2e/paths/05-ticket/12_descriptor.spec.js b/e2e/paths/05-ticket/12_descriptor.spec.js index 3429acc89..ca6fb8290 100644 --- a/e2e/paths/05-ticket/12_descriptor.spec.js +++ b/e2e/paths/05-ticket/12_descriptor.spec.js @@ -75,59 +75,6 @@ describe('Ticket descriptor path', () => { }); }); - describe('Add stowaway', () => { - it('should search for a ticket', async() => { - await page.accessToSearchResult('16'); - await page.waitForState('ticket.card.summary'); - }); - - it('should open the add stowaway dialog', async() => { - await page.waitForFunction(() => { - let element = document.querySelector('vn-ticket-descriptor-menu'); - return element.$ctrl.canShowStowaway === true; - }); - await page.waitToClick(selectors.ticketDescriptor.moreMenu); - await page.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway); - await page.waitForSelector(selectors.ticketDescriptor.addStowawayDialogFirstTicket); - const isVisible = await page.isVisible(selectors.ticketDescriptor.addStowawayDialogFirstTicket); - - expect(isVisible).toBeTruthy(); - }); - - it('should add a ticket as stowaway', async() => { - await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Data saved!'); - }); - - it(`should check the state of the stowaway ticket is embarked`, async() => { - await page.waitForState('ticket.card.summary'); - const state = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText'); - - expect(state).toEqual('State Embarcando'); - }); - - it(`should navigate back to the added ticket using the descriptors ship button`, async() => { - await page.waitToClick(selectors.ticketDescriptor.shipButton); - await page.waitForState('ticket.card.summary'); - }); - - it('should delete the stowaway', async() => { - await page.waitToClick(selectors.ticketDescriptor.moreMenu); - await page.waitForContentLoaded(); - await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton); - await page.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Data saved!'); - }); - - it(`should confirm the ship buton doesn't exisist any more`, async() => { - await page.waitForSelector(selectors.ticketDescriptor.shipButton, {hidden: true}); - }); - }); - describe('Make invoice', () => { it('should login as administrative role then search for a ticket', async() => { const invoiceableTicketId = '14'; diff --git a/e2e/paths/05-ticket/13_services.spec.js b/e2e/paths/05-ticket/13_services.spec.js index 03e57b588..50df23582 100644 --- a/e2e/paths/05-ticket/13_services.spec.js +++ b/e2e/paths/05-ticket/13_services.spec.js @@ -23,9 +23,9 @@ describe('Ticket services path', () => { await page.waitForClassPresent(selectors.ticketService.firstAddServiceTypeButton, 'disabled'); await page.waitToClick(selectors.ticketService.addServiceButton); await page.waitForSelector(selectors.ticketService.firstAddServiceTypeButton); - const result = await page.isDisabled(selectors.ticketService.firstAddServiceTypeButton); + const disabled = await page.isDisabled(selectors.ticketService.firstAddServiceTypeButton); - expect(result).toBe(true); + expect(disabled).toBe(true); }); it('should receive an error if you attempt to save a service without access rights', async() => { diff --git a/e2e/paths/05-ticket/14_create_ticket.spec.js b/e2e/paths/05-ticket/14_create_ticket.spec.js index bfaa08775..80c288a01 100644 --- a/e2e/paths/05-ticket/14_create_ticket.spec.js +++ b/e2e/paths/05-ticket/14_create_ticket.spec.js @@ -4,9 +4,8 @@ import getBrowser from '../../helpers/puppeteer'; describe('Ticket create path', () => { let browser; let page; - let nextMonth = new Date(); + let nextMonth = Date.vnNew(); nextMonth.setMonth(nextMonth.getMonth() + 1); - let stowawayTicketId; beforeAll(async() => { browser = await getBrowser(); @@ -27,7 +26,7 @@ describe('Ticket create path', () => { await page.autocompleteSearch(selectors.createTicketView.client, 'Clark Kent'); await page.pickDate(selectors.createTicketView.deliveryDate, nextMonth); await page.autocompleteSearch(selectors.createTicketView.warehouse, 'Warehouse Two'); - await page.autocompleteSearch(selectors.createTicketView.agency, 'Silla247'); + await page.autocompleteSearch(selectors.createTicketView.agency, 'Gotham247'); await page.waitToClick(selectors.createTicketView.createButton); const message = await page.waitForSnackbar(); @@ -36,8 +35,6 @@ describe('Ticket create path', () => { it('should check the url is now the summary of the ticket', async() => { await page.waitForState('ticket.card.summary'); - stowawayTicketId = await page.waitToGetProperty(selectors.ticketSummary.descriptorTicketId, 'innerText'); - stowawayTicketId = stowawayTicketId.substring(1); }); it('should again open the new ticket form', async() => { @@ -50,7 +47,7 @@ describe('Ticket create path', () => { await page.autocompleteSearch(selectors.createTicketView.client, 'Clark Kent'); await page.pickDate(selectors.createTicketView.deliveryDate, nextMonth); await page.autocompleteSearch(selectors.createTicketView.warehouse, 'Warehouse One'); - await page.autocompleteSearch(selectors.createTicketView.agency, 'Silla247'); + await page.autocompleteSearch(selectors.createTicketView.agency, 'Gotham247'); await page.waitToClick(selectors.createTicketView.createButton); const message = await page.waitForSnackbar(); @@ -61,15 +58,6 @@ describe('Ticket create path', () => { await page.waitForState('ticket.card.summary'); }); - it('should make the previously created ticket the stowaway of the current ticket', async() => { - await page.waitToClick(selectors.ticketDescriptor.moreMenu); - await page.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway); - await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Data saved!'); - }); - it('should delete the current ticket', async() => { await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket); @@ -78,11 +66,4 @@ describe('Ticket create path', () => { expect(message.text).toContain('Ticket deleted. You can undo this action within the first hour'); }); - - it('should search for the stowaway ticket of the previously deleted ticket', async() => { - await page.accessToSearchResult(stowawayTicketId); - const result = await page.countElement(selectors.ticketDescriptor.shipButton); - - expect(result).toBe(0); - }); }); diff --git a/e2e/paths/05-ticket/16_summary.spec.js b/e2e/paths/05-ticket/16_summary.spec.js index 960998c7d..a6017e454 100644 --- a/e2e/paths/05-ticket/16_summary.spec.js +++ b/e2e/paths/05-ticket/16_summary.spec.js @@ -55,7 +55,7 @@ describe('Ticket Summary path', () => { let result = await page .waitToGetProperty(selectors.ticketSummary.firstSaleItemId, 'innerText'); - expect(result).toContain('000002'); + expect(result).toContain('2'); }); it(`should click on the first sale ID to make the item descriptor visible`, async() => { diff --git a/e2e/paths/05-ticket/17_log.spec.js b/e2e/paths/05-ticket/17_log.spec.js index 399eb647b..32829ee74 100644 --- a/e2e/paths/05-ticket/17_log.spec.js +++ b/e2e/paths/05-ticket/17_log.spec.js @@ -55,6 +55,6 @@ describe('Ticket log path', () => { const result = await page.waitToGetProperty(selectors.ticketLog.firstTD, 'innerText'); - expect(result.length).toBeGreaterThan('20'); + expect(result.length).toBeGreaterThan('15'); }); }); diff --git a/e2e/paths/05-ticket/20_moveExpedition.spec.js b/e2e/paths/05-ticket/20_moveExpedition.spec.js new file mode 100644 index 000000000..cf1c5ded3 --- /dev/null +++ b/e2e/paths/05-ticket/20_moveExpedition.spec.js @@ -0,0 +1,50 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Ticket expeditions', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('production', 'ticket'); + await page.accessToSearchResult('1'); + await page.accessToSection('ticket.card.expedition'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it(`should move one expedition to new ticket withoute route`, async() => { + await page.waitToClick(selectors.ticketExpedition.thirdSaleCheckbox); + await page.waitToClick(selectors.ticketExpedition.moveExpeditionButton); + await page.waitToClick(selectors.ticketExpedition.moreMenuWithoutRoute); + await page.waitToClick(selectors.ticketExpedition.saveButton); + await page.waitForState('ticket.card.summary'); + await page.accessToSection('ticket.card.expedition'); + + await page.waitForSelector(selectors.ticketExpedition.expeditionRow, {}); + const result = await page + .countElement(selectors.ticketExpedition.expeditionRow); + + expect(result).toEqual(1); + }); + + it(`should move one expedition to new ticket with route`, async() => { + await page.waitToClick(selectors.ticketExpedition.firstSaleCheckbox); + await page.waitToClick(selectors.ticketExpedition.moveExpeditionButton); + await page.waitToClick(selectors.ticketExpedition.moreMenuWithRoute); + await page.write(selectors.ticketExpedition.newRouteId, '1'); + await page.waitToClick(selectors.ticketExpedition.saveButton); + await page.waitForState('ticket.card.summary'); + await page.accessToSection('ticket.card.expedition'); + + await page.waitForSelector(selectors.ticketExpedition.expeditionRow, {}); + const result = await page + .countElement(selectors.ticketExpedition.expeditionRow); + + expect(result).toEqual(1); + }); +}); diff --git a/e2e/paths/05-ticket/21_future.spec.js b/e2e/paths/05-ticket/21_future.spec.js new file mode 100644 index 000000000..626056958 --- /dev/null +++ b/e2e/paths/05-ticket/21_future.spec.js @@ -0,0 +1,137 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Ticket Future path', () => { + let browser; + let page; + let httpRequest; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'ticket'); + await page.accessToSection('ticket.future'); + page.on('request', req => { + if (req.url().includes(`Tickets/getTicketsFuture`)) + httpRequest = req.url(); + }); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should show errors snackbar because of the required data', async() => { + await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); + await page.clearInput(selectors.ticketFuture.warehouseFk); + await page.waitToClick(selectors.ticketFuture.submit); + let message = await page.waitForSnackbar(); + + expect(message.text).toContain('warehouseFk is a required argument'); + + await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); + await page.clearInput(selectors.ticketFuture.futureDated); + await page.waitToClick(selectors.ticketFuture.submit); + message = await page.waitForSnackbar(); + + expect(message.text).toContain('futureDated is a required argument'); + + await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); + await page.clearInput(selectors.ticketFuture.originDated); + await page.waitToClick(selectors.ticketFuture.submit); + message = await page.waitForSnackbar(); + + expect(message.text).toContain('originDated is a required argument'); + }); + + it('should search with the required data', async() => { + await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); + await page.waitToClick(selectors.ticketFuture.submit); + + expect(httpRequest).toBeDefined(); + }); + + it('should search with the origin IPT', async() => { + await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); + + await page.autocompleteSearch(selectors.ticketFuture.ipt, 'H'); + await page.waitToClick(selectors.ticketFuture.submit); + + expect(httpRequest).toContain('ipt=H'); + }); + + it('should search with the destination IPT', async() => { + await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); + + await page.clearInput(selectors.ticketFuture.ipt); + + await page.autocompleteSearch(selectors.ticketFuture.futureIpt, 'H'); + await page.waitToClick(selectors.ticketFuture.submit); + + expect(httpRequest).toContain('futureIpt=H'); + }); + + it('should search with the origin grouped state', async() => { + await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); + + await page.clearInput(selectors.ticketFuture.futureIpt); + + await page.autocompleteSearch(selectors.ticketFuture.state, 'Free'); + await page.waitToClick(selectors.ticketFuture.submit); + + expect(httpRequest).toContain('state=FREE'); + }); + + it('should search with the destination grouped state', async() => { + await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); + + await page.clearInput(selectors.ticketFuture.state); + + await page.autocompleteSearch(selectors.ticketFuture.futureState, 'Free'); + await page.waitToClick(selectors.ticketFuture.submit); + + expect(httpRequest).toContain('futureState=FREE'); + + await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); + await page.clearInput(selectors.ticketFuture.futureState); + await page.waitToClick(selectors.ticketFuture.submit); + }); + + it('should search in smart-table with an ID Origin', async() => { + await page.waitToClick(selectors.ticketFuture.tableButtonSearch); + await page.write(selectors.ticketFuture.tableId, '1'); + await page.keyboard.press('Enter'); + + expect(httpRequest).toContain('id'); + await page.waitToClick(selectors.ticketFuture.tableButtonSearch); + }); + + it('should search in smart-table with an IPT Destination', async() => { + await page.waitToClick(selectors.ticketFuture.tableButtonSearch); + await page.autocompleteSearch(selectors.ticketFuture.tableFutureIpt, 'H'); + + expect(httpRequest).toContain('futureIpt'); + await page.waitToClick(selectors.ticketFuture.tableButtonSearch); + }); + + it('should search in smart-table with an ID Destination', async() => { + await page.waitToClick(selectors.ticketFuture.tableButtonSearch); + await page.write(selectors.ticketFuture.tableFutureId, '1'); + await page.keyboard.press('Enter'); + + expect(httpRequest).toContain('futureId'); + await page.waitToClick(selectors.ticketFuture.tableButtonSearch); + await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); + await page.waitToClick(selectors.ticketFuture.submit); + }); + + it('should check the three last tickets and move to the future', async() => { + await page.waitToClick(selectors.ticketFuture.multiCheck); + await page.waitToClick(selectors.ticketFuture.firstCheck); + await page.waitToClick(selectors.ticketFuture.moveButton); + await page.waitToClick(selectors.ticketFuture.acceptButton); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Tickets moved successfully!'); + }); +}); diff --git a/e2e/paths/05-ticket/22_advance.spec.js b/e2e/paths/05-ticket/22_advance.spec.js new file mode 100644 index 000000000..15f9dd5bb --- /dev/null +++ b/e2e/paths/05-ticket/22_advance.spec.js @@ -0,0 +1,109 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Ticket Advance path', () => { + let browser; + let page; + let httpRequest; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'ticket'); + await page.accessToSection('ticket.advance'); + page.on('request', req => { + if (req.url().includes(`Tickets/getTicketsAdvance`)) + httpRequest = req.url(); + }); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should show errors snackbar because of the required data', async() => { + await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); + await page.clearInput(selectors.ticketAdvance.warehouseFk); + + await page.waitToClick(selectors.ticketAdvance.submit); + let message = await page.waitForSnackbar(); + + expect(message.text).toContain('warehouseFk is a required argument'); + + await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); + await page.clearInput(selectors.ticketAdvance.dateToAdvance); + await page.waitToClick(selectors.ticketAdvance.submit); + message = await page.waitForSnackbar(); + + expect(message.text).toContain('dateToAdvance is a required argument'); + + await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); + await page.clearInput(selectors.ticketAdvance.dateFuture); + await page.waitToClick(selectors.ticketAdvance.submit); + message = await page.waitForSnackbar(); + + expect(message.text).toContain('dateFuture is a required argument'); + }); + + it('should search with the required data', async() => { + await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); + await page.waitToClick(selectors.ticketAdvance.submit); + + expect(httpRequest).toBeDefined(); + }); + + it('should search with the origin IPT', async() => { + await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); + await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'H'); + await page.waitToClick(selectors.ticketAdvance.submit); + + expect(httpRequest).toContain('futureIpt=H'); + + await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); + await page.clearInput(selectors.ticketAdvance.futureIpt); + await page.waitToClick(selectors.ticketAdvance.submit); + }); + + it('should search with the destination IPT', async() => { + await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); + await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'H'); + await page.waitToClick(selectors.ticketAdvance.submit); + + expect(httpRequest).toContain('ipt=H'); + + await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); + await page.clearInput(selectors.ticketAdvance.ipt); + await page.waitToClick(selectors.ticketAdvance.submit); + }); + + it('should search in smart-table with an IPT Origin', async() => { + await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); + await page.autocompleteSearch(selectors.ticketAdvance.tableFutureIpt, 'V'); + + expect(httpRequest).toContain('futureIpt'); + + await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); + await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); + await page.waitToClick(selectors.ticketAdvance.submit); + }); + + it('should search in smart-table with an IPT Destination', async() => { + await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); + await page.autocompleteSearch(selectors.ticketAdvance.tableIpt, 'V'); + + expect(httpRequest).toContain('ipt'); + + await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); + await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); + await page.waitToClick(selectors.ticketAdvance.submit); + }); + + it('should check the first ticket and move to the present', async() => { + await page.waitToClick(selectors.ticketAdvance.firstCheck); + await page.waitToClick(selectors.ticketAdvance.moveButton); + await page.waitToClick(selectors.ticketAdvance.acceptButton); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Tickets moved successfully!'); + }); +}); diff --git a/e2e/paths/06-claim/01_basic_data.spec.js b/e2e/paths/06-claim/01_basic_data.spec.js index 2e2286939..0a08cad9f 100644 --- a/e2e/paths/06-claim/01_basic_data.spec.js +++ b/e2e/paths/06-claim/01_basic_data.spec.js @@ -22,8 +22,6 @@ describe('Claim edit basic data path', () => { it(`should edit claim state and observation fields`, async() => { await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Gestionado'); - await page.clearTextarea(selectors.claimBasicData.observation); - await page.write(selectors.claimBasicData.observation, 'edited observation'); await page.clearInput(selectors.claimBasicData.packages); await page.write(selectors.claimBasicData.packages, '2'); await page.waitToClick(selectors.claimBasicData.saveButton); @@ -59,13 +57,6 @@ describe('Claim edit basic data path', () => { expect(hasToPickUpCheckbox).toBe('checked'); }); - it('should confirm the claim observation was edited', async() => { - const result = await page - .waitToGetProperty(selectors.claimBasicData.observation, 'value'); - - expect(result).toEqual('edited observation'); - }); - it('should confirm the claim packages was edited', async() => { const result = await page .waitToGetProperty(selectors.claimBasicData.packages, 'value'); @@ -75,8 +66,6 @@ describe('Claim edit basic data path', () => { it(`should edit the claim to leave it untainted`, async() => { await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Pendiente'); - await page.clearTextarea(selectors.claimBasicData.observation); - await page.write(selectors.claimBasicData.observation, 'Observation one'); await page.clearInput(selectors.claimBasicData.packages); await page.write(selectors.claimBasicData.packages, '0'); await page.waitToClick(selectors.claimBasicData.saveButton); diff --git a/e2e/paths/06-claim/05_summary.spec.js b/e2e/paths/06-claim/05_summary.spec.js index 589b3b6cb..758dc2ee3 100644 --- a/e2e/paths/06-claim/05_summary.spec.js +++ b/e2e/paths/06-claim/05_summary.spec.js @@ -37,7 +37,7 @@ describe('Claim summary path', () => { }); it('should display the observation', async() => { - const result = await page.waitToGetProperty(selectors.claimSummary.observation, 'value'); + const result = await page.waitToGetProperty(selectors.claimSummary.observation, 'innerText'); expect(result).toContain('Wisi forensibus mnesarchum in cum. Per id impetus abhorreant'); }); @@ -45,7 +45,7 @@ describe('Claim summary path', () => { it('should display the claimed line(s)', async() => { const result = await page.waitToGetProperty(selectors.claimSummary.firstSaleItemId, 'innerText'); - expect(result).toContain('000002'); + expect(result).toContain('2'); }); it(`should click on the first sale ID making the item descriptor visible`, async() => { diff --git a/e2e/paths/06-claim/07_note.spec.js b/e2e/paths/06-claim/07_note.spec.js new file mode 100644 index 000000000..830f77cbe --- /dev/null +++ b/e2e/paths/06-claim/07_note.spec.js @@ -0,0 +1,46 @@ +import selectors from '../../helpers/selectors'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Claim Add note path', () => { + let browser; + let page; + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('salesPerson', 'claim'); + await page.accessToSearchResult('2'); + await page.accessToSection('claim.card.note.index'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it(`should reach the claim note index`, async() => { + await page.waitForState('claim.card.note.index'); + }); + + it(`should click on the add new note button`, async() => { + await page.waitToClick(selectors.claimNote.addNoteFloatButton); + await page.waitForState('claim.card.note.create'); + }); + + it(`should create a new note`, async() => { + await page.waitForSelector(selectors.claimNote.note); + await page.type(`${selectors.claimNote.note} textarea`, 'The delivery was unsuccessful'); + await page.waitToClick(selectors.claimNote.saveButton); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); + + it(`should redirect back to the claim notes page`, async() => { + await page.waitForState('claim.card.note.index'); + }); + + it('should confirm the note was created', async() => { + const result = await page.waitToGetProperty(selectors.claimNote.firstNoteText, 'innerText'); + + expect(result).toEqual('The delivery was unsuccessful'); + }); +}); diff --git a/e2e/paths/07-order/01_summary.spec.js b/e2e/paths/07-order/01_summary.spec.js index 9b9e37998..922d5eeee 100644 --- a/e2e/paths/07-order/01_summary.spec.js +++ b/e2e/paths/07-order/01_summary.spec.js @@ -34,7 +34,7 @@ describe('Order summary path', () => { it('should check the summary contains the order consignee', async() => { const result = await page.waitToGetProperty(selectors.orderSummary.consignee, 'innerText'); - expect(result).toEqual('address 26 - Silla (Province one)'); + expect(result).toEqual('address 26 - Gotham (Province one)'); }); it('should check the summary contains the order subtotal', async() => { diff --git a/e2e/paths/08-route/01_summary.spec.js b/e2e/paths/08-route/01_summary.spec.js index 02cc71f2f..44f66ba2d 100644 --- a/e2e/paths/08-route/01_summary.spec.js +++ b/e2e/paths/08-route/01_summary.spec.js @@ -9,7 +9,8 @@ describe('Route summary path', () => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('employee', 'route'); - await page.waitToClick('vn-route-index vn-tbody > a:nth-child(1)'); + await page.waitToClick(selectors.routeIndex.previewButton); + await page.waitToClick(selectors.routeSummary.goToRouteSummaryButton); }); afterAll(async() => { @@ -34,6 +35,8 @@ describe('Route summary path', () => { }); it('should click on the first ticket ID making the descriptor popover visible', async() => { + await page.waitForState('route.card.summary'); + await page.waitForTimeout(250); await page.waitToClick(selectors.routeSummary.firstTicketID); await page.waitForSelector(selectors.routeSummary.firstTicketDescriptor); const visible = await page.isVisible(selectors.routeSummary.firstTicketDescriptor); diff --git a/e2e/paths/08-route/02_basic_data.spec.js b/e2e/paths/08-route/02_basic_data.spec.js index b1440f2d1..ff8361499 100644 --- a/e2e/paths/08-route/02_basic_data.spec.js +++ b/e2e/paths/08-route/02_basic_data.spec.js @@ -18,7 +18,7 @@ describe('Route basic Data path', () => { }); it('should edit the route basic data', async() => { - const nextMonth = new Date(); + const nextMonth = Date.vnNew(); nextMonth.setMonth(nextMonth.getMonth() + 1); await page.autocompleteSearch(selectors.routeBasicData.worker, 'adminBossNick'); diff --git a/e2e/paths/09-invoice-in/03_basic_data.spec.js b/e2e/paths/09-invoice-in/03_basic_data.spec.js index 0c3f914e4..778b5949c 100644 --- a/e2e/paths/09-invoice-in/03_basic_data.spec.js +++ b/e2e/paths/09-invoice-in/03_basic_data.spec.js @@ -4,6 +4,7 @@ import getBrowser from '../../helpers/puppeteer'; describe('InvoiceIn basic data path', () => { let browser; let page; + let newDms; beforeAll(async() => { browser = await getBrowser(); @@ -18,12 +19,14 @@ describe('InvoiceIn basic data path', () => { }); it(`should edit the invoiceIn basic data`, async() => { - const now = new Date(); + const now = Date.vnNew(); await page.pickDate(selectors.invoiceInBasicData.issued, now); await page.pickDate(selectors.invoiceInBasicData.operated, now); await page.autocompleteSearch(selectors.invoiceInBasicData.supplier, 'Verdnatura'); await page.clearInput(selectors.invoiceInBasicData.supplierRef); await page.write(selectors.invoiceInBasicData.supplierRef, '9999'); + await page.clearInput(selectors.invoiceInBasicData.dms); + await page.write(selectors.invoiceInBasicData.dms, '2'); await page.pickDate(selectors.invoiceInBasicData.bookEntried, now); await page.pickDate(selectors.invoiceInBasicData.booked, now); await page.autocompleteSearch(selectors.invoiceInBasicData.currency, 'USD'); @@ -61,4 +64,141 @@ describe('InvoiceIn basic data path', () => { expect(result).toEqual('ORN'); }); + + it(`should confirm the invoiceIn dms was edited`, async() => { + const result = await page + .waitToGetProperty(selectors.invoiceInBasicData.dms, 'value'); + + expect(result).toEqual('2'); + }); + + it(`should create a new invoiceIn dms and save the changes`, async() => { + await page.clearInput(selectors.invoiceInBasicData.dms); + await page.waitToClick(selectors.invoiceInBasicData.create); + + await page.clearInput(selectors.invoiceInBasicData.reference); + await page.write(selectors.invoiceInBasicData.reference, 'New Dms'); + + await page.waitToClick(selectors.invoiceInBasicData.confirm); + let message = await page.waitForSnackbar(); + + expect(message.text).toContain('The company can\'t be empty'); + + await page.clearInput(selectors.invoiceInBasicData.companyId); + await page.autocompleteSearch(selectors.invoiceInBasicData.companyId, 'VNL'); + + await page.waitToClick(selectors.invoiceInBasicData.confirm); + message = await page.waitForSnackbar(); + + expect(message.text).toContain('The warehouse can\'t be empty'); + + await page.clearInput(selectors.invoiceInBasicData.warehouseId); + await page.autocompleteSearch(selectors.invoiceInBasicData.warehouseId, 'Warehouse One'); + + await page.waitToClick(selectors.invoiceInBasicData.confirm); + message = await page.waitForSnackbar(); + + expect(message.text).toContain('The DMS Type can\'t be empty'); + + await page.clearInput(selectors.invoiceInBasicData.dmsTypeId); + await page.autocompleteSearch(selectors.invoiceInBasicData.dmsTypeId, 'Ticket'); + + await page.waitToClick(selectors.invoiceInBasicData.confirm); + message = await page.waitForSnackbar(); + + expect(message.text).toContain('The description can\'t be empty'); + + await page.waitToClick(selectors.invoiceInBasicData.description); + await page.write(selectors.invoiceInBasicData.description, 'Dms without edition.'); + + await page.waitToClick(selectors.invoiceInBasicData.confirm); + message = await page.waitForSnackbar(); + + expect(message.text).toContain('The files can\'t be empty'); + + let currentDir = process.cwd(); + let filePath = `${currentDir}/e2e/assets/thermograph.jpeg`; + + const [fileChooser] = await Promise.all([ + page.waitForFileChooser(), + page.waitToClick(selectors.invoiceInBasicData.inputFile) + ]); + await fileChooser.accept([filePath]); + + await page.waitToClick(selectors.invoiceInBasicData.confirm); + message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + + newDms = await page + .waitToGetProperty(selectors.invoiceInBasicData.dms, 'value'); + }); + + it(`should confirm the invoiceIn was edited with the new dms`, async() => { + await page.reloadSection('invoiceIn.card.basicData'); + const result = await page + .waitToGetProperty(selectors.invoiceInBasicData.dms, 'value'); + + expect(result).toEqual(newDms); + }); + + it(`should edit the invoiceIn`, async() => { + await page.waitToClick(selectors.invoiceInBasicData.edit); + + await page.clearInput(selectors.invoiceInBasicData.reference); + await page.write(selectors.invoiceInBasicData.reference, 'Dms Edited'); + await page.clearInput(selectors.invoiceInBasicData.companyId); + await page.autocompleteSearch(selectors.invoiceInBasicData.companyId, 'CCs'); + await page.clearInput(selectors.invoiceInBasicData.warehouseId); + await page.autocompleteSearch(selectors.invoiceInBasicData.warehouseId, 'Algemesi'); + await page.clearInput(selectors.invoiceInBasicData.dmsTypeId); + await page.autocompleteSearch(selectors.invoiceInBasicData.dmsTypeId, 'Basura'); + await page.waitToClick(selectors.invoiceInBasicData.description); + await page.write(selectors.invoiceInBasicData.description, ' Nevermind, now is edited.'); + + await page.waitToClick(selectors.invoiceInBasicData.confirm); + let message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); + + it(`should confirm the new dms has been edited`, async() => { + await page.reloadSection('invoiceIn.card.basicData'); + await page.waitToClick(selectors.invoiceInBasicData.edit); + + const reference = await page + .waitToGetProperty(selectors.invoiceInBasicData.reference, 'value'); + const companyId = await page + .waitToGetProperty(selectors.invoiceInBasicData.companyId, 'value'); + const warehouseId = await page + .waitToGetProperty(selectors.invoiceInBasicData.warehouseId, 'value'); + const dmsTypeId = await page + .waitToGetProperty(selectors.invoiceInBasicData.dmsTypeId, 'value'); + const description = await page + .waitToGetProperty(selectors.invoiceInBasicData.description, 'value'); + + expect(reference).toEqual('Dms Edited'); + expect(companyId).toEqual('CCs'); + expect(warehouseId).toEqual('Algemesi'); + expect(dmsTypeId).toEqual('Basura'); + expect(description).toEqual('Dms without edition. Nevermind, now is edited.'); + + await page.waitToClick(selectors.invoiceInBasicData.confirm); + }); + + it(`should disable edit and download if dms doesn't exists, and set back the original dms`, async() => { + await page.clearInput(selectors.invoiceInBasicData.dms); + await page.write(selectors.invoiceInBasicData.dms, '9999'); + + await page.waitForSelector(`${selectors.invoiceInBasicData.download}.disabled`); + await page.waitForSelector(`${selectors.invoiceInBasicData.edit}.disabled`); + + await page.clearInput(selectors.invoiceInBasicData.dms); + await page.write(selectors.invoiceInBasicData.dms, '1'); + + await page.waitToClick(selectors.invoiceInBasicData.save); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); }); diff --git a/e2e/paths/09-invoice-in/05_serial.spec.js b/e2e/paths/09-invoice-in/05_serial.spec.js new file mode 100644 index 000000000..3aa94f48c --- /dev/null +++ b/e2e/paths/09-invoice-in/05_serial.spec.js @@ -0,0 +1,48 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('InvoiceIn serial path', () => { + let browser; + let page; + let httpRequest; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('administrative', 'invoiceIn'); + await page.accessToSection('invoiceIn.serial'); + page.on('request', req => { + if (req.url().includes(`InvoiceIns/getSerial`)) + httpRequest = req.url(); + }); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should check that passes the correct params to back', async() => { + await page.overwrite(selectors.invoiceInSerial.daysAgo, '30'); + await page.keyboard.press('Enter'); + + expect(httpRequest).toContain('daysAgo=30'); + + await page.overwrite(selectors.invoiceInSerial.serial, 'R'); + await page.keyboard.press('Enter'); + + expect(httpRequest).toContain('serial=R'); + await page.click(selectors.invoiceInSerial.chip); + }); + + it('should go to index and check if the search-panel has the correct params', async() => { + await page.click(selectors.invoiceInSerial.goToIndex); + const params = await page.$$(selectors.invoiceInIndex.topbarSearchParams); + const serial = await params[0].getProperty('title'); + const isBooked = await params[1].getProperty('title'); + const from = await params[2].getProperty('title'); + + expect(await serial.jsonValue()).toContain('serial'); + expect(await isBooked.jsonValue()).toContain('not isBooked'); + expect(await from.jsonValue()).toContain('from'); + }); +}); diff --git a/e2e/paths/09-invoice-out/02_descriptor.spec.js b/e2e/paths/09-invoice-out/02_descriptor.spec.js index 8d403e083..5169345bc 100644 --- a/e2e/paths/09-invoice-out/02_descriptor.spec.js +++ b/e2e/paths/09-invoice-out/02_descriptor.spec.js @@ -100,7 +100,7 @@ describe('InvoiceOut descriptor path', () => { }); it(`should check the invoiceOut booked in the summary data`, async() => { - let today = new Date(); + let today = Date.vnNew(); let day = today.getDate(); if (day < 10) day = `0${day}`; diff --git a/e2e/paths/09-invoice-out/03_manualInvoice.spec.js b/e2e/paths/09-invoice-out/03_manualInvoice.spec.js index 84f0cc8b3..abb9ca7e7 100644 --- a/e2e/paths/09-invoice-out/03_manualInvoice.spec.js +++ b/e2e/paths/09-invoice-out/03_manualInvoice.spec.js @@ -17,12 +17,11 @@ describe('InvoiceOut manual invoice path', () => { it('should open the manual invoice form', async() => { await page.waitToClick(selectors.invoiceOutIndex.createInvoice); - await page.waitToClick(selectors.invoiceOutIndex.createManualInvoice); await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm); }); it('should create an invoice from a ticket', async() => { - await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTicket, '7'); + await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTicket, '15'); await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional'); await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national'); await page.waitToClick(selectors.invoiceOutIndex.saveInvoice); @@ -45,7 +44,6 @@ describe('InvoiceOut manual invoice path', () => { it('should now open the manual invoice form', async() => { await page.waitToClick(selectors.invoiceOutIndex.createInvoice); - await page.waitToClick(selectors.invoiceOutIndex.createManualInvoice); await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm); }); diff --git a/e2e/paths/09-invoice-out/04_globalInvoice.spec.js b/e2e/paths/09-invoice-out/04_globalInvoice.spec.js index b62c889db..23aa3593c 100644 --- a/e2e/paths/09-invoice-out/04_globalInvoice.spec.js +++ b/e2e/paths/09-invoice-out/04_globalInvoice.spec.js @@ -17,35 +17,27 @@ describe('InvoiceOut global invoice path', () => { await browser.close(); }); - let invoicesBefore; + let invoicesBeforeOneClient; + let invoicesBeforeAllClients; + let now = Date.vnNew(); it('should count the amount of invoices listed before globla invoces are made', async() => { - invoicesBefore = await page.countElement(selectors.invoiceOutIndex.searchResult); + invoicesBeforeOneClient = await page.countElement(selectors.invoiceOutIndex.searchResult); - expect(invoicesBefore).toBeGreaterThanOrEqual(4); + expect(invoicesBeforeOneClient).toBeGreaterThanOrEqual(4); }); it('should open the global invoice form', async() => { - await page.waitToClick(selectors.invoiceOutIndex.createInvoice); - await page.waitToClick(selectors.invoiceOutIndex.createGlobalInvoice); - await page.waitForSelector(selectors.invoiceOutIndex.globalInvoiceForm); + await page.accessToSection('invoiceOut.global-invoicing'); }); it('should create a global invoice for charles xavier today', async() => { - await page.pickDate(selectors.invoiceOutIndex.globalInvoiceDate); - await page.autocompleteSearch(selectors.invoiceOutIndex.globalInvoiceFromClient, 'Petter Parker'); - await page.autocompleteSearch(selectors.invoiceOutIndex.globalInvoiceToClient, 'Petter Parker'); - await page.waitToClick(selectors.invoiceOutIndex.saveInvoice); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Data saved!'); - }); - - it('should count the amount of invoices listed after globla invocing', async() => { - await page.waitToClick('[icon="search"]'); - await page.waitForTimeout(1000); // index search needs time to return results - const currentInvoices = await page.countElement(selectors.invoiceOutIndex.searchResult); - - expect(currentInvoices).toBeGreaterThan(invoicesBefore); + await page.waitToClick(selectors.invoiceOutGlobalInvoicing.oneClient); + await page.autocompleteSearch(selectors.invoiceOutGlobalInvoicing.clientId, '1108'); + await page.pickDate(selectors.invoiceOutGlobalInvoicing.invoiceDate, now); + await page.pickDate(selectors.invoiceOutGlobalInvoicing.maxShipped, now); + await page.autocompleteSearch(selectors.invoiceOutGlobalInvoicing.printer, '1'); + await page.waitToClick(selectors.invoiceOutGlobalInvoicing.makeInvoice); + await page.waitForTimeout(1000); }); }); diff --git a/e2e/paths/10-travel/01_create.spec.js b/e2e/paths/10-travel/01_create.spec.js index e5d812ebd..15da42d5d 100644 --- a/e2e/paths/10-travel/01_create.spec.js +++ b/e2e/paths/10-travel/01_create.spec.js @@ -4,7 +4,7 @@ import getBrowser from '../../helpers/puppeteer'; describe('Travel create path', () => { let browser; let page; - const date = new Date(); + const date = Date.vnNew(); const day = 15; date.setDate(day); diff --git a/e2e/paths/10-travel/02_basic_data_and_log.spec.js b/e2e/paths/10-travel/02_basic_data_and_log.spec.js index a231a70b2..5abf8a65e 100644 --- a/e2e/paths/10-travel/02_basic_data_and_log.spec.js +++ b/e2e/paths/10-travel/02_basic_data_and_log.spec.js @@ -9,7 +9,8 @@ describe('Travel basic data path', () => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('buyer', 'travel'); - await page.accessToSearchResult('3'); + await page.write(selectors.travelIndex.generalSearchFilter, '3'); + await page.keyboard.press('Enter'); await page.accessToSection('travel.card.basicData'); }); @@ -22,7 +23,7 @@ describe('Travel basic data path', () => { }); it('should set a wrong delivery date then receive an error on submit', async() => { - const lastMonth = new Date(); + const lastMonth = Date.vnNew(); lastMonth.setMonth(lastMonth.getMonth() - 1); await page.pickDate(selectors.travelBasicData.deliveryDate, lastMonth); @@ -89,11 +90,13 @@ describe('Travel basic data path', () => { }); it('should navigate to the travel logs', async() => { + pending('https://redmine.verdnatura.es/issues/5455'); await page.accessToSection('travel.card.log'); await page.waitForState('travel.card.log'); }); it('should check the 1st log contains details from the changes made', async() => { + pending('https://redmine.verdnatura.es/issues/5455'); const result = await page.waitToGetProperty(selectors.travelLog.firstLogFirstTD, 'innerText'); expect(result).toContain('new reference!'); diff --git a/e2e/paths/10-travel/03_descriptor.spec.js b/e2e/paths/10-travel/03_descriptor.spec.js index f459ef043..3752400c6 100644 --- a/e2e/paths/10-travel/03_descriptor.spec.js +++ b/e2e/paths/10-travel/03_descriptor.spec.js @@ -9,7 +9,8 @@ describe('Travel descriptor path', () => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('buyer', 'travel'); - await page.accessToSearchResult('1'); + await page.write(selectors.travelIndex.generalSearchFilter, '1'); + await page.keyboard.press('Enter'); await page.waitForState('travel.card.summary'); }); @@ -81,7 +82,8 @@ describe('Travel descriptor path', () => { await page.waitToClick('.cancel'); await page.waitToClick(selectors.globalItems.homeButton); await page.selectModule('travel'); - await page.accessToSearchResult('3'); + await page.write(selectors.travelIndex.generalSearchFilter, '3'); + await page.keyboard.press('Enter'); await page.waitForState('travel.card.summary'); const state = await page.getState(); @@ -113,17 +115,8 @@ describe('Travel descriptor path', () => { expect(message.text).toContain('Data saved!'); }); - it('should atempt to clone the travel and its entries using the descriptor menu but receive an error', async() => { - await page.waitToClick(selectors.travelDescriptor.dotMenu); - await page.waitToClick(selectors.travelDescriptor.dotMenuCloneWithEntries); - await page.waitToClick(selectors.travelDescriptor.acceptClonation); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Unable to clone this travel'); - }); - it('should update the landed date to a future date to enable cloneWithEntries', async() => { - const nextMonth = new Date(); + const nextMonth = Date.vnNew(); nextMonth.setMonth(nextMonth.getMonth() + 1); await page.pickDate(selectors.travelBasicData.deliveryDate, nextMonth); await page.waitToClick(selectors.travelBasicData.save); diff --git a/e2e/paths/10-travel/04_extra_community.spec.js b/e2e/paths/10-travel/04_extra_community.spec.js index e4a859192..c5975c958 100644 --- a/e2e/paths/10-travel/04_extra_community.spec.js +++ b/e2e/paths/10-travel/04_extra_community.spec.js @@ -22,6 +22,10 @@ describe('Travel extra community path', () => { await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelReference, 'edited reference'); await page.waitForSpinnerLoad(); await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelLockedKg, '1500'); + + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); }); it('should reload the index and confirm the reference and locked kg were edited', async() => { diff --git a/e2e/paths/10-travel/05_thermograph.spec.js b/e2e/paths/10-travel/05_thermograph.spec.js index a99dc8352..c9709f2f5 100644 --- a/e2e/paths/10-travel/05_thermograph.spec.js +++ b/e2e/paths/10-travel/05_thermograph.spec.js @@ -10,7 +10,8 @@ describe('Travel thermograph path', () => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('buyer', 'travel'); - await page.accessToSearchResult('3'); + await page.write(selectors.travelIndex.generalSearchFilter, '3'); + await page.keyboard.press('Enter'); await page.accessToSection('travel.card.thermograph.index'); }); diff --git a/e2e/paths/10-travel/06_search_panel.spec.js b/e2e/paths/10-travel/06_search_panel.spec.js new file mode 100644 index 000000000..420ceaf48 --- /dev/null +++ b/e2e/paths/10-travel/06_search_panel.spec.js @@ -0,0 +1,62 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Travel search panel path', () => { + let browser; + let page; + let httpRequest; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('buyer', 'travel'); + page.on('request', req => { + if (req.url().includes(`Travels/filter`)) + httpRequest = req.url(); + }); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should filter using all the fields', async() => { + await page.click(selectors.travelIndex.chip); + await page.write(selectors.travelIndex.generalSearchFilter, 'travel'); + await page.keyboard.press('Enter'); + + expect(httpRequest).toContain('search=travel'); + + await page.click(selectors.travelIndex.chip); + await page.autocompleteSearch(selectors.travelIndex.agencyFilter, 'Entanglement'); + + expect(httpRequest).toContain('agencyModeFk'); + + await page.click(selectors.travelIndex.chip); + await page.autocompleteSearch(selectors.travelIndex.warehouseOutFilter, 'Warehouse One'); + + expect(httpRequest).toContain('warehouseOutFk'); + + await page.click(selectors.travelIndex.chip); + await page.autocompleteSearch(selectors.travelIndex.warehouseInFilter, 'Warehouse Two'); + + expect(httpRequest).toContain('warehouseInFk'); + + await page.click(selectors.travelIndex.chip); + await page.overwrite(selectors.travelIndex.scopeDaysFilter, '15'); + await page.keyboard.press('Enter'); + + expect(httpRequest).toContain('scopeDays=15'); + + await page.click(selectors.travelIndex.chip); + await page.autocompleteSearch(selectors.travelIndex.continentFilter, 'Asia'); + + expect(httpRequest).toContain('continent'); + + await page.click(selectors.travelIndex.chip); + await page.write(selectors.travelIndex.totalEntriesFilter, '1'); + await page.keyboard.press('Enter'); + + expect(httpRequest).toContain('totalEntries=1'); + }); +}); diff --git a/e2e/paths/11-zone/02_descriptor.spec.js b/e2e/paths/11-zone/02_descriptor.spec.js index 1de84d601..12a1c8f68 100644 --- a/e2e/paths/11-zone/02_descriptor.spec.js +++ b/e2e/paths/11-zone/02_descriptor.spec.js @@ -37,6 +37,6 @@ describe('Zone descriptor path', () => { await page.accessToSection('ticket.card.log'); const lastChanges = await page.waitToGetProperty(selectors.ticketLog.changes, 'innerText'); - expect(lastChanges).toContain('Arreglar'); + expect(lastChanges).toContain('1'); }); }); diff --git a/e2e/paths/12-entry/02_descriptor.spec.js b/e2e/paths/12-entry/02_descriptor.spec.js index 699d00517..997a6065c 100644 --- a/e2e/paths/12-entry/02_descriptor.spec.js +++ b/e2e/paths/12-entry/02_descriptor.spec.js @@ -29,7 +29,7 @@ describe('Entry descriptor path', () => { it('should click the travels button to be redirected to the travels index filtered by the current agency', async() => { await page.waitToClick(selectors.entryDescriptor.travelsQuicklink); await page.expectURL('/travel/index'); - await page.expectURL('agencyFk'); + await page.expectURL('agencyModeFk'); }); it('should go back to the entry summary', async() => { diff --git a/e2e/paths/12-entry/03_latestBuys.spec.js b/e2e/paths/12-entry/03_latestBuys.spec.js index 553d41b95..a73e12659 100644 --- a/e2e/paths/12-entry/03_latestBuys.spec.js +++ b/e2e/paths/12-entry/03_latestBuys.spec.js @@ -4,10 +4,15 @@ import getBrowser from '../../helpers/puppeteer'; describe('Entry lastest buys path', () => { let browser; let page; + const httpRequests = []; beforeAll(async() => { browser = await getBrowser(); page = browser.page; + page.on('request', req => { + if (req.url().includes(`Buys/latestBuysFilter`)) + httpRequests.push(req.url()); + }); await page.loginAndModule('buyer', 'entry'); }); @@ -20,6 +25,87 @@ describe('Entry lastest buys path', () => { await page.waitForSelector(selectors.entryLatestBuys.editBuysButton, {visible: false}); }); + it('should filter by name', async() => { + await page.write(selectors.entryLatestBuys.generalSearchInput, 'Melee'); + await page.keyboard.press('Enter'); + await page.waitToClick(selectors.entryLatestBuys.chip); + + expect(httpRequests.find(req => req.includes(('search=Melee')))).toBeDefined(); + }); + + it('should filter by reign and type', async() => { + await page.click(selectors.entryLatestBuys.firstReignIcon); + await page.autocompleteSearch(selectors.entryLatestBuys.typeInput, 'Alstroemeria'); + await page.click(selectors.entryLatestBuys.chip); + + expect(httpRequests.find(req => req.includes(('categoryFk')))).toBeDefined(); + expect(httpRequests.find(req => req.includes(('typeFk')))).toBeDefined(); + }); + + it('should filter by from date', async() => { + await page.pickDate(selectors.entryLatestBuys.fromInput, new Date()); + await page.waitToClick(selectors.entryLatestBuys.chip); + + expect(httpRequests.find(req => req.includes(('from')))).toBeDefined(); + }); + + it('should filter by to date', async() => { + await page.pickDate(selectors.entryLatestBuys.toInput, new Date()); + await page.waitToClick(selectors.entryLatestBuys.chip); + + expect(httpRequests.find(req => req.includes(('to')))).toBeDefined(); + }); + + it('should filter by sales person', async() => { + await page.autocompleteSearch(selectors.entryLatestBuys.salesPersonInput, 'buyerNick'); + await page.waitToClick(selectors.entryLatestBuys.chip); + + expect(httpRequests.find(req => req.includes(('salesPersonFk')))).toBeDefined(); + }); + + it('should filter by supplier', async() => { + await page.autocompleteSearch(selectors.entryLatestBuys.supplierInput, 'Farmer King'); + await page.waitToClick(selectors.entryLatestBuys.chip); + + expect(httpRequests.find(req => req.includes(('supplierFk')))).toBeDefined(); + }); + + it('should filter by active', async() => { + await page.waitToClick(selectors.entryLatestBuys.activeCheck); + await page.waitToClick(selectors.entryLatestBuys.activeCheck); + await page.waitToClick(selectors.entryLatestBuys.chip); + + expect(httpRequests.find(req => req.includes(('active=true')))).toBeDefined(); + expect(httpRequests.find(req => req.includes(('active=false')))).toBeDefined(); + }); + + it('should filter by visible', async() => { + await page.waitToClick(selectors.entryLatestBuys.visibleCheck); + await page.waitToClick(selectors.entryLatestBuys.visibleCheck); + await page.waitToClick(selectors.entryLatestBuys.chip); + + expect(httpRequests.find(req => req.includes(('visible=true')))).toBeDefined(); + expect(httpRequests.find(req => req.includes(('visible=false')))).toBeDefined(); + }); + + it('should filter by floramondo', async() => { + await page.waitToClick(selectors.entryLatestBuys.floramondoCheck); + await page.waitToClick(selectors.entryLatestBuys.floramondoCheck); + await page.waitToClick(selectors.entryLatestBuys.chip); + + expect(httpRequests.find(req => req.includes(('floramondo=true')))).toBeDefined(); + expect(httpRequests.find(req => req.includes(('floramondo=false')))).toBeDefined(); + }); + + it('should filter by tag Color', async() => { + await page.waitToClick(selectors.entryLatestBuys.addTagButton); + await page.autocompleteSearch(selectors.entryLatestBuys.itemTagInput, 'Color'); + await page.autocompleteSearch(selectors.entryLatestBuys.itemTagValueInput, 'Brown'); + await page.waitToClick(selectors.entryLatestBuys.chip); + + expect(httpRequests.find(req => req.includes(('tags')))).toBeDefined(); + }); + it('should select all lines but one and then check the edit buys button appears', async() => { await page.waitToClick(selectors.entryLatestBuys.allBuysCheckBox); await page.waitToClick(selectors.entryLatestBuys.secondBuyCheckBox); diff --git a/e2e/paths/12-entry/05_basicData.spec.js b/e2e/paths/12-entry/05_basicData.spec.js index c1aa14019..3b5f40c35 100644 --- a/e2e/paths/12-entry/05_basicData.spec.js +++ b/e2e/paths/12-entry/05_basicData.spec.js @@ -19,6 +19,7 @@ describe('Entry basic data path', () => { it('should edit the basic data', async() => { await page.write(selectors.entryBasicData.reference, 'new movement 8'); + await page.write(selectors.entryBasicData.invoiceNumber, 'new movement 8'); await page.write(selectors.entryBasicData.notes, 'new notes'); await page.write(selectors.entryBasicData.observations, ' edited'); await page.autocompleteSearch(selectors.entryBasicData.supplier, 'Plants nick'); @@ -45,6 +46,13 @@ describe('Entry basic data path', () => { expect(result).toEqual('new movement 8'); }); + it('should confirm the invoiceNumber was edited', async() => { + await page.reloadSection('entry.card.basicData'); + const result = await page.waitToGetProperty(selectors.entryBasicData.invoiceNumber, 'value'); + + expect(result).toEqual('new movement 8'); + }); + it('should confirm the note was edited', async() => { const result = await page.waitToGetProperty(selectors.entryBasicData.notes, 'value'); diff --git a/e2e/paths/13-supplier/02_basic_data.spec.js b/e2e/paths/13-supplier/02_basic_data.spec.js index 4f3c49512..9d86e11d4 100644 --- a/e2e/paths/13-supplier/02_basic_data.spec.js +++ b/e2e/paths/13-supplier/02_basic_data.spec.js @@ -70,8 +70,8 @@ describe('Supplier basic data path', () => { }); it('should check the changes have been recorded', async() => { - const result = await page.waitToGetProperty('#newInstance:nth-child(3)', 'innerText'); + const result = await page.waitToGetProperty('vn-tr table tr:nth-child(3) td.after', 'innerText'); - expect(result).toEqual('note Some notes'); + expect(result).toEqual('Some notes'); }); }); diff --git a/e2e/paths/13-supplier/03_fiscal_data.spec.js b/e2e/paths/13-supplier/03_fiscal_data.spec.js index 0238c8704..4f9581e32 100644 --- a/e2e/paths/13-supplier/03_fiscal_data.spec.js +++ b/e2e/paths/13-supplier/03_fiscal_data.spec.js @@ -31,7 +31,7 @@ describe('Supplier fiscal data path', () => { await page.clearInput(selectors.supplierFiscalData.taxNumber); await page.write(selectors.supplierFiscalData.taxNumber, 'Wrong tax number'); await page.clearInput(selectors.supplierFiscalData.account); - await page.write(selectors.supplierFiscalData.account, 'edited account number'); + await page.write(selectors.supplierFiscalData.account, '0123456789'); await page.autocompleteSearch(selectors.supplierFiscalData.sageWihholding, 'retencion estimacion objetiva'); await page.autocompleteSearch(selectors.supplierFiscalData.sageTaxType, 'operaciones no sujetas'); @@ -70,7 +70,7 @@ describe('Supplier fiscal data path', () => { it('should check the account was edited', async() => { const result = await page.waitToGetProperty(selectors.supplierFiscalData.account, 'value'); - expect(result).toEqual('edited account number'); + expect(result).toEqual('0123456789'); }); it('should check the sageWihholding was edited', async() => { diff --git a/e2e/paths/14-account/01_create_and_basic_data.spec.js b/e2e/paths/14-account/01_create_and_basic_data.spec.js index 4c0fa36a9..ebcacddf4 100644 --- a/e2e/paths/14-account/01_create_and_basic_data.spec.js +++ b/e2e/paths/14-account/01_create_and_basic_data.spec.js @@ -62,27 +62,6 @@ describe('Account create and basic data path', () => { }); describe('Descriptor option', () => { - describe('Edit role', () => { - it('should edit the role using the descriptor menu', async() => { - await page.waitToClick(selectors.accountDescriptor.menuButton); - await page.waitToClick(selectors.accountDescriptor.changeRole); - await page.autocompleteSearch(selectors.accountDescriptor.newRole, 'adminBoss'); - await page.waitToClick(selectors.accountDescriptor.acceptButton); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Role changed succesfully!'); - }); - - it('should reload the roles section to see now there are more roles', async() => { - // when role updates db takes time to return changes, without this timeout the result would have been 3 - await page.waitForTimeout(1000); - await page.reloadSection('account.card.roles'); - const rolesCount = await page.countElement(selectors.accountRoles.anyResult); - - expect(rolesCount).toEqual(61); - }); - }); - describe('activate account', () => { it(`should check the active account icon isn't present in the descriptor`, async() => { await page.waitForNumberOfElements(selectors.accountDescriptor.activeAccountIcon, 0); @@ -150,10 +129,12 @@ describe('Account create and basic data path', () => { describe('Set password', () => { it('should set the password using the descriptor menu', async() => { + const newPassword = 'quantum.12345'; + await page.waitToClick(selectors.accountDescriptor.menuButton); await page.waitToClick(selectors.accountDescriptor.setPassword); - await page.write(selectors.accountDescriptor.newPassword, 'quantum.crypt0graphy'); - await page.write(selectors.accountDescriptor.repeatPassword, 'quantum.crypt0graphy'); + await page.write(selectors.accountDescriptor.newPassword, newPassword); + await page.write(selectors.accountDescriptor.repeatPassword, newPassword); await page.waitToClick(selectors.accountDescriptor.acceptButton); const message = await page.waitForSnackbar(); diff --git a/e2e/paths/14-account/07_ldap.spec.js b/e2e/paths/14-account/07_ldap.spec.js index a3b8137d3..eb22f695c 100644 --- a/e2e/paths/14-account/07_ldap.spec.js +++ b/e2e/paths/14-account/07_ldap.spec.js @@ -29,4 +29,13 @@ describe('Account LDAP path', () => { expect(message.text).toContain('Data saved!'); }); + + it('should reset data', async() => { + await page.waitToClick(selectors.accountLdap.checkEnable); + await page.waitToClick(selectors.accountLdap.save); + + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); }); diff --git a/e2e/paths/14-account/08_samba.spec.js b/e2e/paths/14-account/08_samba.spec.js index c3db026dc..6e7ef9bbf 100644 --- a/e2e/paths/14-account/08_samba.spec.js +++ b/e2e/paths/14-account/08_samba.spec.js @@ -29,4 +29,13 @@ describe('Account Samba path', () => { expect(message.text).toContain('Data saved!'); }); + + it('should reset data', async() => { + await page.waitToClick(selectors.accountSamba.checkEnable); + await page.waitToClick(selectors.accountSamba.save); + + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); }); diff --git a/e2e/paths/14-account/09_privileges.spec.js b/e2e/paths/14-account/09_privileges.spec.js new file mode 100644 index 000000000..e4b8fb24c --- /dev/null +++ b/e2e/paths/14-account/09_privileges.spec.js @@ -0,0 +1,112 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Account privileges path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('developer', 'account'); + await page.accessToSearchResult('1101'); + await page.accessToSection('account.card.privileges'); + }); + + afterAll(async() => { + await browser.close(); + }); + + describe('as developer', () => { + it('should throw error when give privileges', async() => { + await page.waitToClick(selectors.accountPrivileges.checkHasGrant); + await page.waitToClick(selectors.accountPrivileges.save); + + const message = await page.waitForSnackbar(); + + expect(message.text).toContain(`You don't have grant privilege`); + }); + + it('should throw error when change role', async() => { + await page.autocompleteSearch(selectors.accountPrivileges.role, 'employee'); + await page.waitToClick(selectors.accountPrivileges.save); + + const message = await page.waitForSnackbar(); + + expect(message.text).toContain(`You don't have grant privilege`); + }); + }); + + describe('as sysadmin', () => { + beforeAll(async() => { + await page.loginAndModule('sysadmin', 'account'); + await page.accessToSearchResult('9'); + await page.accessToSection('account.card.privileges'); + }); + + it('should give privileges', async() => { + await page.waitToClick(selectors.accountPrivileges.checkHasGrant); + await page.waitToClick(selectors.accountPrivileges.save); + const message = await page.waitForSnackbar(); + + await page.reloadSection('account.card.privileges'); + const result = await page.checkboxState(selectors.accountPrivileges.checkHasGrant); + + expect(message.text).toContain(`Data saved!`); + expect(result).toBe('checked'); + }); + + it('should throw error when change role and not own role', async() => { + await page.autocompleteSearch(selectors.accountPrivileges.role, 'itBoss'); + await page.waitToClick(selectors.accountPrivileges.save); + + const message = await page.waitForSnackbar(); + + expect(message.text).toContain(`You don't own the role and you can't assign it to another user`); + }); + + it('should change role to employee', async() => { + await page.autocompleteSearch(selectors.accountPrivileges.role, 'employee'); + await page.waitToClick(selectors.accountPrivileges.save); + const message = await page.waitForSnackbar(); + + await page.reloadSection('account.card.privileges'); + const result = await page.waitToGetProperty(selectors.accountPrivileges.role, 'value'); + + expect(message.text).toContain(`Data saved!`); + expect(result).toContain('employee'); + }); + + it('should return role to developer', async() => { + await page.autocompleteSearch(selectors.accountPrivileges.role, 'developer'); + await page.waitToClick(selectors.accountPrivileges.save); + const message = await page.waitForSnackbar(); + + await page.reloadSection('account.card.privileges'); + const result = await page.waitToGetProperty(selectors.accountPrivileges.role, 'value'); + + expect(message.text).toContain(`Data saved!`); + expect(result).toContain('developer'); + }); + }); + + describe('as developer again', () => { + it('should remove privileges', async() => { + await page.accessToSearchResult('9'); + await page.accessToSection('account.card.privileges'); + + await page.waitToClick(selectors.accountPrivileges.checkHasGrant); + await page.waitToClick(selectors.accountPrivileges.save); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain(`Data saved!`); + }); + + it('should logIn in developer', async() => { + await page.reloadSection('account.card.privileges'); + const result = await page.checkboxState(selectors.accountPrivileges.checkHasGrant); + + expect(result).toBe('unchecked'); + }); + }); +}); diff --git a/front/core/components/autocomplete/style.scss b/front/core/components/autocomplete/style.scss index 19e8362d5..201d29c1e 100755 --- a/front/core/components/autocomplete/style.scss +++ b/front/core/components/autocomplete/style.scss @@ -19,6 +19,10 @@ padding-right: 0; } } + + & > .icons.pre { + min-width: 22px + } } &.readonly > .container > .icons.post { display: none; diff --git a/front/core/components/button-menu/index.js b/front/core/components/button-menu/index.js index c19962b08..e9e4e5ab7 100644 --- a/front/core/components/button-menu/index.js +++ b/front/core/components/button-menu/index.js @@ -87,6 +87,7 @@ ngModule.vnComponent('vnButtonMenu', { selectFields: '
{{::day.localeChar}}
@@ -57,4 +57,4 @@ - \ No newline at end of file + diff --git a/front/core/components/calendar/index.js b/front/core/components/calendar/index.js index 85b51fd04..f30dac14f 100644 --- a/front/core/components/calendar/index.js +++ b/front/core/components/calendar/index.js @@ -15,9 +15,9 @@ export default class Calendar extends FormInput { constructor($element, $scope, vnWeekDays, moment) { super($element, $scope); this.weekDays = vnWeekDays.locales; - this.defaultDate = new Date(); this.displayControls = true; this.moment = moment; + this.defaultDate = Date.vnNew(); } /** @@ -114,12 +114,14 @@ export default class Calendar extends FormInput { let day = date.getDate(); let wday = date.getDay(); let month = date.getMonth(); + let year = date.getFullYear(); - const currentDay = new Date().getDate(); - const currentMonth = new Date().getMonth(); + const currentDay = Date.vnNew().getDate(); + const currentMonth = Date.vnNew().getMonth(); + const currentYear = Date.vnNew().getFullYear(); let classes = { - today: day === currentDay && month === currentMonth, + today: day === currentDay && month === currentMonth && year === currentYear, weekend: wday === 6 || wday === 0, previous: month < this.month, current: month == this.month, @@ -207,14 +209,23 @@ export default class Calendar extends FormInput { } repeatLast() { - if (!this.formatDay) return; + if (this.formatDay) { + const days = this.element.querySelectorAll('.days > .day'); + for (let i = 0; i < days.length; i++) { + this.formatDay({ + $day: this.days[i], + $element: days[i] + }); + } + } - let days = this.element.querySelectorAll('.days > .day'); - for (let i = 0; i < days.length; i++) { - this.formatDay({ - $day: this.days[i], - $element: days[i] - }); + if (this.formatWeek) { + const weeks = this.element.querySelectorAll('.weeks > .day'); + for (const week of weeks) { + this.formatWeek({ + $element: week + }); + } } } } @@ -228,6 +239,7 @@ ngModule.vnComponent('vnCalendar', { hasEvents: '&?', getClass: '&?', formatDay: '&?', + formatWeek: '&?', displayControls: ' { let controller; let $element; - let date = new Date(); + let date = Date.vnNew(); date.setHours(0, 0, 0, 0); date.setDate(1); @@ -48,7 +48,7 @@ describe('Component vnCalendar', () => { it(`should return the selected element, then emit a 'selection' event`, () => { jest.spyOn(controller, 'emit'); - const day = new Date(); + const day = Date.vnNew(); day.setHours(0, 0, 0, 0); const clickEvent = new Event('click'); diff --git a/front/core/components/check/index.js b/front/core/components/check/index.js index 78b1807a5..25ec506ad 100644 --- a/front/core/components/check/index.js +++ b/front/core/components/check/index.js @@ -40,7 +40,7 @@ export default class Check extends Toggle { set tripleState(value) { this._tripleState = value; - this.field = this.field; + this.field = value; } get tripleState() { diff --git a/front/core/components/check/index.spec.js b/front/core/components/check/index.spec.js index c9d50cab2..7ec0f12a0 100644 --- a/front/core/components/check/index.spec.js +++ b/front/core/components/check/index.spec.js @@ -45,8 +45,8 @@ describe('Component vnCheck', () => { }); it(`should set value to null and change to true when clicked`, () => { - controller.field = null; controller.tripleState = true; + controller.field = null; element.click(); expect(controller.field).toEqual(true); diff --git a/front/core/components/chip/style.scss b/front/core/components/chip/style.scss index 7651638be..562861441 100644 --- a/front/core/components/chip/style.scss +++ b/front/core/components/chip/style.scss @@ -58,10 +58,33 @@ vn-chip { background-color: $color-font-bg-dark; color: $color-font-bg; } + &.pink, + &.pink.clickable:hover, + &.pink.clickable:focus { + background-color: $color-pink; + } + &.dark-notice, + &.dark-notice.clickable:hover, + &.dark-notice.clickable:focus { + background-color: $color-notice; + } + &.yellow, + &.yellow.clickable:hover, + &.yellow.clickable:focus { + background-color: $color-yellow; + } + &.none, + &.none.clickable:hover, + &.none.clickable:focus { + background-color: $color-bg-panel; + border-radius: 50%; + border: 1px solid $color-font-link + + } &.clickable { @extend %clickable; opacity: 0.8; - + &:hover, &:focus { opacity: 1; @@ -118,4 +141,4 @@ vn-avatar { display: inline-block; min-width: 28px; border-radius: 50%; -} \ No newline at end of file +} diff --git a/front/core/components/crud-model/crud-model.js b/front/core/components/crud-model/crud-model.js index 4994e1547..421a79f9b 100644 --- a/front/core/components/crud-model/crud-model.js +++ b/front/core/components/crud-model/crud-model.js @@ -14,6 +14,7 @@ export default class CrudModel extends ModelProxy { this.$q = $q; this.primaryKey = 'id'; this.autoLoad = false; + this.page = 1; } $onInit() { @@ -99,6 +100,18 @@ export default class CrudModel extends ModelProxy { return this.refresh(); } + /** + * Applies a new filter to the model. + * + * @param {Object} params Custom parameters + * @return {Promise} The request promise + */ + + applyParams(params) { + this.userParams = params; + return this.refresh(); + } + removeFilter() { return this.applyFilter(null, null); } @@ -113,13 +126,20 @@ export default class CrudModel extends ModelProxy { } } - loadMore() { + loadMore(append) { if (!this.moreRows) return this.$q.resolve(); - let filter = Object.assign({}, this.currentFilter); - filter.skip = this.orgData ? this.orgData.length : 0; - return this.sendRequest(filter, true); + const filter = Object.assign({}, this.currentFilter); + if (append) + filter.skip = this.orgData ? this.orgData.length : 0; + + if (!append) { + this.page += 1; + filter.limit = this.page * this.limit; + } + + return this.sendRequest(filter, append); } clear() { @@ -127,28 +147,17 @@ export default class CrudModel extends ModelProxy { this.moreRows = null; } - /** - * Saves current changes on the server. - * - * @return {Promise} The save request promise - */ - save() { - if (!this.isChanged) - return this.$q.resolve(); + getChanges() { + if (!this.isChanged) return null; - let deletes = []; - let updates = []; - let creates = []; - let orgDeletes = []; - let orgUpdates = []; - let orgCreates = []; + const deletes = []; + const updates = []; + const creates = []; - let pk = this.primaryKey; + const pk = this.primaryKey; - for (let row of this.removed) { + for (let row of this.removed) deletes.push(row.$orgRow[pk]); - orgDeletes.push(row); - } for (let row of this.data) { if (row.$isNew) { @@ -158,7 +167,6 @@ export default class CrudModel extends ModelProxy { data[prop] = row[prop]; } creates.push(row); - orgCreates.push(row); } else if (row.$oldData) { let data = {}; for (let prop in row.$oldData) @@ -167,28 +175,38 @@ export default class CrudModel extends ModelProxy { data, where: {[pk]: row.$orgRow[pk]} }); - orgUpdates.push(row); } } - let changes = {deletes, updates, creates}; + const changes = {deletes, updates, creates}; for (let prop in changes) { if (changes[prop].length === 0) changes[prop] = undefined; } - if (!changes) - return this.$q.resolve(); + return changes; + } + /** + * Saves current changes on the server. + * + * @return {Promise} The save request promise + */ + save() { + const pk = this.primaryKey; + const changes = this.getChanges(); + if (!changes) return this.$q.resolve(); + + const creates = changes.creates || []; let url = this.saveUrl ? this.saveUrl : `${this._url}/crud`; return this.$http.post(url, changes) .then(res => { const created = res.data; // Apply new data to created instances - for (let i = 0; i < orgCreates.length; i++) { - const row = orgCreates[i]; + for (let i = 0; i < creates.length; i++) { + const row = creates[i]; row[pk] = created[i][pk]; for (let prop in row) { diff --git a/front/core/components/crud-model/index.spec.js b/front/core/components/crud-model/index.spec.js index 8673e947f..7eab80405 100644 --- a/front/core/components/crud-model/index.spec.js +++ b/front/core/components/crud-model/index.spec.js @@ -148,7 +148,7 @@ describe('Component vnCrudModel', () => { controller.moreRows = true; - controller.loadMore(); + controller.loadMore(true); expect(controller.sendRequest).toHaveBeenCalledWith({'skip': 2}, true); }); diff --git a/front/core/components/date-picker/index.spec.js b/front/core/components/date-picker/index.spec.js index f76396311..13ab1d70a 100644 --- a/front/core/components/date-picker/index.spec.js +++ b/front/core/components/date-picker/index.spec.js @@ -4,7 +4,7 @@ describe('Component vnDatePicker', () => { let $ctrl; let today; - today = new Date(); + today = Date.vnNew(); today.setHours(0, 0, 0, 0); beforeEach(ngModule('vnCore')); diff --git a/front/core/components/drop-down/index.js b/front/core/components/drop-down/index.js index 08d0da6d0..302c1c6b5 100644 --- a/front/core/components/drop-down/index.js +++ b/front/core/components/drop-down/index.js @@ -212,12 +212,12 @@ export default class DropDown extends Popover { && !this.model.isLoading; if (shouldLoad) - this.model.loadMore(); + this.model.loadMore(true); } onLoadMoreClick(event) { if (event.defaultPrevented) return; - this.model.loadMore(); + this.model.loadMore(true); } onContainerClick(event) { diff --git a/front/core/components/field/index.html b/front/core/components/field/index.html index bd13f46d6..0d65c1f40 100644 --- a/front/core/components/field/index.html +++ b/front/core/components/field/index.html @@ -12,7 +12,7 @@ * -
+
.icons.pre.clearable { + min-width: 22px + } & > .underline { position: absolute; bottom: 0; diff --git a/front/core/components/icon/icon.js b/front/core/components/icon/icon.js index 38aea0056..8fb79d294 100644 --- a/front/core/components/icon/icon.js +++ b/front/core/components/icon/icon.js @@ -26,7 +26,7 @@ class Icon { Icon.$inject = ['$attrs']; ngModule.vnComponent('vnIcon', { - template: '{{::$ctrl.iconContent}}', + template: '{{::$ctrl.iconContent}}', controller: Icon, bindings: { icon: '@' diff --git a/front/core/components/input-file/index.html b/front/core/components/input-file/index.html index 5ec7e1da4..14d138cfe 100644 --- a/front/core/components/input-file/index.html +++ b/front/core/components/input-file/index.html @@ -3,7 +3,7 @@ ng-transclude="prepend" class="prepend">
-
+
+ accept="{{$ctrl.accept}}">
diff --git a/front/core/components/input-file/style.scss b/front/core/components/input-file/style.scss index 44d11f774..72470c4fe 100644 --- a/front/core/components/input-file/style.scss +++ b/front/core/components/input-file/style.scss @@ -4,4 +4,13 @@ .value { cursor: pointer; } + .control { + & > input[type=file] { + opacity: 0; + } + & > section { + position: absolute; + bottom: 0; + } + } } \ No newline at end of file diff --git a/front/core/components/input-time/index.js b/front/core/components/input-time/index.js index d77ccbec2..67fa9d6fd 100644 --- a/front/core/components/input-time/index.js +++ b/front/core/components/input-time/index.js @@ -23,12 +23,15 @@ export default class InputTime extends Field { let date = null; let value = this.input.value; + if (this.field && !this.modelDate) + this.modelDate = this.field; + if (value) { let split = value.split(':').map(i => parseInt(i) || null); - date = this.field instanceof Date - ? this.field - : new Date(this.field || null); + date = this.modelDate + ? new Date(this.modelDate) + : Date.vnNew(); date.setHours(split[0], split[1], 0, 0); } diff --git a/front/core/components/input-time/index.spec.js b/front/core/components/input-time/index.spec.js index abb684df8..7b4f1c823 100644 --- a/front/core/components/input-time/index.spec.js +++ b/front/core/components/input-time/index.spec.js @@ -20,7 +20,7 @@ describe('Component vnInputTime', () => { describe('field() setter', () => { it(`should display the formated the date`, () => { - let date = new Date(); + let date = Date.vnNew(); $ctrl.field = date; let displayed = $filter('date')(date, 'HH:mm'); diff --git a/front/core/components/model-proxy/model-proxy.js b/front/core/components/model-proxy/model-proxy.js index 26c28c803..0b8d7ebf9 100644 --- a/front/core/components/model-proxy/model-proxy.js +++ b/front/core/components/model-proxy/model-proxy.js @@ -374,9 +374,10 @@ export class Paginable { /** * When limit is enabled, loads the next set of rows. * + * @param {Boolean} append - Whether should append new data * @return {Promise} The request promise */ - loadMore() { - return Promise.resolve(); + loadMore(append) { + return Promise.resolve(append); } } diff --git a/front/core/components/pagination/pagination.js b/front/core/components/pagination/pagination.js index 9979be368..e7127734c 100644 --- a/front/core/components/pagination/pagination.js +++ b/front/core/components/pagination/pagination.js @@ -73,7 +73,7 @@ class Pagination extends Component { if (shouldLoad) { this.nLoads++; - this.model.loadMore(); + this.model.loadMore(false); this.$.$apply(); } } @@ -82,7 +82,7 @@ class Pagination extends Component { if (this.maxLoads > 0 && this.nLoads == this.maxLoads) this.nLoads = 0; - this.model.loadMore(); + this.model.loadMore(false); } $onDestroy() { diff --git a/front/core/components/searchbar/searchbar.js b/front/core/components/searchbar/searchbar.js index 89b5d7df6..aefa89b5b 100644 --- a/front/core/components/searchbar/searchbar.js +++ b/front/core/components/searchbar/searchbar.js @@ -26,6 +26,7 @@ export default class Searchbar extends Component { this.autoState = true; this.separateIndex = true; this.entityState = 'card.summary'; + this.isIndex = false; this.deregisterCallback = this.$transitions.onSuccess( {}, transition => this.onStateChange(transition)); @@ -102,6 +103,9 @@ export default class Searchbar extends Component { filter = {}; } + let stateParts = this.$state.current.name.split('.'); + this.isIndex = stateParts[1] == 'index'; + this.doSearch(filter, 'state'); } @@ -139,8 +143,12 @@ export default class Searchbar extends Component { } removeParam(index) { + const field = this.params[index].key; + this.filterSanitizer(field); + this.params.splice(index, 1); - this.doSearch(this.fromBar(), 'bar'); + this.toRemove = field; + this.doSearch(this.fromBar(), 'removeBar'); } fromBar() { @@ -163,7 +171,7 @@ export default class Searchbar extends Component { let keys = Object.keys(filter); keys.forEach(key => { - if (key == 'search') return; + if (key == 'search' || key == 'tableQ' || key == 'tableOrder') return; let value = filter[key]; let chip; @@ -194,10 +202,11 @@ export default class Searchbar extends Component { } doSearch(filter, source) { - if (filter === this.filter && source != 'state') return; + if (filter === this.filter && !this.isIndex) return; let promise = this.onSearch({$params: filter}); promise = promise || this.$q.resolve(); promise.then(data => this.onFilter(filter, source, data)); + this.toBar(filter); } onFilter(filter, source, data) { @@ -238,8 +247,11 @@ export default class Searchbar extends Component { } else { state = this.searchState; - if (filter) + if (filter) { + if (this.tableQ) + filter.tableQ = this.tableQ; params = {q: JSON.stringify(filter)}; + } if (this.$state.is(state)) opts = {location: 'replace'}; } @@ -247,6 +259,12 @@ export default class Searchbar extends Component { this.filter = filter; + if (source == 'removeBar') { + delete params[this.toRemove]; + delete this.model.userParams[this.toRemove]; + this.model.refresh(); + } + if (!filter && this.model) this.model.clear(); if (source != 'state') @@ -269,9 +287,14 @@ export default class Searchbar extends Component { this.model.clear(); return; } + if (Object.keys(filter).length === 0) { + this.filterSanitizer('search'); + if (this.model.userParams) + delete this.model.userParams['search']; + } let where = null; - let params = null; + let params = {}; if (this.exprBuilder) { where = buildFilter(filter, @@ -283,9 +306,89 @@ export default class Searchbar extends Component { params = this.fetchParams({$params: params}); } + this.tableQ = null; + + const hasParams = this.$params.q && JSON.parse(this.$params.q).tableQ; + if (hasParams) { + const stateFilter = JSON.parse(this.$params.q); + for (let param in stateFilter) { + if (param != 'tableQ' && param != 'orderQ') + this.filterSanitizer(param); + } + + for (let param in this.suggestedFilter) { + this.filterSanitizer(param); + delete stateFilter[param]; + } + + this.tableQ = stateFilter.tableQ; + for (let param in stateFilter.tableQ) + params[param] = stateFilter.tableQ[param]; + + const newParams = Object.assign(stateFilter, params); + return this.model.applyParams(newParams) + .then(() => this.model.data); + } + return this.model.applyFilter(where ? {where} : null, params) .then(() => this.model.data); } + + filterSanitizer(field) { + if (!field) return; + const userFilter = this.model.userFilter; + const userParams = this.model.userParams; + const where = userFilter && userFilter.where; + + if (this.model.userParams) + delete this.model.userParams[field]; + + if (this.exprBuilder) { + const param = this.exprBuilder({ + param: field, + value: null + }); + if (param) [field] = Object.keys(param); + } + + if (!where) return; + + const whereKeys = Object.keys(where); + for (let key of whereKeys) { + removeProp(where, field, key); + + if (Object.keys(where).length == 0) + delete userFilter.where; + } + + function removeProp(obj, targetProp, prop) { + if (prop == targetProp) + delete obj[prop]; + + if (prop === 'and' || prop === 'or' && obj[prop]) { + const arrayCopy = obj[prop].slice(); + for (let param of arrayCopy) { + const [key] = Object.keys(param); + const index = obj[prop].findIndex(param => { + return Object.keys(param)[0] == key; + }); + if (key == targetProp) + obj[prop].splice(index, 1); + + if (param[key] instanceof Array) + removeProp(param, field, key); + + if (Object.keys(param).length == 0) + obj[prop].splice(index, 1); + } + + if (obj[prop].length == 0) + delete obj[prop]; + } + } + + return {userFilter, userParams}; + } } ngModule.vnComponent('vnSearchbar', { diff --git a/front/core/components/searchbar/searchbar.spec.js b/front/core/components/searchbar/searchbar.spec.js index e4f58d294..9998e7a7c 100644 --- a/front/core/components/searchbar/searchbar.spec.js +++ b/front/core/components/searchbar/searchbar.spec.js @@ -6,7 +6,7 @@ describe('Component vnSearchbar', () => { let $state; let $params; let $scope; - let filter = {id: 1, search: 'needle'}; + const filter = {id: 1, search: 'needle'}; beforeEach(ngModule('vnCore', $stateProvider => { $stateProvider @@ -70,8 +70,8 @@ describe('Component vnSearchbar', () => { describe('filter() setter', () => { it(`should update the bar params and search`, () => { - let withoutHours = new Date(2000, 1, 1); - let withHours = new Date(withoutHours.getTime()); + const withoutHours = new Date(2000, 1, 1); + const withHours = new Date(withoutHours.getTime()); withHours.setHours(12, 30, 15, 10); controller.filter = { @@ -83,8 +83,8 @@ describe('Component vnSearchbar', () => { myObjectProp: {myProp: 1} }; - let chips = {}; - for (let param of controller.params || []) + const chips = {}; + for (const param of controller.params || []) chips[param.key] = param.chip; expect(controller.searchString).toBe('needle'); @@ -172,13 +172,20 @@ describe('Component vnSearchbar', () => { describe('removeParam()', () => { it(`should remove the parameter from the filter`, () => { jest.spyOn(controller, 'doSearch'); + controller.model = { + refresh: jest.fn(), + applyFilter: jest.fn().mockReturnValue(Promise.resolve()), + userParams: { + id: 1 + } + }; controller.filter = filter; controller.removeParam(0); expect(controller.doSearch).toHaveBeenCalledWith({ search: 'needle' - }, 'bar'); + }, 'removeBar'); }); }); @@ -199,7 +206,7 @@ describe('Component vnSearchbar', () => { it(`should go to the summary state when one result`, () => { jest.spyOn($state, 'go'); - let data = [{id: 1}]; + const data = [{id: 1}]; controller.baseState = 'foo'; controller.onFilter(filter, 'any', data); @@ -214,7 +221,7 @@ describe('Component vnSearchbar', () => { $scope.$apply(); jest.spyOn($state, 'go'); - let data = [{id: 1}]; + const data = [{id: 1}]; controller.baseState = 'foo'; controller.onFilter(filter, 'any', data); @@ -229,7 +236,7 @@ describe('Component vnSearchbar', () => { $scope.$apply(); jest.spyOn($state, 'go'); - let data = [{id: 1}]; + const data = [{id: 1}]; controller.baseState = 'foo'; controller.onFilter(filter, 'any', data); @@ -247,7 +254,7 @@ describe('Component vnSearchbar', () => { controller.onFilter(filter, 'any'); $scope.$apply(); - let queryParams = {q: JSON.stringify(filter)}; + const queryParams = {q: JSON.stringify(filter)}; expect($state.go).toHaveBeenCalledWith('search.state', queryParams, undefined); expect(controller.filter).toEqual(filter); diff --git a/front/core/components/smart-table/index.html b/front/core/components/smart-table/index.html index a3295c47e..752019313 100644 --- a/front/core/components/smart-table/index.html +++ b/front/core/components/smart-table/index.html @@ -10,9 +10,9 @@
-
- {{model.data.length}} - results +
+ {{model.data.length}} + results
@@ -64,7 +65,7 @@
Shown columns
-
@@ -101,4 +102,5 @@
- \ No newline at end of file + + diff --git a/front/core/components/smart-table/index.js b/front/core/components/smart-table/index.js index 401541c2c..b2380a62f 100644 --- a/front/core/components/smart-table/index.js +++ b/front/core/components/smart-table/index.js @@ -15,9 +15,17 @@ export default class SmartTable extends Component { this.$inputsScope; this.columns = []; this.autoSave = false; + this.autoState = true; this.transclude(); } + $onChanges() { + if (this.model) { + this.defaultFilter(); + this.defaultOrder(); + } + } + $onDestroy() { const styleElement = document.querySelector('style[id="smart-table"]'); if (this.$.css && styleElement) @@ -47,10 +55,8 @@ export default class SmartTable extends Component { set model(value) { this._model = value; - if (value) { + if (value) this.$.model = value; - this.defaultOrder(); - } } getDefaultViewConfig() { @@ -141,7 +147,7 @@ export default class SmartTable extends Component { for (const column of this.columns) { if (viewConfig.configuration[column.field] == false) { const baseSelector = `smart-table[view-config-id="${this.viewConfigId}"] table`; - selectors.push(`${baseSelector} thead > tr > th:nth-child(${column.index + 1})`); + selectors.push(`${baseSelector} thead > tr:not([second-header]) > th:nth-child(${column.index + 1})`); selectors.push(`${baseSelector} tbody > tr > td:nth-child(${column.index + 1})`); } } @@ -160,8 +166,36 @@ export default class SmartTable extends Component { } } + defaultFilter() { + if (this.disabledTableFilter || !this.$params.q) return; + + const stateFilter = JSON.parse(this.$params.q).tableQ; + if (!stateFilter || !this.exprBuilder) return; + + const columns = this.columns.map(column => column.field); + + this.displaySearch(); + if (!this.$inputsScope.searchProps) + this.$inputsScope.searchProps = {}; + + for (let param in stateFilter) { + if (columns.includes(param)) { + const whereParams = {[param]: stateFilter[param]}; + Object.assign(this.$inputsScope.searchProps, whereParams); + this.addFilter(param, stateFilter[param]); + } + } + } + defaultOrder() { - const order = this.model.order; + if (this.disabledTableOrder) return; + + let stateOrder; + if (this.$params.q) + stateOrder = JSON.parse(this.$params.q).tableOrder; + + const order = stateOrder ? stateOrder : this.model.order; + if (!order) return; const orderFields = order.split(', '); @@ -195,10 +229,13 @@ export default class SmartTable extends Component { this.setPriority(column.element, priority); } } + + this.model.order = order; + this.refresh(); } registerColumns() { - const header = this.element.querySelector('thead > tr'); + const header = this.element.querySelector('thead > tr:not([second-header])'); if (!header) return; const columns = header.querySelectorAll('th'); @@ -217,7 +254,7 @@ export default class SmartTable extends Component { } emptyDataRows() { - const header = this.element.querySelector('thead > tr'); + const header = this.element.querySelector('thead > tr:not([second-header])'); const columns = header.querySelectorAll('th'); const tbody = this.element.querySelector('tbody'); if (tbody) { @@ -296,7 +333,7 @@ export default class SmartTable extends Component { } displaySearch() { - const header = this.element.querySelector('thead > tr'); + const header = this.element.querySelector('thead > tr:not([second-header])'); if (!header) return; const tbody = this.element.querySelector('tbody'); @@ -395,28 +432,55 @@ export default class SmartTable extends Component { } searchByColumn(field) { - const searchCriteria = this.$inputsScope.searchProps[field]; - const emptySearch = searchCriteria === '' || searchCriteria == null; - const filters = this.filterSanitizer(field); if (filters && filters.userFilter) this.model.userFilter = filters.userFilter; - if (!emptySearch) - this.addFilter(field, this.$inputsScope.searchProps[field]); - else this.model.refresh(); + + this.addFilter(field, this.$inputsScope.searchProps[field]); + } + + searchPropsSanitizer() { + if (!this.$inputsScope || !this.$inputsScope.searchProps) return null; + let searchProps = this.$inputsScope.searchProps; + const searchPropsArray = Object.entries(searchProps); + searchProps = searchPropsArray.filter( + ([key, value]) => value && value != '' + ); + + return Object.fromEntries(searchProps); } addFilter(field, value) { - let where = {[field]: value}; + if (value === '') value = null; - if (this.exprBuilder) { - where = buildFilter(where, (param, value) => - this.exprBuilder({param, value}) - ); + let stateFilter = {tableQ: {}}; + if (this.$params.q) { + stateFilter = JSON.parse(this.$params.q); + if (!stateFilter.tableQ) + stateFilter.tableQ = {}; + delete stateFilter.tableQ[field]; } - this.model.addFilter({where}); + const whereParams = {[field]: value}; + if (value !== '' && value !== null && value !== undefined) { + let where = {[field]: value}; + if (this.exprBuilder) { + where = buildFilter(whereParams, (param, value) => + this.exprBuilder({param, value}) + ); + } + this.model.addFilter({where}); + } + + const searchProps = this.searchPropsSanitizer(); + + Object.assign(stateFilter.tableQ, searchProps); + + const params = {q: JSON.stringify(stateFilter)}; + + this.$state.go(this.$state.current.name, params, {location: 'replace'}) + .then(() => this.refresh()); } applySort() { @@ -426,7 +490,18 @@ export default class SmartTable extends Component { if (order) this.model.order = order; - this.model.refresh(); + let stateFilter = {tableOrder: {}}; + if (this.$params.q) { + stateFilter = JSON.parse(this.$params.q); + if (!stateFilter.tableOrder) + stateFilter.tableOrder = {}; + } + + stateFilter.tableOrder = order; + + const params = {q: JSON.stringify(stateFilter)}; + this.$state.go(this.$state.current.name, params, {location: 'replace'}) + .then(() => this.refresh()); } filterSanitizer(field) { @@ -511,6 +586,12 @@ export default class SmartTable extends Component { return this.model.save() .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); } + + refresh() { + this.isRefreshing = true; + this.model.refresh() + .finally(() => this.isRefreshing = false); + } } SmartTable.$inject = ['$element', '$scope', '$transclude']; @@ -529,6 +610,8 @@ ngModule.vnComponent('smartTable', { autoSave: ' { $httpBackend = _$httpBackend_; $element = $compile(``)($rootScope); controller = $element.controller('smartTable'); + controller.model = { + refresh: jest.fn().mockReturnValue(new Promise(resolve => resolve())), + addFilter: jest.fn(), + userParams: {} + }; })); afterEach(() => { @@ -83,7 +88,7 @@ describe('Component smartTable', () => { describe('defaultOrder', () => { it('should insert a new object to the controller sortCriteria with a sortType value of "ASC"', () => { const element = document.createElement('div'); - controller.model = {order: 'id'}; + controller.model.order = 'id'; controller.columns = [ {field: 'id', element: element}, {field: 'test1', element: element}, @@ -101,7 +106,8 @@ describe('Component smartTable', () => { it('should add new entries to the controller sortCriteria with a sortType values of "ASC" and "DESC"', () => { const element = document.createElement('div'); - controller.model = {order: 'test1, id DESC'}; + controller.model.order = 'test1, id DESC'; + controller.columns = [ {field: 'id', element: element}, {field: 'test1', element: element}, @@ -125,8 +131,6 @@ describe('Component smartTable', () => { describe('addFilter()', () => { it('should call the model addFilter() with a basic where filter if exprBuilder() was not received', () => { - controller.model = {addFilter: jest.fn()}; - controller.addFilter('myField', 'myValue'); const expectedFilter = { @@ -140,7 +144,6 @@ describe('Component smartTable', () => { it('should call the model addFilter() with a built where filter resultant of exprBuilder()', () => { controller.exprBuilder = jest.fn().mockReturnValue({builtField: 'builtValue'}); - controller.model = {addFilter: jest.fn()}; controller.addFilter('myField', 'myValue'); @@ -155,35 +158,46 @@ describe('Component smartTable', () => { }); describe('applySort()', () => { - it('should call the model refresh() without making changes on the model order', () => { - controller.model = {refresh: jest.fn()}; + it('should call the $state go and model refresh without making changes on the model order', () => { + controller.$state = { + go: jest.fn().mockReturnValue(new Promise(resolve => resolve())), + current: { + name: 'section' + } + }; + jest.spyOn(controller, 'refresh'); controller.applySort(); expect(controller.model.order).toBeUndefined(); - expect(controller.model.refresh).toHaveBeenCalled(); + expect(controller.$state.go).toHaveBeenCalled(); }); - it('should call the model.refresh() after setting model order according to the controller sortCriteria', () => { - controller.model = {refresh: jest.fn()}; + it('should call the $state go and model refresh after setting model order according to the controller sortCriteria', () => { const orderBy = {field: 'myField', sortType: 'ASC'}; + controller.$state = { + go: jest.fn().mockReturnValue(new Promise(resolve => resolve())), + current: { + name: 'section' + } + }; + jest.spyOn(controller, 'refresh'); + controller.sortCriteria = [orderBy]; controller.applySort(); expect(controller.model.order).toEqual(`${orderBy.field} ${orderBy.sortType}`); - expect(controller.model.refresh).toHaveBeenCalled(); + expect(controller.$state.go).toHaveBeenCalled(); }); }); describe('filterSanitizer()', () => { it('should remove the where filter after leaving no fields in it', () => { - controller.model = { - userFilter: { - where: {fieldToRemove: 'valueToRemove'} - }, - userParams: {} + controller.model.userFilter = { + where: {fieldToRemove: 'valueToRemove'} }; + controller.model.userParams = {}; const result = controller.filterSanitizer('fieldToRemove'); @@ -193,23 +207,21 @@ describe('Component smartTable', () => { }); it('should remove the where filter after leaving no fields and "empty ands/ors" in it', () => { - controller.model = { - userFilter: { - where: { - and: [ - {aFieldToRemove: 'aValueToRemove'}, - {aFieldToRemove: 'aValueToRemove'}, - { - or: [ - {aFieldToRemove: 'aValueToRemove'}, - {aFieldToRemove: 'aValueToRemove'}, - ] - } - ] - } - }, - userParams: {} - }; + controller.model.userFilter = { + where: { + and: [ + {aFieldToRemove: 'aValueToRemove'}, + {aFieldToRemove: 'aValueToRemove'}, + { + or: [ + {aFieldToRemove: 'aValueToRemove'}, + {aFieldToRemove: 'aValueToRemove'}, + ] + } + ] + } + }, + controller.model.userParams = {}; const result = controller.filterSanitizer('aFieldToRemove'); @@ -219,24 +231,22 @@ describe('Component smartTable', () => { }); it('should not remove the where filter after leaving no empty "ands/ors" in it', () => { - controller.model = { - userFilter: { - where: { - and: [ - {aFieldToRemove: 'aValueToRemove'}, - {aFieldToRemove: 'aValueToRemove'}, - { - or: [ - {aFieldToRemove: 'aValueToRemove'}, - {aFieldToRemove: 'aValueToRemove'}, - ] - } - ], - or: [{dontKillMe: 'thanks'}] - } - }, - userParams: {} + controller.model.userFilter = { + where: { + and: [ + {aFieldToRemove: 'aValueToRemove'}, + {aFieldToRemove: 'aValueToRemove'}, + { + or: [ + {aFieldToRemove: 'aValueToRemove'}, + {aFieldToRemove: 'aValueToRemove'}, + ] + } + ], + or: [{dontKillMe: 'thanks'}] + } }; + controller.model.userParams = {}; const result = controller.filterSanitizer('aFieldToRemove'); @@ -249,7 +259,7 @@ describe('Component smartTable', () => { describe('saveAll()', () => { it('should throw an error if there are no changes to save in the model', () => { jest.spyOn(controller.vnApp, 'showError'); - controller.model = {isChanged: false}; + controller.model.isChanged = false; controller.saveAll(); expect(controller.vnApp.showError).toHaveBeenCalledWith('No changes to save'); @@ -258,10 +268,8 @@ describe('Component smartTable', () => { it('should call the showSuccess() if there are changes to save in the model', done => { jest.spyOn(controller.vnApp, 'showSuccess'); - controller.model = { - save: jest.fn().mockReturnValue(Promise.resolve()), - isChanged: true - }; + controller.model.save = jest.fn().mockReturnValue(Promise.resolve()); + controller.model.isChanged = true; controller.saveAll().then(() => { expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); @@ -269,4 +277,41 @@ describe('Component smartTable', () => { }).catch(done.fail); }); }); + + describe('defaultFilter()', () => { + it('should call model refresh and model addFilter with filter', () => { + controller.exprBuilder = jest.fn().mockReturnValue({builtField: 'builtValue'}); + + controller.$params = { + q: '{"tableQ": {"fieldName":"value"}}' + }; + controller.columns = [ + {field: 'fieldName'} + ]; + controller.$inputsScope = { + searchProps: {} + }; + + controller.defaultFilter(); + + expect(controller.model.addFilter).toHaveBeenCalled(); + }); + }); + + describe('searchPropsSanitizer()', () => { + it('should searchProps sanitize', () => { + controller.$inputsScope = { + searchProps: { + filterOne: '1', + filterTwo: '' + } + }; + const searchPropsExpected = { + filterOne: '1' + }; + const newSearchProps = controller.searchPropsSanitizer(); + + expect(newSearchProps).toEqual(searchPropsExpected); + }); + }); }); diff --git a/front/core/components/smart-table/table.scss b/front/core/components/smart-table/table.scss index c38c149ca..996c41a74 100644 --- a/front/core/components/smart-table/table.scss +++ b/front/core/components/smart-table/table.scss @@ -8,6 +8,16 @@ smart-table table { & > thead { border-bottom: $border; + & > tr[second-header] { + & > th + { + text-align: center; + border-bottom-style: groove; + font-weight: bold; + text-transform: uppercase; + } + } + & > * > th { font-weight: normal; } @@ -60,6 +70,9 @@ smart-table table { vertical-align: middle; } } + &[separator]{ + border-left-style: groove; + } vn-icon.bright, i.bright { color: #f7931e; } @@ -108,4 +121,4 @@ smart-table table { font-size: 1.375rem; text-align: center; } -} \ No newline at end of file +} diff --git a/front/core/components/table/style.scss b/front/core/components/table/style.scss index d0a29a3ba..557268661 100644 --- a/front/core/components/table/style.scss +++ b/front/core/components/table/style.scss @@ -29,7 +29,7 @@ vn-table { & > tbody { display: table-row-group; } - & > vn-tfoot, + & > vn-tfoot, & > .vn-tfoot, & > tfoot { border-top: $border; @@ -42,7 +42,7 @@ vn-table { height: 48px; } vn-thead, .vn-thead, - vn-tbody, .vn-tbody, + vn-tbody, .vn-tbody, vn-tfoot, .vn-tfoot, thead, tbody, tfoot { & > * { @@ -153,6 +153,18 @@ vn-table { background-color: $color-font-bg-dark; color: $color-font-bg; } + &.dark-notice { + background-color: $color-notice; + color: $color-font-bg; + } + &.yellow { + background-color: $color-yellow; + color: $color-font-bg; + } + &.pink { + background-color: $color-pink; + color: $color-font-bg; + } } vn-icon-menu { display: inline-block; @@ -194,7 +206,7 @@ vn-table.scrollable > .vn-table, } vn-thead th, - vn-thead vn-th, + vn-thead vn-th, thead vn-th, thead th { border-bottom: $border; @@ -217,4 +229,4 @@ vn-table.scrollable.lg, .tableWrapper { overflow-x: auto; -} \ No newline at end of file +} diff --git a/front/core/components/textfield/textfield.js b/front/core/components/textfield/textfield.js index f166dae1c..14567d255 100644 --- a/front/core/components/textfield/textfield.js +++ b/front/core/components/textfield/textfield.js @@ -6,8 +6,98 @@ export default class Textfield extends Field { super($element, $scope, $compile); this.buildInput('text'); } + + set maxLength(value) { + this.input.maxLength = value; + } + + get maxLength() { + return this.input.maxLength; + } + + set insertable(value) { + if (this._insertable === value) + return; + + if (this._insertable) + this.input.removeEventListener('keypress', this.keyPressListener); + + if (value) { + this.keyPressListener = async e => await this.onKeyPress(e); + this.input.addEventListener('keypress', this.keyPressListener); + } + + this._insertable = value; + } + + get insertable() { + return this._insertable; + } + + async onKeyPress(e) { + if (e.key == 'Enter') + return; // If the enter key is pressed dismiss it + + let maxLength = this.maxLength; + + // Call the function that obtains the current cursor position + let pointerPosition = getCaretPosition(e.target); + + // If the cursor position is on the last allowed character, + // prevent any keystroke from doing anything + if (pointerPosition >= maxLength) { + e.preventDefault(); + e.stopPropagation(); + return; + } + + // In case by any ways the input is longer than the max especified size, cut it to it. + let currentArrValue = e.target.value.slice(0, maxLength); + + // Transform said input to a array with each character on one position + currentArrValue = currentArrValue.split(''); + + // Cut the array in 2 parts, one with everything right of the caret, + // and one with everything left to it + let rightToTheCaret = currentArrValue.slice(pointerPosition); + + let leftToTheCaret = currentArrValue.slice(0, pointerPosition); + + // Remove the first number on the array that was right of the caret + rightToTheCaret.shift(); + + // The part that was left to the caret is not modified in any way and is put back into the textField + e.target.value = leftToTheCaret.join(''); + + // Add one millisecond of delay to give the UI time to update, + // so that it detects the changes on the textField + await new Promise(r => setTimeout(r, 1)); + + // Add the values that should be right to the Caret back in the textField + e.target.value = e.target.value + rightToTheCaret.join(''); + + // Update the current pointer position so that it moves 1 position to the right + pointerPosition++; + e.target.setSelectionRange(pointerPosition, pointerPosition); + + return false; + } +} + +function getCaretPosition(targetElement) { + let caretPosition = 0; + + if (targetElement.selectionStart || targetElement.selectionStart == 0) // Firefox Support + caretPosition = targetElement.selectionStart; + + return caretPosition; } ngModule.vnComponent('vnTextfield', { - controller: Textfield + controller: Textfield, + bindings: { + maxLength: ' { - let zeroFillFilter; - - beforeEach(ngModule('vnCore')); - - beforeEach(inject(_zeroFillFilter_ => { - zeroFillFilter = _zeroFillFilter_; - })); - - it('should return null for a input null', () => { - expect(zeroFillFilter(null, null)).toBeNull(); - }); - - it('should return a positive number pads a number with five zeros', () => { - expect(zeroFillFilter(1, 5)).toBe('00001'); - }); - - it('should return negative number pads a number with five zeros', () => { - expect(zeroFillFilter(-1, 5)).toBe('-00001'); - }); - - it('should return zero number with zero zeros', () => { - expect(zeroFillFilter(0, 1)).toBe('0'); - }); -}); diff --git a/front/core/filters/zero-fill.js b/front/core/filters/zero-fill.js deleted file mode 100644 index c4d76b96f..000000000 --- a/front/core/filters/zero-fill.js +++ /dev/null @@ -1,17 +0,0 @@ -import ngModule from '../module'; - -/** - * Pads a number with zeros. - * - * @param {Number} input The number to pad - * @param {Number} padLength The resulting number of digits - * @return {String} The zero-filled number - */ -export default function zeroFill() { - return function(input, padLength) { - if (input == null) return input; - let sign = Math.sign(input) === -1 ? '-' : ''; - return sign + new Array(padLength).concat([Math.abs(input)]).join('0').slice(-padLength); - }; -} -ngModule.filter('zeroFill', zeroFill); diff --git a/front/core/lib/component.js b/front/core/lib/component.js index f17db68a2..5695d9449 100644 --- a/front/core/lib/component.js +++ b/front/core/lib/component.js @@ -12,9 +12,10 @@ export default class Component extends EventEmitter { * @param {HTMLElement} $element The main component element * @param {$rootScope.Scope} $scope The element scope * @param {Function} $transclude The transclusion function + * @param {Function} $location The location function */ - constructor($element, $scope, $transclude) { - super(); + constructor($element, $scope, $transclude, $location) { + super($element, $scope, $transclude, $location); this.$ = $scope; if (!$element) return; @@ -164,7 +165,7 @@ export default class Component extends EventEmitter { $transclude.$$boundTransclude.$$slots[slot]; } } -Component.$inject = ['$element', '$scope']; +Component.$inject = ['$element', '$scope', '$location', '$state']; /* * Automatically adds the most used services to the prototype, so they are diff --git a/front/core/locale/es.yml b/front/core/locale/es.yml index d849fcdd2..f654c61cf 100644 --- a/front/core/locale/es.yml +++ b/front/core/locale/es.yml @@ -26,7 +26,7 @@ Value should have at most %s characters: El valor debe tener un máximo de %s ca Enter a new search: Introduce una nueva búsqueda No results: Sin resultados Ups! It seems there was an error: ¡Vaya! Parece que ha habido un error -General search: Busqueda general +General search: Búsqueda general January: Enero February: Febrero March: Marzo @@ -42,9 +42,9 @@ December: Diciembre Monday: Lunes Tuesday: Martes Wednesday: Miércoles -Thursday: Jueves -Friday: Viernes -Saturday: Sábado +Thursday: Jueves +Friday: Viernes +Saturday: Sábado Sunday: Domingo Has delivery: Hay reparto Loading: Cargando @@ -63,4 +63,4 @@ Loading...: Cargando... No results found: Sin resultados No data: Sin datos Undo changes: Deshacer cambios -Load more results: Cargar más resultados \ No newline at end of file +Load more results: Cargar más resultados diff --git a/front/core/services/app.js b/front/core/services/app.js index 6b2cd1d2a..fb0a08777 100644 --- a/front/core/services/app.js +++ b/front/core/services/app.js @@ -10,6 +10,7 @@ export default class App { constructor() { this.loaderStatus = 0; this.loading = false; + this.versionInterval = setInterval(this.getVersion.bind(this), 300000); } showMessage(message) { @@ -38,6 +39,36 @@ export default class App { if (this.loaderStatus === 0) this.loading = false; } + + getVersion() { + this.logger.$http.get('Applications/status'); + } + + setVersion(newVersion) { + if (newVersion) { + const currentVersion = localStorage.getItem('salix-version'); + if (newVersion != currentVersion) { + this.hasNewVersion = true; + clearInterval(this.versionInterval); + } + localStorage.setItem('salix-version', newVersion); + } + } + + getUrl(route, appName = 'lilium') { + const env = process.env.NODE_ENV; + const filter = { + where: {and: [ + {appName: appName}, + {environment: env} + ]} + }; + + return this.logger.$http.get('Urls/findOne', {filter}) + .then(res => { + return res.data.url + route; + }); + } } ngModule.service('vnApp', App); diff --git a/front/core/services/auth.js b/front/core/services/auth.js index a1dcfa395..c15a34d94 100644 --- a/front/core/services/auth.js +++ b/front/core/services/auth.js @@ -23,7 +23,10 @@ export default class Auth { initialize() { let criteria = { - to: state => state.name != 'login' + to: state => { + const outLayout = ['login', 'recover-password', 'reset-password']; + return !outLayout.some(ol => ol == state.name); + } }; this.$transitions.onStart(criteria, transition => { if (this.loggedIn) diff --git a/front/core/services/date.js b/front/core/services/date.js new file mode 100644 index 000000000..120297951 --- /dev/null +++ b/front/core/services/date.js @@ -0,0 +1,2 @@ +import * as date from 'vn-loopback/server/boot/date'; +date.default(); diff --git a/front/core/services/email.js b/front/core/services/email.js index 633b13a26..02aa9051b 100644 --- a/front/core/services/email.js +++ b/front/core/services/email.js @@ -10,24 +10,12 @@ class Email { /** * Sends an email displaying a notification when it's sent. * - * @param {String} template The email report name + * @param {String} path The email report name * @param {Object} params The email parameters * @return {Promise} Promise resolved when it's sent */ - send(template, params) { - return this.$http.get(`email/${template}`, {params}) - .then(() => this.vnApp.showMessage(this.$t('Notification sent!'))); - } - - /** - * Sends an email displaying a notification when it's sent. - * - * @param {String} template The email report name - * @param {Object} params The email parameters - * @return {Promise} Promise resolved when it's sent - */ - sendCsv(template, params) { - return this.$http.get(`csv/${template}/send`, {params}) + send(path, params) { + return this.$http.post(path, params) .then(() => this.vnApp.showMessage(this.$t('Notification sent!'))); } } diff --git a/front/core/services/index.js b/front/core/services/index.js index ff1d438ed..867a13df0 100644 --- a/front/core/services/index.js +++ b/front/core/services/index.js @@ -10,3 +10,4 @@ import './week-days'; import './report'; import './email'; import './file'; +import './date'; diff --git a/front/core/services/interceptor.js b/front/core/services/interceptor.js index b7cf3a0ec..3f3d9912b 100644 --- a/front/core/services/interceptor.js +++ b/front/core/services/interceptor.js @@ -30,14 +30,17 @@ function interceptor($q, vnApp, vnToken, $translate) { }, response(response) { vnApp.popLoader(); + const newVersion = response.headers('salix-version'); + vnApp.setVersion(newVersion); + return response; }, responseError(rejection) { vnApp.popLoader(); - let err = new HttpError(rejection.statusText); + const err = new HttpError(rejection.statusText); Object.assign(err, rejection); return $q.reject(err); - } + }, }; } ngModule.factory('vnInterceptor', interceptor); diff --git a/front/core/services/modules.js b/front/core/services/modules.js index 4b0d93b76..0b9f8409f 100644 --- a/front/core/services/modules.js +++ b/front/core/services/modules.js @@ -29,6 +29,7 @@ export default class Modules { const module = { name: mod.name || mod.module, + code: mod.module, icon: mod.icon || null, route, keyBind diff --git a/front/core/services/report.js b/front/core/services/report.js index c58a0ee0e..d6eb28ea4 100644 --- a/front/core/services/report.js +++ b/front/core/services/report.js @@ -10,30 +10,16 @@ class Report { * Shows a report in another window, automatically adds the authorization * token to params. * - * @param {String} report The report name + * @param {String} path The report name * @param {Object} params The report parameters */ - show(report, params) { + show(path, params) { params = Object.assign({ - authorization: this.vnToken.token + access_token: this.vnToken.token }, params); const serializedParams = this.$httpParamSerializer(params); - window.open(`api/report/${report}?${serializedParams}`); - } - - /** - * Shows a report in another window, automatically adds the authorization - * token to params. - * - * @param {String} report The report name - * @param {Object} params The report parameters - */ - showCsv(report, params) { - params = Object.assign({ - authorization: this.vnToken.token - }, params); - const serializedParams = this.$httpParamSerializer(params); - window.open(`api/csv/${report}/download?${serializedParams}`); + const query = serializedParams ? `?${serializedParams}` : ''; + window.open(`api/${path}${query}`); } } Report.$inject = ['$httpParamSerializer', 'vnToken']; diff --git a/front/core/styles/fonts/MaterialIcons-Regular.woff2 b/front/core/styles/fonts/MaterialIcons-Regular.woff2 index 9d1dfcc70..2eb4fb499 100644 Binary files a/front/core/styles/fonts/MaterialIcons-Regular.woff2 and b/front/core/styles/fonts/MaterialIcons-Regular.woff2 differ diff --git a/front/core/styles/icons/salixfont.css b/front/core/styles/icons/salixfont.css index c500f976d..6f9b1fe15 100644 --- a/front/core/styles/icons/salixfont.css +++ b/front/core/styles/icons/salixfont.css @@ -32,6 +32,9 @@ .icon-100:before { content: "\e95a"; } +.icon-clientUnpaid:before { + content: "\e95b"; +} .icon-history:before { content: "\e968"; } @@ -337,15 +340,15 @@ .icon-solunion:before { content: "\e94e"; } +.icon-stowaway:before { + content: "\e94f"; +} .icon-splitline:before { content: "\e93e"; } .icon-splur:before { content: "\e970"; } -.icon-stowaway:before { - content: "\e94f"; -} .icon-supplier:before { content: "\e925"; } diff --git a/front/core/styles/icons/salixfont.eot b/front/core/styles/icons/salixfont.eot index 48cc86413..61a3be8b7 100644 Binary files a/front/core/styles/icons/salixfont.eot and b/front/core/styles/icons/salixfont.eot differ diff --git a/front/core/styles/icons/salixfont.svg b/front/core/styles/icons/salixfont.svg index 2b8b1ac8a..d6bfd5d74 100644 --- a/front/core/styles/icons/salixfont.svg +++ b/front/core/styles/icons/salixfont.svg @@ -82,7 +82,7 @@ - + @@ -98,6 +98,7 @@ + @@ -130,4 +131,4 @@ - \ No newline at end of file + diff --git a/front/core/styles/icons/salixfont.ttf b/front/core/styles/icons/salixfont.ttf index 4b090731c..89d3bd57d 100644 Binary files a/front/core/styles/icons/salixfont.ttf and b/front/core/styles/icons/salixfont.ttf differ diff --git a/front/core/styles/icons/salixfont.woff b/front/core/styles/icons/salixfont.woff index 502fed118..bfc9e075d 100644 Binary files a/front/core/styles/icons/salixfont.woff and b/front/core/styles/icons/salixfont.woff differ diff --git a/front/core/styles/variables.scss b/front/core/styles/variables.scss index c79a8590f..c280838ca 100644 --- a/front/core/styles/variables.scss +++ b/front/core/styles/variables.scss @@ -2,6 +2,7 @@ $font-size: 11pt; $menu-width: 256px; +$right-menu-width: 318px; $topbar-height: 56px; $mobile-width: 800px; $float-spacing: 20px; @@ -101,6 +102,8 @@ $color-marginal: #222; $color-success: #a3d131; $color-notice: #32b1ce; $color-alert: #fa3939; +$color-pink: #ff99cc; +$color-yellow: #ffff00; $color-button: $color-secondary; $color-spacer: rgba(255, 255, 255, .3); diff --git a/front/module-import.js b/front/module-import.js index ab1eb73d6..bc547deeb 100755 --- a/front/module-import.js +++ b/front/module-import.js @@ -21,6 +21,7 @@ export default function moduleImport(moduleName) { case 'entry' : return import('entry/front'); case 'account' : return import('account/front'); case 'supplier' : return import('supplier/front'); + case 'shelving' : return import('shelving/front'); case 'monitor' : return import('monitor/front'); } } diff --git a/front/package-lock.json b/front/package-lock.json index a2f192f01..d0fe4de2d 100644 --- a/front/package-lock.json +++ b/front/package-lock.json @@ -1,78 +1,215 @@ { "name": "salix-front", "version": "1.0.0", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "salix-front", + "version": "1.0.0", + "license": "GPL-3.0", + "dependencies": { + "@uirouter/angularjs": "^1.0.20", + "angular": "^1.7.5", + "angular-animate": "^1.7.8", + "angular-moment": "^1.3.0", + "angular-translate": "^2.18.1", + "angular-translate-loader-partial": "^2.18.1", + "croppie": "^2.6.5", + "js-yaml": "^3.13.1", + "mg-crud": "^1.1.2", + "oclazyload": "^0.6.3", + "require-yaml": "0.0.1", + "validator": "^6.3.0" + } + }, + "node_modules/@uirouter/angularjs": { + "version": "1.0.30", + "license": "MIT", + "dependencies": { + "@uirouter/core": "6.0.8" + }, + "engines": { + "node": ">=4.0.0" + }, + "peerDependencies": { + "angular": ">=1.2.0" + } + }, + "node_modules/@uirouter/core": { + "version": "6.0.8", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/angular": { + "version": "1.8.3", + "license": "MIT" + }, + "node_modules/angular-animate": { + "version": "1.8.2", + "license": "MIT" + }, + "node_modules/angular-moment": { + "version": "1.3.0", + "license": "MIT", + "dependencies": { + "moment": ">=2.8.0 <3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/angular-translate": { + "version": "2.19.0", + "license": "MIT", + "dependencies": { + "angular": "^1.8.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/angular-translate-loader-partial": { + "version": "2.19.0", + "license": "MIT", + "dependencies": { + "angular-translate": "~2.19.0" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/croppie": { + "version": "2.6.5", + "license": "MIT" + }, + "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/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/mg-crud": { + "version": "1.1.2", + "license": "MIT", + "dependencies": { + "angular": "^1.6.1" + } + }, + "node_modules/moment": { + "version": "2.29.4", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/oclazyload": { + "version": "0.6.3", + "license": "MIT" + }, + "node_modules/require-yaml": { + "version": "0.0.1", + "license": "BSD", + "dependencies": { + "js-yaml": "" + } + }, + "node_modules/require-yaml/node_modules/argparse": { + "version": "2.0.1", + "license": "Python-2.0" + }, + "node_modules/require-yaml/node_modules/js-yaml": { + "version": "4.1.0", + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "license": "BSD-3-Clause" + }, + "node_modules/validator": { + "version": "6.3.0", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + } + }, "dependencies": { "@uirouter/angularjs": { - "version": "1.0.29", - "resolved": "https://registry.npmjs.org/@uirouter/angularjs/-/angularjs-1.0.29.tgz", - "integrity": "sha512-RImWnBarNixkMto0o8stEaGwZmvhv5cnuOLXyMU2pY8MP2rgEF74ZNJTLeJCW14LR7XDUxVH8Mk8bPI6lxedmQ==", + "version": "1.0.30", "requires": { - "@uirouter/core": "6.0.7" + "@uirouter/core": "6.0.8" } }, "@uirouter/core": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/@uirouter/core/-/core-6.0.7.tgz", - "integrity": "sha512-KUTJxL+6q0PiBnFx4/Z+Hsyg0pSGiaW5yZQeJmUxknecjpTbnXkLU8H2EqRn9N2B+qDRa7Jg8RcgeNDPY72O1w==" + "version": "6.0.8" }, "angular": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/angular/-/angular-1.8.2.tgz", - "integrity": "sha512-IauMOej2xEe7/7Ennahkbb5qd/HFADiNuLSESz9Q27inmi32zB0lnAsFeLEWcox3Gd1F6YhNd1CP7/9IukJ0Gw==" + "version": "1.8.3" }, "angular-animate": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/angular-animate/-/angular-animate-1.8.2.tgz", - "integrity": "sha512-Jbr9+grNMs9Kj57xuBU3Ju3NOPAjS1+g2UAwwDv7su1lt0/PLDy+9zEwDiu8C8xJceoTbmBNKiWGPJGBdCQLlA==" + "version": "1.8.2" }, "angular-moment": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/angular-moment/-/angular-moment-1.3.0.tgz", - "integrity": "sha512-KG8rvO9MoaBLwtGnxTeUveSyNtrL+RNgGl1zqWN36+HDCCVGk2DGWOzqKWB6o+eTTbO3Opn4hupWKIElc8XETA==", "requires": { "moment": ">=2.8.0 <3.0.0" } }, "angular-translate": { - "version": "2.18.4", - "resolved": "https://registry.npmjs.org/angular-translate/-/angular-translate-2.18.4.tgz", - "integrity": "sha512-KohNrkH6J9PK+VW0L/nsRTcg5Fw70Ajwwe3Jbfm54Pf9u9Fd+wuingoKv+h45mKf38eT+Ouu51FPua8VmZNoCw==", + "version": "2.19.0", "requires": { "angular": "^1.8.0" } }, "angular-translate-loader-partial": { - "version": "2.18.4", - "resolved": "https://registry.npmjs.org/angular-translate-loader-partial/-/angular-translate-loader-partial-2.18.4.tgz", - "integrity": "sha512-bsjR+FbB0sdA2528E/ugwKdlPPQhA1looxLxI3otayBTFXBpED33besfSZhYAISLgNMSL038vSssfRUen9qD8w==", + "version": "2.19.0", "requires": { - "angular-translate": "~2.18.4" + "angular-translate": "~2.19.0" } }, "argparse": { "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "requires": { "sprintf-js": "~1.0.2" } }, "croppie": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/croppie/-/croppie-2.6.5.tgz", - "integrity": "sha512-IlChnVUGG5T3w2gRZIaQgBtlvyuYnlUWs2YZIXXR3H9KrlO1PtBT3j+ykxvy9eZIWhk+V5SpBmhCQz5UXKrEKQ==" + "version": "2.6.5" }, "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + "version": "4.0.1" }, "js-yaml": { "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -80,39 +217,27 @@ }, "mg-crud": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/mg-crud/-/mg-crud-1.1.2.tgz", - "integrity": "sha1-p6AWGzWSPK7/8ZpIBpS2V1vDggw=", "requires": { "angular": "^1.6.1" } }, "moment": { - "version": "2.29.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", - "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" + "version": "2.29.4" }, "oclazyload": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/oclazyload/-/oclazyload-0.6.3.tgz", - "integrity": "sha1-Kjirv/QJDAihEBZxkZRbWfLoJ5w=" + "version": "0.6.3" }, "require-yaml": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/require-yaml/-/require-yaml-0.0.1.tgz", - "integrity": "sha1-LhsY2RPDuqcqWk03O28Tjd0sMr0=", "requires": { - "js-yaml": "^4.1.0" + "js-yaml": "" }, "dependencies": { "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + "version": "2.0.1" }, "js-yaml": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "requires": { "argparse": "^2.0.1" } @@ -120,14 +245,10 @@ } }, "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + "version": "1.0.3" }, "validator": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-6.3.0.tgz", - "integrity": "sha1-R84j7Y1Ord+p1LjvAHG2zxB418g=" + "version": "6.3.0" } } } diff --git a/front/salix/components/app/app.html b/front/salix/components/app/app.html index d32c9f68b..d6169308a 100644 --- a/front/salix/components/app/app.html +++ b/front/salix/components/app/app.html @@ -1,9 +1,3 @@ - - - - + diff --git a/front/salix/components/app/app.js b/front/salix/components/app/app.js index 1f8cdb46e..97384d1e1 100644 --- a/front/salix/components/app/app.js +++ b/front/salix/components/app/app.js @@ -9,13 +9,14 @@ import Component from 'core/lib/component'; * @property {SideMenu} rightMenu The left menu, if it's present */ export default class App extends Component { - $postLink() { - this.vnApp.logger = this; + constructor($element, $, $location, $state) { + super($element, $, $location, $state); + this.$location = $location; + this.$state = $state; } - get showLayout() { - let state = this.$state.current.name; - return state && state != 'login'; + $postLink() { + this.vnApp.logger = this; } $onDestroy() { diff --git a/front/salix/components/home/home.js b/front/salix/components/home/home.js index 7a36e1d42..144a1c6d0 100644 --- a/front/salix/components/home/home.js +++ b/front/salix/components/home/home.js @@ -33,7 +33,9 @@ export default class Controller extends Component { if (!res.data.length) return; for (let starredModule of res.data) { - const module = this.modules.find(mod => mod.name === starredModule.moduleFk); + let moduleName = starredModule.moduleFk; + if (moduleName === 'customer') moduleName = 'client'; + const module = this.modules.find(mod => mod.code === moduleName); if (module) { module.starred = true; module.position = starredModule.position; @@ -47,8 +49,10 @@ export default class Controller extends Component { if (event.defaultPrevented) return; event.preventDefault(); event.stopPropagation(); + let moduleName = module.code; + if (moduleName === 'client') moduleName = 'customer'; - const params = {moduleName: module.name}; + const params = {moduleName}; const query = `starredModules/toggleStarredModule`; this.$http.post(query, params).then(res => { if (res.data) { @@ -84,13 +88,16 @@ export default class Controller extends Component { event.preventDefault(); event.stopPropagation(); - const params = {moduleName: module.name, direction: direction}; + let moduleName = module.code; + if (moduleName === 'client') moduleName = 'customer'; + + const params = {moduleName: moduleName, direction: direction}; const query = `starredModules/setPosition`; this.$http.post(query, params).then(res => { if (res.data) { module.position = res.data.movingModule.position; this.modules.forEach(mod => { - if (mod.name == res.data.pushedModule.moduleFk) + if (mod.code == res.data.pushedModule.moduleFk) mod.position = res.data.pushedModule.position; }); this.vnApp.showSuccess(this.$t('Data saved!')); diff --git a/front/salix/components/home/home.spec.js b/front/salix/components/home/home.spec.js index 4a8a58a55..5559ca1d4 100644 --- a/front/salix/components/home/home.spec.js +++ b/front/salix/components/home/home.spec.js @@ -19,7 +19,7 @@ describe('Salix Component vnHome', () => { describe('getStarredModules()', () => { it('should not set any of the modules as starred if there are no starred modules for the user', () => { const expectedResponse = []; - controller._modules = [{module: 'client', name: 'Clients'}]; + controller._modules = [{code: 'client', name: 'Clients'}]; $httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(expectedResponse); $httpBackend.expectGET('starredModules/getStarredModules').respond(expectedResponse); @@ -31,8 +31,8 @@ describe('Salix Component vnHome', () => { }); it('should set the example module as starred since its the starred module for the user', () => { - const expectedResponse = [{id: 1, moduleFk: 'Clients', workerFk: 9}]; - controller._modules = [{module: 'client', name: 'Clients'}]; + const expectedResponse = [{id: 1, moduleFk: 'customer', workerFk: 9}]; + controller._modules = [{code: 'client', name: 'Clients'}]; $httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(expectedResponse); $httpBackend.expectGET('starredModules/getStarredModules').respond(expectedResponse); @@ -48,7 +48,7 @@ describe('Salix Component vnHome', () => { it(`should set the received module as starred if it wasn't starred`, () => { const expectedResponse = [{id: 1, moduleFk: 'Clients', workerFk: 9}]; const event = new Event('target'); - controller._modules = [{module: 'client', name: 'Clients'}]; + controller._modules = [{code: 'client', name: 'Clients'}]; $httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(expectedResponse); $httpBackend.expectPOST('starredModules/toggleStarredModule').respond(expectedResponse); @@ -61,7 +61,7 @@ describe('Salix Component vnHome', () => { it('should set the received module as regular if it was starred', () => { const event = new Event('target'); - controller._modules = [{module: 'client', name: 'Clients', starred: true}]; + controller._modules = [{code: 'client', name: 'Clients', starred: true}]; $httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond([]); $httpBackend.expectPOST('starredModules/toggleStarredModule').respond(undefined); @@ -76,18 +76,18 @@ describe('Salix Component vnHome', () => { describe('moveModule()', () => { it('should perform a query to setPosition and the apply the position to the moved and pushed modules', () => { const starredModules = [ - {id: 1, moduleFk: 'Clients', workerFk: 9}, - {id: 2, moduleFk: 'Orders', workerFk: 9} + {id: 1, moduleFk: 'customer', workerFk: 9}, + {id: 2, moduleFk: 'order', workerFk: 9} ]; const movedModules = { - movingModule: {position: 2, moduleFk: 'Clients'}, - pushedModule: {position: 1, moduleFk: 'Orders'} + movingModule: {position: 2, moduleFk: 'customer'}, + pushedModule: {position: 1, moduleFk: 'order'} }; const event = new Event('target'); controller._modules = [ - {module: 'client', name: 'Clients', position: 1}, - {module: 'orders', name: 'Orders', position: 2} + {code: 'client', name: 'Clients', position: 1}, + {code: 'order', name: 'Orders', position: 2} ]; $httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(starredModules); diff --git a/front/salix/components/index.js b/front/salix/components/index.js index ce4ad585a..8f5724862 100644 --- a/front/salix/components/index.js +++ b/front/salix/components/index.js @@ -5,7 +5,10 @@ import './descriptor-popover'; import './home/home'; import './layout'; import './left-menu/left-menu'; -import './login/login'; +import './login'; +import './outLayout'; +import './recover-password'; +import './reset-password'; import './module-card'; import './module-main'; import './side-menu/side-menu'; @@ -16,3 +19,5 @@ import './user-popover'; import './upload-photo'; import './bank-entity'; import './log'; +import './instance-log'; +import './sendSms'; diff --git a/front/salix/components/instance-log/index.html b/front/salix/components/instance-log/index.html new file mode 100644 index 000000000..9794f75c2 --- /dev/null +++ b/front/salix/components/instance-log/index.html @@ -0,0 +1,12 @@ + + + + + + diff --git a/front/salix/components/instance-log/index.js b/front/salix/components/instance-log/index.js new file mode 100644 index 000000000..6d8497c2d --- /dev/null +++ b/front/salix/components/instance-log/index.js @@ -0,0 +1,21 @@ +import ngModule from '../../module'; +import Section from '../section'; +import './style.scss'; + +export default class Controller extends Section { + open() { + this.$.instanceLog.show(); + } +} + +ngModule.vnComponent('vnInstanceLog', { + controller: Controller, + template: require('./index.html'), + bindings: { + model: '<', + originId: '<', + changedModelId: '<', + changedModel: '@', + url: '@' + } +}); diff --git a/front/salix/components/instance-log/style.scss b/front/salix/components/instance-log/style.scss new file mode 100644 index 000000000..f355e0ac8 --- /dev/null +++ b/front/salix/components/instance-log/style.scss @@ -0,0 +1,9 @@ +vn-log.vn-instance-log { + vn-card { + width: 900px; + visibility: hidden; + & > * { + visibility: visible; + } + } +} diff --git a/front/salix/components/layout/index.html b/front/salix/components/layout/index.html index cd13c565e..5a525ef77 100644 --- a/front/salix/components/layout/index.html +++ b/front/salix/components/layout/index.html @@ -19,6 +19,14 @@
+ + -
diff --git a/front/salix/components/layout/index.js b/front/salix/components/layout/index.js index 986f61622..372e8e828 100644 --- a/front/salix/components/layout/index.js +++ b/front/salix/components/layout/index.js @@ -26,6 +26,10 @@ export class Layout extends Component { const token = this.vnToken.token; return `/api/Images/user/160x160/${userId}/download?access_token=${token}`; } + + refresh() { + window.location.reload(); + } } Layout.$inject = ['$element', '$scope', 'vnModules']; diff --git a/front/salix/components/layout/style.scss b/front/salix/components/layout/style.scss index 36522bc3a..6697bb1b0 100644 --- a/front/salix/components/layout/style.scss +++ b/front/salix/components/layout/style.scss @@ -60,6 +60,9 @@ vn-layout { font-size: 1.05rem; padding: 0; } + .vn-icon-button.refresh { + color: $color-alert; + } } & > vn-side-menu > .menu { display: flex; @@ -85,13 +88,13 @@ vn-layout { } &.right-menu { & > vn-topbar > .end { - width: 80px + $menu-width; + width: 80px + $right-menu-width; } & > .main-view { - padding-right: $menu-width; + padding-right: $right-menu-width; } [fixed-bottom-right] { - right: $menu-width; + right: $right-menu-width; } } & > .main-view { diff --git a/front/salix/components/log/index.html b/front/salix/components/log/index.html index 0a0449038..79dfcef8c 100644 --- a/front/salix/components/log/index.html +++ b/front/salix/components/log/index.html @@ -1,10 +1,12 @@ - @@ -13,81 +15,53 @@ Date - Author - Model - Action - Name - Before - After + User + Model + Action + Name + Changes {{::log.creationDate | date:'dd/MM/yyyy HH:mm'}} -
-
- Changed by: - {{::log.user.name || 'System' | translate}} - -
-
- Model: - {{::log.changedModel | dashIfEmpty}} -
-
- Action: - {{::$ctrl.actionsText[log.action] | dashIfEmpty}} -
-
- Name: - {{::log.changedModelValue | dashIfEmpty}} -
-
- + {{::log.user.name || 'System' | translate}} - + {{::log.changedModel}} - + {{::$ctrl.actionsText[log.action]}} - + {{::log.changedModelValue}} - - -
- - -
-
-
- - -
- - -
-
- -
- {{::log.description}} -
-
+ + + + + + + + + + + + + + + + +
FieldBeforeAfter
{{prop.name}}{{prop.old}}{{prop.new}}
+
+ {{::log.description}} +
@@ -96,4 +70,4 @@
- \ No newline at end of file + diff --git a/front/salix/components/log/index.js b/front/salix/components/log/index.js index c5a4febcc..1c54aa9b8 100644 --- a/front/salix/components/log/index.js +++ b/front/salix/components/log/index.js @@ -2,15 +2,17 @@ import ngModule from '../../module'; import Section from '../section'; import './style.scss'; +const validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/; + export default class Controller extends Section { constructor($element, $) { super($element, $); this.actionsText = { - 'insert': 'Creates', - 'update': 'Updates', - 'delete': 'Deletes', - 'select': 'Views' - }; ``; + insert: 'Creates', + update: 'Updates', + delete: 'Deletes', + select: 'Views' + }; this.filter = { include: [{ relation: 'user', @@ -33,29 +35,57 @@ export default class Controller extends Section { set logs(value) { this._logs = value; + if (!this.logs) return; + const empty = {}; + const validations = window.validations; + for (const log of value) { + const oldValues = log.oldInstance || empty; + const newValues = log.newInstance || empty; + const locale = validations[log.changedModel]?.locale || empty; - if (this.logs) { - this.logs.forEach(log => { - log.oldProperties = this.getInstance(log.oldInstance); - log.newProperties = this.getInstance(log.newInstance); - }); + let props = Object.keys(oldValues).concat(Object.keys(newValues)); + props = [...new Set(props)]; + + log.props = []; + for (const prop of props) { + log.props.push({ + name: locale[prop] || prop, + old: this.formatValue(oldValues[prop]), + new: this.formatValue(newValues[prop]) + }); + } } } - getInstance(instance) { - const properties = []; - let validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/; + get showModelName() { + return !(this.changedModel && this.changedModelId); + } - if (typeof instance == 'object' && instance != null) { - Object.keys(instance).forEach(property => { - if (validDate.test(instance[property])) - instance[property] = new Date(instance[property]).toLocaleString('es-ES'); + formatValue(value) { + let type = typeof value; - properties.push({key: property, value: instance[property]}); - }); - return properties; + if (type === 'string' && validDate.test(value)) { + value = new Date(value); + type = typeof value; + } + + switch (type) { + case 'boolean': + return value ? '✓' : '✗'; + case 'object': + if (value instanceof Date) { + const hasZeroTime = + value.getHours() === 0 && + value.getMinutes() === 0 && + value.getSeconds() === 0; + const format = hasZeroTime ? 'dd/MM/yyyy' : 'dd/MM/yyyy HH:mm:ss'; + return this.$filter('date')(value, format); + } + else + return value; + default: + return value; } - return null; } showWorkerDescriptor(event, workerId) { @@ -70,6 +100,8 @@ ngModule.vnComponent('vnLog', { bindings: { model: '<', originId: '<', + changedModel: ' td { + padding: 2px; + } + & > td.field, + & > th.field { + width: 20%; + color: gray; + } + & > td.before, + & > th.before, + & > td.after, + & > th.after { + width: 40%; + white-space: pre-line; + } + } + } } .ellipsis { white-space: nowrap; @@ -40,4 +63,4 @@ vn-log { .alignSpan { overflow: hidden; display: inline-block; -} \ No newline at end of file +} diff --git a/front/salix/components/login/index.html b/front/salix/components/login/index.html new file mode 100644 index 000000000..963c23061 --- /dev/null +++ b/front/salix/components/login/index.html @@ -0,0 +1,27 @@ + + + + + + + diff --git a/front/salix/components/login/login.js b/front/salix/components/login/index.js similarity index 96% rename from front/salix/components/login/login.js rename to front/salix/components/login/index.js index b5f8c1e7d..150e896a1 100644 --- a/front/salix/components/login/login.js +++ b/front/salix/components/login/index.js @@ -38,6 +38,6 @@ export default class Controller { Controller.$inject = ['$scope', '$element', 'vnAuth']; ngModule.vnComponent('vnLogin', { - template: require('./login.html'), + template: require('./index.html'), controller: Controller }); diff --git a/front/salix/components/login/locale/en.yml b/front/salix/components/login/locale/en.yml deleted file mode 100644 index c59a6dd8e..000000000 --- a/front/salix/components/login/locale/en.yml +++ /dev/null @@ -1,4 +0,0 @@ -User: User -Password: Password -Do not close session: Do not close session -Enter: Enter \ No newline at end of file diff --git a/front/salix/components/login/locale/es.yml b/front/salix/components/login/locale/es.yml index 9c9ba5905..c34861bfb 100644 --- a/front/salix/components/login/locale/es.yml +++ b/front/salix/components/login/locale/es.yml @@ -1,4 +1,5 @@ User: Usuario Password: Contraseña Do not close session: No cerrar sesión -Enter: Entrar \ No newline at end of file +Enter: Entrar +I do not remember my password: No recuerdo mi contraseña diff --git a/front/salix/components/login/login.html b/front/salix/components/login/login.html deleted file mode 100644 index b15714a23..000000000 --- a/front/salix/components/login/login.html +++ /dev/null @@ -1,27 +0,0 @@ -
- -
- - - - - - - -
-
diff --git a/front/salix/components/login/style.scss b/front/salix/components/login/style.scss index 8ebf2a68c..f13c9cf86 100644 --- a/front/salix/components/login/style.scss +++ b/front/salix/components/login/style.scss @@ -1,74 +1,24 @@ @import "variables"; -vn-login { - position: absolute; - height: 100%; - width: 100%; - margin: 0; - padding: 0; - color: $color-font; - font-size: 1.1rem; - font-weight: normal; - background-color: $color-bg-dark; - display: flex; - justify-content: center; - align-items: center; - overflow: auto; +vn-login{ + .footer { + margin-top: 32px; + text-align: center; + position: relative; + & > .vn-submit { + display: block; - & > .box { - box-sizing: border-box; - position: absolute; - max-width: 304px; - min-width: 240px; - padding: 48px; - background-color: $color-bg-panel; - box-shadow: 0 0 16px 0 rgba(0, 0, 0, .6); - border-radius: 8px; - - & > img { - width: 100%; - padding-bottom: 16px; - } - & > form { - & > .vn-textfield { - width: 100%; - } - & > .vn-check { - display: block; - .md-label { - white-space: inherit; - } - } - & > .footer { - margin-top: 32px; - text-align: center; - position: relative; - - & > vn-submit { - display: block; - - & > input { - display: block; - width: 100%; - } - } - & > .spinner-wrapper { - position: absolute; - width: 0; - top: 3px; - right: -8px; - overflow: visible; - } - } - } - } - - @media screen and (max-width: 600px) { - background-color: $color-bg-panel; - - & > .box { - padding: 16px; - box-shadow: none; - } - } + & > input { + display: block; + width: 100%; + } + } + & > .spinner-wrapper { + position: absolute; + width: 0; + top: 3px; + right: -8px; + overflow: visible; + } + } } diff --git a/front/salix/components/outLayout/index.html b/front/salix/components/outLayout/index.html new file mode 100644 index 000000000..186979f8c --- /dev/null +++ b/front/salix/components/outLayout/index.html @@ -0,0 +1,6 @@ +
+ +
+ +
+
diff --git a/front/salix/components/outLayout/index.js b/front/salix/components/outLayout/index.js new file mode 100644 index 000000000..f0e21fa29 --- /dev/null +++ b/front/salix/components/outLayout/index.js @@ -0,0 +1,16 @@ +import ngModule from '../../module'; +import Component from 'core/lib/component'; +import './style.scss'; + +export default class OutLayout extends Component { + constructor($element, $scope) { + super($element, $scope); + } +} + +OutLayout.$inject = ['$element', '$scope']; + +ngModule.vnComponent('vnOutLayout', { + template: require('./index.html'), + controller: OutLayout +}); diff --git a/front/salix/components/login/logo.svg b/front/salix/components/outLayout/logo.svg similarity index 100% rename from front/salix/components/login/logo.svg rename to front/salix/components/outLayout/logo.svg diff --git a/front/salix/components/outLayout/style.scss b/front/salix/components/outLayout/style.scss new file mode 100644 index 000000000..aa94fefb3 --- /dev/null +++ b/front/salix/components/outLayout/style.scss @@ -0,0 +1,67 @@ +@import "variables"; + +vn-out-layout{ + position: absolute; + height: 100%; + width: 100%; + margin: 0; + padding: 0; + color: $color-font; + font-size: 1.1rem; + font-weight: normal; + background-color: $color-bg-dark; + display: flex; + justify-content: center; + align-items: center; + overflow: auto; + + & > .box { + box-sizing: border-box; + position: absolute; + max-width: 304px; + min-width: 240px; + padding: 48px; + background-color: $color-bg-panel; + box-shadow: 0 0 16px 0 rgba(0, 0, 0, .6); + border-radius: 8px; + + & > img { + width: 100%; + padding-bottom: 16px; + } + & > form { + & > .vn-textfield { + width: 100%; + } + & > .vn-check { + display: block; + .md-label { + white-space: inherit; + } + } + } + + h5{ + color: $color-primary; + } + + .text-secondary{ + text-align: center; + padding-bottom: 16px; + } + + } + + @media screen and (max-width: 600px) { + background-color: $color-bg-panel; + + & > .box { + padding: 16px; + box-shadow: none; + } + } + + a{ + color: $color-primary; + } +} diff --git a/front/salix/components/recover-password/index.html b/front/salix/components/recover-password/index.html new file mode 100644 index 000000000..5121f81bd --- /dev/null +++ b/front/salix/components/recover-password/index.html @@ -0,0 +1,17 @@ +
Recover password
+ + +
+ We will sent you an email to recover your password +
+ diff --git a/front/salix/components/recover-password/index.js b/front/salix/components/recover-password/index.js new file mode 100644 index 000000000..a3f26ec64 --- /dev/null +++ b/front/salix/components/recover-password/index.js @@ -0,0 +1,37 @@ +import ngModule from '../../module'; +import './style.scss'; + +export default class Controller { + constructor($scope, $element, $http, vnApp, $translate, $state) { + Object.assign(this, { + $scope, + $element, + $http, + vnApp, + $translate, + $state + }); + } + + goToLogin() { + this.vnApp.showSuccess(this.$translate.instant('Notification sent!')); + this.$state.go('login'); + } + + submit() { + const params = { + user: this.user + }; + + this.$http.post('Accounts/recoverPassword', params) + .then(() => { + this.goToLogin(); + }); + } +} +Controller.$inject = ['$scope', '$element', '$http', 'vnApp', '$translate', '$state']; + +ngModule.vnComponent('vnRecoverPassword', { + template: require('./index.html'), + controller: Controller +}); diff --git a/front/salix/components/recover-password/locale/es.yml b/front/salix/components/recover-password/locale/es.yml new file mode 100644 index 000000000..69777fa65 --- /dev/null +++ b/front/salix/components/recover-password/locale/es.yml @@ -0,0 +1,4 @@ +Recover password: Recuperar contraseña +We will sent you an email to recover your password: Te enviaremos un correo para restablecer tu contraseña +Notification sent!: ¡Notificación enviada! +User or recovery email: Usuario o correo de recuperación diff --git a/front/salix/components/recover-password/style.scss b/front/salix/components/recover-password/style.scss new file mode 100644 index 000000000..d3c6f594e --- /dev/null +++ b/front/salix/components/recover-password/style.scss @@ -0,0 +1,24 @@ +@import "variables"; + +vn-recover-password{ + .footer { + margin-top: 32px; + text-align: center; + position: relative; + & > .vn-submit { + display: block; + + & > input { + display: block; + width: 100%; + } + } + & > .spinner-wrapper { + position: absolute; + width: 0; + top: 3px; + right: -8px; + overflow: visible; + } + } +} diff --git a/front/salix/components/reset-password/index.html b/front/salix/components/reset-password/index.html new file mode 100644 index 000000000..bdbdc113e --- /dev/null +++ b/front/salix/components/reset-password/index.html @@ -0,0 +1,19 @@ +
Reset password
+ + + + + diff --git a/front/salix/components/reset-password/index.js b/front/salix/components/reset-password/index.js new file mode 100644 index 000000000..20c6c34fe --- /dev/null +++ b/front/salix/components/reset-password/index.js @@ -0,0 +1,48 @@ +import ngModule from '../../module'; +import './style.scss'; + +export default class Controller { + constructor($scope, $element, $http, vnApp, $translate, $state, $location) { + Object.assign(this, { + $scope, + $element, + $http, + vnApp, + $translate, + $state, + $location + }); + } + + $onInit() { + this.$http.get('UserPasswords/findOne') + .then(res => { + this.passRequirements = res.data; + }); + } + + submit() { + if (!this.newPassword) + throw new UserError(`You must enter a new password`); + if (this.newPassword != this.repeatPassword) + throw new UserError(`Passwords don't match`); + + const headers = { + Authorization: this.$location.$$search.access_token + }; + + const newPassword = this.newPassword; + + this.$http.post('users/reset-password', {newPassword}, {headers}) + .then(() => { + this.vnApp.showSuccess(this.$translate.instant('Password changed!')); + this.$state.go('login'); + }); + } +} +Controller.$inject = ['$scope', '$element', '$http', 'vnApp', '$translate', '$state', '$location']; + +ngModule.vnComponent('vnResetPassword', { + template: require('./index.html'), + controller: Controller +}); diff --git a/front/salix/components/reset-password/locale/en.yml b/front/salix/components/reset-password/locale/en.yml new file mode 100644 index 000000000..e5419e1c8 --- /dev/null +++ b/front/salix/components/reset-password/locale/en.yml @@ -0,0 +1,4 @@ +Password requirements: > + The password must have at least {{ length }} length characters, + {{nAlpha}} alphabetic characters, {{nUpper}} capital letters, {{nDigits}} + digits and {{nPunct}} symbols (Ex: $%&.) diff --git a/front/salix/components/reset-password/locale/es.yml b/front/salix/components/reset-password/locale/es.yml new file mode 100644 index 000000000..30893a152 --- /dev/null +++ b/front/salix/components/reset-password/locale/es.yml @@ -0,0 +1,8 @@ +Reset password: Restrablecer contraseña +New password: Nueva contraseña +Repeat password: Repetir contraseña +Password changed!: ¡Contraseña cambiada! +Password requirements: > + La contraseña debe tener al menos {{ length }} caracteres de longitud, + {{nAlpha}} caracteres alfabéticos, {{nUpper}} letras mayúsculas, {{nDigits}} + dígitos y {{nPunct}} símbolos (Ej: $%&.) diff --git a/front/salix/components/reset-password/style.scss b/front/salix/components/reset-password/style.scss new file mode 100644 index 000000000..87e4adc8c --- /dev/null +++ b/front/salix/components/reset-password/style.scss @@ -0,0 +1,24 @@ +@import "variables"; + +vn-reset-password{ + .footer { + margin-top: 32px; + text-align: center; + position: relative; + & > .vn-submit { + display: block; + + & > input { + display: block; + width: 100%; + } + } + & > .spinner-wrapper { + position: absolute; + width: 0; + top: 3px; + right: -8px; + overflow: visible; + } + } +} diff --git a/modules/client/front/sms/index.html b/front/salix/components/sendSms/index.html similarity index 100% rename from modules/client/front/sms/index.html rename to front/salix/components/sendSms/index.html diff --git a/front/salix/components/sendSms/index.js b/front/salix/components/sendSms/index.js new file mode 100644 index 000000000..0947550b0 --- /dev/null +++ b/front/salix/components/sendSms/index.js @@ -0,0 +1,50 @@ +import ngModule from '../../module'; +import './style.scss'; +import Dialog from '../../../core/components/dialog'; + +export default class sendSmsDialog extends Dialog { + constructor($element, $scope, $http, $translate, vnApp) { + super($element, $scope, $http, $translate, vnApp); + + new CustomEvent('openSmsDialog', { + detail: { + this: this + } + }); + } + + open() { + this.$.SMSDialog.show(); + } + + charactersRemaining() { + const element = this.sms.message; + const maxLength = 160; + return maxLength - element.length; + } + + onResponse() { + try { + if (!this.sms.destination) + throw new Error(`The destination can't be empty`); + if (!this.sms.message) + throw new Error(`The message can't be empty`); + if (this.charactersRemaining() < 0) + throw new Error(`The message it's too long`); + + return this.onSend({$sms: this.sms}); + } catch (e) { + this.vnApp.showError(this.$t(e.message)); + return false; + } + } +} + +ngModule.vnComponent('vnSmsDialog', { + template: require('./index.html'), + controller: sendSmsDialog, + bindings: { + sms: '<', + onSend: '&', + } +}); diff --git a/modules/client/front/sms/locale/es.yml b/front/salix/components/sendSms/locale/es.yml similarity index 82% rename from modules/client/front/sms/locale/es.yml rename to front/salix/components/sendSms/locale/es.yml index 64c3fcca6..94ab8e588 100644 --- a/modules/client/front/sms/locale/es.yml +++ b/front/salix/components/sendSms/locale/es.yml @@ -1,7 +1,7 @@ Send SMS: Enviar SMS Destination: Destinatario Message: Mensaje -SMS sent!: ¡SMS enviado! +SMS sent: ¡SMS enviado! Characters remaining: Carácteres restantes The destination can't be empty: El destinatario no puede estar vacio The message can't be empty: El mensaje no puede estar vacio diff --git a/modules/client/front/sms/style.scss b/front/salix/components/sendSms/style.scss similarity index 100% rename from modules/client/front/sms/style.scss rename to front/salix/components/sendSms/style.scss diff --git a/front/salix/components/upload-photo/index.html b/front/salix/components/upload-photo/index.html index 9b64a380f..4422d8855 100644 --- a/front/salix/components/upload-photo/index.html +++ b/front/salix/components/upload-photo/index.html @@ -69,14 +69,6 @@ value-field="code"> - - - - diff --git a/front/salix/components/upload-photo/index.js b/front/salix/components/upload-photo/index.js index c47018307..da1fda923 100644 --- a/front/salix/components/upload-photo/index.js +++ b/front/salix/components/upload-photo/index.js @@ -64,8 +64,7 @@ export default class UploadPhoto extends Component { this.editor = null; this.newPhoto = { id: id, - collection: collection, - fileName: id + collection: collection }; this.$.dialog.show(); } @@ -197,7 +196,7 @@ export default class UploadPhoto extends Component { timeout: this.canceler.promise, transformRequest: ([file]) => { const formData = new FormData(); - const now = new Date(); + const now = Date.vnNew(); const timestamp = now.getTime(); const fileName = `${file.name}_${timestamp}`; diff --git a/front/salix/index.js b/front/salix/index.js index 5220f36f6..2488ef9b6 100644 --- a/front/salix/index.js +++ b/front/salix/index.js @@ -1,5 +1,5 @@ import './module'; import './routes'; import './components'; -import './services'; import './styles'; +import 'vn-loopback/server/boot/date'; diff --git a/front/salix/locale/es.yml b/front/salix/locale/es.yml index 4e93ae18e..bed41c63b 100644 --- a/front/salix/locale/es.yml +++ b/front/salix/locale/es.yml @@ -17,11 +17,13 @@ Go to module summary: Ir a la vista previa del módulo Show summary: Mostrar vista previa What is new: Novedades de la versión Settings: Ajustes +There is a new version, click here to reload: Hay una nueva versión, pulse aquí para recargar # Actions Back: Volver Save: Guardar +Assign: Asignar Create: Crear Send: Enviar Delete: Eliminar @@ -50,6 +52,7 @@ Entries: Entradas Users: Usuarios Suppliers: Proveedores Monitors: Monitores +Shelvings: Carros # Common diff --git a/front/salix/module.js b/front/salix/module.js index a8de61ae0..01df01a67 100644 --- a/front/salix/module.js +++ b/front/salix/module.js @@ -112,7 +112,7 @@ function $exceptionHandler(vnApp, $window, $state, $injector) { switch (exception.status) { case 401: - if ($state.current.name != 'login') { + if (!$state.current.name.includes('login')) { messageT = 'Session has expired'; let params = {continue: $window.location.hash}; $state.go('login', params); diff --git a/front/salix/routes.js b/front/salix/routes.js index 600907ff1..f32c143ef 100644 --- a/front/salix/routes.js +++ b/front/salix/routes.js @@ -3,17 +3,38 @@ import getMainRoute from 'core/lib/get-main-route'; config.$inject = ['$stateProvider', '$urlRouterProvider']; function config($stateProvider, $urlRouterProvider) { - $urlRouterProvider.otherwise('/'); + $urlRouterProvider + .otherwise('/'); $stateProvider + .state('layout', { + abstract: true, + template: '', + }) + .state('outLayout', { + abstract: true, + template: '', + }) .state('login', { + parent: 'outLayout', url: '/login?continue', description: 'Login', - views: { - login: {template: ''} - } + template: '' + }) + .state('recover-password', { + parent: 'outLayout', + url: '/recover-password', + description: 'Recover password', + template: '' + }) + .state('reset-password', { + parent: 'outLayout', + url: '/reset-password', + description: 'Reset password', + template: '' }) .state('home', { + parent: 'layout', url: '/', description: 'Home', template: '' @@ -44,6 +65,10 @@ function config($stateProvider, $urlRouterProvider) { }; if (route.abstract) configRoute.abstract = true; + + if (!route.state.includes('.')) + configRoute.parent = 'layout'; + if (route.routeParams) configRoute.params = route.routeParams; diff --git a/jest-front.js b/jest-front.js index 7a692f57c..eabda9110 100644 --- a/jest-front.js +++ b/jest-front.js @@ -13,6 +13,11 @@ import './modules/route/front/module.js'; import './modules/ticket/front/module.js'; import './modules/travel/front/module.js'; import './modules/worker/front/module.js'; +import './modules/shelving/front/module.js'; +import 'vn-loopback/server/boot/date'; + +// Set NODE_ENV +process.env.NODE_ENV = 'development'; core.run(vnInterceptor => { vnInterceptor.setApiPath(null); @@ -38,3 +43,4 @@ window.ngModule = function(moduleName, ...args) { return angular.mock.module(...fns); }; + diff --git a/jest.front.config.js b/jest.front.config.js index a03c61d11..3289df8bb 100644 --- a/jest.front.config.js +++ b/jest.front.config.js @@ -1,5 +1,6 @@ // For a detailed explanation regarding each configuration property, visit: // https://jestjs.io/docs/en/configuration.html +/* eslint max-len: ["error", { "code": 150 }]*/ module.exports = { name: 'front end', diff --git a/loopback/common/methods/application/post.js b/loopback/common/methods/application/post.js new file mode 100644 index 000000000..739f1341a --- /dev/null +++ b/loopback/common/methods/application/post.js @@ -0,0 +1,18 @@ +module.exports = Self => { + Self.remoteMethodCtx('post', { + description: 'Returns the sent parameters', + returns: { + type: 'object', + root: true + }, + http: { + path: `/post`, + verb: 'POST' + } + }); + + Self.post = async ctx => { + console.log(ctx.req.body); + return ctx.req.body; + }; +}; diff --git a/loopback/common/methods/schema/model-info.js b/loopback/common/methods/schema/model-info.js index a95b60627..6a4db033d 100644 --- a/loopback/common/methods/schema/model-info.js +++ b/loopback/common/methods/schema/model-info.js @@ -1,3 +1,5 @@ +const path = require('path'); +const fs = require('fs'); module.exports = Self => { Self.remoteMethod('modelInfo', { @@ -19,6 +21,42 @@ module.exports = Self => { } }); + const modelsLocale = new Map(); + const modulesDir = path.resolve(`${__dirname}/../../../../modules`); + const modules = fs.readdirSync(modulesDir); + + for (const mod of modules) { + const modelsDir = path.join(modulesDir, mod, `back/locale`); + if (!fs.existsSync(modelsDir)) continue; + const models = fs.readdirSync(modelsDir); + + for (const model of models) { + const localeDir = path.join(modelsDir, model); + const localeFiles = fs.readdirSync(localeDir); + + let modelName = model.charAt(0).toUpperCase() + model.substring(1); + modelName = modelName.replace(/-\w/g, match => { + return match.charAt(1).toUpperCase(); + }); + + const modelLocale = new Map(); + modelsLocale.set(modelName, modelLocale); + + for (const localeFile of localeFiles) { + const localePath = path.join(localeDir, localeFile); + + const match = localeFile.match(/^([a-z]+)\.yml$/); + if (!match) { + console.warn(`Skipping wrong model locale file: ${localeFile}`); + continue; + } + + const translations = require(localePath); + modelLocale.set(match[1], translations); + } + } + } + Self.modelInfo = async function(ctx) { let json = {}; let models = Self.app.models; @@ -49,9 +87,14 @@ module.exports = Self => { jsonValidations[fieldName] = jsonField; } + const modelLocale = modelsLocale.get(modelName); + const lang = ctx.req.getLocale(); + const locale = modelLocale && modelLocale.get(lang); + json[modelName] = { properties: model.definition.rawProperties, - validations: jsonValidations + validations: jsonValidations, + locale }; } diff --git a/loopback/common/methods/vn-model/printService.js b/loopback/common/methods/vn-model/printService.js new file mode 100644 index 000000000..5cd571d4c --- /dev/null +++ b/loopback/common/methods/vn-model/printService.js @@ -0,0 +1,57 @@ +const {Report, Email} = require('vn-print'); + +module.exports = Self => { + Self.printReport = async function(ctx, id, reportName) { + const args = Object.assign({}, ctx.args); + const params = {lang: ctx.req.getLocale()}; + + delete args.ctx; + for (const param in args) + params[param] = args[param]; + + const report = new Report(reportName, params); + const stream = await report.toPdfStream(); + + let fileName = `${reportName}`; + if (id) fileName += `-${id}`; + + return [stream, 'application/pdf', `filename="${fileName}.pdf"`]; + }; + + Self.printEmail = async function(ctx, id, templateName) { + const {accessToken} = ctx.req; + const args = Object.assign({}, ctx.args); + const params = {lang: ctx.req.getLocale()}; + + delete args.ctx; + for (const param in args) + params[param] = args[param]; + + params.isPreview = true; + params.access_token = accessToken.id; + + const report = new Email(templateName, params); + const html = await report.render(); + + let fileName = `${templateName}`; + if (id) fileName += `-${id}`; + + return [html, 'text/html', `filename=${fileName}.pdf"`]; + }; + + Self.sendTemplate = async function(ctx, templateName) { + const args = Object.assign({}, ctx.args); + const params = { + recipient: args.recipient, + lang: ctx.req.getLocale() + }; + + delete args.ctx; + for (const param in args) + params[param] = args[param]; + + const email = new Email(templateName, params); + + return email.send(); + }; +}; diff --git a/loopback/common/methods/vn-model/specs/rewriteDbError.spec.js b/loopback/common/methods/vn-model/specs/rewriteDbError.spec.js index e2f842a15..1c4d53266 100644 --- a/loopback/common/methods/vn-model/specs/rewriteDbError.spec.js +++ b/loopback/common/methods/vn-model/specs/rewriteDbError.spec.js @@ -24,6 +24,6 @@ describe('Model rewriteDbError()', () => { error = e; } - expect(error.message).toEqual(`The tag can't be repeated`); + expect(error.message).toEqual(`The tag or priority can't be repeated for an item`); }); }); diff --git a/loopback/common/models/application.js b/loopback/common/models/application.js index ff7599fac..5e767fdc1 100644 --- a/loopback/common/models/application.js +++ b/loopback/common/models/application.js @@ -1,4 +1,5 @@ module.exports = function(Self) { require('../methods/application/status')(Self); + require('../methods/application/post')(Self); }; diff --git a/loopback/common/models/application.json b/loopback/common/models/application.json index 0bb489720..bc72df315 100644 --- a/loopback/common/models/application.json +++ b/loopback/common/models/application.json @@ -7,6 +7,12 @@ "principalType": "ROLE", "principalId": "$everyone", "permission": "ALLOW" - } + }, + { + "property": "post", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } ] } diff --git a/loopback/common/models/loggable.js b/loopback/common/models/loggable.js index 28a6075d0..360c84566 100644 --- a/loopback/common/models/loggable.js +++ b/loopback/common/models/loggable.js @@ -1,4 +1,3 @@ -const pick = require('object.pick'); const LoopBackContext = require('loopback-context'); module.exports = function(Self) { @@ -6,344 +5,11 @@ module.exports = function(Self) { Self.super_.setup.call(this); }; - Self.observe('after save', async function(ctx) { - const loopBackContext = LoopBackContext.getCurrentContext(); - await logInModel(ctx, loopBackContext); - }); - Self.observe('before save', async function(ctx) { - const appModels = ctx.Model.app.models; - const definition = ctx.Model.definition; - const options = {}; - - // Check for transactions - if (ctx.options && ctx.options.transaction) - options.transaction = ctx.options.transaction; - - let oldInstance; - let newInstance; - - if (ctx.data) { - const changes = pick(ctx.currentInstance, Object.keys(ctx.data)); - newInstance = ctx.data; - oldInstance = changes; - - if (ctx.where && !ctx.currentInstance) { - const fields = Object.keys(ctx.data); - const modelName = definition.name; - - ctx.oldInstances = await appModels[modelName].find({ - where: ctx.where, - fields: fields - }, options); - } - } - - // Get changes from created instance - if (ctx.isNewInstance) - newInstance = ctx.instance.__data; - - ctx.hookState.oldInstance = oldInstance; - ctx.hookState.newInstance = newInstance; + ctx.options.httpCtx = LoopBackContext.getCurrentContext(); }); Self.observe('before delete', async function(ctx) { - const appModels = ctx.Model.app.models; - const definition = ctx.Model.definition; - const relations = ctx.Model.relations; - - let options = {}; - if (ctx.options && ctx.options.transaction) - options.transaction = ctx.options.transaction; - - if (ctx.where) { - let affectedModel = definition.name; - let deletedInstances = await appModels[affectedModel].find({ - where: ctx.where - }, options); - - let relation = definition.settings.log.relation; - - if (relation) { - let primaryKey = relations[relation].keyFrom; - - let arrangedDeletedInstances = []; - for (let i = 0; i < deletedInstances.length; i++) { - if (primaryKey) - deletedInstances[i].originFk = deletedInstances[i][primaryKey]; - let arrangedInstance = await fkToValue(deletedInstances[i], ctx); - arrangedDeletedInstances[i] = arrangedInstance; - } - ctx.hookState.oldInstance = arrangedDeletedInstances; - } - } + ctx.options.httpCtx = LoopBackContext.getCurrentContext(); }); - - Self.observe('after delete', async function(ctx) { - const loopBackContext = LoopBackContext.getCurrentContext(); - if (ctx.hookState.oldInstance) - logDeletedInstances(ctx, loopBackContext); - }); - - async function logDeletedInstances(ctx, loopBackContext) { - const appModels = ctx.Model.app.models; - const definition = ctx.Model.definition; - let options = {}; - if (ctx.options && ctx.options.transaction) - options.transaction = ctx.options.transaction; - - ctx.hookState.oldInstance.forEach(async instance => { - let userFk; - if (loopBackContext) - userFk = loopBackContext.active.accessToken.userId; - - let changedModelValue = definition.settings.log.changedModelValue; - let logRecord = { - originFk: instance.originFk, - userFk: userFk, - action: 'delete', - changedModel: definition.name, - changedModelId: instance.id, - changedModelValue: instance[changedModelValue], - oldInstance: instance, - newInstance: {} - }; - - delete instance.originFk; - - let logModel = definition.settings.log.model; - await appModels[logModel].create(logRecord, options); - }); - } - - // Get log values from a foreign key - async function fkToValue(instance, ctx) { - const appModels = ctx.Model.app.models; - const relations = ctx.Model.relations; - let options = {}; - - // Check for transactions - if (ctx.options && ctx.options.transaction) - options.transaction = ctx.options.transaction; - - const instanceCopy = JSON.parse(JSON.stringify(instance)); - const result = {}; - for (const key in instanceCopy) { - let value = instanceCopy[key]; - - if (value instanceof Object) - continue; - - if (value === undefined) continue; - - if (value) { - for (let relationName in relations) { - const relation = relations[relationName]; - if (relation.keyFrom == key && key != 'id') { - const model = relation.modelTo; - const modelName = relation.modelTo.modelName; - const properties = model && model.definition.properties; - const settings = model && model.definition.settings; - - const recordSet = await appModels[modelName].findById(value, null, options); - - const hasShowField = settings.log && settings.log.showField; - let showField = hasShowField && recordSet - && recordSet[settings.log.showField]; - - if (!showField) { - const showFieldNames = [ - 'name', - 'description', - 'code', - 'nickname' - ]; - for (field of showFieldNames) { - const propField = properties && properties[field]; - const recordField = recordSet && recordSet[field]; - - if (propField && recordField) { - showField = field; - break; - } - } - } - - if (showField && recordSet && recordSet[showField]) { - value = recordSet[showField]; - break; - } - - value = recordSet && recordSet.id || value; - break; - } - } - } - result[key] = value; - } - return result; - } - - async function logInModel(ctx, loopBackContext) { - const appModels = ctx.Model.app.models; - const definition = ctx.Model.definition; - const defSettings = ctx.Model.definition.settings; - const relations = ctx.Model.relations; - - const options = {}; - if (ctx.options && ctx.options.transaction) - options.transaction = ctx.options.transaction; - - let primaryKey; - for (let property in definition.properties) { - if (definition.properties[property].id) { - primaryKey = property; - break; - } - } - - if (!primaryKey) throw new Error('Primary key not found'); - let originId; - - // RELATIONS LOG - let changedModelId; - - if (ctx.instance && !defSettings.log.relation) { - originId = ctx.instance.id; - changedModelId = ctx.instance.id; - } else if (defSettings.log.relation) { - primaryKey = relations[defSettings.log.relation].keyFrom; - - if (ctx.where && ctx.where[primaryKey]) - originId = ctx.where[primaryKey]; - else if (ctx.instance) { - originId = ctx.instance[primaryKey]; - changedModelId = ctx.instance.id; - } - } else { - originId = ctx.currentInstance.id; - changedModelId = ctx.currentInstance.id; - } - - // Sets the changedModelValue to save and the instances changed in case its an updateAll - let showField = defSettings.log.showField; - let where; - if (showField && (!ctx.instance || !ctx.instance[showField]) && ctx.where) { - changedModelId = []; - where = []; - let changedInstances = await appModels[definition.name].find({ - where: ctx.where, - fields: ['id', showField, primaryKey] - }, options); - - changedInstances.forEach(element => { - where.push(element[showField]); - changedModelId.push(element.id); - originId = element[primaryKey]; - }); - } else if (ctx.hookState.oldInstance) - where = ctx.instance[showField]; - - // Set oldInstance, newInstance, userFk and action - let oldInstance = {}; - if (ctx.hookState.oldInstance) - Object.assign(oldInstance, ctx.hookState.oldInstance); - - let newInstance = {}; - if (ctx.hookState.newInstance) - Object.assign(newInstance, ctx.hookState.newInstance); - let userFk; - if (loopBackContext) - userFk = loopBackContext.active.accessToken.userId; - - let action = setActionType(ctx); - - removeUnloggable(definition, oldInstance); - removeUnloggable(definition, newInstance); - - oldInstance = await fkToValue(oldInstance, ctx); - newInstance = await fkToValue(newInstance, ctx); - - // Prevent log with no new changes - const hasNewChanges = Object.keys(newInstance).length; - if (!hasNewChanges) return; - - let logRecord = { - originFk: originId, - userFk: userFk, - action: action, - changedModel: definition.name, - changedModelId: changedModelId, // Model property with an different data type will throw a NaN error - changedModelValue: where, - oldInstance: oldInstance, - newInstance: newInstance - }; - - let logsToSave = setLogsToSave(where, changedModelId, logRecord, ctx); - let logModel = defSettings.log.model; - - await appModels[logModel].create(logsToSave, options); - } - - /** - * Removes unwanted properties - * @param {*} definition Model definition - * @param {*} properties Modified object properties - */ - function removeUnloggable(definition, properties) { - const objectCopy = Object.assign({}, properties); - const propList = Object.keys(objectCopy); - const propDefs = new Map(); - - for (let property in definition.properties) { - const propertyDef = definition.properties[property]; - - propDefs.set(property, propertyDef); - } - - for (let property of propList) { - const propertyDef = propDefs.get(property); - const firstChar = property.substring(0, 1); - const isPrivate = firstChar == '$'; - - if (isPrivate || !propertyDef) - delete properties[property]; - - if (!propertyDef) continue; - - if (propertyDef.log === false || isPrivate) - delete properties[property]; - else if (propertyDef.logValue === false) - properties[property] = null; - } - } - - // this function retuns all the instances changed in case this is an updateAll - function setLogsToSave(changedInstances, changedInstancesIds, logRecord, ctx) { - let promises = []; - if (changedInstances && typeof changedInstances == 'object') { - for (let i = 0; i < changedInstances.length; i++) { - logRecord.changedModelId = changedInstancesIds[i]; - logRecord.changedModelValue = changedInstances[i]; - if (ctx.oldInstances) - logRecord.oldInstance = ctx.oldInstances[i]; - promises.push(JSON.parse(JSON.stringify(logRecord))); - } - } else - return logRecord; - - return promises; - } - - function setActionType(ctx) { - let oldInstance = ctx.hookState.oldInstance; - let newInstance = ctx.hookState.newInstance; - - if (oldInstance && newInstance) - return 'update'; - else if (!oldInstance && newInstance) - return 'insert'; - - return 'delete'; - } }; diff --git a/loopback/common/models/vn-model.js b/loopback/common/models/vn-model.js index cc3eede8e..cebd37eac 100644 --- a/loopback/common/models/vn-model.js +++ b/loopback/common/models/vn-model.js @@ -7,6 +7,7 @@ module.exports = function(Self) { require('../methods/vn-model/getSetValues')(Self); require('../methods/vn-model/getEnumValues')(Self); + require('../methods/vn-model/printService')(Self); Object.assign(Self, { setup() { diff --git a/loopback/locale/en.json b/loopback/locale/en.json index c9dca734f..e9fd67209 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -54,7 +54,6 @@ "You can't delete a confirmed order": "You can't delete a confirmed order", "Value has an invalid format": "Value has an invalid format", "The postcode doesn't exist. Please enter a correct one": "The postcode doesn't exist. Please enter a correct one", - "Can't create stowaway for this ticket": "Can't create stowaway for this ticket", "Swift / BIC can't be empty": "Swift / BIC can't be empty", "Deleted sales from ticket": "I have deleted the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}", "Added sale to ticket": "I have added the following line to the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}", @@ -67,10 +66,10 @@ "MESSAGE_INSURANCE_CHANGE": "I have changed the insurence credit of client [{{clientName}} ({{clientId}})]({{{url}}}) to *{{credit}} €*", "Changed client paymethod": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})", "Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})", + "Change quantity": "{{concept}} change of {{oldQuantity}} to {{newQuantity}}", "Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked", "Claim state has changed to incomplete": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *incomplete*", "Claim state has changed to canceled": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *canceled*", - "This ticket is not an stowaway anymore": "The ticket id [{{ticketId}}]({{{ticketUrl}}}) is not an stowaway anymore", "Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member", "Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member", "Client checked as validated despite of duplication": "Client checked as validated despite of duplication from client id {{clientId}}", @@ -124,5 +123,36 @@ "isWithoutNegatives": "isWithoutNegatives", "routeFk": "routeFk", "Not enough privileges to edit a client with verified data": "Not enough privileges to edit a client with verified data", - "Can't change the password of another worker": "Can't change the password of another worker" -} \ No newline at end of file + "Can't change the password of another worker": "Can't change the password of another worker", + "No hay un contrato en vigor": "There is no existing contract", + "No está permitido trabajar": "Not allowed to work", + "Dirección incorrecta": "Wrong direction", + "No se permite fichar a futuro": "It is not allowed to sign in the future", + "Descanso diario 12h.": "Daily rest 12h.", + "Fichadas impares": "Odd signs", + "Descanso diario 9h.": "Daily rest 9h.", + "Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h.", + "Verify email": "Verify email", + "Click on the following link to verify this email. If you haven't requested this email, just ignore it": "Click on the following link to verify this email. If you haven't requested this email, just ignore it", + "Password does not meet requirements": "Password does not meet requirements", + "You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies", + "Not enough privileges to edit a client": "Not enough privileges to edit a client", + "Claim pickup order sent": "Claim pickup order sent [{{claimId}}]({{{claimUrl}}}) to client *{{clientName}}*", + "You don't have grant privilege": "You don't have grant privilege", + "You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user", + "Email verify": "Email verify", + "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) merged with [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})", + "App locked": "App locked by user {{userId}}", + "The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified", + "Receipt's bank was not found": "Receipt's bank was not found", + "This receipt was not compensated": "This receipt was not compensated", + "Client's email was not found": "Client's email was not found", + "Tickets with associated refunds": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº {{id}}", + "It is not possible to modify tracked sales": "It is not possible to modify tracked sales", + "It is not possible to modify sales that their articles are from Floramondo": "It is not possible to modify sales that their articles are from Floramondo", + "It is not possible to modify cloned sales": "It is not possible to modify cloned sales", + "Valid priorities: 1,2,3": "Valid priorities: 1,2,3", + "Warehouse inventory not set": "Almacén inventario no está establecido", + "Component cost not set": "Componente coste no está estabecido", + "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº 2": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº 2" +} diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 23c2281c3..95bf16d66 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -44,7 +44,7 @@ "is not a valid date": "No es una fecha valida", "Barcode must be unique": "El código de barras debe ser único", "The warehouse can't be repeated": "El almacén no puede repetirse", - "The tag can't be repeated": "El tag no puede repetirse", + "The tag or priority can't be repeated for an item": "El tag o prioridad no puede repetirse para un item", "The observation type can't be repeated": "El tipo de observación no puede repetirse", "A claim with that sale already exists": "Ya existe una reclamación para esta línea", "You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo", @@ -84,7 +84,6 @@ "The current ticket can't be modified": "El ticket actual no puede ser modificado", "The current claim can't be modified": "La reclamación actual no puede ser modificada", "The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas", - "Sale(s) blocked, contact production": "Linea(s) bloqueada(s), contacte con produccion", "Please select at least one sale": "Por favor selecciona al menos una linea", "All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket", "NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", @@ -96,12 +95,11 @@ "This postcode already exists": "Este código postal ya existe", "Concept cannot be blank": "El concepto no puede quedar en blanco", "File doesn't exists": "El archivo no existe", - "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias", + "You don't have privileges to change the zone": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias", "This ticket is already on weekly tickets": "Este ticket ya está en tickets programados", "Ticket id cannot be blank": "El id de ticket no puede quedar en blanco", "Weekday cannot be blank": "El día de la semana no puede quedar en blanco", "You can't delete a confirmed order": "No puedes borrar un pedido confirmado", - "Can't create stowaway for this ticket": "No se puede crear un polizon para este ticket", "The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto", "Invalid quantity": "Cantidad invalida", "This postal code is not valid": "This postal code is not valid", @@ -135,10 +133,10 @@ "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*", "Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})", "Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})", + "Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}", "Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*", "Claim state has changed to incomplete": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *incompleta*", "Claim state has changed to canceled": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *anulado*", - "This ticket is not an stowaway anymore": "El ticket id [{{ticketId}}]({{{ticketUrl}}}) ha dejado de ser un polizón", "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}", "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto", "Distance must be lesser than 1000": "La distancia debe ser inferior a 1000", @@ -148,13 +146,14 @@ "Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante", "ORDER_ALREADY_CONFIRMED": "ORDER_ALREADY_CONFIRMED", "Invalid password": "Invalid password", - "Password does not meet requirements": "Password does not meet requirements", + "Password does not meet requirements": "La contraseña no cumple los requisitos", "Role already assigned": "Role already assigned", "Invalid role name": "Invalid role name", "Role name must be written in camelCase": "Role name must be written in camelCase", "Email already exists": "Email already exists", "User already exists": "User already exists", "Absence change notification on the labour calendar": "Notificacion de cambio de ausencia en el calendario laboral", + "Record of hours week": "Registro de horas semana {{week}} año {{year}} ", "Created absence": "El empleado {{author}} ha añadido una ausencia de tipo '{{absenceType}}' a {{employee}} para el día {{dated}}.", "Deleted absence": "El empleado {{author}} ha eliminado una ausencia de tipo '{{absenceType}}' a {{employee}} del día {{dated}}.", "I have deleted the ticket id": "He eliminado el ticket id [{{id}}]({{{url}}})", @@ -210,7 +209,7 @@ "Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes", "Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio", "You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito", - "You can't change the credit set to zero from a manager": "No puedes cambiar el cŕedito establecido a cero por un gerente", + "You can't change the credit set to zero from a financialBoss": "No puedes cambiar el cŕedito establecido a cero por un jefe de finanzas", "Amounts do not match": "Las cantidades no coinciden", "The PDF document does not exists": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'", "The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos", @@ -227,5 +226,50 @@ "This ticket is already a refund": "Este ticket ya es un abono", "isWithoutNegatives": "isWithoutNegatives", "routeFk": "routeFk", - "Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador" -} \ No newline at end of file + "Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador", + "No hay un contrato en vigor": "No hay un contrato en vigor", + "No se permite fichar a futuro": "No se permite fichar a futuro", + "No está permitido trabajar": "No está permitido trabajar", + "Fichadas impares": "Fichadas impares", + "Descanso diario 12h.": "Descanso diario 12h.", + "Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.", + "Dirección incorrecta": "Dirección incorrecta", + "Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador", + "Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador", + "Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente", + "This route does not exists": "Esta ruta no existe", + "Claim pickup order sent": "Reclamación Orden de recogida enviada [{{claimId}}]({{{claimUrl}}}) al cliente *{{clientName}}*", + "You don't have grant privilege": "No tienes privilegios para dar privilegios", + "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario", + "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) fusionado con [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})", + "Already has this status": "Ya tiene este estado", + "There aren't records for this week": "No existen registros para esta semana", + "Empty data source": "Origen de datos vacio", + "App locked": "Aplicación bloqueada por el usuario {{userId}}", + "Email verify": "Correo de verificación", + "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment", + "Receipt's bank was not found": "No se encontró el banco del recibo", + "This receipt was not compensated": "Este recibo no ha sido compensado", + "Client's email was not found": "No se encontró el email del cliente", + "Negative basis": "Base negativa", + "This worker code already exists": "Este codigo de trabajador ya existe", + "This personal mail already exists": "Este correo personal ya existe", + "This worker already exists": "Este trabajador ya existe", + "App name does not exist": "El nombre de aplicación no es válido", + "Try again": "Vuelve a intentarlo", + "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9", + "Failed to upload file": "Error al subir archivo", + "The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe", + "It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar", + "It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo", + "It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas", + "A supplier with the same name already exists. Change the country.": "Un proveedor con el mismo nombre ya existe. Cambie el país.", + "There is no assigned email for this client": "No hay correo asignado para este cliente", + "Exists an invoice with a previous date": "Existe una factura con fecha anterior", + "Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite", + "Warehouse inventory not set": "El almacén inventario no está establecido", + "This locker has already been assigned": "Esta taquilla ya ha sido asignada", + "Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº {{id}}", + "Not exist this branch": "La rama no existe", + "This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado" +} diff --git a/loopback/server/boot/acl.js b/loopback/server/boot/acl.js new file mode 100644 index 000000000..f9375e0c1 --- /dev/null +++ b/loopback/server/boot/acl.js @@ -0,0 +1,22 @@ + +module.exports = function(app) { + app.models.ACL.checkAccessAcl = async(ctx, modelId, property, accessType = '*') => { + const models = app.models; + const context = { + accessToken: ctx.req.accessToken, + model: models[modelId], + property: property, + modelId: modelId, + accessType: accessType, + sharedMethod: { + name: property, + aliases: [], + sharedClass: true + } + }; + + const acl = await models.ACL.checkAccessForContext(context); + + return acl.permission == 'ALLOW'; + }; +}; diff --git a/loopback/server/boot/date.js b/loopback/server/boot/date.js new file mode 100644 index 000000000..810745562 --- /dev/null +++ b/loopback/server/boot/date.js @@ -0,0 +1,17 @@ +module.exports = () => { + Date.vnUTC = () => { + const env = process.env.NODE_ENV; + if (!env || env === 'development') + return new Date(Date.UTC(2001, 0, 1, 11)); + + return new Date(); + }; + + Date.vnNew = () => { + return new Date(Date.vnUTC()); + }; + + Date.vnNow = () => { + return new Date(Date.vnUTC()).getTime(); + }; +}; diff --git a/loopback/server/boot/print.js b/loopback/server/boot/print.js index 0f6af4d56..7558c3ef8 100644 --- a/loopback/server/boot/print.js +++ b/loopback/server/boot/print.js @@ -1,3 +1,3 @@ module.exports = function(app) { - require('../../../print/boot.js')(app); + require('vn-print').boot(app); }; diff --git a/loopback/server/connectors/vn-mysql.js b/loopback/server/connectors/vn-mysql.js index fde0ddcf6..728454d86 100644 --- a/loopback/server/connectors/vn-mysql.js +++ b/loopback/server/connectors/vn-mysql.js @@ -1,9 +1,41 @@ const mysql = require('mysql'); -const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; const MySQL = require('loopback-connector-mysql').MySQL; const EnumFactory = require('loopback-connector-mysql').EnumFactory; +const { Transaction, SQLConnector, ParameterizedSQL } = require('loopback-connector'); const fs = require('fs'); +const limitSet = new Set([ + 'save', + 'updateOrCreate', + 'replaceOrCreate', + 'replaceById', + 'update' +]); + +const opOpts = { + update: [ + 'update', + 'replaceById', + // |insert + 'save', + 'updateOrCreate', + 'replaceOrCreate' + ], + delete: [ + 'destroy', + 'destroyAll' + ], + insert: [ + 'create' + ] +}; + +const opMap = new Map(); +for (const op in opOpts) { + for (const met of opOpts[op]) + opMap.set(met, op); +} + class VnMySQL extends MySQL { /** * Promisified version of execute(). @@ -219,6 +251,277 @@ class VnMySQL extends MySQL { this.makePagination(filter) ]); } + + create(model, data, opts, cb) { + const ctx = { data }; + this.invokeMethod('create', + arguments, model, ctx, opts, cb); + } + + createAll(model, data, opts, cb) { + const ctx = { data }; + this.invokeMethod('createAll', + arguments, model, ctx, opts, cb); + } + + save(model, data, opts, cb) { + const ctx = { data }; + this.invokeMethod('save', + arguments, model, ctx, opts, cb); + } + + updateOrCreate(model, data, opts, cb) { + const ctx = { data }; + this.invokeMethod('updateOrCreate', + arguments, model, ctx, opts, cb); + } + + replaceOrCreate(model, data, opts, cb) { + const ctx = { data }; + this.invokeMethod('replaceOrCreate', + arguments, model, ctx, opts, cb); + } + + destroyAll(model, where, opts, cb) { + const ctx = { where }; + this.invokeMethod('destroyAll', + arguments, model, ctx, opts, cb); + } + + update(model, where, data, opts, cb) { + const ctx = { where, data }; + this.invokeMethod('update', + arguments, model, ctx, opts, cb); + } + + replaceById(model, id, data, opts, cb) { + const ctx = { id, data }; + this.invokeMethod('replaceById', + arguments, model, ctx, opts, cb); + } + + isLoggable(model) { + const Model = this.getModelDefinition(model).model; + const settings = Model.definition.settings; + return settings.base && settings.base === 'Loggable'; + } + + invokeMethod(method, args, model, ctx, opts, cb) { + if (!this.isLoggable(model)) + return super[method].apply(this, args); + + this.invokeMethodP(method, [...args], model, ctx, opts) + .then(res => cb(...res), cb); + } + + async invokeMethodP(method, args, model, ctx, opts) { + const Model = this.getModelDefinition(model).model; + const settings = Model.definition.settings; + let tx; + if (!opts.transaction) { + tx = await Transaction.begin(this, {}); + opts = Object.assign({ transaction: tx, httpCtx: opts.httpCtx }, opts); + } + + try { + // Fetch old values (update|delete) or login + let where, id, data, idName, limit, op, oldInstances, newInstances; + const hasGrabUser = settings.log && settings.log.grabUser; + if (hasGrabUser) { + const userId = opts.httpCtx && opts.httpCtx.active.accessToken.userId; + const user = await Model.app.models.Account.findById(userId, { fields: ['name'] }, opts); + await this.executeP(`CALL account.myUser_loginWithName(?)`, [user.name], opts); + } + else { + where = ctx.where; + id = ctx.id; + data = ctx.data; + idName = this.idName(model); + + limit = limitSet.has(method); + + op = opMap.get(method); + + if (!where) { + if (id) where = { [idName]: id }; + else where = { [idName]: data[idName] }; + } + + // Fetch old values + switch (op) { + case 'update': + case 'delete': + // Single entity operation + const stmt = this.buildSelectStmt(op, data, idName, model, where, limit); + stmt.merge(`FOR UPDATE`); + oldInstances = await this.executeStmt(stmt, opts); + } + } + + const res = await new Promise(resolve => { + const fnArgs = args.slice(0, -2); + fnArgs.push(opts, (...args) => resolve(args)); + super[method].apply(this, fnArgs); + }); + + if (hasGrabUser) + await this.executeP(`CALL account.myUser_logout()`, null, opts); + else { + // Fetch new values + const ids = []; + + switch (op) { + case 'insert': + case 'update': { + switch (method) { + case 'createAll': + for (const row of res[1]) + ids.push(row[idName]); + break; + case 'create': + ids.push(res[1]); + break; + case 'update': + if (data[idName] != null) + ids.push(data[idName]); + break; + } + + const newWhere = ids.length ? { [idName]: ids } : where; + + const stmt = this.buildSelectStmt(op, data, idName, model, newWhere, limit); + newInstances = await this.executeStmt(stmt, opts); + } + } + + await this.createLogRecord(oldInstances, newInstances, model, opts); + } + if (tx) await tx.commit(); + return res; + } catch (err) { + if (tx) tx.rollback(); + throw err; + } + } + + buildSelectStmt(op, data, idName, model, where, limit) { + const Model = this.getModelDefinition(model).model; + const properties = Object.keys(Model.definition.properties); + + const fields = data ? Object.keys(data) : []; + if (op == 'delete') + properties.forEach(property => fields.push(property)); + else { + const log = Model.definition.settings.log; + fields.push(idName); + if (log.relation) fields.push(Model.relations[log.relation].keyFrom); + if (log.showField) fields.push(log.showField); + else { + const showFieldNames = ['name', 'description', 'code', 'nickname']; + for (const field of showFieldNames) { + if (properties.includes(field)) { + log.showField = field; + fields.push(field); + break; + } + } + } + } + + const stmt = new ParameterizedSQL( + 'SELECT ' + + this.buildColumnNames(model, { fields }) + + ' FROM ' + + this.tableEscaped(model) + ); + stmt.merge(this.buildWhere(model, where)); + if (limit) stmt.merge(`LIMIT 1`); + + return stmt; + } + + async createLogRecord(oldInstances, newInstances, model, opts) { + function setActionType() { + if (oldInstances && newInstances) + return 'update'; + else if (!oldInstances && newInstances) + return 'insert'; + return 'delete'; + } + + const action = setActionType(); + if (!newInstances && action != 'delete') return; + + const Model = this.getModelDefinition(model).model; + const models = Model.app.models; + const definition = Model.definition; + const log = definition.settings.log; + + const primaryKey = this.idName(model); + const originRelation = log.relation; + const originFkField = originRelation + ? Model.relations[originRelation].keyFrom + : primaryKey; + + // Prevent adding logs when deleting a principal entity (Client, Zone...) + if (action == 'delete' && !originRelation) return; + + function map(instances) { + const map = new Map(); + if (!instances) return; + for (const instance of instances) + map.set(instance[primaryKey], instance); + return map; + } + + const changedModel = definition.name; + const userFk = opts.httpCtx && opts.httpCtx.active.accessToken.userId; + const oldMap = map(oldInstances); + const newMap = map(newInstances); + const ids = (oldMap || newMap).keys(); + + const logEntries = []; + + function insertValuesLogEntry(logEntry, instance) { + logEntry.originFk = instance[originFkField]; + logEntry.changedModelId = instance[primaryKey]; + if (log.showField) logEntry.changedModelValue = instance[log.showField]; + } + + for (const id of ids) { + const oldI = oldMap && oldMap.get(id); + const newI = newMap && newMap.get(id); + + const logEntry = { + action, + userFk, + changedModel, + }; + + if (newI) { + insertValuesLogEntry(logEntry, newI); + // Delete unchanged properties + if (oldI) { + Object.keys(oldI).forEach(prop => { + const hasChanges = oldI[prop] instanceof Date ? + oldI[prop]?.getTime() != newI[prop]?.getTime() : + oldI[prop] != newI[prop]; + + if (!hasChanges) { + delete oldI[prop]; + delete newI[prop]; + } + }); + } + } else + insertValuesLogEntry(logEntry, oldI); + + logEntry.oldInstance = oldI; + logEntry.newInstance = newI; + logEntries.push(logEntry); + } + await models[log.model].create(logEntries, opts); + } } exports.VnMySQL = VnMySQL; @@ -233,13 +536,13 @@ exports.initialize = function initialize(dataSource, callback) { modelBuilder.defineValueType.bind(modelBuilder) : modelBuilder.constructor.registerType.bind(modelBuilder.constructor); - defineType(function Point() {}); + defineType(function Point() { }); dataSource.EnumFactory = EnumFactory; if (callback) { if (dataSource.settings.lazyConnect) { - process.nextTick(function() { + process.nextTick(function () { callback(); }); } else @@ -247,13 +550,13 @@ exports.initialize = function initialize(dataSource, callback) { } }; -MySQL.prototype.connect = function(callback) { +MySQL.prototype.connect = function (callback) { const self = this; const options = generateOptions(this.settings); if (this.client) { if (callback) { - process.nextTick(function() { + process.nextTick(function () { callback(null, self.client); }); } @@ -262,7 +565,7 @@ MySQL.prototype.connect = function(callback) { function connectionHandler(options, callback) { const client = mysql.createPool(options); - client.getConnection(function(err, connection) { + client.getConnection(function (err, connection) { const conn = connection; if (!err) { if (self.debug) @@ -341,3 +644,31 @@ function generateOptions(settings) { } return options; } + + +SQLConnector.prototype.all = function find(model, filter, options, cb) { + const self = this; + // Order by id if no order is specified + filter = filter || {}; + const stmt = this.buildSelect(model, filter, options); + this.execute(stmt.sql, stmt.params, options, function (err, data) { + if (err) { + return cb(err, []); + } + + try { + const objs = data.map(function (obj) { + return self.fromRow(model, obj); + }); + if (filter && filter.include) { + self.getModelDefinition(model).model.include( + objs, filter.include, options, cb, + ); + } else { + cb(null, objs); + } + } catch (error) { + cb(error, []) + } + }); +}; \ No newline at end of file diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index 5dade9c2e..f5f277ffc 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -15,7 +15,7 @@ "legacyUtcDateProcessing": false, "timezone": "local", "connectTimeout": 40000, - "acquireTimeout": 20000, + "acquireTimeout": 60000, "waitForConnections": true }, "osticket": { @@ -40,6 +40,7 @@ "image/png", "image/jpeg", "image/jpg", + "image/webp", "video/mp4" ] }, @@ -60,7 +61,8 @@ "multipart/x-zip", "image/png", "image/jpeg", - "image/jpg" + "image/jpg", + "image/webp" ] }, "imageStorage": { @@ -72,7 +74,8 @@ "allowedContentTypes": [ "image/png", "image/jpeg", - "image/jpg" + "image/jpg", + "image/webp" ] }, "invoiceStorage": { @@ -96,6 +99,7 @@ "image/png", "image/jpeg", "image/jpg", + "image/webp", "video/mp4" ] }, @@ -109,4 +113,4 @@ "application/x-7z-compressed" ] } -} \ No newline at end of file +} diff --git a/loopback/server/middleware.json b/loopback/server/middleware.json index 60bedcdb3..d65b8b34a 100644 --- a/loopback/server/middleware.json +++ b/loopback/server/middleware.json @@ -31,7 +31,8 @@ "loopback#token": {} }, "auth:after": { - "./middleware/current-user": {} + "./middleware/current-user": {}, + "./middleware/salix-version": {} }, "parse": { "body-parser#json":{} diff --git a/loopback/server/middleware/salix-version.js b/loopback/server/middleware/salix-version.js new file mode 100644 index 000000000..988a3b39c --- /dev/null +++ b/loopback/server/middleware/salix-version.js @@ -0,0 +1,8 @@ +const packageJson = require('../../../package.json'); + +module.exports = function(options) { + return function(req, res, next) { + res.set('Salix-Version', packageJson.version); + next(); + }; +}; diff --git a/print/methods/csv/csv.js b/loopback/util/csv.js similarity index 85% rename from print/methods/csv/csv.js rename to loopback/util/csv.js index d8725582d..e79c18da8 100644 --- a/print/methods/csv/csv.js +++ b/loopback/util/csv.js @@ -1,3 +1,9 @@ +/** + * Transforms an object to a raw data CSV file. + * + * @param {Object} rows Data + * @return {String} Formatted CSV data + */ function toCSV(rows) { const [columns] = rows; let content = Object.keys(columns).join('\t'); diff --git a/loopback/util/log.js b/loopback/util/log.js index e26022c35..76e87781d 100644 --- a/loopback/util/log.js +++ b/loopback/util/log.js @@ -91,7 +91,11 @@ exports.getChanges = (original, changes) => { const isPrivate = firstChar == '$'; if (isPrivate) return; - if (changes[property] != original[property]) { + const hasChanges = original[property] instanceof Date ? + changes[property]?.getTime() != original[property]?.getTime() : + changes[property] != original[property]; + + if (hasChanges) { newChanges[property] = changes[property]; if (original[property] != undefined) diff --git a/loopback/util/not-found-error.js b/loopback/util/not-found-error.js new file mode 100644 index 000000000..7a05254f9 --- /dev/null +++ b/loopback/util/not-found-error.js @@ -0,0 +1,9 @@ +module.exports = class NotFoundError extends Error { + constructor(message = 'Not found', code = 'NOT_FOUND', ...translateArgs) { + super(message); + this.name = 'NotFoundError'; + this.statusCode = 404; + this.code = code; + this.translateArgs = translateArgs; + } +}; diff --git a/modules/account/back/models/ldap-config.js b/modules/account/back/models/ldap-config.js index 819659066..a2a2684a9 100644 --- a/modules/account/back/models/ldap-config.js +++ b/modules/account/back/models/ldap-config.js @@ -5,6 +5,8 @@ const crypto = require('crypto'); const nthash = require('smbhash').nthash; module.exports = Self => { + const shouldSync = process.env.NODE_ENV !== 'test'; + Self.getSynchronizer = async function() { return await Self.findOne({ fields: [ @@ -30,6 +32,7 @@ module.exports = Self => { }, async syncUser(userName, info, password) { + let { client, accountConfig @@ -130,13 +133,14 @@ module.exports = Self => { })); } - if (changes.length) + if (shouldSync && changes.length) await client.modify(dn, changes); - } else + } else if (shouldSync) await client.add(dn, newEntry); } else { try { - await client.del(dn); + if (shouldSync) + await client.del(dn); console.log(` -> User '${userName}' removed from LDAP`); } catch (e) { if (e.name !== 'NoSuchObjectError') throw e; @@ -196,17 +200,19 @@ module.exports = Self => { for (let group of groups) { try { let dn = `cn=${group},${groupDn}`; - await client.modify(dn, new ldap.Change({ - operation, - modification: {memberUid: userName} - })); + if (shouldSync) { + await client.modify(dn, new ldap.Change({ + operation, + modification: {memberUid: userName} + })); + } } catch (err) { if (err.name !== 'NoSuchObjectError') throw err; } } } - + await applyOperations(deleteGroups, 'delete'); await applyOperations(addGroups, 'add'); }, @@ -266,8 +272,10 @@ module.exports = Self => { filter: 'objectClass=posixGroup' }; let reqs = []; - await client.searchForeach(this.groupDn, opts, - o => reqs.push(client.del(o.dn))); + await client.searchForeach(this.groupDn, opts, object => { + if (shouldSync) + reqs.push(client.del(object.dn)); + }); await Promise.all(reqs); // Recreate roles @@ -291,7 +299,8 @@ module.exports = Self => { } let dn = `cn=${role.name},${this.groupDn}`; - reqs.push(client.add(dn, newEntry)); + if (shouldSync) + reqs.push(client.add(dn, newEntry)); } await Promise.all(reqs); } diff --git a/modules/account/back/models/role-config.js b/modules/account/back/models/role-config.js index 6051f2060..ba7bf9d52 100644 --- a/modules/account/back/models/role-config.js +++ b/modules/account/back/models/role-config.js @@ -56,6 +56,12 @@ module.exports = Self => { if (!userExists) { await Self.rawSql('CREATE USER ?@? IDENTIFIED BY ?', [mysqlUser, this.userHost, password]); + await Self.rawSql( + `UPDATE mysql.global_priv + SET Priv = JSON_SET(Priv, '$.autogenerated' , TRUE) + WHERE User = ? AND Host = ?`, + [mysqlUser, this.userHost] + ); userExists = true; } else { switch (this.dbType) { diff --git a/modules/account/back/models/samba-config.js b/modules/account/back/models/samba-config.js index 5fd62a68b..168b5ffb4 100644 --- a/modules/account/back/models/samba-config.js +++ b/modules/account/back/models/samba-config.js @@ -60,16 +60,19 @@ module.exports = Self => { return `cn=Users,${dnBase}`; }, - async syncUser(userName, info, password) { + async syncUser(userName, info, password) { let {sshClient} = this; - + let sambaUser = await this.adClient.searchOne(this.usersDn(), { scope: 'sub', attributes: ['userAccountControl'], filter: `(&(objectClass=user)(sAMAccountName=${userName}))` }); let isEnabled = sambaUser - && !(sambaUser.userAccountControl & UserAccountControlFlags.ACCOUNTDISABLE); + && !(sambaUser.userAccountControl & UserAccountControlFlags.ACCOUNTDISABLE); + + if (process.env.NODE_ENV === 'test') + return; if (info.hasAccount) { if (!sambaUser) { diff --git a/modules/account/back/models/user-password.json b/modules/account/back/models/user-password.json index 1b7e49edd..53909ad1f 100644 --- a/modules/account/back/models/user-password.json +++ b/modules/account/back/models/user-password.json @@ -30,5 +30,13 @@ "type": "number", "required": true } - } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] } diff --git a/modules/account/front/basic-data/index.js b/modules/account/front/basic-data/index.js index 342297e45..77d3eab26 100644 --- a/modules/account/front/basic-data/index.js +++ b/modules/account/front/basic-data/index.js @@ -2,6 +2,11 @@ import ngModule from '../module'; import Section from 'salix/components/section'; export default class Controller extends Section { + $onInit() { + if (this.$params.emailConfirmed) + this.vnApp.showSuccess(this.$t('Email verified successfully!')); + } + onSubmit() { this.$.watcher.submit() .then(() => this.card.reload()); diff --git a/modules/account/front/basic-data/locale/es.yml b/modules/account/front/basic-data/locale/es.yml new file mode 100644 index 000000000..2ca7bf698 --- /dev/null +++ b/modules/account/front/basic-data/locale/es.yml @@ -0,0 +1 @@ +Email verified successfully!: Correo verificado correctamente! diff --git a/modules/account/front/descriptor/index.html b/modules/account/front/descriptor/index.html index c709c1ec0..7a7ba43f3 100644 --- a/modules/account/front/descriptor/index.html +++ b/modules/account/front/descriptor/index.html @@ -11,14 +11,6 @@ translate> Delete - - Change role - - @@ -128,22 +120,6 @@ question="Are you sure you want to continue?" message="User will be deactivated"> - - - - - - - - - - - \ No newline at end of file + diff --git a/modules/account/front/descriptor/index.js b/modules/account/front/descriptor/index.js index 3f27b1f76..b802b2349 100644 --- a/modules/account/front/descriptor/index.js +++ b/modules/account/front/descriptor/index.js @@ -30,20 +30,6 @@ class Controller extends Descriptor { .then(() => this.vnApp.showSuccess(this.$t('User removed'))); } - onChangeRole() { - this.newRole = this.user.role.id; - this.$.changeRole.show(); - } - - onChangeRoleAccept() { - const params = {roleFk: this.newRole}; - return this.$http.patch(`Accounts/${this.id}`, params) - .then(() => { - this.emit('change'); - this.vnApp.showSuccess(this.$t('Role changed succesfully!')); - }); - } - onChangePassClick(askOldPass) { this.$http.get('UserPasswords/findOne') .then(res => { diff --git a/modules/account/front/descriptor/index.spec.js b/modules/account/front/descriptor/index.spec.js index 8ee67a304..f5e7aa7d4 100644 --- a/modules/account/front/descriptor/index.spec.js +++ b/modules/account/front/descriptor/index.spec.js @@ -30,17 +30,6 @@ describe('component vnUserDescriptor', () => { }); }); - describe('onChangeRoleAccept()', () => { - it('should call backend method to change role', () => { - $httpBackend.expectPATCH('Accounts/1').respond(); - controller.onChangeRoleAccept(); - $httpBackend.flush(); - - expect(controller.vnApp.showSuccess).toHaveBeenCalled(); - expect(controller.emit).toHaveBeenCalledWith('change'); - }); - }); - describe('onPassChange()', () => { it('should throw an error when password is empty', () => { expect(() => { diff --git a/modules/account/front/index.js b/modules/account/front/index.js index 50e04c9fa..0cd0c4955 100644 --- a/modules/account/front/index.js +++ b/modules/account/front/index.js @@ -18,3 +18,4 @@ import './roles'; import './ldap'; import './samba'; import './accounts'; +import './privileges'; diff --git a/modules/account/front/privileges/index.html b/modules/account/front/privileges/index.html new file mode 100644 index 000000000..e3e44898a --- /dev/null +++ b/modules/account/front/privileges/index.html @@ -0,0 +1,42 @@ + + + +
+ + + + + + + + + + + + + + + + +
diff --git a/modules/account/front/privileges/index.js b/modules/account/front/privileges/index.js new file mode 100644 index 000000000..00ba772df --- /dev/null +++ b/modules/account/front/privileges/index.js @@ -0,0 +1,9 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section {} + +ngModule.component('vnUserPrivileges', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/account/front/privileges/locale/es.yml b/modules/account/front/privileges/locale/es.yml new file mode 100644 index 000000000..d66a7a6cf --- /dev/null +++ b/modules/account/front/privileges/locale/es.yml @@ -0,0 +1,2 @@ +Privileges: Privilegios +Has grant: Puede delegar privilegios diff --git a/modules/account/front/routes.json b/modules/account/front/routes.json index 66b26f427..a6f2f5d3f 100644 --- a/modules/account/front/routes.json +++ b/modules/account/front/routes.json @@ -19,7 +19,8 @@ {"state": "account.card.basicData", "icon": "settings"}, {"state": "account.card.roles", "icon": "group"}, {"state": "account.card.mailForwarding", "icon": "forward"}, - {"state": "account.card.aliases", "icon": "email"} + {"state": "account.card.aliases", "icon": "email"}, + {"state": "account.card.privileges", "icon": "badge"} ], "role": [ {"state": "account.role.card.basicData", "icon": "settings"}, @@ -73,7 +74,7 @@ } }, { - "url": "/basic-data", + "url": "/basic-data?emailConfirmed", "state": "account.card.basicData", "component": "vn-user-basic-data", "description": "Basic data", @@ -99,6 +100,13 @@ "description": "Mail aliases", "acl": ["marketing", "hr"] }, + { + "url": "/privileges", + "state": "account.card.privileges", + "component": "vn-user-privileges", + "description": "Privileges", + "acl": ["hr"] + }, { "url": "/role?q", "state": "account.role", @@ -249,4 +257,4 @@ "acl": ["developer"] } ] -} \ No newline at end of file +} diff --git a/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.js b/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.js index de812417a..f0686ffa6 100644 --- a/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.js +++ b/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.js @@ -1,6 +1,6 @@ module.exports = Self => { Self.remoteMethodCtx('importToNewRefundTicket', { - description: 'Imports lines from claimBeginning to a new ticket with specific shipped, landed dates, agency and company', + description: 'Import lines of claimBeginning to new ticket with shipped, landed dates, agency and company', accessType: 'WRITE', accepts: [{ arg: 'id', @@ -95,7 +95,7 @@ module.exports = Self => { }, myOptions); const claim = await models.Claim.findOne(filter, myOptions); - const today = new Date(); + const today = Date.vnNew(); const newRefundTicket = await models.Ticket.create({ clientFk: claim.ticket().clientFk, @@ -172,7 +172,7 @@ module.exports = Self => { async function saveObservation(observation, options) { const query = `INSERT INTO vn.ticketObservation (ticketFk, observationTypeFk, description) VALUES(?, ?, ?) - ON DUPLICATE KEY + ON DUPLICATE KEY UPDATE description = CONCAT(vn.ticketObservation.description, VALUES(description),' ')`; await Self.rawSql(query, [ observation.ticketFk, diff --git a/modules/claim/back/methods/claim/isEditable.js b/modules/claim/back/methods/claim-state/isEditable.js similarity index 54% rename from modules/claim/back/methods/claim/isEditable.js rename to modules/claim/back/methods/claim-state/isEditable.js index cd14d70c7..ad51d543a 100644 --- a/modules/claim/back/methods/claim/isEditable.js +++ b/modules/claim/back/methods/claim-state/isEditable.js @@ -1,12 +1,12 @@ module.exports = Self => { Self.remoteMethodCtx('isEditable', { - description: 'Check if a claim is editable', + description: 'Check if an state is editable', accessType: 'READ', accepts: [{ arg: 'id', type: 'number', required: true, - description: 'the claim id', + description: 'the state id', http: {source: 'path'} }], returns: { @@ -21,25 +21,18 @@ module.exports = Self => { Self.isEditable = async(ctx, id, options) => { const userId = ctx.req.accessToken.userId; + const models = Self.app.models; const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); - const isClaimManager = await Self.app.models.Account.hasRole(userId, 'claimManager', myOptions); - - const claim = await Self.app.models.Claim.findById(id, { - fields: ['claimStateFk'], - include: [{ - relation: 'claimState' - }] + const state = await models.ClaimState.findById(id, { + include: { + relation: 'writeRole' + } }, myOptions); - - const isClaimResolved = claim && claim.claimState().code == 'resolved'; - - if (!claim || (isClaimResolved && !isClaimManager)) - return false; - - return true; + const roleWithGrants = state && state.writeRole().name; + return await models.Account.hasRole(userId, roleWithGrants, myOptions); }; }; diff --git a/modules/claim/back/methods/claim/specs/isEditable.spec.js b/modules/claim/back/methods/claim-state/specs/isEditable.spec.js similarity index 74% rename from modules/claim/back/methods/claim/specs/isEditable.spec.js rename to modules/claim/back/methods/claim-state/specs/isEditable.spec.js index 3afea7843..1fb8e1536 100644 --- a/modules/claim/back/methods/claim/specs/isEditable.spec.js +++ b/modules/claim/back/methods/claim-state/specs/isEditable.spec.js @@ -1,16 +1,16 @@ const app = require('vn-loopback/server/server'); -describe('claim isEditable()', () => { - const salesPerdonId = 18; +describe('claimstate isEditable()', () => { + const salesPersonId = 18; const claimManagerId = 72; - it('should return false if the given claim does not exist', async() => { + it('should return false if the given state does not exist', async() => { const tx = await app.models.Claim.beginTransaction({}); try { const options = {transaction: tx}; const ctx = {req: {accessToken: {userId: claimManagerId}}}; - const result = await app.models.Claim.isEditable(ctx, 99999, options); + const result = await app.models.ClaimState.isEditable(ctx, 9999, options); expect(result).toEqual(false); @@ -27,8 +27,8 @@ describe('claim isEditable()', () => { try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: salesPerdonId}}}; - const result = await app.models.Claim.isEditable(ctx, 4, options); + const ctx = {req: {accessToken: {userId: salesPersonId}}}; + const result = await app.models.ClaimState.isEditable(ctx, 3, options); expect(result).toEqual(false); @@ -46,7 +46,7 @@ describe('claim isEditable()', () => { const options = {transaction: tx}; const ctx = {req: {accessToken: {userId: claimManagerId}}}; - const result = await app.models.Claim.isEditable(ctx, 4, options); + const result = await app.models.ClaimState.isEditable(ctx, 3, options); expect(result).toEqual(true); @@ -63,8 +63,8 @@ describe('claim isEditable()', () => { try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: salesPerdonId}}}; - const result = await app.models.Claim.isEditable(ctx, 1, options); + const ctx = {req: {accessToken: {userId: claimManagerId}}}; + const result = await app.models.ClaimState.isEditable(ctx, 7, options); expect(result).toEqual(true); diff --git a/modules/claim/back/methods/claim/claimPickupEmail.js b/modules/claim/back/methods/claim/claimPickupEmail.js new file mode 100644 index 000000000..c688d6ded --- /dev/null +++ b/modules/claim/back/methods/claim/claimPickupEmail.js @@ -0,0 +1,92 @@ +const {Email} = require('vn-print'); + +module.exports = Self => { + Self.remoteMethodCtx('claimPickupEmail', { + description: 'Sends the the claim pickup order email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The claim id', + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id to send to the recipient preferred language', + required: false + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/:id/claim-pickup-email', + verb: 'POST' + } + }); + + Self.claimPickupEmail = async ctx => { + const models = Self.app.models; + const userId = ctx.req.accessToken.userId; + const $t = ctx.req.__; // $translate + const origin = ctx.req.headers.origin; + + const args = Object.assign({}, ctx.args); + const params = { + recipient: args.recipient, + lang: ctx.req.getLocale() + }; + + delete args.ctx; + for (const param in args) + params[param] = args[param]; + + const claim = await models.Claim.findById(args.id, { + fields: ['id', 'clientFk'], + include: { + relation: 'client', + scope: { + fields: ['name', 'salesPersonFk'] + } + } + }); + + const message = $t('Claim pickup order sent', { + claimId: args.id, + clientName: claim.client().name, + claimUrl: `${origin}/#!/claim/${args.id}/summary`, + }); + + const salesPersonId = claim.client().salesPersonFk; + if (salesPersonId) + await models.Chat.sendCheckingPresence(ctx, salesPersonId, message); + + await models.ClaimLog.create({ + originFk: args.id, + userFk: userId, + action: 'insert', + description: 'Claim-pickup-order sent', + changedModel: 'Mail' + }); + + const email = new Email('claim-pickup-order', params); + + return email.send(); + }; +}; diff --git a/modules/claim/back/methods/claim/claimPickupPdf.js b/modules/claim/back/methods/claim/claimPickupPdf.js new file mode 100644 index 000000000..4927efa0f --- /dev/null +++ b/modules/claim/back/methods/claim/claimPickupPdf.js @@ -0,0 +1,41 @@ +module.exports = Self => { + Self.remoteMethodCtx('claimPickupPdf', { + description: 'Returns the claim pickup order pdf', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The claim id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + } + ], + 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/claim-pickup-pdf', + verb: 'GET' + } + }); + + Self.claimPickupPdf = (ctx, id) => Self.printReport(ctx, id, 'claim-pickup-order'); +}; diff --git a/modules/claim/back/methods/claim/createFromSales.js b/modules/claim/back/methods/claim/createFromSales.js index ba7bda71d..2ce3bc44b 100644 --- a/modules/claim/back/methods/claim/createFromSales.js +++ b/modules/claim/back/methods/claim/createFromSales.js @@ -60,7 +60,7 @@ module.exports = Self => { const landedPlusWeek = new Date(ticket.landed); landedPlusWeek.setDate(landedPlusWeek.getDate() + 7); const hasClaimManagerRole = await models.Account.hasRole(userId, 'claimManager', myOptions); - const isClaimable = landedPlusWeek >= new Date(); + const isClaimable = landedPlusWeek >= Date.vnNew(); if (ticket.isDeleted) throw new UserError(`You can't create a claim for a removed ticket`); diff --git a/modules/claim/back/methods/claim/filter.js b/modules/claim/back/methods/claim/filter.js index e86830200..2daee6413 100644 --- a/modules/claim/back/methods/claim/filter.js +++ b/modules/claim/back/methods/claim/filter.js @@ -23,7 +23,7 @@ module.exports = Self => { { arg: 'search', type: 'string', - description: `If it's and integer searchs by id, otherwise it searchs by client name`, + description: `If it's a number searchs by id, otherwise it searchs by client name`, http: {source: 'query'} }, { @@ -34,31 +34,31 @@ module.exports = Self => { }, { arg: 'id', - type: 'integer', + type: 'number', description: 'The claim id', http: {source: 'query'} }, { arg: 'clientFk', - type: 'integer', + type: 'number', description: 'The client id', http: {source: 'query'} }, { arg: 'claimStateFk', - type: 'integer', + type: 'number', description: 'The claim state id', http: {source: 'query'} }, { arg: 'salesPersonFk', - type: 'integer', + type: 'number', description: 'The salesPerson id', http: {source: 'query'} }, { arg: 'attenderFk', - type: 'integer', + type: 'number', description: 'The attender worker id', http: {source: 'query'} }, @@ -67,6 +67,18 @@ module.exports = Self => { type: 'date', description: 'The to date filter', http: {source: 'query'} + }, + { + arg: 'itemFk', + type: 'number', + description: 'The item id', + http: {source: 'query'} + }, + { + arg: 'claimResponsibleFk', + type: 'number', + description: 'The claimResponsible id', + http: {source: 'query'} } ], returns: { @@ -80,33 +92,58 @@ module.exports = Self => { }); Self.filter = async(ctx, filter, options) => { + const models = Self.app.models; const conn = Self.dataSource.connector; + const args = ctx.args; const myOptions = {}; let to; if (typeof options == 'object') Object.assign(myOptions, options); - const where = buildFilter(ctx.args, (param, value) => { + let claimIdsByItemFk = []; + let claimIdsByClaimResponsibleFk = []; + + if (args.itemFk) { + query = `SELECT cb.claimFk + FROM claimBeginning cb + LEFT JOIN sale s ON s.id = cb.saleFk + WHERE s.itemFk = ?`; + const claims = await Self.rawSql(query, [args.itemFk], myOptions); + claimIdsByItemFk = claims.map(claim => claim.claimFk); + } + + if (args.claimResponsibleFk) { + const claims = await models.ClaimDevelopment.find({ + fields: ['claimFk'], + where: {claimResponsibleFk: args.claimResponsibleFk} + }, myOptions); + claimIdsByClaimResponsibleFk = claims.map(claim => claim.claimFk); + } + + const where = buildFilter(args, (param, value) => { switch (param) { case 'search': return /^\d+$/.test(value) ? {'cl.id': value} : { or: [ - {'cl.clientName': {like: `%${value}%`}} + {'c.name': {like: `%${value}%`}} ] }; case 'clientName': - return {'cl.clientName': {like: `%${value}%`}}; + return {'c.name': {like: `%${value}%`}}; case 'clientFk': - return {'cl.clientFk': value}; case 'id': case 'claimStateFk': case 'priority': return {[`cl.${param}`]: value}; + case 'itemFk': + return {'cl.id': {inq: claimIdsByItemFk}}; + case 'claimResponsibleFk': + return {'cl.id': {inq: claimIdsByClaimResponsibleFk}}; case 'salesPersonFk': - return {'cl.salesPersonFk': value}; + return {'c.salesPersonFk': value}; case 'attenderFk': return {'cl.workerFk': value}; case 'created': @@ -118,29 +155,24 @@ module.exports = Self => { } }); - filter = mergeFilters(ctx.args.filter, {where}); + filter = mergeFilters(args.filter, {where}); const stmts = []; const stmt = new ParameterizedSQL( - `SELECT * - FROM ( - SELECT - cl.id, - cl.clientFk, - c.name AS clientName, - cl.workerFk, - u.name AS workerName, - cs.description, - cl.created, - cs.priority, - cl.claimStateFk, - c.salesPersonFk - FROM claim cl - LEFT JOIN client c ON c.id = cl.clientFk - LEFT JOIN worker w ON w.id = cl.workerFk - LEFT JOIN account.user u ON u.id = w.userFk - LEFT JOIN claimState cs ON cs.id = cl.claimStateFk ) cl` + `SELECT + cl.id, + cl.clientFk, + c.name AS clientName, + cl.workerFk, + u.name AS workerName, + cs.code stateCode, + cs.description stateDescription, + cl.created + FROM claim cl + LEFT JOIN client c ON c.id = cl.clientFk + LEFT JOIN account.user u ON u.id = cl.workerFk + LEFT JOIN claimState cs ON cs.id = cl.claimStateFk` ); stmt.merge(conn.makeSuffix(filter)); diff --git a/modules/claim/back/methods/claim/getSummary.js b/modules/claim/back/methods/claim/getSummary.js index 0accbf920..d384f7ebb 100644 --- a/modules/claim/back/methods/claim/getSummary.js +++ b/modules/claim/back/methods/claim/getSummary.js @@ -47,7 +47,7 @@ module.exports = Self => { { relation: 'claimState', scope: { - fields: ['id', 'description'] + fields: ['id', 'code', 'description'] } }, { @@ -65,7 +65,8 @@ module.exports = Self => { ] }; - promises.push(Self.app.models.Claim.find(filter, myOptions)); + const models = Self.app.models; + promises.push(models.Claim.find(filter, myOptions)); // Claim detail filter = { @@ -82,7 +83,21 @@ module.exports = Self => { } ] }; - promises.push(Self.app.models.ClaimBeginning.find(filter, myOptions)); + promises.push(models.ClaimBeginning.find(filter, myOptions)); + + // Claim observations + filter = { + where: {claimFk: id}, + include: [ + { + relation: 'worker', + scope: { + fields: ['id', 'firstName', 'lastName'] + } + } + ] + }; + promises.push(models.ClaimObservation.find(filter, myOptions)); // Claim developments filter = { @@ -114,7 +129,7 @@ module.exports = Self => { } ] }; - promises.push(Self.app.models.ClaimDevelopment.find(filter, myOptions)); + promises.push(models.ClaimDevelopment.find(filter, myOptions)); // Claim action filter = { @@ -131,15 +146,16 @@ module.exports = Self => { {relation: 'claimBeggining'} ] }; - promises.push(Self.app.models.ClaimEnd.find(filter, myOptions)); + promises.push(models.ClaimEnd.find(filter, myOptions)); const res = await Promise.all(promises); - summary.isEditable = await Self.isEditable(ctx, id, myOptions); + summary.isEditable = await models.ClaimState.isEditable(ctx, res[0][0].claimStateFk, myOptions); [summary.claim] = res[0]; summary.salesClaimed = res[1]; - summary.developments = res[2]; - summary.actions = res[3]; + summary.observations = res[2]; + summary.developments = res[3]; + summary.actions = res[4]; return summary; }; diff --git a/modules/claim/back/methods/claim/logs.js b/modules/claim/back/methods/claim/logs.js new file mode 100644 index 000000000..f47513e9e --- /dev/null +++ b/modules/claim/back/methods/claim/logs.js @@ -0,0 +1,134 @@ + +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; +const buildFilter = require('vn-loopback/util/filter').buildFilter; +const { mergeFilters, mergeWhere } = require('vn-loopback/util/filter'); + +module.exports = Self => { + Self.remoteMethodCtx('logs', { + description: 'Find all claim logs of the claim entity matched by a filter', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'Number', + description: 'The claim id', + http: { source: 'path' } + }, + { + arg: 'filter', + type: 'object', + http: { source: 'query' } + }, + { + arg: 'search', + type: 'string', + http: { source: 'query' } + }, + { + arg: 'userFk', + type: 'number', + http: { source: 'query' } + }, + { + arg: 'created', + type: 'date', + http: { source: 'query' } + }, + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/:id/logs`, + verb: 'GET' + } + }); + + Self.logs = async (ctx, id, filter, options) => { + const conn = Self.dataSource.connector; + const args = ctx.args; + const myOptions = {}; + let to; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + let where = buildFilter(args, (param, value) => { + switch (param) { + case 'search': + return { + or: [ + { changedModel: { like: `%${value}%` } }, + { oldInstance: { like: `%${value}%` } } + ] + }; + case 'userFk': + return { 'cl.userFk': value }; + case 'created': + value.setHours(0, 0, 0, 0); + to = new Date(value); + to.setHours(23, 59, 59, 999); + + return { creationDate: { between: [value, to] } }; + } + }); + where = mergeWhere(where, { ['cl.originFk']: id }); + filter = mergeFilters(args.filter, { where }); + + const stmts = []; + + const stmt = new ParameterizedSQL( + `SELECT + cl.id, + cl.userFk, + u.name AS userName, + cl.oldInstance, + cl.newInstance, + cl.changedModel, + cl.action, + cl.creationDate AS created + FROM claimLog cl + JOIN account.user u ON u.id = cl.userFk + ` + ); + + stmt.merge(conn.makeSuffix(filter)); + stmts.push(stmt); + + const sql = ParameterizedSQL.join(stmts, ';'); + const result = await conn.executeStmt(sql, myOptions); + + const logs = []; + for (const row of result) { + const changes = []; + const oldInstance = JSON.parse(row.oldInstance) || {}; + const newInstance = JSON.parse(row.newInstance) || {}; + const mergedProperties = [...Object.keys(oldInstance), ...Object.keys(newInstance)]; + const properties = new Set(mergedProperties); + for (const property of properties) { + let oldValue = oldInstance[property]; + let newValue = newInstance[property]; + + const change = { + property: property, + before: oldValue, + after: newValue, + }; + + changes.push(change); + } + + logs.push({ + model: row.changedModel, + action: row.action, + created: row.created, + userFk: row.userFk, + userName: row.userName, + changes: changes, + }); + } + + return logs; + }; +}; diff --git a/modules/claim/back/methods/claim/regularizeClaim.js b/modules/claim/back/methods/claim/regularizeClaim.js index ab8ea58a4..672c94947 100644 --- a/modules/claim/back/methods/claim/regularizeClaim.js +++ b/modules/claim/back/methods/claim/regularizeClaim.js @@ -1,6 +1,6 @@ module.exports = Self => { Self.remoteMethodCtx('regularizeClaim', { - description: `Imports lines from claimBeginning to a new ticket + description: `Imports lines from claimBeginning to a new ticket with specific shipped, landed dates, agency and company`, accessType: 'WRITE', accepts: [{ @@ -135,10 +135,10 @@ module.exports = Self => { } async function getTicketId(params, options) { - const minDate = new Date(); + const minDate = Date.vnNew(); minDate.setHours(0, 0, 0, 0); - const maxDate = new Date(); + const maxDate = Date.vnNew(); maxDate.setHours(23, 59, 59, 59); let ticket = await Self.app.models.Ticket.findOne({ @@ -155,8 +155,8 @@ module.exports = Self => { } async function createTicket(ctx, options) { - ctx.args.shipped = new Date(); - ctx.args.landed = new Date(); + ctx.args.shipped = Date.vnNew(); + ctx.args.landed = Date.vnNew(); ctx.args.agencyModeId = null; ctx.args.routeId = null; diff --git a/modules/claim/back/methods/claim/specs/createFromSales.spec.js b/modules/claim/back/methods/claim/specs/createFromSales.spec.js index 9151c361e..7cf663caf 100644 --- a/modules/claim/back/methods/claim/specs/createFromSales.spec.js +++ b/modules/claim/back/methods/claim/specs/createFromSales.spec.js @@ -54,7 +54,7 @@ describe('Claim createFromSales()', () => { try { const options = {transaction: tx}; - const todayMinusEightDays = new Date(); + const todayMinusEightDays = Date.vnNew(); todayMinusEightDays.setDate(todayMinusEightDays.getDate() - 8); const ticket = await models.Ticket.findById(ticketId, null, options); @@ -85,7 +85,7 @@ describe('Claim createFromSales()', () => { try { const options = {transaction: tx}; - const todayMinusEightDays = new Date(); + const todayMinusEightDays = Date.vnNew(); todayMinusEightDays.setDate(todayMinusEightDays.getDate() - 8); const ticket = await models.Ticket.findById(ticketId, null, options); diff --git a/modules/claim/back/methods/claim/specs/filter.spec.js b/modules/claim/back/methods/claim/specs/filter.spec.js index b26afe8c4..49e258505 100644 --- a/modules/claim/back/methods/claim/specs/filter.spec.js +++ b/modules/claim/back/methods/claim/specs/filter.spec.js @@ -57,4 +57,44 @@ describe('claim filter()', () => { throw e; } }); + + it('should return 3 results filtering by item id', async() => { + const tx = await app.models.Claim.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const result = await app.models.Claim.filter({args: {filter: {}, itemFk: 2}}, null, options); + + expect(result.length).toEqual(3); + expect(result[0].id).toEqual(1); + expect(result[1].id).toEqual(2); + expect(result[2].id).toEqual(4); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return 3 results filtering by claimResponsible id', async() => { + const tx = await app.models.Claim.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const result = await app.models.Claim.filter({args: {filter: {}, claimResponsibleFk: 7}}, null, options); + + expect(result.length).toEqual(3); + expect(result[0].id).toEqual(2); + expect(result[1].id).toEqual(3); + expect(result[2].id).toEqual(4); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); }); diff --git a/modules/claim/back/methods/claim/specs/getSummary.spec.js b/modules/claim/back/methods/claim/specs/getSummary.spec.js index 6eb920b29..c4d01ecdc 100644 --- a/modules/claim/back/methods/claim/specs/getSummary.spec.js +++ b/modules/claim/back/methods/claim/specs/getSummary.spec.js @@ -19,6 +19,7 @@ describe('claim getSummary()', () => { expect(keys).toContain('claim'); expect(keys).toContain('salesClaimed'); expect(keys).toContain('developments'); + expect(keys).toContain('observations'); expect(keys).toContain('actions'); expect(keys).toContain('isEditable'); diff --git a/modules/claim/back/methods/claim/specs/log.spec.js b/modules/claim/back/methods/claim/specs/log.spec.js new file mode 100644 index 000000000..0ae534f1e --- /dev/null +++ b/modules/claim/back/methods/claim/specs/log.spec.js @@ -0,0 +1,23 @@ +const app = require('vn-loopback/server/server'); + +describe('claim log()', () => { + const claimId = 1; + const salesPersonId = 18; + + it('should return results filtering by user id', async() => { + const result = await app.models.Claim.logs({args: {userFk: salesPersonId}}, claimId); + + const expectedObject = { + model: 'Claim', + action: 'update', + changes: [ + {property: 'hasToPickUp', before: false, after: true} + ] + }; + + const firstRow = result[0]; + + expect(result.length).toBeGreaterThan(0); + expect(firstRow).toEqual(jasmine.objectContaining(expectedObject)); + }); +}); diff --git a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js index bf26d2255..276843c32 100644 --- a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js +++ b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js @@ -1,4 +1,5 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('claim regularizeClaim()', () => { const userId = 18; @@ -39,6 +40,20 @@ describe('claim regularizeClaim()', () => { return await models.ClaimEnd.create(claimEnds, options); } + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + it('should send a chat message with value "Trash" and then change claim state to resolved', async() => { const tx = await models.Claim.beginTransaction({}); diff --git a/modules/claim/back/methods/claim/specs/updateClaim.spec.js b/modules/claim/back/methods/claim/specs/updateClaim.spec.js index 8d888eb40..113df35c9 100644 --- a/modules/claim/back/methods/claim/specs/updateClaim.spec.js +++ b/modules/claim/back/methods/claim/specs/updateClaim.spec.js @@ -1,7 +1,7 @@ const app = require('vn-loopback/server/server'); describe('Update Claim', () => { - const newDate = new Date(); + const newDate = Date.vnNew(); const originalData = { ticketFk: 3, clientFk: 1101, diff --git a/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js b/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js index 4cd4ce528..12ab45fac 100644 --- a/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js +++ b/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js @@ -1,7 +1,7 @@ const app = require('vn-loopback/server/server'); describe('Update Claim', () => { - const newDate = new Date(); + const newDate = Date.vnNew(); const original = { ticketFk: 3, clientFk: 1101, diff --git a/modules/claim/back/methods/claim/updateClaim.js b/modules/claim/back/methods/claim/updateClaim.js index cc9937c19..5271136d6 100644 --- a/modules/claim/back/methods/claim/updateClaim.js +++ b/modules/claim/back/methods/claim/updateClaim.js @@ -2,6 +2,7 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethod('updateClaim', { description: 'Update a claim with privileges', + accessType: 'WRITE', accepts: [{ arg: 'ctx', type: 'object', @@ -78,11 +79,11 @@ module.exports = Self => { // Validate when claimState has been changed if (args.claimStateFk) { - const canUpdate = await canChangeState(ctx, claim.claimStateFk, myOptions); - const hasRights = await canChangeState(ctx, args.claimStateFk, myOptions); + const canEditOldState = await models.ClaimState.isEditable(ctx, claim.claimStateFk, myOptions); + const canEditNewState = await models.ClaimState.isEditable(ctx, args.claimStateFk, myOptions); const isClaimManager = await models.Account.hasRole(userId, 'claimManager', myOptions); - if (!canUpdate || !hasRights || changedHasToPickUp && !isClaimManager) + if (!canEditOldState || !canEditNewState || changedHasToPickUp && !isClaimManager) throw new UserError(`You don't have enough privileges to change that field`); } @@ -113,21 +114,6 @@ module.exports = Self => { } }; - async function canChangeState(ctx, id, options) { - let models = Self.app.models; - let userId = ctx.req.accessToken.userId; - - let state = await models.ClaimState.findById(id, { - include: { - relation: 'writeRole' - } - }, options); - let stateRole = state.writeRole().name; - let canUpdate = await models.Account.hasRole(userId, stateRole, options); - - return canUpdate; - } - async function notifyStateChange(ctx, workerId, claim, state) { const models = Self.app.models; const origin = ctx.req.headers.origin; diff --git a/modules/claim/back/model-config.json b/modules/claim/back/model-config.json index d4d772b58..83d88039c 100644 --- a/modules/claim/back/model-config.json +++ b/modules/claim/back/model-config.json @@ -2,6 +2,9 @@ "Claim": { "dataSource": "vn" }, + "ClaimContainer": { + "dataSource": "claimStorage" + }, "ClaimBeginning": { "dataSource": "vn" }, @@ -38,7 +41,10 @@ "ClaimLog": { "dataSource": "vn" }, - "ClaimContainer": { - "dataSource": "claimStorage" - } + "ClaimObservation": { + "dataSource": "vn" + }, + "ClaimRma": { + "dataSource": "vn" + } } diff --git a/modules/claim/back/models/claim-beginning.js b/modules/claim/back/models/claim-beginning.js index 681aaebc7..4c4b59737 100644 --- a/modules/claim/back/models/claim-beginning.js +++ b/modules/claim/back/models/claim-beginning.js @@ -11,7 +11,7 @@ module.exports = Self => { Self.observe('before save', async ctx => { if (ctx.isNewInstance) return; - await claimIsEditable(ctx); + //await claimIsEditable(ctx); }); Self.observe('before delete', async ctx => { @@ -22,8 +22,28 @@ module.exports = Self => { async function claimIsEditable(ctx) { const loopBackContext = LoopBackContext.getCurrentContext(); const httpCtx = {req: loopBackContext.active}; + const models = Self.app.models; + const myOptions = {}; + + if (ctx.options && ctx.options.transaction) + myOptions.transaction = ctx.options.transaction; + const claimBeginning = await Self.findById(ctx.where.id); - const isEditable = await Self.app.models.Claim.isEditable(httpCtx, claimBeginning.claimFk); + + const filter = { + where: {id: claimBeginning.claimFk}, + include: [ + { + relation: 'claimState', + scope: { + fields: ['id', 'code', 'description'] + } + } + ] + }; + + const [claim] = await models.Claim.find(filter, myOptions); + const isEditable = await models.ClaimState.isEditable(httpCtx, claim.claimState().id); if (!isEditable) throw new UserError(`The current claim can't be modified`); diff --git a/modules/claim/back/models/claim-observation.json b/modules/claim/back/models/claim-observation.json new file mode 100644 index 000000000..e882ad09d --- /dev/null +++ b/modules/claim/back/models/claim-observation.json @@ -0,0 +1,43 @@ +{ + "name": "ClaimObservation", + "base": "Loggable", + "log": { + "model": "ClaimLog", + "relation": "claim" + }, + "options": { + "mysql": { + "table": "claimObservation" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "claimFk": { + "type": "number", + "required": true + }, + "text": { + "type": "string", + "required": true + }, + "created": { + "type": "date" + } + }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + }, + "claim": { + "type": "belongsTo", + "model": "Claim", + "foreignKey": "claimFk" + } + } +} \ No newline at end of file diff --git a/modules/claim/back/models/claim-rma.js b/modules/claim/back/models/claim-rma.js new file mode 100644 index 000000000..6a93613bd --- /dev/null +++ b/modules/claim/back/models/claim-rma.js @@ -0,0 +1,9 @@ +const LoopBackContext = require('loopback-context'); + +module.exports = Self => { + Self.observe('before save', async function(ctx) { + const changes = ctx.data || ctx.instance; + const loopBackContext = LoopBackContext.getCurrentContext(); + changes.workerFk = loopBackContext.active.accessToken.userId; + }); +}; diff --git a/modules/claim/back/models/claim-rma.json b/modules/claim/back/models/claim-rma.json new file mode 100644 index 000000000..27c3c9729 --- /dev/null +++ b/modules/claim/back/models/claim-rma.json @@ -0,0 +1,30 @@ +{ + "name": "ClaimRma", + "base": "VnModel", + "options": { + "mysql": { + "table": "claimRma" + } + }, + "properties": { + "id": { + "id": true, + "type": "number", + "description": "Identifier" + }, + "code": { + "type": "string", + "required": true + }, + "created": { + "type": "date" + } + }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + } + } +} diff --git a/modules/claim/back/models/claim-state.js b/modules/claim/back/models/claim-state.js new file mode 100644 index 000000000..e0df5ac4d --- /dev/null +++ b/modules/claim/back/models/claim-state.js @@ -0,0 +1,3 @@ +module.exports = Self => { + require('../methods/claim-state/isEditable')(Self); +}; diff --git a/modules/claim/back/models/claim.js b/modules/claim/back/models/claim.js index e6dc50073..8e652f9fb 100644 --- a/modules/claim/back/models/claim.js +++ b/modules/claim/back/models/claim.js @@ -6,7 +6,9 @@ module.exports = Self => { require('../methods/claim/regularizeClaim')(Self); require('../methods/claim/uploadFile')(Self); require('../methods/claim/updateClaimAction')(Self); - require('../methods/claim/isEditable')(Self); require('../methods/claim/updateClaimDestination')(Self); require('../methods/claim/downloadFile')(Self); + require('../methods/claim/claimPickupPdf')(Self); + require('../methods/claim/claimPickupEmail')(Self); + require('../methods/claim/logs')(Self); }; diff --git a/modules/claim/back/models/claim.json b/modules/claim/back/models/claim.json index a3490ccf4..4b26720e5 100644 --- a/modules/claim/back/models/claim.json +++ b/modules/claim/back/models/claim.json @@ -46,6 +46,9 @@ }, "packages": { "type": "number" + }, + "rma": { + "type": "string" } }, "relations": { @@ -54,6 +57,12 @@ "model": "ClaimState", "foreignKey": "claimStateFk" }, + "rmas": { + "type": "hasMany", + "model": "ClaimRma", + "foreignKey": "code", + "primaryKey": "rma" + }, "client": { "type": "belongsTo", "model": "Client", @@ -68,6 +77,16 @@ "type": "belongsTo", "model": "Ticket", "foreignKey": "ticketFk" - } + }, + "claimDms": { + "type": "hasMany", + "model": "ClaimDms", + "foreignKey": "claimFk" + }, + "lines": { + "type": "hasMany", + "model": "ClaimBeginning", + "foreignKey": "claimFk" + } } } diff --git a/modules/claim/front/action/index.html b/modules/claim/front/action/index.html index 059764ae2..81b14d3a7 100644 --- a/modules/claim/front/action/index.html +++ b/modules/claim/front/action/index.html @@ -2,36 +2,36 @@ url="ClaimEnds/filter" link="{claimFk: $ctrl.$params.id}" data="$ctrl.salesClaimed" - auto-load="true" + auto-load="true" on-save="$ctrl.onSave()"> - - - -
@@ -47,7 +47,7 @@ @@ -66,12 +66,24 @@ Id Ticket - Destination - Landed - Quantity - Description - Price - Disc. + + Destination + + + Landed + + + Quantity + + + Description + + + Price + + + Disc. + Total @@ -80,21 +92,21 @@ ng-repeat="saleClaimed in $ctrl.salesClaimed" vn-repeat-last on-last="$ctrl.focusLastInput()"> - - - {{::saleClaimed.itemFk | zeroFill:6}} + {{::saleClaimed.itemFk}} {{::saleClaimed.ticketFk}} @@ -129,7 +141,7 @@ - @@ -140,17 +152,17 @@ vn-id="item-descriptor" warehouse-fk="$ctrl.vnConfig.warehouseFk"> - - - + @@ -173,4 +185,4 @@ - \ No newline at end of file + diff --git a/modules/claim/front/basic-data/index.html b/modules/claim/front/basic-data/index.html index 28fd92472..16e134c60 100644 --- a/modules/claim/front/basic-data/index.html +++ b/modules/claim/front/basic-data/index.html @@ -19,7 +19,7 @@ readonly="true"> @@ -51,21 +51,12 @@ label="Packages received" ng-model="$ctrl.claim.packages"> - - - - - - + title="{{'When checked will notify to the salesPerson' | translate}}"> diff --git a/modules/claim/front/basic-data/locale/es.yml b/modules/claim/front/basic-data/locale/es.yml index c51afee3f..5250d266c 100644 --- a/modules/claim/front/basic-data/locale/es.yml +++ b/modules/claim/front/basic-data/locale/es.yml @@ -5,5 +5,5 @@ Responsability: Responsabilidad Company: Empresa Sales/Client: Comercial/Cliente Pick up: Recoger -When checked will notify a pickup to the salesPerson: Cuando se marque enviará una notificación de recogida al comercial -Packages received: Bultos recibidos \ No newline at end of file +When checked will notify to the salesPerson: Cuando se marque enviará una notificación de recogida al comercial +Packages received: Bultos recibidos diff --git a/modules/claim/front/card/index.js b/modules/claim/front/card/index.js index 747eea9e7..4a8677c90 100644 --- a/modules/claim/front/card/index.js +++ b/modules/claim/front/card/index.js @@ -19,10 +19,26 @@ class Controller extends ModuleCard { }, { relation: 'ticket', scope: { - fields: ['agencyModeFk'], - include: { - relation: 'agencyMode' - } + fields: ['zoneFk', 'addressFk'], + include: [ + { + relation: 'zone', + scope: { + fields: ['name'] + } + }, + { + relation: 'address', + scope: { + fields: ['provinceFk'], + include: { + relation: 'province', + scope: { + fields: ['name'] + } + } + } + }] } }, { relation: 'claimState', diff --git a/modules/claim/front/descriptor/index.html b/modules/claim/front/descriptor/index.html index 56fd0bb35..5fd198440 100644 --- a/modules/claim/front/descriptor/index.html +++ b/modules/claim/front/descriptor/index.html @@ -10,6 +10,8 @@ Send Pickup order @@ -25,16 +27,16 @@
- {{$ctrl.claim.client.salesPersonUser.name}} @@ -42,19 +44,27 @@ - {{$ctrl.claim.worker.user.name}} + label="Zone"> + + {{$ctrl.claim.ticket.zone.name}} + + + - {{$ctrl.claim.ticketFk}} @@ -76,7 +86,20 @@ icon="icon-ticket">
-
+
+ + +
+
+ + +
@@ -92,12 +115,15 @@ question="Delete claim" message="Are you sure you want to delete this claim?"> - - - \ No newline at end of file + + + diff --git a/modules/claim/front/descriptor/index.js b/modules/claim/front/descriptor/index.js index 674ac91e1..0dddadbe1 100644 --- a/modules/claim/front/descriptor/index.js +++ b/modules/claim/front/descriptor/index.js @@ -11,17 +11,15 @@ class Controller extends Descriptor { } showPickupOrder() { - this.vnReport.show('claim-pickup-order', { - recipientId: this.claim.clientFk, - claimId: this.claim.id + this.vnReport.show(`Claims/${this.claim.id}/claim-pickup-pdf`, { + recipientId: this.claim.clientFk }); } sendPickupOrder() { - return this.vnEmail.send('claim-pickup-order', { + return this.vnEmail.send(`Claims/${this.claim.id}/claim-pickup-email`, { recipient: this.claim.client.email, - recipientId: this.claim.clientFk, - claimId: this.claim.id + recipientId: this.claim.clientFk }); } diff --git a/modules/claim/front/descriptor/index.spec.js b/modules/claim/front/descriptor/index.spec.js index 669a73954..e6785d3d8 100644 --- a/modules/claim/front/descriptor/index.spec.js +++ b/modules/claim/front/descriptor/index.spec.js @@ -24,12 +24,13 @@ describe('Item Component vnClaimDescriptor', () => { window.open = jasmine.createSpy('open'); const params = { - recipientId: claim.clientFk, - claimId: claim.id + recipientId: claim.clientFk }; controller.showPickupOrder(); - expect(controller.vnReport.show).toHaveBeenCalledWith('claim-pickup-order', params); + const expectedPath = `Claims/${claim.id}/claim-pickup-pdf`; + + expect(controller.vnReport.show).toHaveBeenCalledWith(expectedPath, params); }); }); @@ -39,12 +40,13 @@ describe('Item Component vnClaimDescriptor', () => { const params = { recipient: claim.client.email, - recipientId: claim.clientFk, - claimId: claim.id + recipientId: claim.clientFk }; controller.sendPickupOrder(); - expect(controller.vnEmail.send).toHaveBeenCalledWith('claim-pickup-order', params); + const expectedPath = `Claims/${claim.id}/claim-pickup-email`; + + expect(controller.vnEmail.send).toHaveBeenCalledWith(expectedPath, params); }); }); diff --git a/modules/claim/front/detail/index.js b/modules/claim/front/detail/index.js index 7c3c04f44..56f39e074 100644 --- a/modules/claim/front/detail/index.js +++ b/modules/claim/front/detail/index.js @@ -100,8 +100,8 @@ class Controller extends Section { } setClaimedQuantity(id, claimedQuantity) { - let params = {id: id, quantity: claimedQuantity}; - let query = `ClaimBeginnings/`; + let params = {quantity: claimedQuantity}; + let query = `ClaimBeginnings/${id}`; this.$http.patch(query, params).then(() => { this.vnApp.showSuccess(this.$t('Data saved!')); this.calculateTotals(); @@ -151,7 +151,7 @@ class Controller extends Section { isClaimEditable() { if (!this.claim) return; - this.$http.get(`Claims/${this.claim.id}/isEditable`).then(res => { + this.$http.get(`ClaimStates/${this.claim.claimStateFk}/isEditable`).then(res => { this.isRewritable = res.data; }); } diff --git a/modules/claim/front/detail/index.spec.js b/modules/claim/front/detail/index.spec.js index b36f3a172..1ef779fd7 100644 --- a/modules/claim/front/detail/index.spec.js +++ b/modules/claim/front/detail/index.spec.js @@ -17,12 +17,13 @@ describe('claim', () => { $httpBackend = _$httpBackend_; $httpBackend.whenGET('Claims/ClaimBeginnings').respond({}); $httpBackend.whenGET(`Tickets/1/isEditable`).respond(true); - $httpBackend.whenGET(`Claims/2/isEditable`).respond(true); + $httpBackend.whenGET(`ClaimStates/2/isEditable`).respond(true); const $element = angular.element(''); controller = $componentController('vnClaimDetail', {$element, $scope}); controller.claim = { ticketFk: 1, - id: 2} + id: 2, + claimStateFk: 2} ; controller.salesToClaim = [{saleFk: 1}, {saleFk: 2}]; controller.salesClaimed = [{id: 1, sale: {}}]; @@ -89,9 +90,12 @@ describe('claim', () => { describe('setClaimedQuantity(id, claimedQuantity)', () => { it('should make a patch and call refresh and showSuccess', () => { + const id = 1; + const claimedQuantity = 1; + jest.spyOn(controller.vnApp, 'showSuccess'); - $httpBackend.expectPATCH(`ClaimBeginnings/`).respond({}); - controller.setClaimedQuantity(1, 1); + $httpBackend.expectPATCH(`ClaimBeginnings/${id}`).respond({}); + controller.setClaimedQuantity(id, claimedQuantity); $httpBackend.flush(); expect(controller.vnApp.showSuccess).toHaveBeenCalled(); diff --git a/modules/claim/front/index.js b/modules/claim/front/index.js index ebbc6ea06..473f6a4d3 100644 --- a/modules/claim/front/index.js +++ b/modules/claim/front/index.js @@ -12,3 +12,5 @@ import './search-panel'; import './summary'; import './photos'; import './log'; +import './note/index'; +import './note/create'; diff --git a/modules/claim/front/index/index.html b/modules/claim/front/index/index.html index 102e27245..6b2481429 100644 --- a/modules/claim/front/index/index.html +++ b/modules/claim/front/index/index.html @@ -52,8 +52,8 @@ - - {{::claim.description}} + + {{::claim.stateDescription}} diff --git a/modules/claim/front/index/index.js b/modules/claim/front/index/index.js index 084618e16..e3fdabf79 100644 --- a/modules/claim/front/index/index.js +++ b/modules/claim/front/index/index.js @@ -55,13 +55,13 @@ class Controller extends Section { } } - stateColor(claim) { - switch (claim.description) { - case 'Pendiente': + stateColor(code) { + switch (code) { + case 'pending': return 'warning'; - case 'Gestionado': + case 'managed': return 'notice'; - case 'Resuelto': + case 'resolved': return 'success'; } } diff --git a/modules/claim/front/locale/es.yml b/modules/claim/front/locale/es.yml index dcbb2c484..419e62f56 100644 --- a/modules/claim/front/locale/es.yml +++ b/modules/claim/front/locale/es.yml @@ -6,6 +6,7 @@ Client Id: Id cliente Claimed ticket: Ticket reclamado Delete claim: Eliminar reclamación Observation: Observación +Observations: Observaciones Responsible: Responsable Remove sale: Eliminar linea Claim Id: Id reclamación @@ -17,3 +18,5 @@ Claim deleted!: Reclamación eliminada! claim: reclamación Photos: Fotos Go to the claim: Ir a la reclamación +Sale tracking: Líneas preparadas +Ticket tracking: Estados del ticket diff --git a/modules/claim/front/note/create/index.html b/modules/claim/front/note/create/index.html new file mode 100644 index 000000000..304a8c004 --- /dev/null +++ b/modules/claim/front/note/create/index.html @@ -0,0 +1,30 @@ + + +
+ + + + + + + + + + + + +
\ No newline at end of file diff --git a/modules/claim/front/note/create/index.js b/modules/claim/front/note/create/index.js new file mode 100644 index 000000000..40ae9309b --- /dev/null +++ b/modules/claim/front/note/create/index.js @@ -0,0 +1,22 @@ +import ngModule from '../../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section { + constructor($element, $) { + super($element, $); + this.note = { + claimFk: parseInt(this.$params.id), + workerFk: window.localStorage.currentUserWorkerId, + text: null + }; + } + + cancel() { + this.$state.go('claim.card.note.index', {id: this.$params.id}); + } +} + +ngModule.vnComponent('vnClaimNoteCreate', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/claim/front/note/index/index.html b/modules/claim/front/note/index/index.html new file mode 100644 index 000000000..8ffe19c2b --- /dev/null +++ b/modules/claim/front/note/index/index.html @@ -0,0 +1,32 @@ + + + + +
+ + {{::note.worker.firstName}} {{::note.worker.lastName}} + {{::note.created | date:'dd/MM/yyyy HH:mm'}} + + + {{::note.text}} + +
+
+
+ + + \ No newline at end of file diff --git a/modules/claim/front/note/index/index.js b/modules/claim/front/note/index/index.js new file mode 100644 index 000000000..5a2fd96d3 --- /dev/null +++ b/modules/claim/front/note/index/index.js @@ -0,0 +1,25 @@ +import ngModule from '../../module'; +import Section from 'salix/components/section'; +import './style.scss'; + +export default class Controller extends Section { + constructor($element, $) { + super($element, $); + this.filter = { + order: 'created DESC', + }; + this.include = { + relation: 'worker', + scope: { + fields: ['id', 'firstName', 'lastName'] + } + }; + } +} + +Controller.$inject = ['$element', '$scope']; + +ngModule.vnComponent('vnClaimNote', { + template: require('./index.html'), + controller: Controller, +}); diff --git a/modules/claim/front/note/index/style.scss b/modules/claim/front/note/index/style.scss new file mode 100644 index 000000000..44ae2cee7 --- /dev/null +++ b/modules/claim/front/note/index/style.scss @@ -0,0 +1,5 @@ +vn-client-note { + .note:last-child { + margin-bottom: 0; + } +} \ No newline at end of file diff --git a/modules/claim/front/routes.json b/modules/claim/front/routes.json index 5f08255be..a8b958c5f 100644 --- a/modules/claim/front/routes.json +++ b/modules/claim/front/routes.json @@ -12,6 +12,7 @@ {"state": "claim.card.basicData", "icon": "settings"}, {"state": "claim.card.detail", "icon": "icon-details"}, {"state": "claim.card.photos", "icon": "image"}, + {"state": "claim.card.note.index", "icon": "insert_drive_file"}, {"state": "claim.card.development", "icon": "icon-traceability"}, {"state": "claim.card.action", "icon": "icon-actions"}, {"state": "claim.card.log", "icon": "history"} @@ -27,17 +28,20 @@ "abstract": true, "component": "vn-claim", "description": "Claims" - }, { + }, + { "url": "/index?q", "state": "claim.index", "component": "vn-claim-index", "description": "Claims" - }, { + }, + { "url": "/:id", "state": "claim.card", "abstract": true, "component": "vn-claim-card" - }, { + }, + { "url": "/summary", "state": "claim.card.summary", "component": "vn-claim-summary", @@ -45,7 +49,8 @@ "params": { "claim": "$ctrl.claim" } - }, { + }, + { "url": "/basic-data", "state": "claim.card.basicData", "component": "vn-claim-basic-data", @@ -54,7 +59,8 @@ "claim": "$ctrl.claim" }, "acl": ["salesPerson"] - }, { + }, + { "url": "/detail", "state": "claim.card.detail", "component": "vn-claim-detail", @@ -63,7 +69,32 @@ "claim": "$ctrl.claim" }, "acl": ["salesPerson"] - }, { + }, + { + "url": "/note", + "state": "claim.card.note", + "component": "ui-view", + "abstract": true, + "acl": ["salesPerson"] + }, + { + "url": "/index", + "state": "claim.card.note.index", + "component": "vn-claim-note", + "description": "Notes", + "params": { + "claim": "$ctrl.claim" + }, + "acl": ["salesPerson"] + }, + { + "url": "/create", + "state": "claim.card.note.create", + "component": "vn-claim-note-create", + "description": "New note", + "acl": ["salesPerson"] + }, + { "url": "/development", "state": "claim.card.development", "component": "vn-claim-development", @@ -72,8 +103,9 @@ "claim": "$ctrl.claim" }, "acl": ["claimManager"] - }, { - "url": "/action", + }, + { + "url": "/action?q", "state": "claim.card.action", "component": "vn-claim-action", "description": "Action", @@ -81,7 +113,8 @@ "claim": "$ctrl.claim" }, "acl": ["claimManager"] - }, { + }, + { "url": "/photos", "state": "claim.card.photos", "component": "vn-claim-photos", @@ -89,7 +122,8 @@ "params": { "claim": "$ctrl.claim" } - }, { + }, + { "url" : "/log", "state": "claim.card.log", "component": "vn-claim-log", @@ -97,4 +131,4 @@ "acl": ["claimManager"] } ] -} \ No newline at end of file +} diff --git a/modules/claim/front/search-panel/index.html b/modules/claim/front/search-panel/index.html index d522763a1..151a06c8e 100644 --- a/modules/claim/front/search-panel/index.html +++ b/modules/claim/front/search-panel/index.html @@ -28,7 +28,7 @@ url="Workers/activeWithRole" search-function="{firstName: $search}" value-field="id" - where="{role: {inq: ['salesBoss', 'salesPerson', 'officeBoss']}}" + where="{role: {inq: ['salesTeamBoss', 'salesPerson', 'officeBoss']}}" label="Salesperson"> {{firstName}} {{name}} @@ -38,7 +38,7 @@ url="Workers/activeWithRole" search-function="{firstName: $search}" value-field="id" - where="{role: {inq: ['salesBoss', 'salesPerson']}}" + where="{role: {inq: ['salesTeamBoss', 'salesPerson']}}" label="Attended by"> {{firstName}} {{name}} @@ -58,8 +58,28 @@ ng-model="filter.created"> + + + {{::id}} - {{::name}} + + + + - \ No newline at end of file + diff --git a/modules/claim/front/search-panel/index.js b/modules/claim/front/search-panel/index.js index a7e8fb046..2400b8ede 100644 --- a/modules/claim/front/search-panel/index.js +++ b/modules/claim/front/search-panel/index.js @@ -1,7 +1,14 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; +class Controller extends SearchPanel { + itemSearchFunc($search) { + return /^\d+$/.test($search) + ? {id: $search} + : {name: {like: '%' + $search + '%'}}; + } +} ngModule.vnComponent('vnClaimSearchPanel', { template: require('./index.html'), - controller: SearchPanel + controller: Controller }); diff --git a/modules/claim/front/summary/index.html b/modules/claim/front/summary/index.html index 5d90da516..3115cb451 100644 --- a/modules/claim/front/summary/index.html +++ b/modules/claim/front/summary/index.html @@ -1,11 +1,12 @@ -
- {{::$ctrl.summary.claim.id}} - {{::$ctrl.summary.claim.client.name}} -
- - - - - - +

+ + Basic data + +

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

+ + Observations + +

+

+ Observations +

+
+ + {{::note.worker.firstName}} {{::note.worker.lastName}} + {{::note.created | date:'dd/MM/yyyy HH:mm'}} + + + {{::note.text}} + +
+

- Detail

-

Detail @@ -80,10 +112,10 @@ - - {{::saleClaimed.sale.itemFk | zeroFill:6}} + {{::saleClaimed.sale.itemFk}} {{::saleClaimed.sale.ticket.landed | date: 'dd/MM/yyyy'}} @@ -93,7 +125,7 @@ {{::saleClaimed.sale.price | currency: 'EUR':2}} {{::saleClaimed.sale.discount}} % - {{saleClaimed.sale.quantity * saleClaimed.sale.price * + {{saleClaimed.sale.quantity * saleClaimed.sale.price * ((100 - saleClaimed.sale.discount) / 100) | currency: 'EUR':2}} @@ -105,7 +137,7 @@

Photos

-
@@ -119,13 +151,13 @@

- Development

-

Development @@ -147,8 +179,8 @@ {{::development.claimResult.description}} {{::development.claimResponsible.description}} - {{::development.worker.user.nickname}} @@ -161,21 +193,21 @@

- Action

Action

- - {{::action.sale.itemFk | zeroFill:6}} + {{::action.sale.itemFk}} - {{::action.sale.ticket.id}} @@ -240,9 +272,9 @@ vn-id="item-descriptor" warehouse-fk="$ctrl.vnConfig.warehouseFk"> - - - \ No newline at end of file + diff --git a/modules/client/back/methods/client/campaignMetricsEmail.js b/modules/client/back/methods/client/campaignMetricsEmail.js new file mode 100644 index 000000000..3a1bac5e6 --- /dev/null +++ b/modules/client/back/methods/client/campaignMetricsEmail.js @@ -0,0 +1,55 @@ +const {Email} = require('vn-print'); + +module.exports = Self => { + Self.remoteMethodCtx('campaignMetricsEmail', { + description: 'Sends the campaign metrics email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id to send to the recipient preferred language', + required: false + }, + { + arg: 'from', + type: 'string', + required: true + }, + { + arg: 'to', + type: 'string', + required: true + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/:id/campaign-metrics-email', + verb: 'POST' + } + }); + + Self.campaignMetricsEmail = ctx => Self.sendTemplate(ctx, 'campaign-metrics'); +}; diff --git a/modules/client/back/methods/client/campaignMetricsPdf.js b/modules/client/back/methods/client/campaignMetricsPdf.js new file mode 100644 index 000000000..e163b0619 --- /dev/null +++ b/modules/client/back/methods/client/campaignMetricsPdf.js @@ -0,0 +1,52 @@ +module.exports = Self => { + Self.remoteMethodCtx('campaignMetricsPdf', { + description: 'Returns the campaign metrics pdf', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + }, + { + arg: 'from', + type: 'string', + required: true + }, + { + arg: 'to', + type: 'string', + required: true + } + ], + 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/campaign-metrics-pdf', + verb: 'GET' + } + }); + + Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'campaign-metrics'); +}; diff --git a/modules/client/back/methods/client/checkDuplicated.js b/modules/client/back/methods/client/checkDuplicated.js index acaffbf42..522cd088f 100644 --- a/modules/client/back/methods/client/checkDuplicated.js +++ b/modules/client/back/methods/client/checkDuplicated.js @@ -25,10 +25,9 @@ module.exports = Self => { const client = await Self.app.models.Client.findById(id, myOptions); - const emails = client.email ? client.email.split(',') : null; - const findParams = []; - if (emails.length) { + if (client.email) { + const emails = client.email.split(','); for (let email of emails) findParams.push({email: email}); } diff --git a/modules/client/back/methods/client/clientDebtStatementEmail.js b/modules/client/back/methods/client/clientDebtStatementEmail.js new file mode 100644 index 000000000..1b3ab13d8 --- /dev/null +++ b/modules/client/back/methods/client/clientDebtStatementEmail.js @@ -0,0 +1,50 @@ +const {Email} = require('vn-print'); + +module.exports = Self => { + Self.remoteMethodCtx('clientDebtStatementEmail', { + description: 'Sends the client debt statement email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id to send to the recipient preferred language', + required: false + }, + { + arg: 'from', + type: 'string', + required: true + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/:id/client-debt-statement-email', + verb: 'POST' + } + }); + + Self.clientDebtStatementEmail = ctx => Self.sendTemplate(ctx, 'client-debt-statement'); +}; diff --git a/modules/client/back/methods/client/clientDebtStatementHtml.js b/modules/client/back/methods/client/clientDebtStatementHtml.js new file mode 100644 index 000000000..8752b48d2 --- /dev/null +++ b/modules/client/back/methods/client/clientDebtStatementHtml.js @@ -0,0 +1,47 @@ +module.exports = Self => { + Self.remoteMethodCtx('clientDebtStatementHtml', { + description: 'Returns the client debt statement email preview', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + }, + { + arg: 'from', + type: 'string', + required: true + } + ], + 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/client-debt-statement-html', + verb: 'GET' + } + }); + + Self.clientDebtStatementHtml = (ctx, id) => Self.printEmail(ctx, id, 'client-debt-statement'); +}; diff --git a/modules/client/back/methods/client/clientDebtStatementPdf.js b/modules/client/back/methods/client/clientDebtStatementPdf.js new file mode 100644 index 000000000..845527ace --- /dev/null +++ b/modules/client/back/methods/client/clientDebtStatementPdf.js @@ -0,0 +1,47 @@ +module.exports = Self => { + Self.remoteMethodCtx('clientDebtStatementPdf', { + description: 'Returns the client debt statement pdf', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + }, + { + arg: 'from', + type: 'string', + required: true + } + ], + 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/client-debt-statement-pdf', + verb: 'GET' + } + }); + + Self.clientDebtStatementPdf = (ctx, id) => Self.printReport(ctx, id, 'client-debt-statement'); +}; diff --git a/modules/client/back/methods/client/clientWelcomeEmail.js b/modules/client/back/methods/client/clientWelcomeEmail.js new file mode 100644 index 000000000..accf12bb8 --- /dev/null +++ b/modules/client/back/methods/client/clientWelcomeEmail.js @@ -0,0 +1,43 @@ +module.exports = Self => { + Self.remoteMethodCtx('clientWelcomeEmail', { + description: 'Sends the client welcome email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id to send to the recipient preferred language', + required: false + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/:id/client-welcome-email', + verb: 'POST' + } + }); + + Self.clientWelcomeEmail = ctx => Self.sendTemplate(ctx, 'client-welcome'); +}; diff --git a/modules/client/back/methods/client/clientWelcomeHtml.js b/modules/client/back/methods/client/clientWelcomeHtml.js new file mode 100644 index 000000000..093a06d8e --- /dev/null +++ b/modules/client/back/methods/client/clientWelcomeHtml.js @@ -0,0 +1,42 @@ +module.exports = Self => { + Self.remoteMethodCtx('clientWelcomeHtml', { + description: 'Returns the client welcome email preview', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + } + ], + 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/client-welcome-html', + verb: 'GET' + } + }); + + Self.clientWelcomeHtml = (ctx, id) => Self.printEmail(ctx, id, 'client-welcome'); +}; diff --git a/modules/client/back/methods/client/consumptionSendQueued.js b/modules/client/back/methods/client/consumptionSendQueued.js new file mode 100644 index 000000000..31b54b21d --- /dev/null +++ b/modules/client/back/methods/client/consumptionSendQueued.js @@ -0,0 +1,80 @@ +const {Email} = require('vn-print'); + +module.exports = Self => { + Self.remoteMethod('consumptionSendQueued', { + description: 'Send all queued invoices', + accessType: 'WRITE', + accepts: [], + returns: { + type: 'object', + root: true + }, + http: { + path: '/consumption-send-queued', + verb: 'POST' + } + }); + + Self.consumptionSendQueued = async() => { + const queues = await Self.rawSql(` + SELECT + id, + params + FROM clientConsumptionQueue + WHERE status = ''`); + + for (const queue of queues) { + try { + const params = JSON.parse(queue.params); + + const clients = await Self.rawSql(` + SELECT + c.id AS clientFk, + c.email AS clientEmail, + eu.email salesPersonEmail + FROM client c + JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk + JOIN ticket t ON t.clientFk = c.id + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + WHERE c.id IN(?) + AND it.isPackaging = FALSE + AND DATE(t.shipped) BETWEEN ? AND ? + GROUP BY c.id`, [params.clients, params.from, params.to]); + + for (const client of clients) { + const args = { + id: client.clientFk, + recipient: client.clientEmail, + replyTo: client.salesPersonEmail, + from: params.from, + to: params.to + }; + + const email = new Email('campaign-metrics', args); + await email.send(); + } + + await Self.rawSql(` + UPDATE clientConsumptionQueue + SET status = 'printed', + printed = ? + WHERE id = ?`, + [Date.vnNew(), queue.id]); + } catch (error) { + await Self.rawSql(` + UPDATE clientConsumptionQueue + SET status = ? + WHERE id = ?`, + [error.message, queue.id]); + + throw error; + } + } + + return { + message: 'Success' + }; + }; +}; diff --git a/modules/client/back/methods/client/createReceipt.js b/modules/client/back/methods/client/createReceipt.js index a75ee8844..cb032270a 100644 --- a/modules/client/back/methods/client/createReceipt.js +++ b/modules/client/back/methods/client/createReceipt.js @@ -51,7 +51,7 @@ module.exports = function(Self) { Self.createReceipt = async(ctx, options) => { const models = Self.app.models; const args = ctx.args; - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); let tx; @@ -67,7 +67,7 @@ module.exports = function(Self) { try { delete args.ctx; // Remove unwanted properties - const newReceipt = await models.Receipt.create(args, myOptions); + const originalClient = await models.Client.findById(args.clientFk, null, myOptions); const bank = await models.Bank.findById(args.bankFk, null, myOptions); const accountingType = await models.AccountingType.findById(bank.accountingTypeFk, null, myOptions); @@ -76,23 +76,8 @@ module.exports = function(Self) { if (!args.compensationAccount) throw new UserError('Compensation account is empty'); - const supplierCompensation = await models.Supplier.findOne({ - where: { - account: args.compensationAccount - } - }, myOptions); - - let clientCompensation = {}; - - if (!supplierCompensation) { - clientCompensation = await models.Client.findOne({ - where: { - accountingAccount: args.compensationAccount - } - }, myOptions); - } - if (!supplierCompensation && !clientCompensation) - throw new UserError('Invalid account'); + // Check compensation account exists + await models.Client.getClientOrSupplierReference(args.compensationAccount, myOptions); await Self.rawSql( `CALL vn.ledger_doCompensation(?, ?, ?, ?, ?, ?, ?)`, @@ -151,7 +136,7 @@ module.exports = function(Self) { myOptions ); } - + const newReceipt = await models.Receipt.create(args, myOptions); if (tx) await tx.commit(); return newReceipt; diff --git a/modules/client/back/methods/client/creditRequestEmail.js b/modules/client/back/methods/client/creditRequestEmail.js new file mode 100644 index 000000000..0255949e0 --- /dev/null +++ b/modules/client/back/methods/client/creditRequestEmail.js @@ -0,0 +1,44 @@ +module.exports = Self => { + Self.remoteMethodCtx('clientCreditEmail', { + description: 'Sends the credit request email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'}, + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false, + }, + { + arg: 'recipientId', + type: 'number', + description: + 'The recipient id to send to the recipient preferred language', + required: false, + }, + ], + returns: { + type: ['object'], + root: true, + }, + http: { + path: '/:id/credit-request-email', + verb: 'POST', + }, + }); + + Self.clientCreditEmail = ctx => Self.sendTemplate(ctx, 'credit-request'); +}; diff --git a/modules/client/back/methods/client/creditRequestHtml.js b/modules/client/back/methods/client/creditRequestHtml.js new file mode 100644 index 000000000..fbd6cacb9 --- /dev/null +++ b/modules/client/back/methods/client/creditRequestHtml.js @@ -0,0 +1,42 @@ +module.exports = Self => { + Self.remoteMethodCtx('creditRequestHtml', { + description: 'Returns the credit request email preview', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + } + ], + 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/credit-request-html', + verb: 'GET' + } + }); + + Self.creditRequestHtml = (ctx, id) => Self.printEmail(ctx, id, 'credit-request'); +}; diff --git a/modules/client/back/methods/client/creditRequestPdf.js b/modules/client/back/methods/client/creditRequestPdf.js new file mode 100644 index 000000000..a4f4ed128 --- /dev/null +++ b/modules/client/back/methods/client/creditRequestPdf.js @@ -0,0 +1,42 @@ +module.exports = Self => { + Self.remoteMethodCtx('creditRequestPdf', { + description: 'Returns the credit request pdf', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + } + ], + 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/credit-request-pdf', + verb: 'GET' + } + }); + + Self.creditRequestPdf = (ctx, id) => Self.printReport(ctx, id, 'credit-request'); +}; diff --git a/modules/client/back/methods/client/extendedListFilter.js b/modules/client/back/methods/client/extendedListFilter.js index 8e02cd413..27bbe2a35 100644 --- a/modules/client/back/methods/client/extendedListFilter.js +++ b/modules/client/back/methods/client/extendedListFilter.js @@ -97,7 +97,7 @@ module.exports = Self => { const stmts = []; const stmt = new ParameterizedSQL( - `SELECT + `SELECT c.id, c.name, c.socialName, diff --git a/modules/client/back/methods/client/filter.js b/modules/client/back/methods/client/filter.js new file mode 100644 index 000000000..1ae569fd3 --- /dev/null +++ b/modules/client/back/methods/client/filter.js @@ -0,0 +1,155 @@ + +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', { + description: 'Find all clients matched by the filter', + accessType: 'READ', + accepts: [ + { + arg: 'filter', + type: 'object', + }, + { + arg: 'search', + type: 'string', + description: `If it's and integer searchs by id, otherwise it searchs by name`, + }, + { + arg: 'name', + type: 'string', + description: 'The client name', + }, + { + arg: 'salesPersonFk', + type: 'number', + }, + { + arg: 'fi', + type: 'string', + description: 'The client fiscal id', + }, + { + arg: 'socialName', + type: 'string', + }, + { + arg: 'city', + type: 'string', + }, + { + arg: 'postcode', + type: 'string', + }, + { + arg: 'provinceFk', + type: 'number', + }, + { + arg: 'email', + type: 'string', + }, + { + arg: 'phone', + type: 'string', + }, + { + arg: 'zoneFk', + type: 'number', + }, + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/filter`, + verb: 'GET' + } + }); + + Self.filter = async(ctx, filter, options) => { + const conn = Self.dataSource.connector; + const myOptions = {}; + const postalCode = []; + const args = ctx.args; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (args.zoneFk) { + query = `CALL vn.zone_getPostalCode(?)`; + const [geos] = await Self.rawSql(query, [args.zoneFk]); + for (let geo of geos) + postalCode.push(geo.name); + } + + const where = buildFilter(ctx.args, (param, value) => { + switch (param) { + case 'search': + return /^\d+$/.test(value) + ? {'c.id': {inq: value}} + : {or: [ + {'c.name': {like: `%${value}%`}}, + {'c.socialName': {like: `%${value}%`}}, + ]}; + case 'phone': + return {or: [ + {'c.phone': {like: `%${value}%`}}, + {'c.mobile': {like: `%${value}%`}}, + ]}; + case 'zoneFk': + param = 'a.postalCode'; + return {[param]: {inq: postalCode}}; + case 'name': + case 'salesPersonFk': + case 'fi': + case 'socialName': + case 'city': + case 'postcode': + case 'provinceFk': + case 'email': + param = `c.${param}`; + return {[param]: {like: `%${value}%`}}; + } + }); + + filter = mergeFilters(filter, {where}); + + const stmts = []; + const stmt = new ParameterizedSQL( + `SELECT + DISTINCT c.id, + c.name, + c.fi, + c.socialName, + c.phone, + c.mobile, + c.city, + c.postcode, + c.email, + c.isActive, + c.isFreezed, + p.id AS provinceFk, + p.name AS province, + u.id AS salesPersonFk, + u.name AS salesPerson + FROM client c + LEFT JOIN account.user u ON u.id = c.salesPersonFk + LEFT JOIN province p ON p.id = c.provinceFk + JOIN vn.address a ON a.clientFk = c.id + ` + ); + + stmt.merge(conn.makeWhere(filter.where)); + stmt.merge(conn.makePagination(filter)); + + const clientsIndex = stmts.push(stmt) - 1; + const sql = ParameterizedSQL.join(stmts, ';'); + const result = await conn.executeStmt(sql, myOptions); + + return clientsIndex === 0 ? result : result[clientsIndex]; + }; +}; diff --git a/modules/client/back/methods/client/getCard.js b/modules/client/back/methods/client/getCard.js index f7f8c505b..a2365ee25 100644 --- a/modules/client/back/methods/client/getCard.js +++ b/modules/client/back/methods/client/getCard.js @@ -62,7 +62,7 @@ module.exports = function(Self) { { relation: 'account', scope: { - fields: ['id', 'name', 'active'] + fields: ['id', 'name', 'email', 'active'] } }, { @@ -74,12 +74,13 @@ module.exports = function(Self) { ] }, myOptions); - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); const query = `SELECT vn.clientGetDebt(?, ?) AS debt`; const data = await Self.rawSql(query, [id, date], myOptions); client.debt = data[0].debt; + client.unpaid = await Self.app.models.ClientUnpaid.findById(id, null, myOptions); return client; }; diff --git a/modules/client/back/methods/client/getClientOrSupplierReference.js b/modules/client/back/methods/client/getClientOrSupplierReference.js new file mode 100644 index 000000000..4c7201ee3 --- /dev/null +++ b/modules/client/back/methods/client/getClientOrSupplierReference.js @@ -0,0 +1,57 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethod('getClientOrSupplierReference', { + description: 'Returns the reference of a compensation providing a bank account', + accessType: 'READ', + accepts: { + arg: 'bankAccount', + type: 'number', + required: true, + description: 'The bank account of a client or a supplier' + }, + returns: { + type: 'string', + root: true + }, + http: { + path: `/getClientOrSupplierReference`, + verb: 'GET' + } + }); + + Self.getClientOrSupplierReference = async(bankAccount, options) => { + const models = Self.app.models; + const myOptions = {}; + let reference = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const supplierCompensation = await models.Supplier.findOne({ + where: { + account: bankAccount + } + }, myOptions); + + reference.supplierId = supplierCompensation?.id; + reference.supplierName = supplierCompensation?.name; + + let clientCompensation = {}; + + if (!supplierCompensation) { + clientCompensation = await models.Client.findOne({ + where: { + accountingAccount: bankAccount + } + }, myOptions); + reference.clientId = clientCompensation?.id; + reference.clientName = clientCompensation?.name; + } + + if (!supplierCompensation && !clientCompensation) + throw new UserError('Invalid account'); + + return reference; + }; +}; diff --git a/modules/client/back/methods/client/getDebt.js b/modules/client/back/methods/client/getDebt.js index aafdbfa48..5f8a8c569 100644 --- a/modules/client/back/methods/client/getDebt.js +++ b/modules/client/back/methods/client/getDebt.js @@ -25,7 +25,7 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); const query = `SELECT vn.clientGetDebt(?, ?) AS debt`; const [debt] = await Self.rawSql(query, [clientFk, date], myOptions); diff --git a/modules/client/back/methods/client/getTransactions.js b/modules/client/back/methods/client/getTransactions.js deleted file mode 100644 index 45183bbdc..000000000 --- a/modules/client/back/methods/client/getTransactions.js +++ /dev/null @@ -1,49 +0,0 @@ - -const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; - -module.exports = Self => { - Self.remoteMethod('getTransactions', { - description: 'Returns last entries', - 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: `/getTransactions`, - verb: 'GET' - } - }); - - Self.getTransactions = async(filter, options) => { - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - const conn = Self.dataSource.connector; - const stmt = new ParameterizedSQL(` - SELECT - t.id, - t.clientFk, - t.created, - t.amount / 100 amount, - t.receiptFk IS NOT NULL AS isConfirmed, - tt.message responseMessage, - te.message errorMessage - FROM hedera.tpvTransaction t - JOIN hedera.tpvMerchant m ON m.id = t.merchantFk - LEFT JOIN hedera.tpvResponse tt ON tt.id = t.response - LEFT JOIN hedera.tpvError te ON te.code = errorCode`); - - stmt.merge(conn.makeSuffix(filter, 't')); - - return Self.rawStmt(stmt, myOptions); - }; -}; diff --git a/modules/client/back/methods/client/incotermsAuthorizationEmail.js b/modules/client/back/methods/client/incotermsAuthorizationEmail.js new file mode 100644 index 000000000..4a21f20b0 --- /dev/null +++ b/modules/client/back/methods/client/incotermsAuthorizationEmail.js @@ -0,0 +1,49 @@ +module.exports = Self => { + Self.remoteMethodCtx('incotermsAuthorizationEmail', { + description: 'Sends the incoterms authorization email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id to send to the recipient preferred language', + required: false + }, + { + arg: 'companyId', + type: 'number', + description: 'The company id', + required: true + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/:id/incoterms-authorization-email', + verb: 'POST' + } + }); + + Self.incotermsAuthorizationEmail = ctx => Self.sendTemplate(ctx, 'incoterms-authorization'); +}; diff --git a/modules/client/back/methods/client/incotermsAuthorizationHtml.js b/modules/client/back/methods/client/incotermsAuthorizationHtml.js new file mode 100644 index 000000000..0a6bba0a8 --- /dev/null +++ b/modules/client/back/methods/client/incotermsAuthorizationHtml.js @@ -0,0 +1,48 @@ +module.exports = Self => { + Self.remoteMethodCtx('incotermsAuthorizationHtml', { + description: 'Returns the incoterms authorization email preview', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + }, + { + arg: 'companyId', + type: 'number', + description: 'The company id', + required: true + } + ], + 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/incoterms-authorization-html', + verb: 'GET' + } + }); + + Self.incotermsAuthorizationHtml = (ctx, id) => Self.printEmail(ctx, id, 'incoterms-authorization'); +}; diff --git a/modules/client/back/methods/client/incotermsAuthorizationPdf.js b/modules/client/back/methods/client/incotermsAuthorizationPdf.js new file mode 100644 index 000000000..d37e473f1 --- /dev/null +++ b/modules/client/back/methods/client/incotermsAuthorizationPdf.js @@ -0,0 +1,48 @@ +module.exports = Self => { + Self.remoteMethodCtx('incotermsAuthorizationPdf', { + description: 'Returns the incoterms authorization pdf', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + }, + { + arg: 'companyId', + type: 'number', + description: 'The company id', + required: true + } + ], + 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/incoterms-authorization-pdf', + verb: 'GET' + } + }); + + Self.incotermsAuthorizationPdf = (ctx, id) => Self.printReport(ctx, id, 'incoterms-authorization'); +}; diff --git a/modules/client/back/methods/client/lastActiveTickets.js b/modules/client/back/methods/client/lastActiveTickets.js index 03616a0e3..d662f75aa 100644 --- a/modules/client/back/methods/client/lastActiveTickets.js +++ b/modules/client/back/methods/client/lastActiveTickets.js @@ -32,14 +32,14 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); const ticket = await Self.app.models.Ticket.findById(ticketId, null, myOptions); const query = ` - SELECT + SELECT t.id, t.shipped, - a.name AS agencyName, + a.name AS agencyName, w.name AS warehouseName, ad.nickname AS nickname, ad.city AS city, @@ -52,7 +52,7 @@ module.exports = Self => { JOIN vn.warehouse w ON t.warehouseFk = w.id JOIN vn.address ad ON t.addressFk = ad.id JOIN vn.province pr ON ad.provinceFk = pr.id - WHERE t.shipped >= ? AND t.clientFk = ? AND ts.alertLevel = 0 + WHERE t.shipped >= ? AND t.clientFk = ? AND ts.alertLevel = 0 AND t.id <> ? AND t.warehouseFk = ? ORDER BY t.shipped LIMIT 10`; diff --git a/modules/client/back/methods/client/letterDebtorNdEmail.js b/modules/client/back/methods/client/letterDebtorNdEmail.js new file mode 100644 index 000000000..396acdb97 --- /dev/null +++ b/modules/client/back/methods/client/letterDebtorNdEmail.js @@ -0,0 +1,49 @@ +module.exports = Self => { + Self.remoteMethodCtx('letterDebtorNdEmail', { + description: 'Sends the second debtor letter email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id to send to the recipient preferred language', + required: false + }, + { + arg: 'companyId', + type: 'number', + description: 'The company id', + required: true + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/:id/letter-debtor-nd-email', + verb: 'POST' + } + }); + + Self.letterDebtorNdEmail = ctx => Self.sendTemplate(ctx, 'letter-debtor-nd'); +}; diff --git a/modules/client/back/methods/client/letterDebtorNdHtml.js b/modules/client/back/methods/client/letterDebtorNdHtml.js new file mode 100644 index 000000000..f14f96dea --- /dev/null +++ b/modules/client/back/methods/client/letterDebtorNdHtml.js @@ -0,0 +1,48 @@ +module.exports = Self => { + Self.remoteMethodCtx('letterDebtorNdHtml', { + description: 'Returns the second letter debtor email preview', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + }, + { + arg: 'companyId', + type: 'number', + description: 'The company id', + required: true + } + ], + 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/letter-debtor-nd-html', + verb: 'GET' + } + }); + + Self.letterDebtorNdHtml = (ctx, id) => Self.printEmail(ctx, id, 'letter-debtor-nd'); +}; diff --git a/modules/client/back/methods/client/letterDebtorPdf.js b/modules/client/back/methods/client/letterDebtorPdf.js new file mode 100644 index 000000000..943869143 --- /dev/null +++ b/modules/client/back/methods/client/letterDebtorPdf.js @@ -0,0 +1,48 @@ +module.exports = Self => { + Self.remoteMethodCtx('letterDebtorPdf', { + description: 'Returns the letter debtor pdf', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + }, + { + arg: 'companyId', + type: 'number', + description: 'The company id', + required: true + } + ], + 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/letter-debtor-pdf', + verb: 'GET' + } + }); + + Self.letterDebtorPdf = (ctx, id) => Self.printReport(ctx, id, 'letter-debtor'); +}; diff --git a/modules/client/back/methods/client/letterDebtorStEmail.js b/modules/client/back/methods/client/letterDebtorStEmail.js new file mode 100644 index 000000000..c76204fbc --- /dev/null +++ b/modules/client/back/methods/client/letterDebtorStEmail.js @@ -0,0 +1,49 @@ +module.exports = Self => { + Self.remoteMethodCtx('letterDebtorStEmail', { + description: 'Sends the printer setup email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id to send to the recipient preferred language', + required: false + }, + { + arg: 'companyId', + type: 'number', + description: 'The company id', + required: true + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/:id/letter-debtor-st-email', + verb: 'POST' + } + }); + + Self.letterDebtorStEmail = ctx => Self.sendTemplate(ctx, 'letter-debtor-st'); +}; diff --git a/modules/client/back/methods/client/letterDebtorStHtml.js b/modules/client/back/methods/client/letterDebtorStHtml.js new file mode 100644 index 000000000..a1dcf00d7 --- /dev/null +++ b/modules/client/back/methods/client/letterDebtorStHtml.js @@ -0,0 +1,48 @@ +module.exports = Self => { + Self.remoteMethodCtx('letterDebtorStHtml', { + description: 'Returns the letter debtor email preview', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + }, + { + arg: 'companyId', + type: 'number', + description: 'The company id', + required: true + } + ], + 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/letter-debtor-st-html', + verb: 'GET' + } + }); + + Self.letterDebtorStHtml = (ctx, id) => Self.printEmail(ctx, id, 'letter-debtor-st'); +}; diff --git a/modules/client/back/methods/client/printerSetupEmail.js b/modules/client/back/methods/client/printerSetupEmail.js new file mode 100644 index 000000000..2a0903e90 --- /dev/null +++ b/modules/client/back/methods/client/printerSetupEmail.js @@ -0,0 +1,43 @@ +module.exports = Self => { + Self.remoteMethodCtx('printerSetupEmail', { + description: 'Sends the printer setup email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id to send to the recipient preferred language', + required: false + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/:id/printer-setup-email', + verb: 'POST' + } + }); + + Self.printerSetupEmail = ctx => Self.sendTemplate(ctx, 'printer-setup'); +}; diff --git a/modules/client/back/methods/client/printerSetupHtml.js b/modules/client/back/methods/client/printerSetupHtml.js new file mode 100644 index 000000000..c9d94d1c2 --- /dev/null +++ b/modules/client/back/methods/client/printerSetupHtml.js @@ -0,0 +1,42 @@ +module.exports = Self => { + Self.remoteMethodCtx('printerSetupHtml', { + description: 'Returns the printer setup email preview', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + } + ], + 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/printer-setup-html', + verb: 'GET' + } + }); + + Self.printerSetupHtml = (ctx, id) => Self.printEmail(ctx, id, 'printer-setup'); +}; diff --git a/modules/client/back/methods/client/sepaCoreEmail.js b/modules/client/back/methods/client/sepaCoreEmail.js new file mode 100644 index 000000000..20931eb03 --- /dev/null +++ b/modules/client/back/methods/client/sepaCoreEmail.js @@ -0,0 +1,49 @@ +module.exports = Self => { + Self.remoteMethodCtx('sepaCoreEmail', { + description: 'Sends the campaign metrics email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id to send to the recipient preferred language', + required: false + }, + { + arg: 'companyId', + type: 'number', + description: 'The company id', + required: true + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/:id/sepa-core-email', + verb: 'POST' + } + }); + + Self.sepaCoreEmail = ctx => Self.sendTemplate(ctx, 'sepa-core'); +}; diff --git a/modules/client/back/methods/client/setPassword.js b/modules/client/back/methods/client/setPassword.js index 19675d0e8..e3fc9bbf8 100644 --- a/modules/client/back/methods/client/setPassword.js +++ b/modules/client/back/methods/client/setPassword.js @@ -1,5 +1,6 @@ +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethod('setPassword', { + Self.remoteMethodCtx('setPassword', { description: 'Sets the password of a non-worker client', accepts: [ { @@ -20,13 +21,15 @@ module.exports = Self => { } }); - Self.setPassword = async function(id, newPassword) { + Self.setPassword = async function(ctx, id, newPassword) { const models = Self.app.models; - const isWorker = await models.Worker.findById(id); - if (isWorker) - throw new Error(`Can't change the password of another worker`); + const isClient = await models.Client.findById(id, null); + const isUserAccount = await models.UserAccount.findById(id, null); - await models.Account.setPassword(id, newPassword); + if (isClient && !isUserAccount) + await models.Account.setPassword(id, newPassword); + else + throw new UserError(`Modifiable password only via recovery or by an administrator`); }; }; diff --git a/modules/client/back/methods/client/specs/createWithUser.spec.js b/modules/client/back/methods/client/specs/createWithUser.spec.js index 7d4261aee..4cc51c93c 100644 --- a/modules/client/back/methods/client/specs/createWithUser.spec.js +++ b/modules/client/back/methods/client/specs/createWithUser.spec.js @@ -10,7 +10,8 @@ describe('Client Create', () => { socialName: 'Deadpool Marvel', street: 'Wall Street', city: 'New York', - businessTypeFk: 'florist' + businessTypeFk: 'florist', + provinceFk: 1 }; beforeAll(async() => { diff --git a/modules/client/back/methods/client/specs/extendedListFilter.spec.js b/modules/client/back/methods/client/specs/extendedListFilter.spec.js index 907c03ef9..9a0441656 100644 --- a/modules/client/back/methods/client/specs/extendedListFilter.spec.js +++ b/modules/client/back/methods/client/specs/extendedListFilter.spec.js @@ -1,4 +1,4 @@ -const { models } = require('vn-loopback/server/server'); +const {models} = require('vn-loopback/server/server'); describe('client extendedListFilter()', () => { it('should return the clients matching the filter with a limit of 20 rows', async() => { @@ -99,7 +99,7 @@ describe('client extendedListFilter()', () => { const randomIndex = Math.floor(Math.random() * result.length); const randomResultClient = result[randomIndex]; - + expect(result.length).toBeGreaterThanOrEqual(5); expect(randomResultClient.salesPersonFk).toEqual(salesPersonId); @@ -121,7 +121,7 @@ describe('client extendedListFilter()', () => { const result = await models.Client.extendedListFilter(ctx, filter, options); const firstClient = result[0]; - + expect(result.length).toEqual(1); expect(firstClient.name).toEqual('Max Eisenhardt'); @@ -138,15 +138,15 @@ describe('client extendedListFilter()', () => { try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: 1}}, args: {city: 'Silla'}}; + const ctx = {req: {accessToken: {userId: 1}}, args: {city: 'Gotham'}}; const filter = {}; const result = await models.Client.extendedListFilter(ctx, filter, options); const randomIndex = Math.floor(Math.random() * result.length); const randomResultClient = result[randomIndex]; - + expect(result.length).toBeGreaterThanOrEqual(20); - expect(randomResultClient.city.toLowerCase()).toEqual('silla'); + expect(randomResultClient.city.toLowerCase()).toEqual('gotham'); await tx.rollback(); } catch (e) { @@ -167,7 +167,7 @@ describe('client extendedListFilter()', () => { const randomIndex = Math.floor(Math.random() * result.length); const randomResultClient = result[randomIndex]; - + expect(result.length).toBeGreaterThanOrEqual(20); expect(randomResultClient.postcode).toEqual('46460'); diff --git a/modules/client/back/methods/client/specs/filter.spec.js b/modules/client/back/methods/client/specs/filter.spec.js new file mode 100644 index 000000000..679585050 --- /dev/null +++ b/modules/client/back/methods/client/specs/filter.spec.js @@ -0,0 +1,199 @@ +const {models} = require('vn-loopback/server/server'); + +describe('client filter()', () => { + it('should return the clients matching the filter with a limit of 20 rows', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {req: {accessToken: {userId: 1}}, args: {}}; + const filter = {limit: '8'}; + const result = await models.Client.filter(ctx, filter, options); + + expect(result.length).toEqual(8); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the client "Bruce Wayne" matching the search argument with his name', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {req: {accessToken: {userId: 1}}, args: {search: 'Bruce Wayne'}}; + const filter = {}; + const result = await models.Client.filter(ctx, filter, options); + + const firstResult = result[0]; + + expect(result.length).toEqual(1); + expect(firstResult.name).toEqual('Bruce Wayne'); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the client "Bruce Wayne" matching the search argument with his id', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {req: {accessToken: {userId: 1}}, args: {search: '1101'}}; + const filter = {}; + const result = await models.Client.filter(ctx, filter, options); + + const firstResult = result[0]; + + expect(result.length).toEqual(1); + expect(firstResult.name).toEqual('Bruce Wayne'); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the client "Bruce Wayne" matching the name argument', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {req: {accessToken: {userId: 1}}, args: {name: 'Bruce Wayne'}}; + const filter = {}; + const result = await models.Client.filter(ctx, filter, options); + + const firstResult = result[0]; + + expect(result.length).toEqual(1); + expect(firstResult.name).toEqual('Bruce Wayne'); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the clients matching the "salesPersonFk" argument', async() => { + const tx = await models.Client.beginTransaction({}); + const salesPersonId = 18; + + try { + const options = {transaction: tx}; + + const ctx = {req: {accessToken: {userId: 1}}, args: {salesPersonFk: salesPersonId}}; + const filter = {}; + const result = await models.Client.filter(ctx, filter, options); + + const randomIndex = Math.floor(Math.random() * result.length); + const randomResultClient = result[randomIndex]; + + expect(result.length).toBeGreaterThanOrEqual(5); + expect(randomResultClient.salesPersonFk).toEqual(salesPersonId); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the clients matching the "fi" argument', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {req: {accessToken: {userId: 1}}, args: {fi: '251628698'}}; + const filter = {}; + const result = await models.Client.filter(ctx, filter, options); + + const firstClient = result[0]; + + expect(result.length).toEqual(1); + expect(firstClient.name).toEqual('Max Eisenhardt'); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the clients matching the "city" argument', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {req: {accessToken: {userId: 1}}, args: {city: 'Gotham'}}; + const filter = {}; + const result = await models.Client.filter(ctx, filter, options); + + const randomIndex = Math.floor(Math.random() * result.length); + const randomResultClient = result[randomIndex]; + + expect(result.length).toBeGreaterThanOrEqual(20); + expect(randomResultClient.city.toLowerCase()).toEqual('gotham'); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the clients matching the "postcode" argument', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {req: {accessToken: {userId: 1}}, args: {postcode: '46460'}}; + const filter = {}; + const result = await models.Client.filter(ctx, filter, options); + + const randomIndex = Math.floor(Math.random() * result.length); + const randomResultClient = result[randomIndex]; + + expect(result.length).toBeGreaterThanOrEqual(20); + expect(randomResultClient.postcode).toEqual('46460'); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the clients matching the "zoneFk" argument', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {req: {accessToken: {userId: 1}}, args: {zoneFk: 9}}; + const filter = {}; + const result = await models.Client.filter(ctx, filter, options); + + expect(result.length).toBe(1); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/client/back/methods/client/specs/getTransactions.spec.js b/modules/client/back/methods/client/specs/getTransactions.spec.js deleted file mode 100644 index 0387eb59a..000000000 --- a/modules/client/back/methods/client/specs/getTransactions.spec.js +++ /dev/null @@ -1,21 +0,0 @@ -const models = require('vn-loopback/server/server').models; - -describe('Client getTransations', () => { - it('should call getTransations() method to receive a list of Web Payments from Bruce Wayne', async() => { - const tx = await models.Client.beginTransaction({}); - - try { - const options = {transaction: tx}; - - const filter = {where: {clientFk: 1101}}; - const result = await models.Client.getTransactions(filter, options); - - expect(result[1].id).toBeTruthy(); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); -}); diff --git a/modules/client/back/methods/client/specs/setPassword.spec.js b/modules/client/back/methods/client/specs/setPassword.spec.js index e0de20249..03334918b 100644 --- a/modules/client/back/methods/client/specs/setPassword.spec.js +++ b/modules/client/back/methods/client/specs/setPassword.spec.js @@ -1,23 +1,28 @@ const models = require('vn-loopback/server/server').models; describe('Client setPassword', () => { + const salesPersonId = 19; + const ctx = { + req: {accessToken: {userId: salesPersonId}} + }; + it('should throw an error the setPassword target is not just a client but a worker', async() => { let error; try { - await models.Client.setPassword(1106, 'newPass?'); + await models.Client.setPassword(ctx, 1, 't0pl3v3l.p455w0rd!'); } catch (e) { error = e; } - expect(error.message).toEqual(`Can't change the password of another worker`); + expect(error.message).toEqual(`Modifiable password only via recovery or by an administrator`); }); it('should change the password of the client', async() => { let error; try { - await models.Client.setPassword(1101, 't0pl3v3l.p455w0rd!'); + await models.Client.setPassword(ctx, 1101, 't0pl3v3l.p455w0rd!'); } catch (e) { error = e; } diff --git a/modules/client/back/methods/client/specs/transactions.spec.js b/modules/client/back/methods/client/specs/transactions.spec.js new file mode 100644 index 000000000..b4af40195 --- /dev/null +++ b/modules/client/back/methods/client/specs/transactions.spec.js @@ -0,0 +1,66 @@ +const models = require('vn-loopback/server/server').models; + +describe('Client transactions', () => { + it('should call transactions() method to receive a list of Web Payments from Bruce Wayne', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {}; + const filter = {where: {clientFk: 1101}}; + const result = await models.Client.transactions(ctx, filter, options); + + expect(result[1].id).toBeTruthy(); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should call transactions() method filtering by orderFk', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {args: {orderFk: 6}}; + const filter = {}; + const result = await models.Client.transactions(ctx, filter, options); + + const firstRow = result[0]; + + expect(result.length).toEqual(1); + expect(firstRow.id).toEqual(6); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should call transactions() method filtering by amount', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {args: {amount: 40}}; + const filter = {}; + const result = await models.Client.transactions(ctx, filter, options); + + const randomIndex = Math.floor(Math.random() * result.length); + const transaction = result[randomIndex]; + + expect(transaction.amount).toEqual(40); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/client/back/methods/client/specs/updatePortfolio.spec.js b/modules/client/back/methods/client/specs/updatePortfolio.spec.js deleted file mode 100644 index bf681eb2e..000000000 --- a/modules/client/back/methods/client/specs/updatePortfolio.spec.js +++ /dev/null @@ -1,75 +0,0 @@ -const models = require('vn-loopback/server/server').models; -const LoopBackContext = require('loopback-context'); - -describe('Client updatePortfolio', () => { - const activeCtx = { - accessToken: {userId: 9}, - http: { - req: { - headers: {origin: 'http://localhost'}, - [`__`]: value => { - return value; - } - } - } - }; - - beforeAll(() => { - spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ - active: activeCtx - }); - }); - - it('should update the portfolioWeight when the salesPerson of a client changes', async() => { - const clientId = 1108; - const salesPersonId = 18; - - const tx = await models.Client.beginTransaction({}); - - try { - const options = {transaction: tx}; - const expectedResult = 841.63; - - const client = await models.Client.findById(clientId, null, options); - await client.updateAttribute('salesPersonFk', salesPersonId, options); - - await models.Client.updatePortfolio(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); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); - - it('should keep the same portfolioWeight when a salesperson is unassigned of a client', async() => { - const clientId = 1107; - const salesPersonId = 19; - const tx = await models.Client.beginTransaction({}); - - try { - const options = {transaction: tx}; - const expectedResult = 34.40; - - const client = await models.Client.findById(clientId, null, options); - await client.updateAttribute('salesPersonFk', null, options); - - await models.Client.updatePortfolio(); - - const portfolioQuery = `SELECT portfolioWeight FROM bs.salesPerson WHERE workerFk = ${salesPersonId}; `; - const [salesPerson] = await models.Client.rawSql(portfolioQuery); - - expect(salesPerson.portfolioWeight).toEqual(expectedResult); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); -}); diff --git a/modules/client/back/methods/client/specs/updateUser.spec.js b/modules/client/back/methods/client/specs/updateUser.spec.js index 4dc969906..2d7f7dce0 100644 --- a/modules/client/back/methods/client/specs/updateUser.spec.js +++ b/modules/client/back/methods/client/specs/updateUser.spec.js @@ -10,8 +10,9 @@ describe('Client updateUser', () => { } } }; + const salesPersonId = 19; const ctx = { - req: {accessToken: {userId: employeeId}}, + req: {accessToken: {userId: salesPersonId}}, args: {name: 'test', active: true} }; @@ -21,8 +22,13 @@ describe('Client updateUser', () => { }); }); - it('should throw an error the target user is not just a client but a worker', async() => { + it(`should throw an error if you don't have enough permissions`, async() => { let error; + const employeeId = 1; + const ctx = { + req: {accessToken: {userId: employeeId}}, + args: {name: 'test', active: true} + }; try { const clientID = 1106; await models.Client.updateUser(ctx, clientID); @@ -30,7 +36,19 @@ describe('Client updateUser', () => { error = e; } - expect(error.message).toEqual(`Can't update the user details of another worker`); + expect(error.message).toEqual(`Not enough privileges to edit a client`); + }); + + it('should throw an error the target user is not just a client but a worker', async() => { + let error; + try { + const clientID = 1; + await models.Client.updateUser(ctx, clientID); + } catch (e) { + error = e; + } + + expect(error.message).toEqual(`Modifiable user details only by an administrator`); }); it('should update the user data', async() => { diff --git a/modules/client/back/methods/client/summary.js b/modules/client/back/methods/client/summary.js index 48cb75f31..caa3d8033 100644 --- a/modules/client/back/methods/client/summary.js +++ b/modules/client/back/methods/client/summary.js @@ -125,7 +125,7 @@ module.exports = Self => { async function getRecoveries(recoveryModel, clientId, options) { const filter = { where: { - and: [{clientFk: clientId}, {or: [{finished: null}, {finished: {gt: Date.now()}}]}] + and: [{clientFk: clientId}, {or: [{finished: null}, {finished: {gt: Date.vnNow()}}]}] }, limit: 1 }; diff --git a/modules/client/back/methods/client/transactions.js b/modules/client/back/methods/client/transactions.js new file mode 100644 index 000000000..691910721 --- /dev/null +++ b/modules/client/back/methods/client/transactions.js @@ -0,0 +1,84 @@ + +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('transactions', { + description: 'Returns customer transactions', + accessType: 'READ', + accepts: [ + { + arg: 'filter', + type: 'object', + description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', + http: {source: 'query'} + }, + { + arg: 'orderFk', + type: 'number', + http: {source: 'query'} + }, + { + arg: 'clientFk', + type: 'number', + http: {source: 'query'} + }, + { + arg: 'amount', + type: 'number', + http: {source: 'query'} + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/transactions`, + verb: 'GET' + } + }); + + Self.transactions = async(ctx, filter, options) => { + const args = ctx.args; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const where = buildFilter(args, (param, value) => { + switch (param) { + case 'orderFk': + return {'t.id': value}; + case 'clientFk': + return {'t.clientFk': value}; + case 'amount': + return {'t.amount': (value * 100)}; + } + }); + + filter = mergeFilters(filter, {where}); + + const conn = Self.dataSource.connector; + const stmt = new ParameterizedSQL(` + SELECT + t.id, + t.clientFk, + c.name AS customerName, + t.created, + t.amount / 100 amount, + t.receiptFk IS NOT NULL AS isConfirmed, + tt.message responseMessage, + te.message errorMessage + FROM hedera.tpvTransaction t + JOIN client c ON c.id = t.clientFk + JOIN hedera.tpvMerchant m ON m.id = t.merchantFk + LEFT JOIN hedera.tpvResponse tt ON tt.id = t.response + LEFT JOIN hedera.tpvError te ON te.code = errorCode`); + + stmt.merge(conn.makeSuffix(filter, 't')); + + return Self.rawStmt(stmt, myOptions); + }; +}; diff --git a/modules/client/back/methods/client/updateFiscalData.js b/modules/client/back/methods/client/updateFiscalData.js index 7ae842c6e..fdd8c4c15 100644 --- a/modules/client/back/methods/client/updateFiscalData.js +++ b/modules/client/back/methods/client/updateFiscalData.js @@ -95,6 +95,14 @@ module.exports = Self => { { arg: 'despiteOfClient', type: 'number' + }, + { + arg: 'hasIncoterms', + type: 'boolean' + }, + { + arg: 'hasElectronicInvoice', + type: 'boolean' } ], returns: { @@ -118,19 +126,15 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - if (!myOptions.transaction) { tx = await Self.beginTransaction({}); myOptions.transaction = tx; } - try { const isSalesAssistant = await models.Account.hasRole(userId, 'salesAssistant', myOptions); const client = await models.Client.findById(clientId, null, myOptions); - if (!isSalesAssistant && client.isTaxDataChecked) throw new UserError(`Not enough privileges to edit a client with verified data`); - // Sage data validation const taxDataChecked = args.isTaxDataChecked; const sageTaxChecked = client.sageTaxTypeFk || args.sageTaxTypeFk; @@ -139,7 +143,6 @@ module.exports = Self => { if (taxDataChecked && !hasSageData) throw new UserError(`You need to fill sage information before you check verified data`); - if (args.despiteOfClient) { const logRecord = { originFk: clientId, @@ -154,7 +157,6 @@ module.exports = Self => { await models.ClientLog.create(logRecord, myOptions); } - // Remove unwanted properties delete args.ctx; delete args.id; diff --git a/modules/client/back/methods/client/updatePortfolio.js b/modules/client/back/methods/client/updatePortfolio.js deleted file mode 100644 index 809a84636..000000000 --- a/modules/client/back/methods/client/updatePortfolio.js +++ /dev/null @@ -1,25 +0,0 @@ -module.exports = function(Self) { - Self.remoteMethodCtx('updatePortfolio', { - description: 'Update salesPeson potfolio weight', - accessType: 'READ', - accepts: [], - returns: { - type: 'Object', - root: true - }, - http: { - path: `/updatePortfolio`, - verb: 'GET' - } - }); - - Self.updatePortfolio = async options => { - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - query = `CALL bs.salesPerson_updatePortfolio()`; - return Self.rawSql(query, null, myOptions); - }; -}; diff --git a/modules/client/back/methods/client/updateUser.js b/modules/client/back/methods/client/updateUser.js index dd5b9f9fe..1db8cd6b6 100644 --- a/modules/client/back/methods/client/updateUser.js +++ b/modules/client/back/methods/client/updateUser.js @@ -1,3 +1,4 @@ +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('updateUser', { description: 'Updates the user information', @@ -5,14 +6,18 @@ module.exports = Self => { { arg: 'id', type: 'number', - description: 'The user id', - http: {source: 'path'} + description: 'The user id' }, { arg: 'name', type: 'string', description: 'the user name' }, + { + arg: 'email', + type: 'any', + description: 'the user email' + }, { arg: 'active', type: 'boolean', @@ -27,6 +32,7 @@ module.exports = Self => { Self.updateUser = async function(ctx, id, options) { const models = Self.app.models; + const userId = ctx.req.accessToken.userId; let tx; const myOptions = {}; @@ -39,13 +45,19 @@ module.exports = Self => { } try { - const isWorker = await models.Worker.findById(id, null, myOptions); - if (isWorker) - throw new Error(`Can't update the user details of another worker`); + const isSalesPerson = await models.Account.hasRole(userId, 'salesPerson', myOptions); - const user = await models.Account.findById(id, null, myOptions); + if (!isSalesPerson) + throw new UserError(`Not enough privileges to edit a client`); - await user.updateAttributes(ctx.args, myOptions); + const isClient = await models.Client.findById(id, null, myOptions); + const isUserAccount = await models.UserAccount.findById(id, null, myOptions); + + if (isClient && !isUserAccount) { + const user = await models.Account.findById(id, null, myOptions); + await user.updateAttributes(ctx.args, myOptions); + } else + throw new UserError(`Modifiable user details only by an administrator`); if (tx) await tx.commit(); } catch (e) { diff --git a/modules/client/back/methods/credit-classification/createWithInsurance.spec.js b/modules/client/back/methods/credit-classification/createWithInsurance.spec.js index 95ff5025f..a5837bb90 100644 --- a/modules/client/back/methods/credit-classification/createWithInsurance.spec.js +++ b/modules/client/back/methods/credit-classification/createWithInsurance.spec.js @@ -23,7 +23,7 @@ describe('Client createWithInsurance', () => { try { const options = {transaction: tx}; - const data = {clientFk: 1101, started: Date.now(), credit: 999, grade: 255}; + const data = {clientFk: 1101, started: Date.vnNow(), credit: 999, grade: 255}; const result = await models.CreditClassification.createWithInsurance(data, options); diff --git a/modules/client/back/methods/defaulter/filter.js b/modules/client/back/methods/defaulter/filter.js index ce1d89818..748581913 100644 --- a/modules/client/back/methods/defaulter/filter.js +++ b/modules/client/back/methods/defaulter/filter.js @@ -51,7 +51,7 @@ module.exports = Self => { const stmts = []; - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); const stmt = new ParameterizedSQL( `SELECT * @@ -65,14 +65,14 @@ module.exports = Self => { co.created, co.text observation, uw.id workerFk, - uw.name workerName, + uw.name workerName, c.creditInsurance, d.defaulterSinced FROM vn.defaulter d JOIN vn.client c ON c.id = d.clientFk LEFT JOIN vn.clientObservation co ON co.clientFk = c.id LEFT JOIN account.user u ON u.id = c.salesPersonFk - LEFT JOIN account.user uw ON uw.id = co.workerFk + LEFT JOIN account.user uw ON uw.id = co.workerFk WHERE d.created = ? AND d.amount > 0 diff --git a/modules/client/back/methods/receipt/balanceCompensationEmail.js b/modules/client/back/methods/receipt/balanceCompensationEmail.js new file mode 100644 index 000000000..afae5dabc --- /dev/null +++ b/modules/client/back/methods/receipt/balanceCompensationEmail.js @@ -0,0 +1,52 @@ +const {Email} = require('vn-print'); +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('balanceCompensationEmail', { + description: 'Sends the debit balances compensation email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'Number', + required: true, + description: 'The receipt id', + http: {source: 'path'} + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/:id/balance-compensation-email', + verb: 'POST' + } + }); + + Self.balanceCompensationEmail = async(ctx, id) => { + const models = Self.app.models; + const receipt = await models.Receipt.findById(id, {fields: ['clientFk', 'bankFk']}); + + const bank = await models.Bank.findById(receipt.bankFk); + if (!bank) + throw new UserError(`Receipt's bank was not found`); + + const accountingType = await models.AccountingType.findById(bank.accountingTypeFk); + if (!(accountingType && accountingType.code == 'compensation')) + throw new UserError(`This receipt was not compensated`); + + const client = await models.Client.findById(receipt.clientFk, {fields: ['email']}); + + if (!client.email) + throw new UserError(`Client's email was not found`); + else { + const email = new Email('balance-compensation', { + lang: ctx.req.getLocale(), + recipient: client.email + ',administracion@verdnatura.es', + id + }); + return email.send(); + } + }; +}; diff --git a/modules/client/back/methods/receipt/balanceCompensationPdf.js b/modules/client/back/methods/receipt/balanceCompensationPdf.js new file mode 100644 index 000000000..e790d54a1 --- /dev/null +++ b/modules/client/back/methods/receipt/balanceCompensationPdf.js @@ -0,0 +1,36 @@ +module.exports = Self => { + Self.remoteMethodCtx('balanceCompensationPdf', { + description: 'Returns the the debit balances compensation pdf', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The receipt 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/balance-compensation-pdf', + verb: 'GET' + } + }); + + Self.balanceCompensationPdf = (ctx, id) => Self.printReport(ctx, id, 'balance-compensation'); +}; diff --git a/modules/client/back/methods/receipt/filter.js b/modules/client/back/methods/receipt/filter.js index e29ccf8f2..6df5e73f8 100644 --- a/modules/client/back/methods/receipt/filter.js +++ b/modules/client/back/methods/receipt/filter.js @@ -42,7 +42,7 @@ module.exports = Self => { const stmt = new ParameterizedSQL( `SELECT * FROM ( - SELECT + SELECT r.id, r.isConciliate, r.payed, @@ -56,13 +56,18 @@ module.exports = Self => { u.name userName, r.clientFk, FALSE hasPdf, - FALSE isInvoice + FALSE isInvoice, + at2.id IS NOT NULL as isCompensation FROM vn.receipt r LEFT JOIN vn.worker w ON w.id = r.workerFk LEFT JOIN account.user u ON u.id = w.userFk JOIN vn.company c ON c.id = r.companyFk - WHERE r.clientFk = ? AND r.companyFk = ? - UNION ALL + LEFT JOIN vn.accounting a ON a.id = r.bankFk + LEFT JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk AND at2.code = 'compensation' + WHERE + r.clientFk = ? + AND r.companyFk = ? + UNION ALL SELECT i.id, TRUE, @@ -77,11 +82,11 @@ module.exports = Self => { NULL, i.clientFk, i.hasPdf, - TRUE isInvoice + TRUE isInvoice, + NULL FROM vn.invoiceOut i JOIN vn.company c ON c.id = i.companyFk WHERE i.clientFk = ? AND i.companyFk = ? - ORDER BY payed DESC, created DESC ) t ORDER BY payed DESC, created DESC`, [ clientId, diff --git a/modules/client/back/methods/receipt/receiptPdf.js b/modules/client/back/methods/receipt/receiptPdf.js new file mode 100644 index 000000000..433f386db --- /dev/null +++ b/modules/client/back/methods/receipt/receiptPdf.js @@ -0,0 +1,41 @@ +module.exports = Self => { + Self.remoteMethodCtx('receiptPdf', { + description: 'Returns the receipt pdf', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The claim id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + } + ], + 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/receipt-pdf', + verb: 'GET' + } + }); + + Self.receiptPdf = (ctx, id) => Self.printReport(ctx, id, 'receipt'); +}; diff --git a/modules/client/back/methods/recovery/hasActiveRecovery.js b/modules/client/back/methods/recovery/hasActiveRecovery.js index 6b69d99d7..344b6b6ab 100644 --- a/modules/client/back/methods/recovery/hasActiveRecovery.js +++ b/modules/client/back/methods/recovery/hasActiveRecovery.js @@ -27,7 +27,7 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); const query = ` SELECT count(*) AS hasActiveRecovery diff --git a/modules/client/back/methods/tpv-transaction/confirm.js b/modules/client/back/methods/tpv-transaction/confirm.js new file mode 100644 index 000000000..41229a1fd --- /dev/null +++ b/modules/client/back/methods/tpv-transaction/confirm.js @@ -0,0 +1,97 @@ +const UserError = require('vn-loopback/util/user-error'); +const base64url = require('base64url'); + +module.exports = Self => { + Self.remoteMethod('confirm', { + description: 'Confirms electronic payment transaction', + accessType: 'WRITE', + accepts: [ + { + arg: 'Ds_SignatureVersion', + type: 'string', + required: false, + }, { + arg: 'Ds_MerchantParameters', + type: 'string', + required: true, + }, { + arg: 'Ds_Signature', + type: 'string', + required: true, + } + ], + returns: { + type: 'Boolean', + root: true + }, + http: { + path: `/confirm`, + verb: 'POST' + } + }); + + Self.confirm = async(signatureVersion, merchantParameters, signature) => { + const $ = Self.app.models; + let transaction; + + try { + const decodedParams = JSON.parse( + base64url.decode(merchantParameters, 'utf8')); + const params = {}; + + for (const param in decodedParams) + params[param] = decodeURIComponent(decodedParams[param]); + + const orderId = params['Ds_Order']; + if (!orderId) + throw new UserError('Order id not provided'); + + transaction = await Self.findById(orderId, {fields: ['id']}); + if (!transaction) + throw new UserError('Order not found'); + + await transaction.updateAttributes({ + merchantParameters, + signature, + signatureVersion, + }); + + const merchantId = parseInt(params['Ds_MerchantCode']); + if (!merchantId) + throw new UserError('Merchant id not provided'); + + const merchant = await $.TpvMerchant.findById(merchantId, { + fields: ['id', 'secretKey'] + }); + if (!merchant) + throw new UserError('Merchant not found'); + + const base64hmac = Self.createSignature( + orderId, + merchant.secretKey, + merchantParameters + ); + + if (base64hmac !== base64url.toBase64(signature)) + throw new UserError('Invalid signature'); + + await Self.rawSql( + 'CALL hedera.tpvTransaction_confirm(?, ?, ?, ?, ?, ?)', [ + params['Ds_Amount'], + orderId, + merchantId, + params['Ds_Currency'], + params['Ds_Response'], + params['Ds_ErrorCode'] + ]); + + return true; + } catch (err) { + if (transaction) + await transaction.updateAttribute('responseError', err.message); + else + console.error(err); + throw err; + } + }; +}; diff --git a/modules/client/back/methods/tpv-transaction/end.js b/modules/client/back/methods/tpv-transaction/end.js new file mode 100644 index 000000000..5a757aa48 --- /dev/null +++ b/modules/client/back/methods/tpv-transaction/end.js @@ -0,0 +1,39 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('end', { + description: 'Ends electronic payment transaction', + accessType: 'WRITE', + accepts: [ + { + arg: 'orderId', + type: 'string', + required: true, + }, { + arg: 'status', + type: 'string', + required: true, + } + ], + http: { + path: `/end`, + verb: 'POST' + } + }); + + Self.end = async(ctx, orderId, status) => { + const userId = ctx.req.accessToken.userId; + const transaction = await Self.findById(orderId, { + fields: ['id', 'clientFk'] + }); + + if (transaction?.clientFk != userId) + throw new UserError('Transaction not owned by user'); + + await Self.rawSql( + 'CALL hedera.tpvTransaction_end(?, ?)', [ + orderId, + status + ]); + }; +}; diff --git a/modules/client/back/methods/tpv-transaction/start.js b/modules/client/back/methods/tpv-transaction/start.js new file mode 100644 index 000000000..ea6ed05eb --- /dev/null +++ b/modules/client/back/methods/tpv-transaction/start.js @@ -0,0 +1,85 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('start', { + description: 'Starts electronic payment transaction', + accessType: 'WRITE', + accepts: [ + { + arg: 'amount', + type: 'Number', + required: true, + }, { + arg: 'companyId', + type: 'Number', + required: false, + }, { + arg: 'urlOk', + type: 'String', + required: false, + }, { + arg: 'urlKo', + type: 'String', + required: false, + } + ], + returns: { + type: 'Object', + root: true + }, + http: { + path: `/start`, + verb: 'POST' + } + }); + + Self.start = async(ctx, amount, companyId, urlOk, urlKo) => { + const userId = ctx.req.accessToken.userId; + const [[row]] = await Self.rawSql( + 'CALL hedera.tpvTransaction_start(?, ?, ?)', [ + amount, + companyId, + userId + ]); + + if (!row) + throw new UserError('Transaction error'); + + const orderId = row.transactionId.padStart(12, '0'); + const merchantUrl = row.merchantUrl ? row.merchantUrl : ''; + urlOk = urlOk ? urlOk.replace('_transactionId_', orderId) : ''; + urlKo = urlKo ? urlKo.replace('_transactionId_', orderId) : ''; + + const params = { + 'Ds_Merchant_Amount': amount, + 'Ds_Merchant_Order': orderId, + 'Ds_Merchant_MerchantCode': row.merchant, + 'Ds_Merchant_Currency': row.currency, + 'Ds_Merchant_TransactionType': row.transactionType, + 'Ds_Merchant_Terminal': row.terminal, + 'Ds_Merchant_MerchantURL': merchantUrl, + 'Ds_Merchant_UrlOK': urlOk, + 'Ds_Merchant_UrlKO': urlKo + }; + for (const param in params) + params[param] = encodeURIComponent(params[param]); + + const json = JSON.stringify(params); + const merchantParameters = Buffer.from(json).toString('base64'); + + const signature = Self.createSignature( + orderId, + row.secretKey, + merchantParameters + ); + + return { + url: row.url, + postValues: { + 'Ds_SignatureVersion': 'HMAC_SHA256_V1', + 'Ds_MerchantParameters': merchantParameters, + 'Ds_Signature': signature + } + }; + }; +}; diff --git a/modules/client/back/model-config.json b/modules/client/back/model-config.json index 4feb3b168..b466aa5a1 100644 --- a/modules/client/back/model-config.json +++ b/modules/client/back/model-config.json @@ -8,6 +8,9 @@ "BankEntity": { "dataSource": "vn" }, + "Business": { + "dataSource": "vn" + }, "BusinessType": { "dataSource": "vn" }, @@ -26,6 +29,9 @@ "ClientCreditLimit": { "dataSource": "vn" }, + "ClientConsumptionQueue": { + "dataSource": "vn" + }, "ClientLog": { "dataSource": "vn" }, @@ -98,6 +104,9 @@ "SageTransactionType": { "dataSource": "vn" }, + "TicketSms": { + "dataSource": "vn" + }, "TpvError": { "dataSource": "vn" }, diff --git a/modules/client/back/models/business.json b/modules/client/back/models/business.json new file mode 100644 index 000000000..7ad2d307f --- /dev/null +++ b/modules/client/back/models/business.json @@ -0,0 +1,27 @@ +{ + "name": "Business", + "base": "VnModel", + "options": { + "mysql": { + "table": "business" + } + }, + "properties": { + "id": { + "type": "number", + "id": true + } + }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + }, + "department": { + "type": "belongsTo", + "model": "Department", + "foreignKey": "departmentFk" + } + } +} \ No newline at end of file diff --git a/modules/client/back/models/client-consumption-queue.json b/modules/client/back/models/client-consumption-queue.json new file mode 100644 index 000000000..e423f218c --- /dev/null +++ b/modules/client/back/models/client-consumption-queue.json @@ -0,0 +1,30 @@ +{ + "name": "ClientConsumptionQueue", + "base": "VnModel", + "options": { + "mysql": { + "table": "clientConsumptionQueue" + } + }, + "properties": { + "params": { + "type": "string" + }, + "queued": { + "type": "date" + }, + "printed": { + "type": "date" + }, + "status": { + "type": "string" + } + }, + "relations": { + "client": { + "type": "belongsTo", + "model": "Client", + "foreignKey": "clientFk" + } + } +} diff --git a/modules/client/back/models/client-methods.js b/modules/client/back/models/client-methods.js new file mode 100644 index 000000000..fc77fc090 --- /dev/null +++ b/modules/client/back/models/client-methods.js @@ -0,0 +1,51 @@ +module.exports = Self => { + require('../methods/client/addressesPropagateRe')(Self); + require('../methods/client/canBeInvoiced')(Self); + require('../methods/client/canCreateTicket')(Self); + require('../methods/client/checkDuplicated')(Self); + require('../methods/client/confirmTransaction')(Self); + require('../methods/client/consumption')(Self); + require('../methods/client/createAddress')(Self); + require('../methods/client/createReceipt')(Self); + require('../methods/client/createWithUser')(Self); + require('../methods/client/extendedListFilter')(Self); + require('../methods/client/getAverageInvoiced')(Self); + require('../methods/client/getCard')(Self); + require('../methods/client/getDebt')(Self); + require('../methods/client/getMana')(Self); + require('../methods/client/transactions')(Self); + require('../methods/client/hasCustomerRole')(Self); + require('../methods/client/isValidClient')(Self); + require('../methods/client/lastActiveTickets')(Self); + require('../methods/client/sendSms')(Self); + require('../methods/client/setPassword')(Self); + require('../methods/client/summary')(Self); + require('../methods/client/updateAddress')(Self); + require('../methods/client/updateFiscalData')(Self); + require('../methods/client/updateUser')(Self); + require('../methods/client/uploadFile')(Self); + require('../methods/client/campaignMetricsPdf')(Self); + require('../methods/client/campaignMetricsEmail')(Self); + require('../methods/client/clientWelcomeHtml')(Self); + require('../methods/client/clientWelcomeEmail')(Self); + require('../methods/client/printerSetupHtml')(Self); + require('../methods/client/printerSetupEmail')(Self); + require('../methods/client/sepaCoreEmail')(Self); + require('../methods/client/letterDebtorPdf')(Self); + require('../methods/client/letterDebtorStHtml')(Self); + require('../methods/client/letterDebtorStEmail')(Self); + require('../methods/client/letterDebtorNdHtml')(Self); + require('../methods/client/letterDebtorNdEmail')(Self); + require('../methods/client/clientDebtStatementPdf')(Self); + require('../methods/client/clientDebtStatementHtml')(Self); + require('../methods/client/clientDebtStatementEmail')(Self); + require('../methods/client/creditRequestPdf')(Self); + require('../methods/client/creditRequestHtml')(Self); + require('../methods/client/creditRequestEmail')(Self); + require('../methods/client/incotermsAuthorizationPdf')(Self); + require('../methods/client/incotermsAuthorizationHtml')(Self); + require('../methods/client/incotermsAuthorizationEmail')(Self); + require('../methods/client/consumptionSendQueued')(Self); + require('../methods/client/filter')(Self); + require('../methods/client/getClientOrSupplierReference')(Self); +}; diff --git a/modules/client/back/models/client-sample.js b/modules/client/back/models/client-sample.js index c7cda2412..5e4393042 100644 --- a/modules/client/back/models/client-sample.js +++ b/modules/client/back/models/client-sample.js @@ -1,4 +1,5 @@ const UserError = require('vn-loopback/util/user-error'); +const LoopBackContext = require('loopback-context'); module.exports = Self => { Self.validatesPresenceOf('typeFk', { @@ -6,10 +7,10 @@ module.exports = Self => { }); Self.observe('before save', async function(ctx) { - let models = Self.app.models; - let changes = ctx.data || ctx.instance; + const models = Self.app.models; + const changes = ctx.data || ctx.instance; - let sample = await models.Sample.findById(changes.typeFk); + const sample = await models.Sample.findById(changes.typeFk); if (sample.hasCompany && !changes.companyFk) throw new UserError('Choose a company'); @@ -25,11 +26,11 @@ module.exports = Self => { // Renew mandate if (mandate) { - let mandateType = await models.MandateType.findOne({ + const mandateType = await models.MandateType.findOne({ where: {name: mandate.type} }); - let oldMandate = await models.Mandate.findOne({ + const oldMandate = await models.Mandate.findOne({ where: { clientFk: changes.clientFk, companyFk: changes.companyFk, @@ -40,7 +41,7 @@ module.exports = Self => { // Disable old mandate if (oldMandate) - oldMandate.updateAttribute('finished', new Date()); + oldMandate.updateAttribute('finished', Date.vnNew()); // Create a new mandate await models.Mandate.create({ @@ -50,10 +51,8 @@ module.exports = Self => { }); } - // Apply workerFk - let filter = {where: {userFk: ctx.options.accessToken.userId}}; - let worker = await Self.app.models.Worker.findOne(filter); + const loopBackContext = LoopBackContext.getCurrentContext(); - changes.workerFk = worker.id; + changes.userFk = loopBackContext.active.accessToken.userId; }); }; diff --git a/modules/client/back/models/client-sample.json b/modules/client/back/models/client-sample.json index 920758217..fc64cd949 100644 --- a/modules/client/back/models/client-sample.json +++ b/modules/client/back/models/client-sample.json @@ -32,10 +32,10 @@ "model": "Sample", "foreignKey": "typeFk" }, - "worker": { + "user": { "type": "belongsTo", - "model": "Worker", - "foreignKey": "workerFk" + "model": "Account", + "foreignKey": "userFk" }, "account": { "type": "belongsTo", diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 746261626..c41085b79 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -1,4 +1,3 @@ -const got = require('got'); const UserError = require('vn-loopback/util/user-error'); const getFinalState = require('vn-loopback/util/hook').getFinalState; const isMultiple = require('vn-loopback/util/hook').isMultiple; @@ -8,32 +7,7 @@ const LoopBackContext = require('loopback-context'); module.exports = Self => { // Methods - require('../methods/client/addressesPropagateRe')(Self); - require('../methods/client/canBeInvoiced')(Self); - require('../methods/client/canCreateTicket')(Self); - require('../methods/client/checkDuplicated')(Self); - require('../methods/client/confirmTransaction')(Self); - require('../methods/client/consumption')(Self); - require('../methods/client/createAddress')(Self); - require('../methods/client/createReceipt')(Self); - require('../methods/client/createWithUser')(Self); - require('../methods/client/extendedListFilter')(Self); - require('../methods/client/getAverageInvoiced')(Self); - require('../methods/client/getCard')(Self); - require('../methods/client/getDebt')(Self); - require('../methods/client/getMana')(Self); - require('../methods/client/getTransactions')(Self); - require('../methods/client/hasCustomerRole')(Self); - require('../methods/client/isValidClient')(Self); - require('../methods/client/lastActiveTickets')(Self); - require('../methods/client/sendSms')(Self); - require('../methods/client/setPassword')(Self); - require('../methods/client/summary')(Self); - require('../methods/client/updateAddress')(Self); - require('../methods/client/updateFiscalData')(Self); - require('../methods/client/updatePortfolio')(Self); - require('../methods/client/updateUser')(Self); - require('../methods/client/uploadFile')(Self); + require('./client-methods')(Self); // Validations @@ -53,7 +27,7 @@ module.exports = Self => { message: 'Invalid email', allowNull: true, allowBlank: true, - with: /^[\w|.|-]+@[\w|-]+(\.[\w|-]+)*(,[\w|.|-]+@[\w|-]+(\.[\w|-]+)*)*$/ + with: /^[\W]*([\w+\-.%]+@[\w\-.]+\.[A-Za-z]{1,61}[\W]*,{1}[\W]*)*([\w+\-.%]+@[\w\-.]+\.[A-Za-z]{1,61})[\W]*$/ }); Self.validatesLengthOf('postcode', { @@ -167,6 +141,16 @@ module.exports = Self => { done(); } + Self.validateAsync('isToBeMailed', isToBeMailed, { + message: 'There is no assigned email for this client' + }); + + function isToBeMailed(err, done) { + if (this.isToBeMailed == true && !this.email) + err(); + done(); + } + Self.validateAsync('defaultAddressFk', isActive, {message: 'Unable to default a disabled consignee'} ); @@ -295,6 +279,18 @@ module.exports = Self => { // Credit changes if (changes.credit !== undefined) await Self.changeCredit(ctx, finalState, changes); + + const oldInstance = {}; + if (!ctx.isNewInstance) { + const newProps = Object.keys(changes); + Object.keys(orgData.__data).forEach(prop => { + if (newProps.includes(prop)) + oldInstance[prop] = orgData[prop]; + }); + } + + ctx.hookState.oldInstance = oldInstance; + ctx.hookState.newInstance = changes; }); Self.observe('after save', async ctx => { @@ -317,23 +313,22 @@ module.exports = Self => { const $t = httpRequest.__; const headers = httpRequest.headers; const origin = headers.origin; - const authorization = headers.authorization; const salesPersonId = instance.salesPersonFk; if (salesPersonId) { // Send email to client if (instance.email) { + const {Email} = require('vn-print'); const worker = await models.EmailUser.findById(salesPersonId); const params = { - authorization: authorization, + id: instance.id, recipientId: instance.id, recipient: instance.email, replyTo: worker.email }; - await got.get(`${origin}/api/email/payment-update`, { - searchParams: params - }); + const email = new Email('payment-update', params); + await email.send(); } const fullUrl = `${origin}/#!/client/${instance.id}/billing-data`; @@ -402,8 +397,8 @@ module.exports = Self => { const models = Self.app.models; const userId = ctx.options.accessToken.userId; - const isManager = await models.Account.hasRole(userId, 'manager', ctx.options); - if (!isManager) { + const isFinancialBoss = await models.Account.hasRole(userId, 'financialBoss', ctx.options); + if (!isFinancialBoss) { const lastCredit = await models.ClientCredit.findOne({ where: { clientFk: finalState.id @@ -413,10 +408,10 @@ module.exports = Self => { const lastAmount = lastCredit && lastCredit.amount; const lastWorkerId = lastCredit && lastCredit.workerFk; - const lastWorkerIsManager = await models.Account.hasRole(lastWorkerId, 'manager', ctx.options); + const lastWorkerIsFinancialBoss = await models.Account.hasRole(lastWorkerId, 'financialBoss', ctx.options); - if (lastAmount == 0 && lastWorkerIsManager) - throw new UserError(`You can't change the credit set to zero from a manager`); + if (lastAmount == 0 && lastWorkerIsFinancialBoss) + throw new UserError(`You can't change the credit set to zero from a financialBoss`); const creditLimits = await models.ClientCreditLimit.find({ fields: ['roleFk'], @@ -452,14 +447,19 @@ module.exports = Self => { account.observe('before save', async ctx => { if (ctx.isNewInstance) return; - ctx.hookState.oldInstance = JSON.parse(JSON.stringify(ctx.currentInstance)); + if (ctx.currentInstance) + ctx.hookState.oldInstance = JSON.parse(JSON.stringify(ctx.currentInstance)); }); account.observe('after save', async ctx => { const changes = ctx.data || ctx.instance; if (!ctx.isNewInstance && changes) { const oldData = ctx.hookState.oldInstance; - const hasChanges = oldData.name != changes.name || oldData.active != changes.active; + let hasChanges; + + if (oldData) + hasChanges = oldData.name != changes.name || oldData.active != changes.active; + if (!hasChanges) return; const isClient = await Self.app.models.Client.count({id: oldData.id}); diff --git a/modules/client/back/models/client.json b/modules/client/back/models/client.json index 1426152a4..21db28eaf 100644 --- a/modules/client/back/models/client.json +++ b/modules/client/back/models/client.json @@ -98,6 +98,9 @@ "hasCoreVnh": { "type": "boolean" }, + "hasIncoterms": { + "type": "boolean" + }, "isTaxDataChecked":{ "type": "boolean" }, @@ -139,7 +142,11 @@ }, "salesPersonFk": { "type": "number" + }, + "hasElectronicInvoice": { + "type": "boolean" } + }, "relations": { "account": { @@ -147,6 +154,11 @@ "model": "Account", "foreignKey": "id" }, + "user": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "id" + }, "payMethod": { "type": "belongsTo", "model": "PayMethod", diff --git a/modules/client/back/models/greuge.js b/modules/client/back/models/greuge.js index bd5f2865d..42820fd60 100644 --- a/modules/client/back/models/greuge.js +++ b/modules/client/back/models/greuge.js @@ -1,6 +1,21 @@ +const LoopBackContext = require('loopback-context'); + module.exports = function(Self) { require('../methods/greuge/sumAmount')(Self); + Self.observe('before save', function(ctx, next) { + const loopBackContext = LoopBackContext.getCurrentContext(); + + let userFk = loopBackContext.active.accessToken.userId; + + if (ctx.instance) + ctx.instance.userFk = userFk; + else + ctx.data.userFk = userFk; + + next(); + }); + Self.validatesLengthOf('description', { max: 45, message: 'Description should have maximum of 45 characters' diff --git a/modules/client/back/models/greuge.json b/modules/client/back/models/greuge.json index 918ff0ca5..625bf4e28 100644 --- a/modules/client/back/models/greuge.json +++ b/modules/client/back/models/greuge.json @@ -2,9 +2,9 @@ "name": "Greuge", "base": "Loggable", "log": { - "model": "ClientLog", - "relation": "client", - "showField": "description" + "model": "ClientLog", + "relation": "client", + "showField": "description" }, "options": { "mysql": { @@ -35,7 +35,6 @@ "type": "number", "required": true } - }, "relations": { "client": { @@ -52,6 +51,11 @@ "type": "belongsTo", "model": "GreugeType", "foreignKey": "greugeTypeFk" + }, + "user": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "userFk" } } } \ No newline at end of file diff --git a/modules/client/back/models/receipt.js b/modules/client/back/models/receipt.js index 36a4a8952..3118cc239 100644 --- a/modules/client/back/models/receipt.js +++ b/modules/client/back/models/receipt.js @@ -2,6 +2,9 @@ const LoopBackContext = require('loopback-context'); module.exports = function(Self) { require('../methods/receipt/filter')(Self); + require('../methods/receipt/balanceCompensationEmail')(Self); + require('../methods/receipt/balanceCompensationPdf')(Self); + require('../methods/receipt/receiptPdf')(Self); Self.validateBinded('amountPaid', isNotZero, { message: 'Amount cannot be zero', diff --git a/modules/client/back/models/receipt.json b/modules/client/back/models/receipt.json index 19107f561..da7879df9 100644 --- a/modules/client/back/models/receipt.json +++ b/modules/client/back/models/receipt.json @@ -62,6 +62,11 @@ "type": "belongsTo", "model": "Bank", "foreignKey": "bankFk" + }, + "supplier": { + "type": "belongsTo", + "model": "Supplier", + "foreignKey": "companyFk" } } -} \ No newline at end of file +} diff --git a/modules/client/back/models/sample.json b/modules/client/back/models/sample.json index cfb127ab2..011e8bf24 100644 --- a/modules/client/back/models/sample.json +++ b/modules/client/back/models/sample.json @@ -29,6 +29,9 @@ }, "datepickerEnabled": { "type": "boolean" + }, + "model": { + "type": "string" } }, "scopes": { diff --git a/modules/client/back/models/specs/client.spec.js b/modules/client/back/models/specs/client.spec.js index d1a6d77cb..1f7e56cdb 100644 --- a/modules/client/back/models/specs/client.spec.js +++ b/modules/client/back/models/specs/client.spec.js @@ -53,7 +53,7 @@ describe('Client Model', () => { }); describe('changeCredit()', () => { - it('should fail to change the credit as a salesAssistant set to zero by a manager', async() => { + it('should fail to change the credit as a salesAssistant set to zero by a financialBoss', async() => { const tx = await models.Client.beginTransaction({}); let error; @@ -62,7 +62,7 @@ describe('Client Model', () => { const options = {transaction: tx}; const context = {options}; - // Set credit to zero by a manager + // Set credit to zero by a financialBoss const financialBoss = await models.Account.findOne({ where: {name: 'financialBoss'} }, options); @@ -83,7 +83,7 @@ describe('Client Model', () => { await tx.rollback(); } - expect(error.message).toEqual(`You can't change the credit set to zero from a manager`); + expect(error.message).toEqual(`You can't change the credit set to zero from a financialBoss`); }); it('should fail to change to a high credit amount as a salesAssistant', async() => { diff --git a/modules/client/back/models/ticket-sms.json b/modules/client/back/models/ticket-sms.json new file mode 100644 index 000000000..03f592f51 --- /dev/null +++ b/modules/client/back/models/ticket-sms.json @@ -0,0 +1,28 @@ +{ + "name": "TicketSms", + "base": "VnModel", + "options": { + "mysql": { + "table": "ticketSms" + } + }, + "properties": { + "smsFk": { + "type": "number", + "id": true, + "description": "Identifier" + } + }, + "relations": { + "ticket": { + "type": "belongsTo", + "model": "Ticket", + "foreignKey": "ticketFk" + }, + "sms": { + "type": "belongsTo", + "model": "Sms", + "foreignKey": "smsFk" + } + } +} diff --git a/modules/client/back/models/tpv-transaction.js b/modules/client/back/models/tpv-transaction.js new file mode 100644 index 000000000..eb9dd7d6c --- /dev/null +++ b/modules/client/back/models/tpv-transaction.js @@ -0,0 +1,29 @@ +const crypto = require('crypto'); + +module.exports = Self => { + require('../methods/tpv-transaction/confirm')(Self); + require('../methods/tpv-transaction/start')(Self); + require('../methods/tpv-transaction/end')(Self); + + Self.createSignature = function(orderId, secretKey, merchantParameters) { + secretKey = Buffer.from(secretKey, 'base64'); + const iv = Buffer.alloc(8, 0); + + const cipher = crypto.createCipheriv('des-ede3-cbc', secretKey, iv); + cipher.setAutoPadding(false); + const orderKey = Buffer.concat([ + cipher.update(zeroPad(orderId, 8)), + cipher.final() + ]); + + return crypto.createHmac('sha256', orderKey) + .update(merchantParameters) + .digest('base64'); + }; + + function zeroPad(buf, blocksize) { + const buffer = typeof buf === 'string' ? Buffer.from(buf, 'utf8') : buf; + const pad = Buffer.alloc((blocksize - (buffer.length % blocksize)) % blocksize, 0); + return Buffer.concat([buffer, pad]); + } +}; diff --git a/modules/client/back/models/tpv-transaction.json b/modules/client/back/models/tpv-transaction.json index 2d926cc40..878b1f41a 100644 --- a/modules/client/back/models/tpv-transaction.json +++ b/modules/client/back/models/tpv-transaction.json @@ -35,6 +35,18 @@ }, "created": { "type": "date" + }, + "merchantParameters": { + "type": "string" + }, + "signature": { + "type": "string" + }, + "signatureVersion": { + "type": "string" + }, + "responseError": { + "type": "string" } }, "relations": { @@ -45,4 +57,3 @@ } } } - \ No newline at end of file diff --git a/modules/client/front/balance/create/index.html b/modules/client/front/balance/create/index.html index 56e505463..b76c09356 100644 --- a/modules/client/front/balance/create/index.html +++ b/modules/client/front/balance/create/index.html @@ -11,7 +11,7 @@ @@ -48,6 +48,14 @@ max="$ctrl.maxAmount"> + +
Compensation
+ + +
- -
Compensation
- - -
- @@ -89,4 +89,4 @@ - \ No newline at end of file + diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index c6a6e7ff9..cc9e1ab5a 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -4,7 +4,6 @@ import Dialog from 'core/components/dialog'; class Controller extends Dialog { constructor($element, $, $transclude, vnReport) { super($element, $, $transclude); - this.vnReport = vnReport; this.receipt = {}; } @@ -59,16 +58,21 @@ class Controller extends Dialog { if (value) { const accountingType = value.accountingType; - if (this.originalDescription) { - this.receipt.description = - `${accountingType && accountingType.receiptDescription}, ${this.originalDescription}`; - } else { - this.receipt.description = - `${accountingType && accountingType.receiptDescription}`; + + this.receipt.description = []; + this.viewReceipt = accountingType.code == 'cash'; + if (accountingType.code == 'compensation') + this.receipt.description = ''; + else { + if (accountingType.receiptDescription != null && accountingType.receiptDescription != '') + this.receipt.description.push(accountingType.receiptDescription); + if (this.originalDescription) + this.receipt.description.push(this.originalDescription); + this.receipt.description = this.receipt.description.join(', '); } this.maxAmount = accountingType && accountingType.maxAmount; - this.receipt.payed = new Date(); + this.receipt.payed = Date.vnNew(); if (accountingType.daysInFuture) this.receipt.payed.setDate(this.receipt.payed.getDate() + accountingType.daysInFuture); } @@ -111,7 +115,25 @@ class Controller extends Dialog { } accountShortToStandard(value) { - this.receipt.compensationAccount = value.replace('.', '0'.repeat(11 - value.length)); + if (value) { + this.receipt.compensationAccount = value.replace('.', '0'.repeat(11 - value.length)); + const params = {bankAccount: this.receipt.compensationAccount}; + this.$http.get(`Clients/getClientOrSupplierReference`, {params}) + .then(res => { + if (res.data.clientId) { + this.receipt.description = this.$t('Client Compensation Reference', { + clientId: res.data.clientId, + clientName: res.data.clientName + }); + } else { + this.receipt.description = this.$t('Supplier Compensation Reference', { + supplierId: res.data.supplierId, + supplierName: res.data.supplierName + }); + } + }); + } else + this.receipt.description = ''; } getAmountPaid() { @@ -144,12 +166,8 @@ class Controller extends Dialog { }) .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))) .then(() => { - if (this.viewReceipt) { - this.vnReport.show('receipt', { - receiptId: receiptId, - companyId: this.companyFk - }); - } + if (this.viewReceipt) + this.vnReport.show(`Receipts/${receiptId}/receipt-pdf`); }); } diff --git a/modules/client/front/balance/create/index.spec.js b/modules/client/front/balance/create/index.spec.js index 77fe32e0f..fa6b48ea4 100644 --- a/modules/client/front/balance/create/index.spec.js +++ b/modules/client/front/balance/create/index.spec.js @@ -85,6 +85,8 @@ describe('Client', () => { }); it('should make an http POST query and then call to the report show() method', () => { + const receiptId = 1; + jest.spyOn(controller.vnApp, 'showSuccess'); jest.spyOn(controller.vnReport, 'show'); window.open = jest.fn(); @@ -92,14 +94,12 @@ describe('Client', () => { controller.$params = {id: 1101}; controller.viewReceipt = true; - $httpBackend.expect('POST', `Clients/1101/createReceipt`).respond({id: 1}); + $httpBackend.expect('POST', `Clients/1101/createReceipt`).respond({id: receiptId}); controller.responseHandler('accept'); $httpBackend.flush(); - const expectedParams = {receiptId: 1, companyId: 442}; - expect(controller.vnApp.showSuccess).toHaveBeenCalled(); - expect(controller.vnReport.show).toHaveBeenCalledWith('receipt', expectedParams); + expect(controller.vnReport.show).toHaveBeenCalledWith(`Receipts/${receiptId}/receipt-pdf`); }); }); diff --git a/modules/client/front/balance/create/locale/es.yml b/modules/client/front/balance/create/locale/es.yml index 056590966..8c407708a 100644 --- a/modules/client/front/balance/create/locale/es.yml +++ b/modules/client/front/balance/create/locale/es.yml @@ -1,2 +1,4 @@ View receipt: Ver recibo -Amount exceeded: Según ley contra el fraude no se puede recibir cobros por importe igual o superior a {{maxAmount}} \ No newline at end of file +Amount exceeded: Según ley contra el fraude no se puede recibir cobros por importe igual o superior a {{maxAmount}} +Client Compensation Reference: "({{clientId}}) Ntro Cliente: {{clientName}}" +Supplier Compensation Reference: "({{supplierId}}) Ntro Proveedor: {{supplierName}}" diff --git a/modules/client/front/balance/index/index.html b/modules/client/front/balance/index/index.html index 3c61d8543..faf772c2d 100644 --- a/modules/client/front/balance/index/index.html +++ b/modules/client/front/balance/index/index.html @@ -121,9 +121,22 @@
-
- - + + + + + + + + + @@ -131,7 +144,7 @@ vn-acl="salesAssistant" vn-acl-action="remove" icon="add" - vn-tooltip="New payment" + vn-tooltip="New payment" vn-bind="+" fixed-bottom-right ng-click="balanceCreate.show()"> @@ -142,9 +155,9 @@ company-fk="$ctrl.companyId" client-fk="$ctrl.$params.id"> - - - \ No newline at end of file + diff --git a/modules/client/front/balance/index/index.js b/modules/client/front/balance/index/index.js index 7e09e018c..47cefab7d 100644 --- a/modules/client/front/balance/index/index.js +++ b/modules/client/front/balance/index/index.js @@ -2,8 +2,9 @@ import ngModule from '../../module'; import Section from 'salix/components/section'; class Controller extends Section { - constructor($element, $) { + constructor($element, $, vnEmail) { super($element, $); + this.vnEmail = vnEmail; this.filter = { include: { relation: 'company', @@ -90,9 +91,13 @@ class Controller extends Section { this.$http.patch(endpoint, params) .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); } + + sendEmail(balance) { + return this.vnEmail.send(`Receipts/${balance.id}/balance-compensation-email`); + } } -Controller.$inject = ['$element', '$scope']; +Controller.$inject = ['$element', '$scope', 'vnEmail']; ngModule.vnComponent('vnClientBalanceIndex', { template: require('./index.html'), diff --git a/modules/client/front/balance/index/index.spec.js b/modules/client/front/balance/index/index.spec.js index e130ac655..ea28cb55d 100644 --- a/modules/client/front/balance/index/index.spec.js +++ b/modules/client/front/balance/index/index.spec.js @@ -151,5 +151,19 @@ describe('Client', () => { $httpBackend.flush(); }); }); + + describe('sendEmail()', () => { + it('should send an email', () => { + jest.spyOn(controller.vnEmail, 'send'); + + const $data = {id: 1103}; + + controller.sendEmail($data); + + const expectedPath = `Receipts/${$data.id}/balance-compensation-email`; + + expect(controller.vnEmail.send).toHaveBeenCalledWith(expectedPath); + }); + }); }); }); diff --git a/modules/client/front/balance/index/locale/en.yml b/modules/client/front/balance/index/locale/en.yml index 53cb1313e..0b37c1a1d 100644 --- a/modules/client/front/balance/index/locale/en.yml +++ b/modules/client/front/balance/index/locale/en.yml @@ -1 +1,3 @@ -BILL: N/INV {{ref}} \ No newline at end of file +BILL: N/INV {{ref}} +Notify compensation: Do you want to report compensation to the client by mail? +Send compensation: Send compensation diff --git a/modules/client/front/balance/index/locale/es.yml b/modules/client/front/balance/index/locale/es.yml index 05ef7070a..de710869e 100644 --- a/modules/client/front/balance/index/locale/es.yml +++ b/modules/client/front/balance/index/locale/es.yml @@ -8,4 +8,6 @@ Havings: Haber Balance: Balance Total by company: Total por empresa Download PDF: Descargar PDF -BILL: N/FRA {{ref}} \ No newline at end of file +Send compensation: Enviar compensación +BILL: N/FRA {{ref}} +Notify compensation: ¿Desea informar de la compensación al cliente por correo? \ No newline at end of file diff --git a/modules/client/front/basic-data/index.js b/modules/client/front/basic-data/index.js index 418663952..b08d642d1 100644 --- a/modules/client/front/basic-data/index.js +++ b/modules/client/front/basic-data/index.js @@ -10,8 +10,6 @@ export default class Controller extends Section { onSubmit() { return this.$.watcher.submit().then(() => { - const query = `Clients/updatePortfolio`; - this.$http.get(query); this.$http.get(`Clients/${this.$params.id}/checkDuplicatedData`); }); } diff --git a/modules/client/front/billing-data/index.html b/modules/client/front/billing-data/index.html index 33a237ad7..410681930 100644 --- a/modules/client/front/billing-data/index.html +++ b/modules/client/front/billing-data/index.html @@ -16,7 +16,7 @@
@@ -39,7 +39,7 @@ ng-model="$ctrl.client.iban" rule on-change="$ctrl.autofillBic()" - vn-acl="salesAssistant"> + vn-acl="salesAssistant, hr"> {{bic}} {{name}} @@ -61,7 +61,7 @@ icon="add_circle" vn-click-stop="bankEntity.show({countryFk: $ctrl.client.countryFk})" vn-tooltip="New bank entity" - vn-acl="salesAssistant"> + vn-acl="salesAssistant, hr"> @@ -71,19 +71,19 @@ vn-one label="Received LCR" ng-model="$ctrl.client.hasLcr" - vn-acl="salesAssistant"> + vn-acl="salesAssistant, hr"> + vn-acl="salesAssistant, hr"> + vn-acl="salesAssistant, hr"> diff --git a/modules/client/front/consumption/index.js b/modules/client/front/consumption/index.js index 7017fed41..eb3a10dd6 100644 --- a/modules/client/front/consumption/index.js +++ b/modules/client/front/consumption/index.js @@ -17,11 +17,11 @@ class Controller extends Section { } setDefaultFilter() { - const minDate = new Date(); + const minDate = Date.vnNew(); minDate.setHours(0, 0, 0, 0); minDate.setMonth(minDate.getMonth() - 2); - const maxDate = new Date(); + const maxDate = Date.vnNew(); maxDate.setHours(23, 59, 59, 59); this.filterParams = { @@ -45,11 +45,13 @@ class Controller extends Section { } showReport() { - this.vnReport.show('campaign-metrics', this.reportParams); + const path = `Clients/${this.client.id}/campaign-metrics-pdf`; + this.vnReport.show(path, this.reportParams); } sendEmail() { - this.vnEmail.send('campaign-metrics', this.reportParams); + const path = `Clients/${this.client.id}/campaign-metrics-email`; + this.vnEmail.send(path, this.reportParams); } changeGrouped(value) { diff --git a/modules/client/front/consumption/index.spec.js b/modules/client/front/consumption/index.spec.js index 16b764b56..f2acddbca 100644 --- a/modules/client/front/consumption/index.spec.js +++ b/modules/client/front/consumption/index.spec.js @@ -26,7 +26,7 @@ describe('Client', () => { it('should call the window.open function', () => { jest.spyOn(window, 'open').mockReturnThis(); - const now = new Date(); + const now = Date.vnNew(); controller.$.model.userParams = { from: now, to: now @@ -34,35 +34,30 @@ describe('Client', () => { controller.showReport(); + const clientId = controller.client.id; const expectedParams = { - recipientId: 1101, + recipientId: clientId, from: now, to: now }; const serializedParams = $httpParamSerializer(expectedParams); - const path = `api/report/campaign-metrics?${serializedParams}`; + const expectedPath = `api/Clients/${clientId}/campaign-metrics-pdf?${serializedParams}`; - expect(window.open).toHaveBeenCalledWith(path); + expect(window.open).toHaveBeenCalledWith(expectedPath); }); }); describe('sendEmail()', () => { it('should make a GET query sending the report', () => { - const now = new Date(); + const now = Date.vnNew(); controller.$.model.userParams = { from: now, to: now }; - const expectedParams = { - recipientId: 1101, - from: now, - to: now - }; + const clientId = controller.client.id; + const expectedPath = `Clients/${clientId}/campaign-metrics-email`; - const serializedParams = $httpParamSerializer(expectedParams); - const path = `email/campaign-metrics?${serializedParams}`; - - $httpBackend.expect('GET', path).respond({}); + $httpBackend.expect('POST', expectedPath).respond({}); controller.sendEmail(); $httpBackend.flush(); }); diff --git a/modules/client/front/credit-insurance/create/index.js b/modules/client/front/credit-insurance/create/index.js index 83dc18806..e3138e459 100644 --- a/modules/client/front/credit-insurance/create/index.js +++ b/modules/client/front/credit-insurance/create/index.js @@ -5,7 +5,7 @@ class Controller extends Section { constructor($element, $) { super($element, $); this.creditClassification = { - started: this.$filter('date')(new Date(), 'yyyy-MM-dd HH:mm') + started: this.$filter('date')(Date.vnNew(), 'yyyy-MM-dd HH:mm') }; } diff --git a/modules/client/front/credit-insurance/create/index.spec.js b/modules/client/front/credit-insurance/create/index.spec.js index 36a91ceca..c50afd5cf 100644 --- a/modules/client/front/credit-insurance/create/index.spec.js +++ b/modules/client/front/credit-insurance/create/index.spec.js @@ -24,7 +24,7 @@ describe('Client', () => { describe('onSubmit()', () => { it('should perform a POST query', () => { - let started = new Date(); + let started = Date.vnNew(); controller.creditClassification = { started: started, credit: 300, diff --git a/modules/client/front/credit-insurance/index/index.js b/modules/client/front/credit-insurance/index/index.js index 5f59c918a..b40025c65 100644 --- a/modules/client/front/credit-insurance/index/index.js +++ b/modules/client/front/credit-insurance/index/index.js @@ -52,7 +52,7 @@ class Controller extends Section { } returnDialog() { - let params = {finished: Date.now()}; + let params = {finished: Date.vnNow()}; this.$http.patch(`CreditClassifications/${this.classificationId}`, params).then(() => { this._getClassifications(this.client.id); }); diff --git a/modules/client/front/credit-insurance/index/index.spec.js b/modules/client/front/credit-insurance/index/index.spec.js index 8629db684..af072691a 100644 --- a/modules/client/front/credit-insurance/index/index.spec.js +++ b/modules/client/front/credit-insurance/index/index.spec.js @@ -39,7 +39,7 @@ describe('Client', () => { it(`should return false if finds a classification without due date`, () => { controller.classifications = [ - {finished: Date.now()}, + {finished: Date.vnNow()}, {finished: null} ]; @@ -50,8 +50,8 @@ describe('Client', () => { it(`should return true if all classifications are defined with due date`, () => { controller.classifications = [ - {finished: Date.now()}, - {finished: Date.now()} + {finished: Date.vnNow()}, + {finished: Date.vnNow()} ]; let result = controller.canCreateNew(); diff --git a/modules/client/front/credit-insurance/insurance/create/index.js b/modules/client/front/credit-insurance/insurance/create/index.js index 94de53352..9eae5bfa9 100644 --- a/modules/client/front/credit-insurance/insurance/create/index.js +++ b/modules/client/front/credit-insurance/insurance/create/index.js @@ -5,7 +5,7 @@ class Controller extends Section { constructor($element, $) { super($element, $); this.insurance = { - created: this.$filter('date')(new Date(), 'yyyy-MM-dd HH:mm:ss') + created: this.$filter('date')(Date.vnNew(), 'yyyy-MM-dd HH:mm:ss') }; } diff --git a/modules/client/front/defaulter/index.js b/modules/client/front/defaulter/index.js index 4beadfda6..bfadc5c6a 100644 --- a/modules/client/front/defaulter/index.js +++ b/modules/client/front/defaulter/index.js @@ -82,7 +82,7 @@ export default class Controller extends Section { chipColor(date) { const day = 24 * 60 * 60 * 1000; - const today = new Date(); + const today = Date.vnNew(); today.setHours(0, 0, 0, 0); const observationShipped = new Date(date); diff --git a/modules/client/front/defaulter/index.spec.js b/modules/client/front/defaulter/index.spec.js index 0732c68a1..f92378d08 100644 --- a/modules/client/front/defaulter/index.spec.js +++ b/modules/client/front/defaulter/index.spec.js @@ -38,14 +38,14 @@ describe('client defaulter', () => { describe('chipColor()', () => { it('should return undefined when the date is the present', () => { - let today = new Date(); + let today = Date.vnNew(); let result = controller.chipColor(today); expect(result).toEqual(undefined); }); it('should return warning when the date is 10 days in the past', () => { - let pastDate = new Date(); + let pastDate = Date.vnNew(); pastDate = pastDate.setDate(pastDate.getDate() - 11); let result = controller.chipColor(pastDate); @@ -53,7 +53,7 @@ describe('client defaulter', () => { }); it('should return alert when the date is 20 days in the past', () => { - let pastDate = new Date(); + let pastDate = Date.vnNew(); pastDate = pastDate.setDate(pastDate.getDate() - 21); let result = controller.chipColor(pastDate); diff --git a/modules/client/front/descriptor/index.html b/modules/client/front/descriptor/index.html index cad226416..5aaecbdb0 100644 --- a/modules/client/front/descriptor/index.html +++ b/modules/client/front/descriptor/index.html @@ -18,26 +18,26 @@
+ info="Invoices minus payments plus orders not yet invoiced"> - {{$ctrl.client.salesPersonUser.name}} @@ -70,6 +70,12 @@ icon="icon-no036" ng-if="$ctrl.client.isTaxDataChecked == false"> + +
\ No newline at end of file + diff --git a/modules/client/front/unpaid/index.js b/modules/client/front/unpaid/index.js index a8ff64386..1585b808d 100644 --- a/modules/client/front/unpaid/index.js +++ b/modules/client/front/unpaid/index.js @@ -4,11 +4,19 @@ import Section from 'salix/components/section'; export default class Controller extends Section { setDefaultDate(hasData) { if (hasData && !this.clientUnpaid.dated) - this.clientUnpaid.dated = new Date(); + this.clientUnpaid.dated = Date.vnNew(); + } + + onSubmit() { + this.$.watcher.submit() + .then(() => this.card.reload()); } } ngModule.vnComponent('vnClientUnpaid', { template: require('./index.html'), - controller: Controller + controller: Controller, + require: { + card: '^vnClientCard' + } }); diff --git a/modules/client/front/unpaid/index.spec.js b/modules/client/front/unpaid/index.spec.js index bfeb7df19..0f6460a03 100644 --- a/modules/client/front/unpaid/index.spec.js +++ b/modules/client/front/unpaid/index.spec.js @@ -14,7 +14,7 @@ describe('client unpaid', () => { describe('setDefaultDate()', () => { it(`should not set today date if has dated`, () => { const hasData = true; - const yesterday = new Date(); + const yesterday = Date.vnNew(); yesterday.setDate(yesterday.getDate() - 1); controller.clientUnpaid = { diff --git a/modules/client/front/web-access/index.html b/modules/client/front/web-access/index.html index c807489d6..b776fa577 100644 --- a/modules/client/front/web-access/index.html +++ b/modules/client/front/web-access/index.html @@ -5,6 +5,11 @@ data="$ctrl.account" form="form"> + +
@@ -28,6 +33,17 @@ rule> + + + + { diff --git a/modules/client/front/web-access/locale/es.yml b/modules/client/front/web-access/locale/es.yml index 4a3ac0ab4..5090ed020 100644 --- a/modules/client/front/web-access/locale/es.yml +++ b/modules/client/front/web-access/locale/es.yml @@ -4,4 +4,6 @@ New password: Nueva contraseña Repeat password: Repetir contraseña Change password: Cambiar contraseña Passwords don't match: Las contraseñas no coinciden -You must enter a new password: Debes introducir una nueva contraseña \ No newline at end of file +You must enter a new password: Debes introducir una nueva contraseña +Recovery email: Correo de recuperación +This email is used for user to regain access their account.: Este correo electrónico se usa para que el usuario recupere el acceso a su cuenta. \ No newline at end of file diff --git a/modules/client/front/web-payment/index.html b/modules/client/front/web-payment/index.html index 203d4bb60..2ecfc950b 100644 --- a/modules/client/front/web-payment/index.html +++ b/modules/client/front/web-payment/index.html @@ -1,55 +1,39 @@ - + - + - - - - State - Id - Date - Amount - - - - - - - - - - - - {{::transaction.id}} - {{::transaction.created | date:'dd/MM/yyyy HH:mm'}} - {{::transaction.amount | currency: 'EUR':2}} - - - - - - - + + + + State + Id + Date + Amount + + + + + + + + + + + + {{::transaction.id}} + {{::transaction.created | date:'dd/MM/yyyy HH:mm'}} + {{::transaction.amount | currency: 'EUR':2}} + + + + + + + \ 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 72bee98ae..2642d4f4d 100644 --- a/modules/entry/back/methods/entry/editLatestBuys.js +++ b/modules/entry/back/methods/entry/editLatestBuys.js @@ -52,7 +52,7 @@ module.exports = Self => { switch (field) { case 'size': - case 'density': + case 'weightByPiece': case 'description': case 'packingOut': modelName = 'Item'; diff --git a/modules/entry/back/methods/entry/entryOrderPdf.js b/modules/entry/back/methods/entry/entryOrderPdf.js new file mode 100644 index 000000000..f77832162 --- /dev/null +++ b/modules/entry/back/methods/entry/entryOrderPdf.js @@ -0,0 +1,40 @@ +module.exports = Self => { + Self.remoteMethodCtx('entryOrderPdf', { + description: 'Returns the entry order pdf', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + } + ], + 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/entry-order-pdf', + verb: 'GET' + } + }); + + Self.entryOrderPdf = (ctx, id) => Self.printReport(ctx, id, 'entry-order'); +}; diff --git a/modules/entry/back/methods/entry/filter.js b/modules/entry/back/methods/entry/filter.js index 13690d3ac..e90043074 100644 --- a/modules/entry/back/methods/entry/filter.js +++ b/modules/entry/back/methods/entry/filter.js @@ -154,9 +154,10 @@ module.exports = Self => { e.id, e.supplierFk, e.dated, - e.ref, + e.reference, + e.invoiceNumber, e.isBooked, - e.isInventory, + e.isExcludedFromAvailable, e.notes, e.evaNotes AS observation, e.isConfirmed, diff --git a/modules/entry/back/methods/entry/getEntry.js b/modules/entry/back/methods/entry/getEntry.js index 66238d0dc..cac3c65f8 100644 --- a/modules/entry/back/methods/entry/getEntry.js +++ b/modules/entry/back/methods/entry/getEntry.js @@ -43,7 +43,7 @@ module.exports = Self => { 'name', 'shipped', 'landed', - 'agencyFk', + 'agencyModeFk', 'warehouseOutFk', 'warehouseInFk', 'isReceived', diff --git a/modules/entry/back/methods/entry/importBuys.js b/modules/entry/back/methods/entry/importBuys.js index fb2f5f452..fdc6b058e 100644 --- a/modules/entry/back/methods/entry/importBuys.js +++ b/modules/entry/back/methods/entry/importBuys.js @@ -12,10 +12,15 @@ module.exports = Self => { http: {source: 'path'} }, { - arg: 'ref', + arg: 'reference', type: 'string', description: 'The buyed boxes ids', }, + { + arg: 'invoiceNumber', + type: 'string', + description: 'The registered invoice number', + }, { arg: 'observation', type: 'string', @@ -63,7 +68,8 @@ module.exports = Self => { await entry.updateAttributes({ observation: args.observation, - ref: args.ref + reference: args.reference, + invoiceNumber: args.invoiceNumber }, myOptions); const travel = entry.travel(); diff --git a/modules/entry/back/methods/entry/importBuysPreview.js b/modules/entry/back/methods/entry/importBuysPreview.js index 5b88b587c..730ecab0a 100644 --- a/modules/entry/back/methods/entry/importBuysPreview.js +++ b/modules/entry/back/methods/entry/importBuysPreview.js @@ -20,7 +20,7 @@ module.exports = Self => { }, http: { path: `/:id/importBuysPreview`, - verb: 'GET' + verb: 'POST' } }); diff --git a/modules/entry/back/methods/entry/lastItemBuys.js b/modules/entry/back/methods/entry/lastItemBuys.js index 7e83f1e5f..87b99c229 100644 --- a/modules/entry/back/methods/entry/lastItemBuys.js +++ b/modules/entry/back/methods/entry/lastItemBuys.js @@ -63,7 +63,6 @@ module.exports = Self => { stmt = new ParameterizedSQL( `CREATE TEMPORARY TABLE tmp.item (PRIMARY KEY (id)) - ENGINE = MEMORY SELECT i.*, p.name AS producerName, diff --git a/modules/entry/back/methods/entry/latestBuysFilter.js b/modules/entry/back/methods/entry/latestBuysFilter.js index 9a21d4472..30d47a2a3 100644 --- a/modules/entry/back/methods/entry/latestBuysFilter.js +++ b/modules/entry/back/methods/entry/latestBuysFilter.js @@ -148,14 +148,16 @@ module.exports = Self => { stmt = new ParameterizedSQL(`CALL cache.visible_refresh(@calc_id, FALSE, ?)`, [warehouse.id]); stmts.push(stmt); - const date = new Date(); + const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions); + + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); stmt = new ParameterizedSQL(` - SELECT + SELECT i.image, i.id AS itemFk, i.size, - i.density, + i.weightByPiece, it.code, i.typeFk, i.family, @@ -201,15 +203,15 @@ module.exports = Self => { LEFT JOIN cache.visible v ON v.item_id = lb.item_id AND v.calc_id = @calc_id JOIN item i ON i.id = lb.item_id - JOIN itemType it ON it.id = i.typeFk AND lb.warehouse_id = it.warehouseFk + JOIN itemType it ON it.id = i.typeFk AND lb.warehouse_id = ? JOIN buy b ON b.id = lb.buy_id LEFT JOIN itemCategory ic ON ic.id = it.categoryFk LEFT JOIN itemType t ON t.id = i.typeFk LEFT JOIN intrastat intr ON intr.id = i.intrastatFk LEFT JOIN origin ori ON ori.id = i.originFk - LEFT JOIN entry e ON e.id = b.entryFk AND e.created >= DATE_SUB(? ,INTERVAL 1 YEAR) + LEFT JOIN entry e ON e.id = b.entryFk AND e.created >= DATE_SUB(? ,INTERVAL 1 YEAR) LEFT JOIN supplier s ON s.id = e.supplierFk` - , [date]); + , [userConfig.warehouseFk, date]); if (ctx.args.tags) { let i = 1; diff --git a/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js b/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js index 2413c18f6..99d2df67b 100644 --- a/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js +++ b/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js @@ -1,6 +1,22 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('Buy editLatestsBuys()', () => { + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + it('should change the value of a given column for the selected buys', async() => { const tx = await models.Buy.beginTransaction({}); const options = {transaction: tx}; @@ -9,7 +25,8 @@ describe('Buy editLatestsBuys()', () => { const ctx = { args: { search: 'Ranged weapon longbow 2m' - } + }, + req: {accessToken: {userId: 1}} }; const [original] = await models.Buy.latestBuysFilter(ctx, null, options); @@ -36,11 +53,12 @@ describe('Buy editLatestsBuys()', () => { const options = {transaction: tx}; try { - const filter = {typeFk: 1}; + const filter = {'i.typeFk': 1}; const ctx = { args: { filter: filter - } + }, + req: {accessToken: {userId: 1}} }; const field = 'size'; diff --git a/modules/entry/back/methods/entry/specs/importBuys.spec.js b/modules/entry/back/methods/entry/specs/importBuys.spec.js index 9cf6f4300..4f9204c6a 100644 --- a/modules/entry/back/methods/entry/specs/importBuys.spec.js +++ b/modules/entry/back/methods/entry/specs/importBuys.spec.js @@ -15,13 +15,15 @@ describe('entry import()', () => { }); it('should import the buy rows', async() => { - const expectedRef = '1, 2'; + const expectedReference = '1, 2'; + const expectedInvoiceNumber = '1, 2'; const expectedObservation = '123456'; const ctx = { req: activeCtx, args: { observation: expectedObservation, - ref: expectedRef, + reference: expectedReference, + invoiceNumber: expectedInvoiceNumber, buys: [ { itemFk: 1, @@ -58,7 +60,8 @@ describe('entry import()', () => { }, options); expect(updatedEntry.observation).toEqual(expectedObservation); - expect(updatedEntry.ref).toEqual(expectedRef); + expect(updatedEntry.reference).toEqual(expectedReference); + expect(updatedEntry.invoiceNumber).toEqual(expectedInvoiceNumber); expect(entryBuys.length).toEqual(4); await tx.rollback(); diff --git a/modules/entry/back/methods/entry/specs/latestBuysFilter.spec.js b/modules/entry/back/methods/entry/specs/latestBuysFilter.spec.js index 7c813ea89..0578fcdd4 100644 --- a/modules/entry/back/methods/entry/specs/latestBuysFilter.spec.js +++ b/modules/entry/back/methods/entry/specs/latestBuysFilter.spec.js @@ -9,7 +9,8 @@ describe('Entry latests buys filter()', () => { const ctx = { args: { search: 'Ranged weapon longbow 2m' - } + }, + req: {accessToken: {userId: 1}} }; const results = await models.Buy.latestBuysFilter(ctx, options); @@ -33,7 +34,8 @@ describe('Entry latests buys filter()', () => { const ctx = { args: { id: 1 - } + }, + req: {accessToken: {userId: 1}} }; const results = await models.Buy.latestBuysFilter(ctx, options); @@ -57,7 +59,8 @@ describe('Entry latests buys filter()', () => { tags: [ {tagFk: 27, value: '2m'} ] - } + }, + req: {accessToken: {userId: 1}} }; const results = await models.Buy.latestBuysFilter(ctx, options); @@ -79,7 +82,8 @@ describe('Entry latests buys filter()', () => { const ctx = { args: { categoryFk: 1 - } + }, + req: {accessToken: {userId: 1}} }; const results = await models.Buy.latestBuysFilter(ctx, options); @@ -101,7 +105,8 @@ describe('Entry latests buys filter()', () => { const ctx = { args: { typeFk: 2 - } + }, + req: {accessToken: {userId: 1}} }; const results = await models.Buy.latestBuysFilter(ctx, options); @@ -123,7 +128,8 @@ describe('Entry latests buys filter()', () => { const ctx = { args: { active: true - } + }, + req: {accessToken: {userId: 1}} }; const results = await models.Buy.latestBuysFilter(ctx, options); @@ -145,7 +151,8 @@ describe('Entry latests buys filter()', () => { const ctx = { args: { active: false - } + }, + req: {accessToken: {userId: 1}} }; const results = await models.Buy.latestBuysFilter(ctx, options); @@ -167,7 +174,8 @@ describe('Entry latests buys filter()', () => { const ctx = { args: { visible: true - } + }, + req: {accessToken: {userId: 1}} }; const results = await models.Buy.latestBuysFilter(ctx, options); @@ -189,7 +197,8 @@ describe('Entry latests buys filter()', () => { const ctx = { args: { visible: false - } + }, + req: {accessToken: {userId: 1}} }; const results = await models.Buy.latestBuysFilter(ctx, options); @@ -211,7 +220,8 @@ describe('Entry latests buys filter()', () => { const ctx = { args: { floramondo: true - } + }, + req: {accessToken: {userId: 1}} }; const results = await models.Buy.latestBuysFilter(ctx, options); @@ -233,7 +243,8 @@ describe('Entry latests buys filter()', () => { const ctx = { args: { floramondo: false - } + }, + req: {accessToken: {userId: 1}} }; const results = await models.Buy.latestBuysFilter(ctx, options); @@ -255,7 +266,8 @@ describe('Entry latests buys filter()', () => { const ctx = { args: { salesPersonFk: 35 - } + }, + req: {accessToken: {userId: 1}} }; const results = await models.Buy.latestBuysFilter(ctx, options); @@ -277,7 +289,8 @@ describe('Entry latests buys filter()', () => { const ctx = { args: { description: 'Increases block' - } + }, + req: {accessToken: {userId: 1}} }; const results = await models.Buy.latestBuysFilter(ctx, options); @@ -299,7 +312,8 @@ describe('Entry latests buys filter()', () => { const ctx = { args: { supplierFk: 1 - } + }, + req: {accessToken: {userId: 1}} }; const results = await models.Buy.latestBuysFilter(ctx, options); @@ -318,17 +332,18 @@ describe('Entry latests buys filter()', () => { const options = {transaction: tx}; try { - const from = new Date(); + const from = Date.vnNew(); from.setHours(0, 0, 0, 0); - const to = new Date(); + const to = Date.vnNew(); to.setHours(23, 59, 59, 999); const ctx = { args: { from: from, to: to - } + }, + req: {accessToken: {userId: 1}} }; const results = await models.Buy.latestBuysFilter(ctx, options); diff --git a/modules/entry/back/models/buy.json b/modules/entry/back/models/buy.json index 8e36d0eef..de2ddffd6 100644 --- a/modules/entry/back/models/buy.json +++ b/modules/entry/back/models/buy.json @@ -3,7 +3,8 @@ "base": "Loggable", "log": { "model": "EntryLog", - "relation": "entry" + "relation": "entry", + "grabUser": true }, "options": { "mysql": { @@ -70,4 +71,4 @@ "foreignKey": "packageFk" } } -} \ No newline at end of file +} diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js index 573e5b1cb..1980f964c 100644 --- a/modules/entry/back/models/entry.js +++ b/modules/entry/back/models/entry.js @@ -1,3 +1,4 @@ +const LoopBackContext = require('loopback-context'); module.exports = Self => { require('../methods/entry/filter')(Self); require('../methods/entry/getEntry')(Self); @@ -6,4 +7,42 @@ module.exports = Self => { require('../methods/entry/importBuys')(Self); require('../methods/entry/importBuysPreview')(Self); require('../methods/entry/lastItemBuys')(Self); + require('../methods/entry/entryOrderPdf')(Self); + + Self.observe('before save', async function(ctx, options) { + if (ctx.isNewInstance) return; + + const changes = ctx.data || ctx.instance; + const orgData = ctx.currentInstance; + + const observation = changes.observation || orgData.observation; + const hasChanges = orgData && changes; + const observationChanged = hasChanges + && orgData.observation != observation; + + if (observationChanged) { + let tx; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const loopbackContext = LoopBackContext.getCurrentContext(); + const userId = loopbackContext.active.accessToken.userId; + const id = changes.id || orgData.id; + const entry = await Self.app.models.Entry.findById(id, null, myOptions); + await entry.updateAttribute('observationEditorFk', userId, myOptions); + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + } + }); }; diff --git a/modules/entry/back/models/entry.json b/modules/entry/back/models/entry.json index d8bd079a2..5aa175758 100644 --- a/modules/entry/back/models/entry.json +++ b/modules/entry/back/models/entry.json @@ -2,7 +2,8 @@ "name": "Entry", "base": "Loggable", "log": { - "model":"EntryLog" + "model":"EntryLog", + "grabUser": true }, "options": { "mysql": { @@ -18,13 +19,16 @@ "dated": { "type": "date" }, - "ref": { + "reference": { + "type": "string" + }, + "invoiceNumber": { "type": "string" }, "isBooked": { "type": "boolean" }, - "isInventory": { + "isExcludedFromAvailable": { "type": "boolean" }, "notes": { @@ -74,6 +78,9 @@ "companyFk": { "type": "number", "required": true + }, + "observationEditorFk": { + "type": "number" } }, "relations": { @@ -96,6 +103,11 @@ "type": "belongsTo", "model": "Currency", "foreignKey": "currencyFk" + }, + "observationEditor": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "observationEditorFk" } } } diff --git a/modules/entry/front/basic-data/index.html b/modules/entry/front/basic-data/index.html index a05630dd6..68a65e890 100644 --- a/modules/entry/front/basic-data/index.html +++ b/modules/entry/front/basic-data/index.html @@ -48,7 +48,7 @@ @@ -61,17 +61,25 @@ - - + label="Invoice number" + ng-model="$ctrl.entry.invoiceNumber" + rule + vn-focus> + + + - - + + + + + ng-model="$ctrl.entry.isExcludedFromAvailable"> diff --git a/modules/entry/front/basic-data/index.js b/modules/entry/front/basic-data/index.js index 80870c3f3..564a3df5c 100644 --- a/modules/entry/front/basic-data/index.js +++ b/modules/entry/front/basic-data/index.js @@ -46,7 +46,7 @@ class Controller extends Section { if (!value) continue; switch (key) { - case 'agencyFk': + case 'agencyModeFk': case 'warehouseInFk': case 'warehouseOutFk': case 'shipped': diff --git a/modules/entry/front/buy/import/index.js b/modules/entry/front/buy/import/index.js index a2a28ef69..ba0a98e62 100644 --- a/modules/entry/front/buy/import/index.js +++ b/modules/entry/front/buy/import/index.js @@ -58,7 +58,7 @@ class Controller extends Section { fetchBuys(buys) { const params = {buys}; const query = `Entries/${this.$params.id}/importBuysPreview`; - this.$http.get(query, {params}).then(res => { + this.$http.post(query, params).then(res => { this.import.buys = res.data; }); } diff --git a/modules/entry/front/buy/import/index.spec.js b/modules/entry/front/buy/import/index.spec.js index bf100dc83..036f52074 100644 --- a/modules/entry/front/buy/import/index.spec.js +++ b/modules/entry/front/buy/import/index.spec.js @@ -111,9 +111,8 @@ describe('Entry', () => { 'volume': 1125} ]; - const serializedParams = $httpParamSerializer({buys}); - const query = `Entries/1/importBuysPreview?${serializedParams}`; - $httpBackend.expectGET(query).respond(200, buys); + const query = `Entries/1/importBuysPreview`; + $httpBackend.expectPOST(query).respond(200, buys); controller.fetchBuys(buys); $httpBackend.flush(); diff --git a/modules/entry/front/buy/index/index.html b/modules/entry/front/buy/index/index.html index eaa37c92e..de784198c 100644 --- a/modules/entry/front/buy/index/index.html +++ b/modules/entry/front/buy/index/index.html @@ -60,7 +60,7 @@ ng-if="buy.id" ng-click="itemDescriptor.show($event, buy.item.id)" class="link"> - {{::buy.item.id | zeroFill:6}} + {{::buy.item.id}} diff --git a/modules/entry/front/buy/index/index.js b/modules/entry/front/buy/index/index.js index 6d9ee5760..322b81d4e 100644 --- a/modules/entry/front/buy/index/index.js +++ b/modules/entry/front/buy/index/index.js @@ -73,6 +73,12 @@ export default class Controller extends Section { this.vnApp.showSuccess(this.$t('Data saved!')); }); } + + itemSearchFunc($search) { + return /^\d+$/.test($search) + ? {id: $search} + : {name: {like: '%' + $search + '%'}}; + } } ngModule.vnComponent('vnEntryBuyIndex', { diff --git a/modules/entry/front/card/index.js b/modules/entry/front/card/index.js index eafed171b..96f4702e2 100644 --- a/modules/entry/front/card/index.js +++ b/modules/entry/front/card/index.js @@ -14,7 +14,7 @@ class Controller extends ModuleCard { { relation: 'travel', scope: { - fields: ['id', 'landed', 'agencyFk', 'warehouseOutFk'], + fields: ['id', 'landed', 'agencyModeFk', 'warehouseOutFk'], include: [ { relation: 'agency', diff --git a/modules/entry/front/descriptor/index.html b/modules/entry/front/descriptor/index.html index f0e2439bb..7b61a0cf5 100644 --- a/modules/entry/front/descriptor/index.html +++ b/modules/entry/front/descriptor/index.html @@ -25,7 +25,7 @@ + ng-if="$ctrl.entry.isExcludedFromAvailable"> { jest.spyOn(controller.vnReport, 'show'); window.open = jasmine.createSpy('open'); - const params = { - clientId: controller.vnConfig.storage.currentUserWorkerId, - entryId: entry.id - }; controller.showEntryReport(); + const expectedPath = `Entries/${entry.id}/entry-order-pdf`; - expect(controller.vnReport.show).toHaveBeenCalledWith('entry-order', params); + expect(controller.vnReport.show).toHaveBeenCalledWith(expectedPath); }); }); diff --git a/modules/entry/front/index/index.html b/modules/entry/front/index/index.html index b48f99aab..42177be21 100644 --- a/modules/entry/front/index/index.html +++ b/modules/entry/front/index/index.html @@ -12,6 +12,7 @@ Id Landed Reference + Invoice number Supplier Booked Confirmed @@ -25,7 +26,7 @@ ui-sref="entry.card.summary({id: {{::entry.id}}})"> @@ -45,7 +46,8 @@ {{::entry.landed | date:'dd/MM/yyyy'}} - {{::entry.ref}} + {{::entry.reference}} + {{::entry.invoiceNumber}} {{::entry.supplierName}} diff --git a/modules/entry/front/index/locale/es.yml b/modules/entry/front/index/locale/es.yml index 519f8e39a..4f12fc7bb 100644 --- a/modules/entry/front/index/locale/es.yml +++ b/modules/entry/front/index/locale/es.yml @@ -14,4 +14,5 @@ Booked: Contabilizada Is inventory: Inventario Notes: Notas Status: Estado -Selection: Selección \ No newline at end of file +Selection: Selección +Invoice number: Núm. factura \ No newline at end of file diff --git a/modules/entry/front/latest-buys-search-panel/index.html b/modules/entry/front/latest-buys-search-panel/index.html index 8cfab622a..075d6a8f7 100644 --- a/modules/entry/front/latest-buys-search-panel/index.html +++ b/modules/entry/front/latest-buys-search-panel/index.html @@ -1,198 +1,243 @@ - -
- - - - - - - - - - -
{{name}}
-
- {{category.name}} -
-
> -
-
- - - - - {{name}}: {{nickname}} - - - - - - - - - - - - - - - - - - - Tags - - - - - - - - - - - - - - - - - More fields - - - - - - - - -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- - - - -
+ + + + + + + + + + + + + + + + + + +
{{name}}
+
+ {{category.name}} +
> +
+
+ + + + + {{name}}: {{nickname}} + + + + + + + + + + + + + + + + + + Tags + + + + + + + + + + + + + +
+ + Id/Name: {{$ctrl.filter.search}} + + + {{category.selection.name}} + + + {{type.selection.name}} + + + Sales person: {{salesPerson.selection.nickname}} + + + Supplier: {{supplier.selection.name}} + + + From: {{$ctrl.filter.from | date:'dd/MM/yyyy'}} + + + To: {{$ctrl.filter.to | date:'dd/MM/yyyy'}} + + + Active: {{$ctrl.filter.active ? '✓' : '✗'}} + + + Floramondo: {{$ctrl.filter.floramondo ? '✓' : '✗'}} + + + Visible: {{$ctrl.filter.visible ? '✓' : '✗'}} + + + {{$ctrl.showTagInfo(chipTag)}} + + +
+
diff --git a/modules/entry/front/latest-buys-search-panel/index.js b/modules/entry/front/latest-buys-search-panel/index.js index 83dc88724..4078580ea 100644 --- a/modules/entry/front/latest-buys-search-panel/index.js +++ b/modules/entry/front/latest-buys-search-panel/index.js @@ -1,67 +1,61 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; +import './style.scss'; class Controller extends SearchPanel { constructor($element, $) { super($element, $); - let model = 'Item'; - let moreFields = ['description', 'name']; + } - let properties; - let validations = window.validations; + $onInit() { + this.filter = { + isActive: true, + tags: [] + }; + } - if (validations && validations[model]) - properties = validations[model].properties; - else - properties = {}; - - this.moreFields = []; - for (let field of moreFields) { - let prop = properties[field]; - this.moreFields.push({ - name: field, - label: prop ? prop.description : field, - type: prop ? prop.type : null - }); + changeCategory(id) { + if (this.filter.categoryFk != id) { + this.filter.categoryFk = id; + this.addFilters(); } } - get filter() { - let filter = this.$.filter; - - for (let fieldFilter of this.fieldFilters) - filter[fieldFilter.name] = fieldFilter.value; - - return filter; + removeItemFilter(param) { + this.filter[param] = null; + if (param == 'categoryFk') this.filter['typeFk'] = null; + this.addFilters(); } - set filter(value) { - if (!value) - value = {}; - if (!value.tags) - value.tags = [{}]; + removeTag(tag) { + const index = this.filter.tags.indexOf(tag); + if (index > -1) this.filter.tags.splice(index, 1); + this.addFilters(); + } - this.fieldFilters = []; - for (let field of this.moreFields) { - if (value[field.name] != undefined) { - this.fieldFilters.push({ - name: field.name, - value: value[field.name], - info: field - }); - } + onKeyPress($event) { + if ($event.key === 'Enter') + this.addFilters(); + } + + addFilters() { + for (let i = 0; i < this.filter.tags.length; i++) { + if (!this.filter.tags[i].value) + this.filter.tags.splice(i, 1); } - - this.$.filter = value; + return this.model.addFilter({}, this.filter); } - removeField(index, field) { - this.fieldFilters.splice(index, 1); - delete this.$.filter[field]; + showTagInfo(itemTag) { + if (!itemTag.tagFk) return itemTag.value; + return `${this.tags.find(tag => tag.id == itemTag.tagFk).name}: ${itemTag.value}`; } } ngModule.component('vnLatestBuysSearchPanel', { template: require('./index.html'), - controller: Controller + controller: Controller, + bindings: { + model: '<' + } }); diff --git a/modules/entry/front/latest-buys-search-panel/index.spec.js b/modules/entry/front/latest-buys-search-panel/index.spec.js index 9e187a25a..c3c5acbfb 100644 --- a/modules/entry/front/latest-buys-search-panel/index.spec.js +++ b/modules/entry/front/latest-buys-search-panel/index.spec.js @@ -10,50 +10,46 @@ describe('Entry', () => { beforeEach(angular.mock.inject($componentController => { $element = angular.element(``); controller = $componentController('vnLatestBuysSearchPanel', {$element}); + controller.model = {addFilter: () => {}}; })); - describe('filter() setter', () => { - it(`should set the tags property to the scope filter with an empty array`, () => { - const expectedFilter = { - tags: [{}] - }; - controller.filter = null; + describe('removeItemFilter()', () => { + it(`should remove param from filter`, () => { + controller.filter = {tags: [], categoryFk: 1, typeFk: 1}; + const expectFilter = {tags: [], categoryFk: null, typeFk: null}; - expect(controller.filter).toEqual(expectedFilter); - }); + controller.removeItemFilter('categoryFk'); - it(`should set the tags property to the scope filter with an array of tags`, () => { - const expectedFilter = { - description: 'My item', - tags: [{}] - }; - const expectedFieldFilter = [{ - info: { - label: 'description', - name: 'description', - type: null - }, - name: 'description', - value: 'My item' - }]; - controller.filter = { - description: 'My item' - }; - - expect(controller.filter).toEqual(expectedFilter); - expect(controller.fieldFilters).toEqual(expectedFieldFilter); + expect(controller.filter).toEqual(expectFilter); }); }); - describe('removeField()', () => { - it(`should remove the description property from the fieldFilters and from the scope filter`, () => { - const expectedFilter = {tags: [{}]}; - controller.filter = {description: 'My item'}; + describe('removeTag()', () => { + it(`should remove tag from filter`, () => { + const tag = {tagFk: 1, value: 'Value'}; + controller.filter = {tags: [tag]}; + const expectFilter = {tags: []}; - controller.removeField(0, 'description'); + controller.removeTag(tag); - expect(controller.filter).toEqual(expectedFilter); - expect(controller.fieldFilters).toEqual([]); + expect(controller.filter).toEqual(expectFilter); + }); + }); + + describe('showTagInfo()', () => { + it(`should show tag value`, () => { + const tag = {value: 'Value'}; + const result = controller.showTagInfo(tag); + + expect(result).toEqual('Value'); + }); + + it(`should show tag name and value`, () => { + const tag = {tagFk: 1, value: 'Value'}; + controller.tags = [{id: 1, name: 'tagName'}]; + const result = controller.showTagInfo(tag); + + expect(result).toEqual('tagName: Value'); }); }); }); diff --git a/modules/entry/front/latest-buys-search-panel/style.scss b/modules/entry/front/latest-buys-search-panel/style.scss new file mode 100644 index 000000000..ec189c7e4 --- /dev/null +++ b/modules/entry/front/latest-buys-search-panel/style.scss @@ -0,0 +1,70 @@ +@import "variables"; + +vn-latest-buys-search-panel vn-side-menu div { + & > .input { + padding-left: $spacing-md; + padding-right: $spacing-md; + border-color: $color-spacer; + border-bottom: $border-thin; + } + & > .horizontal { + grid-auto-flow: column; + grid-column-gap: $spacing-sm; + align-items: center; + } + & > .checks { + padding: $spacing-md; + flex-wrap: wrap; + border-color: $color-spacer; + border-bottom: $border-thin; + } + & > .tags { + padding: $spacing-md; + padding-bottom: 0%; + padding-top: 0%; + align-items: center; + } + & > .chips { + display: flex; + flex-wrap: wrap; + padding: $spacing-md; + overflow: hidden; + max-width: 100%; + border-color: $color-spacer; + border-top: $border-thin; + } + & > .item-category { + padding: $spacing-sm; + justify-content: flex-start; + align-items: flex-start; + flex-wrap: wrap; + + vn-autocomplete[vn-id="category"] { + display: none; + } + + & > vn-one { + padding: $spacing-sm; + min-width: 33.33%; + text-align: center; + box-sizing: border-box; + + & > vn-icon { + padding: $spacing-sm; + background-color: $color-font-secondary; + border-radius: 50%; + cursor: pointer; + + &.active { + background-color: $color-main; + color: #fff; + } + & > i:before { + font-size: 2.6rem; + width: 16px; + height: 16px; + } + } + } + } +} diff --git a/modules/entry/front/latest-buys/index.html b/modules/entry/front/latest-buys/index.html index adeda5e56..727b19220 100644 --- a/modules/entry/front/latest-buys/index.html +++ b/modules/entry/front/latest-buys/index.html @@ -4,24 +4,19 @@ order="itemFk DESC" limit="20" data="$ctrl.buys" + on-data-change="$ctrl.reCheck()" auto-load="true">
- - - + + + @@ -67,8 +62,8 @@ - @@ -181,12 +177,12 @@ {{::buy.intrastat}} - + @@ -231,7 +227,7 @@ - @@ -259,7 +255,7 @@ - + { + if (this.checkedBuys.includes(buy.id)) + buy.checked = true; + }); + } + onEditAccept() { const rowsToEdit = []; for (let row of this.checked) diff --git a/modules/entry/front/latest-buys/index.spec.js b/modules/entry/front/latest-buys/index.spec.js index 76e122d80..6574303fc 100644 --- a/modules/entry/front/latest-buys/index.spec.js +++ b/modules/entry/front/latest-buys/index.spec.js @@ -57,5 +57,44 @@ describe('Entry', () => { expect(result.length).toEqual(0); }); }); + + describe('reCheck()', () => { + it(`should recheck buys`, () => { + controller.$.model.data = [ + {checked: false, id: 1}, + {checked: false, id: 2}, + {checked: false, id: 3}, + {checked: false, id: 4}, + ]; + controller.checkedBuys = [1, 2]; + + controller.reCheck(); + + expect(controller.$.model.data[0].checked).toEqual(true); + expect(controller.$.model.data[1].checked).toEqual(true); + expect(controller.$.model.data[2].checked).toEqual(false); + expect(controller.$.model.data[3].checked).toEqual(false); + }); + }); + + describe('saveChecked()', () => { + it(`should check buy`, () => { + const buyCheck = 3; + controller.checkedBuys = [1, 2]; + + controller.saveChecked(buyCheck); + + expect(controller.checkedBuys[2]).toEqual(buyCheck); + }); + + it(`should uncheck buy`, () => { + const buyUncheck = 3; + controller.checkedBuys = [1, 2, 3]; + + controller.saveChecked(buyUncheck); + + expect(controller.checkedBuys[2]).toEqual(undefined); + }); + }); }); }); diff --git a/modules/entry/front/latest-buys/locale/es.yml b/modules/entry/front/latest-buys/locale/es.yml index 8d70844fa..795e3f5f4 100644 --- a/modules/entry/front/latest-buys/locale/es.yml +++ b/modules/entry/front/latest-buys/locale/es.yml @@ -1,5 +1,5 @@ Edit buy(s): Editar compra(s) -Buying value: Precio +Buying value: Coste Freight value: Porte Commission value: Comisión Package value: Embalaje @@ -16,4 +16,4 @@ Field to edit: Campo a editar PackageName: Cubo Edit: Editar buy(s): compra(s) -Package out: Embalaje envíos \ No newline at end of file +Package out: Embalaje envíos diff --git a/modules/entry/front/search-panel/index.html b/modules/entry/front/search-panel/index.html index 38acdf77d..adcb9d6d4 100644 --- a/modules/entry/front/search-panel/index.html +++ b/modules/entry/front/search-panel/index.html @@ -13,9 +13,16 @@ + ng-model="filter.reference"> + + + + diff --git a/modules/entry/front/search-panel/locale/es.yml b/modules/entry/front/search-panel/locale/es.yml index 88f164145..05b71da99 100644 --- a/modules/entry/front/search-panel/locale/es.yml +++ b/modules/entry/front/search-panel/locale/es.yml @@ -5,4 +5,5 @@ From: Desde To: Hasta Agency: Agencia Warehouse: Almacén -Search entry by id or a suppliers by name or alias: Buscar entrada por id o proveedores por nombre y alias \ No newline at end of file +Search entry by id or a suppliers by name or alias: Buscar entrada por id o proveedores por nombre y alias +Invoice number: Núm. factura \ No newline at end of file diff --git a/modules/entry/front/summary/index.html b/modules/entry/front/summary/index.html index a95b2f18a..f03710dc4 100644 --- a/modules/entry/front/summary/index.html +++ b/modules/entry/front/summary/index.html @@ -27,7 +27,10 @@ value="{{$ctrl.entryData.company.code}}"> + value="{{$ctrl.entryData.reference}}"> + + @@ -35,7 +38,7 @@ - {{$ctrl.entryData.travel.ref}} @@ -91,7 +94,7 @@ @@ -111,8 +114,7 @@ - - + @@ -122,19 +124,18 @@ - - +
Origin - Density + + Weight/Piece Active @@ -123,17 +118,18 @@
- - - + {{::buy.packing | dashIfEmpty}} - + {{::buy.grouping | dashIfEmpty}} {{::buy.origin}}{{::buy.density}}{{::buy.weightByPiece}} - + {{::buy.family}} @@ -204,7 +200,7 @@ - + {{::buy.price2 | currency: 'EUR':2}} {{::buy.price3 | currency: 'EUR':2}} Grouping Buying value ImportGrouping pricePacking pricePVP
{{::line.packageFk | dashIfEmpty}} {{::line.weight}} - - {{::line.packing | dashIfEmpty}} + + {{::line.packing | dashIfEmpty}} - - {{::line.grouping | dashIfEmpty}} + + {{::line.grouping | dashIfEmpty}} {{::line.buyingValue | currency: 'EUR':2}} {{::line.quantity * line.buyingValue | currency: 'EUR':2}}{{::line.price2 | currency: 'EUR':2}}{{::line.price3 | currency: 'EUR':2}}{{::line.price2 | currency: 'EUR':2 | dashIfEmpty}} / {{::line.price3 | currency: 'EUR':2 | dashIfEmpty}}
@@ -147,7 +148,7 @@ - {{::line.item.id | zeroFill:6}} + {{::line.item.id}} @@ -192,7 +193,7 @@ vn-id="item-descriptor" warehouse-fk="$ctrl.vnConfig.warehouseFk"> - diff --git a/modules/entry/front/summary/locale/es.yml b/modules/entry/front/summary/locale/es.yml index a141ce56c..1761561ed 100644 --- a/modules/entry/front/summary/locale/es.yml +++ b/modules/entry/front/summary/locale/es.yml @@ -8,4 +8,4 @@ Minimum price: Precio mínimo Buys: Compras Travel: Envio Go to the entry: Ir a la entrada - +Invoice number: Núm. factura diff --git a/modules/invoiceIn/back/methods/invoice-in/getSerial.js b/modules/invoiceIn/back/methods/invoice-in/getSerial.js new file mode 100644 index 000000000..dcc1fbc3c --- /dev/null +++ b/modules/invoiceIn/back/methods/invoice-in/getSerial.js @@ -0,0 +1,65 @@ +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('getSerial', { + description: 'Return invoiceIn serial', + accessType: 'READ', + accepts: [{ + arg: 'filter', + type: 'object' + }, { + arg: 'daysAgo', + type: 'number', + required: true + }, { + arg: 'serial', + type: 'string' + }], + returns: { + type: 'object', + root: true + }, + http: { + path: '/getSerial', + verb: 'GET' + } + }); + + Self.getSerial = async(ctx, options) => { + const conn = Self.dataSource.connector; + const args = ctx.args; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const issued = Date.vnNew(); + const where = buildFilter(args, (param, value) => { + switch (param) { + case 'daysAgo': + issued.setDate(issued.getDate() - value); + return {'i.issued': {gte: issued}}; + case 'serial': + return {'i.serial': {like: `%${value}%`}}; + } + }); + + filter = mergeFilters(args.filter, {where}); + + const stmt = new ParameterizedSQL( + `SELECT i.serial, SUM(IF(i.isBooked, 0,1)) pending, COUNT(*) total + FROM vn.invoiceIn i` + ); + + stmt.merge(conn.makeWhere(filter.where)); + stmt.merge(`GROUP BY i.serial`); + stmt.merge(conn.makeOrderBy(filter.order)); + stmt.merge(conn.makeLimit(filter)); + + const result = await conn.executeStmt(stmt, myOptions); + + return result; + }; +}; diff --git a/modules/invoiceIn/back/methods/invoice-in/invoiceInEmail.js b/modules/invoiceIn/back/methods/invoice-in/invoiceInEmail.js new file mode 100644 index 000000000..a0af3da69 --- /dev/null +++ b/modules/invoiceIn/back/methods/invoice-in/invoiceInEmail.js @@ -0,0 +1,37 @@ +module.exports = Self => { + Self.remoteMethodCtx('invoiceInEmail', { + description: 'Sends the invoice in email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The invoice id', + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id to send to the recipient preferred language', + required: false + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/:id/invoice-in-email', + verb: 'POST' + } + }); + + Self.invoiceInEmail = ctx => Self.sendTemplate(ctx, 'invoiceIn'); +}; diff --git a/modules/invoiceIn/back/methods/invoice-in/invoiceInPdf.js b/modules/invoiceIn/back/methods/invoice-in/invoiceInPdf.js new file mode 100644 index 000000000..681a19fc6 --- /dev/null +++ b/modules/invoiceIn/back/methods/invoice-in/invoiceInPdf.js @@ -0,0 +1,36 @@ +module.exports = Self => { + Self.remoteMethodCtx('invoiceInPdf', { + description: 'Returns the invoiceIn pdf', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The invoiceIn 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/invoice-in-pdf', + verb: 'GET' + } + }); + + Self.invoiceInPdf = (ctx, id) => Self.printReport(ctx, id, 'invoiceIn'); +}; diff --git a/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js b/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js index 401b8dab0..adab3cbeb 100644 --- a/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js +++ b/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js @@ -146,8 +146,8 @@ describe('InvoiceIn filter()', () => { const options = {transaction: tx}; try { - const from = new Date(); - const to = new Date(); + const from = Date.vnNew(); + const to = Date.vnNew(); from.setHours(0, 0, 0, 0); to.setHours(23, 59, 59, 999); to.setDate(to.getDate() + 1); diff --git a/modules/invoiceIn/back/methods/invoice-in/specs/getSerial.spec.js b/modules/invoiceIn/back/methods/invoice-in/specs/getSerial.spec.js new file mode 100644 index 000000000..6224ce9ac --- /dev/null +++ b/modules/invoiceIn/back/methods/invoice-in/specs/getSerial.spec.js @@ -0,0 +1,24 @@ +const models = require('vn-loopback/server/server').models; + +describe('invoiceIn getSerial()', () => { + it('should check that returns without serial param', async() => { + const ctx = {args: {daysAgo: 45}}; + const result = await models.InvoiceIn.getSerial(ctx); + + expect(result.length).toBeGreaterThan(0); + }); + + it('should check that returns with serial param', async() => { + const ctx = {args: {daysAgo: 45, serial: 'R'}}; + const result = await models.InvoiceIn.getSerial(ctx); + + expect(result.length).toBeGreaterThan(0); + }); + + it('should check that returns with non exist serial param', async() => { + const ctx = {args: {daysAgo: 45, serial: 'Mock serial'}}; + const result = await models.InvoiceIn.getSerial(ctx); + + expect(result.length).toEqual(0); + }); +}); diff --git a/modules/invoiceIn/back/model-config.json b/modules/invoiceIn/back/model-config.json index 6765ae81c..bd37b3bf1 100644 --- a/modules/invoiceIn/back/model-config.json +++ b/modules/invoiceIn/back/model-config.json @@ -2,7 +2,7 @@ "InvoiceIn": { "dataSource": "vn" }, - "InvoiceInTax": { + "InvoiceInConfig": { "dataSource": "vn" }, "InvoiceInDueDay": { @@ -13,5 +13,8 @@ }, "InvoiceInLog": { "dataSource": "vn" + }, + "InvoiceInTax": { + "dataSource": "vn" } } diff --git a/modules/invoiceIn/back/models/invoice-in-config.json b/modules/invoiceIn/back/models/invoice-in-config.json new file mode 100644 index 000000000..c0236e654 --- /dev/null +++ b/modules/invoiceIn/back/models/invoice-in-config.json @@ -0,0 +1,38 @@ +{ + "name": "InvoiceInConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "invoiceInConfig" + } + }, + "properties": { + "id": { + "id": true, + "type": "number", + "description": "Identifier" + }, + "retentionRate": { + "type": "number" + }, + "retentionName": { + "type": "string" + }, + "daysAgo": { + "type": "number" + } + }, + "relations": { + "sageWithholding": { + "type": "belongsTo", + "model": "SageWithholding", + "foreignKey": "sageWithholdingFk" + } + }, + "acls": [{ + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }] +} diff --git a/modules/invoiceIn/back/models/invoice-in.js b/modules/invoiceIn/back/models/invoice-in.js index 3b5aa65d9..51905ccb8 100644 --- a/modules/invoiceIn/back/models/invoice-in.js +++ b/modules/invoiceIn/back/models/invoice-in.js @@ -4,4 +4,7 @@ module.exports = Self => { require('../methods/invoice-in/clone')(Self); require('../methods/invoice-in/toBook')(Self); require('../methods/invoice-in/getTotals')(Self); + require('../methods/invoice-in/invoiceInPdf')(Self); + require('../methods/invoice-in/invoiceInEmail')(Self); + require('../methods/invoice-in/getSerial')(Self); }; diff --git a/modules/invoiceIn/front/basic-data/index.html b/modules/invoiceIn/front/basic-data/index.html index be89e502c..a22abbb33 100644 --- a/modules/invoiceIn/front/basic-data/index.html +++ b/modules/invoiceIn/front/basic-data/index.html @@ -5,6 +5,24 @@ form="form" save="patch"> + + + + + +
@@ -31,14 +49,14 @@ @@ -57,17 +75,47 @@ {{id}} - {{name}} + + + + + + + + + + + + @@ -104,4 +152,164 @@ ng-click="watcher.loadOriginalData()"> - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/invoiceIn/front/basic-data/index.js b/modules/invoiceIn/front/basic-data/index.js index 6a39f35cd..8747fc4f2 100644 --- a/modules/invoiceIn/front/basic-data/index.js +++ b/modules/invoiceIn/front/basic-data/index.js @@ -1,9 +1,181 @@ import ngModule from '../module'; import Section from 'salix/components/section'; +import UserError from 'core/lib/user-error'; + +class Controller extends Section { + constructor($element, $, vnFile) { + super($element, $, vnFile); + this.dms = { + files: [], + hasFile: false, + hasFileAttached: false + }; + this.vnFile = vnFile; + this.getAllowedContentTypes(); + this._editDownloadDisabled = false; + } + + get contentTypesInfo() { + return this.$t('ContentTypesInfo', { + allowedContentTypes: this.allowedContentTypes + }); + } + + get editDownloadDisabled() { + return this._editDownloadDisabled; + } + + async checkFileExists(dmsId) { + if (!dmsId) return; + let filter = { + fields: ['id'] + }; + await this.$http.get(`Dms/${dmsId}`, {filter}) + .then(() => this._editDownloadDisabled = false) + .catch(() => this._editDownloadDisabled = true); + } + + async getFile(dmsId) { + const path = `Dms/${dmsId}`; + await this.$http.get(path).then(res => { + const dms = res.data && res.data; + this.dms = { + dmsId: dms.id, + reference: dms.reference, + warehouseId: dms.warehouseFk, + companyId: dms.companyFk, + dmsTypeId: dms.dmsTypeFk, + description: dms.description, + hasFile: dms.hasFile, + hasFileAttached: false, + files: [] + }; + }); + } + + getAllowedContentTypes() { + this.$http.get('DmsContainers/allowedContentTypes').then(res => { + if (res.data.length > 0) { + const contentTypes = res.data.join(', '); + this.allowedContentTypes = contentTypes; + } + }); + } + + openEditDialog(dmsId) { + this.getFile(dmsId).then(() => this.$.dmsEditDialog.show()); + } + + openCreateDialog() { + this.dms = { + reference: null, + warehouseId: null, + companyId: null, + dmsTypeId: null, + description: null, + hasFile: true, + hasFileAttached: true, + files: null + }; + this.$.dmsCreateDialog.show(); + } + + downloadFile(dmsId) { + this.vnFile.download(`api/dms/${dmsId}/downloadFile`); + } + + onFileChange(files) { + let hasFileAttached = false; + if (files.length > 0) + hasFileAttached = true; + + this.$.$applyAsync(() => { + this.dms.hasFileAttached = hasFileAttached; + }); + } + + onEdit() { + if (!this.dms.companyId) + throw new UserError(`The company can't be empty`); + if (!this.dms.warehouseId) + throw new UserError(`The warehouse can't be empty`); + if (!this.dms.dmsTypeId) + throw new UserError(`The DMS Type can't be empty`); + if (!this.dms.description) + throw new UserError(`The description can't be empty`); + + const query = `dms/${this.dms.dmsId}/updateFile`; + const options = { + method: 'POST', + url: query, + params: this.dms, + headers: { + 'Content-Type': undefined + }, + transformRequest: files => { + const formData = new FormData(); + + for (let i = 0; i < files.length; i++) + formData.append(files[i].name, files[i]); + + return formData; + }, + data: this.dms.files + }; + + this.$http(options).then(res => { + if (res) { + this.vnApp.showSuccess(this.$t('Data saved!')); + if (res.data.length > 0) this.invoiceIn.dmsFk = res.data[0].id; + } + }); + } + + onCreate() { + if (!this.dms.companyId) + throw new UserError(`The company can't be empty`); + if (!this.dms.warehouseId) + throw new UserError(`The warehouse can't be empty`); + if (!this.dms.dmsTypeId) + throw new UserError(`The DMS Type can't be empty`); + if (!this.dms.description) + throw new UserError(`The description can't be empty`); + if (!this.dms.files) + throw new UserError(`The files can't be empty`); + + const query = `Dms/uploadFile`; + const options = { + method: 'POST', + url: query, + params: this.dms, + headers: { + 'Content-Type': undefined + }, + transformRequest: files => { + const formData = new FormData(); + + for (let i = 0; i < files.length; i++) + formData.append(files[i].name, files[i]); + + return formData; + }, + data: this.dms.files + }; + + this.$http(options).then(res => { + if (res) { + this.vnApp.showSuccess(this.$t('Data saved!')); + if (res.data.length > 0) this.invoiceIn.dmsFk = res.data[0].id; + } + }); + } +} + +Controller.$inject = ['$element', '$scope', 'vnFile']; ngModule.vnComponent('vnInvoiceInBasicData', { template: require('./index.html'), - controller: Section, + controller: Controller, bindings: { invoiceIn: '<' } diff --git a/modules/invoiceIn/front/basic-data/index.spec.js b/modules/invoiceIn/front/basic-data/index.spec.js new file mode 100644 index 000000000..98710ac35 --- /dev/null +++ b/modules/invoiceIn/front/basic-data/index.spec.js @@ -0,0 +1,102 @@ +import './index.js'; +import watcher from 'core/mocks/watcher'; + +describe('InvoiceIn', () => { + describe('Component vnInvoiceInBasicData', () => { + let controller; + let $scope; + let $httpBackend; + let $httpParamSerializer; + + beforeEach(ngModule('invoiceIn')); + + beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + $scope = $rootScope.$new(); + $httpBackend = _$httpBackend_; + $httpParamSerializer = _$httpParamSerializer_; + const $element = angular.element(''); + controller = $componentController('vnInvoiceInBasicData', {$element, $scope}); + controller.$.watcher = watcher; + $httpBackend.expect('GET', `DmsContainers/allowedContentTypes`).respond({}); + })); + + describe('onFileChange()', () => { + it('should set dms hasFileAttached property to true if has any files', () => { + const files = [{id: 1, name: 'MyFile'}]; + controller.onFileChange(files); + + $scope.$apply(); + + expect(controller.dms.hasFileAttached).toBeTruthy(); + }); + }); + + describe('checkFileExists()', () => { + it(`should return false if a file exists`, () => { + const fileIdExists = 1; + controller.checkFileExists(fileIdExists); + + expect(controller.editDownloadDisabled).toBe(false); + }); + }); + + describe('onEdit()', () => { + it(`should perform a POST query to edit the dms properties`, () => { + jest.spyOn(controller.vnApp, 'showSuccess'); + + const dms = { + dmsId: 1, + reference: 'Ref1', + warehouseId: 1, + companyId: 442, + dmsTypeId: 20, + description: 'This is a description', + files: [] + }; + + controller.dms = dms; + const serializedParams = $httpParamSerializer(controller.dms); + const query = `dms/${controller.dms.dmsId}/updateFile?${serializedParams}`; + + $httpBackend.expectPOST(query).respond({}); + controller.onEdit(); + $httpBackend.flush(); + + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); + }); + }); + + describe('onCreate()', () => { + it(`should perform a POST query to create a new dms`, () => { + jest.spyOn(controller.vnApp, 'showSuccess'); + + const dms = { + reference: 'Ref1', + warehouseId: 1, + companyId: 442, + dmsTypeId: 20, + description: 'This is a description', + files: [{ + lastModified: 1668673957761, + lastModifiedDate: Date.vnNew(), + name: 'file-example.png', + size: 19653, + type: 'image/png', + webkitRelativePath: '' + }] + }; + + controller.dms = dms; + const serializedParams = $httpParamSerializer(controller.dms); + const query = `Dms/uploadFile?${serializedParams}`; + + $httpBackend.expectPOST(query).respond({}); + controller.onCreate(); + $httpBackend.flush(); + + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); + }); + }); + }); +}); + diff --git a/modules/invoiceIn/front/basic-data/locale/en.yml b/modules/invoiceIn/front/basic-data/locale/en.yml new file mode 100644 index 000000000..19f4dc8c2 --- /dev/null +++ b/modules/invoiceIn/front/basic-data/locale/en.yml @@ -0,0 +1 @@ +ContentTypesInfo: Allowed file types {{allowedContentTypes}} diff --git a/modules/invoiceIn/front/basic-data/locale/es.yml b/modules/invoiceIn/front/basic-data/locale/es.yml new file mode 100644 index 000000000..e2e494fa5 --- /dev/null +++ b/modules/invoiceIn/front/basic-data/locale/es.yml @@ -0,0 +1,15 @@ +Upload file: Subir fichero +Edit file: Editar fichero +Upload: Subir +Document: Documento +ContentTypesInfo: "Tipos de archivo permitidos: {{allowedContentTypes}}" +Generate identifier for original file: Generar identificador para archivo original +File management: Gestión documental +Hard copy: Copia +This file will be deleted: Este fichero va a ser borrado +Are you sure?: Estas seguro? +File deleted: Fichero eliminado +Remove file: Eliminar fichero +Download file: Descargar fichero +Edit document: Editar documento +Create document: Crear documento diff --git a/modules/invoiceIn/front/card/index.js b/modules/invoiceIn/front/card/index.js index 582c2abb8..48217faa5 100644 --- a/modules/invoiceIn/front/card/index.js +++ b/modules/invoiceIn/front/card/index.js @@ -6,7 +6,17 @@ class Controller extends ModuleCard { const filter = { include: [ { - relation: 'supplier' + relation: 'supplier', + scope: { + include: { + relation: 'contacts', + scope: { + where: { + email: {neq: null}, + } + } + } + } }, { relation: 'invoiceInDueDay' diff --git a/modules/invoiceIn/front/descriptor/index.html b/modules/invoiceIn/front/descriptor/index.html index 33f9ee8c6..c4330fbf0 100644 --- a/modules/invoiceIn/front/descriptor/index.html +++ b/modules/invoiceIn/front/descriptor/index.html @@ -1,5 +1,12 @@ - + + @@ -10,7 +17,6 @@ translate> To book - Clone Invoice + + Show agricultural receipt as PDF + + + Send agricultural receipt as PDF +
@@ -37,7 +55,7 @@ - {{$ctrl.invoiceIn.supplier.nickname}} + {{$ctrl.invoiceIn.supplier.nickname}}
@@ -57,9 +75,9 @@ icon="icon-invoice-in"> - + - +
- - \ No newline at end of file + + + + + + Are you sure you want to send it? + + + + + + + + diff --git a/modules/invoiceIn/front/descriptor/index.js b/modules/invoiceIn/front/descriptor/index.js index cde324296..e005211a3 100644 --- a/modules/invoiceIn/front/descriptor/index.js +++ b/modules/invoiceIn/front/descriptor/index.js @@ -75,7 +75,7 @@ class Controller extends Descriptor { filter: { where: { invoiceInFk: id, - dueDated: {gte: new Date()} + dueDated: {gte: Date.vnNew()} } }}) .then(res => { @@ -96,6 +96,24 @@ class Controller extends Descriptor { .then(() => this.$state.reload()) .then(() => this.vnApp.showSuccess(this.$t('InvoiceIn booked'))); } + + showPdfInvoice() { + this.vnReport.show(`InvoiceIns/${this.id}/invoice-in-pdf`); + } + + sendPdfInvoice($data) { + if (!$data.email) + return this.vnApp.showError(this.$t(`The email can't be empty`)); + + return this.vnEmail.send(`InvoiceIns/${this.entity.id}/invoice-in-email`, { + recipient: $data.email, + recipientId: this.entity.supplier.id + }); + } + + isAgricultural() { + return this.invoiceIn.supplier.sageWithholdingFk == this.config[0].sageWithholdingFk; + } } ngModule.vnComponent('vnInvoiceInDescriptor', { diff --git a/modules/invoiceIn/front/dueDay/index.js b/modules/invoiceIn/front/dueDay/index.js index 3cc1c81e8..ee9b13e5c 100644 --- a/modules/invoiceIn/front/dueDay/index.js +++ b/modules/invoiceIn/front/dueDay/index.js @@ -4,7 +4,7 @@ import Section from 'salix/components/section'; class Controller extends Section { add() { this.$.model.insert({ - dueDated: new Date(), + dueDated: Date.vnNew(), bankFk: this.vnConfig.local.bankFk }); } diff --git a/modules/invoiceIn/front/index.js b/modules/invoiceIn/front/index.js index 7b6d6a77c..e257cfee3 100644 --- a/modules/invoiceIn/front/index.js +++ b/modules/invoiceIn/front/index.js @@ -13,3 +13,5 @@ import './dueDay'; import './intrastat'; import './create'; import './log'; +import './serial'; +import './serial-search-panel'; diff --git a/modules/invoiceIn/front/intrastat/index.html b/modules/invoiceIn/front/intrastat/index.html index cb447132d..fc0139303 100644 --- a/modules/invoiceIn/front/intrastat/index.html +++ b/modules/invoiceIn/front/intrastat/index.html @@ -47,7 +47,7 @@ show-field="description" rule vn-focus> - {{id | zeroFill:8}}: {{description}} + {{id}}: {{description}} + + + + + + + + +
+ + {{$ctrl.$t('Serial')}}: {{$ctrl.filter.serial}} + +
+ diff --git a/modules/invoiceIn/front/serial-search-panel/index.js b/modules/invoiceIn/front/serial-search-panel/index.js new file mode 100644 index 000000000..b11911ee3 --- /dev/null +++ b/modules/invoiceIn/front/serial-search-panel/index.js @@ -0,0 +1,44 @@ +import ngModule from '../module'; +import SearchPanel from 'core/components/searchbar/search-panel'; +import './style.scss'; + +class Controller extends SearchPanel { + constructor($element, $) { + super($element, $); + this.filter = {}; + const filter = { + fields: ['daysAgo'] + }; + this.$http.get('InvoiceInConfigs', {filter}).then(res => { + if (res.data) { + this.invoiceInConfig = res.data[0]; + this.addFilters(); + } + }); + } + + removeItemFilter(param) { + this.filter[param] = null; + this.addFilters(); + } + + onKeyPress($event) { + if ($event.key === 'Enter') + this.addFilters(); + } + + addFilters() { + if (!this.filter.daysAgo) + this.filter.daysAgo = this.invoiceInConfig.daysAgo; + + return this.model.addFilter({}, this.filter); + } +} + +ngModule.component('vnInvoiceInSerialSearchPanel', { + template: require('./index.html'), + controller: Controller, + bindings: { + model: '<' + } +}); diff --git a/modules/invoiceIn/front/serial-search-panel/index.spec.js b/modules/invoiceIn/front/serial-search-panel/index.spec.js new file mode 100644 index 000000000..b5228e126 --- /dev/null +++ b/modules/invoiceIn/front/serial-search-panel/index.spec.js @@ -0,0 +1,43 @@ +import './index.js'; + +describe('InvoiceIn', () => { + describe('Component serial-search-panel', () => { + let controller; + let $scope; + + beforeEach(ngModule('invoiceIn')); + + beforeEach(inject(($componentController, $rootScope) => { + $scope = $rootScope.$new(); + const $element = angular.element(''); + controller = $componentController('vnInvoiceInSerialSearchPanel', {$element, $scope}); + controller.model = { + addFilter: jest.fn(), + }; + controller.invoiceInConfig = { + daysAgo: 45, + }; + })); + + describe('addFilters()', () => { + it('should add default daysAgo if it is not already set', () => { + controller.filter = { + serial: 'R', + }; + controller.addFilters(); + + expect(controller.filter.daysAgo).toEqual(controller.invoiceInConfig.daysAgo); + }); + + it('should not add default daysAgo if it is already set', () => { + controller.filter = { + daysAgo: 1, + serial: 'R', + }; + controller.addFilters(); + + expect(controller.filter.daysAgo).toEqual(1); + }); + }); + }); +}); diff --git a/modules/invoiceIn/front/serial-search-panel/style.scss b/modules/invoiceIn/front/serial-search-panel/style.scss new file mode 100644 index 000000000..4abfcbfa2 --- /dev/null +++ b/modules/invoiceIn/front/serial-search-panel/style.scss @@ -0,0 +1,24 @@ +@import "variables"; + +vn-invoice-in-serial-search-panel vn-side-menu div { + & > .input { + padding-left: $spacing-md; + padding-right: $spacing-md; + border-color: $color-spacer; + border-bottom: $border-thin; + } + & > .horizontal { + grid-auto-flow: column; + grid-column-gap: $spacing-sm; + align-items: center; + } + & > .chips { + display: flex; + flex-wrap: wrap; + padding: $spacing-md; + overflow: hidden; + max-width: 100%; + border-color: $color-spacer; + border-top: $border-thin; + } +} diff --git a/modules/invoiceIn/front/serial/index.html b/modules/invoiceIn/front/serial/index.html new file mode 100644 index 000000000..1649ec7d7 --- /dev/null +++ b/modules/invoiceIn/front/serial/index.html @@ -0,0 +1,40 @@ + + + + + + + + + + + + Serial + Pending + Total + + + + + + {{::invoiceIn.serial}} + {{::invoiceIn.pending}} + {{::invoiceIn.total}} + + + + + + + + + diff --git a/modules/invoiceIn/front/serial/index.js b/modules/invoiceIn/front/serial/index.js new file mode 100644 index 000000000..193a57492 --- /dev/null +++ b/modules/invoiceIn/front/serial/index.js @@ -0,0 +1,22 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section { + constructor($element, $) { + super($element, $); + } + + goToIndex(daysAgo, serial) { + const issued = Date.vnNew(); + issued.setDate(issued.getDate() - daysAgo); + this.$state.go('invoiceIn.index', + {q: `{"serial": "${serial}", "isBooked": false, "from": ${issued.getTime()}}`}); + } +} + +Controller.$inject = ['$element', '$scope']; + +ngModule.vnComponent('vnInvoiceInSerial', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/invoiceIn/front/serial/locale/es.yml b/modules/invoiceIn/front/serial/locale/es.yml new file mode 100644 index 000000000..92a49cc82 --- /dev/null +++ b/modules/invoiceIn/front/serial/locale/es.yml @@ -0,0 +1,3 @@ +Serial: Serie +Pending: Pendientes +Go to InvoiceIn: Ir al listado de facturas recibidas diff --git a/modules/invoiceIn/front/summary/index.html b/modules/invoiceIn/front/summary/index.html index 3a826eeb7..f0baa33c8 100644 --- a/modules/invoiceIn/front/summary/index.html +++ b/modules/invoiceIn/front/summary/index.html @@ -141,7 +141,7 @@ - {{::intrastat.intrastatFk | zeroFill:8}}: {{::intrastat.intrastat.description}} + {{::intrastat.intrastatFk}}: {{::intrastat.intrastat.description}} {{::intrastat.amount | currency: 'EUR':2}} {{::intrastat.net}} {{::intrastat.stems}} diff --git a/modules/invoiceIn/front/tax/index.spec.js b/modules/invoiceIn/front/tax/index.spec.js index c62ada9ca..52114afe5 100644 --- a/modules/invoiceIn/front/tax/index.spec.js +++ b/modules/invoiceIn/front/tax/index.spec.js @@ -1,7 +1,6 @@ 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', () => { diff --git a/modules/invoiceOut/back/methods/invoiceOut/clientsToInvoice.js b/modules/invoiceOut/back/methods/invoiceOut/clientsToInvoice.js new file mode 100644 index 000000000..f18b0c682 --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/clientsToInvoice.js @@ -0,0 +1,97 @@ +module.exports = Self => { + Self.remoteMethodCtx('clientsToInvoice', { + description: 'Get the clients to make global invoicing', + accessType: 'WRITE', + accepts: [ + { + arg: 'clientId', + type: 'number', + description: 'The client id' + }, { + arg: 'invoiceDate', + type: 'date', + description: 'The invoice date', + required: true + }, { + arg: 'maxShipped', + type: 'date', + description: 'The maximum shipped date', + required: true + }, { + arg: 'companyFk', + type: 'number', + description: 'The company id to invoice', + required: true + }, + ], + returns: { + type: 'Object', + root: true + }, + http: { + path: '/clientsToInvoice', + verb: 'POST' + } + }); + + Self.clientsToInvoice = async(ctx, clientId, invoiceDate, maxShipped, companyFk, options) => { + let tx; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + // Packaging liquidation + const vIsAllInvoiceable = false; + await Self.rawSql('CALL ticketPackaging_add(?, ?, ?, ?)', [ + clientId, + invoiceDate, + companyFk, + vIsAllInvoiceable + ], myOptions); + + const minShipped = Date.vnNew(); + minShipped.setFullYear(maxShipped.getFullYear() - 1); + + const query = ` + SELECT c.id clientId, + c.name clientName, + a.id, + a.nickname + FROM ticket t + JOIN address a ON a.id = t.addressFk + JOIN client c ON c.id = t.clientFk + WHERE t.refFk IS NULL + AND t.shipped BETWEEN ? AND util.dayEnd(?) + AND (t.clientFk = ? OR ? IS NULL ) + AND t.companyFk = ? + AND c.hasToInvoice + AND c.isTaxDataChecked + AND c.isActive + AND NOT t.isDeleted + GROUP BY c.id, IF(c.hasToInvoiceByAddress, a.id, TRUE) + HAVING SUM(t.totalWithVat) > 0;`; + + const addresses = await Self.rawSql(query, [ + minShipped, + maxShipped, + clientId, + clientId, + companyFk + ], myOptions); + + if (tx) await tx.commit(); + + return addresses; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/invoiceOut/back/methods/invoiceOut/createManualInvoice.js b/modules/invoiceOut/back/methods/invoiceOut/createManualInvoice.js index 297afa8e8..a458aa18e 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/createManualInvoice.js +++ b/modules/invoiceOut/back/methods/invoiceOut/createManualInvoice.js @@ -108,14 +108,14 @@ module.exports = Self => { throw new UserError(`This client is not invoiceable`); // Can't invoice tickets into future - const tomorrow = new Date(); + const tomorrow = Date.vnNew(); tomorrow.setDate(tomorrow.getDate() + 1); if (maxShipped >= tomorrow) throw new UserError(`Can't invoice to future`); const maxInvoiceDate = await getMaxIssued(args.serial, companyId, myOptions); - if (new Date() < maxInvoiceDate) + if (Date.vnNew() < maxInvoiceDate) throw new UserError(`Can't invoice to past`); if (ticketId) { @@ -155,7 +155,7 @@ module.exports = Self => { async function isInvoiceable(clientId, options) { const models = Self.app.models; const query = `SELECT (hasToInvoice AND isTaxDataChecked) AS invoiceable - FROM client + FROM client WHERE id = ?`; const [result] = await models.InvoiceOut.rawSql(query, [clientId], options); @@ -172,12 +172,12 @@ module.exports = Self => { async function getMaxIssued(serial, companyId, options) { const models = Self.app.models; - const query = `SELECT MAX(issued) AS issued - FROM invoiceOut + const query = `SELECT MAX(issued) AS issued + FROM invoiceOut WHERE serial = ? AND companyFk = ?`; const [maxIssued] = await models.InvoiceOut.rawSql(query, [serial, companyId], options); - const maxInvoiceDate = maxIssued && maxIssued.issued || new Date(); + const maxInvoiceDate = maxIssued && maxIssued.issued || Date.vnNew(); return maxInvoiceDate; } diff --git a/modules/invoiceOut/back/methods/invoiceOut/createPdf.js b/modules/invoiceOut/back/methods/invoiceOut/createPdf.js index 116e8b3fc..e56516237 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/createPdf.js +++ b/modules/invoiceOut/back/methods/invoiceOut/createPdf.js @@ -1,7 +1,5 @@ const UserError = require('vn-loopback/util/user-error'); -const fs = require('fs-extra'); -const path = require('path'); -const axios = require('axios'); +const print = require('vn-print'); module.exports = Self => { Self.remoteMethodCtx('createPdf', { @@ -27,9 +25,7 @@ module.exports = Self => { Self.createPdf = async function(ctx, id, options) { const models = Self.app.models; - const headers = ctx.req.headers; - const origin = headers.origin; - const auth = ctx.req.accessToken; + const userId = ctx.req.accessToken.userId; if (process.env.NODE_ENV == 'test') throw new UserError(`Action not allowed on the test environment`); @@ -45,10 +41,9 @@ module.exports = Self => { myOptions.transaction = tx; } - let fileSrc; try { const invoiceOut = await Self.findById(id, null, myOptions); - const hasInvoicing = await models.Account.hasRole(auth.userId, 'invoicing', myOptions); + const hasInvoicing = await models.Account.hasRole(userId, 'invoicing', myOptions); if (invoiceOut.hasPdf && !hasInvoicing) throw new UserError(`You don't have enough privileges`); @@ -57,35 +52,27 @@ module.exports = Self => { hasPdf: true }, myOptions); - return axios.get(`${origin}/api/report/invoice`, { - responseType: 'stream', - params: { - authorization: auth.id, - invoiceId: id - } - }).then(async response => { - const issued = invoiceOut.issued; - const year = issued.getFullYear().toString(); - const month = (issued.getMonth() + 1).toString(); - const day = issued.getDate().toString(); - - const container = await models.InvoiceContainer.container(year); - const rootPath = container.client.root; - const fileName = `${year}${invoiceOut.ref}.pdf`; - const src = path.join(rootPath, year, month, day); - fileSrc = path.join(src, fileName); - - await fs.mkdir(src, {recursive: true}); - - if (tx) await tx.commit(); - - response.data.pipe(fs.createWriteStream(fileSrc)); - }).catch(async e => { - if (fs.existsSync(fileSrc)) - await fs.unlink(fileSrc); - - throw e; + const invoiceReport = new print.Report('invoice', { + reference: invoiceOut.ref, + recipientId: invoiceOut.clientFk }); + const stream = await invoiceReport.toPdfStream(); + + const issued = invoiceOut.issued; + const year = issued.getFullYear().toString(); + const month = (issued.getMonth() + 1).toString(); + const day = issued.getDate().toString(); + + const fileName = `${year}${invoiceOut.ref}.pdf`; + + // Store invoice + print.storage.write(stream, { + type: 'invoice', + path: `${year}/${month}/${day}`, + fileName: fileName + }); + + if (tx) await tx.commit(); } catch (e) { if (tx) await tx.rollback(); throw e; diff --git a/modules/invoiceOut/back/methods/invoiceOut/download.js b/modules/invoiceOut/back/methods/invoiceOut/download.js index f1138dd51..5c787428b 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/download.js +++ b/modules/invoiceOut/back/methods/invoiceOut/download.js @@ -9,7 +9,7 @@ module.exports = Self => { accepts: [ { arg: 'id', - type: 'String', + type: 'string', description: 'The invoice id', http: {source: 'path'} } @@ -21,16 +21,16 @@ module.exports = Self => { root: true }, { arg: 'Content-Type', - type: 'String', + type: 'string', http: {target: 'header'} }, { arg: 'Content-Disposition', - type: 'String', + type: 'string', http: {target: 'header'} } ], http: { - path: `/:id/download`, + path: '/:id/download', verb: 'GET' } }); @@ -62,8 +62,14 @@ module.exports = Self => { name: fileName }; - await fs.access(file.path); - let stream = fs.createReadStream(file.path); + try { + await fs.access(file.path); + } catch (error) { + await Self.createPdf(ctx, id, myOptions); + } + + const stream = fs.createReadStream(file.path); + return [stream, file.contentType, `filename="${file.name}"`]; } catch (error) { if (error.code === 'ENOENT') diff --git a/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js b/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js new file mode 100644 index 000000000..fe005f1ab --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js @@ -0,0 +1,69 @@ +const JSZip = require('jszip'); +const fs = require('fs-extra'); +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('downloadZip', { + description: 'Download a zip file with multiple invoices pdfs', + accessType: 'READ', + accepts: [ + { + arg: 'ids', + type: 'string', + description: 'The invoices ids', + } + ], + 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: '/downloadZip', + verb: 'GET' + } + }); + + Self.downloadZip = async function(ctx, ids, options) { + const models = Self.app.models; + const myOptions = {}; + const zip = new JSZip(); + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const zipConfig = await models.ZipConfig.findOne(null, myOptions); + let totalSize = 0; + ids = ids.split(','); + + for (let id of ids) { + if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large'); + const invoiceOutPdf = await models.InvoiceOut.download(ctx, id, myOptions); + const fileName = extractFileName(invoiceOutPdf[2]); + const body = invoiceOutPdf[0]; + const sizeInBytes = (await fs.promises.stat(body.path)).size; + const sizeInMegabytes = sizeInBytes / (1024 * 1024); + totalSize += sizeInMegabytes; + zip.file(fileName, body); + } + + const stream = zip.generateNodeStream({streamFiles: true}); + + return [stream, 'application/zip', `filename="download.zip"`]; + }; + + function extractFileName(str) { + const matches = str.match(/"(.*?)"/); + return matches ? matches[1] : str; + } +}; diff --git a/modules/invoiceOut/back/methods/invoiceOut/exportationPdf.js b/modules/invoiceOut/back/methods/invoiceOut/exportationPdf.js new file mode 100644 index 000000000..7a2526b35 --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/exportationPdf.js @@ -0,0 +1,41 @@ +module.exports = Self => { + Self.remoteMethodCtx('exportationPdf', { + description: 'Returns the exportation pdf', + accessType: 'READ', + accepts: [ + { + arg: 'reference', + type: 'string', + required: true, + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + } + ], + 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: '/:reference/exportation-pdf', + verb: 'GET' + } + }); + + Self.exportationPdf = (ctx, reference) => Self.printReport(ctx, reference, 'exportation'); +}; diff --git a/modules/invoiceOut/back/methods/invoiceOut/getInvoiceDate.js b/modules/invoiceOut/back/methods/invoiceOut/getInvoiceDate.js new file mode 100644 index 000000000..dcc1fa6e8 --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/getInvoiceDate.js @@ -0,0 +1,35 @@ +module.exports = Self => { + Self.remoteMethod('getInvoiceDate', { + description: 'Returns default Invoice Date', + accessType: 'READ', + accepts: [ + { + arg: 'companyFk', + type: 'number', + required: true + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/getInvoiceDate`, + verb: 'GET' + } + }); + + Self.getInvoiceDate = async companyFk => { + const models = Self.app.models; + const [invoiceDate] = await models.InvoiceOut.rawSql( + `SELECT MAX(io.issued) issued + FROM invoiceOut io + JOIN invoiceOutSerial ios ON ios.code = io.serial + WHERE ios.type = 'global' + AND io.issued + AND io.companyFk = ?`, + [companyFk] + ); + return invoiceDate; + }; +}; diff --git a/modules/invoiceOut/back/methods/invoiceOut/globalInvoicing.js b/modules/invoiceOut/back/methods/invoiceOut/globalInvoicing.js deleted file mode 100644 index 7f2cbb442..000000000 --- a/modules/invoiceOut/back/methods/invoiceOut/globalInvoicing.js +++ /dev/null @@ -1,266 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('globalInvoicing', { - description: 'Make a global invoice', - accessType: 'WRITE', - accepts: [ - { - arg: 'invoiceDate', - type: 'date', - description: 'The invoice date' - }, - { - arg: 'maxShipped', - type: 'date', - description: 'The maximum shipped date' - }, - { - arg: 'fromClientId', - type: 'number', - description: 'The minimum client id' - }, - { - arg: 'toClientId', - type: 'number', - description: 'The maximum client id' - }, - { - arg: 'companyFk', - type: 'number', - description: 'The company id to invoice' - } - ], - returns: { - type: 'object', - root: true - }, - http: { - path: '/globalInvoicing', - verb: 'POST' - } - }); - - Self.globalInvoicing = async(ctx, options) => { - const args = ctx.args; - - let tx; - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } - - const invoicesIds = []; - const failedClients = []; - let query; - try { - query = ` - SELECT MAX(issued) issued - FROM vn.invoiceOut io - JOIN vn.time t ON t.dated = io.issued - WHERE io.serial = 'A' - AND t.year = YEAR(?) - AND io.companyFk = ?`; - const [maxIssued] = await Self.rawSql(query, [ - args.invoiceDate, - args.companyFk - ], myOptions); - - const maxSerialDate = maxIssued.issued || args.invoiceDate; - if (args.invoiceDate < maxSerialDate) - args.invoiceDate = maxSerialDate; - - if (args.invoiceDate < args.maxShipped) - args.maxShipped = args.invoiceDate; - - const minShipped = new Date(); - minShipped.setFullYear(minShipped.getFullYear() - 1); - - // Packaging liquidation - const vIsAllInvoiceable = false; - const clientsWithPackaging = await getClientsWithPackaging(ctx, myOptions); - for (let client of clientsWithPackaging) { - await Self.rawSql('CALL packageInvoicing(?, ?, ?, ?, @newTicket)', [ - client.id, - args.invoiceDate, - args.companyFk, - vIsAllInvoiceable - ], myOptions); - } - - const invoiceableClients = await getInvoiceableClients(ctx, myOptions); - - if (!invoiceableClients.length) return; - - for (let client of invoiceableClients) { - try { - if (client.hasToInvoiceByAddress) { - await Self.rawSql('CALL ticketToInvoiceByAddress(?, ?, ?, ?)', [ - minShipped, - args.maxShipped, - client.addressFk, - args.companyFk - ], myOptions); - } else { - await Self.rawSql('CALL invoiceFromClient(?, ?, ?)', [ - args.maxShipped, - client.id, - args.companyFk - ], myOptions); - } - - // Make invoice - const isSpanishCompany = await getIsSpanishCompany(args.companyFk, myOptions); - - // Validates ticket nagative base - const hasAnyNegativeBase = await getNegativeBase(myOptions); - if (hasAnyNegativeBase && isSpanishCompany) - continue; - - query = `SELECT invoiceSerial(?, ?, ?) AS serial`; - const [invoiceSerial] = await Self.rawSql(query, [ - client.id, - args.companyFk, - 'G' - ], myOptions); - const serialLetter = invoiceSerial.serial; - - query = `CALL invoiceOut_new(?, ?, NULL, @invoiceId)`; - await Self.rawSql(query, [ - serialLetter, - args.invoiceDate - ], myOptions); - - const [newInvoice] = await Self.rawSql(`SELECT @invoiceId id`, null, myOptions); - if (newInvoice.id) { - await Self.rawSql('CALL invoiceOutBooking(?)', [newInvoice.id], myOptions); - - query = `INSERT IGNORE INTO invoiceOut_queue(invoiceFk) VALUES(?)`; - await Self.rawSql(query, [newInvoice.id], myOptions); - - invoicesIds.push(newInvoice.id); - } - } catch (e) { - failedClients.push({ - id: client.id, - stacktrace: e - }); - continue; - } - } - - if (failedClients.length > 0) - await notifyFailures(ctx, failedClients, myOptions); - - if (tx) await tx.commit(); - } catch (e) { - if (tx) await tx.rollback(); - throw e; - } - - return invoicesIds; - }; - - async function getNegativeBase(options) { - const models = Self.app.models; - const query = 'SELECT hasAnyNegativeBase() AS base'; - const [result] = await models.InvoiceOut.rawSql(query, null, options); - - return result && result.base; - } - - async function getIsSpanishCompany(companyId, options) { - const models = Self.app.models; - const query = `SELECT COUNT(*) AS total - FROM supplier s - JOIN country c ON c.id = s.countryFk - AND c.code = 'ES' - WHERE s.id = ?`; - const [supplierCompany] = await models.InvoiceOut.rawSql(query, [ - companyId - ], options); - - return supplierCompany && supplierCompany.total; - } - - async function getClientsWithPackaging(ctx, options) { - const models = Self.app.models; - const args = ctx.args; - const query = `SELECT DISTINCT clientFk AS id - FROM ticket t - JOIN ticketPackaging tp ON t.id = tp.ticketFk - WHERE t.shipped BETWEEN '2017-11-21' AND ? - AND t.clientFk BETWEEN ? AND ?`; - return models.InvoiceOut.rawSql(query, [ - args.maxShipped, - args.fromClientId, - args.toClientId - ], options); - } - - async function getInvoiceableClients(ctx, options) { - const models = Self.app.models; - const args = ctx.args; - const minShipped = new Date(); - minShipped.setFullYear(minShipped.getFullYear() - 1); - - const query = `SELECT - c.id, - SUM(IFNULL - ( - s.quantity * - s.price * (100-s.discount)/100, - 0) - + IFNULL(ts.quantity * ts.price,0) - ) AS sumAmount, - c.hasToInvoiceByAddress, - c.email, - c.isToBeMailed, - a.id addressFk - FROM ticket t - LEFT JOIN sale s ON s.ticketFk = t.id - LEFT JOIN ticketService ts ON ts.ticketFk = t.id - JOIN address a ON a.id = t.addressFk - JOIN client c ON c.id = t.clientFk - WHERE ISNULL(t.refFk) AND c.id BETWEEN ? AND ? - AND t.shipped BETWEEN ? AND util.dayEnd(?) - AND t.companyFk = ? AND c.hasToInvoice - AND c.isTaxDataChecked - GROUP BY c.id, IF(c.hasToInvoiceByAddress,a.id,TRUE) HAVING sumAmount > 0`; - - return models.InvoiceOut.rawSql(query, [ - args.fromClientId, - args.toClientId, - minShipped, - args.maxShipped, - args.companyFk - ], options); - } - - async function notifyFailures(ctx, failedClients, options) { - const models = Self.app.models; - const userId = ctx.req.accessToken.userId; - const $t = ctx.req.__; // $translate - - const worker = await models.EmailUser.findById(userId, null, options); - const subject = $t('Global invoicing failed'); - let body = $t(`Wasn't able to invoice the following clients`) + ':

'; - - for (client of failedClients) { - body += `ID: ${client.id} -
${client.stacktrace}

`; - } - - await Self.rawSql(` - INSERT INTO vn.mail (sender, replyTo, sent, subject, body) - VALUES (?, ?, FALSE, ?, ?)`, [ - worker.email, - worker.email, - subject, - body - ], options); - } -}; diff --git a/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js b/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js new file mode 100644 index 000000000..c8f8a6778 --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js @@ -0,0 +1,173 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('invoiceClient', { + description: 'Make a invoice of a client', + accessType: 'WRITE', + accepts: [ + { + arg: 'clientId', + type: 'number', + description: 'The client id to invoice', + required: true + }, { + arg: 'addressId', + type: 'number', + description: 'The address id to invoice', + required: true + }, { + arg: 'invoiceDate', + type: 'date', + description: 'The invoice date', + required: true + }, { + arg: 'maxShipped', + type: 'date', + description: 'The maximum shipped date', + required: true + }, { + arg: 'companyFk', + type: 'number', + description: 'The company id to invoice', + required: true + }, { + arg: 'printerFk', + type: 'number', + description: 'The printer to print', + required: true + } + ], + returns: { + type: 'object', + root: true + }, + http: { + path: '/invoiceClient', + verb: 'POST' + } + }); + + Self.invoiceClient = async(ctx, options) => { + const args = ctx.args; + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + const minShipped = Date.vnNew(); + minShipped.setFullYear(args.maxShipped.getFullYear() - 1); + + let invoiceId; + let invoiceOut; + try { + const client = await models.Client.findById(args.clientId, { + fields: ['id', 'hasToInvoiceByAddress'] + }, myOptions); + + if (client.hasToInvoiceByAddress) { + await Self.rawSql('CALL ticketToInvoiceByAddress(?, ?, ?, ?)', [ + minShipped, + args.maxShipped, + args.addressId, + args.companyFk + ], myOptions); + } else { + await Self.rawSql('CALL invoiceFromClient(?, ?, ?)', [ + args.maxShipped, + client.id, + args.companyFk + ], myOptions); + } + + // Make invoice + const isSpanishCompany = await getIsSpanishCompany(args.companyFk, myOptions); + + // Validates ticket nagative base + const hasAnyNegativeBase = await getNegativeBase(myOptions); + if (hasAnyNegativeBase && isSpanishCompany) + throw new UserError('Negative basis'); + + query = `SELECT invoiceSerial(?, ?, ?) AS serial`; + const [invoiceSerial] = await Self.rawSql(query, [ + client.id, + args.companyFk, + 'G' + ], myOptions); + const serialLetter = invoiceSerial.serial; + + query = `CALL invoiceOut_new(?, ?, NULL, @invoiceId)`; + await Self.rawSql(query, [ + serialLetter, + args.invoiceDate + ], myOptions); + + const [newInvoice] = await Self.rawSql(`SELECT @invoiceId id`, null, myOptions); + if (newInvoice.id) { + await Self.rawSql('CALL invoiceOutBooking(?)', [newInvoice.id], myOptions); + + invoiceOut = await models.InvoiceOut.findById(newInvoice.id, { + include: { + relation: 'client' + } + }, myOptions); + + invoiceId = newInvoice.id; + } + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + + if (invoiceId) { + if (!invoiceOut.client().isToBeMailed) { + const query = ` + CALL vn.report_print( + 'invoice', + ?, + account.myUser_getId(), + JSON_OBJECT('refFk', ?), + 'normal' + );`; + await models.InvoiceOut.rawSql(query, [args.printerFk, invoiceOut.ref]); + } else { + ctx.args = { + reference: invoiceOut.ref, + recipientId: invoiceOut.clientFk, + recipient: invoiceOut.client().email + }; + await models.InvoiceOut.invoiceEmail(ctx, invoiceOut.ref); + } + } + return invoiceId; + }; + + async function getNegativeBase(options) { + const models = Self.app.models; + const query = 'SELECT hasAnyNegativeBase() AS base'; + const [result] = await models.InvoiceOut.rawSql(query, null, options); + return result && result.base; + } + + async function getIsSpanishCompany(companyId, options) { + const models = Self.app.models; + const query = `SELECT COUNT(*) isSpanishCompany + FROM supplier s + JOIN country c ON c.id = s.countryFk + AND c.code = 'ES' + WHERE s.id = ?`; + const [supplierCompany] = await models.InvoiceOut.rawSql(query, [ + companyId + ], options); + + return supplierCompany && supplierCompany.isSpanishCompany; + } +}; diff --git a/modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js b/modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js new file mode 100644 index 000000000..d33df74a2 --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js @@ -0,0 +1,85 @@ +const {toCSV} = require('vn-loopback/util/csv'); + +module.exports = Self => { + Self.remoteMethod('invoiceCsv', { + description: 'Returns the delivery note csv', + accessType: 'READ', + accepts: [ + { + arg: 'reference', + type: 'string', + required: true, + description: 'The invoice reference', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The client id', + required: false + } + ], + 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: '/:reference/invoice-csv', + verb: 'GET' + } + }); + + Self.invoiceCsv = async reference => { + const sales = await Self.rawSql(` + SELECT io.ref Invoice, + io.issued InvoiceDate, + s.ticketFk Ticket, + s.itemFk Item, + s.concept Description, + i.size, + i.subName Producer, + s.quantity Quantity, + s.price Price, + s.discount Discount, + s.created Created, + tc.code Taxcode, + tc.description TaxDescription, + i.tag5, + i.value5, + i.tag6, + i.value6, + i.tag7, + i.value7, + i.tag8, + i.value8, + i.tag9, + i.value9, + i.tag10, + i.value10 + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + JOIN item i ON i.id = s.itemFk + JOIN supplier s2 ON s2.id = t.companyFk + JOIN itemTaxCountry itc ON itc.itemFk = i.id + AND itc.countryFk = s2.countryFk + JOIN taxClass tc ON tc.id = itc.taxClassFk + JOIN invoiceOut io ON io.ref = t.refFk + WHERE t.refFk = ? + ORDER BY s.ticketFk, s.created`, [reference]); + + const content = toCSV(sales); + + return [content, 'text/csv', `inline; filename="doc-${reference}.pdf"`]; + }; +}; diff --git a/modules/invoiceOut/back/methods/invoiceOut/invoiceCsvEmail.js b/modules/invoiceOut/back/methods/invoiceOut/invoiceCsvEmail.js new file mode 100644 index 000000000..38d451595 --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/invoiceCsvEmail.js @@ -0,0 +1,117 @@ +const {Email} = require('vn-print'); +const {toCSV} = require('vn-loopback/util/csv'); + +module.exports = Self => { + Self.remoteMethodCtx('invoiceCsvEmail', { + description: 'Returns the delivery note csv', + accessType: 'READ', + accepts: [ + { + arg: 'reference', + type: 'string', + required: true, + description: 'The invoice reference', + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The client id', + required: false + } + ], + 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: '/:reference/invoice-csv-email', + verb: 'POST' + } + }); + + Self.invoiceCsvEmail = async(ctx, reference) => { + const args = Object.assign({}, ctx.args); + + const params = { + recipient: args.recipient, + lang: ctx.req.getLocale() + }; + + delete args.ctx; + for (const param in args) + params[param] = args[param]; + + const sales = await Self.rawSql(` + SELECT io.ref Invoice, + io.issued InvoiceDate, + s.ticketFk Ticket, + s.itemFk Item, + s.concept Description, + i.size, + i.subName Producer, + s.quantity Quantity, + s.price Price, + s.discount Discount, + s.created Created, + tc.code Taxcode, + tc.description TaxDescription, + i.tag5, + i.value5, + i.tag6, + i.value6, + i.tag7, + i.value7, + i.tag8, + i.value8, + i.tag9, + i.value9, + i.tag10, + i.value10 + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + JOIN item i ON i.id = s.itemFk + JOIN supplier s2 ON s2.id = t.companyFk + JOIN itemTaxCountry itc ON itc.itemFk = i.id + AND itc.countryFk = s2.countryFk + JOIN taxClass tc ON tc.id = itc.taxClassFk + JOIN invoiceOut io ON io.ref = t.refFk + WHERE t.refFk = ? + ORDER BY s.ticketFk, s.created`, [reference]); + + const content = toCSV(sales); + const fileName = `invoice_${reference}.csv`; + const email = new Email('invoice', params); + + return email.send({ + overrideAttachments: true, + attachments: [{ + filename: fileName, + content: content + }] + }); + }; +}; diff --git a/modules/invoiceOut/back/methods/invoiceOut/invoiceEmail.js b/modules/invoiceOut/back/methods/invoiceOut/invoiceEmail.js new file mode 100644 index 000000000..83cb84881 --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/invoiceEmail.js @@ -0,0 +1,79 @@ +const {Email} = require('vn-print'); + +module.exports = Self => { + Self.remoteMethodCtx('invoiceEmail', { + description: 'Sends the invoice email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'reference', + type: 'string', + required: true, + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id to send to the recipient preferred language', + required: false + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/:reference/invoice-email', + verb: 'POST' + } + }); + + Self.invoiceEmail = async(ctx, reference) => { + const args = Object.assign({}, ctx.args); + const {InvoiceOut} = Self.app.models; + const params = { + recipient: args.recipient, + lang: ctx.req.getLocale() + }; + + const invoiceOut = await InvoiceOut.findOne({ + where: { + ref: reference + } + }); + + delete args.ctx; + for (const param in args) + params[param] = args[param]; + + const email = new Email('invoice', params); + + const [stream, ...headers] = await Self.download(ctx, invoiceOut.id); + const name = headers[1]; + const fileName = name.replace(/filename="(.*)"/gm, '$1'); + + const mailOptions = { + overrideAttachments: true, + attachments: [ + { + filename: fileName, + content: stream + } + ] + }; + + return email.send(mailOptions); + }; +}; diff --git a/modules/invoiceOut/back/methods/invoiceOut/invoiceOutPdf.js b/modules/invoiceOut/back/methods/invoiceOut/invoiceOutPdf.js new file mode 100644 index 000000000..941d31596 --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/invoiceOutPdf.js @@ -0,0 +1,50 @@ +const {Report} = require('vn-print'); + +module.exports = Self => { + Self.remoteMethodCtx('invoiceOutPdf', { + description: 'Returns the invoice pdf', + accessType: 'READ', + accepts: [ + { + arg: 'reference', + type: 'string', + required: true, + description: 'The invoice reference', + 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: '/:reference/invoice-out-pdf', + verb: 'GET' + } + }); + + Self.invoiceOutPdf = async(ctx, reference) => { + const args = Object.assign({}, ctx.args); + const params = {lang: ctx.req.getLocale()}; + + delete args.ctx; + for (const param in args) + params[param] = args[param]; + + const report = new Report('invoice', params); + const stream = await report.toPdfStream(); + + return [stream, 'application/pdf', `filename="doc-${reference}.pdf"`]; + }; +}; diff --git a/modules/invoiceOut/back/methods/invoiceOut/refund.js b/modules/invoiceOut/back/methods/invoiceOut/refund.js new file mode 100644 index 000000000..ba1fdfedd --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/refund.js @@ -0,0 +1,48 @@ +module.exports = Self => { + Self.remoteMethod('refund', { + description: 'Create refund tickets with sales and services if provided', + accessType: 'WRITE', + accepts: [{ + arg: 'ref', + type: 'string', + description: 'The invoice reference' + }], + returns: { + type: ['number'], + root: true + }, + http: { + path: '/refund', + verb: 'post' + } + }); + + Self.refund = async(ref, options) => { + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const filter = {where: {refFk: ref}}; + const tickets = await models.Ticket.find(filter, myOptions); + + const ticketsIds = tickets.map(ticket => ticket.id); + const refundedTickets = await models.Ticket.refund(ticketsIds, true, myOptions); + + if (tx) await tx.commit(); + + return refundedTickets; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/createPdf.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/createPdf.spec.js index 7600f065f..803338ef3 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/createPdf.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/createPdf.spec.js @@ -1,7 +1,6 @@ const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); -const fs = require('fs-extra'); -const axios = require('axios'); +const print = require('vn-print'); describe('InvoiceOut createPdf()', () => { const userId = 1; @@ -16,22 +15,15 @@ describe('InvoiceOut createPdf()', () => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx }); - const response = { - data: { - pipe: () => {}, - on: () => {}, + + spyOn(print, 'Report').and.returnValue({ + toPdfStream: () => { + return ''; } - }; - spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(response))); - spyOn(models.InvoiceContainer, 'container').and.returnValue({ - client: {root: '/path'} - }); - spyOn(fs, 'mkdir').and.returnValue(true); - spyOn(fs, 'createWriteStream').and.returnValue({ - on: (event, cb) => cb(), - end: () => {} }); + spyOn(print.storage, 'write').and.returnValue(true); + const tx = await models.InvoiceOut.beginTransaction({}); const options = {transaction: tx}; diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js index ededc5679..15e3e887e 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; describe('InvoiceOut filter()', () => { - let today = new Date(); + let today = Date.vnNew(); today.setHours(2, 0, 0, 0); it('should return the invoice out matching ref', async() => { @@ -64,7 +64,7 @@ describe('InvoiceOut filter()', () => { const invoiceOut = await models.InvoiceOut.findById(1, null, options); await invoiceOut.updateAttribute('hasPdf', true, options); - const result = await models.InvoiceOut.filter(ctx, {}, options); + const result = await models.InvoiceOut.filter(ctx, {id: invoiceOut.id}, options); expect(result.length).toEqual(1); diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/globalInvoicing.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/globalInvoicing.spec.js deleted file mode 100644 index e0ed6c91c..000000000 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/globalInvoicing.spec.js +++ /dev/null @@ -1,40 +0,0 @@ -const models = require('vn-loopback/server/server').models; - -describe('InvoiceOut globalInvoicing()', () => { - const userId = 1; - const companyFk = 442; - const clientId = 1101; - const invoicedTicketId = 8; - const invoiceSerial = 'A'; - const activeCtx = { - accessToken: {userId: userId}, - }; - const ctx = {req: activeCtx}; - - it('should make a global invoicing', async() => { - spyOn(models.InvoiceOut, 'createPdf').and.returnValue(new Promise(resolve => resolve(true))); - - const tx = await models.InvoiceOut.beginTransaction({}); - const options = {transaction: tx}; - - try { - ctx.args = { - invoiceDate: new Date(), - maxShipped: new Date(), - fromClientId: clientId, - toClientId: clientId, - companyFk: companyFk - }; - const result = await models.InvoiceOut.globalInvoicing(ctx, options); - const ticket = await models.Ticket.findById(invoicedTicketId, null, options); - - expect(result.length).toBeGreaterThan(0); - expect(ticket.refFk).toContain(invoiceSerial); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); -}); diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/invoiceClient.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/invoiceClient.spec.js new file mode 100644 index 000000000..9a0574dba --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/invoiceClient.spec.js @@ -0,0 +1,56 @@ +const models = require('vn-loopback/server/server').models; + +describe('InvoiceOut invoiceClient()', () => { + const userId = 1; + const clientId = 1101; + const addressId = 121; + const companyFk = 442; + const minShipped = Date.vnNew(); + minShipped.setFullYear(minShipped.getFullYear() - 1); + minShipped.setMonth(1); + minShipped.setDate(1); + minShipped.setHours(0, 0, 0, 0); + const invoiceSerial = 'A'; + const activeCtx = { + getLocale: () => { + return 'en'; + }, + accessToken: {userId: userId}, + __: value => { + return value; + } + }; + const ctx = {req: activeCtx}; + + it('should make a global invoicing', async() => { + spyOn(models.InvoiceOut, 'createPdf').and.returnValue(new Promise(resolve => resolve(true))); + spyOn(models.InvoiceOut, 'invoiceEmail'); + + const tx = await models.InvoiceOut.beginTransaction({}); + const options = {transaction: tx}; + + try { + ctx.args = { + clientId: clientId, + addressId: addressId, + invoiceDate: Date.vnNew(), + maxShipped: Date.vnNew(), + companyFk: companyFk, + minShipped: minShipped + }; + const invoiceOutId = await models.InvoiceOut.invoiceClient(ctx, options); + const invoiceOut = await models.InvoiceOut.findById(invoiceOutId, null, options); + const [firstTicket] = await models.Ticket.find({ + where: {refFk: invoiceOut.ref} + }, options); + + expect(invoiceOutId).toBeGreaterThan(0); + expect(firstTicket.refFk).toContain(invoiceSerial); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/refund.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/refund.spec.js new file mode 100644 index 000000000..c5a1ac603 --- /dev/null +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/refund.spec.js @@ -0,0 +1,28 @@ +const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); + +describe('InvoiceOut refund()', () => { + const userId = 5; + const activeCtx = { + accessToken: {userId: userId}, + }; + + it('should return the ids for the created refund tickets', async() => { + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + const tx = await models.InvoiceOut.beginTransaction({}); + const options = {transaction: tx}; + + try { + const result = await models.InvoiceOut.refund('T1111111', options); + + expect(result.length).toEqual(1); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/invoiceOut/back/model-config.json b/modules/invoiceOut/back/model-config.json index d52f79477..b190126ea 100644 --- a/modules/invoiceOut/back/model-config.json +++ b/modules/invoiceOut/back/model-config.json @@ -8,6 +8,9 @@ "InvoiceContainer": { "dataSource": "invoiceStorage" }, + "Printer": { + "dataSource": "vn" + }, "TaxArea": { "dataSource": "vn" }, @@ -22,5 +25,8 @@ }, "TaxType": { "dataSource": "vn" + }, + "ZipConfig": { + "dataSource": "vn" } } diff --git a/modules/invoiceOut/back/models/invoice-out.js b/modules/invoiceOut/back/models/invoice-out.js index 3b2822ada..6205abe7b 100644 --- a/modules/invoiceOut/back/models/invoice-out.js +++ b/modules/invoiceOut/back/models/invoice-out.js @@ -3,9 +3,18 @@ module.exports = Self => { require('../methods/invoiceOut/summary')(Self); require('../methods/invoiceOut/getTickets')(Self); require('../methods/invoiceOut/download')(Self); + require('../methods/invoiceOut/downloadZip')(Self); require('../methods/invoiceOut/delete')(Self); require('../methods/invoiceOut/book')(Self); require('../methods/invoiceOut/createPdf')(Self); require('../methods/invoiceOut/createManualInvoice')(Self); - require('../methods/invoiceOut/globalInvoicing')(Self); + require('../methods/invoiceOut/clientsToInvoice')(Self); + require('../methods/invoiceOut/invoiceClient')(Self); + require('../methods/invoiceOut/refund')(Self); + require('../methods/invoiceOut/invoiceEmail')(Self); + require('../methods/invoiceOut/exportationPdf')(Self); + require('../methods/invoiceOut/invoiceCsv')(Self); + require('../methods/invoiceOut/invoiceCsvEmail')(Self); + require('../methods/invoiceOut/invoiceOutPdf')(Self); + require('../methods/invoiceOut/getInvoiceDate')(Self); }; diff --git a/modules/invoiceOut/back/models/printer.json b/modules/invoiceOut/back/models/printer.json new file mode 100644 index 000000000..99003560d --- /dev/null +++ b/modules/invoiceOut/back/models/printer.json @@ -0,0 +1,28 @@ +{ + "name": "Printer", + "base": "VnModel", + "options": { + "mysql": { + "table": "printer" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string" + }, + "isLabeler": { + "type": "boolean" + } + }, + "acls": [{ + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }] +} diff --git a/modules/invoiceOut/back/models/zip-config.json b/modules/invoiceOut/back/models/zip-config.json new file mode 100644 index 000000000..17fe8a1fa --- /dev/null +++ b/modules/invoiceOut/back/models/zip-config.json @@ -0,0 +1,25 @@ +{ + "name": "ZipConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "zipConfig" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "maxSize": { + "type": "number" + } + }, + "acls": [{ + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }] +} \ No newline at end of file diff --git a/modules/invoiceOut/front/descriptor-menu/index.html b/modules/invoiceOut/front/descriptor-menu/index.html index ef4c9a62e..389fcf81b 100644 --- a/modules/invoiceOut/front/descriptor-menu/index.html +++ b/modules/invoiceOut/front/descriptor-menu/index.html @@ -17,12 +17,12 @@ target="_blank" name="showInvoicePdf" translate> - Show as PDF + as PDF - Show as CSV + as CSV @@ -80,6 +80,8 @@ ng-click="refundConfirmation.show()" name="refundInvoice" vn-tooltip="Create a single ticket with all the content of the current invoice" + vn-acl="invoicing, claimManager, salesAssistant" + vn-acl-action="remove" translate> Refund diff --git a/modules/invoiceOut/front/descriptor-menu/index.js b/modules/invoiceOut/front/descriptor-menu/index.js index b884e50cb..456939119 100644 --- a/modules/invoiceOut/front/descriptor-menu/index.js +++ b/modules/invoiceOut/front/descriptor-menu/index.js @@ -81,21 +81,19 @@ class Controller extends Section { }); } - showCsvInvoice() { - this.vnReport.showCsv('invoice', { - recipientId: this.invoiceOut.client.id, - invoiceId: this.id - }); - } - sendPdfInvoice($data) { if (!$data.email) return this.vnApp.showError(this.$t(`The email can't be empty`)); - return this.vnEmail.send('invoice', { + return this.vnEmail.send(`InvoiceOuts/${this.invoiceOut.ref}/invoice-email`, { recipientId: this.invoiceOut.client.id, - recipient: $data.email, - invoiceId: this.id + recipient: $data.email + }); + } + + showCsvInvoice() { + this.vnReport.show(`InvoiceOuts/${this.invoiceOut.ref}/invoice-csv`, { + recipientId: this.invoiceOut.client.id }); } @@ -103,46 +101,25 @@ class Controller extends Section { if (!$data.email) return this.vnApp.showError(this.$t(`The email can't be empty`)); - return this.vnEmail.sendCsv('invoice', { + return this.vnEmail.send(`InvoiceOuts/${this.invoiceOut.ref}/invoice-csv-email`, { recipientId: this.invoiceOut.client.id, - recipient: $data.email, - invoiceId: this.id + recipient: $data.email }); } showExportationLetter() { - this.vnReport.show('exportation', { + this.vnReport.show(`InvoiceOuts/${this.invoiceOut.ref}/exportation-pdf`, { recipientId: this.invoiceOut.client.id, - invoiceId: this.id + refFk: this.invoiceOut.ref }); } - async refundInvoiceOut() { - let filter = { - where: {refFk: this.invoiceOut.ref} - }; - const tickets = await this.$http.get('Tickets', {filter}); - this.tickets = tickets.data; - this.ticketsIds = []; - for (let ticket of this.tickets) - this.ticketsIds.push(ticket.id); - - filter = { - where: {ticketFk: {inq: this.ticketsIds}} - }; - const sales = await this.$http.get('Sales', {filter}); - this.sales = sales.data; - - const ticketServices = await this.$http.get('TicketServices', {filter}); - this.services = ticketServices.data; - - const params = { - sales: this.sales, - services: this.services - }; - const query = `Sales/refund`; - return this.$http.post(query, params).then(res => { - this.$state.go('ticket.card.sale', {id: res.data}); + refundInvoiceOut() { + const query = 'InvoiceOuts/refund'; + const params = {ref: this.invoiceOut.ref}; + this.$http.post(query, params).then(res => { + const ticketIds = res.data.map(ticket => ticket.id).join(', '); + this.vnApp.showSuccess(this.$t('The following refund tickets have been created', {ticketIds})); }); } } diff --git a/modules/invoiceOut/front/descriptor-menu/index.spec.js b/modules/invoiceOut/front/descriptor-menu/index.spec.js index c84c97a57..d2ccfa117 100644 --- a/modules/invoiceOut/front/descriptor-menu/index.spec.js +++ b/modules/invoiceOut/front/descriptor-menu/index.spec.js @@ -6,7 +6,8 @@ describe('vnInvoiceOutDescriptorMenu', () => { let $httpParamSerializer; const invoiceOut = { id: 1, - client: {id: 1101} + client: {id: 1101}, + ref: 'T1111111' }; beforeEach(ngModule('invoiceOut')); @@ -15,14 +16,17 @@ describe('vnInvoiceOutDescriptorMenu', () => { $httpBackend = _$httpBackend_; $httpParamSerializer = _$httpParamSerializer_; controller = $componentController('vnInvoiceOutDescriptorMenu', {$element: null}); + controller.invoiceOut = { + id: 1, + ref: 'T1111111', + client: {id: 1101} + }; })); describe('createPdfInvoice()', () => { it('should make a query to the createPdf() endpoint and show a success snackbar', () => { jest.spyOn(controller.vnApp, 'showSuccess'); - controller.invoiceOut = invoiceOut; - $httpBackend.whenGET(`InvoiceOuts/${invoiceOut.id}`).respond(); $httpBackend.expectPOST(`InvoiceOuts/${invoiceOut.id}/createPdf`).respond(); controller.createPdfInvoice(); @@ -36,14 +40,11 @@ describe('vnInvoiceOutDescriptorMenu', () => { it('should make a query to the csv invoice download endpoint and show a message snackbar', () => { jest.spyOn(window, 'open').mockReturnThis(); - controller.invoiceOut = invoiceOut; - const expectedParams = { - invoiceId: invoiceOut.id, recipientId: invoiceOut.client.id }; const serializedParams = $httpParamSerializer(expectedParams); - const expectedPath = `api/csv/invoice/download?${serializedParams}`; + const expectedPath = `api/InvoiceOuts/${invoiceOut.ref}/invoice-csv?${serializedParams}`; controller.showCsvInvoice(); expect(window.open).toHaveBeenCalledWith(expectedPath); @@ -52,7 +53,6 @@ describe('vnInvoiceOutDescriptorMenu', () => { describe('deleteInvoiceOut()', () => { it(`should make a query and call showSuccess()`, () => { - controller.invoiceOut = invoiceOut; controller.$state.reload = jest.fn(); jest.spyOn(controller.vnApp, 'showSuccess'); @@ -65,7 +65,6 @@ describe('vnInvoiceOutDescriptorMenu', () => { }); it(`should make a query and call showSuccess() after state.go if the state wasn't in invoiceOut module`, () => { - controller.invoiceOut = invoiceOut; jest.spyOn(controller.$state, 'go').mockReturnValue('ok'); jest.spyOn(controller.vnApp, 'showSuccess'); controller.$state.current.name = 'invoiceOut.card.something'; @@ -83,17 +82,9 @@ describe('vnInvoiceOutDescriptorMenu', () => { it('should make a query to the email invoice endpoint and show a message snackbar', () => { jest.spyOn(controller.vnApp, 'showMessage'); - controller.invoiceOut = invoiceOut; - const $data = {email: 'brucebanner@gothamcity.com'}; - const expectedParams = { - invoiceId: invoiceOut.id, - recipient: $data.email, - recipientId: invoiceOut.client.id - }; - const serializedParams = $httpParamSerializer(expectedParams); - $httpBackend.expectGET(`email/invoice?${serializedParams}`).respond(); + $httpBackend.expectPOST(`InvoiceOuts/${invoiceOut.ref}/invoice-email`).respond(); controller.sendPdfInvoice($data); $httpBackend.flush(); @@ -105,17 +96,9 @@ describe('vnInvoiceOutDescriptorMenu', () => { it('should make a query to the csv invoice send endpoint and show a message snackbar', () => { jest.spyOn(controller.vnApp, 'showMessage'); - controller.invoiceOut = invoiceOut; - const $data = {email: 'brucebanner@gothamcity.com'}; - const expectedParams = { - invoiceId: invoiceOut.id, - recipient: $data.email, - recipientId: invoiceOut.client.id - }; - const serializedParams = $httpParamSerializer(expectedParams); - $httpBackend.expectGET(`csv/invoice/send?${serializedParams}`).respond(); + $httpBackend.expectPOST(`InvoiceOuts/${invoiceOut.ref}/invoice-csv-email`).respond(); controller.sendCsvInvoice($data); $httpBackend.flush(); @@ -123,33 +106,16 @@ describe('vnInvoiceOutDescriptorMenu', () => { }); }); - // #4084 review with Juan - xdescribe('refundInvoiceOut()', () => { - it('should make a query and go to ticket.card.sale', () => { - controller.$state.go = jest.fn(); + describe('refundInvoiceOut()', () => { + it('should make a query and show a success message', () => { + jest.spyOn(controller.vnApp, 'showSuccess'); + const params = {ref: controller.invoiceOut.ref}; - const invoiceOut = { - id: 1, - ref: 'T1111111' - }; - controller.invoiceOut = invoiceOut; - const tickets = [{id: 1}]; - const sales = [{id: 1}]; - const services = [{id: 2}]; - - $httpBackend.expectGET(`Tickets`).respond(tickets); - $httpBackend.expectGET(`Sales`).respond(sales); - $httpBackend.expectGET(`TicketServices`).respond(services); - - const expectedParams = { - sales: sales, - services: services - }; - $httpBackend.expectPOST(`Sales/refund`, expectedParams).respond(); + $httpBackend.expectPOST(`InvoiceOuts/refund`, params).respond([{id: 1}, {id: 2}]); controller.refundInvoiceOut(); $httpBackend.flush(); - expect(controller.$state.go).toHaveBeenCalledWith('ticket.card.sale', {id: undefined}); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); }); }); }); diff --git a/modules/invoiceOut/front/descriptor-menu/locale/en.yml b/modules/invoiceOut/front/descriptor-menu/locale/en.yml new file mode 100644 index 000000000..d299155d7 --- /dev/null +++ b/modules/invoiceOut/front/descriptor-menu/locale/en.yml @@ -0,0 +1 @@ +The following refund tickets have been created: "The following refund tickets have been created: {{ticketIds}}" diff --git a/modules/invoiceOut/front/descriptor-menu/locale/es.yml b/modules/invoiceOut/front/descriptor-menu/locale/es.yml index 8949f1f91..df0ba57cf 100644 --- a/modules/invoiceOut/front/descriptor-menu/locale/es.yml +++ b/modules/invoiceOut/front/descriptor-menu/locale/es.yml @@ -2,6 +2,8 @@ Show invoice...: Ver factura... Send invoice...: Enviar factura... Send PDF invoice: Enviar factura en PDF Send CSV invoice: Enviar factura en CSV +as PDF: como PDF +as CSV: como CSV Delete Invoice: Eliminar factura Clone Invoice: Clonar factura Book invoice: Asentar factura @@ -17,3 +19,4 @@ Create a single ticket with all the content of the current invoice: Crear un tic Regenerate PDF invoice: Regenerar PDF factura The invoice PDF document has been regenerated: El documento PDF de la factura ha sido regenerado The email can't be empty: El correo no puede estar vacío +The following refund tickets have been created: "Se han creado los siguientes tickets de abono: {{ticketIds}}" diff --git a/modules/invoiceOut/front/descriptor/index.html b/modules/invoiceOut/front/descriptor/index.html index 92f0b9de5..e1dc579ab 100644 --- a/modules/invoiceOut/front/descriptor/index.html +++ b/modules/invoiceOut/front/descriptor/index.html @@ -3,7 +3,7 @@ description="$ctrl.invoiceOut.ref" summary="$ctrl.$.summary"> - @@ -11,23 +11,23 @@
- {{$ctrl.invoiceOut.client.name}}
@@ -53,4 +53,7 @@
- \ No newline at end of file + + + diff --git a/modules/invoiceOut/front/global-invoicing/index.html b/modules/invoiceOut/front/global-invoicing/index.html new file mode 100644 index 000000000..ebe46b84a --- /dev/null +++ b/modules/invoiceOut/front/global-invoicing/index.html @@ -0,0 +1,144 @@ + + + +
+
+ + Build packaging tickets + + + {{'Invoicing client' | translate}} {{$ctrl.currentAddress.clientId}} + + + Stopping process + + + Ended process + +
+
+ {{$ctrl.percentage | percentage: 0}} ({{$ctrl.addressNumber}} {{'of' | translate}} {{$ctrl.nAddresses}}) +
+
+
+ + + + + Id + Client + Address id + Street + Error + + + + + + + {{::error.address.clientId}} + + + + {{::error.address.clientName}} + + + {{::error.address.id}} + + + {{::error.address.nickname}} + + + {{::error.message}} + + + + + + + + + + +
+ + + + + + + + + {{::id}} - {{::name}} + + + + + + + + + + + + + + +
+
+ + + diff --git a/modules/invoiceOut/front/global-invoicing/index.js b/modules/invoiceOut/front/global-invoicing/index.js new file mode 100644 index 000000000..0ac0223b4 --- /dev/null +++ b/modules/invoiceOut/front/global-invoicing/index.js @@ -0,0 +1,133 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; +import UserError from 'core/lib/user-error'; +import './style.scss'; + +class Controller extends Section { + $onInit() { + const date = Date.vnNew(); + Object.assign(this, { + maxShipped: new Date(date.getFullYear(), date.getMonth(), 0), + clientsToInvoice: 'all', + }); + + this.$http.get('UserConfigs/getUserConfig') + .then(res => { + this.companyFk = res.data.companyFk; + const params = { + companyFk: this.companyFk + }; + return this.$http.get('InvoiceOuts/getInvoiceDate', {params}); + }) + .then(res => { + this.minInvoicingDate = res.data.issued ? new Date(res.data.issued) : null; + this.invoiceDate = this.minInvoicingDate; + }); + } + + stopInvoicing() { + this.status = 'stopping'; + } + + makeInvoice() { + this.invoicing = true; + this.status = 'packageInvoicing'; + this.errors = []; + this.addresses = null; + + try { + if (this.clientsToInvoice == 'one' && !this.clientId) + throw new UserError('Choose a valid client'); + if (!this.invoiceDate || !this.maxShipped) + throw new UserError('Invoice date and the max date should be filled'); + if (this.invoiceDate < this.maxShipped) + throw new UserError('Invoice date can\'t be less than max date'); + if (this.invoiceDate.getTime() < this.minInvoicingDate.getTime()) + throw new UserError('Exists an invoice with a previous date'); + if (!this.companyFk) + throw new UserError('Choose a valid company'); + if (!this.printerFk) + throw new UserError('Choose a valid printer'); + + if (this.clientsToInvoice == 'all') + this.clientId = undefined; + + const params = { + invoiceDate: this.invoiceDate, + maxShipped: this.maxShipped, + clientId: this.clientId, + companyFk: this.companyFk + }; + this.$http.post(`InvoiceOuts/clientsToInvoice`, params) + .then(res => { + this.addresses = res.data; + if (!this.addresses.length) + throw new UserError(`There aren't tickets to invoice`); + + this.addressIndex = 0; + return this.invoiceOut(); + }) + .catch(err => this.handleError(err)); + } catch (err) { + this.handleError(err); + } + } + + handleError(err) { + this.invoicing = false; + this.status = null; + throw err; + } + + invoiceOut() { + if (this.addressIndex == this.addresses.length || this.status == 'stopping') { + this.invoicing = false; + this.status = 'done'; + return; + } + + this.status = 'invoicing'; + const address = this.addresses[this.addressIndex]; + this.currentAddress = address; + + const params = { + clientId: address.clientId, + addressId: address.id, + invoiceDate: this.invoiceDate, + maxShipped: this.maxShipped, + companyFk: this.companyFk, + printerFk: this.printerFk, + }; + + this.$http.post(`InvoiceOuts/invoiceClient`, params) + .catch(res => { + this.errors.unshift({ + address, + message: res.data.error.message + }); + }) + .finally(() => { + this.addressIndex++; + this.invoiceOut(); + }); + } + + get nAddresses() { + if (!this.addresses) return 0; + return this.addresses.length; + } + + get addressNumber() { + return Math.min(this.addressIndex + 1, this.nAddresses); + } + + get percentage() { + const len = this.nAddresses; + return Math.min(this.addressIndex, len) / len; + } +} + +ngModule.vnComponent('vnInvoiceOutGlobalInvoicing', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/invoiceOut/front/global-invoicing/index.spec.js b/modules/invoiceOut/front/global-invoicing/index.spec.js new file mode 100644 index 000000000..056839b20 --- /dev/null +++ b/modules/invoiceOut/front/global-invoicing/index.spec.js @@ -0,0 +1,74 @@ +import './index'; + +describe('InvoiceOut', () => { + describe('Component vnInvoiceOutGlobalInvoicing', () => { + let controller; + let $httpBackend; + + beforeEach(ngModule('invoiceOut')); + + beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { + $httpBackend = _$httpBackend_; + const $scope = $rootScope.$new(); + const $element = angular.element(''); + + controller = $componentController('vnInvoiceOutGlobalInvoicing', {$element, $scope}); + })); + + describe('makeInvoice()', () => { + it('should throw an error when invoiceDate or maxShipped properties are not filled in', () => { + jest.spyOn(controller.vnApp, 'showError'); + controller.clientsToInvoice = 'all'; + + let error; + try { + controller.makeInvoice(); + } catch (e) { + error = e.message; + } + + const expectedError = 'Invoice date and the max date should be filled'; + + expect(error).toBe(expectedError); + }); + + it('should throw an error when select one client and clientId is not filled in', () => { + jest.spyOn(controller.vnApp, 'showError'); + controller.clientsToInvoice = 'one'; + + let error; + try { + controller.makeInvoice(); + } catch (e) { + error = e.message; + } + + const expectedError = 'Choose a valid client'; + + expect(error).toBe(expectedError); + }); + + it('should make an http POST query and then call to the showSuccess() method', () => { + const date = Date.vnNew(); + Object.assign(controller, { + invoiceDate: date, + maxShipped: date, + minInvoicingDate: date, + clientsToInvoice: 'one', + clientId: 1101, + companyFk: 442, + printerFk: 1 + }); + $httpBackend.expectPOST(`InvoiceOuts/clientsToInvoice`).respond([{ + clientId: 1101, + id: 121 + }]); + $httpBackend.expectPOST(`InvoiceOuts/invoiceClient`).respond(); + controller.makeInvoice(); + $httpBackend.flush(); + + expect(controller.status).toEqual('done'); + }); + }); + }); +}); diff --git a/modules/invoiceOut/front/global-invoicing/locale/es.yml b/modules/invoiceOut/front/global-invoicing/locale/es.yml new file mode 100644 index 000000000..242b5a93f --- /dev/null +++ b/modules/invoiceOut/front/global-invoicing/locale/es.yml @@ -0,0 +1,20 @@ +There aren't tickets to invoice: No existen tickets para facturar +Max date: Fecha límite +Invoice date: Fecha de factura +Invoice date can't be less than max date: La fecha de factura no puede ser inferior a la fecha límite +Invoice date and the max date should be filled: La fecha de factura y la fecha límite deben rellenarse +Choose a valid company: Selecciona un empresa válida +Choose a valid printer: Selecciona una impresora válida +All clients: Todos los clientes +Build packaging tickets: Generando tickets de embalajes +Address id: Id dirección +Printer: Impresora +of: de +Client: Cliente +Current client id: Id cliente actual +Invoicing client: Facturando cliente +Ended process: Proceso finalizado +Invoice out: Facturar +One client: Un solo cliente +Choose a valid client: Selecciona un cliente válido +Stop: Parar \ No newline at end of file diff --git a/modules/invoiceOut/front/global-invoicing/style.scss b/modules/invoiceOut/front/global-invoicing/style.scss new file mode 100644 index 000000000..6fdfac0ba --- /dev/null +++ b/modules/invoiceOut/front/global-invoicing/style.scss @@ -0,0 +1,17 @@ +@import "variables"; + +vn-invoice-out-global-invoicing{ + + h5{ + color: $color-primary; + } + + #error { + line-break: normal; + overflow-wrap: break-word; + white-space: normal; + } + +} + + diff --git a/modules/invoiceOut/front/index.js b/modules/invoiceOut/front/index.js index 0307b2b4b..f7cebc0d0 100644 --- a/modules/invoiceOut/front/index.js +++ b/modules/invoiceOut/front/index.js @@ -9,4 +9,4 @@ import './descriptor'; import './descriptor-popover'; import './descriptor-menu'; import './index/manual'; -import './index/global-invoicing'; +import './global-invoicing'; diff --git a/modules/invoiceOut/front/index/global-invoicing/index.html b/modules/invoiceOut/front/index/global-invoicing/index.html deleted file mode 100644 index 3d245b8d8..000000000 --- a/modules/invoiceOut/front/index/global-invoicing/index.html +++ /dev/null @@ -1,70 +0,0 @@ - - Create global invoice - - - - - - -
- - - Adding invoices to queue... - -
- - - - - - - - - {{::id}} - {{::name}} - - - {{::id}} - {{::name}} - - - - - - -
- - - - \ No newline at end of file diff --git a/modules/invoiceOut/front/index/global-invoicing/index.js b/modules/invoiceOut/front/index/global-invoicing/index.js deleted file mode 100644 index 5e522f23d..000000000 --- a/modules/invoiceOut/front/index/global-invoicing/index.js +++ /dev/null @@ -1,81 +0,0 @@ -import ngModule from '../../module'; -import Dialog from 'core/components/dialog'; -import './style.scss'; - -class Controller extends Dialog { - constructor($element, $, $transclude) { - super($element, $, $transclude); - - this.isInvoicing = false; - this.invoice = { - maxShipped: new Date() - }; - } - - $onInit() { - this.getMinClientId(); - this.getMaxClientId(); - } - - getMinClientId() { - this.getClientId('min') - .then(res => this.invoice.fromClientId = res.data.id); - } - - getMaxClientId() { - this.getClientId('max') - .then(res => this.invoice.toClientId = res.data.id); - } - - getClientId(func) { - const order = func == 'min' ? 'ASC' : 'DESC'; - const params = { - filter: { - order: 'id ' + order, - limit: 1 - } - }; - return this.$http.get('Clients/findOne', {params}); - } - - get companyFk() { - return this.invoice.companyFk; - } - - set companyFk(value) { - this.invoice.companyFk = value; - } - - responseHandler(response) { - try { - if (response !== 'accept') - return super.responseHandler(response); - - if (!this.invoice.invoiceDate || !this.invoice.maxShipped) - throw new Error('Invoice date and the max date should be filled'); - - if (!this.invoice.fromClientId || !this.invoice.toClientId) - throw new Error('Choose a valid clients range'); - - this.isInvoicing = true; - return this.$http.post(`InvoiceOuts/globalInvoicing`, this.invoice) - .then(() => super.responseHandler(response)) - .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))) - .finally(() => this.isInvoicing = false); - } catch (e) { - this.vnApp.showError(this.$t(e.message)); - this.isInvoicing = false; - return false; - } - } -} - -Controller.$inject = ['$element', '$scope', '$transclude']; - -ngModule.vnComponent('vnInvoiceOutGlobalInvoicing', { - slotTemplate: require('./index.html'), - controller: Controller, - bindings: { - companyFk: ' { - describe('Component vnInvoiceOutGlobalInvoicing', () => { - let controller; - let $httpBackend; - let $httpParamSerializer; - - beforeEach(ngModule('invoiceOut')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { - $httpBackend = _$httpBackend_; - $httpParamSerializer = _$httpParamSerializer_; - let $scope = $rootScope.$new(); - const $element = angular.element(''); - const $transclude = { - $$boundTransclude: { - $$slots: [] - } - }; - controller = $componentController('vnInvoiceOutGlobalInvoicing', {$element, $scope, $transclude}); - })); - - describe('getMinClientId()', () => { - it('should set the invoice fromClientId property', () => { - const filter = { - order: 'id ASC', - limit: 1 - }; - - const serializedParams = $httpParamSerializer({filter}); - $httpBackend.expectGET(`Clients/findOne?${serializedParams}`).respond(200, {id: 1101}); - - controller.getMinClientId(); - $httpBackend.flush(); - - expect(controller.invoice.fromClientId).toEqual(1101); - }); - }); - - describe('getMaxClientId()', () => { - it('should set the invoice toClientId property', () => { - const filter = { - order: 'id DESC', - limit: 1 - }; - - const serializedParams = $httpParamSerializer({filter}); - $httpBackend.expectGET(`Clients/findOne?${serializedParams}`).respond(200, {id: 1112}); - - controller.getMaxClientId(); - $httpBackend.flush(); - - expect(controller.invoice.toClientId).toEqual(1112); - }); - }); - - describe('responseHandler()', () => { - it('should throw an error when invoiceDate or maxShipped properties are not filled in', () => { - jest.spyOn(controller.vnApp, 'showError'); - - controller.invoice = { - fromClientId: 1101, - toClientId: 1101 - }; - - controller.responseHandler('accept'); - - expect(controller.vnApp.showError).toHaveBeenCalledWith(`Invoice date and the max date should be filled`); - }); - - it('should throw an error when fromClientId or toClientId properties are not filled in', () => { - jest.spyOn(controller.vnApp, 'showError'); - - controller.invoice = { - invoiceDate: new Date(), - maxShipped: new Date() - }; - - controller.responseHandler('accept'); - - expect(controller.vnApp.showError).toHaveBeenCalledWith(`Choose a valid clients range`); - }); - - it('should make an http POST query and then call to the showSuccess() method', () => { - jest.spyOn(controller.vnApp, 'showSuccess'); - - controller.invoice = { - invoiceDate: new Date(), - maxShipped: new Date(), - fromClientId: 1101, - toClientId: 1101 - }; - - $httpBackend.expect('POST', `InvoiceOuts/globalInvoicing`).respond({id: 1}); - controller.responseHandler('accept'); - $httpBackend.flush(); - - expect(controller.vnApp.showSuccess).toHaveBeenCalled(); - }); - }); - }); -}); diff --git a/modules/invoiceOut/front/index/global-invoicing/locale/es.yml b/modules/invoiceOut/front/index/global-invoicing/locale/es.yml deleted file mode 100644 index 1a6e15656..000000000 --- a/modules/invoiceOut/front/index/global-invoicing/locale/es.yml +++ /dev/null @@ -1,9 +0,0 @@ -Create global invoice: Crear factura global -Some fields are required: Algunos campos son obligatorios -Max date: Fecha límite -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 -Invoice date and the max date should be filled: La fecha de factura y la fecha límite deben rellenarse -Choose a valid clients range: Selecciona un rango válido de clientes \ No newline at end of file diff --git a/modules/invoiceOut/front/index/global-invoicing/style.scss b/modules/invoiceOut/front/index/global-invoicing/style.scss deleted file mode 100644 index d0bd9e214..000000000 --- a/modules/invoiceOut/front/index/global-invoicing/style.scss +++ /dev/null @@ -1,17 +0,0 @@ -@import "variables"; - -.vn-invoice-out-global-invoicing { - tpl-body { - width: 500px; - - .progress { - font-weight: bold; - text-align: center; - font-size: 1.5rem; - color: $color-primary; - vn-horizontal { - justify-content: center - } - } - } -} \ No newline at end of file diff --git a/modules/invoiceOut/front/index/index.html b/modules/invoiceOut/front/index/index.html index d970bd15a..dc4d5d8a9 100644 --- a/modules/invoiceOut/front/index/index.html +++ b/modules/invoiceOut/front/index/index.html @@ -4,10 +4,24 @@ + + + + + + + + Reference Issued Amount @@ -16,13 +30,18 @@ Company Due date - + + + + {{::invoiceOut.ref | dashIfEmpty}} {{::invoiceOut.issued | date:'dd/MM/yyyy' | dashIfEmpty}} {{::invoiceOut.amount | currency: 'EUR': 2 | dashIfEmpty}} @@ -36,15 +55,6 @@ {{::invoiceOut.created | date:'dd/MM/yyyy' | dashIfEmpty}} {{::invoiceOut.companyCode | dashIfEmpty}} {{::invoiceOut.dued | date:'dd/MM/yyyy' | dashIfEmpty}} - - - -
- - - - - - - Manual invoicing - - - Global invoicing - - - + +
- - \ No newline at end of file diff --git a/modules/invoiceOut/front/index/index.js b/modules/invoiceOut/front/index/index.js index c884fb90b..2cde3c940 100644 --- a/modules/invoiceOut/front/index/index.js +++ b/modules/invoiceOut/front/index/index.js @@ -2,14 +2,41 @@ import ngModule from '../module'; import Section from 'salix/components/section'; export default class Controller extends Section { + get checked() { + const rows = this.$.model.data || []; + const checkedRows = []; + for (let row of rows) { + if (row.checked) + checkedRows.push(row.id); + } + + return checkedRows; + } + + get totalChecked() { + return this.checked.length; + } + preview(invoiceOut) { this.selectedInvoiceOut = invoiceOut; this.$.summary.show(); } - openPdf(id) { - let url = `api/InvoiceOuts/${id}/download?access_token=${this.vnToken.token}`; - window.open(url, '_blank'); + openPdf() { + if (this.checked.length <= 1) { + const [invoiceOutId] = this.checked; + const url = `api/InvoiceOuts/${invoiceOutId}/download?access_token=${this.vnToken.token}`; + window.open(url, '_blank'); + } else { + const invoiceOutIds = this.checked; + const invoicesIds = invoiceOutIds.join(','); + const serializedParams = this.$httpParamSerializer({ + access_token: this.vnToken.token, + ids: invoicesIds + }); + const url = `api/InvoiceOuts/downloadZip?${serializedParams}`; + window.open(url, '_blank'); + } } } diff --git a/modules/invoiceOut/front/index/locale/es.yml b/modules/invoiceOut/front/index/locale/es.yml index 1460b90d8..74572da49 100644 --- a/modules/invoiceOut/front/index/locale/es.yml +++ b/modules/invoiceOut/front/index/locale/es.yml @@ -6,3 +6,4 @@ Minimum: Minimo Maximum: Máximo Global invoicing: Facturación global Manual invoicing: Facturación manual +Files are too large: Los archivos son demasiado grandes \ No newline at end of file diff --git a/modules/invoiceOut/front/index/manual/index.html b/modules/invoiceOut/front/index/manual/index.html index 3148d3f94..37e6fa119 100644 --- a/modules/invoiceOut/front/index/manual/index.html +++ b/modules/invoiceOut/front/index/manual/index.html @@ -14,11 +14,11 @@ data="taxAreas" order="code"> -
- + Invoicing in progress...
@@ -80,4 +80,4 @@ - \ No newline at end of file + diff --git a/modules/invoiceOut/front/index/manual/index.js b/modules/invoiceOut/front/index/manual/index.js index ed50e37da..3abe4b825 100644 --- a/modules/invoiceOut/front/index/manual/index.js +++ b/modules/invoiceOut/front/index/manual/index.js @@ -8,7 +8,7 @@ class Controller extends Dialog { this.isInvoicing = false; this.invoice = { - maxShipped: new Date() + maxShipped: Date.vnNew() }; } diff --git a/modules/invoiceOut/front/index/manual/style.scss b/modules/invoiceOut/front/index/manual/style.scss index 18e6f3513..820c07756 100644 --- a/modules/invoiceOut/front/index/manual/style.scss +++ b/modules/invoiceOut/front/index/manual/style.scss @@ -14,4 +14,4 @@ } } } -} \ No newline at end of file +} diff --git a/modules/invoiceOut/front/main/index.html b/modules/invoiceOut/front/main/index.html index 7f3e67f35..ab3fce9ea 100644 --- a/modules/invoiceOut/front/main/index.html +++ b/modules/invoiceOut/front/main/index.html @@ -2,7 +2,7 @@ vn-id="model" url="InvoiceOuts/filter" limit="20" - order="issued DESC"> + order="issued DESC, id DESC"> {{ticket.shipped | date: 'dd/MM/yyyy' | dashIfEmpty}} - {{ticket.totalWithVat | currency: 'EUR': 2}} + {{ticket.totalWithVat | currency: 'EUR': 2}} diff --git a/modules/item/back/methods/fixed-price/getRate2.js b/modules/item/back/methods/fixed-price/getRate2.js new file mode 100644 index 000000000..c90a380e3 --- /dev/null +++ b/modules/item/back/methods/fixed-price/getRate2.js @@ -0,0 +1,39 @@ +module.exports = Self => { + Self.remoteMethod('getRate2', { + description: 'Return the rate2', + accessType: 'READ', + accepts: [ + { + arg: 'fixedPriceId', + type: 'integer', + description: 'The fixedPrice Id', + required: true + }, + { + arg: 'rate3', + type: 'number', + description: `The price rate 3`, + required: true + } + ], + returns: { + type: 'object', + root: true + }, + http: { + path: `/getRate2`, + verb: 'GET' + } + }); + + Self.getRate2 = async(fixedPriceId, rate3, options) => { + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const [result] = await Self.rawSql(`SELECT vn.priceFixed_getRate2(?, ?) as rate2`, + [fixedPriceId, rate3], myOptions); + return result; + }; +}; diff --git a/modules/item/back/methods/fixed-price/specs/getRate2.spec.js b/modules/item/back/methods/fixed-price/specs/getRate2.spec.js new file mode 100644 index 000000000..2f5dd93cd --- /dev/null +++ b/modules/item/back/methods/fixed-price/specs/getRate2.spec.js @@ -0,0 +1,39 @@ +const models = require('vn-loopback/server/server').models; + +describe('getRate2()', () => { + it(`should return new rate2 if exists rate`, async() => { + const tx = await models.FixedPrice.beginTransaction({}); + + try { + const options = {transaction: tx}; + const fixedPriceId = 1; + const rate3 = 2; + const result = await models.FixedPrice.getRate2(fixedPriceId, rate3, options); + + expect(result.rate2).toEqual(1.9); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it(`should return null if not exists rate`, async() => { + const tx = await models.FixedPrice.beginTransaction({}); + + try { + const options = {transaction: tx}; + const fixedPriceId = 13; + const rate3 = 2; + const result = await models.FixedPrice.getRate2(fixedPriceId, rate3, options); + + expect(result.rate2).toEqual(null); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/item/back/methods/fixed-price/specs/upsertFixedPrice.spec.js b/modules/item/back/methods/fixed-price/specs/upsertFixedPrice.spec.js index 68eacfbad..86f73122d 100644 --- a/modules/item/back/methods/fixed-price/specs/upsertFixedPrice.spec.js +++ b/modules/item/back/methods/fixed-price/specs/upsertFixedPrice.spec.js @@ -1,12 +1,24 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('upsertFixedPrice()', () => { - const now = new Date(); + const now = Date.vnNew(); const fixedPriceId = 1; let originalFixedPrice; beforeAll(async() => { originalFixedPrice = await models.FixedPrice.findById(fixedPriceId); + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); }); it(`should toggle the hasMinPrice boolean if there's a minPrice and update the rest of the data`, async() => { @@ -72,4 +84,45 @@ describe('upsertFixedPrice()', () => { throw e; } }); + + it(`should recalculate rate2 if change rate3`, async() => { + const tx = await models.FixedPrice.beginTransaction({}); + + const tomorrow = new Date(now); + tomorrow.setDate(tomorrow.getDate() + 1); + + const rate2 = 2; + const firstRate3 = 1; + const secondRate3 = 2; + try { + const options = {transaction: tx}; + const ctx = {args: { + id: undefined, + itemFk: 1, + warehouseFk: 1, + started: tomorrow, + ended: tomorrow, + rate2: rate2, + rate3: firstRate3, + minPrice: 0, + hasMinPrice: false + }}; + + // create new fixed price + const newFixedPrice = await models.FixedPrice.upsertFixedPrice(ctx, options); + + // change rate3 to same fixed price id + ctx.args.id = newFixedPrice.id; + ctx.args.rate3 = secondRate3; + + const result = await models.FixedPrice.upsertFixedPrice(ctx, options); + + expect(result.rate2).not.toEqual(rate2); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); }); diff --git a/modules/item/back/methods/fixed-price/upsertFixedPrice.js b/modules/item/back/methods/fixed-price/upsertFixedPrice.js index ad35ec3a1..eb3eec1bd 100644 --- a/modules/item/back/methods/fixed-price/upsertFixedPrice.js +++ b/modules/item/back/methods/fixed-price/upsertFixedPrice.js @@ -72,6 +72,16 @@ module.exports = Self => { try { delete args.ctx; // removed unwanted data + + if (args.id) { + const beforeFixedPrice = await models.FixedPrice.findById(args.id, {fields: ['rate3']}, myOptions); + const [result] = await Self.rawSql(`SELECT vn.priceFixed_getRate2(?, ?) as rate2`, + [args.id, args.rate3], myOptions); + + if (beforeFixedPrice.rate3 != args.rate3 && result && result.rate2) + args.rate2 = result.rate2; + } + const fixedPrice = await models.FixedPrice.upsert(args, myOptions); const targetItem = await models.Item.findById(args.itemFk, null, myOptions); diff --git a/modules/item/back/methods/item-image-queue/download.js b/modules/item/back/methods/item-image-queue/download.js new file mode 100644 index 000000000..cdc0fe049 --- /dev/null +++ b/modules/item/back/methods/item-image-queue/download.js @@ -0,0 +1,191 @@ +const axios = require('axios'); +const uuid = require('uuid'); +const fs = require('fs/promises'); +const { createWriteStream } = require('fs'); +const path = require('path'); +const gm = require('gm'); + +module.exports = Self => { + Self.remoteMethod('download', { + description: 'Processes the image download queue', + accessType: 'WRITE', + http: { + path: `/download`, + verb: 'POST', + }, + }); + + Self.download = async () => { + const models = Self.app.models; + const tempContainer = await models.TempContainer.container( + 'salix-image' + ); + const tempPath = path.join( + tempContainer.client.root, + tempContainer.name + ); + const maxAttempts = 3; + const collectionName = 'catalog'; + + const tx = await Self.beginTransaction({}); + + let tempFilePath; + let queueRow; + try { + const myOptions = { transaction: tx }; + + queueRow = await Self.findOne( + { + fields: ['id', 'itemFk', 'url', 'attempts'], + where: { + url: { neq: null }, + attempts: { + lt: maxAttempts, + }, + }, + order: 'priority, attempts, updated', + }, + myOptions + ); + + if (!queueRow) return; + + const collection = await models.ImageCollection.findOne( + { + fields: [ + 'id', + 'maxWidth', + 'maxHeight', + 'model', + 'property', + ], + where: { name: collectionName }, + include: { + relation: 'sizes', + scope: { + fields: ['width', 'height', 'crop'], + }, + }, + }, + myOptions + ); + + const fileName = `${uuid.v4()}.png`; + tempFilePath = path.join(tempPath, fileName); + + // Insert image row + await models.Image.create( + { + name: fileName, + collectionFk: collectionName, + updated: Date.vnNow(), + }, + myOptions + ); + + // Update item + const model = models[collection.model]; + if (!model) throw new Error('No matching model found'); + + const item = await model.findById(queueRow.itemFk, null, myOptions); + if (item) { + await item.updateAttribute( + collection.property, + fileName, + myOptions + ); + } + + // Download remote image + const response = await axios.get(queueRow.url, { + responseType: 'stream', + }); + + const writeStream = createWriteStream(tempFilePath); + await new Promise((resolve, reject) => { + writeStream.on('open', () => response.data.pipe(writeStream)); + writeStream.on('finish', () => resolve()); + writeStream.on('error', error => reject(error)); + }); + + // Resize + const container = await models.ImageContainer.container( + collectionName + ); + const rootPath = container.client.root; + const collectionDir = path.join(rootPath, collectionName); + + // To max size + const { maxWidth, maxHeight } = collection; + const fullSizePath = path.join(collectionDir, 'full'); + const toFullSizePath = `${fullSizePath}/${fileName}`; + + await fs.mkdir(fullSizePath, { recursive: true }); + await new Promise((resolve, reject) => { + gm(tempFilePath) + .resize(maxWidth, maxHeight, '>') + .setFormat('png') + .write(toFullSizePath, function (err) { + if (err) reject(err); + if (!err) resolve(); + }); + }); + + // To collection sizes + for (const size of collection.sizes()) { + const { width, height } = size; + + const sizePath = path.join(collectionDir, `${width}x${height}`); + const toSizePath = `${sizePath}/${fileName}`; + + await fs.mkdir(sizePath, { recursive: true }); + await new Promise((resolve, reject) => { + const gmInstance = gm(tempFilePath); + + if (size.crop) { + gmInstance + .resize(width, height, '^') + .gravity('Center') + .crop(width, height); + } + + if (!size.crop) gmInstance.resize(width, height, '>'); + + gmInstance + .setFormat('png') + .write(toSizePath, function (err) { + if (err) reject(err); + if (!err) resolve(); + }); + }); + } + + try { + await fs.unlink(tempFilePath); + } catch (error) { } + + await queueRow.destroy(myOptions); + + // Restart queue + Self.download(); + + await tx.commit(); + } catch (error) { + await tx.rollback(); + + if (queueRow.attempts < maxAttempts) { + await queueRow.updateAttributes({ + error: error, + attempts: queueRow.attempts + 1, + updated: Date.vnNew(), + }); + } + + try { + await fs.unlink(tempFilePath); + } catch (error) { } + + Self.download(); + } + }; +}; diff --git a/modules/item/back/methods/item-image-queue/downloadImages.js b/modules/item/back/methods/item-image-queue/downloadImages.js index 05b223598..7f53df95a 100644 --- a/modules/item/back/methods/item-image-queue/downloadImages.js +++ b/modules/item/back/methods/item-image-queue/downloadImages.js @@ -1,6 +1,7 @@ const https = require('https'); const fs = require('fs-extra'); const path = require('path'); +const uuid = require('uuid'); module.exports = Self => { Self.remoteMethod('downloadImages', { @@ -27,7 +28,7 @@ module.exports = Self => { }); for (let image of images) { - const currentStamp = new Date().getTime(); + const currentStamp = Date.vnNew().getTime(); const updatedStamp = image.updated.getTime(); const graceTime = Math.abs(currentStamp - updatedStamp); const maxTTL = 3600 * 48 * 1000; // 48 hours in ms; @@ -46,10 +47,8 @@ module.exports = Self => { if (!image) return; - const srcFile = image.url; - const fileName = srcFile.replace(/\.|\/|:|\?|\\|=|%/g, ''); - const file = `${fileName}.png`; - const filePath = path.join(tempPath, file); + const fileName = `${uuid.v4()}.png`; + const filePath = path.join(tempPath, fileName); const imageUrl = image.url.replace('http://', 'https://'); https.get(imageUrl, async response => { @@ -60,17 +59,10 @@ module.exports = Self => { } const writeStream = fs.createWriteStream(filePath); - writeStream.on('open', () => { - response.pipe(writeStream); - }); - - writeStream.on('error', async error => { - await errorHandler(image.itemFk, error, filePath); - }); - - writeStream.on('finish', async function() { - writeStream.end(); - }); + writeStream.on('open', () => response.pipe(writeStream)); + writeStream.on('error', async error => + await errorHandler(image.itemFk, error, filePath)); + writeStream.on('finish', () => writeStream.end()); writeStream.on('close', async function() { try { @@ -97,7 +89,7 @@ module.exports = Self => { await row.updateAttributes({ error: error, attempts: row.attempts + 1, - updated: new Date() + updated: Date.vnNew() }); } diff --git a/modules/item/back/methods/item-shelving-sale/filter.js b/modules/item/back/methods/item-shelving-sale/filter.js new file mode 100644 index 000000000..12029d33d --- /dev/null +++ b/modules/item/back/methods/item-shelving-sale/filter.js @@ -0,0 +1,49 @@ + +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; + +module.exports = Self => { + Self.remoteMethod('filter', { + description: 'Returns all item shelving sale matching with the filter', + accessType: 'READ', + accepts: [{ + arg: 'filter', + type: 'object', + description: 'Filter defining where and paginated data' + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/filter`, + verb: 'GET' + } + }); + + Self.filter = async(filter, options) => { + const conn = Self.dataSource.connector; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const stmt = new ParameterizedSQL(` + SELECT iss.created, + iss.saleFk, + iss.quantity, + iss.userFk, + ish.shelvingFk, + p.code, + u.name + FROM itemShelvingSale iss + LEFT JOIN itemShelving ish ON iss.itemShelvingFk = ish.id + LEFT JOIN shelving s ON ish.shelvingFk = s.code + LEFT JOIN parking p ON s.parkingFk = p.id + LEFT JOIN account.user u ON u.id = iss.userFk` + ); + + stmt.merge(conn.makeSuffix(filter)); + + return conn.executeStmt(stmt); + }; +}; diff --git a/modules/item/back/methods/item-shelving/deleteItemShelvings.js b/modules/item/back/methods/item-shelving/deleteItemShelvings.js new file mode 100644 index 000000000..f534b4e9a --- /dev/null +++ b/modules/item/back/methods/item-shelving/deleteItemShelvings.js @@ -0,0 +1,51 @@ +module.exports = Self => { + Self.remoteMethod('deleteItemShelvings', { + description: 'Deletes the selected item shelvings', + accessType: 'WRITE', + accepts: [{ + arg: 'itemShelvingIds', + type: ['number'], + required: true, + description: 'The itemShelving ids to delete' + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/deleteItemShelvings`, + verb: 'POST' + } + }); + + Self.deleteItemShelvings = async(itemShelvingIds, options) => { + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const promises = []; + for (let itemShelvingId of itemShelvingIds) { + const itemShelvingToDelete = models.ItemShelving.destroyById(itemShelvingId, myOptions); + promises.push(itemShelvingToDelete); + } + + const deletedItemShelvings = await Promise.all(promises); + + if (tx) await tx.commit(); + + return deletedItemShelvings; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/item/back/methods/item-shelving/specs/deleteItemShelvings.spec.js b/modules/item/back/methods/item-shelving/specs/deleteItemShelvings.spec.js new file mode 100644 index 000000000..b4113d7cf --- /dev/null +++ b/modules/item/back/methods/item-shelving/specs/deleteItemShelvings.spec.js @@ -0,0 +1,21 @@ +const models = require('vn-loopback/server/server').models; + +describe('ItemShelving deleteItemShelvings()', () => { + it('should return the deleted itemShelvings', async() => { + const tx = await models.Order.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const itemShelvingIds = [1, 2]; + const result = await models.ItemShelving.deleteItemShelvings(itemShelvingIds, options); + + expect(result.length).toEqual(2); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/item/back/methods/item/buyerWasteEmail.js b/modules/item/back/methods/item/buyerWasteEmail.js new file mode 100644 index 000000000..7f340de0f --- /dev/null +++ b/modules/item/back/methods/item/buyerWasteEmail.js @@ -0,0 +1,29 @@ +const {Email} = require('vn-print'); + +module.exports = Self => { + Self.remoteMethodCtx('buyerWasteEmail', { + description: 'Sends the buyer waste email', + accessType: 'WRITE', + accepts: [], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/buyer-waste-email', + verb: 'POST' + } + }); + + Self.buyerWasteEmail = async ctx => { + const models = Self.app.models; + const itemConfig = await models.ItemConfig.findOne(); + + const email = new Email('buyer-week-waste', { + recipient: itemConfig.wasteRecipients, + lang: ctx.req.getLocale() + }); + + return email.send(); + }; +}; diff --git a/modules/item/back/methods/item/clone.js b/modules/item/back/methods/item/clone.js index 3e6f3ab5a..6d07e83d3 100644 --- a/modules/item/back/methods/item/clone.js +++ b/modules/item/back/methods/item/clone.js @@ -42,7 +42,6 @@ module.exports = Self => { origin.itemTag = undefined; origin.description = undefined; - origin.image = undefined; origin.comment = undefined; origin.size = undefined; diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index 5755de69b..c0b1cc0d9 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -86,6 +86,7 @@ module.exports = Self => { Self.filter = async(ctx, filter, options) => { const conn = Self.dataSource.connector; + const models = Self.app.models; const myOptions = {}; if (typeof options == 'object') @@ -140,6 +141,8 @@ module.exports = Self => { filter = mergeFilters(filter, {where}); + const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions); + const stmts = []; const stmt = new ParameterizedSQL( `SELECT @@ -157,7 +160,7 @@ module.exports = Self => { i.subName, i.isActive, i.stems, - i.density, + i.weightByPiece, i.stemMultiplier, i.typeFk, i.isFloramondo, @@ -179,11 +182,11 @@ module.exports = Self => { LEFT JOIN intrastat intr ON intr.id = i.intrastatFk LEFT JOIN producer pr ON pr.id = i.producerFk LEFT JOIN origin ori ON ori.id = i.originFk - LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = it.warehouseFk + LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = ? LEFT JOIN buy b ON b.id = lb.buy_id LEFT JOIN entry e ON e.id = b.entryFk LEFT JOIN supplier s ON s.id = e.supplierFk` - ); + , [userConfig.warehouseFk]); if (ctx.args.tags) { let i = 1; diff --git a/modules/item/back/methods/item/getCard.js b/modules/item/back/methods/item/getCard.js index 8bb88fc86..c4ee09d95 100644 --- a/modules/item/back/methods/item/getCard.js +++ b/modules/item/back/methods/item/getCard.js @@ -30,7 +30,7 @@ module.exports = Self => { { relation: 'itemType', scope: { - fields: ['id', 'name', 'workerFk', 'warehouseFk'], + fields: ['id', 'name', 'workerFk'], include: [{ relation: 'worker', scope: { diff --git a/modules/item/back/methods/item/getSummary.js b/modules/item/back/methods/item/getSummary.js index ffcfc806e..6cd9d9511 100644 --- a/modules/item/back/methods/item/getSummary.js +++ b/modules/item/back/methods/item/getSummary.js @@ -34,7 +34,7 @@ module.exports = Self => { include: [ {relation: 'itemType', scope: { - fields: ['id', 'name', 'workerFk', 'warehouseFk'], + fields: ['id', 'name', 'workerFk'], include: [{ relation: 'worker', scope: { @@ -98,9 +98,8 @@ module.exports = Self => { summary.tags = res[1]; [summary.botanical] = res[2]; - const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions); - - res = await models.Item.getVisibleAvailable(summary.item.id, userConfig.warehouseFk, null, myOptions); + const itemConfig = await models.ItemConfig.findOne(null, myOptions); + res = await models.Item.getVisibleAvailable(summary.item.id, itemConfig.warehouseFk, undefined, myOptions); summary.available = res.available; summary.visible = res.visible; diff --git a/modules/item/back/methods/item/getVisibleAvailable.js b/modules/item/back/methods/item/getVisibleAvailable.js index b291ad9b4..612f64022 100644 --- a/modules/item/back/methods/item/getVisibleAvailable.js +++ b/modules/item/back/methods/item/getVisibleAvailable.js @@ -29,7 +29,7 @@ module.exports = Self => { } }); - Self.getVisibleAvailable = async(id, warehouseFk, dated = new Date(), options) => { + Self.getVisibleAvailable = async(id, warehouseFk, dated = Date.vnNew(), options) => { const myOptions = {}; if (typeof options == 'object') diff --git a/modules/item/back/methods/item/getWasteByItem.js b/modules/item/back/methods/item/getWasteByItem.js index b93d534da..56b90b04a 100644 --- a/modules/item/back/methods/item/getWasteByItem.js +++ b/modules/item/back/methods/item/getWasteByItem.js @@ -32,7 +32,7 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); const wastes = await Self.rawSql(` SELECT *, 100 * dwindle / total AS percentage @@ -43,7 +43,7 @@ module.exports = Self => { sum(ws.saleTotal) AS total, sum(ws.saleWaste) AS dwindle FROM bs.waste ws - WHERE buyer = ? AND family = ? + WHERE buyer = ? AND family = ? AND year = YEAR(TIMESTAMPADD(WEEK,-1, ?)) AND week = WEEK(TIMESTAMPADD(WEEK,-1, ?), 1) GROUP BY buyer, itemFk diff --git a/modules/item/back/methods/item/getWasteByWorker.js b/modules/item/back/methods/item/getWasteByWorker.js index 2b0b78974..8fa351eed 100644 --- a/modules/item/back/methods/item/getWasteByWorker.js +++ b/modules/item/back/methods/item/getWasteByWorker.js @@ -19,7 +19,7 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); const wastes = await Self.rawSql(` SELECT *, 100 * dwindle / total AS percentage @@ -30,11 +30,24 @@ module.exports = Self => { sum(ws.saleWaste) AS dwindle FROM bs.waste ws WHERE year = YEAR(TIMESTAMPADD(WEEK,-1, ?)) - AND week = WEEK(TIMESTAMPADD(WEEK,-1, ?), 1) + AND week = WEEK(TIMESTAMPADD(WEEK,-1, ?), 1) GROUP BY buyer, family ) sub ORDER BY percentage DESC`, [date, date], myOptions); + const wastesTotal = await Self.rawSql(` + SELECT *, 100 * dwindle / total AS percentage + FROM ( + SELECT buyer, + sum(ws.saleTotal) AS total, + sum(ws.saleWaste) AS dwindle + FROM bs.waste ws + WHERE year = YEAR(TIMESTAMPADD(WEEK,-1, ?)) + AND week = WEEK(TIMESTAMPADD(WEEK,-1, ?), 1) + GROUP BY buyer + ) sub + ORDER BY percentage DESC`, [date, date], myOptions); + const details = []; for (let waste of wastes) { @@ -55,6 +68,14 @@ module.exports = Self => { buyerDetail.lines.push(waste); } + for (let waste of details) { + let buyerTotal = wastesTotal.find(totals => { + return waste.buyer == totals.buyer; + }); + + Object.assign(waste, buyerTotal); + } + return details; }; }; diff --git a/modules/item/back/methods/item/labelPdf.js b/modules/item/back/methods/item/labelPdf.js new file mode 100644 index 000000000..c2462353d --- /dev/null +++ b/modules/item/back/methods/item/labelPdf.js @@ -0,0 +1,58 @@ +module.exports = Self => { + Self.remoteMethodCtx('labelPdf', { + description: 'Returns the item label pdf', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The item id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + }, + { + arg: 'warehouseId', + type: 'number', + description: 'The warehouse id', + required: true + }, + { + arg: 'labelNumber', + type: 'number', + required: false + }, + { + arg: 'totalLabels', + type: 'number', + required: false + } + ], + 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/label-pdf', + verb: 'GET' + } + }); + + Self.labelPdf = (ctx, id) => Self.printReport(ctx, id, 'item-label'); +}; diff --git a/modules/item/back/methods/item/new.js b/modules/item/back/methods/item/new.js index 0771b6b14..d066f2c9f 100644 --- a/modules/item/back/methods/item/new.js +++ b/modules/item/back/methods/item/new.js @@ -37,7 +37,8 @@ module.exports = Self => { 'typeFk', 'intrastatFk', 'originFk', - 'relevancy' + 'priority', + 'tag' ]; for (const key in params) { @@ -46,9 +47,18 @@ module.exports = Self => { } try { + const itemConfig = await models.ItemConfig.findOne({fields: ['validPriorities']}, myOptions); + if (!itemConfig.validPriorities.includes(params.priority)) + throw new UserError(`Valid priorities: ${[...itemConfig.validPriorities]}`); + const provisionalName = params.provisionalName; delete params.provisionalName; + const itemType = await models.ItemType.findById(params.typeFk, {fields: ['isLaid']}, myOptions); + + params.isLaid = itemType.isLaid; + params.isPhotoRequested = true; + const item = await models.Item.create(params, myOptions); const typeTags = await models.ItemTypeTag.find({ @@ -59,13 +69,14 @@ module.exports = Self => { await Self.rawSql(query, null, myOptions); - let nameTag = await models.Tag.findOne({where: {name: 'Nombre temporal'}}); + const nameTag = await models.Tag.findById(params.tag, {fields: ['id']}, myOptions); let newTags = []; - newTags.push({itemFk: item.id, tagFk: nameTag.id, value: provisionalName, priority: '2'}); + newTags.push({itemFk: item.id, tagFk: nameTag.id, value: provisionalName, priority: item.priority}); typeTags.forEach(typeTag => { - newTags.push({itemFk: item.id, tagFk: typeTag.tagFk, value: '', priority: typeTag.priority}); + if (nameTag.id != typeTag.tagFk) + newTags.push({itemFk: item.id, tagFk: typeTag.tagFk, value: '', priority: typeTag.priority}); }); await models.ItemTag.create(newTags, myOptions); diff --git a/modules/item/back/methods/item/regularize.js b/modules/item/back/methods/item/regularize.js index 0878e3242..dfbcaa69f 100644 --- a/modules/item/back/methods/item/regularize.js +++ b/modules/item/back/methods/item/regularize.js @@ -94,8 +94,8 @@ module.exports = Self => { } async function createTicket(ctx, options) { - ctx.args.shipped = new Date(); - ctx.args.landed = new Date(); + ctx.args.shipped = Date.vnNew(); + ctx.args.landed = Date.vnNew(); ctx.args.companyId = null; ctx.args.agencyModeId = null; ctx.args.routeId = null; @@ -106,10 +106,10 @@ module.exports = Self => { } async function getTicketId(params, options) { - const minDate = new Date(); + const minDate = Date.vnNew(); minDate.setHours(0, 0, 0, 0); - const maxDate = new Date(); + const maxDate = Date.vnNew(); maxDate.setHours(23, 59, 59, 59); let ticket = await Self.app.models.Ticket.findOne({ diff --git a/modules/item/back/methods/item/specs/clone.spec.js b/modules/item/back/methods/item/specs/clone.spec.js index d376b9e5b..01210677e 100644 --- a/modules/item/back/methods/item/specs/clone.spec.js +++ b/modules/item/back/methods/item/specs/clone.spec.js @@ -1,7 +1,21 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('item clone()', () => { let nextItemId; + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); beforeEach(async() => { let query = `SELECT i1.id + 1 as id FROM vn.item i1 @@ -21,7 +35,7 @@ describe('item clone()', () => { const result = await models.Item.clone(itemFk, options); expect(result.id).toEqual(nextItemId); - expect(result.image).toBeUndefined(); + expect(result.image).toBeDefined(); expect(result.itemTag).toBeUndefined(); expect(result.comment).toBeUndefined(); expect(result.description).toBeUndefined(); diff --git a/modules/item/back/methods/item/specs/filter.spec.js b/modules/item/back/methods/item/specs/filter.spec.js index 6a173576d..14467d1d8 100644 --- a/modules/item/back/methods/item/specs/filter.spec.js +++ b/modules/item/back/methods/item/specs/filter.spec.js @@ -7,7 +7,7 @@ describe('item filter()', () => { try { const filter = {}; - const ctx = {args: {filter: filter, search: 1}}; + const ctx = {args: {filter: filter, search: 1}, req: {accessToken: {userId: 1}}}; const result = await models.Item.filter(ctx, filter, options); expect(result.length).toEqual(1); @@ -26,7 +26,7 @@ describe('item filter()', () => { try { const filter = {}; - const ctx = {args: {filter: filter, search: 4444444444}}; + const ctx = {args: {filter: filter, search: 4444444444}, req: {accessToken: {userId: 1}}}; const result = await models.Item.filter(ctx, filter, options); expect(result.length).toEqual(1); @@ -49,7 +49,7 @@ describe('item filter()', () => { limit: 8 }; const tags = [{value: 'medical box', tagFk: 58}]; - const ctx = {args: {filter: filter, typeFk: 5, tags: tags}}; + const ctx = {args: {filter: filter, typeFk: 5, tags: tags}, req: {accessToken: {userId: 1}}}; const result = await models.Item.filter(ctx, filter, options); expect(result.length).toEqual(2); @@ -67,7 +67,7 @@ describe('item filter()', () => { try { const filter = {}; - const ctx = {args: {filter: filter, isFloramondo: true}}; + const ctx = {args: {filter: filter, isFloramondo: true}, req: {accessToken: {userId: 1}}}; const result = await models.Item.filter(ctx, filter, options); expect(result.length).toEqual(3); @@ -86,7 +86,7 @@ describe('item filter()', () => { try { const filter = {}; - const ctx = {args: {filter: filter, buyerFk: 16}}; + const ctx = {args: {filter: filter, buyerFk: 16}, req: {accessToken: {userId: 1}}}; const result = await models.Item.filter(ctx, filter, options); expect(result.length).toEqual(2); @@ -106,7 +106,7 @@ describe('item filter()', () => { try { const filter = {}; - const ctx = {args: {filter: filter, supplierFk: 1}}; + const ctx = {args: {filter: filter, supplierFk: 1}, req: {accessToken: {userId: 1}}}; const result = await models.Item.filter(ctx, filter, options); expect(result.length).toEqual(2); diff --git a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js index 8e4864ee8..61bf6b3e7 100644 --- a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js +++ b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js @@ -8,11 +8,11 @@ describe('item getVisibleAvailable()', () => { try { const itemFk = 1; const warehouseFk = 1; - const dated = new Date(); + const dated = Date.vnNew(); const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options); - expect(result.available).toEqual(187); + expect(result.available).toEqual(185); expect(result.visible).toEqual(92); await tx.rollback(); @@ -29,7 +29,7 @@ describe('item getVisibleAvailable()', () => { try { const itemFk = 1; const warehouseFk = 1; - const dated = new Date(); + const dated = Date.vnNew(); dated.setDate(dated.getDate() - 1); const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options); diff --git a/modules/item/back/methods/item/specs/getWasteByWorker.spec.js b/modules/item/back/methods/item/specs/getWasteByWorker.spec.js index c8b9d5e15..52f806bd3 100644 --- a/modules/item/back/methods/item/specs/getWasteByWorker.spec.js +++ b/modules/item/back/methods/item/specs/getWasteByWorker.spec.js @@ -12,6 +12,7 @@ describe('Item getWasteByWorker()', () => { const anyResult = result[Math.floor(Math.random() * Math.floor(length))]; expect(anyResult.buyer).toMatch(/(CharlesXavier|HankPym|DavidCharlesHaller)/); + expect(anyResult.total).toBeGreaterThanOrEqual(1000); expect(anyResult.lines.length).toBeGreaterThanOrEqual(3); await tx.rollback(); diff --git a/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js b/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js index 25e661aee..00488e534 100644 --- a/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js +++ b/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js @@ -1,9 +1,9 @@ const {models} = require('vn-loopback/server/server'); describe('item lastEntriesFilter()', () => { it('should return one entry for the given item', async() => { - const minDate = new Date(); + const minDate = Date.vnNew(); minDate.setHours(0, 0, 0, 0); - const maxDate = new Date(); + const maxDate = Date.vnNew(); maxDate.setHours(23, 59, 59, 59); const tx = await models.Item.beginTransaction({}); @@ -23,11 +23,11 @@ describe('item lastEntriesFilter()', () => { }); it('should return five entries for the given item', async() => { - const minDate = new Date(); + const minDate = Date.vnNew(); minDate.setHours(0, 0, 0, 0); minDate.setMonth(minDate.getMonth() - 2, 1); - const maxDate = new Date(); + const maxDate = Date.vnNew(); maxDate.setHours(23, 59, 59, 59); const tx = await models.Item.beginTransaction({}); diff --git a/modules/item/back/methods/item/specs/new.spec.js b/modules/item/back/methods/item/specs/new.spec.js index 049ad0ff2..a1c741649 100644 --- a/modules/item/back/methods/item/specs/new.spec.js +++ b/modules/item/back/methods/item/specs/new.spec.js @@ -1,6 +1,21 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('item new()', () => { + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + it('should create a new item, adding the name as a tag', async() => { const tx = await models.Item.beginTransaction({}); const options = {transaction: tx}; @@ -11,11 +26,17 @@ describe('item new()', () => { originFk: 1, provisionalName: 'planta', typeFk: 2, - relevancy: 0 + priority: 2, + tag: 1 }; let item = await models.Item.new(itemParams, options); - const temporalNameTag = await models.Tag.findOne({where: {name: 'Nombre temporal'}}, options); + + let itemType = await models.ItemType.findById(item.typeFk, options); + + item.isLaid = itemType.isLaid; + + const temporalNameTag = await models.Tag.findById(itemParams.tag, {fields: ['id']}, options); const temporalName = await models.ItemTag.findOne({ where: { @@ -26,9 +47,14 @@ describe('item new()', () => { item = await models.Item.findById(item.id, null, options); + itemType = await models.ItemType.findById(item.typeFk, {fields: ['isLaid']}, options); + + item.isLaid = itemType.isLaid; + expect(item.intrastatFk).toEqual(5080000); expect(item.originFk).toEqual(1); expect(item.typeFk).toEqual(2); + expect(item.isLaid).toBeFalse(); expect(item.name).toEqual('planta'); expect(temporalName.value).toEqual('planta'); diff --git a/modules/item/back/methods/item/specs/regularize.spec.js b/modules/item/back/methods/item/specs/regularize.spec.js index ea0cdfa5a..e7df9a003 100644 --- a/modules/item/back/methods/item/specs/regularize.spec.js +++ b/modules/item/back/methods/item/specs/regularize.spec.js @@ -1,6 +1,21 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('regularize()', () => { + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 18}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + it('should create a new ticket and add a line', async() => { const tx = await models.Item.beginTransaction({}); const options = {transaction: tx}; diff --git a/modules/item/back/methods/tag/onSubmit.js b/modules/item/back/methods/tag/onSubmit.js new file mode 100644 index 000000000..7abbe60d4 --- /dev/null +++ b/modules/item/back/methods/tag/onSubmit.js @@ -0,0 +1,81 @@ + +module.exports = function(Self) { + Self.remoteMethodCtx('onSubmit', { + description: 'Save model changes', + accessType: 'WRITE', + accepts: [ + { + arg: 'creates', + type: ['object'], + description: 'The itemTags records to create' + }, { + arg: 'deletes', + type: ['number'], + description: 'The itemTags ids to delete' + }, { + arg: 'updates', + type: ['object'], + description: 'The itemTags records to update' + }, { + arg: 'maxPriority', + type: 'number', + description: 'The maxPriority value' + } + ], + returns: { + root: true, + type: 'object' + }, + http: { + verb: 'PATCH', + path: '/onSubmit' + } + }); + + Self.onSubmit = async(ctx, options) => { + const models = Self.app.models; + const args = ctx.args; + let tx; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + if (args.deletes) { + for (const itemTagId of args.deletes) + await models.ItemTag.destroyById(itemTagId, myOptions); + } + + if (args.updates) { + for (const row of args.updates) { + if (row.data.priority) { + const itemTag = await models.ItemTag.findById(row.where.id, null, myOptions); + await itemTag.updateAttributes({ + priority: row.data.priority + args.maxPriority + }, myOptions); + } + } + for (const row of args.updates) { + const itemTag = await models.ItemTag.findById(row.where.id, null, myOptions); + await itemTag.updateAttributes(row.data, myOptions); + } + } + + if (args.creates) { + for (const itemTag of args.creates) + await models.ItemTag.create(itemTag, myOptions); + } + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/item/back/methods/tag/specs/onSubmit.spec.js b/modules/item/back/methods/tag/specs/onSubmit.spec.js new file mode 100644 index 000000000..f24aad7e4 --- /dev/null +++ b/modules/item/back/methods/tag/specs/onSubmit.spec.js @@ -0,0 +1,96 @@ +const models = require('vn-loopback/server/server').models; + +describe('tag onSubmit()', () => { + it('should delete a tag', async() => { + const tx = await models.Item.beginTransaction({}); + const options = {transaction: tx}; + + try { + const deletes = [40]; + const ctx = { + args: { + deletes: deletes + } + }; + await models.Tag.onSubmit(ctx, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should update a tag', async() => { + const tx = await models.Item.beginTransaction({}); + const options = {transaction: tx}; + + try { + const updates = [{data: {value: 'Container Test'}, where: {id: 36}}]; + const ctx = { + args: { + updates: updates + } + }; + await models.Tag.onSubmit(ctx, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should create a tag', async() => { + const tx = await models.Item.beginTransaction({}); + const options = {transaction: tx}; + + try { + const creates = [{ + 'itemFk': '6', + 'priority': 8, + '$orgIndex': null, + '$oldData': null, + '$isNew': true, + 'tagFk': 3, + 'value': 'madera' + }]; + const ctx = { + args: { + creates: creates + } + }; + await models.Tag.onSubmit(ctx, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should swap priority for two tags', async() => { + const tx = await models.Item.beginTransaction({}); + const options = {transaction: tx}; + + try { + const updates = [ + {data: {priority: 2}, where: {id: 36}}, + {data: {priority: 1}, where: {id: 37}} + ]; + const ctx = { + args: { + updates: updates, + maxPriority: 7, + + } + }; + await models.Tag.onSubmit(ctx, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/item/back/model-config.json b/modules/item/back/model-config.json index 004aeb4b9..40d73f1a6 100644 --- a/modules/item/back/model-config.json +++ b/modules/item/back/model-config.json @@ -23,6 +23,9 @@ "ItemCategory": { "dataSource": "vn" }, + "ItemConfig": { + "dataSource": "vn" + }, "ItemFamily": { "dataSource": "vn" }, @@ -32,9 +35,6 @@ "ItemPackingType": { "dataSource": "vn" }, - "ItemPlacement": { - "dataSource": "vn" - }, "ItemTag": { "dataSource": "vn" }, @@ -53,6 +53,9 @@ "ItemShelvingSale": { "dataSource": "vn" }, + "ItemShelvingPlacementSupplyStock": { + "dataSource": "vn" + }, "ItemImageQueue": { "dataSource": "vn" }, diff --git a/modules/item/back/models/expense.json b/modules/item/back/models/expense.json index 368876fbe..03147c08b 100644 --- a/modules/item/back/models/expense.json +++ b/modules/item/back/models/expense.json @@ -18,12 +18,5 @@ "isWithheld": { "type": "number" } - }, - "relations": { - "taxType": { - "type": "belongsTo", - "model": "TaxType", - "foreignKey": "taxTypeFk" - } } } \ No newline at end of file diff --git a/modules/item/back/models/fixed-price.js b/modules/item/back/models/fixed-price.js index 9c78c586f..91010805f 100644 --- a/modules/item/back/models/fixed-price.js +++ b/modules/item/back/models/fixed-price.js @@ -1,4 +1,5 @@ module.exports = Self => { require('../methods/fixed-price/filter')(Self); require('../methods/fixed-price/upsertFixedPrice')(Self); + require('../methods/fixed-price/getRate2')(Self); }; diff --git a/modules/item/back/models/item-config.json b/modules/item/back/models/item-config.json new file mode 100644 index 000000000..7ad1d8785 --- /dev/null +++ b/modules/item/back/models/item-config.json @@ -0,0 +1,40 @@ +{ + "name": "ItemConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "itemConfig" + } + }, + "properties": { + "isItemTagTriggerDisabled": { + "type": "boolean" + }, + "monthToDeactivate": { + "type": "boolean" + }, + "wasteRecipients": { + "type": "string", + "description": "Buyers waste report recipients" + }, + "validPriorities": { + "type": "array" + }, + "defaultPriority": { + "type": "number" + }, + "defaultTag": { + "type": "number" + }, + "warehouseFk": { + "type": "number" + } + }, + "relations": { + "tag": { + "type": "belongsTo", + "model": "Tag", + "foreignKey": "defaultTag" + } + } +} diff --git a/modules/item/back/models/item-image-queue.js b/modules/item/back/models/item-image-queue.js index e2059ddac..35a467693 100644 --- a/modules/item/back/models/item-image-queue.js +++ b/modules/item/back/models/item-image-queue.js @@ -1,3 +1,3 @@ module.exports = Self => { - require('../methods/item-image-queue/downloadImages')(Self); + require('../methods/item-image-queue/download')(Self); }; diff --git a/modules/item/back/models/item-packing-type.json b/modules/item/back/models/item-packing-type.json index d77c37dd8..da435db24 100644 --- a/modules/item/back/models/item-packing-type.json +++ b/modules/item/back/models/item-packing-type.json @@ -13,6 +13,9 @@ }, "description": { "type": "string" + }, + "isActive":{ + "type": "boolean" } }, "acls": [ @@ -23,4 +26,4 @@ "permission": "ALLOW" } ] -} \ No newline at end of file +} diff --git a/modules/item/back/models/item-placement.json b/modules/item/back/models/item-placement.json deleted file mode 100644 index 0c036ef14..000000000 --- a/modules/item/back/models/item-placement.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "ItemPlacement", - "base": "VnModel", - "options": { - "mysql": { - "table": "itemPlacement" - } - }, - "properties": { - "id": { - "type": "number", - "id": true - }, - "code": { - "type": "string" - }, - "itemFk": { - "type": "number" - }, - "warehouseFk": { - "type": "number" - } - }, - "relations": { - "item": { - "type": "belongsTo", - "model": "Item", - "foreignKey": "itemFk" - }, - "warehouse": { - "type": "belongsTo", - "model": "Warehouse", - "foreignKey": "warehouseFk" - } - } -} \ No newline at end of file diff --git a/modules/item/back/models/item-shelving-placement-supply.json b/modules/item/back/models/item-shelving-placement-supply.json new file mode 100644 index 000000000..a54013e05 --- /dev/null +++ b/modules/item/back/models/item-shelving-placement-supply.json @@ -0,0 +1,36 @@ +{ + "name": "ItemShelvingPlacementSupplyStock", + "base": "VnModel", + "options": { + "mysql": { + "table": "itemShelvingPlacementSupplyStock" + } + }, + "properties": { + "itemShelvingFk": { + "type": "number", + "id": true + }, + "created": { + "type": "date" + }, + "itemFk": { + "type": "number" + }, + "longName": { + "type": "string" + }, + "parking": { + "type": "string" + }, + "shelving": { + "type": "string" + }, + "packing": { + "type": "number" + }, + "stock": { + "type": "number" + } + } +} \ No newline at end of file diff --git a/modules/item/back/models/item-shelving-sale.js b/modules/item/back/models/item-shelving-sale.js new file mode 100644 index 000000000..b89be9f00 --- /dev/null +++ b/modules/item/back/models/item-shelving-sale.js @@ -0,0 +1,3 @@ +module.exports = Self => { + require('../methods/item-shelving-sale/filter')(Self); +}; diff --git a/modules/item/back/models/item-shelving.js b/modules/item/back/models/item-shelving.js new file mode 100644 index 000000000..5f372a3be --- /dev/null +++ b/modules/item/back/models/item-shelving.js @@ -0,0 +1,3 @@ +module.exports = Self => { + require('../methods/item-shelving/deleteItemShelvings')(Self); +}; diff --git a/modules/item/back/models/item-shelving.json b/modules/item/back/models/item-shelving.json index 951a4553a..0890350da 100644 --- a/modules/item/back/models/item-shelving.json +++ b/modules/item/back/models/item-shelving.json @@ -12,21 +12,12 @@ "id": true, "description": "Identifier" }, - "shelve": { - "type": "string" - }, "shelvingFk": { "type": "string" }, "itemFk": { "type": "number" }, - "deep": { - "type": "number" - }, - "quantity": { - "type": "number" - }, "created": { "type": "date" } @@ -41,6 +32,11 @@ "type": "belongsTo", "model": "Account", "foreignKey": "userFk" - } + }, + "shelving": { + "type": "belongsTo", + "model": "Shelving", + "foreignKey": "shelvingFk" + } } } diff --git a/modules/item/back/models/item-tag.js b/modules/item/back/models/item-tag.js index 891d11558..5b7163913 100644 --- a/modules/item/back/models/item-tag.js +++ b/modules/item/back/models/item-tag.js @@ -5,7 +5,7 @@ module.exports = Self => { Self.rewriteDbError(function(err) { if (err.code === 'ER_DUP_ENTRY') - return new UserError(`The tag can't be repeated`); + return new UserError(`The tag or priority can't be repeated for an item`); if (err.code === 'ER_BAD_NULL_ERROR') return new UserError(`Tag value cannot be blank`); return err; diff --git a/modules/item/back/models/item-type.json b/modules/item/back/models/item-type.json index 843d9877f..c5c920b2f 100644 --- a/modules/item/back/models/item-type.json +++ b/modules/item/back/models/item-type.json @@ -26,6 +26,9 @@ }, "isUnconventionalSize": { "type": "number" + }, + "isLaid": { + "type": "boolean" } }, "relations": { @@ -34,11 +37,6 @@ "model": "Worker", "foreignKey": "workerFk" }, - "warehouse": { - "type": "belongsTo", - "model": "Warehouse", - "foreignKey": "warehouseFk" - }, "category": { "type": "belongsTo", "model": "ItemCategory", diff --git a/modules/item/back/models/item.js b/modules/item/back/models/item.js index 457cce4f2..b8baa97ea 100644 --- a/modules/item/back/models/item.js +++ b/modules/item/back/models/item.js @@ -15,6 +15,8 @@ module.exports = Self => { require('../methods/item/getWasteByItem')(Self); require('../methods/item/createIntrastat')(Self); require('../methods/item/activeBuyers')(Self); + require('../methods/item/buyerWasteEmail')(Self); + require('../methods/item/labelPdf')(Self); Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'}); diff --git a/modules/item/back/models/item.json b/modules/item/back/models/item.json index 01b6ba093..d6b3c27ad 100644 --- a/modules/item/back/models/item.json +++ b/modules/item/back/models/item.json @@ -3,7 +3,8 @@ "base": "Loggable", "log": { "model": "ItemLog", - "showField": "id" + "showField": "id", + "grabUser": true }, "options": { "mysql": { @@ -53,9 +54,9 @@ "type": "number", "description": "Relevancy" }, - "density": { + "weightByPiece": { "type": "number", - "description": "Density" + "description": "WeightByPiece" }, "stemMultiplier": { "type": "number", @@ -143,6 +144,15 @@ }, "packingShelve": { "type": "number" + }, + "isLaid": { + "type": "boolean" + }, + "isPhotoRequested": { + "type": "boolean", + "mysql":{ + "columnName": "doPhoto" + } } }, "relations": { @@ -211,4 +221,4 @@ } } } -} \ No newline at end of file +} diff --git a/modules/item/back/models/tag.js b/modules/item/back/models/tag.js index 43fbc0db3..92760e34f 100644 --- a/modules/item/back/models/tag.js +++ b/modules/item/back/models/tag.js @@ -1,3 +1,4 @@ module.exports = Self => { require('../methods/tag/filterValue')(Self); + require('../methods/tag/onSubmit')(Self); }; diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index 22fd33a07..974aa37d8 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -1,6 +1,6 @@ - - @@ -95,7 +95,7 @@ @@ -108,15 +108,15 @@
@@ -124,9 +124,15 @@ + + + +
@@ -193,7 +205,7 @@ - @@ -226,12 +238,12 @@ - \ No newline at end of file + diff --git a/modules/item/front/basic-data/locale/es.yml b/modules/item/front/basic-data/locale/es.yml index d59752ebb..747dfe792 100644 --- a/modules/item/front/basic-data/locale/es.yml +++ b/modules/item/front/basic-data/locale/es.yml @@ -11,4 +11,6 @@ Identifier: Identificador Fragile: Frágil Is shown at website, app that this item cannot travel (wreath, palms, ...): Se muestra en la web, app que este artículo no puede viajar (coronas, palmas, ...) Multiplier: Multiplicador -Generic: Genérico \ No newline at end of file +Generic: Genérico +This item does need a photo: Este artículo necesita una foto +Do photo: Hacer foto \ No newline at end of file diff --git a/modules/item/front/card/index.html b/modules/item/front/card/index.html index e92e1696d..330d274c0 100644 --- a/modules/item/front/card/index.html +++ b/modules/item/front/card/index.html @@ -1,6 +1,6 @@ - diff --git a/modules/item/front/card/index.js b/modules/item/front/card/index.js index 8b32e030b..2fe42fd04 100644 --- a/modules/item/front/card/index.js +++ b/modules/item/front/card/index.js @@ -5,6 +5,25 @@ class Controller extends ModuleCard { reload() { this.$http.get(`Items/${this.$params.id}/getCard`) .then(res => this.item = res.data); + + this.$http.get('ItemConfigs/findOne') + .then(res => { + if (this.$state.getCurrentPath()[4].state.name === 'item.card.diary') return; + this.warehouseFk = res.data.warehouseFk; + this.getWarehouseName(res.data.warehouseFk); + }); + } + + getWarehouseName(warehouseFk) { + const filter = { + where: {id: warehouseFk} + }; + this.$http.get('Warehouses/findOne', {filter}) + .then(res => { + this.warehouseText = this.$t('WarehouseFk', { + warehouseName: res.data.name + }); + }); } } diff --git a/modules/item/front/card/index.spec.js b/modules/item/front/card/index.spec.js index 2c97f5935..6ebce3d36 100644 --- a/modules/item/front/card/index.spec.js +++ b/modules/item/front/card/index.spec.js @@ -4,12 +4,15 @@ describe('Item', () => { describe('Component vnItemCard', () => { let controller; let $httpBackend; + let $state; let data = {id: 1, name: 'fooName'}; beforeEach(ngModule('item')); - beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => { + beforeEach(inject(($componentController, _$httpBackend_, $stateParams, _$state_) => { $httpBackend = _$httpBackend_; + $state = _$state_; + $state.getCurrentPath = () => [null, null, null, null, {state: {name: 'item.card.diary'}}]; let $element = angular.element('
'); controller = $componentController('vnItemCard', {$element}); @@ -19,6 +22,7 @@ describe('Item', () => { })); it('should request data and set it on the controller', () => { + $httpBackend.expect('GET', `ItemConfigs/findOne`).respond({}); controller.reload(); $httpBackend.flush(); diff --git a/modules/item/front/create/index.html b/modules/item/front/create/index.html index 6deaab1cd..15e212250 100644 --- a/modules/item/front/create/index.html +++ b/modules/item/front/create/index.html @@ -16,10 +16,24 @@ + + + + { + if (res.data) { + const dataRow = res.data[0]; + dataRow.validPriorities.forEach(priority => { + this.validPriorities.push({priority}); + }); + this.item = { + priority: dataRow.defaultPriority, + tag: dataRow.defaultTag + }; + } + }); } onSubmit() { diff --git a/modules/item/front/descriptor/index.html b/modules/item/front/descriptor/index.html index 321545b38..8e85e043f 100644 --- a/modules/item/front/descriptor/index.html +++ b/modules/item/front/descriptor/index.html @@ -19,7 +19,7 @@
Available

{{$ctrl.available | dashIfEmpty}}

+ +

+ + +

+
- {{$ctrl.item.itemType.worker.user.name}} @@ -50,22 +60,22 @@
@@ -112,7 +122,7 @@ question="Do you want to clone this item?" message="All it's properties will be copied"> - @@ -120,7 +130,7 @@ - - \ No newline at end of file + diff --git a/modules/item/front/descriptor/index.js b/modules/item/front/descriptor/index.js index 133b11b48..5f38d08dd 100644 --- a/modules/item/front/descriptor/index.js +++ b/modules/item/front/descriptor/index.js @@ -30,7 +30,10 @@ class Controller extends Descriptor { set warehouseFk(value) { this._warehouseFk = value; - if (value) this.updateStock(); + if (value) { + this.updateStock(); + this.getWarehouseName(value); + } } loadData() { @@ -80,7 +83,7 @@ class Controller extends Descriptor { } onUploadResponse() { - const timestamp = new Date().getTime(); + const timestamp = Date.vnNew().getTime(); const src = this.$rootScope.imagePath('catalog', '200x200', this.item.id); const zoomSrc = this.$rootScope.imagePath('catalog', '1600x900', this.item.id); const newSrc = `${src}&t=${timestamp}`; @@ -88,6 +91,25 @@ class Controller extends Descriptor { this.$.photo.setAttribute('src', newSrc); this.$.photo.setAttribute('zoom-image', newZoomSrc); + + if (this.item.isPhotoRequested) + this.$http.patch(`Items/${this.item.id}`, {isPhotoRequested: false}); + } + + getWarehouseName(warehouseFk) { + this.showIcon = false; + + const filter = { + where: {id: warehouseFk} + }; + this.$http.get('Warehouses/findOne', {filter}) + .then(res => { + this.warehouseText = this.$t('WarehouseFk', { + warehouseName: res.data.name + }); + + this.showIcon = true; + }); } } @@ -100,6 +122,6 @@ ngModule.vnComponent('vnItemDescriptor', { item: '<', dated: '<', cardReload: '&', - warehouseFk: ' { id: 1, itemType: { warehouseFk: 1 - } + }, + isPhotoRequested: true }; const stock = { visible: 1, @@ -43,4 +44,16 @@ describe('vnItemDescriptor', () => { expect(controller.item).toEqual(item); }); }); + + describe('onUploadResponse()', () => { + it(`should change isPhotoRequested when a new photo is uploaded`, () => { + controller.item = item; + controller.$rootScope = {imagePath: () => {}}; + controller.$.photo = {setAttribute: () => {}}; + + $httpBackend.expectPATCH(`Items/${item.id}`).respond(200); + controller.onUploadResponse(); + $httpBackend.flush(); + }); + }); }); diff --git a/modules/item/front/diary/index.js b/modules/item/front/diary/index.js index 6d912ebe8..03134913f 100644 --- a/modules/item/front/diary/index.js +++ b/modules/item/front/diary/index.js @@ -7,7 +7,7 @@ class Controller extends Section { super($element, $scope); this.$anchorScroll = $anchorScroll; this.$location = $location; - let today = new Date(); + let today = Date.vnNew(); today.setHours(0, 0, 0, 0); this.today = today.toJSON(); } @@ -27,7 +27,7 @@ class Controller extends Section { if (this.$params.warehouseFk) this.warehouseFk = this.$params.warehouseFk; else if (value) - this.warehouseFk = value.itemType.warehouseFk; + this.warehouseFk = this.vnConfig.warehouseFk; if (this.$params.lineFk) this.lineFk = this.$params.lineFk; @@ -37,6 +37,7 @@ class Controller extends Section { set warehouseFk(value) { if (value && value != this._warehouseFk) { this._warehouseFk = value; + this.card.warehouseFk = value; this.$state.go(this.$state.current.name, { warehouseFk: value @@ -67,6 +68,11 @@ class Controller extends Section { this.$[descriptor].show(event.target, sale.origin); } + + $onDestroy() { + if (this.$state.getCurrentPath()[2].state.name === 'item') + this.card.reload(); + } } Controller.$inject = ['$element', '$scope', '$anchorScroll', '$location']; @@ -76,5 +82,8 @@ ngModule.vnComponent('vnItemDiary', { controller: Controller, bindings: { item: '<' + }, + require: { + card: '?^vnItemCard' } }); diff --git a/modules/item/front/diary/index.spec.js b/modules/item/front/diary/index.spec.js index 78dae0883..a6302346d 100644 --- a/modules/item/front/diary/index.spec.js +++ b/modules/item/front/diary/index.spec.js @@ -14,12 +14,14 @@ describe('Item', () => { controller = $componentController('vnItemDiary', {$element, $scope}); controller.$.model = crudModel; controller.$params = {id: 1}; + controller.card = {}; })); describe('set item()', () => { it('should set warehouseFk property based on itemType warehouseFk', () => { jest.spyOn(controller.$, '$applyAsync'); - controller.item = {id: 1, itemType: {warehouseFk: 1}}; + controller.vnConfig = {warehouseFk: 1}; + controller.item = {id: 1}; expect(controller.$.$applyAsync).toHaveBeenCalledWith(jasmine.any(Function)); $scope.$apply(); diff --git a/modules/item/front/fixed-price/index.html b/modules/item/front/fixed-price/index.html index 8127a76dc..ce7cefe7a 100644 --- a/modules/item/front/fixed-price/index.html +++ b/modules/item/front/fixed-price/index.html @@ -23,9 +23,9 @@
- @@ -34,21 +34,19 @@ - - - - + - + @@ -78,52 +79,52 @@ - - - - - + + + + - + + - @@ -408,22 +412,22 @@
Item ID + Description Warehouse - P.P.U. + + Grouping price - P.P.P. + + Packing price Min price @@ -72,7 +70,7 @@ show-field="name" value-field="id" search-function="$ctrl.itemSearchFunc($search)" - on-change="$ctrl.upsertPrice(price)" + on-change="$ctrl.upsertPrice(price, true)" order="id DESC" tabindex="1"> @@ -112,18 +110,32 @@ - - + + {{price.rate2 | currency: 'EUR':2}} + + + + + - - + + {{price.rate3 | currency: 'EUR':2}} + + + + + - + - \ No newline at end of file + diff --git a/modules/item/front/fixed-price/index.js b/modules/item/front/fixed-price/index.js index b84c2cc2d..df2989043 100644 --- a/modules/item/front/fixed-price/index.js +++ b/modules/item/front/fixed-price/index.js @@ -12,14 +12,6 @@ export default class Controller extends Section { }, defaultSearch: true, columns: [ - { - field: 'itemName', - autocomplete: { - url: 'Items', - showField: 'name', - valueField: 'id' - } - }, { field: 'warehouseFk', autocomplete: { @@ -70,7 +62,10 @@ export default class Controller extends Section { }); } - upsertPrice(price) { + upsertPrice(price, resetMinPrice) { + if (resetMinPrice) + delete price['minPrice']; + price.hasMinPrice = price.minPrice ? true : false; let requiredFields = ['itemFk', 'started', 'ended', 'rate2', 'rate3']; @@ -105,8 +100,8 @@ export default class Controller extends Section { exprBuilder(param, value) { switch (param) { - case 'itemName': - return {'i.id': value}; + case 'name': + return {'i.name': {like: `%${value}%`}}; case 'itemFk': case 'warehouseFk': case 'rate2': diff --git a/modules/item/front/fixed-price/index.spec.js b/modules/item/front/fixed-price/index.spec.js index 94621e352..42dd898b3 100644 --- a/modules/item/front/fixed-price/index.spec.js +++ b/modules/item/front/fixed-price/index.spec.js @@ -24,7 +24,7 @@ describe('fixed price', () => { }); it('should perform an http request to update the price', () => { - const now = new Date(); + const now = Date.vnNew(); jest.spyOn(controller.vnApp, 'showSuccess'); $httpBackend.expectPATCH('FixedPrices/upsertFixedPrice').respond(); diff --git a/modules/item/front/fixed-price/locale/es.yml b/modules/item/front/fixed-price/locale/es.yml index 3f400336d..6bdfcb678 100644 --- a/modules/item/front/fixed-price/locale/es.yml +++ b/modules/item/front/fixed-price/locale/es.yml @@ -3,5 +3,3 @@ Search prices by item ID or code: Buscar por ID de artículo o código Search fixed prices: Buscar precios fijados Add fixed price: Añadir precio fijado This row will be removed: Esta linea se eliminará -Price By Unit: Precio Por Unidad -Price By Package: Precio Por Paquete \ No newline at end of file diff --git a/modules/item/front/index.js b/modules/item/front/index.js index 6a8d1b3b7..d2ffcc8fb 100644 --- a/modules/item/front/index.js +++ b/modules/item/front/index.js @@ -24,3 +24,5 @@ import './waste/detail'; import './fixed-price'; import './fixed-price-search-panel'; import './item-type'; +import './item-shelving'; + diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index 750dbfc4d..6f5cce7c0 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -45,8 +45,8 @@ Buyer - Density + + Weight/Piece Multiplier @@ -117,7 +117,7 @@ {{::item.userName}} - {{::item.density}}{{::item.weightByPiece}} {{::item.stemMultiplier}} + + + + +
+
+
Total
+ + +
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + Created + + Item + + Concept + + Parking + + Shelving + + Etiqueta + + Packing +
+ + + {{::itemShelvingPlacementSupplyStock.created | date: 'dd/MM/yyyy'}} + {{::itemShelvingPlacementSupplyStock.itemFk}} + + + {{itemShelvingPlacementSupplyStock.longName}} + + + {{::itemShelvingPlacementSupplyStock.parking}} + + {{::itemShelvingPlacementSupplyStock.shelving}} + + {{(itemShelvingPlacementSupplyStock.stock / itemShelvingPlacementSupplyStock.packing).toFixed(2)}} + + {{::itemShelvingPlacementSupplyStock.packing}} +
+
+
+
+ + + + + \ No newline at end of file diff --git a/modules/item/front/item-shelving/index.js b/modules/item/front/item-shelving/index.js new file mode 100644 index 000000000..b8584039b --- /dev/null +++ b/modules/item/front/item-shelving/index.js @@ -0,0 +1,89 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section { + constructor($element, $) { + super($element, $); + + this.smartTableOptions = { + activeButtons: { + search: true + }, + columns: [ + { + field: 'parking', + autocomplete: { + url: 'Parkings', + showField: 'code', + valueField: 'code' + } + }, + { + field: 'shelving', + autocomplete: { + url: 'Shelvings', + showField: 'code', + valueField: 'code' + } + }, + { + field: 'created', + searchable: false + }, + { + field: 'itemFk', + searchable: false + }, + { + field: 'longName', + searchable: false + } + ] + }; + } + + get checked() { + const itemShelvings = this.$.model.data || []; + const checkedLines = []; + for (let itemShelving of itemShelvings) { + if (itemShelving.checked) + checkedLines.push(itemShelving.itemShelvingFk); + } + + return checkedLines; + } + + calculateTotals() { + this.labelTotal = 0; + const itemShelvings = this.$.model.data || []; + itemShelvings.forEach(itemShelving => { + const label = itemShelving.stock / itemShelving.packing; + this.labelTotal += label; + }); + } + + onRemove() { + const params = {itemShelvingIds: this.checked}; + const query = `ItemShelvings/deleteItemShelvings`; + this.$http.post(query, params) + .then(() => { + this.vnApp.showSuccess(this.$t('ItemShelvings removed')); + this.$.model.refresh(); + }); + } + + exprBuilder(param, value) { + switch (param) { + case 'parking': + case 'shelving': + case 'label': + case 'packing': + return {[param]: value}; + } + } +} + +ngModule.vnComponent('vnItemShelving', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/item/front/item-shelving/index.spec.js b/modules/item/front/item-shelving/index.spec.js new file mode 100644 index 000000000..55df1c27d --- /dev/null +++ b/modules/item/front/item-shelving/index.spec.js @@ -0,0 +1,81 @@ +import './index'; +import crudModel from 'core/mocks/crud-model'; + +describe('item shelving', () => { + describe('Component vnItemShelving', () => { + let controller; + let $httpBackend; + + beforeEach(ngModule('item')); + + beforeEach(inject(($componentController, _$httpBackend_) => { + $httpBackend = _$httpBackend_; + const $element = angular.element(''); + controller = $componentController('vnItemShelving', {$element}); + controller.$.model = crudModel; + controller.$.model.data = [ + {itemShelvingFk: 1, packing: 10, stock: 1}, + {itemShelvingFk: 2, packing: 12, stock: 5}, + {itemShelvingFk: 4, packing: 20, stock: 10} + ]; + const modelData = controller.$.model.data; + modelData[0].checked = true; + modelData[1].checked = true; + })); + + describe('checked() getter', () => { + it('should return a the selected rows', () => { + const result = controller.checked; + + expect(result).toEqual(expect.arrayContaining([1, 2])); + }); + }); + + describe('calculateTotals()', () => { + it('should calculate the total of labels', () => { + controller.calculateTotals(); + + expect(controller.labelTotal).toEqual(1.0166666666666666); + }); + }); + + describe('onRemove()', () => { + it('shoud remove the selected lines', () => { + jest.spyOn(controller.$.model, 'refresh'); + const expectedParams = {itemShelvingIds: [1, 2]}; + + $httpBackend.expectPOST('ItemShelvings/deleteItemShelvings', expectedParams).respond(200); + controller.onRemove(); + $httpBackend.flush(); + + expect(controller.$.model.refresh).toHaveBeenCalled(); + }); + }); + + describe('exprBuilder()', () => { + it('should search by parking', () => { + const expr = controller.exprBuilder('parking', '700-01'); + + expect(expr).toEqual({'parking': '700-01'}); + }); + + it('should search by shelving', () => { + const expr = controller.exprBuilder('shelving', 'AAA'); + + expect(expr).toEqual({'shelving': 'AAA'}); + }); + + it('should search by label', () => { + const expr = controller.exprBuilder('label', 0.17); + + expect(expr).toEqual({'label': 0.17}); + }); + + it('should search by packing', () => { + const expr = controller.exprBuilder('packing', 10); + + expect(expr).toEqual({'packing': 10}); + }); + }); + }); +}); diff --git a/modules/item/front/item-shelving/locale/es.yml b/modules/item/front/item-shelving/locale/es.yml new file mode 100644 index 000000000..006363cfa --- /dev/null +++ b/modules/item/front/item-shelving/locale/es.yml @@ -0,0 +1,5 @@ +Shelving: Matrícula +Remove selected lines: Eliminar líneas seleccionadas +Selected lines will be deleted: Las líneas seleccionadas serán eliminadas +ItemShelvings removed: Carros eliminados +Total labels: Total etiquetas \ No newline at end of file diff --git a/modules/item/front/last-entries/index.html b/modules/item/front/last-entries/index.html index 29047c613..609cdb7fa 100644 --- a/modules/item/front/last-entries/index.html +++ b/modules/item/front/last-entries/index.html @@ -9,15 +9,17 @@ - + @@ -35,8 +37,7 @@ Warehouse Landed Entry - P.P.U - P.P.P + PVP Label Packing Grouping @@ -51,7 +52,7 @@ - @@ -65,30 +66,31 @@ {{::entry.entryFk | dashIfEmpty}} - {{::entry.price2 | dashIfEmpty}} - {{::entry.price3 | dashIfEmpty}} + + {{::entry.price2 | currency: 'EUR':2 | dashIfEmpty}} / {{::entry.price3 | currency: 'EUR':2 | dashIfEmpty}} + {{entry.stickers | dashIfEmpty}} - - {{::entry.packing | dashIfEmpty}} + + {{::entry.packing | dashIfEmpty}} - - {{::entry.grouping | dashIfEmpty}} + + {{::entry.grouping | dashIfEmpty}} {{::entry.stems | dashIfEmpty}} {{::entry.quantity}} - - {{::entry.cost | dashIfEmpty}} + {{::$ctrl.$t('Cost')}}: {{::entry.buyingValue | currency: 'EUR':3 | dashIfEmpty}}
+ {{::$ctrl.$t('Package')}}: {{::entry.packageValue | currency: 'EUR':3 | dashIfEmpty}}
+ {{::$ctrl.$t('Freight')}}: {{::entry.freightValue | currency: 'EUR':3 | dashIfEmpty}}
+ {{::$ctrl.$t('Comission')}}: {{::entry.comissionValue | currency: 'EUR':3 | dashIfEmpty}}"> + {{::entry.cost | currency: 'EUR':3 | dashIfEmpty}}
{{::entry.weight | dashIfEmpty}} @@ -113,24 +115,24 @@ ng-click="contextmenu.filterBySelection()"> Filter by selection - Exclude selection - Remove filter - Remove all filters - Copy value - \ No newline at end of file + diff --git a/modules/item/front/last-entries/index.js b/modules/item/front/last-entries/index.js index 014761da9..0c6804838 100644 --- a/modules/item/front/last-entries/index.js +++ b/modules/item/front/last-entries/index.js @@ -5,11 +5,11 @@ class Controller extends Section { constructor($element, $) { super($element, $); - const from = new Date(); + const from = Date.vnNew(); from.setDate(from.getDate() - 75); from.setHours(0, 0, 0, 0); - const to = new Date(); + const to = Date.vnNew(); to.setDate(to.getDate() + 10); to.setHours(23, 59, 59, 59); diff --git a/modules/item/front/locale/es.yml b/modules/item/front/locale/es.yml index 12a729ef4..37f774e4e 100644 --- a/modules/item/front/locale/es.yml +++ b/modules/item/front/locale/es.yml @@ -40,10 +40,11 @@ Create: Crear Client card: Ficha del cliente Shipped: F. envío stems: Tallos -Density: Densidad +Weight/Piece: Peso (gramos)/tallo Search items by id, name or barcode: Buscar articulos por identificador, nombre o codigo de barras SalesPerson: Comercial Concept: Concepto +Units/Box: Unidades/caja # Sections Items: Artículos @@ -54,10 +55,11 @@ Basic data: Datos básicos Tax: IVA History: Historial Botanical: Botánico +Shelvings: Carros Barcodes: Códigos de barras Diary: Histórico Item diary: Registro de compra-venta Last entries: Últimas entradas Tags: Etiquetas Waste breakdown: Desglose de mermas -Waste breakdown by item: Desglose de mermas por artículo \ No newline at end of file +Waste breakdown by item: Desglose de mermas por artículo diff --git a/modules/item/front/request-search-panel/index.spec.js b/modules/item/front/request-search-panel/index.spec.js index 2fb339209..56c76eabf 100644 --- a/modules/item/front/request-search-panel/index.spec.js +++ b/modules/item/front/request-search-panel/index.spec.js @@ -15,7 +15,7 @@ describe(' Component vnRequestSearchPanel', () => { it('should clear the scope days when setting the from property', () => { controller.filter.scopeDays = 1; - controller.from = new Date(); + controller.from = Date.vnNew(); expect(controller.filter.scopeDays).toBeNull(); expect(controller.from).toBeDefined(); @@ -26,7 +26,7 @@ describe(' Component vnRequestSearchPanel', () => { it('should clear the scope days when setting the to property', () => { controller.filter.scopeDays = 1; - controller.to = new Date(); + controller.to = Date.vnNew(); expect(controller.filter.scopeDays).toBeNull(); expect(controller.to).toBeDefined(); @@ -35,8 +35,8 @@ describe(' Component vnRequestSearchPanel', () => { describe('scopeDays() setter', () => { it('should clear the date range when setting the scopeDays property', () => { - controller.filter.from = new Date(); - controller.filter.to = new Date(); + controller.filter.from = Date.vnNew(); + controller.filter.to = Date.vnNew(); controller.scopeDays = 1; diff --git a/modules/item/front/request/index.js b/modules/item/front/request/index.js index 2fe08ada6..747cbeff2 100644 --- a/modules/item/front/request/index.js +++ b/modules/item/front/request/index.js @@ -7,10 +7,10 @@ export default class Controller extends Section { super($element, $); if (!this.$state.q) { - const today = new Date(); + const today = Date.vnNew(); today.setHours(0, 0, 0, 0); - const nextWeek = new Date(); + const nextWeek = Date.vnNew(); nextWeek.setHours(23, 59, 59, 59); nextWeek.setDate(nextWeek.getDate() + 7); @@ -27,7 +27,7 @@ export default class Controller extends Section { $params.scopeDays = 1; if (typeof $params.scopeDays === 'number') { - const from = new Date(); + const from = Date.vnNew(); from.setHours(0, 0, 0, 0); const to = new Date(from.getTime()); @@ -82,7 +82,7 @@ export default class Controller extends Section { } compareDate(date) { - let today = new Date(); + let today = Date.vnNew(); today.setHours(0, 0, 0, 0); let timeTicket = new Date(date); timeTicket.setHours(0, 0, 0, 0); diff --git a/modules/item/front/request/index.spec.js b/modules/item/front/request/index.spec.js index 0fc061023..aadeaddca 100644 --- a/modules/item/front/request/index.spec.js +++ b/modules/item/front/request/index.spec.js @@ -93,7 +93,7 @@ describe('Item', () => { }); it(`should return "warning" if date is today`, () => { - let date = new Date(); + let date = Date.vnNew(); let result = controller.compareDate(date); expect(result).toEqual('warning'); diff --git a/modules/item/front/routes.json b/modules/item/front/routes.json index 5743d0ce7..3dea69ba1 100644 --- a/modules/item/front/routes.json +++ b/modules/item/front/routes.json @@ -15,11 +15,12 @@ "card": [ {"state": "item.card.basicData", "icon": "settings"}, {"state": "item.card.tags", "icon": "icon-tags"}, + {"state": "item.card.last-entries", "icon": "icon-regentry"}, {"state": "item.card.tax", "icon": "icon-tax"}, - {"state": "item.card.botanical", "icon": "local_florist"}, + {"state": "item.card.botanical", "icon": "local_florist"}, + {"state": "item.card.shelving", "icon": "icon-inventory"}, {"state": "item.card.itemBarcode", "icon": "icon-barcode"}, {"state": "item.card.diary", "icon": "icon-transaction"}, - {"state": "item.card.last-entries", "icon": "icon-regentry"}, {"state": "item.card.log", "icon": "history"} ], "itemType": [ @@ -92,6 +93,16 @@ }, "acl": ["buyer"] }, + { + "url" : "/shelving", + "state": "item.card.shelving", + "component": "vn-item-shelving", + "description": "Shelvings", + "params": { + "item": "$ctrl.item" + }, + "acl": ["employee"] + }, { "url" : "/barcode", "state": "item.card.itemBarcode", diff --git a/modules/item/front/summary/index.html b/modules/item/front/summary/index.html index dfc0b6e01..46a2baef4 100644 --- a/modules/item/front/summary/index.html +++ b/modules/item/front/summary/index.html @@ -11,7 +11,7 @@ @@ -22,91 +22,110 @@

Available

{{$ctrl.summary.available}}

+ +

+ + +

+

- Basic data

Basic data

- - - - - - - {{$ctrl.summary.item.itemType.worker.user.name}} + + + +

- Other data

Other data

- - - - - + -

- Tags

-

Tags @@ -117,15 +136,32 @@ value="{{tag.value}}"> + +

+ + Description + +

+

+ Description +

+

+ {{$ctrl.summary.item.description}} +

+

- Tax

-

Tax @@ -137,33 +173,33 @@

- Botanical

-

Botanical

- -

- Barcode

-

Barcode @@ -174,6 +210,6 @@ - - \ No newline at end of file + diff --git a/modules/item/front/summary/index.js b/modules/item/front/summary/index.js index 52753ff65..e17a6a8c4 100644 --- a/modules/item/front/summary/index.js +++ b/modules/item/front/summary/index.js @@ -7,6 +7,24 @@ class Controller extends Summary { this.$http.get(`Items/${this.item.id}/getSummary`).then(response => { this.summary = response.data; }); + + this.$http.get('ItemConfigs/findOne') + .then(res => { + if (this.card) this.card.warehouseFk = res.data.warehouseFk; + this.getWarehouseName(res.data.warehouseFk); + }); + } + + getWarehouseName(warehouseFk) { + const filter = { + where: {id: warehouseFk} + }; + this.$http.get('Warehouses/findOne', {filter}) + .then(res => { + this.warehouseText = this.$t('WarehouseFk', { + warehouseName: res.data.name + }); + }); } $onChanges() { @@ -37,4 +55,7 @@ ngModule.vnComponent('vnItemSummary', { bindings: { item: '<', }, + require: { + card: '?^vnItemCard' + } }); diff --git a/modules/item/front/summary/index.spec.js b/modules/item/front/summary/index.spec.js index 0b349194c..d7821bea0 100644 --- a/modules/item/front/summary/index.spec.js +++ b/modules/item/front/summary/index.spec.js @@ -14,12 +14,15 @@ describe('Item', () => { const $element = angular.element(''); controller = $componentController('vnItemSummary', {$element, $scope}); controller.item = {id: 1}; + controller.card = {}; })); describe('getSummary()', () => { it('should perform a query to set summary', () => { let data = {id: 1, name: 'Gem of mind'}; $httpBackend.expect('GET', `Items/1/getSummary`).respond(200, data); + $httpBackend.expect('GET', `ItemConfigs/findOne`).respond({}); + $httpBackend.expect('GET', `Warehouses/findOne`).respond({}); controller.getSummary(); $httpBackend.flush(); diff --git a/modules/item/front/summary/locale/en.yml b/modules/item/front/summary/locale/en.yml new file mode 100644 index 000000000..0ec208720 --- /dev/null +++ b/modules/item/front/summary/locale/en.yml @@ -0,0 +1 @@ +WarehouseFk: Calculated on the warehouse of {{ warehouseName }} diff --git a/modules/item/front/summary/locale/es.yml b/modules/item/front/summary/locale/es.yml index a87a04857..2e78841ae 100644 --- a/modules/item/front/summary/locale/es.yml +++ b/modules/item/front/summary/locale/es.yml @@ -1,3 +1,4 @@ Barcode: Códigos de barras Other data: Otros datos -Go to the item: Ir al artículo \ No newline at end of file +Go to the item: Ir al artículo +WarehouseFk: Calculado sobre el almacén de {{ warehouseName }} diff --git a/modules/item/front/summary/style.scss b/modules/item/front/summary/style.scss index 7d5e3b609..d047f3e36 100644 --- a/modules/item/front/summary/style.scss +++ b/modules/item/front/summary/style.scss @@ -29,7 +29,11 @@ vn-item-summary { padding: 0; &:nth-child(1) { - border-right: 1px solid white; + border-right: 1px solid white; + } + + &:nth-child(2) { + border-right: 1px solid white; } } -} \ No newline at end of file +} diff --git a/modules/item/front/tags/index.html b/modules/item/front/tags/index.html index c040b9984..f9b5370fa 100644 --- a/modules/item/front/tags/index.html +++ b/modules/item/front/tags/index.html @@ -19,7 +19,7 @@ data="tags" auto-load="true"> -
+ - \ No newline at end of file + diff --git a/modules/item/front/tags/index.js b/modules/item/front/tags/index.js index 3b3cd58ef..2c3b39d45 100644 --- a/modules/item/front/tags/index.js +++ b/modules/item/front/tags/index.js @@ -29,8 +29,15 @@ class Controller extends Section { } onSubmit() { - this.$.watcher.check(); - this.$.model.save().then(() => { + const changes = this.$.model.getChanges(); + const data = { + creates: changes.creates, + deletes: changes.deletes, + updates: changes.updates, + maxPriority: this.getHighestPriority() + }; + this.$http.patch(`Tags/onSubmit`, data).then(() => { + this.$.model.refresh(); this.$.watcher.notifySaved(); this.$.watcher.updateOriginalData(); this.card.reload(); diff --git a/modules/item/front/waste/index/index.html b/modules/item/front/waste/index/index.html index c80733e9e..f1475c1b3 100644 --- a/modules/item/front/waste/index/index.html +++ b/modules/item/front/waste/index/index.html @@ -4,39 +4,46 @@ data="details"> -
- -
{{detail.buyer}}
- - - - -
- - - - - Family - Percentage - Dwindle - Total - - - - - {{::waste.family}} - {{::(waste.percentage / 100) | percentage: 2}} - {{::waste.dwindle | currency: 'EUR'}} - {{::waste.total | currency: 'EUR'}} - - - - -
-
\ No newline at end of file + + + + + Buyer + Family + Percentage + Dwindle + Total + + + + + + {{::detail.buyer}} + {{::detail.family}} + {{::(detail.percentage / 100) | percentage: 2}} + {{::detail.dwindle | currency: 'EUR'}} + {{::detail.total | currency: 'EUR'}} + + + + + + + + {{::waste.family}} + {{::(waste.percentage / 100) | percentage: 2}} + {{::waste.dwindle | currency: 'EUR'}} + {{::waste.total | currency: 'EUR'}} + + + + +
+ diff --git a/modules/item/front/waste/index/style.scss b/modules/item/front/waste/index/style.scss index 8b44cb6f1..36fac3311 100644 --- a/modules/item/front/waste/index/style.scss +++ b/modules/item/front/waste/index/style.scss @@ -5,20 +5,9 @@ vn-item-waste-index, vn-item-waste-detail { .header { padding: 12px 0 5px 0; - color: gray; + background-color: $color-bg; font-size: 1.2rem; - border-bottom: $border; margin-bottom: 10px; - - & > vn-none > vn-icon { - @extend %clickable-light; - color: $color-button; - font-size: 1.4rem; - } - - vn-none > .arrow { - transition: transform 200ms; - } } vn-table vn-th.waste-family, @@ -26,12 +15,13 @@ vn-item-waste-detail { max-width: 64px; width: 64px } + .hidden { display: none; - } - .header > vn-none > .arrow.hidden { + + .arrow.hidden { display: block; transform: rotate(180deg); } -} \ No newline at end of file +} diff --git a/modules/mdb/back/methods/mdbApp/lock.js b/modules/mdb/back/methods/mdbApp/lock.js new file mode 100644 index 000000000..a12a93814 --- /dev/null +++ b/modules/mdb/back/methods/mdbApp/lock.js @@ -0,0 +1,66 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('lock', { + description: 'Lock an app for the user', + accessType: 'WRITE', + accepts: [ + { + arg: 'appName', + type: 'string', + required: true, + description: 'The app name', + http: {source: 'path'} + + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/:appName/lock`, + verb: 'POST' + } + }); + + Self.lock = async(ctx, appName, options) => { + const models = Self.app.models; + const userId = ctx.req.accessToken.userId; + const myOptions = {}; + const $t = ctx.req.__; // $translate + + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const mdbApp = await models.MdbApp.findById(appName, {fields: ['app', 'locked', 'userFk']}, myOptions); + + if (mdbApp.locked) { + throw new UserError($t('App locked', { + userId: mdbApp.userFk + })); + } + + const updatedMdbApp = await mdbApp.updateAttributes({ + userFk: userId, + locked: Date.vnNew() + }, myOptions); + + if (tx) await tx.commit(); + + return updatedMdbApp; + } catch (e) { + if (tx) await tx.rollback(); + + throw e; + } + }; +}; diff --git a/modules/mdb/back/methods/mdbApp/specs/lock.spec.js b/modules/mdb/back/methods/mdbApp/specs/lock.spec.js new file mode 100644 index 000000000..162d0490a --- /dev/null +++ b/modules/mdb/back/methods/mdbApp/specs/lock.spec.js @@ -0,0 +1,51 @@ +const models = require('vn-loopback/server/server').models; + +describe('MdbApp lock()', () => { + it('should throw an error if the app is already locked', async() => { + const tx = await models.MdbApp.beginTransaction({}); + let error; + + try { + const options = {transaction: tx}; + const appName = 'bar'; + const developerId = 9; + const ctx = { + req: { + accessToken: {userId: developerId}, + __: () => {} + } + }; + + const result = await models.MdbApp.lock(ctx, appName, options); + + expect(result.locked).not.toBeNull(); + + await tx.rollback(); + } catch (e) { + error = e; + + await tx.rollback(); + } + + expect(error).toBeDefined(); + }); + + it(`should lock a mdb `, async() => { + const tx = await models.MdbApp.beginTransaction({}); + + try { + const options = {transaction: tx}; + const appName = 'foo'; + const developerId = 9; + const ctx = {req: {accessToken: {userId: developerId}}}; + + const result = await models.MdbApp.lock(ctx, appName, options); + + expect(result.locked).not.toBeNull(); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + } + }); +}); diff --git a/modules/mdb/back/methods/mdbApp/specs/unlock.spec.js b/modules/mdb/back/methods/mdbApp/specs/unlock.spec.js new file mode 100644 index 000000000..9f1678372 --- /dev/null +++ b/modules/mdb/back/methods/mdbApp/specs/unlock.spec.js @@ -0,0 +1,22 @@ +const models = require('vn-loopback/server/server').models; + +describe('MdbApp unlock()', () => { + it(`should unlock a mdb `, async() => { + const tx = await models.MdbApp.beginTransaction({}); + + try { + const options = {transaction: tx}; + const appName = 'bar'; + const developerId = 9; + const ctx = {req: {accessToken: {userId: developerId}}}; + + const result = await models.MdbApp.unlock(ctx, appName, options); + + expect(result.locked).toBeNull(); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + } + }); +}); diff --git a/modules/mdb/back/methods/mdbApp/unlock.js b/modules/mdb/back/methods/mdbApp/unlock.js new file mode 100644 index 000000000..6bf67ddf4 --- /dev/null +++ b/modules/mdb/back/methods/mdbApp/unlock.js @@ -0,0 +1,40 @@ +module.exports = Self => { + Self.remoteMethodCtx('unlock', { + description: 'Unlock an app for the user', + accessType: 'WRITE', + accepts: [ + { + arg: 'appName', + type: 'string', + required: true, + description: 'The app name', + http: {source: 'path'} + + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/:appName/unlock`, + verb: 'POST' + } + }); + + Self.unlock = async(ctx, appName, options) => { + const models = Self.app.models; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const mdbApp = await models.MdbApp.findById(appName, null, myOptions); + const updatedMdbApp = await mdbApp.updateAttributes({ + userFk: null, + locked: null + }, myOptions); + + return updatedMdbApp; + }; +}; diff --git a/modules/mdb/back/methods/mdbVersion/last.js b/modules/mdb/back/methods/mdbVersion/last.js new file mode 100644 index 000000000..5f89f10fb --- /dev/null +++ b/modules/mdb/back/methods/mdbVersion/last.js @@ -0,0 +1,46 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('last', { + description: 'Gets the latest version of a access file', + accepts: [ + { + arg: 'appName', + type: 'string', + required: true, + description: 'The app name' + } + ], + returns: { + type: 'number', + root: true + }, + http: { + path: `/:appName/last`, + verb: 'GET' + } + }); + + Self.last = async(ctx, appName) => { + const models = Self.app.models; + const versions = await models.MdbVersion.find({ + where: {app: appName}, + fields: ['version'] + }); + + if (!versions.length) + throw new UserError('App name does not exist'); + + let maxNumber = 0; + for (let mdb of versions) { + if (mdb.version > maxNumber) + maxNumber = mdb.version; + } + + let response = { + version: maxNumber + }; + + return response; + }; +}; diff --git a/modules/mdb/back/methods/mdbVersion/upload.js b/modules/mdb/back/methods/mdbVersion/upload.js index 3d54c0250..58fc46abb 100644 --- a/modules/mdb/back/methods/mdbVersion/upload.js +++ b/modules/mdb/back/methods/mdbVersion/upload.js @@ -11,18 +11,31 @@ module.exports = Self => { type: 'string', required: true, description: 'The app name' - }, - { - arg: 'newVersion', + }, { + arg: 'toVersion', type: 'number', required: true, description: `The new version number` - }, - { + }, { arg: 'branch', type: 'string', required: true, description: `The branch name` + }, { + arg: 'fromVersion', + type: 'string', + required: true, + description: `The old version number` + }, { + arg: 'description', + type: 'string', + required: false, + description: `The description of changes` + }, { + arg: 'unlock', + type: 'boolean', + required: false, + description: `It allows unlock the app` } ], returns: { @@ -34,15 +47,22 @@ module.exports = Self => { verb: 'POST' } }); - - Self.upload = async(ctx, appName, newVersion, branch, options) => { + Self.upload = async( + ctx, + appName, + toVersion, + branch, + fromVersion, + description, + unlock, + options + ) => { const models = Self.app.models; const myOptions = {}; - + const $t = ctx.req.__; // $translate const TempContainer = models.TempContainer; const AccessContainer = models.AccessContainer; const fileOptions = {}; - let tx; if (typeof options == 'object') @@ -55,6 +75,28 @@ module.exports = Self => { let srcFile; try { + const userId = ctx.req.accessToken.userId; + const mdbApp = await models.MdbApp.findById(appName, null, myOptions); + + if (mdbApp && mdbApp.locked && mdbApp.userFk != userId) { + throw new UserError($t('App locked', { + userId: mdbApp.userFk + })); + } + + const existBranch = await models.MdbBranch.findOne({ + where: {name: branch} + }, myOptions); + + if (!existBranch) + throw new UserError('Not exist this branch'); + + let lastMethod = await Self.last(ctx, appName, myOptions); + lastMethod.version++; + + if (lastMethod.version != toVersion) + throw new UserError('Try again'); + const tempContainer = await TempContainer.container('access'); const uploaded = await TempContainer.upload(tempContainer.name, ctx.req, ctx.result, fileOptions); const files = Object.values(uploaded.files).map(file => { @@ -67,7 +109,7 @@ module.exports = Self => { const accessContainer = await AccessContainer.container('.archive'); const destinationFile = path.join( - accessContainer.client.root, accessContainer.name, appName, `${newVersion}.7z`); + accessContainer.client.root, accessContainer.name, appName, `${toVersion}.7z`); if (process.env.NODE_ENV == 'test') await fs.unlink(srcFile); @@ -79,7 +121,7 @@ module.exports = Self => { const existBranch = await models.MdbBranch.findOne({ where: {name: branch} - }); + }, myOptions); if (!existBranch) throw new UserError('Not exist this branch'); @@ -88,32 +130,80 @@ module.exports = Self => { await fs.mkdir(branchPath, {recursive: true}); const destinationBranch = path.join(branchPath, `${appName}.7z`); - const destinationRoot = path.join(accessContainer.client.root, `${appName}.7z`); + const destinationRelative = `../../.archive/${appName}/${toVersion}.7z`; try { await fs.unlink(destinationBranch); } catch (e) {} - await fs.symlink(destinationFile, destinationBranch); + await fs.symlink(destinationRelative, destinationBranch); if (branch == 'master') { + const destinationRoot = path.join(accessContainer.client.root, `${appName}.7z`); + const rootRelative = `./.archive/${appName}/${toVersion}.7z`; try { await fs.unlink(destinationRoot); } catch (e) {} - await fs.symlink(destinationFile, destinationRoot); + await fs.symlink(rootRelative, destinationRoot); } } + if (description) { + let formatDesc; + const mainBranches = new Set(['master', 'test', 'dev']); + if (mainBranches.has(branch)) + formatDesc = `> :branch_${branch}: `; + else + formatDesc = `> :branch: `; + + formatDesc += `*${appName.toUpperCase()}* v.${toVersion} `; + + const oldVersion = await models.MdbVersionTree.findOne({ + where: { + version: fromVersion, + app: appName + }, + fields: ['branchFk'] + }, myOptions); + + if (!oldVersion || branch == oldVersion.branchFk) + formatDesc += `[*${branch}*]: `; + else + formatDesc += `[*${oldVersion.branchFk}* » *${branch}*]: `; + + const params = await models.MdbConfig.findOne(myOptions); + const issueTrackerUrl = params.issueTrackerUrl; + const issueNumberRegex = params.issueNumberRegex; + const chatDestination = params.chatDestination; + + const regex = new RegExp(issueNumberRegex, 'g'); + formatDesc += description.replace(regex, (match, issueId) => { + const newUrl = issueTrackerUrl.replace('{index}', issueId); + return `[#${issueId}](${newUrl})`; + }); + + await models.Chat.send(ctx, chatDestination, formatDesc, myOptions); + } + await models.MdbVersionTree.create({ + app: appName, + version: toVersion, + branchFk: branch, + fromVersion, + userFk: userId, + description, + }, myOptions); await models.MdbVersion.upsert({ app: appName, branchFk: branch, - version: newVersion - }); + version: toVersion + }, myOptions); + + if (unlock) await models.MdbApp.unlock(ctx, appName, myOptions); if (tx) await tx.commit(); } catch (e) { if (tx) await tx.rollback(); if (fs.existsSync(srcFile)) - await fs.unlink(srcFile); + fs.unlink(srcFile); throw e; } diff --git a/modules/mdb/back/model-config.json b/modules/mdb/back/model-config.json index d5be8de87..b59a4fda0 100644 --- a/modules/mdb/back/model-config.json +++ b/modules/mdb/back/model-config.json @@ -1,10 +1,19 @@ { + "MdbApp": { + "dataSource": "vn" + }, "MdbBranch": { "dataSource": "vn" }, "MdbVersion": { "dataSource": "vn" }, + "MdbVersionTree": { + "dataSource": "vn" + }, + "MdbConfig": { + "dataSource": "vn" + }, "AccessContainer": { "dataSource": "accessStorage" } diff --git a/modules/mdb/back/models/mdbApp.js b/modules/mdb/back/models/mdbApp.js new file mode 100644 index 000000000..dce715573 --- /dev/null +++ b/modules/mdb/back/models/mdbApp.js @@ -0,0 +1,4 @@ +module.exports = Self => { + require('../methods/mdbApp/lock')(Self); + require('../methods/mdbApp/unlock')(Self); +}; diff --git a/modules/mdb/back/models/mdbApp.json b/modules/mdb/back/models/mdbApp.json new file mode 100644 index 000000000..868f8c1d0 --- /dev/null +++ b/modules/mdb/back/models/mdbApp.json @@ -0,0 +1,31 @@ +{ + "name": "MdbApp", + "base": "VnModel", + "options": { + "mysql": { + "table": "mdbApp" + } + }, + "properties": { + "app": { + "type": "string", + "description": "The app name", + "id": true + }, + "locked": { + "type": "date" + } + }, + "relations": { + "branch": { + "type": "belongsTo", + "model": "MdbBranch", + "foreignKey": "baselineBranchFk" + }, + "user": { + "type": "belongsTo", + "model": "MdbBranch", + "foreignKey": "userFk" + } + } +} diff --git a/modules/mdb/back/models/mdbBranch.json b/modules/mdb/back/models/mdbBranch.json index 486dfaf25..b22d14ece 100644 --- a/modules/mdb/back/models/mdbBranch.json +++ b/modules/mdb/back/models/mdbBranch.json @@ -11,6 +11,11 @@ "id": true, "type": "string", "description": "Identifier" + }, + "dsName": { + "id": true, + "type": "string", + "description": "ODBC name" } } } \ No newline at end of file diff --git a/modules/mdb/back/models/mdbConfig.json b/modules/mdb/back/models/mdbConfig.json new file mode 100644 index 000000000..60634104a --- /dev/null +++ b/modules/mdb/back/models/mdbConfig.json @@ -0,0 +1,24 @@ +{ + "name": "MdbConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "mdbConfig" + } + }, + "properties": { + "id": { + "type": "string", + "id": true + }, + "issueTrackerUrl": { + "type": "string" + }, + "issueNumberRegex": { + "type": "string" + }, + "chatDestination": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/modules/mdb/back/models/mdbVersion.js b/modules/mdb/back/models/mdbVersion.js index b36ee2a60..3a7a0c6f3 100644 --- a/modules/mdb/back/models/mdbVersion.js +++ b/modules/mdb/back/models/mdbVersion.js @@ -1,3 +1,4 @@ module.exports = Self => { require('../methods/mdbVersion/upload')(Self); + require('../methods/mdbVersion/last')(Self); }; diff --git a/modules/mdb/back/models/mdbVersionTree.json b/modules/mdb/back/models/mdbVersionTree.json new file mode 100644 index 000000000..106473b64 --- /dev/null +++ b/modules/mdb/back/models/mdbVersionTree.json @@ -0,0 +1,38 @@ +{ + "name": "MdbVersionTree", + "base": "VnModel", + "options": { + "mysql": { + "table": "mdbVersionTree" + } + }, + "properties": { + "app": { + "type": "string", + "description": "The app name", + "id": true + }, + "version": { + "type": "number" + }, + "branchFk": { + "type": "string" + }, + "fromVersion": { + "type": "number" + }, + "userFk": { + "type": "number" + }, + "description": { + "type": "string" + } + }, + "relations": { + "branch": { + "type": "belongsTo", + "model": "MdbBranch", + "foreignKey": "branchFk" + } + } +} \ No newline at end of file diff --git a/modules/monitor/back/methods/sales-monitor/clientsFilter.js b/modules/monitor/back/methods/sales-monitor/clientsFilter.js index 3756a706b..13e38f8e1 100644 --- a/modules/monitor/back/methods/sales-monitor/clientsFilter.js +++ b/modules/monitor/back/methods/sales-monitor/clientsFilter.js @@ -34,10 +34,11 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); const stmt = new ParameterizedSQL(` SELECT + v.id, u.name AS salesPerson, IFNULL(sc.workerSubstitute, c.salesPersonFk) AS salesPersonFk, c.id AS clientFk, @@ -50,7 +51,7 @@ module.exports = Self => { JOIN account.user u ON c.salesPersonFk = u.id LEFT JOIN sharingCart sc ON sc.workerFk = c.salesPersonFk AND ? BETWEEN sc.started AND sc.ended - LEFT JOIN workerTeamCollegues wtc + LEFT JOIN workerTeamCollegues wtc ON wtc.collegueFk = IFNULL(sc.workerSubstitute, c.salesPersonFk)`, [date]); diff --git a/modules/monitor/back/methods/sales-monitor/ordersFilter.js b/modules/monitor/back/methods/sales-monitor/ordersFilter.js index 6ae4042b6..a80ea822e 100644 --- a/modules/monitor/back/methods/sales-monitor/ordersFilter.js +++ b/modules/monitor/back/methods/sales-monitor/ordersFilter.js @@ -53,7 +53,7 @@ module.exports = Self => { JOIN client c ON c.id = o.customer_id JOIN address a ON a.id = o.address_id JOIN agencyMode am ON am.id = o.agency_id - JOIN user u ON u.id = c.salesPersonFk + JOIN account.user u ON u.id = c.salesPersonFk JOIN workerTeamCollegues wtc ON c.salesPersonFk = wtc.collegueFk`); if (!filter.where) filter.where = {}; diff --git a/modules/monitor/back/methods/sales-monitor/salesFilter.js b/modules/monitor/back/methods/sales-monitor/salesFilter.js index 9a7415055..8f7b336ab 100644 --- a/modules/monitor/back/methods/sales-monitor/salesFilter.js +++ b/modules/monitor/back/methods/sales-monitor/salesFilter.js @@ -104,7 +104,7 @@ module.exports = Self => { const userId = ctx.req.accessToken.userId; const conn = Self.dataSource.connector; const models = Self.app.models; - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); const args = ctx.args; const myOptions = {}; @@ -164,6 +164,10 @@ module.exports = Self => { let stmt; stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.filter'); + + stmts.push(`SET @_optimizer_search_depth = @@optimizer_search_depth`); + stmts.push(`SET SESSION optimizer_search_depth = 0`); + stmt = new ParameterizedSQL( `CREATE TEMPORARY TABLE tmp.filter (PRIMARY KEY (id)) @@ -224,10 +228,12 @@ module.exports = Self => { stmt.merge(conn.makeWhere(filter.where)); stmts.push(stmt); + stmts.push(`SET SESSION optimizer_search_depth = @_optimizer_search_depth`); + // Get client debt balance stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt'); stmts.push(` - CREATE TEMPORARY TABLE tmp.clientGetDebt + CREATE TEMPORARY TABLE tmp.clientGetDebt (PRIMARY KEY (clientFk)) ENGINE = MEMORY SELECT DISTINCT clientFk FROM tmp.filter`); @@ -238,7 +244,7 @@ module.exports = Self => { stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.tickets'); stmt = new ParameterizedSQL(` - CREATE TEMPORARY TABLE tmp.tickets + CREATE TEMPORARY TABLE tmp.tickets (PRIMARY KEY (id)) ENGINE = MEMORY SELECT f.*, r.risk AS debt @@ -268,10 +274,10 @@ module.exports = Self => { stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems'); stmt = new ParameterizedSQL(` - CREATE TEMPORARY TABLE tmp.sale_getProblems + CREATE TEMPORARY TABLE tmp.sale_getProblems (INDEX (ticketFk)) ENGINE = MEMORY - SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped + SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped FROM tmp.filter f LEFT JOIN alertLevel al ON al.id = f.alertLevel WHERE (al.code = 'FREE' OR f.alertLevel IS NULL) @@ -289,11 +295,26 @@ module.exports = Self => { risk = t.debt + t.credit, totalProblems = totalProblems + 1 `); + stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.sale_getWarnings'); + stmt = new ParameterizedSQL(` - SELECT t.*, tp.*, - ((tp.risk) + cc.riskTolerance < 0) AS hasHighRisk + CREATE TEMPORARY TABLE tmp.sale_getWarnings + (INDEX (ticketFk, agencyModeFk)) + ENGINE = MEMORY + SELECT f.id ticketFk, f.agencyModeFk + FROM tmp.filter f`); + stmts.push(stmt); + + stmts.push('CALL ticket_getWarnings()'); + + stmt = new ParameterizedSQL(` + SELECT t.*, + tp.*, + ((tp.risk) + cc.riskTolerance < 0) AS hasHighRisk, + tw.* FROM tmp.tickets t LEFT JOIN tmp.ticket_problems tp ON tp.ticketFk = t.id + LEFT JOIN tmp.ticket_warnings tw ON tw.ticketFk = t.id JOIN clientConfig cc`); const hasProblems = args.problems; @@ -346,20 +367,37 @@ module.exports = Self => { return {'t.alertLevel': value}; case 'pending': if (value) { - return {and: [ - {'t.alertLevel': 0}, - {'t.alertLevelCode': {nin: [ - 'OK', - 'BOARDING', - 'PRINTED', - 'PRINTED_AUTO', - 'PICKER_DESIGNED' - ]}} - ]}; + return {'t.alertLevelCode': {inq: [ + 'FIXING', + 'FREE', + 'NOT_READY', + 'BLOCKED', + 'EXPANDABLE', + 'CHAINED', + 'WAITING_FOR_PAYMENT' + ]}}; } else { - return {and: [ - {'t.alertLevel': {gt: 0}} - ]}; + return {'t.alertLevelCode': {inq: [ + 'ON_PREPARATION', + 'ON_CHECKING', + 'CHECKED', + 'PACKING', + 'PACKED', + 'INVOICED', + 'ON_DELIVERY', + 'PREPARED', + 'WAITING_FOR_PICKUP', + 'DELIVERED', + 'PRINTED_BACK', + 'LAST_CALL', + 'PREVIOUS_PREPARATION', + 'ASSISTED_PREPARATION', + 'BOARD', + 'PRINTED STOWAWAY', + 'OK STOWAWAY', + 'HALF_PACKED', + 'COOLER_PREPARATION' + ]}}; } case 'agencyModeFk': case 'warehouseFk': @@ -377,10 +415,12 @@ module.exports = Self => { const ticketsIndex = stmts.push(stmt) - 1; stmts.push( - `DROP TEMPORARY TABLE + `DROP TEMPORARY TABLE tmp.filter, tmp.ticket_problems, tmp.sale_getProblems, + tmp.sale_getWarnings, + tmp.ticket_warnings, tmp.risk`); const sql = ParameterizedSQL.join(stmts, ';'); diff --git a/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js b/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js index bcb37830c..febfc5357 100644 --- a/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js +++ b/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js @@ -8,8 +8,8 @@ describe('SalesMonitor clientsFilter()', () => { const options = {transaction: tx}; const ctx = {req: {accessToken: {userId: 18}}, args: {}}; - const from = new Date(); - const to = new Date(); + const from = Date.vnNew(); + const to = Date.vnNew(); from.setHours(0, 0, 0, 0); to.setHours(23, 59, 59, 59); @@ -35,9 +35,9 @@ describe('SalesMonitor clientsFilter()', () => { try { const options = {transaction: tx}; const ctx = {req: {accessToken: {userId: 18}}, args: {}}; - const yesterday = new Date(); + const yesterday = Date.vnNew(); yesterday.setDate(yesterday.getDate() - 1); - const today = new Date(); + const today = Date.vnNew(); yesterday.setHours(0, 0, 0, 0); today.setHours(23, 59, 59, 59); diff --git a/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js b/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js index a4fb1b0af..4e0fb85b7 100644 --- a/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js +++ b/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js @@ -11,7 +11,7 @@ describe('SalesMonitor salesFilter()', () => { const filter = {order: 'id DESC'}; const result = await models.SalesMonitor.salesFilter(ctx, filter, options); - expect(result.length).toEqual(27); + expect(result.length).toBeGreaterThan(25); await tx.rollback(); } catch (e) { @@ -26,9 +26,9 @@ describe('SalesMonitor salesFilter()', () => { try { const options = {transaction: tx}; - const yesterday = new Date(); + const yesterday = Date.vnNew(); yesterday.setHours(0, 0, 0, 0); - const today = new Date(); + const today = Date.vnNew(); today.setHours(23, 59, 59, 59); const ctx = {req: {accessToken: {userId: 9}}, args: { @@ -39,7 +39,7 @@ describe('SalesMonitor salesFilter()', () => { const filter = {}; const result = await models.SalesMonitor.salesFilter(ctx, filter, options); - expect(result.length).toEqual(16); + expect(result.length).toBeGreaterThan(15); await tx.rollback(); } catch (e) { @@ -54,10 +54,10 @@ describe('SalesMonitor salesFilter()', () => { try { const options = {transaction: tx}; - const yesterday = new Date(); + const yesterday = Date.vnNew(); yesterday.setDate(yesterday.getDate() - 1); yesterday.setHours(0, 0, 0, 0); - const today = new Date(); + const today = Date.vnNew(); today.setHours(23, 59, 59, 59); const ctx = {req: {accessToken: {userId: 9}}, args: { @@ -87,7 +87,7 @@ describe('SalesMonitor salesFilter()', () => { const filter = {}; const result = await models.SalesMonitor.salesFilter(ctx, filter, options); - expect(result.length).toEqual(27); + expect(result.length).toBeGreaterThan(20); await tx.rollback(); } catch (e) { @@ -130,7 +130,7 @@ describe('SalesMonitor salesFilter()', () => { const length = result.length; const anyResult = result[Math.floor(Math.random() * Math.floor(length))]; - expect(length).toEqual(10); + expect(length).toBeGreaterThan(10); expect(anyResult.state).toMatch(/(Libre|Arreglar)/); await tx.rollback(); @@ -147,16 +147,12 @@ describe('SalesMonitor salesFilter()', () => { const options = {transaction: tx}; const ctx = {req: {accessToken: {userId: 9}}, args: {pending: false}}; - const filter = {}; + const filter = {order: 'alertLevel ASC'}; const result = await models.SalesMonitor.salesFilter(ctx, filter, options); const firstRow = result[0]; - const secondRow = result[1]; - const thirdRow = result[2]; expect(result.length).toEqual(12); - expect(firstRow.state).toEqual('Entregado'); - expect(secondRow.state).toEqual('Entregado'); - expect(thirdRow.state).toEqual('Entregado'); + expect(firstRow.alertLevel).not.toEqual(0); await tx.rollback(); } catch (e) { @@ -175,7 +171,7 @@ describe('SalesMonitor salesFilter()', () => { const filter = {}; const result = await models.SalesMonitor.salesFilter(ctx, filter, options); - expect(result.length).toEqual(23); + expect(result.length).toBeGreaterThan(20); await tx.rollback(); } catch (e) { @@ -209,10 +205,10 @@ describe('SalesMonitor salesFilter()', () => { try { const options = {transaction: tx}; - const yesterday = new Date(); + const yesterday = Date.vnNew(); yesterday.setDate(yesterday.getDate() - 1); yesterday.setHours(0, 0, 0, 0); - const today = new Date(); + const today = Date.vnNew(); today.setHours(23, 59, 59, 59); const ctx = {req: {accessToken: {userId: 18}}, args: {}}; @@ -238,10 +234,10 @@ describe('SalesMonitor salesFilter()', () => { try { const options = {transaction: tx}; - const yesterday = new Date(); + const yesterday = Date.vnNew(); yesterday.setDate(yesterday.getDate() - 1); yesterday.setHours(0, 0, 0, 0); - const today = new Date(); + const today = Date.vnNew(); today.setHours(23, 59, 59, 59); const ctx = {req: {accessToken: {userId: 18}}, args: {}}; diff --git a/modules/monitor/front/index/clients/index.html b/modules/monitor/front/index/clients/index.html index eafc2256e..c0e3d1b14 100644 --- a/modules/monitor/front/index/clients/index.html +++ b/modules/monitor/front/index/clients/index.html @@ -19,22 +19,24 @@ - @@ -59,7 +61,7 @@

{{::visit.dated | date:'dd/MM/yy'}} @@ -100,9 +102,9 @@ - - \ No newline at end of file + diff --git a/modules/monitor/front/index/clients/index.js b/modules/monitor/front/index/clients/index.js index 58613f09d..ac3ce9140 100644 --- a/modules/monitor/front/index/clients/index.js +++ b/modules/monitor/front/index/clients/index.js @@ -5,7 +5,7 @@ export default class Controller extends Section { constructor($element, $) { super($element, $); - const date = new Date(); + const date = Date.vnNew(); this.dateFrom = date; this.dateTo = date; this.filter = { @@ -64,9 +64,9 @@ export default class Controller extends Section { let from = this.dateFrom; let to = this.dateTo; if (!from) - from = new Date(); + from = Date.vnNew(); if (!to) - to = new Date(); + to = Date.vnNew(); const minHour = new Date(from); minHour.setHours(0, 0, 0, 0); const maxHour = new Date(to); diff --git a/modules/monitor/front/index/locale/es.yml b/modules/monitor/front/index/locale/es.yml index 126528caa..f114a2259 100644 --- a/modules/monitor/front/index/locale/es.yml +++ b/modules/monitor/front/index/locale/es.yml @@ -12,4 +12,5 @@ Theoretical: Teórica Practical: Práctica Preparation: Preparación Auto-refresh: Auto-refresco -Toggle auto-refresh every 2 minutes: Conmuta el refresco automático cada 2 minutos \ No newline at end of file +Toggle auto-refresh every 2 minutes: Conmuta el refresco automático cada 2 minutos +Is fragile: Es frágil diff --git a/modules/monitor/front/index/orders/index.html b/modules/monitor/front/index/orders/index.html index 6126e23ef..74e80e40e 100644 --- a/modules/monitor/front/index/orders/index.html +++ b/modules/monitor/front/index/orders/index.html @@ -41,7 +41,7 @@ SalesPerson - diff --git a/modules/monitor/front/index/orders/index.js b/modules/monitor/front/index/orders/index.js index e3a47f68b..40100b79f 100644 --- a/modules/monitor/front/index/orders/index.js +++ b/modules/monitor/front/index/orders/index.js @@ -26,7 +26,7 @@ export default class Controller extends Section { } chipColor(date) { - const today = new Date(); + const today = Date.vnNew(); today.setHours(0, 0, 0, 0); const orderLanded = new Date(date); diff --git a/modules/monitor/front/index/search-panel/index.spec.js b/modules/monitor/front/index/search-panel/index.spec.js index f862e8d77..18cf1abfc 100644 --- a/modules/monitor/front/index/search-panel/index.spec.js +++ b/modules/monitor/front/index/search-panel/index.spec.js @@ -38,7 +38,7 @@ describe('Monitor Component vnMonitorSalesSearchPanel', () => { it('should clear the scope days when setting the from property', () => { controller.filter.scopeDays = 1; - controller.from = new Date(); + controller.from = Date.vnNew(); expect(controller.filter.scopeDays).toBeNull(); expect(controller.from).toBeDefined(); @@ -49,7 +49,7 @@ describe('Monitor Component vnMonitorSalesSearchPanel', () => { it('should clear the scope days when setting the to property', () => { controller.filter.scopeDays = 1; - controller.to = new Date(); + controller.to = Date.vnNew(); expect(controller.filter.scopeDays).toBeNull(); expect(controller.to).toBeDefined(); @@ -58,8 +58,8 @@ describe('Monitor Component vnMonitorSalesSearchPanel', () => { describe('scopeDays() setter', () => { it('should clear the date range when setting the scopeDays property', () => { - controller.filter.from = new Date(); - controller.filter.to = new Date(); + controller.filter.from = Date.vnNew(); + controller.filter.to = Date.vnNew(); controller.scopeDays = 1; diff --git a/modules/monitor/front/index/tickets/index.html b/modules/monitor/front/index/tickets/index.html index a504301a5..539d4b3cb 100644 --- a/modules/monitor/front/index/tickets/index.html +++ b/modules/monitor/front/index/tickets/index.html @@ -19,13 +19,13 @@ Tickets monitor - + - State + Zone
@@ -133,66 +134,74 @@ - {{::ticket.id}} + {{ticket.id}} - {{::ticket.nickname}} + {{ticket.nickname}} - {{::ticket.userName | dashIfEmpty}} + {{ticket.userName | dashIfEmpty}} - - {{::ticket.shippedDate | date: 'dd/MM/yyyy'}} + + {{ticket.shippedDate | date: 'dd/MM/yyyy'}} {{::ticket.zoneLanding | date: 'HH:mm'}}{{::ticket.practicalHour | date: 'HH:mm'}}{{::ticket.shipped | date: 'HH:mm'}}{{::ticket.province}}{{ticket.zoneLanding | date: 'HH:mm'}}{{ticket.practicalHour | date: 'HH:mm'}}{{ticket.shipped | date: 'HH:mm'}}{{ticket.province}} - {{::ticket.refFk}} + {{ticket.refFk}} - - {{::ticket.state}} - - - {{::ticket.zoneName | dashIfEmpty}} + ng-show="!ticket.refFk" + class="chip {{ticket.classColor}}"> + {{ticket.state}} - - {{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}} + + + + + {{ticket.zoneName | dashIfEmpty}} + + + + {{(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}} - + + Filter by selection - Exclude selection - Remove filter - Remove all filters - Copy value diff --git a/modules/monitor/front/index/tickets/index.js b/modules/monitor/front/index/tickets/index.js index 91d9079d8..2f2dead05 100644 --- a/modules/monitor/front/index/tickets/index.js +++ b/modules/monitor/front/index/tickets/index.js @@ -91,7 +91,7 @@ export default class Controller extends Section { $params.scopeDays = 1; if (typeof $params.scopeDays === 'number') { - const from = new Date(); + const from = Date.vnNew(); from.setHours(0, 0, 0, 0); const to = new Date(from.getTime()); @@ -105,7 +105,7 @@ export default class Controller extends Section { } compareDate(date) { - let today = new Date(); + let today = Date.vnNew(); today.setHours(0, 0, 0, 0); let timeTicket = new Date(date); timeTicket.setHours(0, 0, 0, 0); diff --git a/modules/monitor/front/index/tickets/index.spec.js b/modules/monitor/front/index/tickets/index.spec.js index 5d42743c1..c12ea6844 100644 --- a/modules/monitor/front/index/tickets/index.spec.js +++ b/modules/monitor/front/index/tickets/index.spec.js @@ -32,7 +32,7 @@ describe('Component vnMonitorSalesTickets', () => { let params = controller.fetchParams({ scopeDays: 2 }); - const from = new Date(); + const from = Date.vnNew(); from.setHours(0, 0, 0, 0); const to = new Date(from.getTime()); to.setDate(to.getDate() + params.scopeDays); @@ -66,14 +66,14 @@ describe('Component vnMonitorSalesTickets', () => { describe('compareDate()', () => { it('should return warning when the date is the present', () => { - let today = new Date(); + let today = Date.vnNew(); let result = controller.compareDate(today); expect(result).toEqual('warning'); }); it('should return sucess when the date is in the future', () => { - let futureDate = new Date(); + let futureDate = Date.vnNew(); futureDate = futureDate.setDate(futureDate.getDate() + 10); let result = controller.compareDate(futureDate); @@ -81,7 +81,7 @@ describe('Component vnMonitorSalesTickets', () => { }); it('should return undefined when the date is in the past', () => { - let pastDate = new Date(); + let pastDate = Date.vnNew(); pastDate = pastDate.setDate(pastDate.getDate() - 10); let result = controller.compareDate(pastDate); @@ -99,7 +99,7 @@ describe('Component vnMonitorSalesTickets', () => { describe('dateRange()', () => { it('should return two dates with the hours at the start and end of the given date', () => { - const now = new Date(); + const now = Date.vnNew(); const today = now.getDate(); diff --git a/modules/order/back/methods/order/specs/new.spec.js b/modules/order/back/methods/order/specs/new.spec.js index 5873189f8..f11367579 100644 --- a/modules/order/back/methods/order/specs/new.spec.js +++ b/modules/order/back/methods/order/specs/new.spec.js @@ -9,7 +9,7 @@ describe('order new()', () => { try { const options = {transaction: tx}; - const landed = new Date(); + const landed = Date.vnNew(); const addressFk = 6; const agencyModeFk = 1; @@ -30,7 +30,7 @@ describe('order new()', () => { try { const options = {transaction: tx}; - const landed = new Date(); + const landed = Date.vnNew(); const addressFk = 121; const agencyModeFk = 1; diff --git a/modules/order/front/basic-data/index.spec.js b/modules/order/front/basic-data/index.spec.js index 01009d085..21dee0765 100644 --- a/modules/order/front/basic-data/index.spec.js +++ b/modules/order/front/basic-data/index.spec.js @@ -46,7 +46,7 @@ describe('Order', () => { it('should set agencyModeFk to null and get the available agencies if the order has landed and client', async() => { controller.order.agencyModeFk = 999; controller.order.addressFk = 999; - controller.order.landed = new Date(); + controller.order.landed = Date.vnNew(); const expectedAgencies = [{id: 1}, {id: 2}]; diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js index 5fdd2e238..c0777ebc9 100644 --- a/modules/order/front/catalog/index.js +++ b/modules/order/front/catalog/index.js @@ -157,7 +157,7 @@ class Controller extends Section { * Apply order to model */ applyOrder() { - if (this.typeId || this.tagGroups.length > 0) + if (this.typeId || this.tagGroups.length > 0 || this.itemName) this.$.model.addFilter(null, {orderBy: this.getOrderBy()}); } diff --git a/modules/order/front/index/index.js b/modules/order/front/index/index.js index a8e6e977e..750f2e226 100644 --- a/modules/order/front/index/index.js +++ b/modules/order/front/index/index.js @@ -8,7 +8,7 @@ export default class Controller extends Section { } compareDate(date) { - let today = new Date(); + let today = Date.vnNew(); today.setHours(0, 0, 0, 0); date = new Date(date); diff --git a/modules/order/front/index/index.spec.js b/modules/order/front/index/index.spec.js index 5b85b3333..abe336478 100644 --- a/modules/order/front/index/index.spec.js +++ b/modules/order/front/index/index.spec.js @@ -26,14 +26,14 @@ describe('Component vnOrderIndex', () => { describe('compareDate()', () => { it('should return warning when the date is the present', () => { - let curDate = new Date(); + let curDate = Date.vnNew(); let result = controller.compareDate(curDate); expect(result).toEqual('warning'); }); it('should return sucess when the date is in the future', () => { - let futureDate = new Date(); + let futureDate = Date.vnNew(); futureDate = futureDate.setDate(futureDate.getDate() + 10); let result = controller.compareDate(futureDate); @@ -41,7 +41,7 @@ describe('Component vnOrderIndex', () => { }); it('should return undefined when the date is in the past', () => { - let pastDate = new Date(); + let pastDate = Date.vnNew(); pastDate = pastDate.setDate(pastDate.getDate() - 10); let result = controller.compareDate(pastDate); diff --git a/modules/order/front/line/index.html b/modules/order/front/line/index.html index f0a2f2bdf..7be5a00af 100644 --- a/modules/order/front/line/index.html +++ b/modules/order/front/line/index.html @@ -39,7 +39,7 @@ - {{::row.itemFk | zeroFill:6}} + {{::row.itemFk}} diff --git a/modules/order/front/summary/index.html b/modules/order/front/summary/index.html index 2813aeb9b..3622ae932 100644 --- a/modules/order/front/summary/index.html +++ b/modules/order/front/summary/index.html @@ -95,7 +95,7 @@ - {{::row.itemFk | zeroFill:6}} + {{::row.itemFk}} diff --git a/modules/route/back/methods/agency-term/filter.js b/modules/route/back/methods/agency-term/filter.js index 0ecec7e88..9d1268958 100644 --- a/modules/route/back/methods/agency-term/filter.js +++ b/modules/route/back/methods/agency-term/filter.js @@ -74,35 +74,35 @@ module.exports = Self => { filter = mergeFilters(filter, {where}); - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); const stmts = []; const stmt = new ParameterizedSQL( `SELECT * FROM ( - SELECT r.id routeFk, - r.created, - r.agencyModeFk, + SELECT r.id routeFk, + r.created, + r.agencyModeFk, am.name agencyModeName, - am.agencyFk, + am.agencyFk, a.name agencyAgreement, SUM(t.packages) packages, r.m3, - r.kmEnd - r.kmStart kmTotal, - CAST(IFNULL(sat.routePrice, - (sat.kmPrice * (GREATEST(r.kmEnd - r.kmStart , sat.minimumKm)) - + GREATEST(r.m3 , sat.minimumM3) * sat.m3Price) - + sat.packagePrice * SUM(t.packages) ) + r.kmEnd - r.kmStart kmTotal, + CAST(IFNULL(sat.routePrice, + (sat.kmPrice * (GREATEST(r.kmEnd - r.kmStart , sat.minimumKm)) + + GREATEST(r.m3 , sat.minimumM3) * sat.m3Price) + + sat.packagePrice * SUM(t.packages) ) AS DECIMAL(10,2)) price, r.invoiceInFk, sat.supplierFk, s.name supplierName FROM vn.route r - LEFT JOIN vn.agencyMode am ON r.agencyModeFk = am.id + LEFT JOIN vn.agencyMode am ON r.agencyModeFk = am.id LEFT JOIN vn.agency a ON am.agencyFk = a.id LEFT JOIN vn.ticket t ON t.routeFk = r.id LEFT JOIN vn.supplierAgencyTerm sat ON sat.agencyFk = a.id - LEFT JOIN vn.supplier s ON s.id = sat.supplierFk + LEFT JOIN vn.supplier s ON s.id = sat.supplierFk WHERE r.created > DATE_ADD(?, INTERVAL -2 MONTH) AND sat.supplierFk IS NOT NULL GROUP BY r.id ) a` 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 ad4613caf..2a8ebdba3 100644 --- a/modules/route/back/methods/agency-term/specs/createInvoiceIn.spec.js +++ b/modules/route/back/methods/agency-term/specs/createInvoiceIn.spec.js @@ -16,7 +16,6 @@ describe('AgencyTerm createInvoiceIn()', () => { ]; it('should make an invoiceIn', async() => { - pending('Include after #3638 export database'); const tx = await models.AgencyTerm.beginTransaction({}); const options = {transaction: tx}; diff --git a/modules/route/back/methods/agency-term/specs/filter.spec.js b/modules/route/back/methods/agency-term/specs/filter.spec.js index d6c00e585..41e696157 100644 --- a/modules/route/back/methods/agency-term/specs/filter.spec.js +++ b/modules/route/back/methods/agency-term/specs/filter.spec.js @@ -3,7 +3,7 @@ const models = require('vn-loopback/server/server').models; describe('AgencyTerm filter()', () => { const authUserId = 9; - const today = new Date(); + const today = Date.vnNew(); today.setHours(2, 0, 0, 0); it('should return all results matching the filter', async() => { @@ -57,10 +57,10 @@ describe('AgencyTerm filter()', () => { const options = {transaction: tx}; try { - const from = new Date(); + const from = Date.vnNew(); from.setHours(0, 0, 0, 0); - const to = new Date(); + const to = Date.vnNew(); to.setHours(23, 59, 59, 999); const ctx = { diff --git a/modules/route/back/methods/route/downloadZip.js b/modules/route/back/methods/route/downloadZip.js new file mode 100644 index 000000000..597f1d1f6 --- /dev/null +++ b/modules/route/back/methods/route/downloadZip.js @@ -0,0 +1,62 @@ +const JSZip = require('jszip'); + +module.exports = Self => { + Self.remoteMethodCtx('downloadZip', { + description: 'Download a zip file with multiple routes pdfs', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'string', + description: 'The routes ids', + } + ], + 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: '/downloadZip', + verb: 'GET' + } + }); + + Self.downloadZip = async function(ctx, id, options) { + const models = Self.app.models; + const myOptions = {}; + const zip = new JSZip(); + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const ids = id.split(','); + for (let id of ids) { + ctx.args.id = id; + const routePdf = await models.Route.driverRoutePdf(ctx, id); + const fileName = extractFileName(routePdf[2]); + const body = routePdf[0]; + + zip.file(fileName, body); + } + + const stream = zip.generateNodeStream({streamFiles: true}); + + return [stream, 'application/zip', `filename="download.zip"`]; + }; + + function extractFileName(str) { + const matches = str.match(/"(.*?)"/); + return matches ? matches[1] : str; + } +}; diff --git a/modules/route/back/methods/route/driverRouteEmail.js b/modules/route/back/methods/route/driverRouteEmail.js new file mode 100644 index 000000000..82b005e44 --- /dev/null +++ b/modules/route/back/methods/route/driverRouteEmail.js @@ -0,0 +1,43 @@ +module.exports = Self => { + Self.remoteMethodCtx('driverRouteEmail', { + description: 'Sends the driver route email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id to send to the recipient preferred language', + required: false + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/:id/driver-route-email', + verb: 'POST' + } + }); + + Self.driverRouteEmail = ctx => Self.sendTemplate(ctx, 'driver-route'); +}; diff --git a/modules/route/back/methods/route/driverRoutePdf.js b/modules/route/back/methods/route/driverRoutePdf.js new file mode 100644 index 000000000..f0cd75f0e --- /dev/null +++ b/modules/route/back/methods/route/driverRoutePdf.js @@ -0,0 +1,41 @@ +module.exports = Self => { + Self.remoteMethodCtx('driverRoutePdf', { + description: 'Returns the driver route pdf', + accepts: [ + { + arg: 'id', + type: 'string', + required: true, + description: 'The route id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + } + ], + 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/driver-route-pdf', + verb: 'GET' + } + }); + + Self.driverRoutePdf = (ctx, id) => Self.printReport(ctx, id, 'driver-route'); +}; diff --git a/modules/route/back/methods/route/getTickets.js b/modules/route/back/methods/route/getTickets.js index 9a2f5289a..1eb9e27f5 100644 --- a/modules/route/back/methods/route/getTickets.js +++ b/modules/route/back/methods/route/getTickets.js @@ -33,35 +33,39 @@ module.exports = Self => { const stmt = new ParameterizedSQL( `SELECT - t.id, - t.packages, - t.warehouseFk, - t.nickname, - t.clientFk, - t.priority, - t.addressFk, - st.code AS ticketStateCode, - st.name AS ticketStateName, - wh.name AS warehouseName, - tob.description AS ticketObservation, - a.street, - a.postalCode, - a.city, - am.name AS agencyModeName, - u.nickname AS userNickname, - vn.ticketTotalVolume(t.id) AS volume - FROM route r - JOIN ticket t ON t.routeFk = r.id - LEFT JOIN ticketState ts ON ts.ticketFk = t.id - LEFT JOIN state st ON st.id = ts.stateFk - LEFT JOIN warehouse wh ON wh.id = t.warehouseFk - LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id - LEFT JOIN observationType ot ON tob.observationTypeFk = ot.id - AND ot.code = 'delivery' - LEFT JOIN address a ON a.id = t.addressFk - LEFT JOIN agencyMode am ON am.id = t.agencyModeFk - LEFT JOIN account.user u ON u.id = r.workerFk - LEFT JOIN vehicle v ON v.id = r.vehicleFk` + t.id, + t.packages, + t.warehouseFk, + t.nickname, + t.clientFk, + t.priority, + t.addressFk, + st.code AS ticketStateCode, + st.name AS ticketStateName, + wh.name AS warehouseName, + tob.description AS ticketObservation, + a.street, + a.postalCode, + a.city, + am.name AS agencyModeName, + u.nickname AS userNickname, + vn.ticketTotalVolume(t.id) AS volume, + tob.description, + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt + FROM vn.route r + JOIN ticket t ON t.routeFk = r.id + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN ticketState ts ON ts.ticketFk = t.id + LEFT JOIN state st ON st.id = ts.stateFk + LEFT JOIN warehouse wh ON wh.id = t.warehouseFk + LEFT JOIN observationType ot ON ot.code = 'delivery' + LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id + AND tob.observationTypeFk = ot.id + LEFT JOIN address a ON a.id = t.addressFk + LEFT JOIN agencyMode am ON am.id = t.agencyModeFk + LEFT JOIN account.user u ON u.id = r.workerFk + LEFT JOIN vehicle v ON v.id = r.vehicleFk` ); if (!filter.where) filter.where = {}; @@ -69,7 +73,9 @@ module.exports = Self => { const where = filter.where; where['r.id'] = filter.id; - stmt.merge(conn.makeSuffix(filter)); + stmt.merge(conn.makeWhere(filter.where)); + stmt.merge(conn.makeGroupBy('t.id')); + stmt.merge(conn.makeOrderBy(filter.order)); const tickets = await conn.executeStmt(stmt, myOptions); diff --git a/modules/route/back/methods/route/sendSms.js b/modules/route/back/methods/route/sendSms.js new file mode 100644 index 000000000..d1c3efa35 --- /dev/null +++ b/modules/route/back/methods/route/sendSms.js @@ -0,0 +1,39 @@ + +module.exports = Self => { + Self.remoteMethodCtx('sendSms', { + description: 'Sends a SMS to each client of the routes, each client only recieves the SMS once', + accessType: 'WRITE', + accepts: [ + { + arg: 'destination', + type: 'string', + description: 'A comma separated string of destinations', + required: true, + }, + { + arg: 'message', + type: 'string', + required: true, + }], + returns: { + type: 'object', + root: true + }, + http: { + path: `/sendSms`, + verb: 'POST' + } + }); + + Self.sendSms = async(ctx, destination, message) => { + const targetClients = destination.split(','); + + const allSms = []; + for (let client of targetClients) { + let sms = await Self.app.models.Sms.send(ctx, client, message); + allSms.push(sms); + } + + return allSms; + }; +}; diff --git a/modules/route/back/methods/route/specs/clone.spec.js b/modules/route/back/methods/route/specs/clone.spec.js index d1fc6b297..496ae1c89 100644 --- a/modules/route/back/methods/route/specs/clone.spec.js +++ b/modules/route/back/methods/route/specs/clone.spec.js @@ -1,7 +1,23 @@ const app = require('vn-loopback/server/server'); +const LoopBackContext = require('loopback-context'); describe('route clone()', () => { - const createdDate = new Date(); + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + + const createdDate = Date.vnNew(); it('should throw an error if the amount of ids pased to the clone function do no match the database', async() => { const ids = [996, 997, 998, 999]; diff --git a/modules/route/back/methods/route/specs/filter.spec.js b/modules/route/back/methods/route/specs/filter.spec.js index 9d481f21e..18c0ca04f 100644 --- a/modules/route/back/methods/route/specs/filter.spec.js +++ b/modules/route/back/methods/route/specs/filter.spec.js @@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server'); const models = require('vn-loopback/server/server').models; describe('Route filter()', () => { - const today = new Date(); + const today = Date.vnNew(); today.setHours(2, 0, 0, 0); it('should return the routes matching "search"', async() => { @@ -23,10 +23,10 @@ describe('Route filter()', () => { const options = {transaction: tx}; try { - const from = new Date(); + const from = Date.vnNew(); from.setHours(0, 0, 0, 0); - const to = new Date(); + const to = Date.vnNew(); to.setHours(23, 59, 59, 999); const ctx = { args: { diff --git a/modules/route/back/methods/route/specs/getDeliveryPoint.spec.js b/modules/route/back/methods/route/specs/getDeliveryPoint.spec.js index 4025b04d6..b08051c0a 100644 --- a/modules/route/back/methods/route/specs/getDeliveryPoint.spec.js +++ b/modules/route/back/methods/route/specs/getDeliveryPoint.spec.js @@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server'); describe('route getDeliveryPoint()', () => { const routeId = 1; - const deliveryPointAddress = '46460 Av Espioca 100-Silla'; + const deliveryPointAddress = '1007 Mountain Drive, Gotham'; it('should get the delivery point addres of a route with assigned vehicle', async() => { let route = await app.models.Route.findById(routeId); diff --git a/modules/route/back/methods/route/specs/getSuggestedTickets.spec.js b/modules/route/back/methods/route/specs/getSuggestedTickets.spec.js index bb38cb50e..0acc6c1a7 100644 --- a/modules/route/back/methods/route/specs/getSuggestedTickets.spec.js +++ b/modules/route/back/methods/route/specs/getSuggestedTickets.spec.js @@ -23,7 +23,7 @@ describe('route getSuggestedTickets()', () => { await ticketInRoute.updateAttributes({ routeFk: null, - landed: new Date() + landed: Date.vnNew() }, options); const result = await models.Route.getSuggestedTickets(routeID, options); diff --git a/modules/route/back/methods/route/specs/insertTicket.spec.js b/modules/route/back/methods/route/specs/insertTicket.spec.js index 7c60e755f..19d02e1ef 100644 --- a/modules/route/back/methods/route/specs/insertTicket.spec.js +++ b/modules/route/back/methods/route/specs/insertTicket.spec.js @@ -23,7 +23,7 @@ describe('route insertTicket()', () => { const ticketInRoute = await app.models.Ticket.findById(ticketId, null, options); await ticketInRoute.updateAttributes({ routeFk: null, - landed: new Date() + landed: Date.vnNew() }, options); const result = await app.models.Route.insertTicket(routeId, ticketId, options); diff --git a/modules/route/back/methods/route/specs/updateWorkCenter.spec.js b/modules/route/back/methods/route/specs/updateWorkCenter.spec.js new file mode 100644 index 000000000..baa63f226 --- /dev/null +++ b/modules/route/back/methods/route/specs/updateWorkCenter.spec.js @@ -0,0 +1,65 @@ +const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); + +describe('route updateWorkCenter()', () => { + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + const routeId = 1; + + it('should set the commission work center if the worker has workCenter', async() => { + const tx = await models.Route.beginTransaction({}); + try { + const developerId = 9; + const ctx = { + req: { + accessToken: {userId: developerId} + } + }; + const options = {transaction: tx}; + + const expectedResult = 1; + const updatedRoute = await models.Route.updateWorkCenter(ctx, routeId, options); + + expect(updatedRoute.commissionWorkCenterFk).toEqual(expectedResult); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it(`shoul set the default commision work center if that worker didn't have one yet`, async() => { + const tx = await models.Route.beginTransaction({}); + try { + const userWithoutWorkCenter = 2; + const ctx = { + req: { + accessToken: {userId: userWithoutWorkCenter} + } + }; + const options = {transaction: tx}; + + const expectedResult = 9; + const updatedRoute = await models.Route.updateWorkCenter(ctx, routeId, options); + + expect(updatedRoute.commissionWorkCenterFk).toEqual(expectedResult); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/route/back/methods/route/updateWorkCenter.js b/modules/route/back/methods/route/updateWorkCenter.js new file mode 100644 index 000000000..75169ce7e --- /dev/null +++ b/modules/route/back/methods/route/updateWorkCenter.js @@ -0,0 +1,55 @@ +module.exports = Self => { + Self.remoteMethodCtx('updateWorkCenter', { + description: 'Update the commission work center through user salix connected', + accessType: 'WRITE', + accepts: { + arg: 'id', + type: 'number', + description: 'Route Id', + http: {source: 'path'} + }, + returns: { + type: 'object', + root: true + }, + http: { + path: `/:id/updateWorkCenter`, + verb: 'POST' + } + }); + + Self.updateWorkCenter = async(ctx, id, options) => { + const models = Self.app.models; + const myOptions = {}; + let tx; + const userId = ctx.req.accessToken.userId; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const date = Date.vnNew(); + const [result] = await Self.rawSql(` + SELECT IFNULL(wl.workCenterFk, r.defaultWorkCenterFk) AS commissionWorkCenter + FROM vn.routeConfig r + LEFT JOIN vn.workerLabour wl ON wl.workerFk = ? + AND ? BETWEEN wl.started AND IFNULL(wl.ended, ?); + `, [userId, date, date], myOptions); + + const route = await models.Route.findById(id, null, myOptions); + await route.updateAttribute('commissionWorkCenterFk', result.commissionWorkCenter, myOptions); + + if (tx) await tx.commit(); + + return route; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js index c82d1722e..883f4597e 100644 --- a/modules/route/back/models/route.js +++ b/modules/route/back/models/route.js @@ -9,6 +9,11 @@ module.exports = Self => { require('../methods/route/clone')(Self); require('../methods/route/getSuggestedTickets')(Self); require('../methods/route/unlink')(Self); + require('../methods/route/updateWorkCenter')(Self); + require('../methods/route/driverRoutePdf')(Self); + require('../methods/route/driverRouteEmail')(Self); + require('../methods/route/sendSms')(Self); + require('../methods/route/downloadZip')(Self); Self.validate('kmStart', validateDistance, { message: 'Distance must be lesser than 1000' diff --git a/modules/route/back/models/route.json b/modules/route/back/models/route.json index 46fb6b76f..3b12f4ee6 100644 --- a/modules/route/back/models/route.json +++ b/modules/route/back/models/route.json @@ -2,7 +2,8 @@ "name": "Route", "base": "Loggable", "log": { - "model":"RouteLog" + "model":"RouteLog", + "grabUser": true }, "options": { "mysql": { @@ -47,6 +48,12 @@ }, "description": { "type": "string" + }, + "isOk": { + "type": "boolean" + }, + "commissionWorkCenterFk": { + "type": "number" } }, "relations": { diff --git a/modules/route/back/models/vehicle.json b/modules/route/back/models/vehicle.json index a35926bef..34a376b89 100644 --- a/modules/route/back/models/vehicle.json +++ b/modules/route/back/models/vehicle.json @@ -50,8 +50,10 @@ }, "scope": { "where": { - "isActive": true - } + "isActive": { + "neq": false + } + } }, "acls": [ { diff --git a/modules/route/front/agency-term/index/index.js b/modules/route/front/agency-term/index/index.js index f73095e7a..6c3bafc9a 100644 --- a/modules/route/front/agency-term/index/index.js +++ b/modules/route/front/agency-term/index/index.js @@ -1,6 +1,5 @@ import ngModule from '../../module'; import Section from 'salix/components/section'; -import './style.scss'; class Controller extends Section { constructor($element, $) { diff --git a/modules/route/front/agency-term/index/style.scss b/modules/route/front/agency-term/index/style.scss deleted file mode 100644 index eaa1a16ed..000000000 --- a/modules/route/front/agency-term/index/style.scss +++ /dev/null @@ -1,32 +0,0 @@ -@import "variables"; - -vn-item-product { - display: block; - - .id { - background-color: $color-main; - color: $color-font-dark; - margin-bottom: 0; - } - .image { - height: 112px; - width: 112px; - - & > img { - max-height: 100%; - max-width: 100%; - border-radius: 3px; - } - } - vn-label-value:first-of-type section{ - margin-top: 9px; - } -} - -table { - img { - border-radius: 50%; - width: 50px; - height: 50px; - } -} \ No newline at end of file diff --git a/modules/route/front/basic-data/index.html b/modules/route/front/basic-data/index.html index d3ba25b11..831599ae8 100644 --- a/modules/route/front/basic-data/index.html +++ b/modules/route/front/basic-data/index.html @@ -21,7 +21,7 @@
{{name}} - {{nickname}}
- + + diff --git a/modules/route/front/basic-data/locale/es.yml b/modules/route/front/basic-data/locale/es.yml index a98f20215..9dcacbe9a 100644 --- a/modules/route/front/basic-data/locale/es.yml +++ b/modules/route/front/basic-data/locale/es.yml @@ -5,3 +5,4 @@ Km end: Km de fin Description: Descripción Hour started: Hora inicio Hour finished: Hora fin +Is served: Se ha servido diff --git a/modules/route/front/card/index.js b/modules/route/front/card/index.js index 5813c9e89..6bf233c0a 100644 --- a/modules/route/front/card/index.js +++ b/modules/route/front/card/index.js @@ -18,7 +18,8 @@ class Controller extends ModuleCard { 'started', 'finished', 'cost', - 'zoneFk' + 'zoneFk', + 'isOk' ], include: [ { diff --git a/modules/route/front/create/index.js b/modules/route/front/create/index.js index 56c8cc25a..c81394c10 100644 --- a/modules/route/front/create/index.js +++ b/modules/route/front/create/index.js @@ -4,7 +4,12 @@ import Section from 'salix/components/section'; export default class Controller extends Section { onSubmit() { this.$.watcher.submit().then( - res => this.$state.go('route.card.summary', {id: res.data.id}) + res => { + this.$http.post(`Routes/${res.data.id}/updateWorkCenter`, null) + .then(() => { + this.$state.go('route.card.summary', {id: res.data.id}); + }); + } ); } } diff --git a/modules/route/front/descriptor/index.html b/modules/route/front/descriptor/index.html index fc1d3419c..6d6fb082e 100644 --- a/modules/route/front/descriptor/index.html +++ b/modules/route/front/descriptor/index.html @@ -20,6 +20,13 @@ translate> Update volume + + Delete route +
diff --git a/modules/route/front/descriptor/index.js b/modules/route/front/descriptor/index.js index 32411aa58..aa47044b1 100644 --- a/modules/route/front/descriptor/index.js +++ b/modules/route/front/descriptor/index.js @@ -11,17 +11,19 @@ class Controller extends Descriptor { } showRouteReport() { - this.vnReport.show('driver-route', { - routeId: this.id + this.vnReport.show(`Routes/${this.id}/driver-route-pdf`, { + id: this.id }); } sendRouteReport() { const workerUser = this.route.worker.user; - this.vnEmail.send('driver-route', { + this.vnEmail.send(`Routes/${this.id}/driver-route-email`, { recipient: workerUser.emailUser.email, - routeId: this.id + id: this.id }); + const params = {isOk: true}; + return this.$http.patch(`Routes/${this.id}`, params); } updateVolume() { @@ -32,6 +34,14 @@ class Controller extends Descriptor { }); } + deleteCurrentRoute() { + this.$http.delete(`Routes/${this.id}`) + .then(() => { + this.vnApp.showSuccess(this.$t('Route deleted')); + this.$state.go('route.index'); + }); + } + loadData() { const filter = { fields: [ diff --git a/modules/route/front/descriptor/index.spec.js b/modules/route/front/descriptor/index.spec.js index ab996d9b0..f43666c8b 100644 --- a/modules/route/front/descriptor/index.spec.js +++ b/modules/route/front/descriptor/index.spec.js @@ -23,4 +23,20 @@ describe('vnRouteDescriptorPopover', () => { expect(controller.route).toEqual(response); }); }); + + describe('deleteCurrentRoute()', () => { + it(`should perform a delete query to delete the current route`, () => { + const id = 1; + + jest.spyOn(controller.vnApp, 'showSuccess'); + + controller._id = id; + $httpBackend.expectDELETE(`Routes/${id}`).respond(200); + controller.deleteCurrentRoute(); + $httpBackend.flush(); + + expect(controller.route).toBeUndefined(); + expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Route deleted'); + }); + }); }); diff --git a/modules/route/front/descriptor/locale/es.yml b/modules/route/front/descriptor/locale/es.yml index 63fa7202b..23068fbf8 100644 --- a/modules/route/front/descriptor/locale/es.yml +++ b/modules/route/front/descriptor/locale/es.yml @@ -4,4 +4,6 @@ Send route report: Enviar informe de ruta Show route report: Ver informe de ruta Update volume: Actualizar volumen Volume updated: Volumen actualizado +Delete route: Borrar ruta +Route deleted: Ruta borrada Are you sure you want to update the volume?: Estas seguro que quieres actualizar el volumen? \ No newline at end of file diff --git a/modules/route/front/index.js b/modules/route/front/index.js index 55cb745e1..c43048df5 100644 --- a/modules/route/front/index.js +++ b/modules/route/front/index.js @@ -15,3 +15,4 @@ import './agency-term/index'; import './agency-term/createInvoiceIn'; import './agency-term-search-panel'; import './ticket-popup'; +import './sms'; diff --git a/modules/route/front/index/index.html b/modules/route/front/index/index.html index 6d4bb202d..7a64a9aff 100644 --- a/modules/route/front/index/index.html +++ b/modules/route/front/index/index.html @@ -1,69 +1,164 @@ - +
- - - - - - - - Id - Worker - Agency - Vehicle - Date - - Description - - - - - - - - - - {{::route.id | dashIfEmpty}} - - - {{::route.workerUserName}} - - - {{::route.agencyName | dashIfEmpty}} - {{::route.vehiclePlateNumber | dashIfEmpty}} - {{::route.created | dashIfEmpty | date:'dd/MM/yyyy'}} - {{::route.m3 | dashIfEmpty}} - {{::route.description | dashIfEmpty}} - - - - - - - - - + + +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + Id + + Worker + + Agency + + Vehicle + + Date + + + + Description + + Hour started + + Hour finished +
+ + + {{::route.id | dashIfEmpty}} + + +
{{name}} - {{nickname}}
+
+
+
+ + + + + + + + + {{::route.m3 | dashIfEmpty}} + + + + + + + + + + + + + +
+
+
- +
- - - - { + this.vnApp.showSuccess(this.$t('Data saved!')); + }); + } + + markAsServed() { + const routes = []; + for (let route of this.checked) + routes.push(route.id); + + const params = {isOk: true}; + for (let routeId of routes) + this.$http.patch(`Routes/${routeId}`, params); + } } Controller.$inject = ['$element', '$scope', 'vnReport']; diff --git a/modules/route/front/index/index.spec.js b/modules/route/front/index/index.spec.js index 80e660b76..399ece714 100644 --- a/modules/route/front/index/index.spec.js +++ b/modules/route/front/index/index.spec.js @@ -12,7 +12,7 @@ describe('Component vnRouteIndex', () => { const $element = angular.element(''); controller = $componentController('vnRouteIndex', {$element}); controller.$.model = crudModel; - controller.$.model.data = [{id: 1}, {id: 2}, {id: 3}]; + controller.$.model.data = [{id: 1, checked: true}, {id: 2}, {id: 3}]; })); describe('checked() getter', () => { @@ -44,25 +44,21 @@ describe('Component vnRouteIndex', () => { describe('showRouteReport()', () => { it('should call to the vnReport show method', () => { - controller.vnReport.show = jest.fn(); + jest.spyOn(window, 'open').mockReturnThis(); const data = controller.$.model.data; data[0].checked = true; data[2].checked = true; - const expectedParams = { - authorization: null, - routeId: '1,3' - }; controller.showRouteReport(); - expect(controller.vnReport.show).toHaveBeenCalledWith('driver-route', expectedParams); + expect(window.open).toHaveBeenCalled(); }); }); describe('cloneSelectedRoutes()', () => { it('should perform an http request to Routes/clone', () => { - controller.createdDate = new Date(); + controller.createdDate = Date.vnNew(); $httpBackend.expect('POST', 'Routes/clone').respond(); controller.cloneSelectedRoutes(); @@ -148,4 +144,13 @@ describe('Component vnRouteIndex', () => { expect(controller.$.model.refresh).toHaveBeenCalledWith(); }); }); + + describe('markAsServed()', () => { + it('should perform a HTTP patch query', () => { + const data = {isOk: true}; + $httpBackend.expect('PATCH', `Routes/1`, data).respond(); + controller.markAsServed(); + $httpBackend.flush(); + }); + }); }); diff --git a/modules/route/front/index/locale/es.yml b/modules/route/front/index/locale/es.yml index 591ea80d8..3db84d81e 100644 --- a/modules/route/front/index/locale/es.yml +++ b/modules/route/front/index/locale/es.yml @@ -2,4 +2,12 @@ Vehicle: Vehículo Download selected routes as PDF: Descargar rutas seleccionadas como PDF Clone selected routes: Clonar rutas seleccionadas The date can't be empty: La fecha no puede estar vacía -Starting date: Fecha de inicio \ No newline at end of file +Starting date: Fecha de inicio +Hour started: Hora inicio +Hour finished: Hora fin +Go to route: Ir a la ruta +You must select a valid time: Debe seleccionar una hora válida +You must select a valid date: Debe seleccionar una fecha válida +Mark as served: Marcar como servidas +Retrieving data from the routes: Recuperando datos de las rutas +Send SMS to all clients: Mandar sms a todos los clientes de las rutas \ No newline at end of file diff --git a/modules/route/front/main/index.js b/modules/route/front/main/index.js index 938f81bcc..8c57bbad6 100644 --- a/modules/route/front/main/index.js +++ b/modules/route/front/main/index.js @@ -3,11 +3,11 @@ import ModuleMain from 'salix/components/module-main'; export default class Route extends ModuleMain { $postLink() { - const to = new Date(); + const to = Date.vnNew(); to.setDate(to.getDate() + 1); to.setHours(0, 0, 0, 0); - const from = new Date(); + const from = Date.vnNew(); from.setDate(from.getDate()); from.setHours(0, 0, 0, 0); @@ -21,7 +21,7 @@ export default class Route extends ModuleMain { $params.scopeDays = 1; if (typeof $params.scopeDays === 'number') { - const from = new Date(); + const from = Date.vnNew(); from.setHours(0, 0, 0, 0); const to = new Date(from.getTime()); diff --git a/modules/route/front/main/index.spec.js b/modules/route/front/main/index.spec.js index e5724b493..0c16a7b1f 100644 --- a/modules/route/front/main/index.spec.js +++ b/modules/route/front/main/index.spec.js @@ -15,7 +15,7 @@ describe('Route Component vnRoute', () => { let params = controller.fetchParams({ scopeDays: 2 }); - const from = new Date(); + const from = Date.vnNew(); from.setHours(0, 0, 0, 0); const to = new Date(from.getTime()); to.setDate(to.getDate() + params.scopeDays); diff --git a/modules/route/front/routes.json b/modules/route/front/routes.json index f5e7d9ae8..75e1fdc57 100644 --- a/modules/route/front/routes.json +++ b/modules/route/front/routes.json @@ -39,7 +39,7 @@ "abstract": true, "component": "vn-route-card" }, { - "url": "/agency-term", + "url": "/agency-term?q", "abstract": true, "state": "route.agencyTerm", "component": "ui-view" @@ -49,12 +49,12 @@ "component": "vn-agency-term-index", "description": "Autonomous", "acl": ["administrative"] - },{ + },{ "url": "/createInvoiceIn?q", "state": "route.agencyTerm.createInvoiceIn", "component": "vn-agency-term-create-invoice-in", "description": "File management", - "params": { + "params": { "route": "$ctrl.route" }, "acl": ["administrative"] @@ -92,4 +92,4 @@ "acl": ["delivery"] } ] -} \ No newline at end of file +} diff --git a/modules/route/front/search-panel/index.spec.js b/modules/route/front/search-panel/index.spec.js index 16e1a5cfc..ae15e16e4 100644 --- a/modules/route/front/search-panel/index.spec.js +++ b/modules/route/front/search-panel/index.spec.js @@ -15,7 +15,7 @@ describe('Route Component vnRouteSearchPanel', () => { it('should clear the scope days when setting the from property', () => { controller.filter.scopeDays = 1; - controller.from = new Date(); + controller.from = Date.vnNew(); expect(controller.filter.scopeDays).toBeNull(); expect(controller.from).toBeDefined(); @@ -26,7 +26,7 @@ describe('Route Component vnRouteSearchPanel', () => { it('should clear the scope days when setting the to property', () => { controller.filter.scopeDays = 1; - controller.to = new Date(); + controller.to = Date.vnNew(); expect(controller.filter.scopeDays).toBeNull(); expect(controller.to).toBeDefined(); @@ -35,8 +35,8 @@ describe('Route Component vnRouteSearchPanel', () => { describe('scopeDays() setter', () => { it('should clear the date range when setting the scopeDays property', () => { - controller.filter.from = new Date(); - controller.filter.to = new Date(); + controller.filter.from = Date.vnNew(); + controller.filter.to = Date.vnNew(); controller.scopeDays = 1; diff --git a/modules/ticket/front/sms/index.html b/modules/route/front/sms/index.html similarity index 79% rename from modules/ticket/front/sms/index.html rename to modules/route/front/sms/index.html index 97bdfef14..0d7dd7c11 100644 --- a/modules/ticket/front/sms/index.html +++ b/modules/route/front/sms/index.html @@ -1,19 +1,10 @@ + message="Send SMS to the selected tickets">
- - - - { - this.vnApp.showMessage(this.$t('SMS sent!')); + this.$http.post(`Routes/sendSms`, this.sms).then(res => { + this.vnApp.showMessage(this.$t('SMS sent')); if (res.data) this.emit('send', {response: res.data}); }); @@ -38,7 +38,7 @@ class Controller extends Component { } } -ngModule.vnComponent('vnTicketSms', { +ngModule.vnComponent('vnRouteSms', { template: require('./index.html'), controller: Controller, bindings: { diff --git a/modules/ticket/front/sms/index.spec.js b/modules/route/front/sms/index.spec.js similarity index 79% rename from modules/ticket/front/sms/index.spec.js rename to modules/route/front/sms/index.spec.js index b133db04d..8bf35e673 100644 --- a/modules/ticket/front/sms/index.spec.js +++ b/modules/route/front/sms/index.spec.js @@ -1,17 +1,17 @@ import './index'; -describe('Ticket', () => { - describe('Component vnTicketSms', () => { +describe('Route', () => { + describe('Component vnRouteSms', () => { let controller; let $httpBackend; - beforeEach(ngModule('ticket')); + beforeEach(ngModule('route')); beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; let $scope = $rootScope.$new(); const $element = angular.element(''); - controller = $componentController('vnTicketSms', {$element, $scope}); + controller = $componentController('vnRouteSms', {$element, $scope}); controller.$.message = { input: { value: 'My SMS' @@ -21,16 +21,16 @@ describe('Ticket', () => { describe('onResponse()', () => { it('should perform a POST query and show a success snackbar', () => { - let params = {ticketId: 11, destinationFk: 1101, destination: 111111111, message: 'My SMS'}; - controller.sms = {ticketId: 11, destinationFk: 1101, destination: 111111111, message: 'My SMS'}; + let params = {destinationFk: 1101, destination: 111111111, message: 'My SMS'}; + controller.sms = {destinationFk: 1101, destination: 111111111, message: 'My SMS'}; jest.spyOn(controller.vnApp, 'showMessage'); - $httpBackend.expect('POST', `Tickets/11/sendSms`, params).respond(200, params); + $httpBackend.expect('POST', `Routes/sendSms`, params).respond(200, params); controller.onResponse(); $httpBackend.flush(); - expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!'); + expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent'); }); it('should call onResponse without the destination and show an error snackbar', () => { diff --git a/modules/ticket/front/sms/locale/es.yml b/modules/route/front/sms/locale/es.yml similarity index 68% rename from modules/ticket/front/sms/locale/es.yml rename to modules/route/front/sms/locale/es.yml index 64c3fcca6..0168a6eb6 100644 --- a/modules/ticket/front/sms/locale/es.yml +++ b/modules/route/front/sms/locale/es.yml @@ -1,5 +1,5 @@ -Send SMS: Enviar SMS -Destination: Destinatario +Send SMS to the selected tickets: Enviar SMS a los tickets seleccionados +Routes to notify: Rutas a notificar Message: Mensaje SMS sent!: ¡SMS enviado! Characters remaining: Carácteres restantes diff --git a/modules/ticket/front/sms/style.scss b/modules/route/front/sms/style.scss similarity index 100% rename from modules/ticket/front/sms/style.scss rename to modules/route/front/sms/style.scss diff --git a/modules/route/front/summary/index.html b/modules/route/front/summary/index.html index 86f558634..56f7a49b9 100644 --- a/modules/route/front/summary/index.html +++ b/modules/route/front/summary/index.html @@ -10,26 +10,26 @@ - - - - - {{$ctrl.summary.route.worker.user.name}} - @@ -40,35 +40,35 @@ - - - -

- Ticket

-

Ticket @@ -77,45 +77,56 @@ Order - Ticket id - Alias + Street + City + PC + Client + Warehouse Packages - Warehouse - PC - Street + Packaging + Ticket {{ticket.priority | dashIfEmpty}} + {{ticket.street}} + + {{::ticket.city}} + + {{ticket.postalCode}} + + + {{ticket.nickname}} + + + {{ticket.warehouseName}} + {{ticket.packages}} + {{ticket.volume}} + {{ticket.ipt}} - {{ticket.id}} - - {{ticket.nickname}} - - - {{ticket.packages}} - {{ticket.volume}} - {{ticket.warehouseName}} - {{ticket.postalCode}} - {{ticket.street}} - - - + + @@ -123,12 +134,12 @@ - - diff --git a/modules/route/front/summary/index.js b/modules/route/front/summary/index.js index 543c54afc..9e1ea1856 100644 --- a/modules/route/front/summary/index.js +++ b/modules/route/front/summary/index.js @@ -31,6 +31,21 @@ class Controller extends Summary { this.sumPackages(); }); } + + goToBuscaman(ticket) { + if (!this.route.vehicleFk) + throw new UserError(`The route doesn't have a vehicle`); + let query = `Routes/${this.route.vehicleFk}/getDeliveryPoint`; + + this.$http.get(query).then(response => { + if (!response.data) + throw new UserError(`The route's vehicle doesn't have a delivery point`); + + const address = response.data + '+to:' + ticket.postalCode + ' ' + ticket.city + ' ' + ticket.street; + const url = 'http://gps.buscalia.com/usuario/localizar.aspx?bmi=true&addr='; + window.open(url + encodeURI(address), '_blank'); + }); + } } ngModule.vnComponent('vnRouteSummary', { diff --git a/modules/route/front/summary/index.spec.js b/modules/route/front/summary/index.spec.js index ad300817a..cfa21aeb9 100644 --- a/modules/route/front/summary/index.spec.js +++ b/modules/route/front/summary/index.spec.js @@ -37,5 +37,29 @@ describe('Route', () => { expect(controller.packagesTotal).toEqual(4); }); }); + + describe('goToBuscaman()', () => { + it('should open buscaman with the given arguments', () => { + jest.spyOn(window, 'open').mockReturnThis(); + const expectedUrl = 'http://gps.buscalia.com/usuario/localizar.aspx?bmi=true&addr=46460%20Av%20Espioca%20100+to:n19%20London%20my%20street'; + controller.route = {vehicleFk: 1}; + const url = `Routes/${controller.route.vehicleFk}/getDeliveryPoint`; + $httpBackend.when('GET', `Routes/1/summary`).respond(); + $httpBackend.expectGET(url).respond('46460 Av Espioca 100'); + + const ticket = { + id: 1, + checked: true, + street: 'my street', + postalCode: 'n19', + city: 'London' + }; + + controller.goToBuscaman(ticket); + $httpBackend.flush(); + + expect(window.open).toHaveBeenCalledWith(expectedUrl, '_blank'); + }); + }); }); }); diff --git a/modules/route/front/tickets/index.html b/modules/route/front/tickets/index.html index e02969219..32a4a2d7c 100644 --- a/modules/route/front/tickets/index.html +++ b/modules/route/front/tickets/index.html @@ -6,12 +6,13 @@ data="$ctrl.tickets" auto-load="true"> - -
- + +
+ + + + + + - - - + @@ -35,16 +53,20 @@ model="model"> + Order Street City PC Client + Warehouse Packages + Packaging Ticket + @@ -54,17 +76,31 @@ ng-model="ticket.checked"> + + + + + class="dense"> {{::ticket.street}} - {{::ticket.city}} + + {{::ticket.city}} + {{::ticket.postalCode}} + {{ticket.warehouseName}} {{::ticket.packages}} {{::ticket.volume | number:2}} + {{::ticket.ipt}} - + + + + + +
- - @@ -121,19 +168,29 @@ route="$ctrl.$params" parent-reload="$ctrl.$.model.refresh()"> - - - - + + + + + + +

+ - - \ No newline at end of file +
+ + + diff --git a/modules/route/front/tickets/index.js b/modules/route/front/tickets/index.js index b14b28ed6..8789708ac 100644 --- a/modules/route/front/tickets/index.js +++ b/modules/route/front/tickets/index.js @@ -20,15 +20,48 @@ class Controller extends Section { return highestPriority + 1; } + setHighestPriority(ticket) { + const highestPriority = this.getHighestPriority(); + if (highestPriority - 1 != ticket.priority) { + const params = {priority: highestPriority}; + const query = `Tickets/${ticket.id}/`; + this.$http.patch(query, params).then(res => { + ticket.priority = res.data.priority; + this.vnApp.showSuccess(this.$t('Data saved!')); + }); + } + } + setPriority(id, priority) { let params = {priority: priority}; let query = `Tickets/${id}/`; this.$http.patch(query, params).then(() => { this.vnApp.showSuccess(this.$t('Data saved!')); - this.$.model.refresh(); }); } + deletePriority() { + const lines = this.getSelectedItems(this.tickets); + + for (const line of lines) { + this.$http.patch(`Tickets/${line.id}/`, {priority: null}).then(() => { + this.vnApp.showSuccess(this.$t('Data saved!')); + this.$.model.refresh(); + }); + } + } + + setOrderedPriority(lines) { + let priority = 1; + for (const line of lines) { + this.$http.patch(`Tickets/${line.id}/`, {priority: priority}).then(() => { + this.vnApp.showSuccess(this.$t('Data saved!')); + this.$.model.refresh(); + }); + priority++; + } + } + getSelectedItems(items) { const selectedItems = []; @@ -41,27 +74,24 @@ class Controller extends Section { return selectedItems; } - goToBuscaman() { + goToBuscaman(ticket) { if (!this.route.vehicleFk) throw new UserError(`The route doesn't have a vehicle`); - let query = `Routes/${this.route.vehicleFk}/getDeliveryPoint`; - this.$http.get(query).then(response => { - if (!response.data) + this.$http.get(`Routes/${this.route.vehicleFk}/getDeliveryPoint`).then(res => { + if (!res.data) throw new UserError(`The route's vehicle doesn't have a delivery point`); - return response.data; - }).then(address => { - let addresses; - if (address) addresses = address; - let lines = this.getSelectedItems(this.tickets); - - let url = 'http://gps.buscalia.com/usuario/localizar.aspx?bmi=true&addr='; - lines.forEach(line => { - addresses = addresses + '+to:' + line.postalCode + ' ' + line.city + ' ' + line.street; + let addresses = res.data; + const lines = ticket ? [ticket] : this.getSelectedItems(this.tickets); + lines.forEach((line, index) => { + const previousLine = lines[index - 1] ? lines[index - 1].street : null; + if (previousLine != line.street) + addresses = addresses + '+to:' + line.postalCode + ' ' + line.city + ' ' + line.street; }); - window.open(url + addresses, '_blank'); + const url = 'http://gps.buscalia.com/usuario/localizar.aspx?bmi=true&addr='; + window.open(url + encodeURI(addresses), '_blank'); }); } @@ -126,6 +156,37 @@ class Controller extends Section { throw error; }); } + + async sendSms() { + try { + const clientsFk = []; + const clientsName = []; + const clients = []; + + const selectedTickets = this.getSelectedItems(this.$.$ctrl.tickets); + + for (let ticket of selectedTickets) { + clientsFk.push(ticket.clientFk); + let userContact = await this.$http.get(`Clients/${ticket.clientFk}`); + clientsName.push(userContact.data.name); + clients.push(userContact.data.phone); + } + + const destinationFk = String(clientsFk); + const destination = String(clients); + + this.newSMS = Object.assign({ + destinationFk: destinationFk, + destination: destination + }); + + this.$.sms.open(); + return true; + } catch (e) { + this.vnApp.showError(this.$t(e.message)); + return false; + } + } } ngModule.vnComponent('vnRouteTickets', { diff --git a/modules/route/front/tickets/index.spec.js b/modules/route/front/tickets/index.spec.js index 82647d903..2c73048bd 100644 --- a/modules/route/front/tickets/index.spec.js +++ b/modules/route/front/tickets/index.spec.js @@ -58,9 +58,23 @@ describe('Route', () => { }); }); + describe('setHighestPriority()', () => { + it('should set a ticket highest priority', () => { + jest.spyOn(controller.vnApp, 'showSuccess'); + controller.$.model.data = [{priority: 3}]; + const ticket = {id: 1, priority: 2}; + const res = {data: {priority: 4}}; + + $httpBackend.expectPATCH(`Tickets/${ticket.id}/`).respond(res); + controller.setHighestPriority(ticket); + $httpBackend.flush(); + + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); + }); + }); + describe('setPriority()', () => { it('should set a ticket priority', () => { - jest.spyOn(controller.$.model, 'refresh'); jest.spyOn(controller.vnApp, 'showSuccess'); const ticketId = 1; const priority = 999; @@ -69,6 +83,35 @@ describe('Route', () => { controller.setPriority(ticketId, priority); $httpBackend.flush(); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); + }); + }); + + describe('deletePriority()', () => { + it('should delete priority of all tickets', () => { + jest.spyOn(controller.$.model, 'refresh'); + jest.spyOn(controller.vnApp, 'showSuccess'); + controller.tickets = [{id: 1, checked: true}]; + + $httpBackend.expectPATCH(`Tickets/${controller.tickets[0].id}/`).respond(); + controller.deletePriority(); + $httpBackend.flush(); + + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); + expect(controller.$.model.refresh).toHaveBeenCalledWith(); + }); + }); + + describe('setOrderedPriority()', () => { + it('should set priority of all tickets starting by 1', () => { + jest.spyOn(controller.$.model, 'refresh'); + jest.spyOn(controller.vnApp, 'showSuccess'); + const tickets = [{id: 1, checked: true}]; + + $httpBackend.expectPATCH(`Tickets/${tickets[0].id}/`).respond(); + controller.setOrderedPriority(tickets); + $httpBackend.flush(); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.model.refresh).toHaveBeenCalledWith(); }); @@ -93,7 +136,7 @@ describe('Route', () => { describe('goToBuscaman()', () => { it('should open buscaman with the given arguments', () => { jest.spyOn(window, 'open').mockReturnThis(); - const expectedUrl = 'http://gps.buscalia.com/usuario/localizar.aspx?bmi=true&addr=46460 Av Espioca 100+to:n19 London my street'; + const expectedUrl = 'http://gps.buscalia.com/usuario/localizar.aspx?bmi=true&addr=46460%20Av%20Espioca%20100+to:n19%20London%20my%20street'; controller.route = {vehicleFk: 1}; const url = `Routes/${controller.route.vehicleFk}/getDeliveryPoint`; $httpBackend.expectGET(url).respond('46460 Av Espioca 100'); diff --git a/modules/route/front/tickets/locale/es.yml b/modules/route/front/tickets/locale/es.yml index 6d63b4b6e..e7f483d2f 100644 --- a/modules/route/front/tickets/locale/es.yml +++ b/modules/route/front/tickets/locale/es.yml @@ -13,3 +13,6 @@ The route's vehicle doesn't have a delivery point: El vehículo de la ruta no ti The route doesn't have a vehicle: La ruta no tiene un vehículo Population: Población Unlink selected zone?: Desvincular zona seleccionada? +Delete priority: Borrar orden +Renumber all tickets in the order you see on the screen: Renumerar todos los tickets con el orden que ves por pantalla +Assign highest priority: Asignar máxima prioridad \ No newline at end of file diff --git a/modules/shelving/back/methods/shelving/getSummary.js b/modules/shelving/back/methods/shelving/getSummary.js new file mode 100644 index 000000000..da357c7bf --- /dev/null +++ b/modules/shelving/back/methods/shelving/getSummary.js @@ -0,0 +1,52 @@ +module.exports = Self => { + Self.remoteMethod('getSummary', { + description: 'Returns the shelving summary', + accessType: 'READ', + accepts: { + arg: 'code', + type: 'string', + required: true, + description: 'The shelving code', + http: {source: 'path'} + }, + returns: { + type: 'object', + root: true + }, + http: { + path: `/:code/getSummary`, + verb: 'GET' + } + }); + Self.getSummary = async code => { + let filter = { + where: {code: code}, + fields: [ + 'code', + 'parkingFk', + 'priority', + 'userFk', + 'isRecyclable' + ], + include: [ + { + relation: 'parking' + }, + { + relation: 'worker', + scope: { + fields: ['id', 'userFk'], + include: { + relation: 'user', + scope: { + fields: ['id', 'nickname'] + } + } + } + } + ] + }; + + return Self.app.models.Shelving.findOne(filter); + }; +}; diff --git a/modules/shelving/back/model-config.json b/modules/shelving/back/model-config.json new file mode 100644 index 000000000..c26c39d38 --- /dev/null +++ b/modules/shelving/back/model-config.json @@ -0,0 +1,14 @@ +{ + "Parking": { + "dataSource": "vn" + }, + "Shelving": { + "dataSource": "vn" + }, + "ShelvingLog": { + "dataSource": "vn" + }, + "Sector": { + "dataSource": "vn" + } +} \ No newline at end of file diff --git a/modules/shelving/back/models/parking.json b/modules/shelving/back/models/parking.json new file mode 100644 index 000000000..53fec6e69 --- /dev/null +++ b/modules/shelving/back/models/parking.json @@ -0,0 +1,40 @@ +{ + "name": "Parking", + "base": "VnModel", + "options": { + "mysql": { + "table": "parking" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "column": { + "type": "string", + "required": true + }, + "row": { + "type": "string", + "required": true + }, + "sectorFk": { + "type": "number" + }, + "code": { + "type": "string" + }, + "pickingOrder": { + "type": "number" + } + }, + "relations": { + "saleGroup": { + "type": "hasMany", + "model": "saleGroup", + "foreignKey": "parkingFk" + } + } +} diff --git a/modules/shelving/back/models/sector.json b/modules/shelving/back/models/sector.json new file mode 100644 index 000000000..0dc502cd0 --- /dev/null +++ b/modules/shelving/back/models/sector.json @@ -0,0 +1,72 @@ +{ + "name": "Sector", + "base": "VnModel", + "options": { + "mysql": { + "table": "sector" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "description": { + "type": "string", + "required": true + }, + "warehouseFk": { + "type": "number", + "required": true + }, + "isPreviousPreparedByPacking": { + "type": "boolean", + "required": true + }, + "code": { + "type": "string", + "required": false + }, + "isPreviousPrepared": { + "type": "boolean", + "required": true + }, + "isPackagingArea": { + "type": "boolean", + "required": true + }, + "reportFk": { + "type": "number", + "required": false + }, + "sonFk": { + "type": "number", + "required": false + }, + "isMain": { + "type": "boolean", + "required": true + }, + "itemPackingTypeFk": { + "type": "string", + "required": false + }, + "workerFk": { + "type": "number", + "required": false + }, + "printerFk": { + "type": "number", + "required": false + }, + "isHideForPickers": { + "type": "boolean", + "required": true + }, + "isReserve": { + "type": "boolean", + "required": true + } + } +} \ No newline at end of file diff --git a/modules/shelving/back/models/shelving-log.json b/modules/shelving/back/models/shelving-log.json new file mode 100644 index 000000000..a2267394e --- /dev/null +++ b/modules/shelving/back/models/shelving-log.json @@ -0,0 +1,58 @@ +{ + "name": "ShelvingLog", + "base": "VnModel", + "options": { + "mysql": { + "table": "shelvingLog" + } + }, + "properties": { + "id": { + "id": true, + "type": "number", + "forceId": false + }, + "originFk": { + "type": "number", + "required": true + }, + "userFk": { + "type": "number" + }, + "action": { + "type": "string", + "required": true + }, + "changedModel": { + "type": "string" + }, + "oldInstance": { + "type": "object" + }, + "newInstance": { + "type": "object" + }, + "creationDate": { + "type": "date" + }, + "changedModelId": { + "type": "number" + }, + "changedModelValue": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "relations": { + "user": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "userFk" + } + }, + "scope": { + "order": ["creationDate DESC", "id DESC"] + } +} diff --git a/modules/shelving/back/models/shelving.js b/modules/shelving/back/models/shelving.js new file mode 100644 index 000000000..3e27f5863 --- /dev/null +++ b/modules/shelving/back/models/shelving.js @@ -0,0 +1,3 @@ +module.exports = Self => { + require('../methods/shelving/getSummary')(Self); +}; diff --git a/modules/shelving/back/models/shelving.json b/modules/shelving/back/models/shelving.json new file mode 100644 index 000000000..508ac428f --- /dev/null +++ b/modules/shelving/back/models/shelving.json @@ -0,0 +1,51 @@ +{ + "name": "Shelving", + "base": "Loggable", + "log": { + "model": "ShelvingLog", + "showField": "id" + }, + "options": { + "mysql": { + "table": "shelving" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "code": { + "type": "string", + "required": true + }, + "parkingFk": { + "type": "number" + }, + "isPrinted": { + "type": "boolean" + }, + "priority": { + "type": "number" + }, + "userFk": { + "type": "number" + }, + "isRecyclable": { + "type": "boolean" + } + }, + "relations": { + "parking": { + "type": "belongsTo", + "model": "Parking", + "foreignKey": "parkingFk" + }, + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "userFk" + } + } +} diff --git a/modules/shelving/front/basic-data/index.html b/modules/shelving/front/basic-data/index.html new file mode 100644 index 000000000..68d61e169 --- /dev/null +++ b/modules/shelving/front/basic-data/index.html @@ -0,0 +1,52 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/modules/shelving/front/basic-data/index.js b/modules/shelving/front/basic-data/index.js new file mode 100644 index 000000000..e17c9feee --- /dev/null +++ b/modules/shelving/front/basic-data/index.js @@ -0,0 +1,10 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +ngModule.vnComponent('vnShelvingBasicData', { + template: require('./index.html'), + controller: Section, + bindings: { + shelving: '<' + } +}); diff --git a/modules/shelving/front/card/index.html b/modules/shelving/front/card/index.html new file mode 100644 index 000000000..c83afc288 --- /dev/null +++ b/modules/shelving/front/card/index.html @@ -0,0 +1,8 @@ + + + + + + diff --git a/modules/shelving/front/card/index.js b/modules/shelving/front/card/index.js new file mode 100644 index 000000000..5e2ea9b12 --- /dev/null +++ b/modules/shelving/front/card/index.js @@ -0,0 +1,29 @@ +import ngModule from '../module'; +import ModuleCard from 'salix/components/module-card'; + +class Controller extends ModuleCard { + reload() { + const filter = { + include: [ + {relation: 'worker', + scope: { + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + } + }}, + {relation: 'parking'} + ] + }; + this.$http.get(`Shelvings/${this.$params.id}`, {filter}) + .then(res => this.shelving = res.data); + } +} + +ngModule.vnComponent('vnShelvingCard', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/shelving/front/card/index.spec.js b/modules/shelving/front/card/index.spec.js new file mode 100644 index 000000000..85b1bd269 --- /dev/null +++ b/modules/shelving/front/card/index.spec.js @@ -0,0 +1,26 @@ +import './index'; + +describe('component vnShelvingCard', () => { + let controller; + let $httpBackend; + const data = {id: 1, code: 'AAA'}; + + beforeEach(ngModule('shelving')); + + beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => { + $httpBackend = _$httpBackend_; + + let $element = angular.element('
'); + controller = $componentController('vnShelvingCard', {$element}); + + $stateParams.id = data.id; + $httpBackend.whenRoute('GET', 'Shelvings/:id').respond(data); + })); + + it('should reload the controller data', () => { + controller.reload(); + $httpBackend.flush(); + + expect(controller.shelving).toEqual(data); + }); +}); diff --git a/modules/shelving/front/create/index.html b/modules/shelving/front/create/index.html new file mode 100644 index 000000000..edb3a7d3b --- /dev/null +++ b/modules/shelving/front/create/index.html @@ -0,0 +1,51 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/modules/shelving/front/create/index.js b/modules/shelving/front/create/index.js new file mode 100644 index 000000000..bb0e441eb --- /dev/null +++ b/modules/shelving/front/create/index.js @@ -0,0 +1,15 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section { + onSubmit() { + return this.$.watcher.submit().then(res => + this.$state.go('shelving.card.basicData', {id: res.data.id}) + ); + } +} + +ngModule.vnComponent('vnShelvingCreate', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/shelving/front/create/index.spec.js b/modules/shelving/front/create/index.spec.js new file mode 100644 index 000000000..0bdde9145 --- /dev/null +++ b/modules/shelving/front/create/index.spec.js @@ -0,0 +1,38 @@ +import './index'; + +describe('Shelving', () => { + describe('Component vnShelvingCreate', () => { + let $scope; + let $state; + let controller; + + beforeEach(ngModule('shelving')); + + beforeEach(inject(($componentController, $rootScope, _$state_) => { + $scope = $rootScope.$new(); + $state = _$state_; + $scope.watcher = { + submit: () => { + return { + then: callback => { + callback({data: {id: 1}}); + } + }; + } + }; + const $element = angular.element(''); + controller = $componentController('vnShelvingCreate', {$element, $scope}); + controller.$params = {}; + })); + + describe('onSubmit()', () => { + it(`should redirect to basic data by calling the $state.go function`, () => { + jest.spyOn(controller.$state, 'go'); + + controller.onSubmit(); + + expect(controller.$state.go).toHaveBeenCalledWith('shelving.card.basicData', {id: 1}); + }); + }); + }); +}); diff --git a/modules/shelving/front/descriptor/index.html b/modules/shelving/front/descriptor/index.html new file mode 100644 index 000000000..1344bb52a --- /dev/null +++ b/modules/shelving/front/descriptor/index.html @@ -0,0 +1,45 @@ + + + + Delete + + + +
+ + + + + + + {{::$ctrl.shelving.worker.user.nickname}} + + +
+
+
+ + + + + + + \ No newline at end of file diff --git a/modules/shelving/front/descriptor/index.js b/modules/shelving/front/descriptor/index.js new file mode 100644 index 000000000..931dbb6dc --- /dev/null +++ b/modules/shelving/front/descriptor/index.js @@ -0,0 +1,26 @@ +import ngModule from '../module'; +import Descriptor from 'salix/components/descriptor'; + +class Controller extends Descriptor { + get shelving() { + return this.entity; + } + + set shelving(value) { + this.entity = value; + } + + onDelete() { + return this.$http.delete(`Shelvings/${this.shelving.id}`) + .then(() => this.$state.go('shelving.index')) + .then(() => this.vnApp.showSuccess(this.$t('Shelving removed'))); + } +} + +ngModule.vnComponent('vnShelvingDescriptor', { + template: require('./index.html'), + controller: Controller, + bindings: { + shelving: '<' + } +}); diff --git a/modules/shelving/front/descriptor/index.spec.js b/modules/shelving/front/descriptor/index.spec.js new file mode 100644 index 000000000..3ee33580b --- /dev/null +++ b/modules/shelving/front/descriptor/index.spec.js @@ -0,0 +1,29 @@ +import './index.js'; + +describe('component vnShelvingDescriptor', () => { + let $httpBackend; + let controller; + + const shelving = {id: 1, code: 'AA6'}; + + beforeEach(ngModule('shelving')); + + beforeEach(inject(($componentController, _$httpBackend_, _$httpParamSerializer_) => { + $httpBackend = _$httpBackend_; + controller = $componentController('vnShelvingDescriptor', {$element: null}, {shelving}); + jest.spyOn(controller.vnApp, 'showSuccess'); + })); + + describe('onDelete()', () => { + it('should delete entity and go to index', () => { + controller.$state.go = jest.fn(); + + $httpBackend.expectDELETE('Shelvings/1').respond(); + controller.onDelete(); + $httpBackend.flush(); + + expect(controller.$state.go).toHaveBeenCalledWith('shelving.index'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); + }); + }); +}); diff --git a/modules/shelving/front/index.js b/modules/shelving/front/index.js new file mode 100644 index 000000000..2ad9bc1b9 --- /dev/null +++ b/modules/shelving/front/index.js @@ -0,0 +1,11 @@ +export * from './module'; + +import './basic-data'; +import './card'; +import './create'; +import './descriptor'; +import './index/'; +import './main'; +import './search-panel'; +import './summary'; +import './log'; diff --git a/modules/shelving/front/index/index.html b/modules/shelving/front/index/index.html new file mode 100644 index 000000000..1532abd42 --- /dev/null +++ b/modules/shelving/front/index/index.html @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/shelving/front/index/index.js b/modules/shelving/front/index/index.js new file mode 100644 index 000000000..04d8ea9cd --- /dev/null +++ b/modules/shelving/front/index/index.js @@ -0,0 +1,14 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section { + preview(shelving) { + this.selectedShelving = shelving; + this.$.summary.show(); + } +} + +ngModule.vnComponent('vnShelvingIndex', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/shelving/front/index/index.spec.js b/modules/shelving/front/index/index.spec.js new file mode 100644 index 000000000..aad79fb0e --- /dev/null +++ b/modules/shelving/front/index/index.spec.js @@ -0,0 +1,39 @@ +import './index.js'; +describe('Component vnShelvingIndex', () => { + let controller; + let $window; + let shelvings = [{ + id: 1, + code: 'AAA' + }, { + id: 2, + code: 'AA1' + }, { + id: 3, + code: 'AA2' + }]; + + beforeEach(ngModule('shelving')); + + beforeEach(inject(($componentController, _$window_) => { + $window = _$window_; + const $element = angular.element(''); + controller = $componentController('vnShelvingIndex', {$element}); + })); + + describe('preview()', () => { + it('should show the dialog summary', () => { + controller.$.summary = {show: () => {}}; + jest.spyOn(controller.$.summary, 'show'); + + let event = new MouseEvent('click', { + view: $window, + bubbles: true, + cancelable: true + }); + controller.preview(event, shelvings[0]); + + expect(controller.$.summary.show).toHaveBeenCalledWith(); + }); + }); +}); diff --git a/modules/shelving/front/index/locale/es.yml b/modules/shelving/front/index/locale/es.yml new file mode 100644 index 000000000..4d30f4cee --- /dev/null +++ b/modules/shelving/front/index/locale/es.yml @@ -0,0 +1,2 @@ +Parking: Parking +Priority: Prioridad \ No newline at end of file diff --git a/modules/shelving/front/log/index.html b/modules/shelving/front/log/index.html new file mode 100644 index 000000000..8f0e6851c --- /dev/null +++ b/modules/shelving/front/log/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/modules/shelving/front/log/index.js b/modules/shelving/front/log/index.js new file mode 100644 index 000000000..588e0995a --- /dev/null +++ b/modules/shelving/front/log/index.js @@ -0,0 +1,7 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +ngModule.vnComponent('vnShelvingLog', { + template: require('./index.html'), + controller: Section, +}); diff --git a/modules/shelving/front/log/locale/es.yml b/modules/shelving/front/log/locale/es.yml new file mode 100644 index 000000000..c572b78d1 --- /dev/null +++ b/modules/shelving/front/log/locale/es.yml @@ -0,0 +1 @@ +Changed by: Cambiado por \ No newline at end of file diff --git a/modules/shelving/front/main/index.html b/modules/shelving/front/main/index.html new file mode 100644 index 000000000..3f3cc718b --- /dev/null +++ b/modules/shelving/front/main/index.html @@ -0,0 +1,19 @@ + + + + + + + + + + \ No newline at end of file diff --git a/modules/shelving/front/main/index.js b/modules/shelving/front/main/index.js new file mode 100644 index 000000000..96689fbd9 --- /dev/null +++ b/modules/shelving/front/main/index.js @@ -0,0 +1,29 @@ +import ngModule from '../module'; +import ModuleMain from 'salix/components/module-main'; + +export default class Shelving extends ModuleMain { + constructor($element, $) { + super($element, $); + this.filter = { + include: [ + {relation: 'parking'} + ], + }; + } + + exprBuilder(param, value) { + switch (param) { + case 'search': + return {code: {like: `%${value}%`}}; + case 'parkingFk': + case 'userFk': + case 'isRecyclable': + return {[param]: value}; + } + } +} + +ngModule.vnComponent('vnShelving', { + controller: Shelving, + template: require('./index.html') +}); diff --git a/modules/shelving/front/main/index.spec.js b/modules/shelving/front/main/index.spec.js new file mode 100644 index 000000000..dcfa912bc --- /dev/null +++ b/modules/shelving/front/main/index.spec.js @@ -0,0 +1,19 @@ +import './index'; + +describe('component vnShelving', () => { + let controller; + + beforeEach(ngModule('shelving')); + + beforeEach(inject($componentController => { + controller = $componentController('vnShelving', {$element: null}); + })); + + describe('exprBuilder()', () => { + it('should search by code', () => { + let expr = controller.exprBuilder('search', 'UXN'); + + expect(expr).toEqual({code: {like: '%UXN%'}},); + }); + }); +}); diff --git a/modules/shelving/front/main/locale/es.yml b/modules/shelving/front/main/locale/es.yml new file mode 100644 index 000000000..4c39469ce --- /dev/null +++ b/modules/shelving/front/main/locale/es.yml @@ -0,0 +1 @@ +Search shelving by code, parking or worker: Busca carros por código, parking o trabajador \ No newline at end of file diff --git a/modules/shelving/front/module.js b/modules/shelving/front/module.js new file mode 100644 index 000000000..8ba261ead --- /dev/null +++ b/modules/shelving/front/module.js @@ -0,0 +1,3 @@ +import {ng} from 'core/vendor'; + +export default ng.module('shelving', ['salix']); diff --git a/modules/shelving/front/routes.json b/modules/shelving/front/routes.json new file mode 100644 index 000000000..4059e5095 --- /dev/null +++ b/modules/shelving/front/routes.json @@ -0,0 +1,67 @@ +{ + "module": "shelving", + "name": "Shelvings", + "icon" : "icon-inventory", + "dependencies": ["worker"], + "validations" : true, + "menus": { + "main": [ + {"state": "shelving.index", "icon": "icon-inventory"} + ], + "card": [ + {"state": "shelving.card.basicData", "icon": "settings"}, + {"state": "shelving.card.log", "icon": "history"} + ] + }, + "routes": [ + { + "url": "/shelving", + "state": "shelving", + "abstract": true, + "component": "vn-shelving", + "description": "Shelvings" + }, + { + "url": "/index?q", + "state": "shelving.index", + "component": "vn-shelving-index", + "description": "Shelvings" + }, + { + "url": "/create", + "state": "shelving.create", + "component": "vn-shelving-create", + "description": "New shelving" + }, + { + "url": "/:id", + "state": "shelving.card", + "abstract": true, + "component": "vn-shelving-card" + }, + { + "url": "/summary", + "state": "shelving.card.summary", + "component": "vn-shelving-summary", + "description": "Summary", + "params": { + "shelving": "$ctrl.shelving" + } + }, + { + "url": "/basic-data", + "state": "shelving.card.basicData", + "component": "vn-shelving-basic-data", + "description": "Basic data", + "params": { + "shelving": "$ctrl.shelving" + } + }, + { + "url" : "/log", + "state": "shelving.card.log", + "component": "vn-shelving-log", + "description": "Log" + } + ] +} diff --git a/modules/shelving/front/search-panel/index.html b/modules/shelving/front/search-panel/index.html new file mode 100644 index 000000000..b7ca068a5 --- /dev/null +++ b/modules/shelving/front/search-panel/index.html @@ -0,0 +1,43 @@ +
+
+ + + + + + + + + + + + + + + + + +
+
\ No newline at end of file diff --git a/modules/shelving/front/search-panel/index.js b/modules/shelving/front/search-panel/index.js new file mode 100644 index 000000000..51b81538b --- /dev/null +++ b/modules/shelving/front/search-panel/index.js @@ -0,0 +1,7 @@ +import ngModule from '../module'; +import SearchPanel from 'core/components/searchbar/search-panel'; + +ngModule.vnComponent('vnShelvingSearchPanel', { + template: require('./index.html'), + controller: SearchPanel +}); diff --git a/modules/shelving/front/search-panel/locale/es.yml b/modules/shelving/front/search-panel/locale/es.yml new file mode 100644 index 000000000..bd19b1b33 --- /dev/null +++ b/modules/shelving/front/search-panel/locale/es.yml @@ -0,0 +1 @@ +Search shelvings by code: Busca carros por código \ No newline at end of file diff --git a/modules/shelving/front/summary/index.html b/modules/shelving/front/summary/index.html new file mode 100644 index 000000000..61e44d278 --- /dev/null +++ b/modules/shelving/front/summary/index.html @@ -0,0 +1,51 @@ + +
+ + + + {{::$ctrl.summary.code}} +
+ + +

+ + Basic data + +

+ + + + + + + + + + {{$ctrl.summary.worker.user.nickname}} + + + + + +
+
+
+ + \ No newline at end of file diff --git a/modules/shelving/front/summary/index.js b/modules/shelving/front/summary/index.js new file mode 100644 index 000000000..10a905f1d --- /dev/null +++ b/modules/shelving/front/summary/index.js @@ -0,0 +1,41 @@ +import ngModule from '../module'; +import Summary from 'salix/components/summary'; +import './style.scss'; + +class Controller extends Summary { + set shelving(value) { + this._shelving = value; + this.summary = null; + if (!value) return; + + const filter = { + include: [ + {relation: 'worker', + scope: { + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + } + }}, + {relation: 'parking'} + ] + }; + this.$http.get(`Shelvings/${value.id}`, {filter}) + .then(res => this.summary = res.data); + } + + get shelving() { + return this._shelving; + } +} + +ngModule.vnComponent('vnShelvingSummary', { + template: require('./index.html'), + controller: Controller, + bindings: { + shelving: '<' + } +}); diff --git a/modules/shelving/front/summary/locale/es.yml b/modules/shelving/front/summary/locale/es.yml new file mode 100644 index 000000000..d5d14d52a --- /dev/null +++ b/modules/shelving/front/summary/locale/es.yml @@ -0,0 +1,5 @@ +Code: Código +Parking: Parking +Priority: Prioridad +Worker: Trabajador +Recyclable: Reciclable \ No newline at end of file diff --git a/modules/shelving/front/summary/style.scss b/modules/shelving/front/summary/style.scss new file mode 100644 index 000000000..1eb6b2323 --- /dev/null +++ b/modules/shelving/front/summary/style.scss @@ -0,0 +1,7 @@ +@import "variables"; + +vn-client-summary { + .alert span { + color: $color-alert + } +} \ No newline at end of file diff --git a/modules/supplier/back/methods/supplier/campaignMetricsEmail.js b/modules/supplier/back/methods/supplier/campaignMetricsEmail.js new file mode 100644 index 000000000..4a2c843b8 --- /dev/null +++ b/modules/supplier/back/methods/supplier/campaignMetricsEmail.js @@ -0,0 +1,68 @@ +const {Email} = require('vn-print'); + +module.exports = Self => { + Self.remoteMethodCtx('campaignMetricsEmail', { + description: 'Sends the campaign metrics email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id to send to the recipient preferred language', + required: false + }, + { + arg: 'from', + type: 'string', + required: true + }, + { + arg: 'to', + type: 'string', + required: true + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/:id/campaign-metrics-email', + verb: 'POST' + } + }); + + Self.campaignMetricsEmail = async ctx => { + const args = Object.assign({}, ctx.args); + const params = { + recipient: args.recipient, + lang: ctx.req.getLocale() + }; + + delete args.ctx; + for (const param in args) + params[param] = args[param]; + + const email = new Email('supplier-campaign-metrics', params); + + return email.send(); + }; +}; diff --git a/modules/supplier/back/methods/supplier/campaignMetricsPdf.js b/modules/supplier/back/methods/supplier/campaignMetricsPdf.js new file mode 100644 index 000000000..f7ff900e7 --- /dev/null +++ b/modules/supplier/back/methods/supplier/campaignMetricsPdf.js @@ -0,0 +1,51 @@ +module.exports = Self => { + Self.remoteMethodCtx('campaignMetricsPdf', { + description: 'Returns the campaign metrics pdf', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + }, + { + arg: 'from', + type: 'string', + required: true + }, + { + arg: 'to', + type: 'string', + required: true + } + ], + 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/campaign-metrics-pdf', + verb: 'GET' + } + }); + + Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'supplier-campaign-metrics'); +}; diff --git a/modules/supplier/back/methods/supplier/consumption.js b/modules/supplier/back/methods/supplier/consumption.js index e8e22625f..710db1bb1 100644 --- a/modules/supplier/back/methods/supplier/consumption.js +++ b/modules/supplier/back/methods/supplier/consumption.js @@ -89,12 +89,12 @@ module.exports = Self => { ENGINE = MEMORY SELECT e.id, - e.ref, + e.invoiceNumber, e.supplierFk, t.shipped FROM vn.entry e JOIN vn.travel t ON t.id = e.travelFk - JOIN buy b ON b.id = b.entryFk + JOIN buy b ON e.id = b.entryFk JOIN item i ON i.id = b.itemFk JOIN itemType it ON it.id = i.typeFk`); stmt.merge(conn.makeWhere(filter.where)); @@ -104,7 +104,7 @@ module.exports = Self => { const entriesIndex = stmts.push('SELECT * FROM tmp.entry') - 1; stmt = new ParameterizedSQL( - `SELECT + `SELECT b.id AS buyId, b.itemFk, b.entryFk, diff --git a/modules/supplier/back/methods/supplier/filter.js b/modules/supplier/back/methods/supplier/filter.js index 3500afacd..0b473f7df 100644 --- a/modules/supplier/back/methods/supplier/filter.js +++ b/modules/supplier/back/methods/supplier/filter.js @@ -95,8 +95,8 @@ module.exports = Self => { pm.name AS payMethod, pd.payDem AS payDem FROM vn.supplier s - JOIN vn.payMethod pm ON pm.id = s.payMethodFk - JOIN vn.payDem pd ON pd.id = s.payDemFk` + LEFT JOIN vn.payMethod pm ON pm.id = s.payMethodFk + LEFT JOIN vn.payDem pd ON pd.id = s.payDemFk` ); stmt.merge(conn.makeSuffix(filter)); diff --git a/modules/supplier/back/methods/supplier/newSupplier.js b/modules/supplier/back/methods/supplier/newSupplier.js new file mode 100644 index 000000000..c40e7214f --- /dev/null +++ b/modules/supplier/back/methods/supplier/newSupplier.js @@ -0,0 +1,33 @@ +module.exports = Self => { + Self.remoteMethodCtx('newSupplier', { + description: 'Creates a new supplier and returns it', + accessType: 'WRITE', + accepts: [{ + arg: 'name', + type: 'string' + }], + returns: { + type: 'string', + root: true + }, + http: { + path: `/newSupplier`, + verb: 'POST' + } + }); + + Self.newSupplier = async(ctx, options) => { + const models = Self.app.models; + const args = ctx.args; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + delete args.ctx; + const data = {...args, ...{nickname: args.name}}; + const supplier = await models.Supplier.create(data, myOptions); + + return supplier; + }; +}; diff --git a/modules/supplier/back/methods/supplier/specs/consumption.spec.js b/modules/supplier/back/methods/supplier/specs/consumption.spec.js index 0e8f3afcc..0b4d6f82c 100644 --- a/modules/supplier/back/methods/supplier/specs/consumption.spec.js +++ b/modules/supplier/back/methods/supplier/specs/consumption.spec.js @@ -11,7 +11,7 @@ describe('supplier consumption() filter', () => { }; const result = await app.models.Supplier.consumption(ctx, filter); - expect(result.length).toEqual(6); + expect(result.length).toEqual(5); }); it('should return a list of entries from the item id 1 and supplier 1', async() => { diff --git a/modules/supplier/back/methods/supplier/specs/filter.spec.js b/modules/supplier/back/methods/supplier/specs/filter.spec.js index 1f74b10ff..2620bb687 100644 --- a/modules/supplier/back/methods/supplier/specs/filter.spec.js +++ b/modules/supplier/back/methods/supplier/specs/filter.spec.js @@ -10,7 +10,7 @@ describe('Supplier filter()', () => { let result = await app.models.Supplier.filter(ctx); - expect(result.length).toEqual(1); + expect(result.length).toBeGreaterThanOrEqual(1); expect(result[0].id).toEqual(1); }); diff --git a/modules/supplier/back/methods/supplier/specs/newSupplier.spec.js b/modules/supplier/back/methods/supplier/specs/newSupplier.spec.js new file mode 100644 index 000000000..d4479d00b --- /dev/null +++ b/modules/supplier/back/methods/supplier/specs/newSupplier.spec.js @@ -0,0 +1,39 @@ +const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); + +describe('Supplier newSupplier()', () => { + const administrativeId = 5; + const activeCtx = { + accessToken: {userId: administrativeId}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + const ctx = {req: activeCtx}; + + beforeEach(() => { + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + + it('should create a new supplier containing only the name', async() => { + const tx = await models.Supplier.beginTransaction({}); + + try { + const options = {transaction: tx}; + ctx.args = { + name: 'newSupplier' + }; + + const result = await models.Supplier.newSupplier(ctx, options); + + expect(result.name).toEqual('newSupplier'); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/supplier/back/methods/supplier/updateFiscalData.js b/modules/supplier/back/methods/supplier/updateFiscalData.js index 4604b3f91..271ed8769 100644 --- a/modules/supplier/back/methods/supplier/updateFiscalData.js +++ b/modules/supplier/back/methods/supplier/updateFiscalData.js @@ -64,6 +64,14 @@ module.exports = Self => { { arg: 'healthRegister', type: 'string' + }, + { + arg: 'isVies', + type: 'boolean' + }, + { + arg: 'isTrucker', + type: 'boolean' }], returns: { arg: 'res', diff --git a/modules/supplier/back/models/specs/supplier.spec.js b/modules/supplier/back/models/specs/supplier.spec.js index 3140981c3..f317f1fb9 100644 --- a/modules/supplier/back/models/specs/supplier.spec.js +++ b/modules/supplier/back/models/specs/supplier.spec.js @@ -8,7 +8,6 @@ describe('loopback model Supplier', () => { beforeAll(async() => { supplierOne = await models.Supplier.findById(1); supplierTwo = await models.Supplier.findById(442); - const activeCtx = { accessToken: {userId: 9}, http: { @@ -23,71 +22,106 @@ describe('loopback model Supplier', () => { }); }); - afterAll(async() => { - await supplierOne.updateAttribute('payMethodFk', supplierOne.payMethodFk); - await supplierTwo.updateAttribute('payMethodFk', supplierTwo.payMethodFk); - }); - describe('payMethodFk', () => { it('should throw an error when attempting to set an invalid payMethod id in the supplier', async() => { - let error; - const expectedError = 'You can not select this payment method without a registered bankery account'; - const supplier = await models.Supplier.findById(1); + const tx = await models.Supplier.beginTransaction({}); + const options = {transaction: tx}; - await supplier.updateAttribute('payMethodFk', 8) - .catch(e => { - error = e; + try { + let error; + const expectedError = 'You can not select this payment method without a registered bankery account'; - expect(error.message).toContain(expectedError); - }); + await supplierOne.updateAttribute('payMethodFk', 8, options) + .catch(e => { + error = e; - expect(error).toBeDefined(); + expect(error.message).toContain(expectedError); + }); + + expect(error).toBeDefined(); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } }); it('should not throw if the payMethod id is valid', async() => { - let error; - const supplier = await models.Supplier.findById(442); - await supplier.updateAttribute('payMethodFk', 4) - .catch(e => { - error = e; - }); + const tx = await models.Supplier.beginTransaction({}); + const options = {transaction: tx}; - expect(error).not.toBeDefined(); + try { + let error; + await supplierTwo.updateAttribute('payMethodFk', 4, options) + .catch(e => { + error = e; + }); + + expect(error).not.toBeDefined(); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } }); it('should have checked isPayMethodChecked for payMethod hasVerfified is false', async() => { - const supplier = await models.Supplier.findById(442); - await supplier.updateAttribute('isPayMethodChecked', true); - await supplier.updateAttribute('payMethodFk', 5); + const tx = await models.Supplier.beginTransaction({}); + const options = {transaction: tx}; - const result = await models.Supplier.findById(442); + try { + await supplierTwo.updateAttribute('isPayMethodChecked', true, options); + await supplierTwo.updateAttribute('payMethodFk', 5, options); - expect(result.isPayMethodChecked).toEqual(true); + const result = await models.Supplier.findById(442, null, options); + + expect(result.isPayMethodChecked).toEqual(true); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } }); it('should have unchecked isPayMethodChecked for payMethod hasVerfified is true', async() => { - const supplier = await models.Supplier.findById(442); - await supplier.updateAttribute('isPayMethodChecked', true); - await supplier.updateAttribute('payMethodFk', 2); + const tx = await models.Supplier.beginTransaction({}); + const options = {transaction: tx}; - const result = await models.Supplier.findById(442); + try { + await supplierTwo.updateAttribute('isPayMethodChecked', true, options); + await supplierTwo.updateAttribute('payMethodFk', 2, options); - expect(result.isPayMethodChecked).toEqual(false); + const result = await models.Supplier.findById(442, null, options); + + expect(result.isPayMethodChecked).toEqual(false); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } }); it('should have unchecked isPayMethodChecked for payDay and peyDemFk', async() => { - const supplier = await models.Supplier.findById(442); + const tx = await models.Supplier.beginTransaction({}); + const options = {transaction: tx}; - await supplier.updateAttribute('isPayMethodChecked', true); - await supplier.updateAttribute('payDay', 5); - const firstResult = await models.Supplier.findById(442); + try { + await supplierTwo.updateAttribute('payMethodFk', 2, options); + await supplierTwo.updateAttribute('isPayMethodChecked', true, options); + await supplierTwo.updateAttribute('payDay', 5, options); + const firstResult = await models.Supplier.findById(442, null, options); - await supplier.updateAttribute('isPayMethodChecked', true); - await supplier.updateAttribute('payDemFk', 1); - const secondResult = await models.Supplier.findById(442); + await supplierTwo.updateAttribute('isPayMethodChecked', true, options); + await supplierTwo.updateAttribute('payDemFk', 1, options); + const secondResult = await models.Supplier.findById(442, null, options); - expect(firstResult.isPayMethodChecked).toEqual(false); - expect(secondResult.isPayMethodChecked).toEqual(false); + expect(firstResult.isPayMethodChecked).toEqual(false); + expect(secondResult.isPayMethodChecked).toEqual(false); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } }); }); }); diff --git a/modules/supplier/back/models/supplier.js b/modules/supplier/back/models/supplier.js index c1be3488f..4e509aafc 100644 --- a/modules/supplier/back/models/supplier.js +++ b/modules/supplier/back/models/supplier.js @@ -8,22 +8,25 @@ module.exports = Self => { require('../methods/supplier/updateFiscalData')(Self); require('../methods/supplier/consumption')(Self); require('../methods/supplier/freeAgencies')(Self); + require('../methods/supplier/campaignMetricsPdf')(Self); + require('../methods/supplier/campaignMetricsEmail')(Self); + require('../methods/supplier/newSupplier')(Self); Self.validatesPresenceOf('name', { message: 'The social name cannot be empty' }); - Self.validatesUniquenessOf('name', { - message: 'The supplier name must be unique' - }); + if (this.city) { + Self.validatesPresenceOf('city', { + message: 'City cannot be empty' + }); + } - Self.validatesPresenceOf('city', { - message: 'City cannot be empty' - }); - - Self.validatesPresenceOf('nif', { - message: 'The nif cannot be empty' - }); + if (this.nif) { + Self.validatesPresenceOf('nif', { + message: 'The nif cannot be empty' + }); + } Self.validatesUniquenessOf('nif', { message: 'TIN must be unique' @@ -55,6 +58,9 @@ module.exports = Self => { } async function tinIsValid(err, done) { + if (!this.countryFk) + return done(); + const filter = { fields: ['code'], where: {id: this.countryFk} @@ -78,6 +84,7 @@ module.exports = Self => { }); async function hasSupplierAccount(err, done) { + if (!this.payMethodFk) return done(); const payMethod = await Self.app.models.PayMethod.findById(this.payMethodFk); const supplierAccount = await Self.app.models.SupplierAccount.findOne({where: {supplierFk: this.id}}); const hasIban = supplierAccount && supplierAccount.iban; @@ -90,6 +97,7 @@ module.exports = Self => { } Self.observe('before save', async function(ctx) { + if (ctx.isNewInstance) return; const loopbackContext = LoopBackContext.getCurrentContext(); const changes = ctx.data || ctx.instance; const orgData = ctx.currentInstance; @@ -99,12 +107,33 @@ module.exports = Self => { const isPayMethodChecked = changes.isPayMethodChecked || orgData.isPayMethodChecked; const hasChanges = orgData && changes; const isPayMethodCheckedChanged = hasChanges - && orgData.isPayMethodChecked != isPayMethodChecked; + && orgData.isPayMethodChecked != isPayMethodChecked; if (isNotFinancial && isPayMethodCheckedChanged) throw new UserError('You can not modify is pay method checked'); }); + Self.validateAsync('name', 'countryFk', hasSupplierSameName, { + message: 'A supplier with the same name already exists. Change the country.' + }); + + async function hasSupplierSameName(err, done) { + if (!this.name || !this.countryFk) done(); + const supplier = await Self.app.models.Supplier.findOne( + { + where: { + name: this.name, + countryFk: this.countryFk + }, + fields: ['id'] + }); + + if (supplier && supplier.id != this.id) + err(); + + done(); + } + Self.observe('before save', async function(ctx) { const changes = ctx.data || ctx.instance; const orgData = ctx.currentInstance; @@ -112,7 +141,7 @@ module.exports = Self => { const socialName = changes.name || orgData.name; const hasChanges = orgData && changes; const socialNameChanged = hasChanges - && orgData.socialName != socialName; + && orgData.socialName != socialName; if ((socialNameChanged) && !isAlpha(socialName)) throw new UserError('The social name has an invalid format'); diff --git a/modules/supplier/back/models/supplier.json b/modules/supplier/back/models/supplier.json index b27073ca5..ee2c4fbbd 100644 --- a/modules/supplier/back/models/supplier.json +++ b/modules/supplier/back/models/supplier.json @@ -51,6 +51,9 @@ "isSerious": { "type": "boolean" }, + "isTrucker": { + "type": "boolean" + }, "note": { "type": "string" }, @@ -107,6 +110,9 @@ }, "healthRegister": { "type": "string" + }, + "isVies": { + "type": "boolean" } }, "relations": { @@ -172,4 +178,4 @@ "foreignKey": "supplierActivityFk" } } -} \ No newline at end of file +} diff --git a/modules/supplier/front/agency-term/create/index.html b/modules/supplier/front/agency-term/create/index.html index e43f6396a..29d7b9b6a 100644 --- a/modules/supplier/front/agency-term/create/index.html +++ b/modules/supplier/front/agency-term/create/index.html @@ -26,6 +26,7 @@ type="number" label="Minimum M3" ng-model="$ctrl.supplierAgencyTerm.minimumM3" + step="0.01" rule> @@ -46,6 +47,7 @@ type="number" label="M3 Price" ng-model="$ctrl.supplierAgencyTerm.m3Price" + step="0.01" rule> diff --git a/modules/supplier/front/agency-term/index/index.html b/modules/supplier/front/agency-term/index/index.html index 9d53226c5..44c6deba9 100644 --- a/modules/supplier/front/agency-term/index/index.html +++ b/modules/supplier/front/agency-term/index/index.html @@ -24,36 +24,42 @@ diff --git a/modules/supplier/front/consumption/index.html b/modules/supplier/front/consumption/index.html index 5eaff4bfa..9e3bdac17 100644 --- a/modules/supplier/front/consumption/index.html +++ b/modules/supplier/front/consumption/index.html @@ -31,8 +31,8 @@ - @@ -40,8 +40,8 @@ {{::entry.id}} Date {{::entry.shipped | date: 'dd/MM/yyyy'}} - Reference - {{::entry.ref}} + Reference + {{::entry.invoiceNumber}} @@ -83,8 +83,8 @@ - diff --git a/modules/supplier/front/consumption/index.js b/modules/supplier/front/consumption/index.js index 21a30929d..9af0d1747 100644 --- a/modules/supplier/front/consumption/index.js +++ b/modules/supplier/front/consumption/index.js @@ -11,11 +11,11 @@ class Controller extends Section { } setDefaultFilter() { - const minDate = new Date(); + const minDate = Date.vnNew(); minDate.setHours(0, 0, 0, 0); minDate.setMonth(minDate.getMonth() - 2); - const maxDate = new Date(); + const maxDate = Date.vnNew(); maxDate.setHours(23, 59, 59, 59); this.filterParams = { @@ -33,7 +33,8 @@ class Controller extends Section { } showReport() { - this.vnReport.show('supplier-campaign-metrics', this.reportParams); + const path = `Suppliers/${this.supplier.id}/campaign-metrics-pdf`; + this.vnReport.show(path, this.reportParams); } sendEmail() { @@ -52,7 +53,9 @@ class Controller extends Section { const params = Object.assign({ recipient: contact.email }, this.reportParams); - this.vnEmail.send('supplier-campaign-metrics', params); + + const path = `Suppliers/${this.supplier.id}/campaign-metrics-email`; + this.vnEmail.send(path, params); } else { const message = this.$t(`This supplier doesn't have a contact with an email address`); this.vnApp.showError(message); diff --git a/modules/supplier/front/consumption/index.spec.js b/modules/supplier/front/consumption/index.spec.js index d095a174b..0ac531a68 100644 --- a/modules/supplier/front/consumption/index.spec.js +++ b/modules/supplier/front/consumption/index.spec.js @@ -28,7 +28,7 @@ describe('Supplier', () => { it('should call the window.open function', () => { jest.spyOn(window, 'open').mockReturnThis(); - const now = new Date(); + const now = Date.vnNew(); controller.$.model.userParams = { from: now, to: now @@ -42,7 +42,7 @@ describe('Supplier', () => { to: now }; const serializedParams = $httpParamSerializer(expectedParams); - const path = `api/report/supplier-campaign-metrics?${serializedParams}`; + const path = `api/Suppliers/${supplierId}/campaign-metrics-pdf?${serializedParams}`; expect(window.open).toHaveBeenCalledWith(path); }); @@ -66,7 +66,8 @@ describe('Supplier', () => { controller.sendEmail(); $httpBackend.flush(); - expect(controller.vnApp.showError).toHaveBeenCalledWith(`This supplier doesn't have a contact with an email address`); + expect(controller.vnApp.showError) + .toHaveBeenCalledWith(`This supplier doesn't have a contact with an email address`); }); it('should make a GET query sending the report', () => { @@ -85,22 +86,21 @@ describe('Supplier', () => { {id: 1, email: 'batman@gothamcity.com'} ]); - const now = new Date(); + const now = Date.vnNew(); controller.$.model.userParams = { from: now, to: now }; const expectedParams = { - recipientId: 2, recipient: 'batman@gothamcity.com', from: now, to: now }; serializedParams = $httpParamSerializer(expectedParams); - const path = `email/supplier-campaign-metrics?${serializedParams}`; + const path = `Suppliers/${supplierId}/campaign-metrics-email`; - $httpBackend.expect('GET', path).respond({}); + $httpBackend.expect('POST', path).respond({}); controller.sendEmail(); $httpBackend.flush(); }); diff --git a/modules/supplier/front/consumption/locale/es.yml b/modules/supplier/front/consumption/locale/es.yml index 6ef67ab2b..08c2a22e5 100644 --- a/modules/supplier/front/consumption/locale/es.yml +++ b/modules/supplier/front/consumption/locale/es.yml @@ -1,3 +1,2 @@ - Total entry: Total entrada -This supplier doesn't have a contact with an email address: Este proveedor no tiene ningún contacto con una dirección de email \ No newline at end of file +This supplier doesn't have a contact with an email address: Este proveedor no tiene ningún contacto con una dirección de email diff --git a/modules/supplier/front/create/index.html b/modules/supplier/front/create/index.html new file mode 100644 index 000000000..c3efcf6ae --- /dev/null +++ b/modules/supplier/front/create/index.html @@ -0,0 +1,30 @@ + + +
+ + + + + + + + + + + + +
diff --git a/modules/supplier/front/create/index.js b/modules/supplier/front/create/index.js new file mode 100644 index 000000000..c33367dac --- /dev/null +++ b/modules/supplier/front/create/index.js @@ -0,0 +1,23 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +class Controller extends Section { + constructor($element, $) { + super($element, $); + } + + onSubmit() { + this.$.watcher.submit().then( + json => { + this.$state.go(`supplier.card.fiscalData`, {id: json.data.id}); + } + ); + } +} + +Controller.$inject = ['$element', '$scope']; + +ngModule.vnComponent('vnSupplierCreate', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/supplier/front/descriptor/index.js b/modules/supplier/front/descriptor/index.js index df9fe2155..9f23ce68c 100644 --- a/modules/supplier/front/descriptor/index.js +++ b/modules/supplier/front/descriptor/index.js @@ -13,7 +13,7 @@ class Controller extends Descriptor { get entryFilter() { if (!this.supplier) return null; - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); const from = new Date(date.getTime()); @@ -41,6 +41,7 @@ class Controller extends Descriptor { 'payDay', 'isActive', 'isSerious', + 'isTrucker', 'account' ], include: [ diff --git a/modules/supplier/front/descriptor/index.spec.js b/modules/supplier/front/descriptor/index.spec.js index 8926fa4d1..4d16c5183 100644 --- a/modules/supplier/front/descriptor/index.spec.js +++ b/modules/supplier/front/descriptor/index.spec.js @@ -27,6 +27,7 @@ describe('Supplier Component vnSupplierDescriptor', () => { 'payDay', 'isActive', 'isSerious', + 'isTrucker', 'account' ], include: [ diff --git a/modules/supplier/front/fiscal-data/index.html b/modules/supplier/front/fiscal-data/index.html index 77a5cce4e..ccbd5b0d9 100644 --- a/modules/supplier/front/fiscal-data/index.html +++ b/modules/supplier/front/fiscal-data/index.html @@ -60,6 +60,8 @@ vn-one label="Account" ng-model="$ctrl.supplier.account" + insertable="true" + max-length="10" rule> - - - {{code}} - {{town.name}} ({{town.province.name}}, + {{code}} - {{town.name}} ({{town.province.name}}, {{town.province.country.country}}) @@ -142,7 +142,9 @@
- + + - - {{name}} ({{country.country}}) - + + + + + + + + @@ -197,4 +210,4 @@ - \ No newline at end of file + diff --git a/modules/supplier/front/fiscal-data/locale/es.yml b/modules/supplier/front/fiscal-data/locale/es.yml index 4cb537198..5232dd95d 100644 --- a/modules/supplier/front/fiscal-data/locale/es.yml +++ b/modules/supplier/front/fiscal-data/locale/es.yml @@ -3,3 +3,4 @@ Sage transaction type: Tipo de transacción Sage Sage withholding: Retención Sage Supplier activity: Actividad proveedor Healt register: Pasaporte sanitario +Trucker: Transportista \ No newline at end of file diff --git a/modules/supplier/front/index.js b/modules/supplier/front/index.js index ba2768854..9216d0781 100644 --- a/modules/supplier/front/index.js +++ b/modules/supplier/front/index.js @@ -20,3 +20,4 @@ import './address/create'; import './address/edit'; import './agency-term/index'; import './agency-term/create'; +import './create/index'; diff --git a/modules/supplier/front/index/index.html b/modules/supplier/front/index/index.html index 87e822eea..49f38cb1b 100644 --- a/modules/supplier/front/index/index.html +++ b/modules/supplier/front/index/index.html @@ -58,4 +58,7 @@ - \ No newline at end of file + + + + \ No newline at end of file diff --git a/modules/supplier/front/index/locale/es.yml b/modules/supplier/front/index/locale/es.yml index ad8a4f0bb..ce06f462c 100644 --- a/modules/supplier/front/index/locale/es.yml +++ b/modules/supplier/front/index/locale/es.yml @@ -2,4 +2,5 @@ Payment deadline: Plazo de pago Pay day: Dia de pago Account: Cuenta Pay method: Metodo de pago -Tax number: Nif \ No newline at end of file +Tax number: Nif +New supplier: Nuevo proveedor \ No newline at end of file diff --git a/modules/supplier/front/routes.json b/modules/supplier/front/routes.json index 61420b40d..75b8213cb 100644 --- a/modules/supplier/front/routes.json +++ b/modules/supplier/front/routes.json @@ -30,7 +30,7 @@ "abstract": true, "component": "vn-supplier", "description": "Suppliers" - }, + }, { "url": "/index?q", "state": "supplier.index", @@ -51,6 +51,13 @@ "params": { "supplier": "$ctrl.supplier" } + }, + { + "url": "/create", + "state": "supplier.create", + "component": "vn-supplier-create", + "acl": ["administrative"], + "description": "New supplier" }, { "url": "/basic-data", diff --git a/modules/ticket/back/locale/sale/en.yml b/modules/ticket/back/locale/sale/en.yml new file mode 100644 index 000000000..ae8f67d5e --- /dev/null +++ b/modules/ticket/back/locale/sale/en.yml @@ -0,0 +1,11 @@ +concept: concept +quantity: quantity +price: price +discount: discount +reserved: reserved +isPicked: is picked +created: created +originalQuantity: original quantity +itemFk: item +ticketFk: ticket +saleFk: sale diff --git a/modules/ticket/back/locale/sale/es.yml b/modules/ticket/back/locale/sale/es.yml new file mode 100644 index 000000000..ff8cc5466 --- /dev/null +++ b/modules/ticket/back/locale/sale/es.yml @@ -0,0 +1,11 @@ +concept: concepto +quantity: cantidad +price: precio +discount: descuento +reserved: reservado +isPicked: esta seleccionado +created: creado +originalQuantity: cantidad original +itemFk: artículo +ticketFk: ticket +saleFk: línea diff --git a/modules/ticket/back/locale/ticket/en.yml b/modules/ticket/back/locale/ticket/en.yml new file mode 100644 index 000000000..c4ad84232 --- /dev/null +++ b/modules/ticket/back/locale/ticket/en.yml @@ -0,0 +1,23 @@ +shipped: shipped +landed: landed +nickname: nickname +location: location +solution: solution +packages: packages +updated: updated +isDeleted: is deleted +priority: priority +zoneFk: zone +zonePrice: zone price +zoneBonus: zone bonus +totalWithVat: total with vat +totalWithoutVat: total without vat +clientFk: client +warehouseFk: warehouse +refFk: reference +addressFk: address +routeFk: route +companyFk: company +agencyModeFk: agency +ticketFk: ticket +mergedTicket: merged ticket diff --git a/modules/ticket/back/locale/ticket/es.yml b/modules/ticket/back/locale/ticket/es.yml new file mode 100644 index 000000000..15b5a39bf --- /dev/null +++ b/modules/ticket/back/locale/ticket/es.yml @@ -0,0 +1,25 @@ +shipped: fecha salida +landed: fecha entrega +nickname: alias +location: ubicación +solution: solución +packages: embalajes +updated: fecha última actualización +isDeleted: esta eliminado +priority: prioridad +zoneFk: zona +zonePrice: precio zona +zoneBonus: bonus zona +totalWithVat: total con IVA +totalWithoutVat: total sin IVA +clientFk: cliente +warehouseFk: almacén +refFk: referencia +addressFk: dirección +routeFk: ruta +companyFk: empresa +agencyModeFk: agencia +ticketFk: ticket +mergedTicket: ticket fusionado +withWarningAccept: aviso negativos +isWithoutNegatives: sin negativos diff --git a/modules/ticket/back/methods/boxing/getVideo.js b/modules/ticket/back/methods/boxing/getVideo.js new file mode 100644 index 000000000..6f471e837 --- /dev/null +++ b/modules/ticket/back/methods/boxing/getVideo.js @@ -0,0 +1,88 @@ +const https = require('https'); + +module.exports = Self => { + Self.remoteMethod('getVideo', { + description: 'Get packing video', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'Ticket id' + }, + { + arg: 'filename', + type: 'string', + required: true, + description: 'Time to add' + }, + { + arg: 'req', + type: 'object', + http: {source: 'req'} + }, + { + arg: 'res', + type: 'object', + http: {source: 'res'} + } + ], + http: { + path: `/getVideo`, + verb: 'GET', + }, + }); + + Self.getVideo = async(id, filename, req, res, options) => { + const models = Self.app.models; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const packingSiteConfig = await models.PackingSiteConfig.findOne({}, myOptions); + + const query = ` + SELECT + e.id, + ps.monitorId, + e.created + FROM expedition e + JOIN host h ON Convert(h.code USING utf8mb3) COLLATE utf8mb3_unicode_ci = e.hostFk + JOIN packingSite ps ON ps.hostFk = h.id + WHERE e.id = ?;`; + const [expedition] = await models.Expedition.rawSql(query, [id]); + const monitorId = expedition.monitorId; + + const videoUrl = + `/${packingSiteConfig.shinobiToken}/videos/${packingSiteConfig.shinobiGroupKey}/${monitorId}/${filename}`; + + const headers = Object.assign({}, req.headers, { + host: 'shinobi.verdnatura.es' + }); + const httpOptions = { + host: 'shinobi.verdnatura.es', + path: videoUrl, + port: 443, + headers + }; + + return new Promise((resolve, reject) => { + const req = https.request(httpOptions, shinobiRes => { + shinobiRes.pause(); + res.writeHeader(shinobiRes.statusCode, shinobiRes.headers); + shinobiRes.pipe(res); + }); + + req.on('error', () => { + reject(); + }); + + req.on('end', () => { + resolve(); + }); + req.end(); + }); + }; +}; diff --git a/modules/ticket/back/methods/boxing/getVideoList.js b/modules/ticket/back/methods/boxing/getVideoList.js new file mode 100644 index 000000000..3d45a720d --- /dev/null +++ b/modules/ticket/back/methods/boxing/getVideoList.js @@ -0,0 +1,78 @@ +const axios = require('axios'); +const models = require('vn-loopback/server/server').models; + +module.exports = Self => { + Self.remoteMethod('getVideoList', { + description: 'Get video list of expedition id', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'Expedition id' + }, { + arg: 'from', + type: 'number', + required: false, + }, { + arg: 'to', + type: 'number', + required: false, + } + ], returns: { + type: ['object'], + root: true + }, + http: { + path: `/getVideoList`, + verb: 'GET', + }, + }); + + Self.getVideoList = async(id, from, to, options) => { + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const packingSiteConfig = await models.PackingSiteConfig.findOne({}, myOptions); + + const query = ` + SELECT + e.id, + ps.monitorId, + e.created + FROM expedition e + JOIN host h ON Convert(h.code USING utf8mb3) COLLATE utf8mb3_unicode_ci = e.hostFk + JOIN packingSite ps ON ps.hostFk = h.id + WHERE e.id = ?;`; + const [expedition] = await models.PackingSiteConfig.rawSql(query, [id]); + + if (!from && !expedition) return []; + let start = new Date(expedition.created); + let end = new Date(start.getTime() + (packingSiteConfig.avgBoxingTime * 1000)); + + if (from && to) { + start.setHours(from, 0, 0); + end.setHours(to, 0, 0); + } + const offset = start.getTimezoneOffset(); + start = new Date(start.getTime() - (offset * 60 * 1000)); + end = new Date(end.getTime() - (offset * 60 * 1000)); + + const videoUrl = + `/${packingSiteConfig.shinobiToken}/videos/${packingSiteConfig.shinobiGroupKey}/${expedition.monitorId}`; + const timeUrl = `?start=${start.toISOString().split('.')[0]}&end=${end.toISOString().split('.')[0]}`; + const url = `${packingSiteConfig.shinobiUrl}${videoUrl}${timeUrl}`; + + let response; + + try { + response = await axios.get(url); + } catch (e) { + return []; + } + return response.data.videos.map(video => video.filename); + }; +}; diff --git a/modules/ticket/back/methods/boxing/specs/getVideo.spec.js b/modules/ticket/back/methods/boxing/specs/getVideo.spec.js new file mode 100644 index 000000000..8e8cdc5b9 --- /dev/null +++ b/modules/ticket/back/methods/boxing/specs/getVideo.spec.js @@ -0,0 +1,40 @@ +const models = require('vn-loopback/server/server').models; +const https = require('https'); + +xdescribe('boxing getVideo()', () => { + it('should return data', async() => { + const tx = await models.PackingSiteConfig.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const id = 1; + const video = 'video.mp4'; + + const response = { + pipe: () => {}, + on: () => {}, + end: () => {}, + }; + + const req = { + headers: 'apiHeader', + data: { + pipe: () => {}, + on: () => {}, + } + }; + + spyOn(https, 'request').and.returnValue(response); + + const result = await models.Boxing.getVideo(id, video, req, null, options); + + expect(result[0]).toEqual(response.data.videos[0].filename); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/ticket/back/methods/boxing/specs/getVideoList.spec.js b/modules/ticket/back/methods/boxing/specs/getVideoList.spec.js new file mode 100644 index 000000000..c6d1a3e07 --- /dev/null +++ b/modules/ticket/back/methods/boxing/specs/getVideoList.spec.js @@ -0,0 +1,36 @@ +const models = require('vn-loopback/server/server').models; +const axios = require('axios'); + +describe('boxing getVideoList()', () => { + it('should return video list', async() => { + const tx = await models.PackingSiteConfig.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const id = 1; + const from = 1; + const to = 2; + + const response = { + data: { + videos: [{ + id: 1, + filename: 'video1.mp4' + }] + } + }; + + spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(response))); + + const result = await models.Boxing.getVideoList(id, from, to, options); + + expect(result[0]).toEqual(response.data.videos[0].filename); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/ticket/back/methods/expedition/deleteExpeditions.js b/modules/ticket/back/methods/expedition/deleteExpeditions.js new file mode 100644 index 000000000..2419d3a5e --- /dev/null +++ b/modules/ticket/back/methods/expedition/deleteExpeditions.js @@ -0,0 +1,52 @@ + +module.exports = Self => { + Self.remoteMethod('deleteExpeditions', { + description: 'Delete the selected expeditions', + accessType: 'WRITE', + accepts: [{ + arg: 'expeditionIds', + type: ['number'], + required: true, + description: 'The expeditions ids to delete' + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/deleteExpeditions`, + verb: 'POST' + } + }); + + Self.deleteExpeditions = async(expeditionIds, options) => { + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const promises = []; + for (let expeditionId of expeditionIds) { + const deletedExpedition = models.Expedition.destroyById(expeditionId, myOptions); + promises.push(deletedExpedition); + } + + const deletedExpeditions = await Promise.all(promises); + + if (tx) await tx.commit(); + + return deletedExpeditions; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/ticket/back/methods/expedition/filter.js b/modules/ticket/back/methods/expedition/filter.js index 723d7c844..fcf0bd1b3 100644 --- a/modules/ticket/back/methods/expedition/filter.js +++ b/modules/ticket/back/methods/expedition/filter.js @@ -32,12 +32,11 @@ module.exports = Self => { `SELECT e.id, e.ticketFk, - e.isBox, + e.freightItemFk, e.workerFk, i1.name packageItemName, e.counter, i2.name freightItemName, - e.itemFk, u.name userName, e.created, e.externalId, @@ -50,10 +49,10 @@ module.exports = Self => { 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 - INNER JOIN vn.item i1 ON i1.id = e.isBox + INNER JOIN vn.item i1 ON i1.id = e.freightItemFk LEFT JOIN vn.packaging p ON p.id = e.packagingFk LEFT JOIN vn.item i3 ON i3.id = p.itemFk + LEFT JOIN vn.item i2 ON i2.id = p.itemFk LEFT JOIN account.user u ON u.id = e.workerFk LEFT JOIN vn.expeditionScan es ON es.expeditionFk = e.id LEFT JOIN account.user su ON su.id = es.workerFk diff --git a/modules/ticket/back/methods/expedition/moveExpeditions.js b/modules/ticket/back/methods/expedition/moveExpeditions.js new file mode 100644 index 000000000..cef35ab86 --- /dev/null +++ b/modules/ticket/back/methods/expedition/moveExpeditions.js @@ -0,0 +1,93 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('moveExpeditions', { + description: 'Move the selected expeditions to another ticket', + accessType: 'WRITE', + accepts: [{ + arg: 'clientId', + type: 'number', + description: `The client id`, + required: true + }, + { + arg: 'landed', + type: 'date', + description: `The landing date` + }, + { + arg: 'warehouseId', + type: 'number', + description: `The warehouse id`, + required: true + }, + { + arg: 'addressId', + type: 'number', + description: `The address id`, + required: true + }, + { + arg: 'agencyModeId', + type: 'any', + description: `The agencyMode id` + }, + { + arg: 'routeId', + type: 'any', + description: `The route id` + }, + { + arg: 'expeditionIds', + type: ['number'], + required: true, + description: 'The expeditions ids to move' + }], + returns: { + type: 'object', + root: true + }, + http: { + path: `/moveExpeditions`, + verb: 'POST' + } + }); + + Self.moveExpeditions = async(ctx, options) => { + const models = Self.app.models; + const args = ctx.args; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + if (args.routeId) { + const route = await models.Route.findById(args.routeId, null, myOptions); + if (!route) throw new UserError('This route does not exists'); + } + const ticket = await models.Ticket.new(ctx, myOptions); + const promises = []; + for (let expeditionsId of args.expeditionIds) { + const expeditionToUpdate = await models.Expedition.findById(expeditionsId, null, myOptions); + const expeditionUpdated = expeditionToUpdate.updateAttribute('ticketFk', ticket.id, myOptions); + promises.push(expeditionUpdated); + } + + await Promise.all(promises); + + if (tx) await tx.commit(); + + return ticket; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/ticket/back/methods/expedition/specs/deleteExpeditions.spec.js b/modules/ticket/back/methods/expedition/specs/deleteExpeditions.spec.js new file mode 100644 index 000000000..14bdf7aea --- /dev/null +++ b/modules/ticket/back/methods/expedition/specs/deleteExpeditions.spec.js @@ -0,0 +1,22 @@ +const models = require('vn-loopback/server/server').models; + +describe('ticket deleteExpeditions()', () => { + it('should delete the selected expeditions', async() => { + const tx = await models.Expedition.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const expeditionIds = [12, 13]; + const result = await models.Expedition.deleteExpeditions(expeditionIds, options); + + expect(result.length).toEqual(2); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); + diff --git a/modules/ticket/back/methods/expedition/specs/filter.spec.js b/modules/ticket/back/methods/expedition/specs/filter.spec.js index 85e98da4a..f643462cc 100644 --- a/modules/ticket/back/methods/expedition/specs/filter.spec.js +++ b/modules/ticket/back/methods/expedition/specs/filter.spec.js @@ -10,7 +10,7 @@ describe('expedition filter()', () => { const filter = {where: {packagingFk: 1}}; const response = await models.Expedition.filter(filter, options); - expect(response.length).toEqual(10); + expect(response.length).toBeGreaterThan(1); await tx.rollback(); } catch (e) { diff --git a/modules/ticket/back/methods/expedition/specs/moveExpeditions.spec.js b/modules/ticket/back/methods/expedition/specs/moveExpeditions.spec.js new file mode 100644 index 000000000..ac397d38e --- /dev/null +++ b/modules/ticket/back/methods/expedition/specs/moveExpeditions.spec.js @@ -0,0 +1,39 @@ +const models = require('vn-loopback/server/server').models; + +describe('ticket moveExpeditions()', () => { + it('should move the selected expeditions to new ticket', async() => { + const tx = await models.Expedition.beginTransaction({}); + const ctx = { + req: {accessToken: {userId: 9}}, + args: {}, + params: {} + }; + const myCtx = Object.assign({}, ctx); + + try { + const options = {transaction: tx}; + myCtx.args = { + clientId: 1101, + landed: Date.vnNew(), + warehouseId: 1, + addressId: 121, + agencyModeId: 1, + routeId: null, + expeditionIds: [1, 2] + + }; + + const ticket = await models.Expedition.moveExpeditions(myCtx, options); + + const newestTicketIdInFixtures = 27; + + expect(ticket.id).toBeGreaterThan(newestTicketIdInFixtures); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); + diff --git a/modules/ticket/back/methods/packaging/specs/listPackaging.spec.js b/modules/ticket/back/methods/packaging/specs/listPackaging.spec.js index 3d07b90f9..1b5892e04 100644 --- a/modules/ticket/back/methods/packaging/specs/listPackaging.spec.js +++ b/modules/ticket/back/methods/packaging/specs/listPackaging.spec.js @@ -8,9 +8,9 @@ describe('ticket listPackaging()', () => { const options = {transaction: tx}; const filter = {where: {packagingFk: 1}}; - const response = await models.Packaging.listPackaging(filter, options); + const [response] = await models.Packaging.listPackaging(filter, options); - expect(response[0].name).toEqual('Container ammo box 1m'); + expect(response.name).toEqual('Container ammo box 1m'); await tx.rollback(); } catch (e) { diff --git a/modules/ticket/back/methods/sale-tracking/listSaleTracking.js b/modules/ticket/back/methods/sale-tracking/listSaleTracking.js index c0d63ef62..98743d8cc 100644 --- a/modules/ticket/back/methods/sale-tracking/listSaleTracking.js +++ b/modules/ticket/back/methods/sale-tracking/listSaleTracking.js @@ -36,7 +36,7 @@ module.exports = Self => { st.originalQuantity, st.created, st.workerFk, - u.nickname userNickname, + u.name, ste.name AS state FROM saleTracking st JOIN sale s ON s.id = st.saleFk @@ -48,24 +48,6 @@ module.exports = Self => { const trackings = await Self.rawStmt(stmt, myOptions); - const salesFilter = { - include: [ - { - relation: 'item' - } - ], - where: {ticketFk: filter.where.ticketFk} - }; - - const sales = await Self.app.models.Sale.find(salesFilter, myOptions); - - for (const tracking of trackings) { - for (const sale of sales) { - if (tracking.itemFk == sale.itemFk) - tracking.item = sale.item(); - } - } - return trackings; }; }; diff --git a/modules/ticket/back/methods/sale/canEdit.js b/modules/ticket/back/methods/sale/canEdit.js index 4e0fc5f8b..3091ebca7 100644 --- a/modules/ticket/back/methods/sale/canEdit.js +++ b/modules/ticket/back/methods/sale/canEdit.js @@ -1,10 +1,12 @@ +const UserError = require('vn-loopback/util/user-error'); + module.exports = Self => { Self.remoteMethodCtx('canEdit', { description: 'Check if all the received sales are aditable', accessType: 'READ', accepts: [{ arg: 'sales', - type: ['object'], + type: ['number'], required: true }], returns: { @@ -12,29 +14,55 @@ module.exports = Self => { root: true }, http: { - path: `/isEditable`, - verb: 'get' + path: `/canEdit`, + verb: 'GET' } }); Self.canEdit = async(ctx, sales, options) => { const models = Self.app.models; - const userId = ctx.req.accessToken.userId; const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); - const idsCollection = sales.map(sale => sale.id); + const salesData = await models.Sale.find({ + fields: ['id', 'itemFk', 'ticketFk'], + where: {id: {inq: sales}}, + include: + { + relation: 'item', + scope: { + fields: ['id', 'isFloramondo'], + } + } + }, myOptions); - const saleTracking = await models.SaleTracking.find({where: {saleFk: {inq: idsCollection}}}, myOptions); + const ticketId = salesData[0].ticketFk; - const hasSaleTracking = saleTracking.length; + const isTicketEditable = await models.Ticket.isEditable(ctx, ticketId, myOptions); + if (!isTicketEditable) + throw new UserError(`The sales of this ticket can't be modified`); - const isProductionRole = await models.Account.hasRole(userId, 'production', myOptions); + const hasSaleTracking = await models.SaleTracking.findOne({where: {saleFk: {inq: sales}}}, myOptions); + const hasSaleCloned = await models.SaleCloned.findOne({where: {saleClonedFk: {inq: sales}}}, myOptions); + const hasSaleFloramondo = salesData.find(sale => sale.item().isFloramondo); - const canEdit = (isProductionRole || !hasSaleTracking); + const canEditTracked = await models.ACL.checkAccessAcl(ctx, 'Sale', 'editTracked'); + const canEditCloned = await models.ACL.checkAccessAcl(ctx, 'Sale', 'editCloned'); + const canEditFloramondo = await models.ACL.checkAccessAcl(ctx, 'Sale', 'editFloramondo'); - return canEdit; + const shouldEditTracked = canEditTracked || !hasSaleTracking; + const shouldEditCloned = canEditCloned || !hasSaleCloned; + const shouldEditFloramondo = canEditFloramondo || !hasSaleFloramondo; + + if (!shouldEditTracked) + throw new UserError('It is not possible to modify tracked sales'); + if (!shouldEditCloned) + throw new UserError('It is not possible to modify cloned sales'); + if (!shouldEditFloramondo) + throw new UserError('It is not possible to modify sales that their articles are from Floramondo'); + + return true; }; }; diff --git a/modules/ticket/back/methods/sale/deleteSales.js b/modules/ticket/back/methods/sale/deleteSales.js index c1359569d..5d1463a66 100644 --- a/modules/ticket/back/methods/sale/deleteSales.js +++ b/modules/ticket/back/methods/sale/deleteSales.js @@ -41,7 +41,9 @@ module.exports = Self => { } try { - const canEditSales = await models.Sale.canEdit(ctx, sales, myOptions); + const saleIds = sales.map(sale => sale.id); + + await models.Sale.canEdit(ctx, saleIds, myOptions); const ticket = await models.Ticket.findById(ticketId, { include: { @@ -57,13 +59,6 @@ module.exports = Self => { } }, myOptions); - const isTicketEditable = await models.Ticket.isEditable(ctx, ticketId, myOptions); - if (!isTicketEditable) - throw new UserError(`The sales of this ticket can't be modified`); - - if (!canEditSales) - throw new UserError(`Sale(s) blocked, please contact production`); - const promises = []; let deletions = ''; for (let sale of sales) { diff --git a/modules/ticket/back/methods/sale/getClaimableFromTicket.js b/modules/ticket/back/methods/sale/getClaimableFromTicket.js index ecbc52b94..c51781f59 100644 --- a/modules/ticket/back/methods/sale/getClaimableFromTicket.js +++ b/modules/ticket/back/methods/sale/getClaimableFromTicket.js @@ -24,24 +24,24 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); const query = ` - SELECT - s.id AS saleFk, - t.id AS ticketFk, + SELECT + s.id AS saleFk, + t.id AS ticketFk, t.landed, - s.concept, - s.itemFk, - s.quantity, - s.price, - s.discount, + s.concept, + s.itemFk, + s.quantity, + s.price, + s.discount, t.nickname - FROM vn.ticket t + FROM vn.ticket t INNER JOIN vn.sale s ON s.ticketFk = t.id LEFT JOIN vn.claimBeginning cb ON cb.saleFk = s.id - WHERE (t.landed) >= TIMESTAMPADD(DAY, -7, ?) + WHERE (t.landed) >= TIMESTAMPADD(DAY, -7, ?) AND t.id = ? AND cb.id IS NULL ORDER BY t.landed DESC, t.id DESC`; diff --git a/modules/ticket/back/methods/sale/recalculatePrice.js b/modules/ticket/back/methods/sale/recalculatePrice.js index 59c7d3535..2c8e6768b 100644 --- a/modules/ticket/back/methods/sale/recalculatePrice.js +++ b/modules/ticket/back/methods/sale/recalculatePrice.js @@ -1,4 +1,5 @@ const UserError = require('vn-loopback/util/user-error'); + module.exports = Self => { Self.remoteMethodCtx('recalculatePrice', { description: 'Calculates the price of sales and its components', @@ -34,17 +35,9 @@ module.exports = Self => { } try { - const salesIds = []; - for (let sale of sales) - salesIds.push(sale.id); + const salesIds = sales.map(sale => sale.id); - const isEditable = await models.Ticket.isEditable(ctx, sales[0].ticketFk, myOptions); - if (!isEditable) - throw new UserError(`The sales of this ticket can't be modified`); - - const canEditSale = await models.Sale.canEdit(ctx, sales, myOptions); - if (!canEditSale) - throw new UserError(`Sale(s) blocked, please contact production`); + await models.Sale.canEdit(ctx, salesIds, myOptions); const query = ` DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales; diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index 83a420a8e..7b63fd66e 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -1,23 +1,25 @@ -const UserError = require('vn-loopback/util/user-error'); - module.exports = Self => { - Self.remoteMethodCtx('refund', { - description: 'Create ticket refund with lines and services changing the sign to the quantites', + Self.remoteMethod('refund', { + description: 'Create refund tickets with sales and services if provided', accessType: 'WRITE', - accepts: [{ - arg: 'sales', - description: 'The sales', - type: ['object'], - required: false - }, - { - arg: 'services', - type: ['object'], - required: false, - description: 'The services' - }], + accepts: [ + { + arg: 'salesIds', + type: ['number'], + required: true + }, + { + arg: 'servicesIds', + type: ['number'] + }, + { + arg: 'createSingleTicket', + type: 'boolean', + required: false + } + ], returns: { - type: 'number', + type: ['number'], root: true }, http: { @@ -26,7 +28,8 @@ module.exports = Self => { } }); - Self.refund = async(ctx, sales, services, options) => { + Self.refund = async(salesIds, servicesIds, createSingleTicket = false, options) => { + const models = Self.app.models; const myOptions = {}; let tx; @@ -39,59 +42,148 @@ module.exports = Self => { } try { - const userId = ctx.req.accessToken.userId; + const refundAgencyMode = await models.AgencyMode.findOne({ + include: { + relation: 'zones', + scope: { + limit: 1, + field: ['id', 'name'] + } + }, + where: {code: 'refund'} + }, myOptions); - const isClaimManager = await Self.app.models.Account.hasRole(userId, 'claimManager'); - const isSalesAssistant = await Self.app.models.Account.hasRole(userId, 'salesAssistant'); - const hasValidRole = isClaimManager || isSalesAssistant; + const refoundZoneId = refundAgencyMode.zones()[0].id; - if (!hasValidRole) - throw new UserError(`You don't have privileges to create refund`); + const salesFilter = { + where: {id: {inq: salesIds}}, + include: { + relation: 'components', + scope: { + fields: ['saleFk', 'componentFk', 'value'] + } + } + }; + const sales = await models.Sale.find(salesFilter, myOptions); + const ticketsIds = [...new Set(sales.map(sale => sale.ticketFk))]; - const salesIds = []; - if (sales) { - for (let sale of sales) - salesIds.push(sale.id); - } else - salesIds.push(null); + const refundTickets = []; + const mappedTickets = new Map(); + const now = Date.vnNew(); - const servicesIds = []; - if (services) { - for (let service of services) - servicesIds.push(service.id); - } else - servicesIds.push(null); + const [firstTicketId] = ticketsIds; + if (createSingleTicket) { + await createTicketRefund( + firstTicketId, + refundTickets, + mappedTickets, + now, + refundAgencyMode, + refoundZoneId, + myOptions + ); + } else { + for (let ticketId of ticketsIds) { + await createTicketRefund( + ticketId, + refundTickets, + mappedTickets, + now, + refundAgencyMode, + refoundZoneId, + myOptions + ); + } + } - const query = ` - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - DROP TEMPORARY TABLE IF EXISTS tmp.ticketService; + for (const sale of sales) { + const refundTicketId = await getTicketRefundId(createSingleTicket, sale.ticketFk, refundTickets, mappedTickets); - CREATE TEMPORARY TABLE tmp.sale - SELECT s.id, s.itemFk, s.quantity, s.concept, s.price, s.discount, s.ticketFk - FROM sale s - WHERE s.id IN (?); + const createdSale = await models.Sale.create({ + ticketFk: refundTicketId, + itemFk: sale.itemFk, + quantity: - sale.quantity, + concept: sale.concept, + price: sale.price, + discount: sale.discount, + }, myOptions); - CREATE TEMPORARY TABLE tmp.ticketService - SELECT ts.description, ts.quantity, ts.price, ts.taxClassFk, ts.ticketServiceTypeFk, ts.ticketFk - FROM ticketService ts - WHERE ts.id IN (?); + const components = sale.components(); + for (const component of components) + component.saleFk = createdSale.id; - CALL vn.ticket_doRefund(@newTicket); + await models.SaleComponent.create(components, myOptions); + } - DROP TEMPORARY TABLE tmp.sale; - DROP TEMPORARY TABLE tmp.ticketService;`; + if (servicesIds && servicesIds.length > 0) { + const servicesFilter = { + where: {id: {inq: servicesIds}} + }; + const services = await models.TicketService.find(servicesFilter, myOptions); - await Self.rawSql(query, [salesIds, servicesIds], myOptions); + for (const service of services) { + const refundTicketId = await getTicketRefundId(createSingleTicket, service.ticketFk, refundTickets, mappedTickets); - const [newTicket] = await Self.rawSql('SELECT @newTicket id', null, myOptions); - const newTicketId = newTicket.id; + await models.TicketService.create({ + description: service.description, + quantity: - service.quantity, + price: service.price, + taxClassFk: service.taxClassFk, + ticketFk: refundTicketId, + ticketServiceTypeFk: service.ticketServiceTypeFk, + }, myOptions); + } + } if (tx) await tx.commit(); - return newTicketId; + return refundTickets; } catch (e) { if (tx) await tx.rollback(); throw e; } }; + + async function createTicketRefund( + ticketId, + refundTickets, + mappedTickets, + now, + refundAgencyMode, + refoundZoneId, + myOptions + ) { + const models = Self.app.models; + + const filter = {include: {relation: 'address'}}; + const ticket = await models.Ticket.findById(ticketId, filter, myOptions); + + const refundTicket = await models.Ticket.create({ + clientFk: ticket.clientFk, + shipped: now, + addressFk: ticket.address().id, + agencyModeFk: refundAgencyMode.id, + nickname: ticket.address().nickname, + warehouseFk: ticket.warehouseFk, + companyFk: ticket.companyFk, + landed: now, + zoneFk: refoundZoneId + }, myOptions); + + refundTickets.push(refundTicket); + + mappedTickets.set(ticketId, refundTicket.id); + + await models.TicketRefund.create({ + refundTicketFk: refundTicket.id, + originalTicketFk: ticket.id, + }, myOptions); + } + + async function getTicketRefundId(createSingleTicket, ticketId, refundTickets, mappedTickets) { + if (createSingleTicket) { + const [firstRefundTicket] = refundTickets; + return firstRefundTicket.id; + } else return mappedTickets.get(ticketId); + } }; diff --git a/modules/ticket/back/methods/sale/reserve.js b/modules/ticket/back/methods/sale/reserve.js index b368f6fc3..2dc368af6 100644 --- a/modules/ticket/back/methods/sale/reserve.js +++ b/modules/ticket/back/methods/sale/reserve.js @@ -49,14 +49,9 @@ module.exports = Self => { } try { - const isTicketEditable = await models.Ticket.isEditable(ctx, ticketId, myOptions); - if (!isTicketEditable) - throw new UserError(`The sales of this ticket can't be modified`); + const salesIds = sales.map(sale => sale.id); - const canEditSale = await models.Sale.canEdit(ctx, sales, myOptions); - - if (!canEditSale) - throw new UserError(`Sale(s) blocked, please contact production`); + await models.Sale.canEdit(ctx, salesIds, myOptions); let changesMade = ''; const promises = []; diff --git a/modules/ticket/back/methods/sale/salePreparingList.js b/modules/ticket/back/methods/sale/salePreparingList.js new file mode 100644 index 000000000..e6e7d5164 --- /dev/null +++ b/modules/ticket/back/methods/sale/salePreparingList.js @@ -0,0 +1,33 @@ +module.exports = Self => { + Self.remoteMethodCtx('salePreparingList', { + description: 'Returns a list with the lines of a ticket and its different states of preparation', + accessType: 'READ', + accepts: [{ + arg: 'id', + type: 'number', + required: true, + description: 'The ticket id', + http: {source: 'path'} + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/:id/salePreparingList`, + verb: 'GET' + } + }); + + Self.salePreparingList = async(ctx, id, options) => { + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + query = `CALL vn.salePreparingList(?)`; + const [sales] = await Self.rawSql(query, [id], myOptions); + + return sales; + }; +}; diff --git a/modules/ticket/back/methods/sale/specs/canEdit.spec.js b/modules/ticket/back/methods/sale/specs/canEdit.spec.js index 4f6747257..62f98421a 100644 --- a/modules/ticket/back/methods/sale/specs/canEdit.spec.js +++ b/modules/ticket/back/methods/sale/specs/canEdit.spec.js @@ -1,69 +1,164 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('sale canEdit()', () => { - it('should return true if the role is production regardless of the saleTrackings', async() => { - const tx = await models.Sale.beginTransaction({}); - - try { - const options = {transaction: tx}; - - const productionUserID = 49; - const ctx = {req: {accessToken: {userId: productionUserID}}}; - - const sales = [{id: 3}]; - - const result = await models.Sale.canEdit(ctx, sales, options); - - expect(result).toEqual(true); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } + const employeeId = 1; + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); }); - it('should return true if the role is not production and none of the sales has saleTracking', async() => { - const tx = await models.Sale.beginTransaction({}); + describe('sale editTracked', () => { + it('should return true if the role is production regardless of the saleTrackings', async() => { + const tx = await models.Sale.beginTransaction({}); - try { - const options = {transaction: tx}; + try { + const options = {transaction: tx}; - const salesPersonUserID = 18; - const ctx = {req: {accessToken: {userId: salesPersonUserID}}}; + const productionUserID = 49; + const ctx = {req: {accessToken: {userId: productionUserID}}}; - const sales = [{id: 10}]; + const sales = [25]; - const result = await models.Sale.canEdit(ctx, sales, options); + const result = await models.Sale.canEdit(ctx, sales, options); - expect(result).toEqual(true); + expect(result).toEqual(true); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return true if the role is not production and none of the sales has saleTracking', async() => { + const tx = await models.Sale.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const salesPersonUserID = 18; + const ctx = {req: {accessToken: {userId: salesPersonUserID}}}; + + const sales = [10]; + + const result = await models.Sale.canEdit(ctx, sales, options); + + expect(result).toEqual(true); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); }); - it('should return false if any of the sales has a saleTracking record', async() => { - const tx = await models.Sale.beginTransaction({}); + describe('sale editCloned', () => { + const saleCloned = [29]; - try { - const options = {transaction: tx}; + it('should return true if any of the sales is cloned and has the correct role', async() => { + const tx = await models.Sale.beginTransaction({}); + const roleEnabled = await models.ACL.findOne({ + where: { + model: 'Sale', + property: 'editCloned', + permission: 'ALLOW' + } + }); + if (!roleEnabled || !roleEnabled.principalId) return await tx.rollback(); - const salesPersonUserID = 18; - const ctx = {req: {accessToken: {userId: salesPersonUserID}}}; + try { + const options = {transaction: tx}; - const sales = [{id: 3}]; + const role = await models.Role.findOne({ + where: { + name: roleEnabled.principalId + } + }); + const ctx = {req: {accessToken: {userId: role.id}}}; - const result = await models.Sale.canEdit(ctx, sales, options); + const result = await models.Sale.canEdit(ctx, saleCloned, options); - expect(result).toEqual(false); + expect(result).toEqual(true); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + }); + + describe('sale editFloramondo', () => { + it('should return false if any of the sales isFloramondo', async() => { + const tx = await models.Sale.beginTransaction({}); + const sales = [26]; + let error; + try { + const options = {transaction: tx}; + + const ctx = {req: {accessToken: {userId: employeeId}}}; + const saleToEdit = await models.Sale.findById(sales[0], null, options); + await saleToEdit.updateAttribute('itemFk', 9, options); + + await models.Sale.canEdit(ctx, sales, options); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } + + expect(error).toEqual( + new Error('It is not possible to modify sales that their articles are from Floramondo')); + }); + + it('should return true if any of the sales is of isFloramondo and has the correct role', async() => { + const tx = await models.Sale.beginTransaction({}); + const sales = [26]; + + const roleEnabled = await models.ACL.findOne({ + where: { + model: 'Sale', + property: 'editFloramondo', + permission: 'ALLOW' + } + }); + + if (!roleEnabled || !roleEnabled.principalId) return await tx.rollback(); + + try { + const options = {transaction: tx}; + + const role = await models.Role.findOne({ + where: { + name: roleEnabled.principalId + } + }); + const ctx = {req: {accessToken: {userId: role.id}}}; + + // For test + const saleToEdit = await models.Sale.findById(sales[0], null, options); + await saleToEdit.updateAttribute('itemFk', 9, options); + + const result = await models.Sale.canEdit(ctx, sales, options); + + expect(result).toEqual(true); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); }); }); diff --git a/modules/ticket/back/methods/sale/specs/deleteSales.spec.js b/modules/ticket/back/methods/sale/specs/deleteSales.spec.js index 82cf916b3..3d3e06e22 100644 --- a/modules/ticket/back/methods/sale/specs/deleteSales.spec.js +++ b/modules/ticket/back/methods/sale/specs/deleteSales.spec.js @@ -1,6 +1,21 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('sale deleteSales()', () => { + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + it('should throw an error if the ticket of the given sales is not editable', async() => { const tx = await models.Sale.beginTransaction({}); diff --git a/modules/ticket/back/methods/sale/specs/refund.spec.js b/modules/ticket/back/methods/sale/specs/refund.spec.js index 5cb353055..403b4b477 100644 --- a/modules/ticket/back/methods/sale/specs/refund.spec.js +++ b/modules/ticket/back/methods/sale/specs/refund.spec.js @@ -1,23 +1,30 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); -describe('sale refund()', () => { - const sales = [ - {id: 7, ticketFk: 11}, - {id: 8, ticketFk: 11} - ]; - const services = [{id: 1}]; +describe('Sale refund()', () => { + const userId = 5; + const activeCtx = { + accessToken: {userId: userId}, + }; - it('should create ticket with the selected lines changing the sign to the quantites', async() => { + const servicesIds = [3]; + + beforeEach(() => { + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + + it('should create ticket with the selected lines', async() => { const tx = await models.Sale.beginTransaction({}); - const ctx = {req: {accessToken: {userId: 9}}}; + const salesIds = [7, 8]; try { const options = {transaction: tx}; - const response = await models.Sale.refund(ctx, sales, services, options); - const [newTicketId] = await models.Sale.rawSql('SELECT MAX(t.id) id FROM vn.ticket t;', null, options); + const response = await models.Sale.refund(salesIds, servicesIds, false, options); - expect(response).toEqual(newTicketId.id); + expect(response.length).toBeGreaterThanOrEqual(1); await tx.rollback(); } catch (e) { @@ -26,24 +33,54 @@ describe('sale refund()', () => { } }); - it(`should throw an error if the user doesn't have privileges to create a refund`, async() => { + it('should create a ticket for each unique ticketFk in the sales', async() => { const tx = await models.Sale.beginTransaction({}); - const ctx = {req: {accessToken: {userId: 1}}}; - - let error; + const salesIds = [6, 7]; try { const options = {transaction: tx}; - await models.Sale.refund(ctx, sales, services, options); + const createSingleTicket = false; + const tickets = await models.Sale.refund(salesIds, servicesIds, createSingleTicket, options); + + const ticketsIds = tickets.map(ticket => ticket.id); + + const refundedTickets = await models.Ticket.find({ + where: { + id: { + inq: ticketsIds + } + }, + include: [ + { + relation: 'ticketSales', + scope: { + include: { + relation: 'components' + } + } + }, + { + relation: 'ticketServices', + } + ] + }, options); + + const firstRefoundedTicket = refundedTickets[0]; + const secondRefoundedTicket = refundedTickets[1]; + const salesLength = firstRefoundedTicket.ticketSales().length; + const componentsLength = firstRefoundedTicket.ticketSales()[0].components().length; + const servicesLength = secondRefoundedTicket.ticketServices().length; + + expect(refundedTickets.length).toEqual(2); + expect(salesLength).toEqual(1); + expect(componentsLength).toEqual(4); + expect(servicesLength).toBeGreaterThanOrEqual(1); await tx.rollback(); } catch (e) { await tx.rollback(); - error = e; + throw e; } - - expect(error).toBeDefined(); - expect(error.message).toEqual(`You don't have privileges to create refund`); }); }); diff --git a/modules/ticket/back/methods/sale/specs/reserve.spec.js b/modules/ticket/back/methods/sale/specs/reserve.spec.js index c4b3b4e5d..259cb8cd5 100644 --- a/modules/ticket/back/methods/sale/specs/reserve.spec.js +++ b/modules/ticket/back/methods/sale/specs/reserve.spec.js @@ -1,14 +1,29 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('sale reserve()', () => { const ctx = { req: { - accessToken: {userId: 9}, + accessToken: {userId: 1}, headers: {origin: 'localhost:5000'}, __: () => {} } }; + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + it('should throw an error if the ticket can not be modified', async() => { const tx = await models.Sale.beginTransaction({}); diff --git a/modules/ticket/back/methods/sale/specs/updateConcept.spec.js b/modules/ticket/back/methods/sale/specs/updateConcept.spec.js index 01f610d36..1b42e7140 100644 --- a/modules/ticket/back/methods/sale/specs/updateConcept.spec.js +++ b/modules/ticket/back/methods/sale/specs/updateConcept.spec.js @@ -1,8 +1,23 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('sale updateConcept()', () => { + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + const ctx = {req: {accessToken: {userId: 9}}}; - const saleId = 1; + const saleId = 25; it('should throw if ID was undefined', async() => { const tx = await models.Sale.beginTransaction({}); diff --git a/modules/ticket/back/methods/sale/specs/updatePrice.spec.js b/modules/ticket/back/methods/sale/specs/updatePrice.spec.js index e76511421..133be8de3 100644 --- a/modules/ticket/back/methods/sale/specs/updatePrice.spec.js +++ b/modules/ticket/back/methods/sale/specs/updatePrice.spec.js @@ -1,6 +1,21 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('sale updatePrice()', () => { + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 18}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + const ctx = { req: { accessToken: {userId: 18}, @@ -79,10 +94,18 @@ describe('sale updatePrice()', () => { const price = 5.4; const originalSalesPersonMana = await models.WorkerMana.findById(18, null, options); const manaComponent = await models.Component.findOne({where: {code: 'mana'}}, options); + const teamOne = 96; + const userId = ctx.req.accessToken.userId; + + const business = await models.Business.findOne({where: {workerFk: userId}}, options); + await business.updateAttribute('departmentFk', teamOne, options); await models.Sale.updatePrice(ctx, saleId, price, options); const updatedSale = await models.Sale.findById(saleId, null, options); - createdSaleComponent = await models.SaleComponent.findOne({where: {saleFk: saleId, componentFk: manaComponent.id}}, options); + const createdSaleComponent = await models.SaleComponent.findOne({ + where: { + saleFk: saleId, componentFk: manaComponent.id + }}, options); expect(updatedSale.price).toBe(price); expect(createdSaleComponent.value).toEqual(-2.04); diff --git a/modules/ticket/back/methods/sale/specs/updateQuantity.spec.js b/modules/ticket/back/methods/sale/specs/updateQuantity.spec.js index 4c961faab..4778f6b6d 100644 --- a/modules/ticket/back/methods/sale/specs/updateQuantity.spec.js +++ b/modules/ticket/back/methods/sale/specs/updateQuantity.spec.js @@ -1,6 +1,21 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('sale updateQuantity()', () => { + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + const ctx = { req: { accessToken: {userId: 9}, @@ -9,32 +24,21 @@ describe('sale updateQuantity()', () => { } }; - it('should throw an error if the quantity is not a number', async() => { - const tx = await models.Sale.beginTransaction({}); - - let error; - try { - const options = {transaction: tx}; - - await models.Sale.updateQuantity(ctx, 1, 'wrong quantity!', options); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - error = e; - } - - expect(error).toEqual(new Error('The value should be a number')); - }); - it('should throw an error if the quantity is greater than it should be', async() => { + const ctx = { + req: { + accessToken: {userId: 1}, + headers: {origin: 'localhost:5000'}, + __: () => {} + } + }; const tx = await models.Sale.beginTransaction({}); let error; try { const options = {transaction: tx}; - await models.Sale.updateQuantity(ctx, 1, 99, options); + await models.Sale.updateQuantity(ctx, 17, 99, options); await tx.rollback(); } catch (e) { @@ -45,21 +49,60 @@ describe('sale updateQuantity()', () => { expect(error).toEqual(new Error('The new quantity should be smaller than the old one')); }); - it('should update the quantity of a given sale current line', async() => { + it('should add quantity if the quantity is greater than it should be and is role advanced', async() => { const tx = await models.Sale.beginTransaction({}); + const saleId = 17; + const buyerId = 35; + const ctx = { + req: { + accessToken: {userId: buyerId}, + headers: {origin: 'localhost:5000'}, + __: () => {} + } + }; try { const options = {transaction: tx}; - const originalLine = await models.Sale.findOne({where: {id: 1}, fields: ['quantity']}, options); + const isRoleAdvanced = await models.Ticket.isRoleAdvanced(ctx, options); - expect(originalLine.quantity).toEqual(5); + expect(isRoleAdvanced).toEqual(true); - await models.Sale.updateQuantity(ctx, 1, 4, options); + const originalLine = await models.Sale.findOne({where: {id: saleId}, fields: ['quantity']}, options); - const modifiedLine = await models.Sale.findOne({where: {id: 1}, fields: ['quantity']}, options); + expect(originalLine.quantity).toEqual(30); - expect(modifiedLine.quantity).toEqual(4); + const newQuantity = originalLine.quantity + 1; + await models.Sale.updateQuantity(ctx, saleId, newQuantity, options); + + const modifiedLine = await models.Sale.findOne({where: {id: saleId}, fields: ['quantity']}, options); + + expect(modifiedLine.quantity).toEqual(newQuantity); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should update the quantity of a given sale current line', async() => { + const tx = await models.Sale.beginTransaction({}); + const saleId = 25; + const newQuantity = 4; + + try { + const options = {transaction: tx}; + + const originalLine = await models.Sale.findOne({where: {id: saleId}, fields: ['quantity']}, options); + + expect(originalLine.quantity).toEqual(20); + + await models.Sale.updateQuantity(ctx, saleId, newQuantity, options); + + const modifiedLine = await models.Sale.findOne({where: {id: saleId}, fields: ['quantity']}, options); + + expect(modifiedLine.quantity).toEqual(newQuantity); await tx.rollback(); } catch (e) { diff --git a/modules/ticket/back/methods/sale/specs/usesMana.spec.js b/modules/ticket/back/methods/sale/specs/usesMana.spec.js new file mode 100644 index 000000000..777bdc8f0 --- /dev/null +++ b/modules/ticket/back/methods/sale/specs/usesMana.spec.js @@ -0,0 +1,48 @@ +const models = require('vn-loopback/server/server').models; + +describe('sale usesMana()', () => { + const ctx = { + req: { + accessToken: {userId: 18} + } + }; + + it('should return that the worker uses mana', async() => { + const tx = await models.Sale.beginTransaction({}); + + try { + const options = {transaction: tx}; + const teamOne = 96; + const userId = ctx.req.accessToken.userId; + + const business = await models.Business.findOne({where: {workerFk: userId}}, options); + await business.updateAttribute('departmentFk', teamOne, options); + + const usesMana = await models.Sale.usesMana(ctx, options); + + expect(usesMana).toBe(true); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return that the worker not uses mana', async() => { + const tx = await models.Sale.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const usesMana = await models.Sale.usesMana(ctx, options); + + expect(usesMana).toBe(false); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/ticket/back/methods/sale/updateConcept.js b/modules/ticket/back/methods/sale/updateConcept.js index 0730f85e2..dcd25dcbb 100644 --- a/modules/ticket/back/methods/sale/updateConcept.js +++ b/modules/ticket/back/methods/sale/updateConcept.js @@ -40,10 +40,7 @@ module.exports = Self => { try { const currentLine = await models.Sale.findById(id, null, myOptions); - const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions); - - if (!canEditSale) - throw new UserError(`Sale(s) blocked, please contact production`); + await models.Sale.canEdit(ctx, [id], myOptions); const line = await currentLine.updateAttributes({concept: newConcept}, myOptions); diff --git a/modules/ticket/back/methods/sale/updatePrice.js b/modules/ticket/back/methods/sale/updatePrice.js index bbd9d154d..505de5180 100644 --- a/modules/ticket/back/methods/sale/updatePrice.js +++ b/modules/ticket/back/methods/sale/updatePrice.js @@ -66,18 +66,12 @@ module.exports = Self => { const sale = await models.Sale.findById(id, filter, myOptions); - const isEditable = await models.Ticket.isEditable(ctx, sale.ticketFk, myOptions); - if (!isEditable) - throw new UserError(`The sales of this ticket can't be modified`); - - const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions); - - if (!canEditSale) - throw new UserError(`Sale(s) blocked, please contact production`); + await models.Sale.canEdit(ctx, [id], myOptions); const oldPrice = sale.price; const userId = ctx.req.accessToken.userId; - const usesMana = await models.WorkerMana.findOne({where: {workerFk: userId}, fields: 'amount'}, myOptions); + + const usesMana = await models.Sale.usesMana(ctx, myOptions); const componentCode = usesMana ? 'mana' : 'buyerDiscount'; const discount = await models.Component.findOne({where: {code: componentCode}}, myOptions); const componentId = discount.id; @@ -88,7 +82,6 @@ module.exports = Self => { saleFk: id }; const saleComponent = await models.SaleComponent.findOne({where}, myOptions); - if (saleComponent) { await models.SaleComponent.updateAll(where, { value: saleComponent.value + componentValue diff --git a/modules/ticket/back/methods/sale/updateQuantity.js b/modules/ticket/back/methods/sale/updateQuantity.js index 24e3736f3..d2927c65c 100644 --- a/modules/ticket/back/methods/sale/updateQuantity.js +++ b/modules/ticket/back/methods/sale/updateQuantity.js @@ -41,13 +41,7 @@ module.exports = Self => { } try { - const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions); - - if (!canEditSale) - throw new UserError(`Sale(s) blocked, please contact production`); - - if (isNaN(newQuantity)) - throw new UserError(`The value should be a number`); + await models.Sale.canEdit(ctx, [id], myOptions); const filter = { include: { @@ -70,7 +64,8 @@ module.exports = Self => { const sale = await models.Sale.findById(id, filter, myOptions); - if (newQuantity > sale.quantity) + const isRoleAdvanced = await models.Ticket.isRoleAdvanced(ctx, myOptions); + if (newQuantity > sale.quantity && !isRoleAdvanced) throw new UserError('The new quantity should be smaller than the old one'); const oldQuantity = sale.quantity; diff --git a/modules/ticket/back/methods/sale/usesMana.js b/modules/ticket/back/methods/sale/usesMana.js new file mode 100644 index 000000000..3f55293bf --- /dev/null +++ b/modules/ticket/back/methods/sale/usesMana.js @@ -0,0 +1,33 @@ +module.exports = Self => { + Self.remoteMethodCtx('usesMana', { + description: 'Returns if the worker uses mana', + accessType: 'READ', + accepts: [], + returns: { + type: 'boolean', + root: true + }, + http: { + path: `/usesMana`, + verb: 'GET' + } + }); + + Self.usesMana = async(ctx, options) => { + const models = Self.app.models; + const userId = ctx.req.accessToken.userId; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const salesDepartment = await models.Department.findOne({where: {code: 'VT'}, fields: 'id'}, myOptions); + const departments = await models.Department.getLeaves(salesDepartment.id, null, myOptions); + const workerDepartment = await models.WorkerDepartment.findById(userId, null, myOptions); + if (!workerDepartment) return false; + + const usesMana = departments.find(department => department.id == workerDepartment.departmentFk); + + return usesMana ? true : false; + }; +}; diff --git a/modules/ticket/back/methods/state/editableStates.js b/modules/ticket/back/methods/state/editableStates.js index 2c90ac43b..115876f26 100644 --- a/modules/ticket/back/methods/state/editableStates.js +++ b/modules/ticket/back/methods/state/editableStates.js @@ -24,7 +24,7 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - let statesList = await models.State.find({where: filter.where}, myOptions); + let statesList = await models.State.find(filter, myOptions); const isProduction = await models.Account.hasRole(userId, 'production', myOptions); const isSalesPerson = await models.Account.hasRole(userId, 'salesPerson', myOptions); const isAdministrative = await models.Account.hasRole(userId, 'administrative', myOptions); diff --git a/modules/ticket/back/methods/ticket-log/getChanges.js b/modules/ticket/back/methods/ticket-log/getChanges.js new file mode 100644 index 000000000..d020a0957 --- /dev/null +++ b/modules/ticket/back/methods/ticket-log/getChanges.js @@ -0,0 +1,64 @@ +module.exports = Self => { + Self.remoteMethodCtx('getChanges', { + description: 'Get changues in the sales of a ticket', + accessType: 'READ', + accepts: [{ + arg: 'id', + type: 'number', + required: true, + description: 'the ticket id', + http: {source: 'path'} + }], + returns: { + type: 'object', + root: true + }, + http: { + path: `/:id/getChanges`, + verb: 'get' + } + }); + + Self.getChanges = async(ctx, id, options) => { + const models = Self.app.models; + const myOptions = {}; + const $t = ctx.req.__; // $translate + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const ticketLogs = await models.TicketLog.find( + { + where: { + and: [ + {originFk: id}, + {action: 'update'}, + {changedModel: 'Sale'} + ] + }, + fields: [ + 'oldInstance', + 'newInstance', + 'changedModelId' + ], + }, myOptions); + + const changes = []; + for (const ticketLog of ticketLogs) { + const oldQuantity = ticketLog.oldInstance.quantity; + const newQuantity = ticketLog.newInstance.quantity; + + if (oldQuantity || newQuantity) { + const sale = await models.Sale.findById(ticketLog.changedModelId, null, myOptions); + const message = $t('Change quantity', { + concept: sale.concept, + oldQuantity: oldQuantity || 0, + newQuantity: newQuantity || 0, + }); + + changes.push(message); + } + } + return changes.join('\n'); + }; +}; diff --git a/modules/ticket/back/methods/ticket-log/specs/getChanges.spec.js b/modules/ticket/back/methods/ticket-log/specs/getChanges.spec.js new file mode 100644 index 000000000..c0f7dde0e --- /dev/null +++ b/modules/ticket/back/methods/ticket-log/specs/getChanges.spec.js @@ -0,0 +1,16 @@ +const models = require('vn-loopback/server/server').models; + +describe('ticketLog getChanges()', () => { + const ctx = {req: {}}; + + ctx.req.__ = value => { + return value; + }; + it('should return the changes in the sales of a ticket', async() => { + const ticketId = 7; + + const changues = await models.TicketLog.getChanges(ctx, ticketId); + + expect(changues).toContain(`Change quantity`); + }); +}); diff --git a/modules/ticket/back/methods/ticket-request/getItemTypeWorker.js b/modules/ticket/back/methods/ticket-request/getItemTypeWorker.js new file mode 100644 index 000000000..0655c7bba --- /dev/null +++ b/modules/ticket/back/methods/ticket-request/getItemTypeWorker.js @@ -0,0 +1,57 @@ +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; + +module.exports = Self => { + Self.remoteMethodCtx('getItemTypeWorker', { + description: 'Returns the workers that appear in itemType', + accessType: 'READ', + accepts: [{ + arg: 'filter', + type: 'Object', + description: 'Filter defining where and paginated data', + required: true + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/getItemTypeWorker`, + verb: 'GET' + } + }); + + Self.getItemTypeWorker = async(ctx, filter, options) => { + const myOptions = {}; + const conn = Self.dataSource.connector; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const query = + `SELECT DISTINCT u.id, u.nickname + FROM itemType it + JOIN worker w ON w.id = it.workerFk + JOIN account.user u ON u.id = w.id`; + + let stmt = new ParameterizedSQL(query); + + if (filter.where) { + const value = filter.where.firstName; + const myFilter = { + where: {or: [ + {'w.firstName': {like: `%${value}%`}}, + {'w.lastName': {like: `%${value}%`}}, + {'u.name': {like: `%${value}%`}}, + {'u.nickname': {like: `%${value}%`}} + ]} + }; + + stmt.merge(conn.makeSuffix(myFilter)); + } + + if (tx) await tx.commit(); + + return conn.executeStmt(stmt); + }; +}; diff --git a/modules/ticket/back/methods/ticket-request/specs/getItemTypeWorkers.spec.js b/modules/ticket/back/methods/ticket-request/specs/getItemTypeWorkers.spec.js new file mode 100644 index 000000000..ae5c508b6 --- /dev/null +++ b/modules/ticket/back/methods/ticket-request/specs/getItemTypeWorkers.spec.js @@ -0,0 +1,21 @@ +const models = require('vn-loopback/server/server').models; + +describe('ticket-request getItemTypeWorker()', () => { + const ctx = {req: {accessToken: {userId: 18}}}; + + it('should return the buyer as result', async() => { + const filter = {where: {firstName: 'buyer'}}; + + const result = await models.TicketRequest.getItemTypeWorker(ctx, filter); + + expect(result.length).toEqual(1); + }); + + it('should return the workers at itemType as result', async() => { + const filter = {}; + + const result = await models.TicketRequest.getItemTypeWorker(ctx, filter); + + expect(result.length).toBeGreaterThan(1); + }); +}); diff --git a/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js b/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js index 746e1b7fc..175bc4e4b 100644 --- a/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js +++ b/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js @@ -9,7 +9,7 @@ describe('ticket changeState()', () => { accessToken: {userId: 9}, }; const ctx = {req: activeCtx}; - const now = new Date(); + const now = Date.vnNew(); const sampleTicket = { shipped: now, landed: now, diff --git a/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js b/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js index 411bbe014..2587b6657 100644 --- a/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js @@ -17,7 +17,7 @@ describe('ticket-weekly filter()', () => { const firstRow = result[0]; expect(firstRow.ticketFk).toEqual(1); - expect(result.length).toEqual(5); + expect(result.length).toEqual(6); await tx.rollback(); } catch (e) { diff --git a/modules/ticket/back/methods/ticket/canBeInvoiced.js b/modules/ticket/back/methods/ticket/canBeInvoiced.js index a009d63cf..6b8f9e71a 100644 --- a/modules/ticket/back/methods/ticket/canBeInvoiced.js +++ b/modules/ticket/back/methods/ticket/canBeInvoiced.js @@ -43,7 +43,7 @@ module.exports = function(Self) { ticketBases => ticketBases.hasSomeNegativeBase ); - const today = new Date(); + const today = Date.vnNew(); const invalidTickets = tickets.some(ticket => { const shipped = new Date(ticket.shipped); diff --git a/modules/ticket/back/methods/ticket/canHaveStowaway.js b/modules/ticket/back/methods/ticket/canHaveStowaway.js deleted file mode 100644 index 9246d0308..000000000 --- a/modules/ticket/back/methods/ticket/canHaveStowaway.js +++ /dev/null @@ -1,48 +0,0 @@ - -module.exports = Self => { - Self.remoteMethod('canHaveStowaway', { - description: 'Returns if a ticket can have stowaway', - accessType: 'READ', - accepts: [{ - arg: 'id', - type: 'number', - required: true, - description: 'ticket id', - http: {source: 'path'} - }], - returns: { - root: true - }, - http: { - path: `/:id/canHaveStowaway`, - verb: 'GET' - } - }); - - Self.canHaveStowaway = async(id, options) => { - const models = Self.app.models; - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - const ticket = await models.Ticket.findById(id, { - include: { - relation: 'ship', - scope: { - fields: ['id'] - } - } - }, myOptions); - - const warehouse = await models.Warehouse.findById(ticket.warehouseFk, null, myOptions); - - const hasStowaway = ticket.ship() ? true : false; - const validStowaway = warehouse && warehouse.hasStowaway && !hasStowaway; - - if (!ticket.isDeleted && validStowaway) - return true; - - return false; - }; -}; diff --git a/print/methods/closure/closeAll.js b/modules/ticket/back/methods/ticket/closeAll.js similarity index 54% rename from print/methods/closure/closeAll.js rename to modules/ticket/back/methods/ticket/closeAll.js index 7af3676f2..3726d85b7 100644 --- a/print/methods/closure/closeAll.js +++ b/modules/ticket/back/methods/ticket/closeAll.js @@ -1,20 +1,41 @@ -const db = require('vn-print/core/database'); +const UserError = require('vn-loopback/util/user-error'); const closure = require('./closure'); -module.exports = async function(request, response, next) { - try { - const reqArgs = request.query; - if (!reqArgs.to) - throw new Error('The argument to is required'); +module.exports = Self => { + Self.remoteMethod('closeAll', { + description: 'Makes the closure process from all warehouses', + accessType: 'WRITE', + accepts: [], + returns: { + type: 'object', + root: true + }, + http: { + path: `/close-all`, + verb: 'POST' + } + }); - response.status(200).json({ - message: 'Success' - }); + Self.closeAll = async() => { + const toDate = Date.vnNew(); + toDate.setHours(0, 0, 0, 0); + toDate.setDate(toDate.getDate() - 1); - const tickets = await db.rawSql(` - SELECT + const todayMinDate = Date.vnNew(); + todayMinDate.setHours(0, 0, 0, 0); + + const todayMaxDate = Date.vnNew(); + todayMaxDate.setHours(23, 59, 59, 59); + + // Prevent closure for current day + if (toDate >= todayMinDate && toDate <= todayMaxDate) + throw new UserError('You cannot close tickets for today'); + + const tickets = await Self.rawSql(` + SELECT t.id, t.clientFk, + t.companyFk, c.name clientName, c.email recipient, c.salesPersonFk, @@ -31,15 +52,16 @@ 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 al.code = 'PACKED' - AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) + WHERE al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered') + AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) AND t.refFk IS NULL - GROUP BY t.id`, [reqArgs.to, reqArgs.to]); + GROUP BY t.id + `, [toDate, toDate]); - await closure.start(tickets, response.locals); + await closure(Self, tickets); - await db.rawSql(` + await Self.rawSql(` UPDATE ticket t JOIN ticketState ts ON t.id = ts.ticketFk JOIN alertLevel al ON al.id = ts.alertLevel @@ -51,8 +73,10 @@ module.exports = async function(request, response, next) { AND util.dayEnd(?) AND al.code NOT IN('DELIVERED','PACKED') AND t.routeFk - AND z.name LIKE '%MADRID%'`, [reqArgs.to, reqArgs.to]); - } catch (error) { - next(error); - } + AND z.name LIKE '%MADRID%'`, [toDate, toDate]); + + return { + message: 'Success' + }; + }; }; diff --git a/modules/ticket/back/methods/ticket/closeByAgency.js b/modules/ticket/back/methods/ticket/closeByAgency.js new file mode 100644 index 000000000..eb1aee349 --- /dev/null +++ b/modules/ticket/back/methods/ticket/closeByAgency.js @@ -0,0 +1,79 @@ +const closure = require('./closure'); + +module.exports = Self => { + Self.remoteMethodCtx('closeByAgency', { + description: 'Makes the closure process by agency mode', + accessType: 'WRITE', + accepts: [ + { + arg: 'agencyModeFk', + type: ['number'], + required: true, + description: 'The agencies mode ids', + }, + { + arg: 'warehouseFk', + type: 'number', + description: 'The ticket warehouse id', + required: true + }, + { + arg: 'to', + type: 'date', + description: 'Max closure date', + required: true + } + ], + returns: { + type: 'object', + root: true + }, + http: { + path: `/close-by-agency`, + verb: 'POST' + } + }); + + Self.closeByAgency = async ctx => { + const args = ctx.args; + + const tickets = await Self.rawSql(` + SELECT + t.id, + t.clientFk, + t.companyFk, + c.name clientName, + c.email recipient, + c.salesPersonFk, + c.isToBeMailed, + c.hasToInvoice, + co.hasDailyInvoice, + eu.email salesPersonEmail + FROM expedition e + JOIN ticket t ON t.id = e.ticketFk + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN alertLevel al ON al.id = ts.alertLevel + JOIN client c ON c.id = t.clientFk + 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 al.code = 'PACKED' + AND t.agencyModeFk IN(?) + AND t.warehouseFk = ? + AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) + AND util.dayEnd(?) + AND t.refFk IS NULL + GROUP BY e.ticketFk`, [ + args.agencyModeFk, + args.warehouseFk, + args.to, + args.to + ]); + + await closure(Self, tickets); + + return { + message: 'Success' + }; + }; +}; diff --git a/print/methods/closure/closeByRoute.js b/modules/ticket/back/methods/ticket/closeByRoute.js similarity index 53% rename from print/methods/closure/closeByRoute.js rename to modules/ticket/back/methods/ticket/closeByRoute.js index 2c0bfd1eb..58e130b8e 100644 --- a/print/methods/closure/closeByRoute.js +++ b/modules/ticket/back/methods/ticket/closeByRoute.js @@ -1,22 +1,36 @@ -const db = require('vn-print/core/database'); -const Email = require('vn-print/core/email'); const closure = require('./closure'); +const {Email} = require('vn-print'); -module.exports = async function(request, response, next) { - try { - const reqArgs = request.query; +module.exports = Self => { + Self.remoteMethodCtx('closeByRoute', { + description: 'Makes the closure process by route', + accessType: 'WRITE', + accepts: [ + { + arg: 'routeFk', + type: 'number', + required: true, + description: 'The routes ids', + }, + ], + returns: { + type: 'object', + root: true + }, + http: { + path: `/close-by-route`, + verb: 'POST' + } + }); - if (!reqArgs.routeId) - throw new Error('The argument routeId is required'); + Self.closeByRoute = async ctx => { + const args = ctx.args; - response.status(200).json({ - message: 'Success' - }); - - const tickets = await db.rawSql(` + const tickets = await Self.rawSql(` SELECT t.id, t.clientFk, + t.companyFk, c.name clientName, c.email recipient, c.salesPersonFk, @@ -35,27 +49,27 @@ module.exports = async function(request, response, next) { WHERE al.code = 'PACKED' AND t.routeFk = ? AND t.refFk IS NULL - GROUP BY e.ticketFk`, [reqArgs.routeId]); + GROUP BY e.ticketFk`, [args.routeFk]); - await closure.start(tickets, response.locals); + await closure(Self, tickets); // Send route report to the agency - const agencyMail = await db.findValue(` + const [agencyMail] = await Self.rawSql(` SELECT am.reportMail FROM route r JOIN agencyMode am ON am.id = r.agencyModeFk - WHERE r.id = ?`, [reqArgs.routeId]); + WHERE r.id = ?`, [args.routeFk]); if (agencyMail) { - const args = Object.assign({ - routeId: Number.parseInt(reqArgs.routeId), + const email = new Email('driver-route', { + id: args.routeFk, recipient: agencyMail - }, response.locals); - - const email = new Email('driver-route', args); + }); await email.send(); } - } catch (error) { - next(error); - } + + return { + message: 'Success' + }; + }; }; diff --git a/print/methods/closure/closeByTicket.js b/modules/ticket/back/methods/ticket/closeByTicket.js similarity index 52% rename from print/methods/closure/closeByTicket.js rename to modules/ticket/back/methods/ticket/closeByTicket.js index c71b3ecd0..8884897c2 100644 --- a/print/methods/closure/closeByTicket.js +++ b/modules/ticket/back/methods/ticket/closeByTicket.js @@ -1,21 +1,36 @@ -const db = require('vn-print/core/database'); const closure = require('./closure'); -module.exports = async function(request, response, next) { - try { - const reqArgs = request.query; +module.exports = Self => { + Self.remoteMethodCtx('closeByTicket', { + description: 'Makes the closure process by ticket', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The ticket id', + http: {source: 'path'} + } + ], + returns: { + type: 'object', + root: true + }, + http: { + path: `/:id/close-by-ticket`, + verb: 'POST' + } + }); - if (!reqArgs.ticketId) - throw new Error('The argument ticketId is required'); + Self.closeByTicket = async ctx => { + const args = ctx.args; - response.status(200).json({ - message: 'Success' - }); - - const tickets = await db.rawSql(` + const tickets = await Self.rawSql(` SELECT t.id, t.clientFk, + t.companyFk, c.name clientName, c.email recipient, c.salesPersonFk, @@ -34,10 +49,12 @@ module.exports = async function(request, response, next) { WHERE al.code = 'PACKED' AND t.id = ? AND t.refFk IS NULL - GROUP BY e.ticketFk`, [reqArgs.ticketId]); + GROUP BY e.ticketFk`, [args.id]); - await closure.start(tickets, response.locals); - } catch (error) { - next(error); - } + await closure(Self, tickets); + + return { + message: 'Success' + }; + }; }; diff --git a/modules/ticket/back/methods/ticket/closure.js b/modules/ticket/back/methods/ticket/closure.js new file mode 100644 index 000000000..d5fa58e7b --- /dev/null +++ b/modules/ticket/back/methods/ticket/closure.js @@ -0,0 +1,180 @@ +const Report = require('vn-print/core/report'); +const Email = require('vn-print/core/email'); +const smtp = require('vn-print/core/smtp'); +const config = require('vn-print/core/config'); +const storage = require('vn-print/core/storage'); + +module.exports = async function(Self, tickets, reqArgs = {}) { + if (tickets.length == 0) return; + + const failedtickets = []; + for (const ticket of tickets) { + try { + await Self.rawSql(`CALL vn.ticket_closeByTicket(?)`, [ticket.id]); + + const [invoiceOut] = await Self.rawSql(` + SELECT io.id, io.ref, io.serial, cny.code companyCode, io.issued + FROM ticket t + JOIN invoiceOut io ON io.ref = t.refFk + JOIN company cny ON cny.id = io.companyFk + WHERE t.id = ? + `, [ticket.id]); + + const mailOptions = { + overrideAttachments: true, + attachments: [] + }; + + const isToBeMailed = ticket.recipient && ticket.salesPersonFk && ticket.isToBeMailed; + + if (invoiceOut) { + const args = { + reference: invoiceOut.ref, + recipientId: ticket.clientFk, + recipient: ticket.recipient, + replyTo: ticket.salesPersonEmail + }; + + const invoiceReport = new Report('invoice', args); + const stream = await invoiceReport.toPdfStream(); + + const issued = invoiceOut.issued; + const year = issued.getFullYear().toString(); + const month = (issued.getMonth() + 1).toString(); + const day = issued.getDate().toString(); + + const fileName = `${year}${invoiceOut.ref}.pdf`; + + // Store invoice + storage.write(stream, { + type: 'invoice', + path: `${year}/${month}/${day}`, + fileName: fileName + }); + + await Self.rawSql('UPDATE invoiceOut SET hasPdf = true WHERE id = ?', [invoiceOut.id]); + + if (isToBeMailed) { + const invoiceAttachment = { + filename: fileName, + content: stream + }; + + if (invoiceOut.serial == 'E' && invoiceOut.companyCode == 'VNL') { + const exportation = new Report('exportation', args); + const stream = await exportation.toPdfStream(); + const fileName = `CITES-${invoiceOut.ref}.pdf`; + + mailOptions.attachments.push({ + filename: fileName, + content: stream + }); + } + + mailOptions.attachments.push(invoiceAttachment); + + const email = new Email('invoice', args); + await email.send(mailOptions); + } + } else if (isToBeMailed) { + const args = { + id: ticket.id, + recipientId: ticket.clientFk, + recipient: ticket.recipient, + replyTo: ticket.salesPersonEmail + }; + + const email = new Email('delivery-note-link', args); + await email.send(); + } + + // Incoterms authorization + const [{firstOrder}] = await Self.rawSql(` + SELECT COUNT(*) as firstOrder + FROM ticket t + JOIN client c ON c.id = t.clientFk + WHERE t.clientFk = ? + AND NOT t.isDeleted + AND c.isVies + `, [ticket.clientFk]); + + if (firstOrder == 1) { + const args = { + id: ticket.clientFk, + companyId: ticket.companyFk, + recipientId: ticket.clientFk, + recipient: ticket.recipient, + replyTo: ticket.salesPersonEmail + }; + + const email = new Email('incoterms-authorization', args); + await email.send(); + + const [sample] = await Self.rawSql( + `SELECT id + FROM sample + WHERE code = 'incoterms-authorization' + `); + + await Self.rawSql(` + INSERT INTO clientSample (clientFk, typeFk, companyFk) VALUES(?, ?, ?) + `, [ticket.clientFk, sample.id, ticket.companyFk]); + } + } catch (error) { + // Domain not found + if (error.responseCode == 450) + return invalidEmail(ticket); + + // Save tickets on a list of failed ids + failedtickets.push({ + id: ticket.id, + stacktrace: error + }); + } + } + + // Send email with failed tickets + if (failedtickets.length > 0) { + let body = 'This following tickets have failed:

'; + + for (const ticket of failedtickets) { + body += `Ticket: ${ticket.id} +
${ticket.stacktrace}

`; + } + + smtp.send({ + to: config.app.reportEmail, + subject: '[API] Nightly ticket closure report', + html: body + }); + } + + async function invalidEmail(ticket) { + await Self.rawSql(`UPDATE client SET email = NULL WHERE id = ?`, [ + ticket.clientFk + ]); + + const oldInstance = `{"email": "${ticket.recipient}"}`; + const newInstance = `{"email": ""}`; + await Self.rawSql(` + INSERT INTO clientLog (originFk, userFk, action, changedModel, oldInstance, newInstance) + VALUES (?, NULL, 'UPDATE', 'Client', ?, ?)`, [ + ticket.clientFk, + oldInstance, + newInstance + ]); + + const body = `No se ha podido enviar el albarán ${ticket.id} + al cliente ${ticket.clientFk} - ${ticket.clientName} + porque la dirección de email "${ticket.recipient}" no es correcta + o no está disponible.

+ Para evitar que se repita este error, se ha eliminado la dirección de email de la ficha del cliente. + Actualiza la dirección de email con una correcta.`; + + smtp.send({ + to: ticket.salesPersonEmail, + subject: 'No se ha podido enviar el albarán', + html: body + }); + } +}; diff --git a/modules/ticket/back/methods/ticket/collectionLabel.js b/modules/ticket/back/methods/ticket/collectionLabel.js new file mode 100644 index 000000000..74b5b2c0a --- /dev/null +++ b/modules/ticket/back/methods/ticket/collectionLabel.js @@ -0,0 +1,41 @@ +module.exports = Self => { + Self.remoteMethodCtx('collectionLabel', { + description: 'Returns the collection label', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The ticket id', + http: {source: 'path'} + }, { + arg: 'labelCount', + type: 'number', + required: false, + description: 'The number of labels' + } + ], + 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/collection-label', + verb: 'GET' + } + }); + + Self.collectionLabel = (ctx, id) => Self.printReport(ctx, id, 'collection-label'); +}; diff --git a/modules/ticket/back/methods/ticket/componentUpdate.js b/modules/ticket/back/methods/ticket/componentUpdate.js index 6b385992c..c23d1669e 100644 --- a/modules/ticket/back/methods/ticket/componentUpdate.js +++ b/modules/ticket/back/methods/ticket/componentUpdate.js @@ -83,6 +83,11 @@ module.exports = Self => { type: 'boolean', description: 'Is whithout negatives', required: true + }, + { + arg: 'withWarningAccept', + type: 'boolean', + description: 'Has pressed in confirm message', }], returns: { type: ['object'], @@ -126,8 +131,7 @@ module.exports = Self => { myOptions); if (!zoneShipped || zoneShipped.zoneFk != args.zoneFk) { - const error = `You don't have privileges to change the zone or - for these parameters there are more than one shipping options, talk to agencies`; + const error = `You don't have privileges to change the zone`; throw new UserError(error); } @@ -138,9 +142,11 @@ module.exports = Self => { const params = [args.id, args.shipped, args.warehouseFk]; const [salesMovable] = await Self.rawSql(query, params, myOptions); + const sales = await models.Sale.find({where: {ticketFk: args.id}}, myOptions); const salesNewTicket = salesMovable.filter(sale => (sale.movable ? sale.movable : 0) >= sale.quantity); - if (salesNewTicket.length) { + const salesNewTicketLength = salesNewTicket.length; + if (salesNewTicketLength && sales.length != salesNewTicketLength) { const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions); args.id = newTicket.id; } @@ -159,18 +165,29 @@ module.exports = Self => { 'shipped', 'landed', 'isDeleted', - 'routeFk' + 'routeFk', + 'nickname' ], include: [ { relation: 'client', scope: { fields: 'salesPersonFk' - } - }] + }, + include: [ + { + relation: 'address', + scope: { + fields: 'nickname' + } + } + ] + }, + ] }, myOptions); args.routeFk = null; + if (args.isWithoutNegatives === false) delete args.isWithoutNegatives; const updatedTicket = Object.assign({}, args); delete updatedTicket.ctx; delete updatedTicket.option; @@ -218,37 +235,41 @@ module.exports = Self => { } const changes = loggable.getChanges(originalTicket, updatedTicket); - const oldProperties = await loggable.translateValues(Self, changes.old); - const newProperties = await loggable.translateValues(Self, changes.new); + const hasChanges = Object.keys(changes.old).length > 0 || Object.keys(changes.new).length > 0; - await models.TicketLog.create({ - originFk: args.id, - userFk: userId, - action: 'update', - changedModel: 'Ticket', - changedModelId: args.id, - oldInstance: oldProperties, - newInstance: newProperties - }, myOptions); + if (hasChanges) { + const oldProperties = await loggable.translateValues(Self, changes.old); + const newProperties = await loggable.translateValues(Self, changes.new); - const salesPersonId = originalTicket.client().salesPersonFk; - if (salesPersonId) { - const origin = ctx.req.headers.origin; + await models.TicketLog.create({ + originFk: args.id, + userFk: userId, + action: 'update', + changedModel: 'Ticket', + changedModelId: args.id, + oldInstance: oldProperties, + newInstance: newProperties + }, myOptions); - let changesMade = ''; - for (let change in newProperties) { - let value = newProperties[change]; - let oldValue = oldProperties[change]; + const salesPersonId = originalTicket.client().salesPersonFk; + if (salesPersonId) { + const origin = ctx.req.headers.origin; - changesMade += `\r\n~${$t(change)}: ${oldValue}~ ➔ *${$t(change)}: ${value}*`; + let changesMade = ''; + for (let change in newProperties) { + let value = newProperties[change]; + let oldValue = oldProperties[change]; + + changesMade += `\r\n~${$t(change)}: ${oldValue}~ ➔ *${$t(change)}: ${value}*`; + } + + const message = $t('Changed this data from the ticket', { + ticketId: args.id, + ticketUrl: `${origin}/#!/ticket/${args.id}/sale`, + changes: changesMade + }); + await models.Chat.sendCheckingPresence(ctx, salesPersonId, message); } - - const message = $t('Changed this data from the ticket', { - ticketId: args.id, - ticketUrl: `${origin}/#!/ticket/${args.id}/sale`, - changes: changesMade - }); - await models.Chat.sendCheckingPresence(ctx, salesPersonId, message); } res.id = args.id; diff --git a/modules/ticket/back/methods/ticket/deleteStowaway.js b/modules/ticket/back/methods/ticket/deleteStowaway.js deleted file mode 100644 index c3e5e0db1..000000000 --- a/modules/ticket/back/methods/ticket/deleteStowaway.js +++ /dev/null @@ -1,105 +0,0 @@ - -module.exports = Self => { - Self.remoteMethodCtx('deleteStowaway', { - description: 'Deletes an stowaway', - accessType: 'WRITE', - accepts: [{ - arg: 'id', - type: 'number', - required: true, - description: 'The ticket id', - http: {source: 'path'} - }], - returns: { - root: true - }, - http: { - path: `/:id/deleteStowaway`, - verb: 'POST' - } - }); - - Self.deleteStowaway = async(ctx, id, options) => { - const models = Self.app.models; - const $t = ctx.req.__; // $translate - const myOptions = {}; - let tx; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } - - try { - const ticket = await Self.findById(id, { - include: [{ - relation: 'ship' - }, { - relation: 'stowaway' - }, { - relation: 'client', - scope: { - include: { - relation: 'salesPersonUser', - scope: { - fields: ['id', 'name'] - } - } - } - }] - }, myOptions); - - let stowawayFk; - let shipFk; - if (ticket.stowaway()) { - shipFk = ticket.stowaway().shipFk; - stowawayFk = ticket.stowaway().id; - } else if (ticket.ship()) { - shipFk = ticket.ship().shipFk; - stowawayFk = ticket.ship().id; - } - - const stowaway = await models.Stowaway.findOne({ - where: { - id: stowawayFk, - shipFk: shipFk - } - }, myOptions); - const result = await stowaway.destroy(myOptions); - - const state = await models.State.findOne({ - where: { - code: 'BOARDING' - } - }, myOptions); - const ticketTracking = await models.TicketTracking.findOne({ - where: { - ticketFk: shipFk, - stateFk: state.id - } - }, myOptions); - - await ticketTracking.destroy(myOptions); - - const salesPerson = ticket.client().salesPersonUser(); - if (salesPerson) { - const origin = ctx.req.headers.origin; - const message = $t('This ticket is not an stowaway anymore', { - ticketId: stowawayFk, - ticketUrl: `${origin}/#!/ticket/${stowawayFk}/sale` - }); - await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message); - } - - if (tx) await tx.commit(); - - return result; - } catch (e) { - if (tx) await tx.rollback(); - throw e; - } - }; -}; diff --git a/modules/ticket/back/methods/ticket/deliveryNoteCsv.js b/modules/ticket/back/methods/ticket/deliveryNoteCsv.js new file mode 100644 index 000000000..55ec4089d --- /dev/null +++ b/modules/ticket/back/methods/ticket/deliveryNoteCsv.js @@ -0,0 +1,84 @@ +const {toCSV} = require('vn-loopback/util/csv'); + +module.exports = Self => { + Self.remoteMethod('deliveryNoteCsv', { + description: 'Returns the delivery note csv', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The ticket id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The client id', + required: false + } + ], + 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/delivery-note-csv', + verb: 'GET' + } + }); + + Self.deliveryNoteCsv = async id => { + const sales = await Self.rawSql(` + SELECT io.ref Invoice, + io.issued InvoiceDate, + s.ticketFk Ticket, + s.itemFk Item, + s.concept Description, + i.size, + i.subName Producer, + s.quantity Quantity, + s.price Price, + s.discount Discount, + s.created Created, + tc.code Taxcode, + tc.description TaxDescription, + i.tag5, + i.value5, + i.tag6, + i.value6, + i.tag7, + i.value7, + i.tag8, + i.value8, + i.tag9, + i.value9, + i.tag10, + i.value10 + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.supplier s2 ON s2.id = t.companyFk + JOIN vn.itemTaxCountry itc ON itc.itemFk = i.id + AND itc.countryFk = s2.countryFk + JOIN vn.taxClass tc ON tc.id = itc.taxClassFk + LEFT JOIN vn.invoiceOut io ON io.id = t.refFk + WHERE s.ticketFk = ? + ORDER BY s.ticketFk, s.created`, [id]); + const content = toCSV(sales); + + return [content, 'text/csv', `inline; filename="doc-${id}.pdf"`]; + }; +}; diff --git a/modules/ticket/back/methods/ticket/deliveryNoteCsvEmail.js b/modules/ticket/back/methods/ticket/deliveryNoteCsvEmail.js new file mode 100644 index 000000000..79702cbaf --- /dev/null +++ b/modules/ticket/back/methods/ticket/deliveryNoteCsvEmail.js @@ -0,0 +1,117 @@ +const {Email} = require('vn-print'); +const {toCSV} = require('vn-loopback/util/csv'); + +module.exports = Self => { + Self.remoteMethodCtx('deliveryNoteCsvEmail', { + description: 'Returns the delivery note csv', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The ticket id', + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The client id', + required: false + } + ], + 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/delivery-note-csv-email', + verb: 'POST' + } + }); + + Self.deliveryNoteCsvEmail = async(ctx, id) => { + const args = Object.assign({}, ctx.args); + + const params = { + recipient: args.recipient, + lang: ctx.req.getLocale() + }; + + delete args.ctx; + for (const param in args) + params[param] = args[param]; + + const sales = await Self.rawSql(` + SELECT io.ref Invoice, + io.issued InvoiceDate, + s.ticketFk Ticket, + s.itemFk Item, + s.concept Description, + i.size, + i.subName Producer, + s.quantity Quantity, + s.price Price, + s.discount Discount, + s.created Created, + tc.code Taxcode, + tc.description TaxDescription, + i.tag5, + i.value5, + i.tag6, + i.value6, + i.tag7, + i.value7, + i.tag8, + i.value8, + i.tag9, + i.value9, + i.tag10, + i.value10 + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.supplier s2 ON s2.id = t.companyFk + JOIN vn.itemTaxCountry itc ON itc.itemFk = i.id + AND itc.countryFk = s2.countryFk + JOIN vn.taxClass tc ON tc.id = itc.taxClassFk + LEFT JOIN vn.invoiceOut io ON io.id = t.refFk + WHERE s.ticketFk = ? + ORDER BY s.ticketFk, s.created`, [id]); + + const content = toCSV(sales); + const fileName = `ticket_${id}.csv`; + const email = new Email('delivery-note', params); + + return email.send({ + overrideAttachments: true, + attachments: [{ + filename: fileName, + content: content + }] + }); + }; +}; diff --git a/modules/ticket/back/methods/ticket/deliveryNoteEmail.js b/modules/ticket/back/methods/ticket/deliveryNoteEmail.js new file mode 100644 index 000000000..4b275b45e --- /dev/null +++ b/modules/ticket/back/methods/ticket/deliveryNoteEmail.js @@ -0,0 +1,49 @@ +module.exports = Self => { + Self.remoteMethodCtx('deliveryNoteEmail', { + description: 'Sends the delivery note email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The ticket id', + http: {source: 'path'} + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id to send to the recipient preferred language', + required: false + }, + { + arg: 'type', + type: 'string', + description: 'The delivery note type [ deliveryNote, proforma, withoutPrices ]', + required: false + }, + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/:id/delivery-note-email', + verb: 'POST' + } + }); + + Self.deliveryNoteEmail = ctx => Self.sendTemplate(ctx, 'delivery-note'); +}; diff --git a/modules/ticket/back/methods/ticket/deliveryNotePdf.js b/modules/ticket/back/methods/ticket/deliveryNotePdf.js new file mode 100644 index 000000000..628e16bcd --- /dev/null +++ b/modules/ticket/back/methods/ticket/deliveryNotePdf.js @@ -0,0 +1,48 @@ +module.exports = Self => { + Self.remoteMethodCtx('deliveryNotePdf', { + description: 'Returns the delivery note pdf', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The ticket id', + http: {source: 'path'} + }, + { + arg: 'recipientId', + type: 'number', + description: 'The client id', + required: false + }, + { + arg: 'type', + type: 'string', + description: 'The delivery note type [ deliveryNote, proforma, withoutPrices ]', + required: false + }, + ], + 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/delivery-note-pdf', + verb: 'GET' + } + }); + + Self.deliveryNotePdf = (ctx, id) => Self.printReport(ctx, id, 'delivery-note'); +}; diff --git a/modules/ticket/back/methods/ticket/expeditionPalletLabel.js b/modules/ticket/back/methods/ticket/expeditionPalletLabel.js new file mode 100644 index 000000000..9830364d6 --- /dev/null +++ b/modules/ticket/back/methods/ticket/expeditionPalletLabel.js @@ -0,0 +1,41 @@ +module.exports = Self => { + Self.remoteMethodCtx('expeditionPalletLabel', { + description: 'Returns the expedition pallet label', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'The pallet id', + http: {source: 'path'} + }, { + arg: 'userFk', + type: 'number', + required: true, + description: 'The user id' + } + ], + 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/expedition-pallet-label', + verb: 'GET' + } + }); + + Self.expeditionPalletLabel = (ctx, id) => Self.printReport(ctx, id, 'expedition-pallet-label'); +}; diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 467c88246..262b3fd74 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -88,6 +88,11 @@ module.exports = Self => { type: 'boolean', description: `Whether to show only tickets with route` }, + { + arg: 'hasInvoice', + type: 'boolean', + description: `Whether to show only tickets with invoice` + }, { arg: 'pending', type: 'boolean', @@ -132,7 +137,7 @@ module.exports = Self => { Self.filter = async(ctx, filter, options) => { const userId = ctx.req.accessToken.userId; const conn = Self.dataSource.connector; - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); const models = Self.app.models; const args = ctx.args; @@ -199,23 +204,12 @@ module.exports = Self => { if (value == true) return {'t.routeFk': {neq: null}}; return {'t.routeFk': null}; + case 'hasInvoice': + if (value == true) + return {'t.refFk': {neq: null}}; + return {'t.refFk': null}; case 'pending': - if (value) { - return {and: [ - {'st.alertLevel': 0}, - {'st.code': {nin: [ - 'OK', - 'BOARDING', - 'PRINTED', - 'PRINTED_AUTO', - 'PICKER_DESIGNED' - ]}} - ]}; - } else { - return {and: [ - {'st.alertLevel': {gt: 0}} - ]}; - } + return {'st.isNotValidated': value}; case 'id': case 'clientFk': case 'agencyModeFk': @@ -301,10 +295,10 @@ module.exports = Self => { stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems'); stmt = new ParameterizedSQL(` - CREATE TEMPORARY TABLE tmp.sale_getProblems + CREATE TEMPORARY TABLE tmp.sale_getProblems (INDEX (ticketFk)) ENGINE = MEMORY - SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped + SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped FROM tmp.filter f LEFT JOIN alertLevel al ON al.id = f.alertLevel WHERE (al.code = 'FREE' OR f.alertLevel IS NULL) @@ -356,7 +350,7 @@ module.exports = Self => { const ticketsIndex = stmts.push(stmt) - 1; stmts.push( - `DROP TEMPORARY TABLE + `DROP TEMPORARY TABLE tmp.filter, tmp.ticket_problems`); diff --git a/modules/ticket/back/methods/ticket/getPossibleStowaways.js b/modules/ticket/back/methods/ticket/getPossibleStowaways.js deleted file mode 100644 index c97e3de89..000000000 --- a/modules/ticket/back/methods/ticket/getPossibleStowaways.js +++ /dev/null @@ -1,74 +0,0 @@ -const UserError = require('vn-loopback/util/user-error'); - -module.exports = Self => { - Self.remoteMethod('getPossibleStowaways', { - description: 'Returns a list of allowed tickets for a stowaway ticket', - accessType: 'READ', - accepts: [{ - arg: 'id', - type: 'number', - required: true, - description: 'ticket id', - http: {source: 'path'} - }], - returns: { - root: true - }, - http: { - path: `/:id/getPossibleStowaways`, - verb: 'GET' - } - }); - - Self.getPossibleStowaways = async(ticketFk, options) => { - const models = Self.app.models; - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - const canHaveStowaway = await models.Ticket.canHaveStowaway(ticketFk, myOptions); - - if (!canHaveStowaway) - throw new UserError(`Can't create stowaway for this ticket`); - - const ship = await models.Ticket.findById(ticketFk, null, myOptions); - - if (!ship || !ship.shipped) - return []; - - const lowestDate = new Date(ship.shipped.getTime()); - lowestDate.setHours(0, 0, -1, 0); - - const highestDate = new Date(ship.shipped.getTime()); - highestDate.setHours(23, 59, 59); - - const possibleStowaways = await models.Ticket.find({ - where: { - id: {neq: ticketFk}, - clientFk: ship.clientFk, - addressFk: ship.addressFk, - agencyModeFk: ship.agencyModeFk, - warehouseFk: {neq: ship.warehouseFk}, - shipped: { - between: [lowestDate.toJSON(), highestDate.toJSON()] - } - }, - include: [ - {relation: 'agencyMode'}, - {relation: 'warehouse'}, - {relation: 'ticketState', - scope: { - fields: ['stateFk'], - include: { - relation: 'state', - fields: ['id', 'name'], - } - }, - }, - ] - }, myOptions); - - return possibleStowaways; - }; -}; diff --git a/modules/ticket/back/methods/ticket/getSales.js b/modules/ticket/back/methods/ticket/getSales.js index 3e45b3fb5..321e8e24e 100644 --- a/modules/ticket/back/methods/ticket/getSales.js +++ b/modules/ticket/back/methods/ticket/getSales.js @@ -87,6 +87,14 @@ module.exports = Self => { for (let problem of problems) saleProblems.set(problem.saleFk, problem); + const ticketLog = await Self.rawSql(`SELECT DISTINCT changedModelId + FROM ticketLog tl + WHERE changedModel = 'Sale' + AND originFk = ?`, [id], myOptions); + const salesWithLogs = ticketLog.map(sale => { + return sale.changedModelId; + }); + for (let sale of sales) { const problems = saleProblems.get(sale.id); const itemStock = itemAvailable.get(sale.itemFk); @@ -98,6 +106,8 @@ module.exports = Self => { sale.hasTicketRequest = problems.hasTicketRequest; sale.hasComponentLack = problems.hasComponentLack; } + if (salesWithLogs.includes(sale.id)) + sale.$hasLogs = true; } return sales; diff --git a/modules/ticket/back/methods/ticket/getTicketsAdvance.js b/modules/ticket/back/methods/ticket/getTicketsAdvance.js new file mode 100644 index 000000000..ec9314db2 --- /dev/null +++ b/modules/ticket/back/methods/ticket/getTicketsAdvance.js @@ -0,0 +1,136 @@ +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('getTicketsAdvance', { + description: 'Find all tickets that can be moved to the present', + accessType: 'READ', + accepts: [ + { + arg: 'warehouseFk', + type: 'number', + description: 'Warehouse identifier', + required: true + }, + { + arg: 'dateFuture', + type: 'date', + description: 'Date of the tickets that you want to advance', + required: true + }, + { + arg: 'dateToAdvance', + type: 'date', + description: 'Date to when you want to advance', + required: true + }, + { + arg: 'ipt', + type: 'string', + description: 'Origin Item Packaging Type', + required: false + }, + { + arg: 'futureIpt', + type: 'string', + description: 'Destination Item Packaging Type', + required: false + }, + { + arg: 'id', + type: 'number', + description: 'Origin id', + required: false + }, + { + arg: 'futureId', + type: 'number', + description: 'Destination id', + required: false + }, + { + arg: 'isFullMovable', + type: 'boolean', + description: 'True when lines and stock of origin are equal', + required: false + }, + { + arg: 'filter', + type: 'object', + description: `Filter defining where, order, offset, and limit - must be a JSON-encoded string` + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/getTicketsAdvance`, + verb: 'GET' + } + }); + + Self.getTicketsAdvance = async(ctx, options) => { + const args = ctx.args; + const conn = Self.dataSource.connector; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const where = buildFilter(ctx.args, (param, value) => { + switch (param) { + case 'id': + return {'f.id': value}; + case 'futureId': + return {'f.futureId': value}; + case 'ipt': + return {or: + [ + {'f.ipt': {like: `%${value}%`}}, + {'f.ipt': null} + ] + }; + case 'futureIpt': + return {or: + [ + {'f.futureIpt': {like: `%${value}%`}}, + {'f.futureIpt': null} + ] + }; + case 'isFullMovable': + return {'f.isFullMovable': value}; + } + }); + + let filter = mergeFilters(ctx.args.filter, {where}); + const stmts = []; + let stmt; + + stmt = new ParameterizedSQL( + `CALL vn.ticket_canAdvance(?,?,?)`, + [args.dateFuture, args.dateToAdvance, args.warehouseFk]); + + stmts.push(stmt); + + stmt = new ParameterizedSQL(` + SELECT f.* + FROM tmp.filter f`); + + stmt.merge(conn.makeWhere(filter.where)); + + stmt.merge(conn.makeOrderBy(filter.order)); + stmt.merge(conn.makeLimit(filter)); + const ticketsIndex = stmts.push(stmt) - 1; + + stmts.push( + `DROP TEMPORARY TABLE + tmp.filter`); + + const sql = ParameterizedSQL.join(stmts, ';'); + const result = await conn.executeStmt(sql, myOptions); + + return result[ticketsIndex]; + }; +}; diff --git a/modules/ticket/back/methods/ticket/getTicketsFuture.js b/modules/ticket/back/methods/ticket/getTicketsFuture.js new file mode 100644 index 000000000..901e546f7 --- /dev/null +++ b/modules/ticket/back/methods/ticket/getTicketsFuture.js @@ -0,0 +1,220 @@ +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; +const buildFilter = require('vn-loopback/util/filter').buildFilter; +const mergeFilters = require('vn-loopback/util/filter').mergeFilters; +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('getTicketsFuture', { + description: 'Find all tickets that can be moved to the future', + accessType: 'READ', + accepts: [ + { + arg: 'originDated', + type: 'date', + description: 'The date in question', + required: true + }, + { + arg: 'futureDated', + type: 'date', + description: 'The date to probe', + required: true + }, + { + arg: 'warehouseFk', + type: 'number', + description: 'Warehouse identifier', + required: true + }, + { + arg: 'litersMax', + type: 'number', + description: 'Maximum volume of tickets to catapult', + required: false + }, + { + arg: 'linesMax', + type: 'number', + description: 'Maximum number of lines of tickets to catapult', + required: false + }, + { + arg: 'ipt', + type: 'string', + description: 'Origin Item Packaging Type', + required: false + }, + { + arg: 'futureIpt', + type: 'string', + description: 'Destination Item Packaging Type', + required: false + }, + { + arg: 'id', + type: 'number', + description: 'Origin id', + required: false + }, + { + arg: 'futureId', + type: 'number', + description: 'Destination id', + required: false + }, + { + arg: 'state', + type: 'string', + description: 'Origin state', + required: false + }, + { + arg: 'futureState', + type: 'string', + description: 'Destination state', + required: false + }, + { + arg: 'problems', + type: 'boolean', + description: `Whether to show only tickets with problems`, + required: false + }, + { + arg: 'filter', + type: 'object', + description: `Filter defining where, order, offset, and limit - must be a JSON-encoded string` + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/getTicketsFuture`, + verb: 'GET' + } + }); + + Self.getTicketsFuture = async(ctx, options) => { + const args = ctx.args; + const conn = Self.dataSource.connector; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const where = buildFilter(ctx.args, (param, value) => { + switch (param) { + case 'id': + return {'f.id': value}; + case 'linesMax': + return {'f.lines': {lte: value}}; + case 'litersMax': + return {'f.liters': {lte: value}}; + case 'futureId': + return {'f.futureId': value}; + case 'ipt': + return {or: + [ + {'f.ipt': {like: `%${value}%`}}, + {'f.ipt': null} + ] + }; + case 'futureIpt': + return {or: + [ + {'f.futureIpt': {like: `%${value}%`}}, + {'f.futureIpt': null} + ] + }; + case 'state': + return {'f.stateCode': {like: `%${value}%`}}; + case 'futureState': + return {'f.futureStateCode': {like: `%${value}%`}}; + } + }); + + let filter = mergeFilters(ctx.args.filter, {where}); + const stmts = []; + let stmt; + + stmt = new ParameterizedSQL( + `CALL vn.ticket_canbePostponed(?,?,?)`, + [args.originDated, args.futureDated, args.warehouseFk]); + + stmts.push(stmt); + + stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems'); + + stmt = new ParameterizedSQL(` + CREATE TEMPORARY TABLE tmp.sale_getProblems + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped, f.lines, f.liters + FROM tmp.filter f + LEFT JOIN alertLevel al ON al.id = f.alertLevel + WHERE (al.code = 'FREE' OR f.alertLevel IS NULL)`); + stmts.push(stmt); + + stmts.push('CALL ticket_getProblems(FALSE)'); + + stmt = new ParameterizedSQL(` + SELECT f.*, tp.* + FROM tmp.filter f + LEFT JOIN tmp.ticket_problems tp ON tp.ticketFk = f.id`); + + if (args.problems != undefined && (!args.originDated && !args.futureDated)) + throw new UserError('Choose a date range or days forward'); + + let condition; + let hasProblem; + let range; + let hasWhere; + switch (args.problems) { + case true: + condition = `or`; + hasProblem = true; + range = {neq: null}; + hasWhere = true; + break; + + case false: + condition = `and`; + hasProblem = null; + range = null; + hasWhere = true; + break; + } + + const problems = { + [condition]: [ + {'tp.isFreezed': hasProblem}, + {'tp.risk': hasProblem}, + {'tp.hasTicketRequest': hasProblem}, + {'tp.itemShortage': range}, + {'tp.hasComponentLack': hasProblem}, + {'tp.isTooLittle': hasProblem} + ] + }; + + if (hasWhere) + filter = mergeFilters(filter, {where: problems}); + + stmt.merge(conn.makeWhere(filter.where)); + stmt.merge(conn.makeOrderBy(filter.order)); + stmt.merge(conn.makeLimit(filter)); + + const ticketsIndex = stmts.push(stmt) - 1; + + stmts.push( + `DROP TEMPORARY TABLE + tmp.filter, + tmp.ticket_problems`); + + const sql = ParameterizedSQL.join(stmts, ';'); + const result = await conn.executeStmt(sql, myOptions); + + return result[ticketsIndex]; + }; +}; diff --git a/modules/ticket/back/methods/ticket/isEditable.js b/modules/ticket/back/methods/ticket/isEditable.js index 5b9a397a1..d8fbb86ce 100644 --- a/modules/ticket/back/methods/ticket/isEditable.js +++ b/modules/ticket/back/methods/ticket/isEditable.js @@ -20,24 +20,20 @@ module.exports = Self => { }); Self.isEditable = async(ctx, id, options) => { - const userId = ctx.req.accessToken.userId; + const models = Self.app.models; const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); - let state = await Self.app.models.TicketState.findOne({ + const state = await models.TicketState.findOne({ where: {ticketFk: id} }, myOptions); - const isSalesAssistant = await Self.app.models.Account.hasRole(userId, 'salesAssistant', myOptions); - const isDeliveryBoss = await Self.app.models.Account.hasRole(userId, 'deliveryBoss', myOptions); - const isBuyer = await Self.app.models.Account.hasRole(userId, 'buyer', myOptions); + const isRoleAdvanced = await models.Ticket.isRoleAdvanced(ctx, myOptions); - const isValidRole = isSalesAssistant || isDeliveryBoss || isBuyer; - - let alertLevel = state ? state.alertLevel : null; - let ticket = await Self.app.models.Ticket.findById(id, { + const alertLevel = state ? state.alertLevel : null; + const ticket = await models.Ticket.findById(id, { fields: ['clientFk'], include: [{ relation: 'client', @@ -48,15 +44,17 @@ module.exports = Self => { } }] }, myOptions); - const isLocked = await Self.app.models.Ticket.isLocked(id, myOptions); + + const isLocked = await models.Ticket.isLocked(id, myOptions); + const isWeekly = await models.TicketWeekly.findOne({where: {ticketFk: id}}, myOptions); const alertLevelGreaterThanZero = (alertLevel && alertLevel > 0); const isNormalClient = ticket && ticket.client().type().code == 'normal'; - const validAlertAndRoleNormalClient = (alertLevelGreaterThanZero && isNormalClient && !isValidRole); + const isEditable = !(alertLevelGreaterThanZero && isNormalClient); - if (!ticket || validAlertAndRoleNormalClient || isLocked) - return false; + if (ticket && (isEditable || isRoleAdvanced) && !isLocked && !isWeekly) + return true; - return true; + return false; }; }; diff --git a/modules/ticket/back/methods/ticket/isRoleAdvanced.js b/modules/ticket/back/methods/ticket/isRoleAdvanced.js new file mode 100644 index 000000000..7c5c8ed86 --- /dev/null +++ b/modules/ticket/back/methods/ticket/isRoleAdvanced.js @@ -0,0 +1,32 @@ +module.exports = Self => { + Self.remoteMethodCtx('isRoleAdvanced', { + description: 'Check if a ticket is editable', + accessType: 'READ', + returns: { + type: 'boolean', + root: true + }, + http: { + path: `/isRoleAdvanced`, + verb: 'GET' + } + }); + + Self.isRoleAdvanced = async(ctx, options) => { + const models = Self.app.models; + const userId = ctx.req.accessToken.userId; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const isSalesAssistant = await models.Account.hasRole(userId, 'salesAssistant', myOptions); + const isDeliveryBoss = await models.Account.hasRole(userId, 'deliveryBoss', myOptions); + const isBuyer = await models.Account.hasRole(userId, 'buyer', myOptions); + const isClaimManager = await models.Account.hasRole(userId, 'claimManager', myOptions); + + const isRoleAdvanced = isSalesAssistant || isDeliveryBoss || isBuyer || isClaimManager; + + return isRoleAdvanced; + }; +}; diff --git a/modules/ticket/back/methods/ticket/makeInvoice.js b/modules/ticket/back/methods/ticket/makeInvoice.js index 4e9c22a24..9739f5985 100644 --- a/modules/ticket/back/methods/ticket/makeInvoice.js +++ b/modules/ticket/back/methods/ticket/makeInvoice.js @@ -26,7 +26,7 @@ module.exports = function(Self) { Self.makeInvoice = async(ctx, ticketsIds, options) => { const userId = ctx.req.accessToken.userId; const models = Self.app.models; - const date = new Date(); + const date = Date.vnNew(); date.setHours(0, 0, 0, 0); const myOptions = {}; diff --git a/modules/ticket/back/methods/ticket/merge.js b/modules/ticket/back/methods/ticket/merge.js new file mode 100644 index 000000000..8aaca1085 --- /dev/null +++ b/modules/ticket/back/methods/ticket/merge.js @@ -0,0 +1,78 @@ +const dateUtil = require('vn-loopback/util/date'); + +module.exports = Self => { + Self.remoteMethodCtx('merge', { + description: 'Merge one ticket into another', + accessType: 'WRITE', + accepts: [ + { + arg: 'tickets', + type: ['object'], + description: 'The array of tickets', + required: false + } + ], + returns: { + type: 'string', + root: true + }, + http: { + path: `/merge`, + verb: 'POST' + } + }); + + Self.merge = async(ctx, tickets, options) => { + const httpRequest = ctx.req; + const $t = httpRequest.__; + const origin = httpRequest.headers.origin; + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + for (let ticket of tickets) { + const originFullPath = `${origin}/#!/ticket/${ticket.originId}/summary`; + const destinationFullPath = `${origin}/#!/ticket/${ticket.destinationId}/summary`; + const message = $t('Ticket merged', { + originDated: dateUtil.toString(new Date(ticket.originShipped)), + destinationDated: dateUtil.toString(new Date(ticket.destinationShipped)), + originId: ticket.originId, + destinationId: ticket.destinationId, + originFullPath, + destinationFullPath + }); + if (!ticket.originId || !ticket.destinationId) continue; + + const ticketDestinationLogRecord = { + originFk: ticket.destinationId, + userFk: ctx.req.accessToken.userId, + action: 'update', + changedModel: 'Ticket', + changedModelId: ticket.destinationId, + changedModelValue: ticket.destinationId, + oldInstance: {}, + newInstance: {mergedTicket: ticket.originId} + }; + + await models.TicketLog.create(ticketDestinationLogRecord, myOptions); + await models.Sale.updateAll({ticketFk: ticket.originId}, {ticketFk: ticket.destinationId}, myOptions); + await models.Ticket.setDeleted(ctx, ticket.originId, myOptions); + await models.Chat.sendCheckingPresence(ctx, ticket.workerFk, message); + } + if (tx) + await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/ticket/back/methods/ticket/new.js b/modules/ticket/back/methods/ticket/new.js index e6048421e..a5d04bc4c 100644 --- a/modules/ticket/back/methods/ticket/new.js +++ b/modules/ticket/back/methods/ticket/new.js @@ -111,7 +111,7 @@ module.exports = Self => { args.landed = landedResult && landedResult.landed; } - query = `CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @result); + query = `CALL vn.ticket_add(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, @result); SELECT @result newTicketId;`; const result = await Self.rawSql(query, [ args.clientId, @@ -122,23 +122,11 @@ module.exports = Self => { args.agencyModeId || null, args.routeId || null, args.landed, + true, myUserId ], myOptions); const ticket = await models.Ticket.findById(result[1][0].newTicketId, null, myOptions); - const cleanInstance = JSON.parse(JSON.stringify(ticket)); - - const logRecord = { - originFk: cleanInstance.id, - userFk: myUserId, - action: 'insert', - changedModel: 'Ticket', - changedModelId: cleanInstance.id, - oldInstance: {}, - newInstance: cleanInstance - }; - - await models.TicketLog.create(logRecord, myOptions); if (tx) await tx.commit(); diff --git a/modules/ticket/back/methods/ticket/priceDifference.js b/modules/ticket/back/methods/ticket/priceDifference.js index 0e8cc2e06..989e0e5ce 100644 --- a/modules/ticket/back/methods/ticket/priceDifference.js +++ b/modules/ticket/back/methods/ticket/priceDifference.js @@ -88,8 +88,7 @@ module.exports = Self => { myOptions); if (!zoneShipped || zoneShipped.zoneFk != args.zoneId) { - const error = `You don't have privileges to change the zone or - for these parameters there are more than one shipping options, talk to agencies`; + const error = `You don't have privileges to change the zone`; throw new UserError(error); } diff --git a/modules/ticket/back/methods/ticket/refund.js b/modules/ticket/back/methods/ticket/refund.js new file mode 100644 index 000000000..1f0021316 --- /dev/null +++ b/modules/ticket/back/methods/ticket/refund.js @@ -0,0 +1,59 @@ +module.exports = Self => { + Self.remoteMethod('refund', { + description: 'Create refund tickets with all their sales and services', + accessType: 'WRITE', + accepts: [ + { + arg: 'ticketsIds', + type: ['number'], + required: true + }, + { + arg: 'createSingleTicket', + type: 'boolean', + required: false + } + ], + returns: { + type: ['number'], + root: true + }, + http: { + path: `/refund`, + verb: 'post' + } + }); + + Self.refund = async(ticketsIds, createSingleTicket = false, options) => { + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const filter = {where: {ticketFk: {inq: ticketsIds}}}; + + const sales = await models.Sale.find(filter, myOptions); + const salesIds = sales.map(sale => sale.id); + + const services = await models.TicketService.find(filter, myOptions); + const servicesIds = services.map(service => service.id); + + const refundedTickets = await models.Sale.refund(salesIds, servicesIds, createSingleTicket, myOptions); + + if (tx) await tx.commit(); + + return refundedTickets; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/ticket/back/methods/ticket/restore.js b/modules/ticket/back/methods/ticket/restore.js index c9bb126fd..722c3294e 100644 --- a/modules/ticket/back/methods/ticket/restore.js +++ b/modules/ticket/back/methods/ticket/restore.js @@ -38,7 +38,7 @@ module.exports = Self => { }] }, myOptions); - const now = new Date(); + const now = Date.vnNew(); const maxDate = new Date(ticket.updated); maxDate.setHours(maxDate.getHours() + 1); @@ -56,7 +56,7 @@ module.exports = Self => { await models.Chat.sendCheckingPresence(ctx, salesPersonId, message); } - const fullYear = new Date().getFullYear(); + const fullYear = Date.vnNew().getFullYear(); const newShipped = ticket.shipped; const newLanded = ticket.landed; newShipped.setFullYear(fullYear); diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js new file mode 100644 index 000000000..ab1c32d1b --- /dev/null +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -0,0 +1,132 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('saveSign', { + description: 'Save sign', + accessType: 'WRITE', + accepts: + [ + { + arg: 'tickets', + type: ['number'], + required: true, + description: 'The tickets' + }, + { + arg: 'location', + type: 'object', + description: 'The employee location the moment the sign is saved' + }, + { + arg: 'signedTime', + type: 'date', + description: 'The signed time' + } + ], + http: { + path: `/saveSign`, + verb: 'POST' + } + }); + + Self.saveSign = async(ctx, options) => { + const args = Object.assign({}, ctx.args); + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + async function setLocation(ticketId) { + await models.Delivery.create({ + ticketFk: ticketId, + longitude: args.location.Longitude, + latitude: args.location.Latitude, + dated: args.signedTime || new Date() + }, myOptions); + } + + async function gestDocExists(ticketId) { + const ticketDms = await models.TicketDms.findOne({ + where: {ticketFk: ticketId}, + fields: ['dmsFk'] + }, myOptions); + + if (!ticketDms) return false; + + const ticket = await models.Ticket.findById(ticketId, {fields: ['isSigned']}, myOptions); + if (ticket.isSigned == true) + return true; + else + await models.Dms.destroyAll({where: {reference: ticketId}}, myOptions); + + return false; + } + + async function createGestDoc(id) { + const ticket = await models.Ticket.findById(id, + {include: [ + { + relation: 'warehouse', + scope: { + fields: ['id'] + } + }, { + relation: 'client', + scope: { + fields: ['name'] + } + }, { + relation: 'route', + scope: { + fields: ['id'] + } + } + ] + }, myOptions); + const dmsType = await models.DmsType.findOne({where: {code: 'Ticket'}, fields: ['id']}, myOptions); + const ctxUploadFile = Object.assign({}, ctx); + ctxUploadFile.args = { + warehouseId: ticket.warehouseFk, + companyId: ticket.companyFk, + dmsTypeId: dmsType.id, + reference: id, + description: `Ticket ${id} Cliente ${ticket.client().name} Ruta ${ticket.route().id}`, + hasFile: true + }; + await models.Ticket.uploadFile(ctxUploadFile, id, myOptions); + } + + try { + for (let i = 0; i < args.tickets.length; i++) { + const ticketState = await models.TicketState.findOne( + {where: {ticketFk: args.tickets[i]}, + fields: ['alertLevel'] + }, myOptions); + + const packedAlertLevel = await models.AlertLevel.findOne({where: {code: 'PACKED'}, + fields: ['id'] + }, myOptions); + + if (ticketState.alertLevel < packedAlertLevel.id) + throw new UserError('This ticket cannot be signed because it has not been boxed'); + else if (!await gestDocExists(args.tickets[i])) { + if (args.location) setLocation(args.tickets[i]); + await createGestDoc(args.tickets[i]); + await Self.rawSql(`CALL vn.ticket_setState(?, ?)`, [args.tickets[i], 'DELIVERED'], myOptions); + } + } + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/ticket/back/methods/ticket/sendSms.js b/modules/ticket/back/methods/ticket/sendSms.js index a0adcae07..2336ae859 100644 --- a/modules/ticket/back/methods/ticket/sendSms.js +++ b/modules/ticket/back/methods/ticket/sendSms.js @@ -31,6 +31,7 @@ module.exports = Self => { }); Self.sendSms = async(ctx, id, destination, message, options) => { + const models = Self.app.models; const myOptions = {}; let tx; @@ -45,7 +46,14 @@ module.exports = Self => { const userId = ctx.req.accessToken.userId; try { - const sms = await Self.app.models.Sms.send(ctx, destination, message); + const sms = await models.Sms.send(ctx, destination, message); + + const newTicketSms = { + ticketFk: id, + smsFk: sms.id + }; + await models.TicketSms.create(newTicketSms); + const logRecord = { originFk: id, userFk: userId, @@ -60,7 +68,7 @@ module.exports = Self => { } }; - const ticketLog = await Self.app.models.TicketLog.create(logRecord, myOptions); + const ticketLog = await models.TicketLog.create(logRecord, myOptions); sms.logId = ticketLog.id; diff --git a/modules/ticket/back/methods/ticket/setDeleted.js b/modules/ticket/back/methods/ticket/setDeleted.js index c683dcffd..6ebc37d6e 100644 --- a/modules/ticket/back/methods/ticket/setDeleted.js +++ b/modules/ticket/back/methods/ticket/setDeleted.js @@ -42,6 +42,14 @@ module.exports = Self => { if (!isEditable) throw new UserError(`The sales of this ticket can't be modified`); + // Check if ticket has refunds + const ticketRefunds = await models.TicketRefund.find({ + where: {originalTicketFk: id}, + fields: ['id']} + , myOptions); + if (ticketRefunds.length > 0) + throw new UserError($t('Tickets with associated refunds', {id: ticketRefunds[0].id})); + // Check if has sales with shelving const isSalesAssistant = await models.Account.hasRole(userId, 'salesAssistant', myOptions); const sales = await models.Sale.find({ @@ -107,28 +115,9 @@ module.exports = Self => { } } } - }, { - relation: 'ship' - }, { - relation: 'stowaway' }] }, myOptions); - // Change state to "fixing" if contains an stowaway and remove the link between them - let otherTicketId; - if (ticket.stowaway()) - otherTicketId = ticket.stowaway().shipFk; - else if (ticket.ship()) - otherTicketId = ticket.ship().id; - - if (otherTicketId) { - await models.Ticket.deleteStowaway(ctx, otherTicketId, myOptions); - await models.TicketTracking.changeState(ctx, { - ticketFk: otherTicketId, - code: 'FIXING' - }, myOptions); - } - // Send notification to salesPerson const salesPersonUser = ticket.client().salesPersonUser(); if (salesPersonUser) { @@ -153,12 +142,12 @@ module.exports = Self => { await models.TicketCollection.destroyById(ticketCollection.id, myOptions); await Self.rawSql(` - DELETE sc + DELETE sc 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 + JOIN vn.sale s ON s.id = sgd.saleFk WHERE s.ticketFk = ?;`, [ticket.id], myOptions); if (tx) await tx.commit(); diff --git a/modules/ticket/back/methods/ticket/specs/addSale.spec.js b/modules/ticket/back/methods/ticket/specs/addSale.spec.js index cfd149511..2e568716a 100644 --- a/modules/ticket/back/methods/ticket/specs/addSale.spec.js +++ b/modules/ticket/back/methods/ticket/specs/addSale.spec.js @@ -1,7 +1,21 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('ticket addSale()', () => { const ticketId = 13; + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); it('should create a new sale for the ticket with id 13', async() => { const tx = await models.Ticket.beginTransaction({}); diff --git a/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js b/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js index 8b7e1685d..806f80227 100644 --- a/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js +++ b/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js @@ -61,7 +61,7 @@ describe('ticket canBeInvoiced()', () => { const ticket = await models.Ticket.findById(ticketId, null, options); - const shipped = new Date(); + const shipped = Date.vnNew(); shipped.setDate(shipped.getDate() + 1); await ticket.updateAttribute('shipped', shipped, options); diff --git a/modules/ticket/back/methods/ticket/specs/canHaveStowaway.spec.js b/modules/ticket/back/methods/ticket/specs/canHaveStowaway.spec.js deleted file mode 100644 index 2bd25c2d2..000000000 --- a/modules/ticket/back/methods/ticket/specs/canHaveStowaway.spec.js +++ /dev/null @@ -1,39 +0,0 @@ -const models = require('vn-loopback/server/server').models; - -describe('ticket canHaveStowaway()', () => { - it('should return true if the ticket warehouse have hasStowaway equal 1', async() => { - const tx = await models.Ticket.beginTransaction({}); - - try { - const options = {transaction: tx}; - - const ticketId = 16; - const canStowaway = await models.Ticket.canHaveStowaway(ticketId, options); - - expect(canStowaway).toBeTruthy(); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); - - it('should return false if the ticket warehouse dont have hasStowaway equal 0', async() => { - const tx = await models.Ticket.beginTransaction({}); - - try { - const options = {transaction: tx}; - - const ticketId = 10; - const canStowaway = await models.Ticket.canHaveStowaway(ticketId, options); - - expect(canStowaway).toBeFalsy(); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); -}); diff --git a/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js b/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js index 2aa2a07c4..d65c87654 100644 --- a/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js +++ b/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js @@ -1,10 +1,11 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('ticket componentUpdate()', () => { const userID = 1101; const ticketID = 11; - const today = new Date(); - const tomorrow = new Date(); + const today = Date.vnNew(); + const tomorrow = Date.vnNew(); tomorrow.setDate(tomorrow.getDate() + 1); @@ -18,9 +19,12 @@ describe('ticket componentUpdate()', () => { beforeAll(async() => { const deliveryComponenet = await models.Component.findOne({where: {code: 'delivery'}}); deliveryComponentId = deliveryComponenet.id; - componentOfSaleSeven = `SELECT value FROM vn.saleComponent WHERE saleFk = 7 AND componentFk = ${deliveryComponentId}`; - componentOfSaleEight = `SELECT value FROM vn.saleComponent WHERE saleFk = 8 AND componentFk = ${deliveryComponentId}`; - + componentOfSaleSeven = `SELECT value + FROM vn.saleComponent + WHERE saleFk = 7 AND componentFk = ${deliveryComponentId}`; + componentOfSaleEight = `SELECT value + FROM vn.saleComponent + WHERE saleFk = 8 AND componentFk = ${deliveryComponentId}`; [componentValue] = await models.SaleComponent.rawSql(componentOfSaleSeven); firstvalueBeforeChange = componentValue.value; @@ -175,10 +179,15 @@ describe('ticket componentUpdate()', () => { } } }; + + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: ctx.req + }); + const oldTicket = await models.Ticket.findById(ticketID, null, options); + await models.Ticket.componentUpdate(ctx, options); const [newTicketID] = await models.Ticket.rawSql('SELECT MAX(id) as id FROM ticket', null, options); - const oldTicket = await models.Ticket.findById(ticketID, null, options); const newTicket = await models.Ticket.findById(newTicketID.id, null, options); const newTicketSale = await models.Sale.findOne({where: {ticketFk: args.id}}, options); diff --git a/modules/ticket/back/methods/ticket/specs/deleteStowaway.spec.js b/modules/ticket/back/methods/ticket/specs/deleteStowaway.spec.js deleted file mode 100644 index 62bfc71be..000000000 --- a/modules/ticket/back/methods/ticket/specs/deleteStowaway.spec.js +++ /dev/null @@ -1,75 +0,0 @@ -const models = require('vn-loopback/server/server').models; - -describe('ticket deleteStowaway()', () => { - const shipId = 16; - const stowawayId = 17; - const ctx = { - req: { - accessToken: {userId: 18}, - headers: {origin: 'http://localhost'} - } - }; - ctx.req.__ = (value, params) => { - return params.nickname; - }; - - it(`should create an stowaway, delete it and see the states of both stowaway and ship go back to the last states`, async() => { - const tx = await models.Ticket.beginTransaction({}); - - try { - const options = {transaction: tx}; - - await models.Stowaway.rawSql(` - INSERT INTO stowaway (id, shipFk) VALUES (?, ?) - `, [stowawayId, shipId], options); - await models.Stowaway.rawSql( - `CALL ticketStateUpdate(?, ?)`, [shipId, 'BOARDING'], options); - await models.Stowaway.rawSql( - `CALL ticketStateUpdate(?, ?)`, [stowawayId, 'BOARDING'], options); - - let createdStowaways = await models.Stowaway.count({id: stowawayId, shipFk: shipId}, options); - - expect(createdStowaways).toEqual(1); - - let shipState = await models.TicketLastState.findOne({ - where: { - ticketFk: shipId - } - }, options); - let stowawayState = await models.TicketLastState.findOne({ - where: { - ticketFk: stowawayId - } - }, options); - - expect(shipState.name).toEqual('Embarcando'); - expect(stowawayState.name).toEqual('Embarcando'); - - await models.Ticket.deleteStowaway(ctx, shipId, options); - await models.Ticket.deleteStowaway(ctx, stowawayId, options); - - createdStowaways = await models.Stowaway.count({id: stowawayId, shipFk: shipId}, options); - - expect(createdStowaways).toEqual(0); - - shipState = await models.TicketLastState.findOne({ - where: { - ticketFk: shipId - } - }, options); - stowawayState = await models.TicketLastState.findOne({ - where: { - ticketFk: stowawayId - } - }, options); - - expect(shipState.name).toEqual('OK'); - expect(stowawayState.name).toEqual('Libre'); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); -}); diff --git a/modules/ticket/back/methods/ticket/specs/filter.spec.js b/modules/ticket/back/methods/ticket/specs/filter.spec.js index 020bc5747..6cc1a3ad2 100644 --- a/modules/ticket/back/methods/ticket/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket/specs/filter.spec.js @@ -11,7 +11,7 @@ describe('ticket filter()', () => { const filter = {order: 'id DESC'}; const result = await models.Ticket.filter(ctx, filter, options); - expect(result.length).toEqual(27); + expect(result.length).toBeGreaterThan(25); await tx.rollback(); } catch (e) { @@ -26,9 +26,9 @@ describe('ticket filter()', () => { try { const options = {transaction: tx}; - const yesterday = new Date(); + const yesterday = Date.vnNew(); yesterday.setHours(0, 0, 0, 0); - const today = new Date(); + const today = Date.vnNew(); today.setHours(23, 59, 59, 59); const ctx = {req: {accessToken: {userId: 9}}, args: { @@ -39,7 +39,7 @@ describe('ticket filter()', () => { const filter = {}; const result = await models.Ticket.filter(ctx, filter, options); - expect(result.length).toEqual(6); + expect(result.length).toBeGreaterThan(3); await tx.rollback(); } catch (e) { @@ -54,10 +54,10 @@ describe('ticket filter()', () => { try { const options = {transaction: tx}; - const yesterday = new Date(); + const yesterday = Date.vnNew(); yesterday.setDate(yesterday.getDate() - 1); yesterday.setHours(0, 0, 0, 0); - const today = new Date(); + const today = Date.vnNew(); today.setHours(23, 59, 59, 59); const ctx = {req: {accessToken: {userId: 9}}, args: { @@ -87,7 +87,7 @@ describe('ticket filter()', () => { const filter = {}; const result = await models.Ticket.filter(ctx, filter, options); - expect(result.length).toEqual(27); + expect(result.length).toBeGreaterThan(25); await tx.rollback(); } catch (e) { @@ -107,8 +107,8 @@ describe('ticket filter()', () => { const result = await models.Ticket.filter(ctx, filter, options); const firstRow = result[0]; - expect(result.length).toEqual(1); - expect(firstRow.id).toEqual(11); + expect(result.length).toBeGreaterThan(0); + expect(firstRow.id).toBeGreaterThan(10); await tx.rollback(); } catch (e) { @@ -130,7 +130,7 @@ describe('ticket filter()', () => { const length = result.length; const anyResult = result[Math.floor(Math.random() * Math.floor(length))]; - expect(length).toEqual(10); + expect(length).toBeGreaterThan(10); expect(anyResult.state).toMatch(/(Libre|Arreglar)/); await tx.rollback(); @@ -153,7 +153,7 @@ describe('ticket filter()', () => { const secondRow = result[1]; const thirdRow = result[2]; - expect(result.length).toEqual(12); + expect(result.length).toBeGreaterThan(15); expect(firstRow.state).toEqual('Entregado'); expect(secondRow.state).toEqual('Entregado'); expect(thirdRow.state).toEqual('Entregado'); @@ -175,7 +175,7 @@ describe('ticket filter()', () => { const filter = {}; const result = await models.Ticket.filter(ctx, filter, options); - expect(result.length).toEqual(23); + expect(result.length).toBeGreaterThan(25); await tx.rollback(); } catch (e) { @@ -194,7 +194,7 @@ describe('ticket filter()', () => { const filter = {}; const result = await models.Ticket.filter(ctx, filter, options); - expect(result.length).toEqual(4); + expect(result.length).toBeGreaterThan(0); await tx.rollback(); } catch (e) { @@ -213,7 +213,7 @@ describe('ticket filter()', () => { const filter = {}; const result = await models.Ticket.filter(ctx, filter, options); - expect(result.length).toEqual(3); + expect(result.length).toBeGreaterThan(0); await tx.rollback(); } catch (e) { @@ -232,7 +232,7 @@ describe('ticket filter()', () => { const filter = {}; const result = await models.Ticket.filter(ctx, filter, options); - expect(result.length).toEqual(22); + expect(result.length).toBeGreaterThan(20); await tx.rollback(); } catch (e) { @@ -251,7 +251,7 @@ describe('ticket filter()', () => { const filter = {}; const result = await models.Ticket.filter(ctx, filter, options); - expect(result.length).toEqual(5); + expect(result.length).toBeGreaterThan(0); await tx.rollback(); } catch (e) { @@ -270,7 +270,45 @@ describe('ticket filter()', () => { const filter = {}; const result = await models.Ticket.filter(ctx, filter, options); - expect(result.length).toEqual(27); + expect(result.length).toBeGreaterThan(25); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets with the invoice on false', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {req: {accessToken: {userId: 9}}, args: {hasInvoice: true}}; + const filter = {}; + const result = await models.Ticket.filter(ctx, filter, options); + + expect(result.length).toBeGreaterThan(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets with the invoice on null', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {req: {accessToken: {userId: 9}}, args: {hasInvoice: null}}; + const filter = {}; + const result = await models.Ticket.filter(ctx, filter, options); + + expect(result.length).toBeGreaterThanOrEqual(27); await tx.rollback(); } catch (e) { diff --git a/modules/ticket/back/methods/ticket/specs/getPossibleStowaways.spec.js b/modules/ticket/back/methods/ticket/specs/getPossibleStowaways.spec.js deleted file mode 100644 index ed1a327d4..000000000 --- a/modules/ticket/back/methods/ticket/specs/getPossibleStowaways.spec.js +++ /dev/null @@ -1,60 +0,0 @@ -const models = require('vn-loopback/server/server').models; -let UserError = require('vn-loopback/util/user-error'); - -describe('ticket getPossibleStowaways()', () => { - it(`should throw an error if Can't create stowaway for this ticket`, async() => { - const tx = await models.Ticket.beginTransaction({}); - - let error; - - try { - const options = {transaction: tx}; - - const ticketId = 10; - await models.Ticket.getPossibleStowaways(ticketId, options); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - error = e; - } - - expect(error).toEqual(new UserError(`Can't create stowaway for this ticket`)); - }); - - it('should return an empty list of tickets for a valid ticket', async() => { - const tx = await models.Ticket.beginTransaction({}); - - try { - const options = {transaction: tx}; - - const ticketId = 12; - const possibleStowaways = await models.Ticket.getPossibleStowaways(ticketId, options); - - expect(possibleStowaways.length).toEqual(0); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); - - it('should return allowed list of tickets for a valid ticket', async() => { - const tx = await models.Ticket.beginTransaction({}); - - try { - const options = {transaction: tx}; - - const ticketId = 16; - const possibleStowaways = await models.Ticket.getPossibleStowaways(ticketId, options); - - expect(possibleStowaways.length).toEqual(1); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); -}); diff --git a/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js b/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js new file mode 100644 index 000000000..5a3209a6d --- /dev/null +++ b/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js @@ -0,0 +1,131 @@ +const models = require('vn-loopback/server/server').models; + +describe('TicketFuture getTicketsAdvance()', () => { + const today = Date.vnNew(); + today.setHours(0, 0, 0, 0); + let tomorrow = Date.vnNew(); + tomorrow.setDate(today.getDate() + 1); + + it('should return the tickets passing the required data', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + dateFuture: tomorrow, + dateToAdvance: today, + warehouseFk: 1, + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsAdvance(ctx, options); + + expect(result.length).toBeGreaterThan(0); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets matching the fullMovable true', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + dateFuture: tomorrow, + dateToAdvance: today, + warehouseFk: 1, + isFullMovable: true + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsAdvance(ctx, options); + + expect(result.length).toBeGreaterThan(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets matching the fullMovable false', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + dateFuture: tomorrow, + dateToAdvance: today, + warehouseFk: 1, + isFullMovable: false + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsAdvance(ctx, options); + + expect(result.length).toEqual(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets matching the origin IPT', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + dateFuture: tomorrow, + dateToAdvance: today, + warehouseFk: 1, + ipt: 'V' + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsAdvance(ctx, options); + + expect(result.length).toBeGreaterThan(5); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets matching the destination IPT', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + dateFuture: tomorrow, + dateToAdvance: today, + warehouseFk: 1, + tfIpt: 'V' + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsAdvance(ctx, options); + + expect(result.length).toBeGreaterThan(5); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/ticket/back/methods/ticket/specs/getTicketsFuture.spec.js b/modules/ticket/back/methods/ticket/specs/getTicketsFuture.spec.js new file mode 100644 index 000000000..44896493f --- /dev/null +++ b/modules/ticket/back/methods/ticket/specs/getTicketsFuture.spec.js @@ -0,0 +1,304 @@ +const models = require('vn-loopback/server/server').models; + +describe('ticket getTicketsFuture()', () => { + const today = Date.vnNew(); + today.setHours(0, 0, 0, 0); + + it('should return the tickets passing the required data', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + originDated: today, + futureDated: today, + warehouseFk: 1, + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsFuture(ctx, options); + + expect(result.length).toBeGreaterThan(0); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets matching the problems on true', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + originDated: today, + futureDated: today, + warehouseFk: 1, + problems: true + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsFuture(ctx, options); + + expect(result.length).toBeGreaterThan(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets matching the problems on false', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + originDated: today, + futureDated: today, + warehouseFk: 1, + problems: false + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsFuture(ctx, options); + + expect(result.length).toEqual(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets matching the problems on null', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + originDated: today, + futureDated: today, + warehouseFk: 1, + problems: null + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsFuture(ctx, options); + + expect(result.length).toBeGreaterThan(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets matching the OK State in origin date', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + originDated: today, + futureDated: today, + warehouseFk: 1, + state: 'OK' + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsFuture(ctx, options); + + expect(result.length).toBeGreaterThan(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets matching the OK State in destination date', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + originDated: today, + futureDated: today, + warehouseFk: 1, + futureState: 'OK' + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsFuture(ctx, options); + + expect(result.length).toBeGreaterThan(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets matching the correct IPT in origin date', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + originDated: today, + futureDated: today, + warehouseFk: 1, + ipt: null + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsFuture(ctx, options); + + expect(result.length).toBeGreaterThan(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets matching the incorrect IPT in origin date', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + originDated: today, + futureDated: today, + warehouseFk: 1, + ipt: 'H' + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsFuture(ctx, options); + + expect(result.length).toBeGreaterThan(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets matching the correct IPT in destination date', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + originDated: today, + futureDated: today, + warehouseFk: 1, + futureIpt: null + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsFuture(ctx, options); + + expect(result.length).toBeGreaterThan(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets matching the incorrect IPT in destination date', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + originDated: today, + futureDated: today, + warehouseFk: 1, + futureIpt: 'H' + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsFuture(ctx, options); + + expect(result.length).toBeGreaterThan(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets matching the ID in origin date', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + originDated: today, + futureDated: today, + warehouseFk: 1, + id: 13 + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsFuture(ctx, options); + + expect(result.length).toBeGreaterThan(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return the tickets matching the ID in destination date', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const args = { + originDated: today, + futureDated: today, + warehouseFk: 1, + futureId: 12 + }; + + const ctx = {req: {accessToken: {userId: 9}}, args}; + const result = await models.Ticket.getTicketsFuture(ctx, options); + + expect(result.length).toBeGreaterThan(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/ticket/back/methods/ticket/specs/isEditable.spec.js b/modules/ticket/back/methods/ticket/specs/isEditable.spec.js index adc2acdee..7337017d6 100644 --- a/modules/ticket/back/methods/ticket/specs/isEditable.spec.js +++ b/modules/ticket/back/methods/ticket/specs/isEditable.spec.js @@ -134,4 +134,23 @@ describe('ticket isEditable()', () => { expect(result).toEqual(false); }); + + it('should not be able to edit if is a ticket weekly', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {req: {accessToken: {userId: 1}}}; + + const result = await models.Ticket.isEditable(ctx, 15, options); + + expect(result).toEqual(false); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); }); diff --git a/modules/ticket/back/methods/ticket/specs/merge.spec.js b/modules/ticket/back/methods/ticket/specs/merge.spec.js new file mode 100644 index 000000000..3254e58a8 --- /dev/null +++ b/modules/ticket/back/methods/ticket/specs/merge.spec.js @@ -0,0 +1,62 @@ +const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); + +describe('ticket merge()', () => { + const tickets = { + originId: 13, + destinationId: 12, + originShipped: Date.vnNew(), + destinationShipped: Date.vnNew(), + workerFk: 1 + }; + + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + + const ctx = { + req: { + accessToken: {userId: 9}, + headers: {origin: 'http://localhost:5000'}, + } + }; + ctx.req.__ = value => { + return value; + }; + + it('should merge two tickets', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + const chatNotificationBeforeMerge = await models.Chat.find(null, options); + + await models.Ticket.merge(ctx, [tickets], options); + + const createdTicketLog = await models.TicketLog.find({where: {originFk: tickets.destinationId}}, options); + const deletedTicket = await models.Ticket.findOne({where: {id: tickets.originId}}, options); + const salesTicketFuture = await models.Sale.find({where: {ticketFk: tickets.destinationId}}, options); + const chatNotificationAfterMerge = await models.Chat.find(null, options); + + expect(createdTicketLog.length).toEqual(1); + expect(deletedTicket.isDeleted).toEqual(true); + expect(salesTicketFuture.length).toEqual(2); + expect(chatNotificationBeforeMerge.length).toEqual(chatNotificationAfterMerge.length - 2); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/ticket/back/methods/ticket/specs/new.spec.js b/modules/ticket/back/methods/ticket/specs/new.spec.js index fce7cdceb..0a2f93bc4 100644 --- a/modules/ticket/back/methods/ticket/specs/new.spec.js +++ b/modules/ticket/back/methods/ticket/specs/new.spec.js @@ -2,7 +2,7 @@ const models = require('vn-loopback/server/server').models; let UserError = require('vn-loopback/util/user-error'); describe('ticket new()', () => { - const today = new Date(); + const today = Date.vnNew(); const ctx = {req: {accessToken: {userId: 1}}}; it('should throw an error if the client isnt frozen and isnt active', async() => { diff --git a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js index d8c785baa..cc54353ef 100644 --- a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js +++ b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js @@ -8,7 +8,7 @@ describe('sale priceDifference()', () => { try { const options = {transaction: tx}; - const tomorrow = new Date(); + const tomorrow = Date.vnNew(); tomorrow.setDate(tomorrow.getDate() + 1); const ctx = {req: {accessToken: {userId: 1106}}}; @@ -45,8 +45,8 @@ describe('sale priceDifference()', () => { const ctx = {req: {accessToken: {userId: 1106}}}; ctx.args = { id: 1, - landed: new Date(), - shipped: new Date(), + landed: Date.vnNew(), + shipped: Date.vnNew(), addressId: 121, zoneId: 3, warehouseId: 1 @@ -68,7 +68,7 @@ describe('sale priceDifference()', () => { try { const options = {transaction: tx}; - const tomorrow = new Date(); + const tomorrow = Date.vnNew(); tomorrow.setDate(tomorrow.getDate() + 1); const ctx = {req: {accessToken: {userId: 1106}}}; @@ -86,8 +86,8 @@ describe('sale priceDifference()', () => { const firstItem = result.items[0]; const secondtItem = result.items[1]; - expect(firstItem.movable).toEqual(410); - expect(secondtItem.movable).toEqual(1870); + expect(firstItem.movable).toEqual(380); + expect(secondtItem.movable).toEqual(1790); await tx.rollback(); } catch (e) { diff --git a/modules/ticket/back/methods/ticket/specs/restore.spec.js b/modules/ticket/back/methods/ticket/specs/restore.spec.js index bd976d124..3b35ae2b4 100644 --- a/modules/ticket/back/methods/ticket/specs/restore.spec.js +++ b/modules/ticket/back/methods/ticket/specs/restore.spec.js @@ -24,8 +24,8 @@ describe('ticket restore()', () => { let error; const tx = await app.models.Ticket.beginTransaction({}); - const now = new Date(); - now.setHours(now.getHours() - 1); + const now = Date.vnNew(); + now.setHours(now.getHours() - 1.1); try { const options = {transaction: tx}; @@ -46,7 +46,7 @@ describe('ticket restore()', () => { it('should restore the ticket making its state no longer deleted', async() => { const tx = await app.models.Ticket.beginTransaction({}); - const now = new Date(); + const now = Date.vnNew(); try { const options = {transaction: tx}; diff --git a/modules/ticket/back/methods/ticket/specs/saveSign.spec.js b/modules/ticket/back/methods/ticket/specs/saveSign.spec.js new file mode 100644 index 000000000..6b532a5d1 --- /dev/null +++ b/modules/ticket/back/methods/ticket/specs/saveSign.spec.js @@ -0,0 +1,32 @@ +const models = require('vn-loopback/server/server').models; + +describe('Ticket saveSign()', () => { + const FormData = require('form-data'); + const data = new FormData(); + let ctx = {req: { + accessToken: {userId: 9}, + headers: { + ...data.getHeaders() + } + + }}; + + it(`should throw error if the ticket's alert level is lower than 2`, async() => { + const tx = await models.TicketDms.beginTransaction({}); + const ticketWithOkState = 12; + let error; + try { + const options = {transaction: tx}; + ctx.args = {tickets: [ticketWithOkState]}; + + await models.Ticket.saveSign(ctx, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error).toBeDefined(); + }); +}); diff --git a/modules/ticket/back/methods/ticket/specs/sendSms.spec.js b/modules/ticket/back/methods/ticket/specs/sendSms.spec.js index f50253b10..f94b8be2a 100644 --- a/modules/ticket/back/methods/ticket/specs/sendSms.spec.js +++ b/modules/ticket/back/methods/ticket/specs/sendSms.spec.js @@ -15,9 +15,16 @@ describe('ticket sendSms()', () => { const sms = await models.Ticket.sendSms(ctx, id, destination, message, options); const createdLog = await models.TicketLog.findById(sms.logId, null, options); + + const filter = { + ticketFk: createdLog.originFk + }; + const ticketSms = await models.TicketSms.findOne(filter, options); + const json = JSON.parse(JSON.stringify(createdLog.newInstance)); expect(json.message).toEqual(message); + expect(ticketSms.ticketFk).toEqual(createdLog.originFk); await tx.rollback(); } catch (e) { diff --git a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js index 4551377df..b2e70697a 100644 --- a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js +++ b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js @@ -82,6 +82,9 @@ describe('ticket setDeleted()', () => { ctx.req.__ = value => { return value; }; + const [ticketCollectionOld] = await models.Ticket.rawSql( + `SELECT COUNT(*) numberRows + FROM vn.ticketCollection`, [], options); const ticketId = 23; await models.Ticket.setDeleted(ctx, ticketId, options); @@ -90,7 +93,7 @@ describe('ticket setDeleted()', () => { `SELECT COUNT(*) numberRows FROM vn.ticketCollection`, [], options); - expect(ticketCollection.numberRows).toEqual(3); + expect(ticketCollection.numberRows).toBeLessThan(ticketCollectionOld.numberRows); await tx.rollback(); } catch (e) { @@ -99,91 +102,31 @@ describe('ticket setDeleted()', () => { } }); - it('should delete ticket, remove stowaway and itemshelving then change stowaway state to "FIXING" ', async() => { - pending('test excluded by task #3693'); + it('should show error trying to delete a ticket with a refund', async() => { const tx = await models.Ticket.beginTransaction({}); - + let error; try { const options = {transaction: tx}; - spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ - active: activeCtx - }); const ctx = { req: { - accessToken: {userId: employeeUser}, - headers: { - origin: 'http://localhost:5000' - }, - __: () => {} + accessToken: {userId: 9}, + headers: {origin: 'http://localhost:5000'}, } }; + ctx.req.__ = value => { + return value; + }; - const sampleTicket = await models.Ticket.findById(12); - const sampleStowaway = await models.Ticket.findById(13); - - sampleTicket.id = undefined; - const shipTicket = await models.Ticket.create(sampleTicket, options); - - sampleStowaway.id = undefined; - const stowawayTicket = await models.Ticket.create(sampleStowaway, options); - - await models.Stowaway.rawSql(` - INSERT INTO vn.stowaway(id, shipFk) - VALUES (?, ?)`, [stowawayTicket.id, shipTicket.id], options); - - const boardingState = await models.State.findOne({ - where: { - code: 'BOARDING' - } - }, options); - - await models.TicketTracking.create({ - ticketFk: stowawayTicket.id, - stateFk: boardingState.id, - workerFk: ctx.req.accessToken.userId - }, options); - - const okState = await models.State.findOne({ - where: { - code: 'OK' - } - }, options); - - await models.TicketTracking.create({ - ticketFk: shipTicket.id, - stateFk: okState.id, - workerFk: ctx.req.accessToken.userId - }, options); - - let stowawayTicketState = await models.TicketState.findOne({ - where: { - ticketFk: stowawayTicket.id - } - }, options); - - let stowaway = await models.Stowaway.findById(shipTicket.id, null, options); - - expect(stowaway).toBeDefined(); - expect(stowawayTicketState.code).toEqual('BOARDING'); - - await models.Ticket.setDeleted(ctx, shipTicket.id, options); - - stowawayTicketState = await models.TicketState.findOne({ - where: { - ticketFk: stowawayTicket.id - } - }, options); - - stowaway = await models.Stowaway.findById(shipTicket.id, null, options); - - expect(stowaway).toBeNull(); - expect(stowawayTicketState.code).toEqual('FIXING'); + const ticketId = 12; + await models.Ticket.setDeleted(ctx, ticketId, options); await tx.rollback(); } catch (e) { await tx.rollback(); - throw e; + error = e; } + + expect(error.message).toContain('Tickets with associated refunds'); }); }); diff --git a/modules/ticket/back/methods/ticket/specs/transferSales.spec.js b/modules/ticket/back/methods/ticket/specs/transferSales.spec.js index cd2ce8599..270aae2f8 100644 --- a/modules/ticket/back/methods/ticket/specs/transferSales.spec.js +++ b/modules/ticket/back/methods/ticket/specs/transferSales.spec.js @@ -80,34 +80,6 @@ describe('sale transferSales()', () => { expect(error.message).toEqual(`Can't transfer claimed sales`); }); - it('should be able to transfer claimed sales if the role is claimManager', async() => { - const tx = await models.Ticket.beginTransaction({}); - - let error; - try { - const options = {transaction: tx}; - - const claimManagerId = 72; - const myActiveCtx = { - accessToken: {userId: claimManagerId}, - }; - const myCtx = {req: myActiveCtx}; - - const ticketId = 11; - const receiverTicketId = null; - const sales = await models.Ticket.getSales(ticketId, options); - - await models.Ticket.transferSales(myCtx, ticketId, receiverTicketId, sales, options); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - error = e; - } - - expect(error).toBeUndefined(); - }); - it('should transfer the sales from a ticket to a new one', async() => { const tx = await models.Ticket.beginTransaction({}); diff --git a/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js b/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js index 1873207aa..41de1fd6e 100644 --- a/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js +++ b/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js @@ -1,6 +1,20 @@ const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); describe('sale updateDiscount()', () => { + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); const originalSaleId = 8; it('should throw an error if no sales were selected', async() => { @@ -110,6 +124,11 @@ describe('sale updateDiscount()', () => { const componentId = manaDiscount.id; const manaCode = 'mana'; + const teamOne = 96; + const userId = ctx.req.accessToken.userId; + const business = await models.Business.findOne({where: {workerFk: userId}}, options); + await business.updateAttribute('departmentFk', teamOne, options); + await models.Ticket.updateDiscount(ctx, ticketId, sales, newDiscount, manaCode, options); const updatedSale = await models.Sale.findById(originalSaleId, null, options); @@ -150,6 +169,11 @@ describe('sale updateDiscount()', () => { const componentId = manaDiscount.id; const manaCode = 'manaClaim'; + const teamOne = 96; + const userId = ctx.req.accessToken.userId; + const business = await models.Business.findOne({where: {workerFk: userId}}, options); + await business.updateAttribute('departmentFk', teamOne, options); + await models.Ticket.updateDiscount(ctx, ticketId, sales, newDiscount, manaCode, options); const updatedSale = await models.Sale.findById(originalSaleId, null, options); diff --git a/modules/ticket/back/methods/ticket/summary.js b/modules/ticket/back/methods/ticket/summary.js index 848913fe1..a57968fc1 100644 --- a/modules/ticket/back/methods/ticket/summary.js +++ b/modules/ticket/back/methods/ticket/summary.js @@ -71,7 +71,7 @@ module.exports = Self => { }, { relation: 'address', scope: { - fields: ['street', 'city', 'provinceFk', 'phone', 'mobile', 'postalCode'], + fields: ['street', 'city', 'provinceFk', 'phone', 'mobile', 'postalCode', 'isEqualizated'], include: { relation: 'province', scope: { diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index 1b8476184..48035648c 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -77,9 +77,8 @@ module.exports = Self => { const saleIds = sales.map(sale => sale.id); - const isClaimManager = await models.Account.hasRole(userId, 'claimManager'); const hasClaimedSales = await models.ClaimBeginning.findOne({where: {saleFk: {inq: saleIds}}}); - if (hasClaimedSales && !isClaimManager) + if (hasClaimedSales) throw new UserError(`Can't transfer claimed sales`); for (const sale of sales) { @@ -106,8 +105,8 @@ module.exports = Self => { originFk: id, userFk: userId, action: 'update', - changedModel: 'Ticket', - changedModelId: id, + changedModel: 'Sale', + changedModelId: sale.id, oldInstance: { item: originalSaleData.itemFk, quantity: originalSaleData.quantity, @@ -127,8 +126,8 @@ module.exports = Self => { originFk: ticketId, userFk: userId, action: 'update', - changedModel: 'Ticket', - changedModelId: ticketId, + changedModel: 'Sale', + changedModelId: sale.id, oldInstance: { item: originalSaleData.itemFk, quantity: originalSaleData.quantity, @@ -178,16 +177,16 @@ module.exports = Self => { // Update original sale const rest = originalSale.quantity - sale.quantity; - query = `UPDATE sale + query = `UPDATE sale SET quantity = ? WHERE id = ?`; await Self.rawSql(query, [rest, sale.id], options); // Clone sale with new quantity - query = `INSERT INTO sale (itemFk, ticketFk, concept, quantity, originalQuantity, price, discount, priceFixed, + query = `INSERT INTO sale (itemFk, ticketFk, concept, quantity, originalQuantity, price, discount, priceFixed, reserved, isPicked, isPriceFixed, isAdded) - SELECT itemFk, ?, concept, ?, originalQuantity, price, discount, priceFixed, - reserved, isPicked, isPriceFixed, isAdded + SELECT itemFk, ?, concept, ?, originalQuantity, price, discount, priceFixed, + reserved, isPicked, isPriceFixed, isAdded FROM sale WHERE id = ?`; await Self.rawSql(query, [ticketId, sale.quantity, sale.id], options); diff --git a/modules/ticket/back/methods/ticket/updateDiscount.js b/modules/ticket/back/methods/ticket/updateDiscount.js index b1291a45b..4dd346161 100644 --- a/modules/ticket/back/methods/ticket/updateDiscount.js +++ b/modules/ticket/back/methods/ticket/updateDiscount.js @@ -98,12 +98,7 @@ module.exports = Self => { if (isLocked || (!hasAllowedRoles && alertLevel > 0)) throw new UserError(`The sales of this ticket can't be modified`); - const usesMana = await models.WorkerMana.findOne({ - where: { - workerFk: userId - }, - fields: 'amount'}, myOptions); - + const usesMana = await models.Sale.usesMana(ctx, myOptions); const componentCode = usesMana ? manaCode : 'buyerDiscount'; const discountComponent = await models.Component.findOne({ where: {code: componentCode}}, myOptions); @@ -115,14 +110,38 @@ module.exports = Self => { for (let sale of sales) { const oldDiscount = sale.discount; const value = ((-sale.price * newDiscount) / 100); - const newComponent = models.SaleComponent.upsert({ - saleFk: sale.id, - value: value, - componentFk: componentId}, myOptions); + + const manaComponent = await models.Component.findOne({ + where: {code: 'mana'} + }, myOptions); + + const manaClaimComponent = await models.Component.findOne({ + where: {code: 'manaClaim'} + }, myOptions); + + const [oldComponent] = await models.SaleComponent.find({ + where: { + and: [ + {saleFk: sale.id}, + {componentFk: {inq: [manaComponent.id, manaClaimComponent.id]}} + ] + } + }, myOptions); + + let deletedComponent; + if (oldComponent) { + const filter = { + saleFk: sale.id, + componentFk: oldComponent.componentFk + }; + deletedComponent = await models.SaleComponent.destroyAll(filter, myOptions); + } + + const newComponent = await createSaleComponent(sale.id, value, componentId, myOptions); const updatedSale = sale.updateAttribute('discount', newDiscount, myOptions); - promises.push(newComponent, updatedSale); + promises.push(newComponent, updatedSale, deletedComponent); const change = `${oldDiscount}% ➔ *${newDiscount}%*`; changesMade += `\r\n-${sale.itemFk}: ${sale.concept} (${sale.quantity}) ${change}`; @@ -165,4 +184,14 @@ module.exports = Self => { throw e; } }; + + async function createSaleComponent(saleId, value, componentId, myOptions) { + const models = Self.app.models; + + return models.SaleComponent.upsert({ + saleFk: saleId, + value: value, + componentFk: componentId + }, myOptions); + } }; diff --git a/modules/ticket/back/model-config.json b/modules/ticket/back/model-config.json index e75c7415e..bee01a875 100644 --- a/modules/ticket/back/model-config.json +++ b/modules/ticket/back/model-config.json @@ -5,6 +5,9 @@ "AnnualAverageInvoiced": { "dataSource": "vn" }, + "Boxing": { + "dataSource": "vn" + }, "Component": { "dataSource": "vn" }, @@ -20,25 +23,34 @@ "Packaging": { "dataSource": "vn" }, + "PackingSiteConfig": { + "dataSource": "vn" + }, + "ExpeditionMistake": { + "dataSource": "vn" + }, "PrintServerQueue": { "dataSource": "vn" }, "Sale": { "dataSource": "vn" }, - "SaleChecked": { + "SaleCloned": { "dataSource": "vn" }, "SaleComponent": { "dataSource": "vn" }, + "SaleGroup": { + "dataSource": "vn" + }, + "SaleGroupDetail": { + "dataSource": "vn" + }, "SaleTracking": { "dataSource": "vn" }, - "State":{ - "dataSource": "vn" - }, - "Stowaway": { + "State": { "dataSource": "vn" }, "Ticket": { @@ -59,19 +71,22 @@ "TicketPackaging": { "dataSource": "vn" }, + "TicketRefund": { + "dataSource": "vn" + }, "TicketRequest": { "dataSource": "vn" }, - "TicketState":{ + "TicketState": { "dataSource": "vn" }, - "TicketLastState":{ + "TicketLastState": { "dataSource": "vn" }, - "TicketService":{ + "TicketService": { "dataSource": "vn" }, - "TicketServiceType":{ + "TicketServiceType": { "dataSource": "vn" }, "TicketTracking": { diff --git a/modules/ticket/back/models/boxing.js b/modules/ticket/back/models/boxing.js new file mode 100644 index 000000000..c251ea0e4 --- /dev/null +++ b/modules/ticket/back/models/boxing.js @@ -0,0 +1,4 @@ +module.exports = Self => { + require('../methods/boxing/getVideo')(Self); + require('../methods/boxing/getVideoList')(Self); +}; diff --git a/modules/ticket/back/models/boxing.json b/modules/ticket/back/models/boxing.json new file mode 100644 index 000000000..5aecbcabe --- /dev/null +++ b/modules/ticket/back/models/boxing.json @@ -0,0 +1,12 @@ +{ + "name": "Boxing", + "base": "PersistedModel", + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} diff --git a/modules/ticket/back/models/expedition.js b/modules/ticket/back/models/expedition.js index 9d6564373..46cde6890 100644 --- a/modules/ticket/back/models/expedition.js +++ b/modules/ticket/back/models/expedition.js @@ -1,3 +1,5 @@ module.exports = function(Self) { require('../methods/expedition/filter')(Self); + require('../methods/expedition/deleteExpeditions')(Self); + require('../methods/expedition/moveExpeditions')(Self); }; diff --git a/modules/ticket/back/models/expedition.json b/modules/ticket/back/models/expedition.json index fc94f185d..d74c56d2c 100644 --- a/modules/ticket/back/models/expedition.json +++ b/modules/ticket/back/models/expedition.json @@ -16,7 +16,7 @@ "type": "number", "description": "Identifier" }, - "isBox": { + "freightItemFk": { "type": "number" }, "created": { @@ -37,11 +37,6 @@ "model": "agency-mode", "foreignKey": "agencyModeFk" }, - "packageItem": { - "type": "belongsTo", - "model": "Item", - "foreignKey": "itemFk" - }, "worker": { "type": "belongsTo", "model": "Worker", @@ -55,7 +50,7 @@ "freightItem": { "type": "belongsTo", "model": "Item", - "foreignKey": "isBox" + "foreignKey": "freightItemFk" }, "packaging": { "type": "belongsTo", diff --git a/modules/ticket/back/models/expeditionMistake.json b/modules/ticket/back/models/expeditionMistake.json new file mode 100644 index 000000000..43033194a --- /dev/null +++ b/modules/ticket/back/models/expeditionMistake.json @@ -0,0 +1,33 @@ +{ + "name": "ExpeditionMistake", + "base": "VnModel", + "options": { + "mysql": { + "table": "expeditionMistake" + } + }, + "properties": { + "created": { + "type": "date" + } + }, + "relations": { + "expedition": { + "type": "belongsTo", + "model": "Expedition", + "foreignKey": "expeditionFk" + }, + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + }, + "type": { + "type": "belongsTo", + "model": "MistakeType", + "foreignKey": "typeFk" + } + } + + } + \ No newline at end of file diff --git a/modules/ticket/back/models/packingSiteConfig.json b/modules/ticket/back/models/packingSiteConfig.json new file mode 100644 index 000000000..8f0032d41 --- /dev/null +++ b/modules/ticket/back/models/packingSiteConfig.json @@ -0,0 +1,28 @@ +{ + "name": "PackingSiteConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "packingSiteConfig" + } + }, + "properties": { + "id": { + "id": true, + "type": "number", + "description": "Identifier" + }, + "shinobiUrl": { + "type": "string" + }, + "shinobiGroupKey":{ + "type":"string" + }, + "shinobiToken":{ + "type":"string" + }, + "avgBoxingTime":{ + "type":"number" + } + } +} diff --git a/modules/ticket/back/models/sale-checked.json b/modules/ticket/back/models/sale-checked.json deleted file mode 100644 index 96d790505..000000000 --- a/modules/ticket/back/models/sale-checked.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "SaleChecked", - "base": "VnModel", - "options": { - "mysql": { - "table": "saleChecked" - } - }, - "properties": { - "isChecked": { - "type": "number" - }, - "saleFk": { - "id": true - } - }, - "relations": { - "sale": { - "type": "belongsTo", - "model": "Sale", - "foreignKey": "saleFk" - } - } -} \ No newline at end of file diff --git a/modules/ticket/back/models/sale-cloned.json b/modules/ticket/back/models/sale-cloned.json new file mode 100644 index 000000000..eb0641684 --- /dev/null +++ b/modules/ticket/back/models/sale-cloned.json @@ -0,0 +1,26 @@ +{ + "name": "SaleCloned", + "base": "VnModel", + "options": { + "mysql": { + "table": "saleCloned" + } + }, + "properties": { + "saleClonedFk": { + "id": true + } + }, + "relations": { + "saleOriginal": { + "type": "belongsTo", + "model": "Sale", + "foreignKey": "saleOriginalFk" + }, + "saleCloned": { + "type": "belongsTo", + "model": "Sale", + "foreignKey": "saleClonedFk" + } + } +} diff --git a/modules/ticket/back/models/sale.js b/modules/ticket/back/models/sale.js index 2a4457263..bab201fdd 100644 --- a/modules/ticket/back/models/sale.js +++ b/modules/ticket/back/models/sale.js @@ -1,5 +1,6 @@ module.exports = Self => { require('../methods/sale/getClaimableFromTicket')(Self); + require('../methods/sale/salePreparingList')(Self); require('../methods/sale/reserve')(Self); require('../methods/sale/deleteSales')(Self); require('../methods/sale/updatePrice')(Self); @@ -8,6 +9,7 @@ module.exports = Self => { require('../methods/sale/recalculatePrice')(Self); require('../methods/sale/refund')(Self); require('../methods/sale/canEdit')(Self); + require('../methods/sale/usesMana')(Self); Self.validatesPresenceOf('concept', { message: `Concept cannot be blank` diff --git a/modules/ticket/back/models/sale.json b/modules/ticket/back/models/sale.json index e18f0291f..7b8cf501b 100644 --- a/modules/ticket/back/models/sale.json +++ b/modules/ticket/back/models/sale.json @@ -4,7 +4,8 @@ "log": { "model": "TicketLog", "relation": "ticket", - "showField": "concept" + "showField": "concept", + "grabUser": true }, "options": { "mysql": { @@ -56,11 +57,6 @@ "foreignKey": "ticketFk", "required": true }, - "isChecked": { - "type": "hasOne", - "model": "SaleChecked", - "foreignKey": "saleFk" - }, "components": { "type": "hasMany", "model": "SaleComponent", @@ -80,6 +76,11 @@ "type": "hasOne", "model": "ItemShelvingSale", "foreignKey": "saleFk" - } + }, + "saleGroupDetail": { + "type": "hasOne", + "model": "SaleGroupDetail", + "foreignKey": "saleFk" + } } } diff --git a/modules/ticket/back/models/saleGroup.json b/modules/ticket/back/models/saleGroup.json new file mode 100644 index 000000000..d5cf82cb5 --- /dev/null +++ b/modules/ticket/back/models/saleGroup.json @@ -0,0 +1,31 @@ +{ + "name": "SaleGroup", + "base": "VnModel", + "options": { + "mysql": { + "table": "saleGroup" + } + }, + "properties": { + "id": { + "id": true, + "type": "number", + "description": "Identifier" + }, + "parkingFk": { + "type": "number" + } + }, + "relations": { + "saleGroupDetail": { + "type": "hasMany", + "model": "SaleGroupDetail", + "foreignKey": "saleGroupFk" + }, + "parking": { + "type": "belongsTo", + "model": "Parking", + "foreignKey": "parkingFk" + } + } +} diff --git a/modules/ticket/back/models/saleGroupDetail.json b/modules/ticket/back/models/saleGroupDetail.json new file mode 100644 index 000000000..2fbc71bbd --- /dev/null +++ b/modules/ticket/back/models/saleGroupDetail.json @@ -0,0 +1,31 @@ +{ + "name": "SaleGroupDetail", + "base": "VnModel", + "options": { + "mysql": { + "table": "saleGroupDetail" + } + }, + "properties": { + "id": { + "id": true, + "type": "number", + "description": "Identifier" + }, + "saleFk": { + "type": "number" + } + }, + "relations": { + "sale": { + "type": "belongsTo", + "model": "Sale", + "foreignKey": "saleFk" + }, + "saleGroup": { + "type": "belongsTo", + "model": "SaleGroup", + "foreignKey": "saleGroupFk" + } + } +} diff --git a/modules/ticket/back/models/stowaway.js b/modules/ticket/back/models/stowaway.js deleted file mode 100644 index 780b6b31c..000000000 --- a/modules/ticket/back/models/stowaway.js +++ /dev/null @@ -1,24 +0,0 @@ -const LoopBackContext = require('loopback-context'); -const UserError = require('vn-loopback/util/user-error'); - -module.exports = function(Self) { - Self.observe('before save', async function(ctx) { - const models = Self.app.models; - const canHaveStowaway = await models.Ticket.canHaveStowaway(ctx.instance.shipFk); - - if (!canHaveStowaway) - throw new UserError(`Can't create stowaway for this ticket`); - - if (ctx.isNewInstance) { - let where = { - code: 'BOARDING' - }; - let state = await models.State.findOne({where}); - let params = {ticketFk: ctx.instance.shipFk, stateFk: state.id}; - const loopBackContext = LoopBackContext.getCurrentContext(); - - let httpCtx = {req: loopBackContext.active}; - await models.TicketTracking.changeState(httpCtx, params); - } - }); -}; diff --git a/modules/ticket/back/models/stowaway.json b/modules/ticket/back/models/stowaway.json deleted file mode 100644 index ef3aeb40d..000000000 --- a/modules/ticket/back/models/stowaway.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "Stowaway", - "base": "VnModel", - "options": { - "mysql": { - "table": "stowaway" - } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "shipFk": { - "type": "number", - "required": false - }, - "created":{ - "type": "date", - "required": false - } - }, - "relations": { - "ship": { - "type": "belongsTo", - "model": "Ticket", - "foreignKey": "shipFk" - }, - "ticket": { - "type": "belongsTo", - "model": "Ticket", - "foreignKey": "id" - } - } -} diff --git a/modules/ticket/back/models/ticket-log.js b/modules/ticket/back/models/ticket-log.js new file mode 100644 index 000000000..81855ada7 --- /dev/null +++ b/modules/ticket/back/models/ticket-log.js @@ -0,0 +1,3 @@ +module.exports = function(Self) { + require('../methods/ticket-log/getChanges')(Self); +}; diff --git a/modules/ticket/back/models/ticket-methods.js b/modules/ticket/back/models/ticket-methods.js new file mode 100644 index 000000000..3992e7307 --- /dev/null +++ b/modules/ticket/back/models/ticket-methods.js @@ -0,0 +1,43 @@ +module.exports = function(Self) { + require('../methods/ticket/getVolume')(Self); + require('../methods/ticket/getTotalVolume')(Self); + require('../methods/ticket/summary')(Self); + require('../methods/ticket/priceDifference')(Self); + require('../methods/ticket/componentUpdate')(Self); + require('../methods/ticket/new')(Self); + require('../methods/ticket/isEditable')(Self); + require('../methods/ticket/setDeleted')(Self); + require('../methods/ticket/restore')(Self); + require('../methods/ticket/getSales')(Self); + require('../methods/ticket/getSalesPersonMana')(Self); + require('../methods/ticket/filter')(Self); + require('../methods/ticket/canBeInvoiced')(Self); + require('../methods/ticket/makeInvoice')(Self); + require('../methods/ticket/updateEditableTicket')(Self); + require('../methods/ticket/isEmpty')(Self); + require('../methods/ticket/updateDiscount')(Self); + require('../methods/ticket/uploadFile')(Self); + require('../methods/ticket/addSale')(Self); + require('../methods/ticket/transferSales')(Self); + require('../methods/ticket/recalculateComponents')(Self); + require('../methods/ticket/sendSms')(Self); + require('../methods/ticket/isLocked')(Self); + require('../methods/ticket/freightCost')(Self); + require('../methods/ticket/getComponentsSum')(Self); + require('../methods/ticket/refund')(Self); + require('../methods/ticket/deliveryNotePdf')(Self); + require('../methods/ticket/deliveryNoteEmail')(Self); + require('../methods/ticket/deliveryNoteCsv')(Self); + require('../methods/ticket/deliveryNoteCsvEmail')(Self); + require('../methods/ticket/closeAll')(Self); + require('../methods/ticket/closeByTicket')(Self); + require('../methods/ticket/closeByAgency')(Self); + require('../methods/ticket/closeByRoute')(Self); + require('../methods/ticket/getTicketsFuture')(Self); + require('../methods/ticket/merge')(Self); + require('../methods/ticket/getTicketsAdvance')(Self); + require('../methods/ticket/isRoleAdvanced')(Self); + require('../methods/ticket/collectionLabel')(Self); + require('../methods/ticket/expeditionPalletLabel')(Self); + require('../methods/ticket/saveSign')(Self); +}; diff --git a/modules/ticket/back/models/ticket-refund.json b/modules/ticket/back/models/ticket-refund.json new file mode 100644 index 000000000..8fd0e2306 --- /dev/null +++ b/modules/ticket/back/models/ticket-refund.json @@ -0,0 +1,40 @@ +{ + "name": "TicketRefund", + "base": "Loggable", + "options": { + "mysql": { + "table": "ticketRefund" + } + }, + "log": { + "model": "TicketLog", + "relation": "originalTicket" + }, + "properties": { + "id": { + "id": true, + "type": "number", + "description": "Identifier" + }, + "refundTicketFk": { + "type": "number", + "required": true + }, + "originalTicketFk": { + "type": "number", + "required": true + } + }, + "relations": { + "refundTicket": { + "type": "belongsTo", + "model": "Ticket", + "foreignKey": "refundTicketFk" + }, + "originalTicket": { + "type": "belongsTo", + "model": "Ticket", + "foreignKey": "originalTicketFk" + } + } +} diff --git a/modules/ticket/back/models/ticket-request.js b/modules/ticket/back/models/ticket-request.js index 234978f33..4125126dc 100644 --- a/modules/ticket/back/models/ticket-request.js +++ b/modules/ticket/back/models/ticket-request.js @@ -5,6 +5,7 @@ module.exports = function(Self) { require('../methods/ticket-request/filter')(Self); require('../methods/ticket-request/deny')(Self); require('../methods/ticket-request/confirm')(Self); + require('../methods/ticket-request/getItemTypeWorker')(Self); Self.observe('before save', async function(ctx) { if (ctx.isNewInstance) { diff --git a/modules/ticket/back/models/ticket-service.js b/modules/ticket/back/models/ticket-service.js index aa94c42e3..209727ee4 100644 --- a/modules/ticket/back/models/ticket-service.js +++ b/modules/ticket/back/models/ticket-service.js @@ -3,17 +3,18 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.observe('before save', async ctx => { const models = Self.app.models; - let changes = ctx.currentInstance || ctx.instance; - if (changes) { - let ticketId = changes.ticketFk; - let isLocked = await models.Ticket.isLocked(ticketId); + const changes = ctx.currentInstance || ctx.instance; + + if (changes && !ctx.isNewInstance) { + const ticketId = changes.ticketFk; + const isLocked = await models.Ticket.isLocked(ticketId); if (isLocked) throw new UserError(`The current ticket can't be modified`); + } - if (changes.ticketServiceTypeFk) { - const ticketServiceType = await models.TicketServiceType.findById(changes.ticketServiceTypeFk); - changes.description = ticketServiceType.name; - } + if (changes && changes.ticketServiceTypeFk) { + const ticketServiceType = await models.TicketServiceType.findById(changes.ticketServiceTypeFk); + changes.description = ticketServiceType.name; } }); diff --git a/modules/ticket/back/models/ticket.js b/modules/ticket/back/models/ticket.js index b217eae4d..c05130552 100644 --- a/modules/ticket/back/models/ticket.js +++ b/modules/ticket/back/models/ticket.js @@ -2,34 +2,8 @@ const LoopBackContext = require('loopback-context'); module.exports = Self => { - require('../methods/ticket/getVolume')(Self); - require('../methods/ticket/getTotalVolume')(Self); - require('../methods/ticket/summary')(Self); - require('../methods/ticket/priceDifference')(Self); - require('../methods/ticket/componentUpdate')(Self); - require('../methods/ticket/new')(Self); - require('../methods/ticket/isEditable')(Self); - require('../methods/ticket/setDeleted')(Self); - require('../methods/ticket/restore')(Self); - require('../methods/ticket/getSales')(Self); - require('../methods/ticket/getSalesPersonMana')(Self); - require('../methods/ticket/filter')(Self); - require('../methods/ticket/getPossibleStowaways')(Self); - require('../methods/ticket/canBeInvoiced')(Self); - require('../methods/ticket/makeInvoice')(Self); - require('../methods/ticket/updateEditableTicket')(Self); - require('../methods/ticket/isEmpty')(Self); - require('../methods/ticket/updateDiscount')(Self); - require('../methods/ticket/uploadFile')(Self); - require('../methods/ticket/addSale')(Self); - require('../methods/ticket/transferSales')(Self); - require('../methods/ticket/canHaveStowaway')(Self); - require('../methods/ticket/recalculateComponents')(Self); - require('../methods/ticket/deleteStowaway')(Self); - require('../methods/ticket/sendSms')(Self); - require('../methods/ticket/isLocked')(Self); - require('../methods/ticket/freightCost')(Self); - require('../methods/ticket/getComponentsSum')(Self); + // Methods + require('./ticket-methods')(Self); Self.observe('before save', async function(ctx) { const loopBackContext = LoopBackContext.getCurrentContext(); diff --git a/modules/ticket/back/models/ticket.json b/modules/ticket/back/models/ticket.json index 65127a78c..dabda838a 100644 --- a/modules/ticket/back/models/ticket.json +++ b/modules/ticket/back/models/ticket.json @@ -3,7 +3,8 @@ "base": "Loggable", "log": { "model":"TicketLog", - "showField": "id" + "showField": "id", + "grabUser": true }, "options": { "mysql": { @@ -36,7 +37,7 @@ "type": "number" }, "updated": { - "type": "date", + "type": "date", "mysql": { "columnName": "created" } @@ -44,6 +45,9 @@ "isDeleted": { "type": "boolean" }, + "isSigned": { + "type": "boolean" + }, "priority": { "type": "number" }, @@ -69,16 +73,6 @@ "model": "Client", "foreignKey": "clientFk" }, - "ship": { - "type": "hasOne", - "model": "Stowaway", - "foreignKey": "shipFk" - }, - "stowaway": { - "type": "hasOne", - "model": "Stowaway", - "foreignKey": "id" - }, "warehouse": { "type": "belongsTo", "model": "Warehouse", @@ -115,6 +109,16 @@ "model": "TicketPackaging", "foreignKey": "ticketFk" }, + "ticketSales": { + "type": "hasMany", + "model": "Sale", + "foreignKey": "ticketFk" + }, + "ticketServices": { + "type": "hasMany", + "model": "TicketService", + "foreignKey": "ticketFk" + }, "tracking": { "type": "hasMany", "model": "TicketTracking", @@ -136,4 +140,4 @@ "foreignKey": "zoneFk" } } -} \ No newline at end of file +} diff --git a/modules/ticket/front/advance-search-panel/index.html b/modules/ticket/front/advance-search-panel/index.html new file mode 100644 index 000000000..ee18c26f9 --- /dev/null +++ b/modules/ticket/front/advance-search-panel/index.html @@ -0,0 +1,60 @@ +
+
+ + + + + + + + + + {{description}} + + + + + {{description}} + + + + + + + + + + + + +
+
diff --git a/modules/ticket/front/advance-search-panel/index.js b/modules/ticket/front/advance-search-panel/index.js new file mode 100644 index 000000000..8ddbe78d4 --- /dev/null +++ b/modules/ticket/front/advance-search-panel/index.js @@ -0,0 +1,31 @@ +import ngModule from '../module'; +import SearchPanel from 'core/components/searchbar/search-panel'; + +class Controller extends SearchPanel { + constructor($, $element) { + super($, $element); + this.filter = this.$.filter; + this.getItemPackingTypes(); + } + + getItemPackingTypes() { + let itemPackingTypes = []; + const filter = { + where: {isActive: true} + }; + this.$http.get('ItemPackingTypes', {filter}).then(res => { + for (let ipt of res.data) { + itemPackingTypes.push({ + code: ipt.code, + description: this.$t(ipt.description) + }); + } + this.itemPackingTypes = itemPackingTypes; + }); + } +} + +ngModule.vnComponent('vnAdvanceTicketSearchPanel', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/ticket/front/advance-search-panel/locale/en.yml b/modules/ticket/front/advance-search-panel/locale/en.yml new file mode 100644 index 000000000..f01932c7a --- /dev/null +++ b/modules/ticket/front/advance-search-panel/locale/en.yml @@ -0,0 +1 @@ +Advance tickets: Advance tickets diff --git a/modules/ticket/front/advance-search-panel/locale/es.yml b/modules/ticket/front/advance-search-panel/locale/es.yml new file mode 100644 index 000000000..7be2efe96 --- /dev/null +++ b/modules/ticket/front/advance-search-panel/locale/es.yml @@ -0,0 +1,2 @@ +Advance tickets: Adelantar tickets +100% movable: 100% movible diff --git a/modules/ticket/front/advance/index.html b/modules/ticket/front/advance/index.html new file mode 100644 index 000000000..007f80fe6 --- /dev/null +++ b/modules/ticket/front/advance/index.html @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DestinationOrigin
+ + + + + ID + + Date + + IPT + + State + + Liters + + Lines + + Import + + ID + + Date + + IPT + + State + + Liters + + Not Movable + + Lines + + Import +
+ + + + + + + + {{::ticket.id | dashIfEmpty}} + + + + {{::ticket.shipped | date: 'dd/MM/yyyy'}} + + {{::ticket.ipt | dashIfEmpty}} + + {{::ticket.state | dashIfEmpty}} + + {{::ticket.liters | dashIfEmpty}}{{::ticket.lines | dashIfEmpty}} + + {{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}} + + + + {{::ticket.futureId | dashIfEmpty}} + + + + {{::ticket.futureShipped | date: 'dd/MM/yyyy'}} + + {{::ticket.futureIpt | dashIfEmpty}} + + {{::ticket.futureState | dashIfEmpty}} + + {{::ticket.futureLiters | dashIfEmpty}}{{::ticket.notMovableLines | dashIfEmpty}}{{::ticket.futureLines | dashIfEmpty}} + + {{::(ticket.futureTotalWithVat ? ticket.futureTotalWithVat : 0) | currency: 'EUR': 2}} + +
+
+
+
+ + + + diff --git a/modules/ticket/front/advance/index.js b/modules/ticket/front/advance/index.js new file mode 100644 index 000000000..7b8008426 --- /dev/null +++ b/modules/ticket/front/advance/index.js @@ -0,0 +1,208 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; +import './style.scss'; + +export default class Controller extends Section { + constructor($element, $) { + super($element, $); + this.$checkAll = false; + + this.smartTableOptions = { + activeButtons: { + search: true, + }, + columns: [ + { + field: 'state', + searchable: false + }, + { + field: 'futureState', + searchable: false + }, + { + field: 'totalWithVat', + searchable: false + }, + { + field: 'futureTotalWithVat', + searchable: false + }, + { + field: 'shipped', + searchable: false + }, + { + field: 'futureShipped', + searchable: false + }, + { + field: 'ipt', + autocomplete: { + url: 'ItemPackingTypes', + where: `{isActive: true}`, + showField: 'description', + valueField: 'code' + } + }, + { + field: 'futureIpt', + autocomplete: { + url: 'ItemPackingTypes', + where: `{isActive: true}`, + showField: 'description', + valueField: 'code' + } + }, + ] + }; + } + + $postLink() { + this.setDefaultFilter(); + } + + setDefaultFilter() { + let today = Date.vnNew(); + const tomorrow = new Date(today); + tomorrow.setDate(tomorrow.getDate() + 1); + this.$http.get(`UserConfigs/getUserConfig`) + .then(res => { + this.filterParams = { + dateFuture: tomorrow, + dateToAdvance: today, + warehouseFk: res.data.warehouseFk + }; + this.$.model.addFilter({}, this.filterParams); + }); + } + + compareDate(date) { + let today = Date.vnNew(); + today.setHours(0, 0, 0, 0); + let timeTicket = new Date(date); + timeTicket.setHours(0, 0, 0, 0); + + let comparation = today - timeTicket; + + if (comparation == 0) + return 'warning'; + if (comparation < 0) + return 'success'; + } + + get checked() { + const tickets = this.$.model.data || []; + const checkedLines = []; + for (let ticket of tickets) { + if (ticket.checked) + checkedLines.push(ticket); + } + + return checkedLines; + } + + stateColor(state) { + if (state === 'OK') + return 'success'; + else if (state === 'Libre') + return 'notice'; + } + + dateRange(value) { + const minHour = new Date(value); + minHour.setHours(0, 0, 0, 0); + const maxHour = new Date(value); + maxHour.setHours(23, 59, 59, 59); + + return [minHour, maxHour]; + } + + totalPriceColor(totalWithVat) { + return this.isLessThan50(totalWithVat) ? 'warning' : ''; + } + + totalPriceTitle(totalWithVat) { + return this.isLessThan50(totalWithVat) ? 'Less than 50€' : ''; + } + + isLessThan50(totalWithVat) { + return (parseInt(totalWithVat) > 0 && parseInt(totalWithVat) < 50); + } + + get confirmationMessage() { + if (!this.$.model) return 0; + + return this.$t(`Advance confirmation`, { + checked: this.checked.length + }); + } + + agencies(futureAgency, agency) { + return this.$t(`Origin agency`, {agency: futureAgency}) + + '\n' + this.$t(`Destination agency`, {agency: agency}); + } + + moveTicketsAdvance() { + let ticketsToMove = []; + this.checked.forEach(ticket => { + ticketsToMove.push({ + originId: ticket.futureId, + destinationId: ticket.id, + originShipped: ticket.futureShipped, + destinationShipped: ticket.shipped, + workerFk: ticket.workerFk + }); + }); + const params = {tickets: ticketsToMove}; + return this.$http.post('Tickets/merge', params) + .then(() => { + this.$.model.refresh(); + this.vnApp.showSuccess(this.$t('Success')); + }); + } + + exprBuilder(param, value) { + switch (param) { + case 'id': + return {'id': value}; + case 'futureId': + return {'futureId': value}; + case 'liters': + return {'liters': value}; + case 'lines': + return {'lines': value}; + case 'futureLiters': + return {'futureLiters': value}; + case 'futureLines': + return {'futureLines': value}; + case 'ipt': + return {or: + [ + {'ipt': {like: `%${value}%`}}, + {'ipt': null} + ] + }; + case 'futureIpt': + return {or: + [ + {'futureIpt': {like: `%${value}%`}}, + {'futureIpt': null} + ] + }; + case 'totalWithVat': + return {'totalWithVat': value}; + case 'futureTotalWithVat': + return {'futureTotalWithVat': value}; + case 'notMovableLines': + return {'notMovableLines': value}; + } + } +} + +Controller.$inject = ['$element', '$scope']; + +ngModule.vnComponent('vnTicketAdvance', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/ticket/front/advance/index.spec.js b/modules/ticket/front/advance/index.spec.js new file mode 100644 index 000000000..6874f914b --- /dev/null +++ b/modules/ticket/front/advance/index.spec.js @@ -0,0 +1,113 @@ +import './index.js'; +import crudModel from 'core/mocks/crud-model'; + +describe('Component vnTicketAdvance', () => { + let controller; + let $httpBackend; + + beforeEach(ngModule('ticket') + ); + + beforeEach(inject(($componentController, _$httpBackend_) => { + $httpBackend = _$httpBackend_; + const $element = angular.element(''); + controller = $componentController('vnTicketAdvance', {$element}); + controller.$.model = crudModel; + controller.$.model.data = [{ + id: 1, + checked: true, + state: 'OK' + }, { + id: 2, + checked: true, + state: 'Libre' + }]; + })); + + describe('compareDate()', () => { + it('should return warning when the date is the present', () => { + let today = Date.vnNew(); + let result = controller.compareDate(today); + + expect(result).toEqual('warning'); + }); + + it('should return sucess when the date is in the future', () => { + let futureDate = Date.vnNew(); + futureDate = futureDate.setDate(futureDate.getDate() + 10); + let result = controller.compareDate(futureDate); + + expect(result).toEqual('success'); + }); + + it('should return undefined when the date is in the past', () => { + let pastDate = Date.vnNew(); + pastDate = pastDate.setDate(pastDate.getDate() - 10); + let result = controller.compareDate(pastDate); + + expect(result).toEqual(undefined); + }); + }); + + describe('checked()', () => { + it('should return an array of checked tickets', () => { + const result = controller.checked; + const firstRow = result[0]; + const secondRow = result[1]; + + expect(result.length).toEqual(2); + expect(firstRow.id).toEqual(1); + expect(secondRow.id).toEqual(2); + }); + }); + + describe('stateColor()', () => { + it('should return success to the OK tickets', () => { + const ok = controller.stateColor(controller.$.model.data[0].state); + const notOk = controller.stateColor(controller.$.model.data[1].state); + + expect(ok).toEqual('success'); + expect(notOk).not.toEqual('success'); + }); + + it('should return success to the FREE tickets', () => { + const notFree = controller.stateColor(controller.$.model.data[0].state); + const free = controller.stateColor(controller.$.model.data[1].state); + + expect(free).toEqual('notice'); + expect(notFree).not.toEqual('notice'); + }); + }); + + describe('dateRange()', () => { + it('should return two dates with the hours at the start and end of the given date', () => { + const now = Date.vnNew(); + + const today = now.getDate(); + + const dateRange = controller.dateRange(now); + const start = dateRange[0].toString(); + const end = dateRange[1].toString(); + + expect(start).toContain(today); + expect(start).toContain('00:00:00'); + + expect(end).toContain(today); + expect(end).toContain('23:59:59'); + }); + }); + + describe('moveTicketsAdvance()', () => { + it('should make an HTTP Post query', () => { + jest.spyOn(controller.$.model, 'refresh'); + jest.spyOn(controller.vnApp, 'showSuccess'); + + $httpBackend.expectPOST(`Tickets/merge`).respond(); + controller.moveTicketsAdvance(); + $httpBackend.flush(); + + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); + expect(controller.$.model.refresh).toHaveBeenCalledWith(); + }); + }); +}); diff --git a/modules/ticket/front/advance/locale/en.yml b/modules/ticket/front/advance/locale/en.yml new file mode 100644 index 000000000..a47d951d0 --- /dev/null +++ b/modules/ticket/front/advance/locale/en.yml @@ -0,0 +1,2 @@ +Advance tickets: Advance tickets +Success: Tickets moved successfully! diff --git a/modules/ticket/front/advance/locale/es.yml b/modules/ticket/front/advance/locale/es.yml new file mode 100644 index 000000000..3111d9afd --- /dev/null +++ b/modules/ticket/front/advance/locale/es.yml @@ -0,0 +1,11 @@ +Advance tickets: Adelantar tickets +Search advance tickets by date: Busca tickets para adelantar por fecha +Advance confirmation: ¿Desea adelantar {{checked}} tickets? +Success: Tickets movidos correctamente +Lines: Líneas +Liters: Litros +Item Packing Type: Encajado +Origin agency: "Agencia origen: {{agency}}" +Destination agency: "Agencia destino: {{agency}}" +Less than 50€: Menor a 50€ +Not Movable: No movibles diff --git a/modules/ticket/front/advance/style.scss b/modules/ticket/front/advance/style.scss new file mode 100644 index 000000000..8fa9de438 --- /dev/null +++ b/modules/ticket/front/advance/style.scss @@ -0,0 +1,7 @@ +@import "variables"; + +vn-ticket-advance{ + vn-icon { + color: #f7931e + } +} diff --git a/modules/ticket/front/basic-data/step-one/index.js b/modules/ticket/front/basic-data/step-one/index.js index f532265e2..99782de44 100644 --- a/modules/ticket/front/basic-data/step-one/index.js +++ b/modules/ticket/front/basic-data/step-one/index.js @@ -75,8 +75,10 @@ class Controller extends Component { } set shipped(value) { + if (new Date(this.ticket.shipped).toDateString() != value.toDateString()) + value.setHours(0, 0, 0, 0); + this.ticket.shipped = value; - this.ticket.shipped.setHours(0, 0, 0, 0); this.getLanded({ shipped: value, addressFk: this.ticket.addressFk, diff --git a/modules/ticket/front/basic-data/step-one/index.spec.js b/modules/ticket/front/basic-data/step-one/index.spec.js index 2b14c18cc..30946dab0 100644 --- a/modules/ticket/front/basic-data/step-one/index.spec.js +++ b/modules/ticket/front/basic-data/step-one/index.spec.js @@ -67,7 +67,7 @@ describe('Ticket', () => { jest.spyOn(controller, 'getShipped'); controller.ticket.addressFk = 99; controller.addressId = 100; - const landed = new Date(); + const landed = Date.vnNew(); const expectedResult = { landed: landed, addressFk: 100, @@ -101,7 +101,7 @@ describe('Ticket', () => { describe('shipped() getter', () => { it('should return the shipped property', () => { - const shipped = new Date(); + const shipped = Date.vnNew(); controller.ticket.shipped = shipped; expect(controller.shipped).toEqual(shipped); @@ -111,7 +111,7 @@ describe('Ticket', () => { describe('shipped() setter', () => { it('should set shipped property and call getLanded() method ', () => { jest.spyOn(controller, 'getLanded'); - const shipped = new Date(); + const shipped = Date.vnNew(); const expectedResult = { shipped: shipped, addressFk: 121, @@ -126,7 +126,7 @@ describe('Ticket', () => { describe('landed() getter', () => { it('should return the landed property', () => { - const landed = new Date(); + const landed = Date.vnNew(); controller.ticket.landed = landed; expect(controller.landed).toEqual(landed); @@ -136,7 +136,7 @@ describe('Ticket', () => { describe('landed() setter', () => { it('should set shipped property and call getShipped() method ', () => { jest.spyOn(controller, 'getShipped'); - const landed = new Date(); + const landed = Date.vnNew(); const expectedResult = { landed: landed, addressFk: 121, @@ -161,7 +161,7 @@ describe('Ticket', () => { it('should set agencyModeId property and call getLanded() method', () => { jest.spyOn(controller, 'getLanded'); controller.$.agencyMode = {selection: {warehouseFk: 1}}; - const shipped = new Date(); + const shipped = Date.vnNew(); const agencyModeId = 8; const expectedResult = { shipped: shipped, @@ -177,7 +177,7 @@ describe('Ticket', () => { it('should do nothing if attempting to set the same agencyMode id', () => { jest.spyOn(controller, 'getShipped'); - const landed = new Date(); + const landed = Date.vnNew(); const agencyModeId = 7; const expectedResult = { landed: landed, @@ -278,8 +278,8 @@ describe('Ticket', () => { agencyModeFk: 1, companyFk: 442, warehouseFk: 1, - shipped: new Date(), - landed: new Date() + shipped: Date.vnNew(), + landed: Date.vnNew() }; expect(controller.isFormInvalid()).toBeFalsy(); @@ -288,7 +288,7 @@ describe('Ticket', () => { describe('onStepChange()', () => { it('should call onStepChange method and return a NO_AGENCY_AVAILABLE signal error', async() => { - let landed = new Date(); + let landed = Date.vnNew(); landed.setHours(0, 0, 0, 0); controller._ticket = { @@ -299,7 +299,7 @@ describe('Ticket', () => { agencyModeFk: 1, companyFk: 442, warehouseFk: 1, - shipped: new Date(), + shipped: Date.vnNew(), landed: landed }; @@ -314,8 +314,8 @@ describe('Ticket', () => { describe('getLanded()', () => { it('should return an available landed date', async() => { - const shipped = new Date(); - const expectedResult = {landed: new Date()}; + const shipped = Date.vnNew(); + const expectedResult = {landed: Date.vnNew()}; const params = { shipped: shipped, addressFk: 121, @@ -336,8 +336,8 @@ describe('Ticket', () => { describe('getShipped()', () => { it('should return an available shipped date', async() => { - const landed = new Date(); - const expectedResult = {shipped: new Date()}; + const landed = Date.vnNew(); + const expectedResult = {shipped: Date.vnNew()}; const params = { landed: landed, addressFk: 121, @@ -358,7 +358,7 @@ describe('Ticket', () => { describe('zoneWhere() getter', () => { it('should return an object containing filter properties', async() => { - const shipped = new Date(); + const shipped = Date.vnNew(); controller.ticket.shipped = shipped; const expectedResult = { diff --git a/modules/ticket/front/basic-data/step-two/index.html b/modules/ticket/front/basic-data/step-two/index.html index 6be455fc9..fc57a354a 100644 --- a/modules/ticket/front/basic-data/step-two/index.html +++ b/modules/ticket/front/basic-data/step-two/index.html @@ -23,7 +23,7 @@ title="{{::sale.item.name}}" vn-click-stop="itemDescriptor.show($event, sale.itemFk, sale.id)" class="link"> - {{::sale.itemFk | zeroFill:6}} + {{::sale.itemFk}} @@ -40,7 +40,7 @@ - {{::sale.movable}} @@ -64,14 +64,14 @@
-
Total
+
Total
Price {{$ctrl.totalPrice | currency: 'EUR': 2}}
New price {{$ctrl.totalNewPrice | currency: 'EUR': 2}}
Difference {{$ctrl.totalPriceDifference | currency: 'EUR': 2}}
-
Charge difference to
+
Charge difference to
- @@ -95,4 +95,10 @@ warehouse-fk="$ctrl.ticket.warehouseFk" ticket-fk="$ctrl.ticket.id"> + + diff --git a/modules/ticket/front/basic-data/step-two/index.js b/modules/ticket/front/basic-data/step-two/index.js index c12647aa5..74e2df074 100644 --- a/modules/ticket/front/basic-data/step-two/index.js +++ b/modules/ticket/front/basic-data/step-two/index.js @@ -67,6 +67,7 @@ class Controller extends Component { ticketHaveNegatives() { let haveNegatives = false; let haveNotNegatives = false; + this.ticket.withoutNegatives = false; const haveDifferences = this.ticket.sale.haveDifferences; this.ticket.sale.items.forEach(item => { @@ -76,11 +77,23 @@ class Controller extends Component { haveNotNegatives = true; }); - this.ticket.withoutNegatives = false; this.haveNegatives = (haveNegatives && haveNotNegatives && haveDifferences); + if (this.haveNegatives) + this.ticket.withoutNegatives = true; } onSubmit() { + if (this.haveNegatives && !this.ticket.withoutNegatives) + this.$.negativesConfirm.show(); + else this.applyChanges(); + } + + onConfirmAccept() { + this.ticket.withWarningAccept = true; + this.applyChanges(); + } + + applyChanges() { if (!this.ticket.option) { return this.vnApp.showError( this.$t('Choose an option') @@ -100,7 +113,8 @@ class Controller extends Component { landed: this.ticket.landed, isDeleted: this.ticket.isDeleted, option: parseInt(this.ticket.option), - isWithoutNegatives: this.ticket.withoutNegatives + isWithoutNegatives: this.ticket.withoutNegatives, + withWarningAccept: this.ticket.withWarningAccept }; this.$http.post(query, params) diff --git a/modules/ticket/front/basic-data/step-two/locale/es.yml b/modules/ticket/front/basic-data/step-two/locale/es.yml index e1f1e0bfc..71f893e1e 100644 --- a/modules/ticket/front/basic-data/step-two/locale/es.yml +++ b/modules/ticket/front/basic-data/step-two/locale/es.yml @@ -8,4 +8,6 @@ New price: Nuevo precio Price difference: Diferencia de precio Create without negatives: Crear sin negativos Clone this ticket with the changes and only sales availables: Clona este ticket con los cambios y solo las ventas disponibles. -Movable: Movible \ No newline at end of file +Movable: Movible +Negatives are going to be generated, are you sure you want to advance all the lines?: Se van a generar negativos, ¿seguro que quieres adelantar todas las líneas? +Edit basic data: Editar datos básicos diff --git a/modules/ticket/front/boxing/index.html b/modules/ticket/front/boxing/index.html new file mode 100644 index 000000000..7fb3b870e --- /dev/null +++ b/modules/ticket/front/boxing/index.html @@ -0,0 +1,2 @@ + + diff --git a/modules/ticket/front/boxing/index.js b/modules/ticket/front/boxing/index.js new file mode 100644 index 000000000..4e6b398f2 --- /dev/null +++ b/modules/ticket/front/boxing/index.js @@ -0,0 +1,21 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +class Controller extends Section { + constructor($element, $) { + super($element, $); + } + + async $onInit() { + const url = await this.vnApp.getUrl(`ticket/${this.$params.id}/boxing`); + window.open(url).focus(); + } +} + +ngModule.vnComponent('vnTicketBoxing', { + template: require('./index.html'), + controller: Controller, + bindings: { + ticket: '<' + } +}); diff --git a/modules/ticket/front/card/index.js b/modules/ticket/front/card/index.js index 6e38039e2..fa4ad4e39 100644 --- a/modules/ticket/front/card/index.js +++ b/modules/ticket/front/card/index.js @@ -6,18 +6,15 @@ class Controller extends ModuleCard { let filter = { include: [ { - relation: 'address'}, + relation: 'address' + }, { - relation: 'ship'}, - { - relation: 'stowaway'}, + relation: 'zone' + }, { relation: 'warehouse', scope: {fields: ['name']} }, - { - relation: 'zone', - }, { relation: 'invoiceOut', scope: {fields: ['id']} @@ -38,7 +35,8 @@ class Controller extends ModuleCard { 'credit', 'email', 'phone', - 'mobile' + 'mobile', + 'hasElectronicInvoice', ], include: { relation: 'salesPersonUser', @@ -47,7 +45,8 @@ class Controller extends ModuleCard { } }, }, - }, { + }, + { relation: 'ticketState', scope: { fields: ['stateFk'], diff --git a/modules/ticket/front/component/index.html b/modules/ticket/front/component/index.html index 1236059ae..39b54b461 100644 --- a/modules/ticket/front/component/index.html +++ b/modules/ticket/front/component/index.html @@ -27,7 +27,7 @@ - {{sale.itemFk | zeroFill:6}} + {{sale.itemFk}}
diff --git a/modules/ticket/front/create/card.html b/modules/ticket/front/create/card.html index 65c45d3dc..e48aea681 100644 --- a/modules/ticket/front/create/card.html +++ b/modules/ticket/front/create/card.html @@ -19,6 +19,7 @@ disabled="!$ctrl.clientId" url="{{ $ctrl.clientId ? 'Clients/'+ $ctrl.clientId +'/addresses' : null }}" fields="['nickname', 'street', 'city']" + where="{isActive: true}" ng-model="$ctrl.addressId" show-field="nickname" value-field="id" diff --git a/modules/ticket/front/descriptor-menu/index.html b/modules/ticket/front/descriptor-menu/index.html index 1dcfd669f..c2ebc3e3a 100644 --- a/modules/ticket/front/descriptor-menu/index.html +++ b/modules/ticket/front/descriptor-menu/index.html @@ -5,6 +5,13 @@ + + Transfer client + Show Delivery Note... as PDF - - as PDF - - as PDF without prices + as PDF without prices + + as PDF signed + @@ -47,7 +52,7 @@ Send Delivery Note... @@ -57,6 +62,11 @@ translate> Send PDF + + Send PDF to tablet + @@ -104,18 +114,10 @@ SMS Minimum import - Add stowaway - - - Delete stowaway + SMS Notify changes Refund all @@ -155,31 +159,31 @@ @@ -254,26 +258,42 @@ + + + + + + + #{{id}} - {{::name}} + + + + + + + + - - - - - - - - - - + - \ No newline at end of file + + + + + + + + + diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js index c6388654e..ff029db78 100644 --- a/modules/ticket/front/descriptor-menu/index.js +++ b/modules/ticket/front/descriptor-menu/index.js @@ -52,7 +52,8 @@ class Controller extends Section { const filter = { include: [{ relation: 'address', - }, { + }, + { relation: 'client', scope: { fields: [ @@ -64,7 +65,8 @@ class Controller extends Section { 'credit', 'email', 'phone', - 'mobile' + 'mobile', + 'hasElectronicInvoice', ], include: { relation: 'salesPersonUser', @@ -74,17 +76,15 @@ class Controller extends Section { } } }, - {relation: 'ship'}, - {relation: 'stowaway'}, - {relation: 'invoiceOut'}] + { + relation: 'invoiceOut' + }] }; return this.$http.get(`Tickets/${this.ticketId}`, {filter}) .then(res => this.ticket = res.data) .then(() => { - this.canStowaway(); this.isTicketEditable(); - this.hasDocuware(); }); } @@ -95,6 +95,23 @@ class Controller extends Section { }); } + transferClient() { + this.$http.get(`Clients/${this.ticket.client.id}`).then(client => { + const ticket = this.ticket; + + const params = + { + clientFk: client.data.id, + addressFk: client.data.defaultAddressFk, + }; + + this.$http.patch(`Tickets/${ticket.id}`, params).then(() => { + this.vnApp.showSuccess(this.$t('Data saved!')); + this.reload(); + }); + }); + } + isTicketEditable() { if (!this.ticket) return; @@ -117,42 +134,32 @@ class Controller extends Section { } showPdfDeliveryNote(type) { - this.vnReport.show('delivery-note', { + this.vnReport.show(`tickets/${this.id}/delivery-note-pdf`, { recipientId: this.ticket.client.id, - ticketId: this.id, type: type }); } - hasDocuware() { - const params = { - fileCabinet: 'deliveryClient', - dialog: 'findTicket' - }; - this.$http.post(`Docuwares/${this.id}/checkFile`, params) - .then(res => this.hasDocuwareFile = res.data); - } + sendPdfDeliveryNote($data) { + let query = `tickets/${this.id}/delivery-note-email`; + if (this.hasDocuwareFile) query = `docuwares/${this.id}/delivery-note-email`; - showCsvDeliveryNote() { - this.vnReport.showCsv('delivery-note', { + return this.vnEmail.send(query, { recipientId: this.ticket.client.id, - ticketId: this.id, + recipient: $data.email }); } - sendPdfDeliveryNote($data) { - return this.vnEmail.send('delivery-note', { - recipientId: this.ticket.client.id, - recipient: $data.email, - ticketId: this.id + showCsvDeliveryNote() { + this.vnReport.show(`tickets/${this.id}/delivery-note-csv`, { + recipientId: this.ticket.client.id }); } sendCsvDeliveryNote($data) { - return this.vnEmail.sendCsv('delivery-note', { + return this.vnEmail.send(`tickets/${this.id}/delivery-note-csv-email`, { recipientId: this.ticket.client.id, - recipient: $data.email, - ticketId: this.id + recipient: $data.email }); } @@ -170,7 +177,7 @@ class Controller extends Section { get canRestoreTicket() { const isDeleted = this.ticket.isDeleted; - const now = new Date(); + const now = Date.vnNew(); const maxDate = new Date(this.ticket.updated); maxDate.setHours(maxDate.getHours() + 1); @@ -211,6 +218,18 @@ class Controller extends Section { }); } + sendChangesSms() { + return this.$http.get(`TicketLogs/${this.id}/getChanges`) + .then(res => { + const params = { + ticketId: this.id, + created: this.ticket.updated, + changes: res.data + }; + this.showSMSDialog({message: this.$t('Send changes', params)}); + }); + } + showSMSDialog(params) { const address = this.ticket.address; const client = this.ticket.client; @@ -225,32 +244,36 @@ class Controller extends Section { destinationFk: this.ticket.clientFk, destination: phone }, params); + this.$.sms.open(); } - canStowaway() { - this.canShowStowaway = false; - if (!this.isTicketModule || !this.ticket) return; - - this.$http.get(`Tickets/${this.id}/canHaveStowaway`) - .then(res => this.canShowStowaway = !!res.data); - } - - get canDeleteStowaway() { - if (!this.ticket || !this.isTicketModule) - return false; - - return this.ticket.stowaway || this.ticket.ship; - } - - deleteStowaway() { - return this.$http.post(`Tickets/${this.id}/deleteStowaway`) - .then(() => this.reload()) - .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); - } - makeInvoice() { const params = {ticketsIds: [this.id]}; + /* + This should call the notification sistem to insert a new notification + in te queue, yet to check how to handle user permissions, + as of 08-11-2022 every employee can insert a new notification in the queue + + */ + const client = this.ticket.client; + + if (client.hasElectronicInvoice) { + this.$http.post(`NotificationQueues`, { + notificationFk: 'invoice-electronic', + authorFk: client.id, + params: JSON.stringify( + { + 'name': client.name, + 'email': client.email, + 'ticketId': this.id, + 'url': window.location.href + }) + }).then(() => { + this.vnApp.showSuccess(this.$t('Invoice sent')); + }); + } + return this.$http.post(`Tickets/makeInvoice`, params) .then(() => this.reload()) .then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced'))); @@ -274,24 +297,39 @@ class Controller extends Section { } async refund() { - const filter = { - where: {ticketFk: this.id} - }; - const sales = await this.$http.get('Sales', {filter}); - this.sales = sales.data; - - const ticketServices = await this.$http.get('TicketServices', {filter}); - this.services = ticketServices.data; - - const params = { - sales: this.sales, - services: this.services - }; - const query = `Sales/refund`; + const params = {ticketsIds: [this.id]}; + const query = 'Tickets/refund'; return this.$http.post(query, params).then(res => { - this.$state.go('ticket.card.sale', {id: res.data}); + const [refundTicket] = res.data; + this.vnApp.showSuccess(this.$t('The following refund ticket have been created', { + ticketId: refundTicket.id + })); + this.$state.go('ticket.card.sale', {id: refundTicket.id}); }); } + + onSmsSend(sms) { + return this.$http.post(`Tickets/${this.id}/sendSms`, sms) + .then(() => this.vnApp.showSuccess(this.$t('SMS sent'))); + } + + hasDocuware() { + this.$http.post(`Docuwares/${this.id}/checkFile`, {fileCabinet: 'deliveryNote', signed: true}) + .then(res => { + this.hasDocuwareFile = res.data; + }); + } + + uploadDocuware(force) { + if (!force) + return this.$.pdfToTablet.show(); + + return this.$http.post(`Docuwares/${this.id}/upload`, {fileCabinet: 'deliveryNote'}) + .then(() => { + this.vnApp.showSuccess(this.$t('PDF sent!')); + this.$.balanceCreate.show(); + }); + } } Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail']; diff --git a/modules/ticket/front/descriptor-menu/index.spec.js b/modules/ticket/front/descriptor-menu/index.spec.js index af377d8ea..babc22038 100644 --- a/modules/ticket/front/descriptor-menu/index.spec.js +++ b/modules/ticket/front/descriptor-menu/index.spec.js @@ -43,7 +43,7 @@ describe('Ticket Component vnTicketDescriptorMenu', () => { describe('canRestoreTicket() getter', () => { it('should return true for a ticket deleted within the last hour', () => { controller.ticket.isDeleted = true; - controller.ticket.updated = new Date(); + controller.ticket.updated = Date.vnNew(); const result = controller.canRestoreTicket; @@ -51,7 +51,7 @@ describe('Ticket Component vnTicketDescriptorMenu', () => { }); it('should return false for a ticket deleted more than one hour ago', () => { - const pastHour = new Date(); + const pastHour = Date.vnNew(); pastHour.setHours(pastHour.getHours() - 2); controller.ticket.isDeleted = true; @@ -124,12 +124,11 @@ describe('Ticket Component vnTicketDescriptorMenu', () => { jest.spyOn(window, 'open').mockReturnThis(); const type = 'deliveryNote'; const expectedParams = { - ticketId: ticket.id, recipientId: ticket.client.id, type: type }; const serializedParams = $httpParamSerializer(expectedParams); - const expectedPath = `api/report/delivery-note?${serializedParams}`; + const expectedPath = `api/tickets/${ticket.id}/delivery-note-pdf?${serializedParams}`; controller.showPdfDeliveryNote(type); expect(window.open).toHaveBeenCalledWith(expectedPath); @@ -143,12 +142,13 @@ describe('Ticket Component vnTicketDescriptorMenu', () => { const $data = {email: 'brucebanner@gothamcity.com'}; const params = { recipient: $data.email, - recipientId: ticket.client.id, - ticketId: ticket.id + recipientId: ticket.client.id }; controller.sendPdfDeliveryNote($data); - expect(controller.vnEmail.send).toHaveBeenCalledWith('delivery-note', params); + const expectedPath = `tickets/${ticket.id}/delivery-note-email`; + + expect(controller.vnEmail.send).toHaveBeenCalledWith(expectedPath, params); }); }); @@ -157,11 +157,10 @@ describe('Ticket Component vnTicketDescriptorMenu', () => { jest.spyOn(window, 'open').mockReturnThis(); const expectedParams = { - ticketId: ticket.id, recipientId: ticket.client.id }; const serializedParams = $httpParamSerializer(expectedParams); - const expectedPath = `api/csv/delivery-note/download?${serializedParams}`; + const expectedPath = `api/tickets/${ticket.id}/delivery-note-csv?${serializedParams}`; controller.showCsvDeliveryNote(); expect(window.open).toHaveBeenCalledWith(expectedPath); @@ -170,21 +169,18 @@ describe('Ticket Component vnTicketDescriptorMenu', () => { describe('sendCsvDeliveryNote()', () => { it('should make a query to the csv delivery-note send endpoint and show a message snackbar', () => { - jest.spyOn(controller.vnApp, 'showMessage'); + jest.spyOn(controller.vnEmail, 'send'); const $data = {email: 'brucebanner@gothamcity.com'}; const expectedParams = { - ticketId: ticket.id, recipient: $data.email, recipientId: ticket.client.id, }; - const serializedParams = $httpParamSerializer(expectedParams); - - $httpBackend.expectGET(`csv/delivery-note/send?${serializedParams}`).respond(); controller.sendCsvDeliveryNote($data); - $httpBackend.flush(); - expect(controller.vnApp.showMessage).toHaveBeenCalled(); + const expectedPath = `tickets/${ticket.id}/delivery-note-csv-email`; + + expect(controller.vnEmail.send).toHaveBeenCalledWith(expectedPath, expectedParams); }); }); @@ -231,23 +227,6 @@ describe('Ticket Component vnTicketDescriptorMenu', () => { }); }); - describe('canStowaway()', () => { - it('should make a query and return if the ticket can be stowawayed', () => { - $httpBackend.expect('GET', `Tickets/${ticket.id}/canHaveStowaway`).respond(true); - controller.canStowaway(); - $httpBackend.flush(); - - expect(controller.canShowStowaway).toBeTruthy(); - }); - - it('should not make a query if is not on the ticket module', () => { - $state.getCurrentPath = () => [null, {state: {name: 'client'}}]; - controller.canStowaway(); - - expect(controller.canShowStowaway).toBeFalsy(); - }); - }); - describe('recalculateComponents()', () => { it('should make a query and show a success message', () => { jest.spyOn(controller, 'reload').mockReturnThis(); @@ -262,38 +241,41 @@ describe('Ticket Component vnTicketDescriptorMenu', () => { }); }); - // #4084 review with Juan - xdescribe('refund()', () => { + describe('refund()', () => { it('should make a query and go to ticket.card.sale', () => { controller.$state.go = jest.fn(); controller._id = ticket.id; - const sales = [{id: 1}]; - const services = [{id: 2}]; - $httpBackend.expectGET(`Sales`).respond(sales); - $httpBackend.expectGET(`TicketServices`).respond(services); - - const expectedParams = { - sales: sales, - services: services + const params = { + ticketsIds: [16] }; - $httpBackend.expectPOST(`Sales/refund`, expectedParams).respond(); + $httpBackend.expectPOST('Tickets/refund', params).respond([{id: 99}]); controller.refund(); $httpBackend.flush(); - expect(controller.$state.go).toHaveBeenCalledWith('ticket.card.sale', {id: undefined}); + expect(controller.$state.go).toHaveBeenCalledWith('ticket.card.sale', {id: 99}); + }); + }); + + describe('sendChangesSms()', () => { + it('should make a query and open the sms dialog', () => { + controller.$.sms = {open: () => {}}; + jest.spyOn(controller.$.sms, 'open'); + + $httpBackend.expectGET(`TicketLogs/${ticket.id}/getChanges`).respond(); + controller.sendChangesSms(); + $httpBackend.flush(); + + expect(controller.$.sms.open).toHaveBeenCalledWith(); }); }); describe('showSMSDialog()', () => { it('should set the destionationFk and destination properties and then call the sms open() method', () => { controller.$.sms = {open: () => {}}; - jest.spyOn(controller.$.sms, 'open'); - controller.showSMSDialog(); - expect(controller.$.sms.open).toHaveBeenCalledWith(); expect(controller.newSMS).toEqual({ destinationFk: ticket.clientFk, destination: ticket.address.mobile, @@ -304,9 +286,47 @@ describe('Ticket Component vnTicketDescriptorMenu', () => { describe('hasDocuware()', () => { it('should call hasDocuware method', () => { - $httpBackend.whenPOST(`Docuwares/${ticket.id}/checkFile`).respond(); + $httpBackend.whenPOST(`Docuwares/${ticket.id}/checkFile`).respond(true); controller.hasDocuware(); $httpBackend.flush(); + + expect(controller.hasDocuwareFile).toBe(true); + }); + }); + + describe('uploadDocuware()', () => { + it('should open dialog if not force', () => { + controller.$.pdfToTablet = {show: () => {}}; + jest.spyOn(controller.$.pdfToTablet, 'show'); + controller.uploadDocuware(false); + + expect(controller.$.pdfToTablet.show).toHaveBeenCalled(); + }); + + it('should make a query and show balance create', () => { + controller.$.balanceCreate = {show: () => {}}; + jest.spyOn(controller.$.balanceCreate, 'show'); + jest.spyOn(controller.vnApp, 'showSuccess'); + + $httpBackend.whenPOST(`Docuwares/${ticket.id}/upload`).respond(true); + controller.uploadDocuware(true); + $httpBackend.flush(); + + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); + expect(controller.$.balanceCreate.show).toHaveBeenCalled(); + }); + }); + + describe('transferClient()', () => { + it(`should perform two queries, a get to obtain the clientData and a patch to update the ticket`, () => { + const client = + { + clientFk: 1101, + addressFk: 1, + }; + $httpBackend.expect('GET', `Clients/${ticket.client.id}`).respond(client); + $httpBackend.expect('PATCH', `Tickets/${ticket.id}`).respond(); + controller.transferClient(); }); }); }); diff --git a/modules/ticket/front/descriptor-menu/locale/en.yml b/modules/ticket/front/descriptor-menu/locale/en.yml new file mode 100644 index 000000000..03f93db8d --- /dev/null +++ b/modules/ticket/front/descriptor-menu/locale/en.yml @@ -0,0 +1 @@ +The following refund ticket have been created: "The following refund ticket have been created: {{ticketId}}" \ No newline at end of file diff --git a/modules/ticket/front/descriptor-menu/locale/es.yml b/modules/ticket/front/descriptor-menu/locale/es.yml index 060d03154..b51637524 100644 --- a/modules/ticket/front/descriptor-menu/locale/es.yml +++ b/modules/ticket/front/descriptor-menu/locale/es.yml @@ -1,11 +1,20 @@ Show Delivery Note...: Ver albarán... Send Delivery Note...: Enviar albarán... as PDF: como PDF +as PDF signed: como PDF firmado as CSV: como CSV as PDF without prices: como PDF sin precios Send PDF: Enviar PDF +Send PDF to tablet: Enviar PDF a tablet Send CSV: Enviar CSV Send CSV Delivery Note: Enviar albarán en CSV Send PDF Delivery Note: Enviar albarán en PDF Show Proforma: Ver proforma -Refund all: Abonar todo \ No newline at end of file +Refund all: Abonar todo +Invoice sent: Factura enviada +The following refund ticket have been created: "Se ha creado siguiente ticket de abono: {{ticketId}}" +Transfer client: Transferir cliente +SMS Notify changes: SMS Notificar cambios +PDF sent!: ¡PDF enviado! +Already exist signed delivery note: Ya existe albarán de entrega firmado +Are you sure you want to replace this delivery note?: ¿Seguro que quieres reemplazar este albarán de entrega? diff --git a/modules/ticket/front/descriptor/addStowaway.html b/modules/ticket/front/descriptor/addStowaway.html deleted file mode 100644 index 44d262d51..000000000 --- a/modules/ticket/front/descriptor/addStowaway.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - Ticket id - Shipped - Agency - Warehouse - State - - - - - {{ticket.id}} - {{ticket.landed | date: 'dd/MM/yyyy'}} - {{ticket.agencyMode.name}} - {{ticket.warehouse.name}} - {{ticket.ticketState.state.name}} - - - - - - - \ No newline at end of file diff --git a/modules/ticket/front/descriptor/addStowaway.js b/modules/ticket/front/descriptor/addStowaway.js deleted file mode 100644 index c88bda0af..000000000 --- a/modules/ticket/front/descriptor/addStowaway.js +++ /dev/null @@ -1,32 +0,0 @@ -import ngModule from '../module'; -import Component from 'core/lib/component'; -import './style.scss'; - -class Controller extends Component { - addStowaway(stowaway) { - let params = {id: stowaway.id, shipFk: this.ticket.id}; - this.$http.post(`Stowaways/`, params) - .then(() => this.cardReload()) - .then(() => { - this.vnApp.showSuccess(this.$t('Data saved!')); - this.$.dialog.hide(); - }); - } - - show() { - this.$.dialog.show(); - } - - hide() { - this.$.dialog.hide(); - } -} - -ngModule.vnComponent('vnAddStowaway', { - template: require('./addStowaway.html'), - controller: Controller, - bindings: { - ticket: '<', - cardReload: '&?' - } -}); diff --git a/modules/ticket/front/descriptor/index.html b/modules/ticket/front/descriptor/index.html index 2c27b19cd..75bcd2801 100644 --- a/modules/ticket/front/descriptor/index.html +++ b/modules/ticket/front/descriptor/index.html @@ -93,36 +93,6 @@ icon="icon-basketadd"> -
- - -
-
- - -
- -
- -
diff --git a/modules/ticket/front/descriptor/index.js b/modules/ticket/front/descriptor/index.js index 28d5eb953..aaaad423e 100644 --- a/modules/ticket/front/descriptor/index.js +++ b/modules/ticket/front/descriptor/index.js @@ -39,7 +39,8 @@ class Controller extends Descriptor { 'name', 'isActive', 'isFreezed', - 'isTaxDataChecked' + 'isTaxDataChecked', + 'hasElectronicInvoice', ], include: { relation: 'salesPersonUser', diff --git a/modules/ticket/front/descriptor/locale/en.yml b/modules/ticket/front/descriptor/locale/en.yml index 64075c7ef..8eed2265d 100644 --- a/modules/ticket/front/descriptor/locale/en.yml +++ b/modules/ticket/front/descriptor/locale/en.yml @@ -1,2 +1,3 @@ Make a payment: "Verdnatura communicates:\rYour order is pending of payment.\rPlease, enter the web page and make the payment with card.\rThank you." Minimum is needed: "Verdnatura communicates:\rA minimum import of 50€ (Without BAT) is needed for your order {{ticketId}} from date {{created | date: 'dd/MM/yyyy'}} to receive it with no extra fees." +Send changes: "Verdnatura communicates:\rOrder {{ticketId}} date {{created | date: 'dd/MM/yyyy'}}\r{{changes}}" diff --git a/modules/ticket/front/descriptor/locale/es.yml b/modules/ticket/front/descriptor/locale/es.yml index 2a7bf360f..d921b5dc2 100644 --- a/modules/ticket/front/descriptor/locale/es.yml +++ b/modules/ticket/front/descriptor/locale/es.yml @@ -1,12 +1,4 @@ -Ship: Barco -Stowaway: Polizón Cliente: Client -Ship stowaways: Polizones del barco -Stowaways to add: Polizones a añadir -Stowaways of the ticket: Polizones del ticket -Add stowaway: Añadir polizón -Delete stowaway: Eliminar polizón -Are you sure you want to delete this stowaway?: ¿Seguro que quieres eliminar este polizón? Are you sure you want to send it?: ¿Seguro que quieres enviarlo? Show pallet report: Ver hoja de pallet Change shipped hour: Cambiar hora de envío @@ -30,4 +22,5 @@ SMS Pending payment: 'SMS Pago pendiente' Restore ticket: Restaurar ticket You are going to restore this ticket: Vas a restaurar este ticket Are you sure you want to restore this ticket?: ¿Seguro que quieres restaurar el ticket? -Are you sure you want to refund all?: ¿Seguro que quieres abonar todo? \ No newline at end of file +Are you sure you want to refund all?: ¿Seguro que quieres abonar todo? +Send changes: "Verdnatura le recuerda:\rPedido {{ticketId}} día {{created | date: 'dd/MM/yyyy'}}\r{{changes}}" diff --git a/modules/ticket/front/descriptor/style.scss b/modules/ticket/front/descriptor/style.scss index 1a69feeff..f083f41fc 100644 --- a/modules/ticket/front/descriptor/style.scss +++ b/modules/ticket/front/descriptor/style.scss @@ -1,11 +1,5 @@ @import "variables"; -.add-stowaway { - vn-data-viewer { - width: 640px - } -} - vn-dialog.modal-form { section.header { background-color: $color-main; diff --git a/modules/ticket/front/expedition/index.html b/modules/ticket/front/expedition/index.html index a41d368f6..447411f3a 100644 --- a/modules/ticket/front/expedition/index.html +++ b/modules/ticket/front/expedition/index.html @@ -8,54 +8,77 @@ auto-load="true"> - - - - - - Expedition - Item - Name - Package type - Counter - externalId - Created - State - - - - - - - - - - {{expedition.id | zeroFill:6}} - - - {{expedition.packagingFk}} - - - {{::expedition.packageItemName}} - {{::expedition.freightItemName}} - {{::expedition.counter}} - {{::expedition.externalId}} - {{::expedition.created | date:'dd/MM/yyyy HH:mm'}} - {{::expedition.state}} - - - - - - - + + + + + + + + + +

Subtotal {{$ctrl.ticket.totalWithoutVat | currency: 'EUR':2}}

+

VAT {{$ctrl.ticket.totalWithVat - $ctrl.ticket.totalWithoutVat | currency: 'EUR':2}}

+

Total {{$ctrl.ticket.totalWithVat | currency: 'EUR':2}}

+
+
+ + + + + + + + Expedition + Item + Name + Package type + Counter + externalId + Created + State + + + + + + + + + + {{expedition.id}} + + + {{expedition.packagingFk}} + + + {{::expedition.packageItemName}} + {{::expedition.freightItemName}} + {{::expedition.counter}} + {{::expedition.externalId}} + {{::expedition.created | date:'dd/MM/yyyy HH:mm'}} + {{::expedition.state}} + + + + + + +
- + on-accept="$ctrl.onRemove()"> - + - + State @@ -111,4 +134,37 @@ - \ No newline at end of file + + + + + New ticket without route + + + New ticket with route + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/ticket/front/expedition/index.js b/modules/ticket/front/expedition/index.js index 120d89bb2..2d4432fe8 100644 --- a/modules/ticket/front/expedition/index.js +++ b/modules/ticket/front/expedition/index.js @@ -2,6 +2,27 @@ import ngModule from '../module'; import Section from 'salix/components/section'; class Controller extends Section { + constructor($element, $scope) { + super($element, $scope); + this.landed = Date.vnNew(); + this.newRoute = null; + } + + get checked() { + const rows = this.$.model.data || []; + const checkedRows = []; + for (let row of rows) { + if (row.checked) + checkedRows.push(row.id); + } + + return checkedRows; + } + + get totalChecked() { + return this.checked.length; + } + onDialogAccept(id) { return this.$http.delete(`Expeditions/${id}`) .then(() => this.$.model.refresh()); @@ -11,6 +32,33 @@ class Controller extends Section { this.expedition = expedition; this.$.statusLog.show(); } + + onRemove() { + const params = {expeditionIds: this.checked}; + const query = `Expeditions/deleteExpeditions`; + this.$http.post(query, params) + .then(() => { + this.vnApp.showSuccess(this.$t('Expedition removed')); + this.$.model.refresh(); + }); + } + + createTicket(landed, routeFk) { + const params = { + clientId: this.ticket.clientFk, + landed: landed, + warehouseId: this.ticket.warehouseFk, + addressId: this.ticket.addressFk, + agencyModeId: this.ticket.agencyModeFk, + routeId: routeFk, + expeditionIds: this.checked + }; + const query = `Expeditions/moveExpeditions`; + this.$http.post(query, params).then(res => { + this.vnApp.showSuccess(this.$t('Data saved!')); + this.$state.go('ticket.card.summary', {id: res.data.id}); + }); + } } ngModule.vnComponent('vnTicketExpedition', { diff --git a/modules/ticket/front/expedition/index.spec.js b/modules/ticket/front/expedition/index.spec.js index 586ef2109..71e32151c 100644 --- a/modules/ticket/front/expedition/index.spec.js +++ b/modules/ticket/front/expedition/index.spec.js @@ -17,6 +17,14 @@ describe('Ticket', () => { refresh: () => {} }; controller = $componentController('vnTicketExpedition', {$element: null, $scope}); + controller.$.model.data = [ + {id: 1}, + {id: 2}, + {id: 3} + ]; + const modelData = controller.$.model.data; + modelData[0].checked = true; + modelData[1].checked = true; })); describe('onDialogAccept()', () => { @@ -50,5 +58,52 @@ describe('Ticket', () => { expect(controller.$.statusLog.show).toHaveBeenCalledWith(); }); }); + + describe('onRemove()', () => { + it('should make a query and then call to the model refresh() method', () => { + jest.spyOn($scope.model, 'refresh'); + + const expectedParams = {expeditionIds: [1, 2]}; + $httpBackend.expect('POST', 'Expeditions/deleteExpeditions', expectedParams).respond(200); + controller.onRemove(); + $httpBackend.flush(); + + expect($scope.model.refresh).toHaveBeenCalledWith(); + }); + }); + + describe('createTicket()', () => { + it('should make a query and then call to the $state go() method', () => { + jest.spyOn(controller.$state, 'go').mockReturnThis(); + + const landed = Date.vnNew(); + const ticket = { + clientFk: 1101, + landed: landed, + addressFk: 121, + agencyModeFk: 1, + warehouseFk: 1 + }; + const routeId = null; + controller.ticket = ticket; + + const ticketToTransfer = {id: 28}; + + const expectedParams = { + clientId: 1101, + landed: landed, + warehouseId: 1, + addressId: 121, + agencyModeId: 1, + routeId: null, + expeditionIds: [1, 2] + }; + $httpBackend.expect('POST', 'Expeditions/moveExpeditions', expectedParams).respond(ticketToTransfer); + controller.createTicket(ticket.landed, routeId); + $httpBackend.flush(); + + expect(controller.$state.go).toHaveBeenCalledWith('ticket.card.summary', {id: ticketToTransfer.id}); + }); + }); }); }); diff --git a/modules/ticket/front/expedition/locale/es.yml b/modules/ticket/front/expedition/locale/es.yml index d23cf25af..1933bac20 100644 --- a/modules/ticket/front/expedition/locale/es.yml +++ b/modules/ticket/front/expedition/locale/es.yml @@ -1 +1,6 @@ -Status log: Hitorial de estados \ No newline at end of file +Status log: Historial de estados +Expedition removed: Expedición eliminada +Move: Mover +New ticket without route: Nuevo ticket sin ruta +New ticket with route: Nuevo ticket con ruta +Route id: Id ruta \ No newline at end of file diff --git a/modules/ticket/front/future-search-panel/index.html b/modules/ticket/front/future-search-panel/index.html new file mode 100644 index 000000000..18b574f2a --- /dev/null +++ b/modules/ticket/front/future-search-panel/index.html @@ -0,0 +1,94 @@ +
+
+ + + + + + + + + + + + + + + + {{description}} + + + + + {{description}} + + + + + + + {{name}} + + + + + {{name}} + + + + + + + + + + + + +
+
diff --git a/modules/ticket/front/future-search-panel/index.js b/modules/ticket/front/future-search-panel/index.js new file mode 100644 index 000000000..8a75420df --- /dev/null +++ b/modules/ticket/front/future-search-panel/index.js @@ -0,0 +1,46 @@ +import ngModule from '../module'; +import SearchPanel from 'core/components/searchbar/search-panel'; + +class Controller extends SearchPanel { + constructor($, $element) { + super($, $element); + this.filter = this.$.filter; + this.getGroupedStates(); + this.getItemPackingTypes(); + } + + getGroupedStates() { + let groupedStates = []; + this.$http.get('AlertLevels').then(res => { + for (let state of res.data) { + groupedStates.push({ + id: state.id, + code: state.code, + name: this.$t(state.code) + }); + } + this.groupedStates = groupedStates; + }); + } + + getItemPackingTypes() { + let itemPackingTypes = []; + const filter = { + where: {isActive: true} + }; + this.$http.get('ItemPackingTypes', {filter}).then(res => { + for (let ipt of res.data) { + itemPackingTypes.push({ + description: this.$t(ipt.description), + code: ipt.code, + }); + } + this.itemPackingTypes = itemPackingTypes; + }); + } +} + +ngModule.vnComponent('vnFutureTicketSearchPanel', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/ticket/front/future-search-panel/locale/en.yml b/modules/ticket/front/future-search-panel/locale/en.yml new file mode 100644 index 000000000..767c20152 --- /dev/null +++ b/modules/ticket/front/future-search-panel/locale/en.yml @@ -0,0 +1 @@ +Future tickets: Tickets a futuro diff --git a/modules/ticket/front/future-search-panel/locale/es.yml b/modules/ticket/front/future-search-panel/locale/es.yml new file mode 100644 index 000000000..9d72c5b06 --- /dev/null +++ b/modules/ticket/front/future-search-panel/locale/es.yml @@ -0,0 +1,14 @@ +Future tickets: Tickets a futuro +Origin date: Fecha origen +Destination date: Fecha destino +Origin ETD: ETD origen +Destination ETD: ETD destino +Max Lines: Líneas máx. +Max Liters: Litros máx. +Origin IPT: IPT origen +Destination IPT: IPT destino +With problems: Con problemas +Warehouse: Almacén +Origin Grouped State: Estado agrupado origen +Destination Grouped State: Estado agrupado destino +IPT: Encajado diff --git a/modules/ticket/front/future/index.html b/modules/ticket/front/future/index.html new file mode 100644 index 000000000..8628bb34c --- /dev/null +++ b/modules/ticket/front/future/index.html @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OriginDestination
+ + + + Problems + + ID + + Date + + IPT + + State + + Liters + + Available Lines + + ID + + Date + + IPT + + State +
+ + + + + + + + + + + + + + + + + {{::ticket.id}} + + + {{::ticket.shipped | date: 'dd/MM/yyyy HH:mm'}} + + {{::ticket.ipt | dashIfEmpty}} + + {{::ticket.state}} + + {{::ticket.liters}}{{::ticket.lines}} + + {{::ticket.futureId}} + + + + {{::ticket.futureShipped | date: 'dd/MM/yyyy HH:mm'}} + + {{::ticket.futureIpt | dashIfEmpty}} + + {{::ticket.futureState}} + +
+
+
+
+ + + + diff --git a/modules/ticket/front/future/index.js b/modules/ticket/front/future/index.js new file mode 100644 index 000000000..8cb7f16aa --- /dev/null +++ b/modules/ticket/front/future/index.js @@ -0,0 +1,174 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section { + constructor($element, $) { + super($element, $); + this.$checkAll = false; + + this.smartTableOptions = { + activeButtons: { + search: true, + }, + columns: [{ + field: 'totalProblems', + searchable: false, + }, + { + field: 'shipped', + searchable: false + }, + { + field: 'futureShipped', + searchable: false + }, + { + field: 'state', + searchable: false + }, + { + field: 'futureState', + searchable: false + }, + { + field: 'ipt', + autocomplete: { + url: 'ItemPackingTypes', + where: `{isActive: true}`, + showField: 'description', + valueField: 'code' + } + }, + { + field: 'futureIpt', + autocomplete: { + url: 'ItemPackingTypes', + where: `{isActive: true}`, + showField: 'description', + valueField: 'code' + } + }, + ] + }; + } + + $postLink() { + this.setDefaultFilter(); + } + + setDefaultFilter() { + const today = Date.vnNew(); + + this.$http.get(`UserConfigs/getUserConfig`) + .then(res => { + this.filterParams = { + originDated: today, + futureDated: today, + warehouseFk: res.data.warehouseFk + }; + this.$.model.applyFilter(null, this.filterParams); + }); + } + + compareDate(date) { + let today = Date.vnNew(); + today.setHours(0, 0, 0, 0); + let timeTicket = new Date(date); + timeTicket.setHours(0, 0, 0, 0); + + let comparation = today - timeTicket; + + if (comparation == 0) + return 'warning'; + if (comparation < 0) + return 'success'; + } + + get checked() { + const tickets = this.$.model.data || []; + const checkedLines = []; + for (let ticket of tickets) { + if (ticket.checked) + checkedLines.push(ticket); + } + + return checkedLines; + } + + stateColor(state) { + if (state === 'OK') + return 'success'; + else if (state === 'Libre') + return 'notice'; + } + + dateRange(value) { + const minHour = new Date(value); + minHour.setHours(0, 0, 0, 0); + const maxHour = new Date(value); + maxHour.setHours(23, 59, 59, 59); + + return [minHour, maxHour]; + } + + get confirmationMessage() { + if (!this.$.model) return 0; + + return this.$t(`Move confirmation`, { + checked: this.checked.length + }); + } + + moveTicketsFuture() { + let ticketsToMove = []; + this.checked.forEach(ticket => { + ticketsToMove.push({ + originId: ticket.id, + destinationId: ticket.futureId, + originShipped: ticket.shipped, + destinationShipped: ticket.futureShipped, + workerFk: ticket.workerFk + }); + }); + let params = {tickets: ticketsToMove}; + return this.$http.post('Tickets/merge', params) + .then(() => { + this.$.model.refresh(); + this.vnApp.showSuccess(this.$t('Success')); + }); + } + + exprBuilder(param, value) { + switch (param) { + case 'id': + return {'id': value}; + case 'futureId': + return {'futureId': value}; + case 'liters': + return {'liters': value}; + case 'lines': + return {'lines': value}; + case 'ipt': + return {or: + [ + {'ipt': {like: `%${value}%`}}, + {'ipt': null} + ] + }; + case 'futureIpt': + return {or: + [ + {'futureIpt': {like: `%${value}%`}}, + {'futureIpt': null} + ] + }; + } + } +} + +Controller.$inject = ['$element', '$scope']; + +ngModule.vnComponent('vnTicketFuture', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/ticket/front/future/index.spec.js b/modules/ticket/front/future/index.spec.js new file mode 100644 index 000000000..188421298 --- /dev/null +++ b/modules/ticket/front/future/index.spec.js @@ -0,0 +1,108 @@ +import './index.js'; +import crudModel from 'core/mocks/crud-model'; + +describe('Component vnTicketFuture', () => { + const today = Date.vnNew(); + let controller; + let $httpBackend; + + beforeEach(ngModule('ticket')); + + beforeEach(inject(($componentController, _$httpBackend_) => { + $httpBackend = _$httpBackend_; + const $element = angular.element(''); + controller = $componentController('vnTicketFuture', {$element}); + controller.$.model = crudModel; + controller.$.model.data = [{ + id: 1, + checked: true, + state: 'OK' + }, { + id: 2, + checked: true, + state: 'Libre' + }]; + })); + + describe('compareDate()', () => { + it('should return warning when the date is the present', () => { + let result = controller.compareDate(today); + + expect(result).toEqual('warning'); + }); + + it('should return sucess when the date is in the future', () => { + let futureDate = Date.vnNew(); + futureDate = futureDate.setDate(futureDate.getDate() + 10); + let result = controller.compareDate(futureDate); + + expect(result).toEqual('success'); + }); + + it('should return undefined when the date is in the past', () => { + let pastDate = Date.vnNew(); + pastDate = pastDate.setDate(pastDate.getDate() - 10); + let result = controller.compareDate(pastDate); + + expect(result).toEqual(undefined); + }); + }); + + describe('checked()', () => { + it('should return an array of checked tickets', () => { + const result = controller.checked; + const firstRow = result[0]; + const secondRow = result[1]; + + expect(result.length).toEqual(2); + expect(firstRow.id).toEqual(1); + expect(secondRow.id).toEqual(2); + }); + }); + + describe('stateColor()', () => { + it('should return success to the OK tickets', () => { + const ok = controller.stateColor(controller.$.model.data[0].state); + const notOk = controller.stateColor(controller.$.model.data[1].state); + + expect(ok).toEqual('success'); + expect(notOk).not.toEqual('success'); + }); + + it('should return success to the FREE tickets', () => { + const notFree = controller.stateColor(controller.$.model.data[0].state); + const free = controller.stateColor(controller.$.model.data[1].state); + + expect(free).toEqual('notice'); + expect(notFree).not.toEqual('notice'); + }); + }); + + describe('dateRange()', () => { + it('should return two dates with the hours at the start and end of the given date', () => { + const dateRange = controller.dateRange(today); + const start = dateRange[0].toString(); + const end = dateRange[1].toString(); + + expect(start).toContain(today.getDate()); + expect(start).toContain('00:00:00'); + + expect(end).toContain(today.getDate()); + expect(end).toContain('23:59:59'); + }); + }); + + describe('moveTicketsFuture()', () => { + it('should make an HTTP Post query', () => { + jest.spyOn(controller.$.model, 'refresh'); + jest.spyOn(controller.vnApp, 'showSuccess'); + + $httpBackend.expectPOST(`Tickets/merge`).respond(); + controller.moveTicketsFuture(); + $httpBackend.flush(); + + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); + expect(controller.$.model.refresh).toHaveBeenCalledWith(); + }); + }); +}); diff --git a/modules/ticket/front/future/locale/en.yml b/modules/ticket/front/future/locale/en.yml new file mode 100644 index 000000000..4400e6992 --- /dev/null +++ b/modules/ticket/front/future/locale/en.yml @@ -0,0 +1,2 @@ +Move confirmation: Do you want to move {{checked}} tickets to the future? +Success: Tickets moved successfully! diff --git a/modules/ticket/front/future/locale/es.yml b/modules/ticket/front/future/locale/es.yml new file mode 100644 index 000000000..9fceea111 --- /dev/null +++ b/modules/ticket/front/future/locale/es.yml @@ -0,0 +1,16 @@ +Future tickets: Tickets a futuro +Search tickets: Buscar tickets +Search future tickets by date: Buscar tickets por fecha +Problems: Problemas +Origin ID: ID origen +Origin State: Estado origen +Destination State: Estado destino +Liters: Litros +Available Lines: Líneas disponibles +Destination ID: ID destino +Move tickets: Mover tickets +Move confirmation: ¿Desea mover {{checked}} tickets hacia el futuro? +Success: Tickets movidos correctamente +IPT: Encajado +Origin Date: Fecha origen +Destination Date: Fecha destino diff --git a/modules/ticket/front/index.js b/modules/ticket/front/index.js index 01d1d7242..029dc16a4 100644 --- a/modules/ticket/front/index.js +++ b/modules/ticket/front/index.js @@ -5,7 +5,6 @@ import './index/'; import './search-panel'; import './card'; import './descriptor'; -import './descriptor/addStowaway'; import './descriptor-popover'; import './descriptor-menu'; import './create/card'; @@ -21,7 +20,6 @@ import './package/index'; import './sale'; import './tracking/index'; import './tracking/edit'; -import './sale-checked'; import './services'; import './component'; import './sale-tracking'; @@ -33,4 +31,8 @@ import './weekly'; import './dms/index'; import './dms/create'; import './dms/edit'; -import './sms'; +import './boxing'; +import './future'; +import './future-search-panel'; +import './advance'; +import './advance-search-panel'; diff --git a/modules/ticket/front/index/index.js b/modules/ticket/front/index/index.js index 2df4de0a5..42332ccc8 100644 --- a/modules/ticket/front/index/index.js +++ b/modules/ticket/front/index/index.js @@ -29,11 +29,8 @@ export default class Controller extends Section { } openDeliveryNotes(ids) { - for (let id of ids) { - this.vnReport.show('delivery-note', { - ticketId: id, - }); - } + for (let id of ids) + this.vnReport.show(`Tickets/${id}/delivery-note-pdf`); } openBalanceDialog() { @@ -93,7 +90,7 @@ export default class Controller extends Section { } compareDate(date) { - let today = new Date(); + let today = Date.vnNew(); today.setHours(0, 0, 0, 0); let timeTicket = new Date(date); timeTicket.setHours(0, 0, 0, 0); diff --git a/modules/ticket/front/index/index.spec.js b/modules/ticket/front/index/index.spec.js index b966ca8c4..5046387b0 100644 --- a/modules/ticket/front/index/index.spec.js +++ b/modules/ticket/front/index/index.spec.js @@ -31,14 +31,14 @@ describe('Component vnTicketIndex', () => { describe('compareDate()', () => { it('should return warning when the date is the present', () => { - let today = new Date(); + let today = Date.vnNew(); let result = controller.compareDate(today); expect(result).toEqual('warning'); }); it('should return sucess when the date is in the future', () => { - let futureDate = new Date(); + let futureDate = Date.vnNew(); futureDate = futureDate.setDate(futureDate.getDate() + 10); let result = controller.compareDate(futureDate); @@ -46,7 +46,7 @@ describe('Component vnTicketIndex', () => { }); it('should return undefined when the date is in the past', () => { - let pastDate = new Date(); + let pastDate = Date.vnNew(); pastDate = pastDate.setDate(pastDate.getDate() - 10); let result = controller.compareDate(pastDate); @@ -96,8 +96,8 @@ describe('Component vnTicketIndex', () => { controller.setDelivered(); $httpBackend.flush(); - expect($window.open).toHaveBeenCalledWith(`api/report/delivery-note?ticketId=${tickets[1].id}`); - expect($window.open).toHaveBeenCalledWith(`api/report/delivery-note?ticketId=${tickets[2].id}`); + expect($window.open).toHaveBeenCalledWith(`api/Tickets/${tickets[1].id}/delivery-note-pdf`); + expect($window.open).toHaveBeenCalledWith(`api/Tickets/${tickets[2].id}/delivery-note-pdf`); }); }); diff --git a/modules/ticket/front/locale/es.yml b/modules/ticket/front/locale/es.yml index 752dd7b36..748ba210f 100644 --- a/modules/ticket/front/locale/es.yml +++ b/modules/ticket/front/locale/es.yml @@ -4,6 +4,7 @@ Agency: Agencia Amount: Importe Base to commission: Base comisionable Boxes: Cajas +Boxing: Encajado by: por Checked: Comprobado Client: Cliente @@ -45,7 +46,7 @@ Price gap: Diferencia de precio Quantity: Cantidad Remove lines: Eliminar lineas Route: Ruta -SET OK: PONER OK +SET OK: PONER OK Shipment: Salida Shipped: F. envío Some fields are invalid: Algunos campos no son válidos @@ -81,4 +82,4 @@ Sale tracking: Líneas preparadas Pictures: Fotos Log: Historial Packager: Encajador -Palletizer: Palletizador \ No newline at end of file +Palletizer: Palletizador diff --git a/modules/ticket/front/main/index.js b/modules/ticket/front/main/index.js index 1b807216b..3f9482fc4 100644 --- a/modules/ticket/front/main/index.js +++ b/modules/ticket/front/main/index.js @@ -22,7 +22,7 @@ export default class Ticket extends ModuleMain { $params.scopeDays = 1; if (typeof $params.scopeDays === 'number') { - const from = new Date(); + const from = Date.vnNew(); from.setHours(0, 0, 0, 0); const to = new Date(from.getTime()); diff --git a/modules/ticket/front/package/index.js b/modules/ticket/front/package/index.js index ed13f12d8..fd67ce583 100644 --- a/modules/ticket/front/package/index.js +++ b/modules/ticket/front/package/index.js @@ -6,7 +6,7 @@ class Controller extends Section { this.$.model.insert({ packagingFk: null, quantity: null, - created: new Date(), + created: Date.vnNew(), ticketFk: this.$params.id }); } diff --git a/modules/ticket/front/request/create/index.html b/modules/ticket/front/request/create/index.html index 8d25358b5..71a2de260 100644 --- a/modules/ticket/front/request/create/index.html +++ b/modules/ticket/front/request/create/index.html @@ -18,9 +18,8 @@ diff --git a/modules/ticket/front/request/index/index.html b/modules/ticket/front/request/index/index.html index 054f0c76a..510c09974 100644 --- a/modules/ticket/front/request/index/index.html +++ b/modules/ticket/front/request/index/index.html @@ -75,7 +75,7 @@ ng-show="::request.saleFk" ng-click="itemDescriptor.show($event, request.sale.itemFk, request.sale.id)" class="link"> - {{::request.saleFk | zeroFill:6}} + {{::request.saleFk}} - - - - - - - Is checked - Item - Description - Quantity - - - - - - - - - - - {{::sale.itemFk | zeroFill:6}} - - - -
- {{::sale.item.name}} - -

{{::sale.item.subName}}

-
-
- - -
- {{::sale.quantity}} -
-
-
-
-
- - diff --git a/modules/ticket/front/sale-checked/index.js b/modules/ticket/front/sale-checked/index.js deleted file mode 100644 index 857ac49e3..000000000 --- a/modules/ticket/front/sale-checked/index.js +++ /dev/null @@ -1,42 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.filter = { - include: [ - { - relation: 'item' - }, { - relation: 'isChecked', - scope: { - fields: ['isChecked'] - } - } - ] - }; - } - showItemDescriptor(event, sale) { - this.quicklinks = { - btnThree: { - icon: 'icon-transaction', - state: `item.card.diary({ - id: ${sale.itemFk}, - warehouseFk: ${this.ticket.warehouseFk}, - lineFk: ${sale.id} - })`, - tooltip: 'Item diary' - } - }; - this.$.itemDescriptor.show(event.target, sale.itemFk); - } -} - -ngModule.vnComponent('vnTicketSaleChecked', { - template: require('./index.html'), - controller: Controller, - bindings: { - ticket: '<' - } -}); diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html index fc585650a..0309dde13 100644 --- a/modules/ticket/front/sale-tracking/index.html +++ b/modules/ticket/front/sale-tracking/index.html @@ -1,10 +1,11 @@ @@ -12,33 +13,62 @@ - + Is checked Item - Description + Description Quantity - Original - Worker - State - Created + Parking + - - - - - + + + + + + + + + + + + + - - {{sale.itemFk | zeroFill:6}} + {{::sale.item.id}} - +
{{::sale.item.name}} @@ -53,16 +83,19 @@ {{::sale.quantity}} - {{::sale.originalQuantity}} - - - {{::sale.userNickname | dashIfEmpty}} - + {{::sale.saleGroupDetail.saleGroup.parking.code | dashIfEmpty}} + + + + + - {{::sale.state}} - {{::sale.created | date: 'dd/MM/yyyy HH:mm'}} @@ -70,8 +103,95 @@ + warehouse-fk="$ctrl.ticket.warehouseFk" + ticket-fk="$ctrl.ticket.id"> - - \ No newline at end of file + + + + + + + + + + Quantity + Original + Worker + State + Created + + + + + {{::saleTracking.quantity}} + {{::saleTracking.originalQuantity}} + + + {{::saleTracking.name | dashIfEmpty}} + + + {{::saleTracking.state}} + {{::saleTracking.created | date: 'dd/MM/yyyy HH:mm'}} + + + + + + + + + + + + + + + + + + Quantity + Worker + Shelving + Parking + Created + + + + + {{::itemShelvingSale.quantity}} + + + {{::itemShelvingSale.name | dashIfEmpty}} + + + {{::itemShelvingSale.shelvingFk}} + {{::itemShelvingSale.code}} + {{::itemShelvingSale.created | date: 'dd/MM/yyyy HH:mm'}} + + + + + + + + diff --git a/modules/ticket/front/sale-tracking/index.js b/modules/ticket/front/sale-tracking/index.js index 394ef4f1e..60b422cc0 100644 --- a/modules/ticket/front/sale-tracking/index.js +++ b/modules/ticket/front/sale-tracking/index.js @@ -1,12 +1,94 @@ import ngModule from '../module'; import Section from 'salix/components/section'; +import './style.scss'; -class Controller extends Section {} +class Controller extends Section { + constructor($element, $) { + super($element, $); + this.filter = { + include: [ + { + relation: 'item' + }, + { + relation: 'saleTracking', + scope: { + fields: ['isChecked'] + } + }, + { + relation: 'saleGroupDetail', + scope: { + fields: ['saleGroupFk'], + include: { + relation: 'saleGroup', + scope: { + fields: ['parkingFk'], + include: { + relation: 'parking', + scope: { + fields: ['code'] + } + } + } + } + } + } + ] + }; + } + + get sales() { + return this._sales; + } + + set sales(value) { + this._sales = value; + if (value) { + const query = `Sales/${this.$params.id}/salePreparingList`; + this.$http.get(query) + .then(res => { + this.salePreparingList = res.data; + for (const salePreparing of this.salePreparingList) { + for (const sale of this.sales) { + if (salePreparing.saleFk == sale.id) + sale.preparingList = salePreparing; + } + } + }); + } + } + + showItemDescriptor(event, sale) { + this.quicklinks = { + btnThree: { + icon: 'icon-transaction', + state: `item.card.diary({ + id: ${sale.item.id}, + warehouseFk: ${this.ticket.warehouseFk}, + lineFk: ${sale.id} + })`, + tooltip: 'Item diary' + } + }; + this.$.itemDescriptor.show(event.target, sale.item.id); + } + + showSaleTracking(sale) { + this.saleId = sale.id; + this.$.saleTracking.show(); + } + + showItemShelvingSale(sale) { + this.saleId = sale.id; + this.$.itemShelvingSale.show(); + } +} ngModule.vnComponent('vnTicketSaleTracking', { template: require('./index.html'), controller: Controller, bindings: { - ticket: '<', - }, + ticket: '<' + } }); diff --git a/modules/ticket/front/sale-tracking/locale/es.yml b/modules/ticket/front/sale-tracking/locale/es.yml new file mode 100644 index 000000000..eabc0a04d --- /dev/null +++ b/modules/ticket/front/sale-tracking/locale/es.yml @@ -0,0 +1,6 @@ +ItemShelvings sale: Carros línea +has saleGroupDetail: tiene detalle grupo lineas +is previousSelected: es previa seleccionada +is previous: es previa +is prepared: esta preparado +is controled: esta controlado diff --git a/modules/ticket/front/sale-tracking/style.scss b/modules/ticket/front/sale-tracking/style.scss new file mode 100644 index 000000000..78a0bda1d --- /dev/null +++ b/modules/ticket/front/sale-tracking/style.scss @@ -0,0 +1,21 @@ +@import "variables"; + +vn-sale-tracking { + .chip { + display: inline-block; + min-width: 15px; + min-height: 25px; + } + +} + +.circleState { + display: inline-block; + justify-content: center; + align-items: center; + border-radius: 50%; + font-size: .9rem; + height: 28px; + width: 28px; + cursor: pointer; +} diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index f4e5840f3..6fc986e8f 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -22,15 +22,17 @@ disabled="!$ctrl.isEditable" label="State" value-field="code" + fields="['id', 'name', 'alertLevel', 'code']" url="States/editableStates" on-change="$ctrl.changeState(value)"> + disabled="!$ctrl.hasSelectedSales()" + vn-tooltip="Select lines to see the options" + ng-click="moreOptions.show($event)"> - - @@ -68,6 +70,7 @@ Disc Amount Packaging + @@ -84,13 +87,13 @@ vn-tooltip="{{::$ctrl.$t('Claim')}}: {{::sale.claim.claimFk}}"> - - @@ -108,28 +111,28 @@ - - {{::sale.visible}} - {{::sale.available}} + ng-click="itemDescriptor.show($event, sale.itemFk, sale.id, $ctrl.ticket.shipped)"> {{sale.itemFk}} - {{(sale.discount / 100) | percentage}} + {{(sale.discount / 100) | percentage}} @@ -204,6 +207,23 @@ {{::sale.item.itemPackingTypeFk | dashIfEmpty}} + + + + + + + @@ -244,7 +264,7 @@
-
MANÁ: {{::$ctrl.edit.mana | currency: 'EUR': 0}}
+
Mana: {{::$ctrl.edit.mana | currency: 'EUR': 0}}
-
- - - - -
- - -
-
-
Mana: {{::$ctrl.edit.mana | currency: 'EUR':0}}
-
-
- - - - - - - - -
-

New price

-

- {{$ctrl.getNewPrice() | currency: 'EUR': 2}} -

-
-
-
- - - + + +
+
+
Mana: {{::$ctrl.edit.mana | currency: 'EUR': 0}}
+
- + + + + + + +
+

New price

+

+ {{$ctrl.getNewPrice() | currency: 'EUR': 2}} +

+
-
- Mana: {{::$ctrl.edit.mana | currency: 'EUR': 0}} -
- - + + + + + + +
+
@@ -363,7 +367,7 @@ - {{::sale.itemFk | zeroFill:6}} + {{::sale.itemFk}} {{::sale.concept}} @@ -399,8 +403,8 @@
{{::ticket.id}}{{::ticket.agencyName}} {{::ticket.address}} - {{::ticket.nickname}} - {{::ticket.name}} - {{::ticket.street}} - {{::ticket.postalCode}} + {{::ticket.nickname}} + {{::ticket.name}} + {{::ticket.street}} + {{::ticket.postalCode}} {{::ticket.city}}
@@ -457,10 +461,11 @@ - - + sms="$ctrl.newSMS" + on-send="$ctrl.onSmsSend($sms)"> + + ng-click="$ctrl.showEditDiscountPopover($event, sale)"> Update discount Refund - \ No newline at end of file + diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index 987333e28..f3fb89d04 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -51,7 +51,7 @@ class Controller extends Section { const hasClaimManagerRole = this.aclService.hasAny(['claimManager']); - return landedPlusWeek >= new Date() || hasClaimManagerRole; + return landedPlusWeek >= Date.vnNew() || hasClaimManagerRole; } return false; } @@ -75,6 +75,7 @@ class Controller extends Section { this.$.editPricePopover.relocate(); }); }); + this.getUsesMana(); this.getCurrentWorkerMana(); } @@ -85,6 +86,13 @@ class Controller extends Section { }); } + getUsesMana() { + this.$http.get(`Sales/usesMana`) + .then(res => { + this.usesMana = res.data; + }); + } + /** * Returns checked instances * @@ -243,26 +251,21 @@ class Controller extends Section { showEditDiscountPopover(event, sale) { if (this.isLocked) return; - - this.edit = { - discount: sale.discount, - sale: sale - }; + if (sale) { + this.edit = { + discount: sale.discount, + sale: sale + }; + } else { + this.edit = { + discount: null, + sales: this.selectedValidSales() + }; + } this.$.editDiscount.show(event); } - showEditDiscountDialog(event) { - if (this.isLocked) return; - - this.edit = { - discount: null, - sales: this.selectedValidSales() - }; - - this.$.editDiscountDialog.show(event); - } - changeDiscount() { const sale = this.edit.sale; const newDiscount = this.edit.discount; @@ -278,11 +281,10 @@ class Controller extends Section { const hasChanges = sales.some(sale => { return sale.discount != newDiscount; }); - if (newDiscount != null && hasChanges) this.updateDiscount(sales); - this.$.editDiscountDialog.hide(); + this.$.editDiscount.hide(); } updateDiscount(sales) { @@ -303,7 +305,7 @@ class Controller extends Section { } getNewPrice() { - if (this.edit) { + if (this.edit.sale) { const sale = this.edit.sale; let newDiscount = sale.discount; let newPrice = this.edit.price || sale.price; @@ -375,6 +377,7 @@ class Controller extends Section { const params = { ticketFk: this.ticket.id, created: this.ticket.updated, + landed: this.ticket.landed, notAvailables }; this.newSMS = { @@ -386,6 +389,11 @@ class Controller extends Section { this.$.sms.open(); } + onSmsSend(sms) { + return this.$http.post(`Tickets/${this.ticket.id}/sendSms`, sms) + .then(() => this.vnApp.showSuccess(this.$t('SMS sent'))); + } + /** * Inserts a new instance */ @@ -483,11 +491,18 @@ class Controller extends Section { const sales = this.selectedValidSales(); if (!sales) return; - const params = {sales: sales}; - const query = `Sales/refund`; - this.resetChanges(); + const salesIds = sales.map(sale => sale.id); + + const params = {salesIds: salesIds}; + const query = 'Sales/refund'; this.$http.post(query, params).then(res => { - this.$state.go('ticket.card.sale', {id: res.data}); + const [refundTicket] = res.data; + this.vnApp.showSuccess(this.$t('The following refund ticket have been created', { + ticketId: refundTicket.id + })); + this.$state.go('ticket.card.sale', {id: refundTicket.id}); + + this.resetChanges(); }); } @@ -498,7 +513,8 @@ class Controller extends Section { } save() { - this.changeDiscount(); + if (this.edit.sale) this.changeDiscount(); + if (this.edit.sales) this.changeMultipleDiscount(); } cancel() { diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js index a8ac2f3de..8585503cc 100644 --- a/modules/ticket/front/sale/index.spec.js +++ b/modules/ticket/front/sale/index.spec.js @@ -15,9 +15,9 @@ describe('Ticket', () => { const ticket = { id: 1, clientFk: 1101, - shipped: new Date(), - landed: new Date(), - created: new Date(), + shipped: Date.vnNew(), + landed: Date.vnNew(), + created: Date.vnNew(), client: {salesPersonFk: 1}, address: {mobile: 111111111} }; @@ -115,6 +115,7 @@ describe('Ticket', () => { const expectedAmount = 250; $httpBackend.expect('GET', 'Tickets/1/getSalesPersonMana').respond(200, expectedAmount); + $httpBackend.expect('GET', 'Sales/usesMana').respond(200); $httpBackend.expect('GET', 'WorkerManas/getCurrentWorkerMana').respond(200, expectedAmount); controller.getMana(); $httpBackend.flush(); @@ -393,7 +394,7 @@ describe('Ticket', () => { secondSelectedSale.checked = true; const expectedSales = [firstSelectedSale, secondSelectedSale]; - controller.$.editDiscountDialog = {hide: jest.fn()}; + controller.$.editDiscount = {hide: jest.fn()}; controller.edit = { discount: 10, sales: expectedSales @@ -402,7 +403,7 @@ describe('Ticket', () => { controller.changeMultipleDiscount(); expect(controller.updateDiscount).toHaveBeenCalledWith(expectedSales); - expect(controller.$.editDiscountDialog.hide).toHaveBeenCalledWith(); + expect(controller.$.editDiscount.hide).toHaveBeenCalledWith(); }); it('should not call to the updateDiscount() method and then to the editDiscountDialog hide() method', () => { @@ -417,7 +418,7 @@ describe('Ticket', () => { secondSelectedSale.discount = 10; const expectedSales = [firstSelectedSale, secondSelectedSale]; - controller.$.editDiscountDialog = {hide: jest.fn()}; + controller.$.editDiscount = {hide: jest.fn()}; controller.edit = { discount: 10, sales: expectedSales @@ -426,7 +427,7 @@ describe('Ticket', () => { controller.changeMultipleDiscount(); expect(controller.updateDiscount).not.toHaveBeenCalledWith(expectedSales); - expect(controller.$.editDiscountDialog.hide).toHaveBeenCalledWith(); + expect(controller.$.editDiscount.hide).toHaveBeenCalledWith(); }); }); @@ -704,18 +705,19 @@ describe('Ticket', () => { }); describe('createRefund()', () => { - it('should make an HTTP POST query and then call to the $state go() method', () => { + it('should make a query and then navigate to the created ticket sales section', () => { jest.spyOn(controller, 'selectedValidSales').mockReturnValue(controller.sales); - jest.spyOn(controller, 'resetChanges'); jest.spyOn(controller.$state, 'go'); - - const expectedId = 9999; - $httpBackend.expect('POST', `Sales/refund`).respond(200, expectedId); + const params = { + salesIds: [1, 4], + }; + const refundTicket = {id: 99}; + const createdTickets = [refundTicket]; + $httpBackend.expect('POST', 'Sales/refund', params).respond(200, createdTickets); controller.createRefund(); $httpBackend.flush(); - expect(controller.resetChanges).toHaveBeenCalledWith(); - expect(controller.$state.go).toHaveBeenCalledWith('ticket.card.sale', {id: expectedId}); + expect(controller.$state.go).toHaveBeenCalledWith('ticket.card.sale', refundTicket); }); }); diff --git a/modules/ticket/front/sale/locale/en.yml b/modules/ticket/front/sale/locale/en.yml index ec7f54160..b418c086c 100644 --- a/modules/ticket/front/sale/locale/en.yml +++ b/modules/ticket/front/sale/locale/en.yml @@ -1,3 +1,3 @@ Product not available: >- - Verdnatura communicates: Your order {{ticketFk}} created on {{created | date: "dd/MM/yyyy"}}. + Verdnatura communicates: Your order {{ticketFk}} with reception date on {{landed | date: "dd/MM/yyyy"}}. {{notAvailables}} not available. Sorry for the inconvenience. \ No newline at end of file diff --git a/modules/ticket/front/sale/locale/es.yml b/modules/ticket/front/sale/locale/es.yml index aab8ff493..41ba52d17 100644 --- a/modules/ticket/front/sale/locale/es.yml +++ b/modules/ticket/front/sale/locale/es.yml @@ -13,9 +13,9 @@ New ticket: Nuevo ticket Edit price: Editar precio You are going to delete lines of the ticket: Vas a eliminar lineas del ticket This ticket will be removed from current route! Continue anyway?: ¡Se eliminará el ticket de la ruta actual! ¿Continuar de todas formas? -You have to allow pop-ups in your web browser to use this functionality: +You have to allow pop-ups in your web browser to use this functionality: Debes permitir los pop-pups en tu navegador para que esta herramienta funcione correctamente -Disc: Dto +Disc: Dto Available: Disponible What is the day of receipt of the ticket?: ¿Cual es el día de preparación del pedido? Add claim: Crear reclamación @@ -26,7 +26,7 @@ Destination ticket: Ticket destinatario Change ticket state to 'Ok': Cambiar estado del ticket a 'Ok' Reserved: Reservado Send shortage SMS: Enviar SMS faltas -Product not available: "Verdnatura le comunica:\rPedido {{ticketFk}} día {{created | date: 'dd/MM/yyyy'}}.\r{{notAvailables}} no disponible/s.\rDisculpe las molestias." +Product not available: "Verdnatura le comunica:\rPedido {{ticketFk}} con fecha recepción {{landed | date: 'dd/MM/yyyy'}}.\r{{notAvailables}} no disponible/s.\rDisculpe las molestias." Continue anyway?: ¿Continuar de todas formas? This ticket is now empty: El ticket ha quedado vacio Do you want to delete it?: ¿Quieres eliminarlo? @@ -39,3 +39,5 @@ Packaging: Encajado Refund: Abono Promotion mana: Maná promoción Claim mana: Maná reclamación +History: Historial +Select lines to see the options: Seleccione lineas para ver las opciones diff --git a/modules/ticket/front/search-panel/index.html b/modules/ticket/front/search-panel/index.html index b0d4963bd..7002f3dd6 100644 --- a/modules/ticket/front/search-panel/index.html +++ b/modules/ticket/front/search-panel/index.html @@ -141,6 +141,11 @@ ng-model="filter.hasRoute" triple-state="true"> + diff --git a/modules/ticket/front/search-panel/index.spec.js b/modules/ticket/front/search-panel/index.spec.js index 41c32c047..df320b55b 100644 --- a/modules/ticket/front/search-panel/index.spec.js +++ b/modules/ticket/front/search-panel/index.spec.js @@ -38,7 +38,7 @@ describe('Ticket Component vnTicketSearchPanel', () => { it('should clear the scope days when setting the from property', () => { controller.filter.scopeDays = 1; - controller.from = new Date(); + controller.from = Date.vnNew(); expect(controller.filter.scopeDays).toBeNull(); expect(controller.from).toBeDefined(); @@ -49,7 +49,7 @@ describe('Ticket Component vnTicketSearchPanel', () => { it('should clear the scope days when setting the to property', () => { controller.filter.scopeDays = 1; - controller.to = new Date(); + controller.to = Date.vnNew(); expect(controller.filter.scopeDays).toBeNull(); expect(controller.to).toBeDefined(); @@ -58,8 +58,8 @@ describe('Ticket Component vnTicketSearchPanel', () => { describe('scopeDays() setter', () => { it('should clear the date range when setting the scopeDays property', () => { - controller.filter.from = new Date(); - controller.filter.to = new Date(); + controller.filter.from = Date.vnNew(); + controller.filter.to = Date.vnNew(); controller.scopeDays = 1; diff --git a/modules/ticket/front/search-panel/locale/es.yml b/modules/ticket/front/search-panel/locale/es.yml index 52cc04d6e..1d1c82d1a 100644 --- a/modules/ticket/front/search-panel/locale/es.yml +++ b/modules/ticket/front/search-panel/locale/es.yml @@ -13,6 +13,7 @@ Grouped States: Estado agrupado Days onward: Días adelante With problems: Con problemas Has route: Con ruta +Has invoice: Con factura Pending: Pendiente FREE: Libre DELIVERED: Servido diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index fe49a301f..97055208b 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -1,6 +1,6 @@
- - Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} + Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} ({{$ctrl.summary.client.id}}) - {{$ctrl.summary.nickname}} - -
- - {{$ctrl.summary.client.salesPersonUser.name}} - @@ -47,11 +48,11 @@ {{$ctrl.summary.zone.name}} - - {{$ctrl.summary.routeFk}} @@ -66,17 +67,17 @@ - - -

Subtotal {{$ctrl.summary.totalWithoutVat | currency: 'EUR':2}}

-

VAT {{$ctrl.summary.totalWithVat - $ctrl.summary.totalWithoutVat | currency: 'EUR':2}}

+

VAT + RE + VAT + {{$ctrl.summary.totalWithVat - $ctrl.summary.totalWithoutVat | currency: 'EUR':2}} +

Total {{$ctrl.summary.totalWithVat | currency: 'EUR':2}}

- Sale @@ -146,13 +150,13 @@ vn-tooltip="{{::$ctrl.$t('Claim')}}: {{::sale.claimBeginning.claimFk}}"> - - @@ -170,22 +174,22 @@ - - {{sale.itemFk | zeroFill:6}} + {{sale.itemFk}} - {{::sale.visible}} - {{::sale.available}} @@ -216,7 +220,7 @@

- Packages @@ -241,7 +245,7 @@

- Service @@ -276,7 +280,7 @@

- Purchase request @@ -304,11 +308,11 @@ {{::request.quantity}} {{::request.price}} - - {{request.sale.itemFk | zeroFill:6}} + {{request.sale.itemFk}} @@ -336,9 +340,9 @@ - - - \ No newline at end of file + diff --git a/modules/ticket/front/volume/index.html b/modules/ticket/front/volume/index.html index 8f17a9475..f5dd18033 100644 --- a/modules/ticket/front/volume/index.html +++ b/modules/ticket/front/volume/index.html @@ -35,7 +35,7 @@ - {{sale.itemFk | zeroFill:6}} + {{sale.itemFk}} diff --git a/modules/ticket/front/weekly/index.html b/modules/ticket/front/weekly/index.html index 9ea35d92e..ca3b6e662 100644 --- a/modules/ticket/front/weekly/index.html +++ b/modules/ticket/front/weekly/index.html @@ -4,7 +4,7 @@ filter="::$ctrl.filter" limit="20" data="weeklies" - order="ticketFk" + order="weekDay, ticketFk" primary-key="ticketFk" auto-load="true"> @@ -17,87 +17,110 @@ model="model"> - - - - - - Ticket ID - Client - Shipment - Agency - Warehouse - Salesperson - - - - - - - - {{weekly.ticketFk}} - - - - - {{::weekly.clientName}} - - - - - - - - - - - {{::weekly.warehouseName}} - - - {{::weekly.userName}} - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Ticket ID + + Client + + Shipment + + Agency + + Warehouse + + Salesperson +
+ + {{weekly.ticketFk}} + + + + {{::weekly.clientName}} + + + + + + + + {{weekly.warehouseName}} + + {{::weekly.userName}} + + + + +
+
+
+
@@ -112,4 +135,4 @@ on-accept="$ctrl.onDeleteWeeklyAccept($data)" question="This ticket will be removed from weekly tickets! Continue anyway?" message="You are going to delete this weekly ticket"> - + \ No newline at end of file diff --git a/modules/ticket/front/weekly/index.js b/modules/ticket/front/weekly/index.js index 71365c4b3..a10ff7184 100644 --- a/modules/ticket/front/weekly/index.js +++ b/modules/ticket/front/weekly/index.js @@ -1,3 +1,4 @@ + import ngModule from '../module'; import Section from 'salix/components/section'; @@ -15,6 +16,44 @@ export default class Controller extends Section { {id: 5, name: 'Saturday'}, {id: 6, name: 'Sunday'} ]; + + this.smartTableOptions = { + activeButtons: { + search: true, + shownColumns: true, + }, + columns: [ + { + field: 'ticketFk', + searchable: false + }, + { + field: 'clientName', + }, + { + field: 'weekDay', + searchable: false, + }, + { + field: 'agencyModeFk', + searchable: false, + }, + { + field: 'warehouseFk', + searchable: false, + }, + { + field: 'nickname', + }, + ] + }; + } + + exprBuilder(param, value) { + switch (param) { + case 'clientName': return {'c.name': value}; + case 'nickName': return {'u.name': value}; + } } onUpdate(ticketFk, field, value) { diff --git a/modules/travel/back/methods/thermograph/createThermograph.js b/modules/travel/back/methods/thermograph/createThermograph.js index 23d9d6037..75d967628 100644 --- a/modules/travel/back/methods/thermograph/createThermograph.js +++ b/modules/travel/back/methods/thermograph/createThermograph.js @@ -40,7 +40,7 @@ module.exports = Self => { const models = Self.app.models; let tx; const myOptions = {}; - const date = new Date(); + const date = Date.vnNew(); if (typeof options == 'object') Object.assign(myOptions, options); diff --git a/modules/travel/back/methods/travel/cloneWithEntries.js b/modules/travel/back/methods/travel/cloneWithEntries.js index 393194f06..e5b6b1580 100644 --- a/modules/travel/back/methods/travel/cloneWithEntries.js +++ b/modules/travel/back/methods/travel/cloneWithEntries.js @@ -35,12 +35,12 @@ module.exports = Self => { 'landed', 'warehouseInFk', 'warehouseOutFk', - 'agencyFk', + 'agencyModeFk', 'ref' ] }); - const started = new Date(); - const ended = new Date(); + const started = Date.vnNew(); + const ended = Date.vnNew(); if (!travel) throw new UserError('Travel not found'); @@ -56,7 +56,7 @@ module.exports = Self => { travel.warehouseOutFk, travel.warehouseInFk, travel.ref, - travel.agencyFk + travel.agencyModeFk ] ); stmts.push(stmt); @@ -76,7 +76,7 @@ module.exports = Self => { 'landed', 'warehouseInFk', 'warehouseOutFk', - 'agencyFk', + 'agencyModeFk', 'ref' ] }); diff --git a/modules/travel/back/methods/travel/extraCommunityEmail.js b/modules/travel/back/methods/travel/extraCommunityEmail.js new file mode 100644 index 000000000..f4b09b79d --- /dev/null +++ b/modules/travel/back/methods/travel/extraCommunityEmail.js @@ -0,0 +1,76 @@ +module.exports = Self => { + Self.remoteMethodCtx('extraCommunityEmail', { + description: 'Sends the extra community email with an attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'replyTo', + type: 'string', + description: 'The sender email to reply to', + required: false + }, + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id to send to the recipient preferred language', + required: false + }, + { + arg: 'landedTo', + type: 'date' + }, + { + arg: 'shippedFrom', + type: 'date' + }, + { + arg: 'continent', + type: 'string' + }, + { + arg: 'reference', + type: 'string' + }, + { + arg: 'id', + type: 'number' + }, + { + arg: 'agencyModeFk', + type: 'number' + }, + { + arg: 'warehouseOutFk', + type: 'number' + }, + { + arg: 'warehouseInFk', + type: 'number' + }, + { + arg: 'totalEntries', + type: 'number' + }, + { + arg: 'cargoSupplierFk', + type: 'number' + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/extra-community-email', + verb: 'POST' + } + }); + + Self.extraCommunityEmail = ctx => Self.sendTemplate(ctx, 'extra-community'); +}; diff --git a/modules/travel/back/methods/travel/extraCommunityFilter.js b/modules/travel/back/methods/travel/extraCommunityFilter.js index af6e1ec0a..5ee51de8e 100644 --- a/modules/travel/back/methods/travel/extraCommunityFilter.js +++ b/modules/travel/back/methods/travel/extraCommunityFilter.js @@ -34,7 +34,7 @@ module.exports = Self => { description: 'The landed to date filter' }, { - arg: 'agencyFk', + arg: 'agencyModeFk', type: 'number', description: 'The agencyModeFk id' }, @@ -54,7 +54,7 @@ module.exports = Self => { description: 'The totalEntries filter' }, { - arg: 'ref', + arg: 'reference', type: 'string', description: 'The reference' }, @@ -96,7 +96,7 @@ module.exports = Self => { case 'continent': return {'cnt.code': value}; case 'id': - case 'agencyFk': + case 'agencyModeFk': case 'warehouseOutFk': case 'warehouseInFk': case 'totalEntries': @@ -128,10 +128,11 @@ module.exports = Self => { w.name AS warehouseInFk, w.name AS warehouseInName, SUM(b.stickers) AS stickers, - s.id AS supplierFk, + s.id AS cargoSupplierFk, s.nickname AS cargoSupplierNickname, - CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg, - CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg + s.name AS supplierName, + CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg, + CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg FROM travel t LEFT JOIN supplier s ON s.id = t.cargoSupplierFk LEFT JOIN entry e ON e.travelFk = t.id @@ -143,7 +144,8 @@ module.exports = Self => { JOIN warehouse wo ON wo.id = t.warehouseOutFk JOIN country c ON c.id = wo.countryFk LEFT JOIN continent cnt ON cnt.id = c.continentFk - JOIN agencyMode am ON am.id = t.agencyFk` + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN vn.volumeConfig vc` ); stmt.merge(conn.makeWhere(filter.where)); @@ -158,21 +160,25 @@ module.exports = Self => { `SELECT e.id, e.travelFk, - e.ref, + e.reference, + e.invoiceNumber, e.loadPriority, + s.id AS supplierFk, s.name AS supplierName, SUM(b.stickers) AS stickers, e.evaNotes, e.notes, - CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedkg, - CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg - FROM tmp.travel tr + e.invoiceAmount, + CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) as loadedkg, + CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) AS DECIMAL(10,0)) as volumeKg + FROM tmp.travel tr JOIN entry e ON e.travelFk = tr.id JOIN buy b ON b.entryFk = e.id JOIN packaging pkg ON pkg.id = b.packageFk JOIN item i ON i.id = b.itemFk JOIN itemType it ON it.id = i.typeFk - JOIN supplier s ON s.id = e.supplierFk` + JOIN supplier s ON s.id = e.supplierFk + JOIN vn.volumeConfig vc` ); stmt.merge(conn.makeGroupBy('e.id')); diff --git a/modules/travel/back/methods/travel/extraCommunityPdf.js b/modules/travel/back/methods/travel/extraCommunityPdf.js new file mode 100644 index 000000000..676b98be2 --- /dev/null +++ b/modules/travel/back/methods/travel/extraCommunityPdf.js @@ -0,0 +1,85 @@ +module.exports = Self => { + Self.remoteMethodCtx('extraCommunityPdf', { + description: 'Returns the extra community pdf', + accessType: 'READ', + accepts: [ + { + arg: 'recipientId', + type: 'number', + description: 'The recipient id', + required: false + }, + { + arg: 'filter', + type: 'object', + description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string' + }, + { + arg: 'search', + type: 'string', + description: 'Searchs the travel by id' + }, + { + arg: 'landedTo', + type: 'date' + }, + { + arg: 'shippedFrom', + type: 'date' + }, + { + arg: 'continent', + type: 'string' + }, + { + arg: 'reference', + type: 'string' + }, + { + arg: 'id', + type: 'number' + }, + { + arg: 'agencyModeFk', + type: 'number' + }, + { + arg: 'warehouseOutFk', + type: 'number' + }, + { + arg: 'warehouseInFk', + type: 'number' + }, + { + arg: 'totalEntries', + type: 'number' + }, + { + arg: 'cargoSupplierFk', + type: 'number' + } + ], + 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: '/extra-community-pdf', + verb: 'GET' + } + }); + + Self.extraCommunityPdf = ctx => Self.printReport(ctx, null, 'extra-community'); +}; diff --git a/modules/travel/back/methods/travel/filter.js b/modules/travel/back/methods/travel/filter.js index 586b4e5aa..3fa1d65f9 100644 --- a/modules/travel/back/methods/travel/filter.js +++ b/modules/travel/back/methods/travel/filter.js @@ -44,7 +44,7 @@ module.exports = Self => { description: 'The landed to date filter', http: {source: 'query'} }, { - arg: 'agencyFk', + arg: 'agencyModeFk', type: 'number', description: 'The agencyModeFk id', http: {source: 'query'} @@ -102,7 +102,7 @@ module.exports = Self => { case 'landedTo': return {'t.landed': {lte: value}}; case 'id': - case 'agencyFk': + case 'agencyModeFk': case 'warehouseOutFk': case 'warehouseInFk': case 'totalEntries': @@ -124,7 +124,7 @@ module.exports = Self => { t.landed, t.warehouseInFk, t.warehouseOutFk, - t.agencyFk, + t.agencyModeFk, t.ref, t.isDelivered, t.isReceived, @@ -137,7 +137,7 @@ module.exports = Self => { wout.name warehouseOutName, cnt.code continent FROM vn.travel t - JOIN vn.agencyMode am ON am.id = t.agencyFk + JOIN vn.agencyMode am ON am.id = t.agencyModeFk JOIN vn.warehouse win ON win.id = t.warehouseInFk JOIN vn.warehouse wout ON wout.id = t.warehouseOutFk JOIN warehouse wo ON wo.id = t.warehouseOutFk diff --git a/modules/travel/back/methods/travel/getAverageDays.js b/modules/travel/back/methods/travel/getAverageDays.js index 9a9649d84..d888d80c1 100644 --- a/modules/travel/back/methods/travel/getAverageDays.js +++ b/modules/travel/back/methods/travel/getAverageDays.js @@ -32,9 +32,9 @@ module.exports = Self => { t.warehouseOutFk, t.landed, t.shipped, - t.agencyFk + t.agencyModeFk FROM travel t - WHERE t.agencyFk = ? LIMIT 50)`, [agencyModeFk]); + WHERE t.agencyModeFk = ? LIMIT 50)`, [agencyModeFk]); stmts.push(stmt); stmt = new ParameterizedSQL(` @@ -44,10 +44,10 @@ module.exports = Self => { t.warehouseOutFk, (SELECT ROUND(AVG(DATEDIFF(t.landed, t.shipped ))) FROM tmp.travel t - WHERE t.agencyFk + WHERE t.agencyModeFk ORDER BY id DESC LIMIT 50) AS dayDuration FROM tmp.travel t - WHERE t.agencyFk + WHERE t.agencyModeFk ORDER BY t.id DESC LIMIT 1`); const avgDaysIndex = stmts.push(stmt) - 1; diff --git a/modules/travel/back/methods/travel/getEntries.js b/modules/travel/back/methods/travel/getEntries.js index ae7c7a53b..5ca12f7a1 100644 --- a/modules/travel/back/methods/travel/getEntries.js +++ b/modules/travel/back/methods/travel/getEntries.js @@ -1,4 +1,4 @@ - +/* eslint max-len: ["error", { "code": 150 }]*/ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; module.exports = Self => { Self.remoteMethod('getEntries', { @@ -25,27 +25,34 @@ module.exports = Self => { let stmt; stmt = new ParameterizedSQL(` - SELECT e.travelFk, e.id, e.isConfirmed, e.ref, e.notes, e.evaNotes AS observation, - s.name AS supplierName, - CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap)) - * b.stickers)/1000000)/((pcc.width*pcc.depth*pcc.height)/1000000) AS DECIMAL(10,2)) cc, - CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap)) - * b.stickers)/1000000)/((ppallet.width*ppallet.depth*ppallet.height)/1000000) AS DECIMAL(10,2)) pallet, - CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap)) - * b.stickers)/1000000) AS DECIMAL(10,2)) m3, - TRUNCATE(SUM(b.stickers)/(COUNT( b.id) / COUNT( DISTINCT b.id)),0) hb, - CAST(SUM(b.freightValue*b.quantity) AS DECIMAL(10,2)) freightValue, - CAST(SUM(b.packageValue*b.quantity) AS DECIMAL(10,2)) packageValue + SELECT + e.travelFk, + e.id, + e.isConfirmed, + e.invoiceNumber, + e.reference, + e.notes, + e.evaNotes AS observation, + s.name AS supplierName, + CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap)) + * b.stickers)/1000000)/((pcc.width*pcc.depth*pcc.height)/1000000) AS DECIMAL(10,2)) cc, + CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap)) + * b.stickers)/1000000)/((ppallet.width*ppallet.depth*ppallet.height)/1000000) AS DECIMAL(10,2)) pallet, + CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap)) + * b.stickers)/1000000) AS DECIMAL(10,2)) m3, + TRUNCATE(SUM(b.stickers)/(COUNT( b.id) / COUNT( DISTINCT b.id)),0) hb, + CAST(SUM(b.freightValue*b.quantity) AS DECIMAL(10,2)) freightValue, + CAST(SUM(b.packageValue*b.quantity) AS DECIMAL(10,2)) packageValue FROM vn.travel t - LEFT JOIN vn.entry e ON t.id = e.travelFk + LEFT JOIN vn.entry e ON t.id = e.travelFk LEFT JOIN vn.buy b ON b.entryFk = e.id - LEFT JOIN vn.supplier s ON e.supplierFk = s.id + LEFT JOIN vn.supplier s ON e.supplierFk = s.id JOIN vn.item i ON i.id = b.itemFk LEFT JOIN vn.packaging p ON p.id = b.packageFk JOIN vn.packaging pcc ON pcc.id = 'cc' JOIN vn.packaging ppallet ON ppallet.id = 'pallet 100' JOIN vn.packagingConfig pconfig - WHERE t.id = ? + WHERE t.id = ? GROUP BY e.id;`, [ id ]); diff --git a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js index aa92fa308..0e434e048 100644 --- a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js +++ b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js @@ -49,7 +49,7 @@ describe('Travel cloneWithEntries()', () => { pending('#2687 - Cannot make a data rollback because of the triggers'); const warehouseThree = 3; const agencyModeOne = 1; - const yesterday = new Date(); + const yesterday = Date.vnNew(); yesterday.setDate(yesterday.getDate() - 1); travelBefore = await models.Travel.findById(travelId); @@ -71,7 +71,7 @@ describe('Travel cloneWithEntries()', () => { expect(newTravel.ref).toEqual('fifth travel'); expect(newTravel.warehouseInFk).toEqual(warehouseThree); expect(newTravel.warehouseOutFk).toEqual(warehouseThree); - expect(newTravel.agencyFk).toEqual(agencyModeOne); + expect(newTravel.agencyModeFk).toEqual(agencyModeOne); expect(travelEntries.length).toBeGreaterThan(0); }); }); diff --git a/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js b/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js index b74160efe..599851b55 100644 --- a/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js +++ b/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js @@ -70,10 +70,10 @@ describe('Travel extraCommunityFilter()', () => { expect(result.length).toEqual(3); }); - it('should return the travel matching "agencyFk"', async() => { + it('should return the travel matching "agencyModeFk"', async() => { const ctx = { args: { - agencyFk: 1 + agencyModeFk: 1 } }; @@ -95,10 +95,10 @@ describe('Travel extraCommunityFilter()', () => { }); it('should return the routes matching "shipped from" and "landed to"', async() => { - const from = new Date(); + const from = Date.vnNew(); from.setDate(from.getDate() - 2); from.setHours(0, 0, 0, 0); - const to = new Date(); + const to = Date.vnNew(); to.setHours(23, 59, 59, 999); to.setDate(to.getDate() + 7); const ctx = { diff --git a/modules/travel/back/methods/travel/specs/filter.spec.js b/modules/travel/back/methods/travel/specs/filter.spec.js index c739866a0..1a6ee895c 100644 --- a/modules/travel/back/methods/travel/specs/filter.spec.js +++ b/modules/travel/back/methods/travel/specs/filter.spec.js @@ -54,8 +54,8 @@ describe('Travel filter()', () => { }); it('should return the routes matching "shipped from" and "shipped to"', async() => { - const from = new Date(); - const to = new Date(); + const from = Date.vnNew(); + const to = Date.vnNew(); from.setHours(0, 0, 0, 0); to.setHours(23, 59, 59, 999); to.setDate(to.getDate() + 1); diff --git a/modules/travel/back/methods/travel/specs/getEntries.spec.js b/modules/travel/back/methods/travel/specs/getEntries.spec.js index 9b5c4fe49..fcaa80d02 100644 --- a/modules/travel/back/methods/travel/specs/getEntries.spec.js +++ b/modules/travel/back/methods/travel/specs/getEntries.spec.js @@ -1,28 +1,34 @@ -const app = require('vn-loopback/server/server'); +const models = require('vn-loopback/server/server').models; describe('travel getEntries()', () => { const travelId = 1; it('should check the response contains the id', async() => { - const entries = await app.models.Travel.getEntries(travelId); + const entries = await models.Travel.getEntries(travelId); expect(entries.length).toEqual(1); expect(entries[0].id).toEqual(1); }); it('should check the response contains the travelFk', async() => { - const entries = await app.models.Travel.getEntries(travelId); + const entries = await models.Travel.getEntries(travelId); expect(entries[0].travelFk).toEqual(1); }); - it('should check the response contains the ref', async() => { - const entries = await app.models.Travel.getEntries(travelId); + it('should check the response contains the reference', async() => { + const entries = await models.Travel.getEntries(travelId); - expect(entries[0].ref).toEqual('Movement 1'); + expect(entries[0].reference).toEqual('Movement 1'); + }); + + it('should check the response contains the invoiceNumber', async() => { + const entries = await models.Travel.getEntries(travelId); + + expect(entries[0].invoiceNumber).toEqual('IN2001'); }); it('should check the response contains the m3', async() => { - const entries = await app.models.Travel.getEntries(travelId); + const entries = await models.Travel.getEntries(travelId); expect(entries[0].m3).toEqual(0.22); }); diff --git a/modules/travel/back/models/travel.js b/modules/travel/back/models/travel.js index 046153ee2..4bcf7b31d 100644 --- a/modules/travel/back/models/travel.js +++ b/modules/travel/back/models/travel.js @@ -10,6 +10,8 @@ module.exports = Self => { require('../methods/travel/extraCommunityFilter')(Self); require('../methods/travel/getAverageDays')(Self); require('../methods/travel/cloneWithEntries')(Self); + require('../methods/travel/extraCommunityPdf')(Self); + require('../methods/travel/extraCommunityEmail')(Self); Self.rewriteDbError(function(err) { if (err.code === 'ER_DUP_ENTRY') diff --git a/modules/travel/back/models/travel.json b/modules/travel/back/models/travel.json index 95330e263..7dd9f5bba 100644 --- a/modules/travel/back/models/travel.json +++ b/modules/travel/back/models/travel.json @@ -3,7 +3,8 @@ "base": "Loggable", "log": { "model":"TravelLog", - "showField": "ref" + "showField": "ref", + "grabUser": true }, "options": { "mysql": { @@ -44,17 +45,14 @@ "type": "number" }, "agencyModeFk": { - "type": "number", - "mysql": { - "columnName": "agencyFk" - } + "type": "number" } }, "relations": { "agency": { "type": "belongsTo", "model": "AgencyMode", - "foreignKey": "agencyFk" + "foreignKey": "agencyModeFk" }, "warehouseIn": { "type": "belongsTo", diff --git a/modules/travel/front/create/index.spec.js b/modules/travel/front/create/index.spec.js index e3f85d9ae..cdff8cfb9 100644 --- a/modules/travel/front/create/index.spec.js +++ b/modules/travel/front/create/index.spec.js @@ -53,7 +53,7 @@ describe('Travel Component vnTravelCreate', () => { it(`should do nothing if there's no response data.`, () => { controller.travel = {agencyModeFk: 4}; - const tomorrow = new Date(); + const tomorrow = Date.vnNew(); const query = `travels/getAverageDays?agencyModeFk=${controller.travel.agencyModeFk}`; $httpBackend.expectGET(query).respond(undefined); @@ -67,7 +67,7 @@ describe('Travel Component vnTravelCreate', () => { it(`should fill the fields when it's selected a date and agency.`, () => { controller.travel = {agencyModeFk: 1}; - const tomorrow = new Date(); + const tomorrow = Date.vnNew(); tomorrow.setDate(tomorrow.getDate() + 9); const expectedResponse = { id: 8, diff --git a/modules/travel/front/descriptor-menu/index.js b/modules/travel/front/descriptor-menu/index.js index 25922815e..0630bb618 100644 --- a/modules/travel/front/descriptor-menu/index.js +++ b/modules/travel/front/descriptor-menu/index.js @@ -25,7 +25,7 @@ class Controller extends Section { 'shipped', 'landed', 'totalEntries', - 'agencyFk', + 'agencyModeFk', 'warehouseInFk', 'warehouseOutFk', 'cargoSupplierFk' @@ -64,7 +64,7 @@ class Controller extends Section { onCloneAccept() { const params = JSON.stringify({ ref: this.travel.ref, - agencyModeFk: this.travel.agencyFk, + agencyModeFk: this.travel.agencyModeFk, shipped: this.travel.shipped, landed: this.travel.landed, warehouseInFk: this.travel.warehouseInFk, diff --git a/modules/travel/front/descriptor-menu/index.spec.js b/modules/travel/front/descriptor-menu/index.spec.js index 4ca93a6d6..40319e8e2 100644 --- a/modules/travel/front/descriptor-menu/index.spec.js +++ b/modules/travel/front/descriptor-menu/index.spec.js @@ -18,7 +18,7 @@ describe('Travel Component vnTravelDescriptorMenu', () => { controller.travel = { ref: 'the ref', - agencyFk: 'the agency', + agencyModeFk: 'the agency', shipped: 'the shipped date', landed: 'the landing date', warehouseInFk: 'the receiver warehouse', @@ -29,7 +29,7 @@ describe('Travel Component vnTravelDescriptorMenu', () => { const params = JSON.stringify({ ref: controller.travel.ref, - agencyModeFk: controller.travel.agencyFk, + agencyModeFk: controller.travel.agencyModeFk, shipped: controller.travel.shipped, landed: controller.travel.landed, warehouseInFk: controller.travel.warehouseInFk, diff --git a/modules/travel/front/descriptor/index.js b/modules/travel/front/descriptor/index.js index dc19f68af..b1f2f53be 100644 --- a/modules/travel/front/descriptor/index.js +++ b/modules/travel/front/descriptor/index.js @@ -14,9 +14,9 @@ class Controller extends Descriptor { let travelFilter; const travel = this.travel; - if (travel && travel.agencyFk) { + if (travel && travel.agencyModeFk) { travelFilter = this.travel && JSON.stringify({ - agencyFk: this.travel.agencyFk + agencyModeFk: this.travel.agencyModeFk }); } return travelFilter; diff --git a/modules/travel/front/extra-community-search-panel/index.html b/modules/travel/front/extra-community-search-panel/index.html index 8e51acc15..09fbb8949 100644 --- a/modules/travel/front/extra-community-search-panel/index.html +++ b/modules/travel/front/extra-community-search-panel/index.html @@ -29,7 +29,7 @@ @@ -50,15 +50,15 @@ @@ -84,4 +84,4 @@ - \ No newline at end of file + diff --git a/modules/travel/front/extra-community/index.html b/modules/travel/front/extra-community/index.html index 0b94c6c1e..c888f97da 100644 --- a/modules/travel/front/extra-community/index.html +++ b/modules/travel/front/extra-community/index.html @@ -1,8 +1,9 @@ @@ -18,112 +19,171 @@ model="model"> - - -
- - - - - - - - Id - Supplier - Freighter - Reference - Packages - Bl. KG - Phy. KG - Vol. KG - - Wh. Out - - W. Shipped - - Wh. In - - W. Landed - - - - - - + + +
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + +
+ Id + + Supplier + + Agency + + Amount + + Reference + + Packages + + Bl. KG + + Phy. KG + + Vol. KG + + Wh. Out + + W. Shipped + + Wh. In + + W. Landed +
+ {{::travel.id}} - - {{::travel.agencyModeName}} - {{::travel.cargoSupplierNickname}} - - {{travel.ref}} - - - - - - {{::travel.stickers}} - - {{travel.kg}} - - - - - - {{::travel.loadedKg}} - {{::travel.volumeKg}} - {{::travel.warehouseOutName}} - {{::travel.shipped | date: 'dd/MM/yyyy'}} - {{::travel.warehouseInName}} - {{::travel.landed | date: 'dd/MM/yyyy'}} - - + + + {{::travel.cargoSupplierNickname}} + + {{::travel.agencyModeName}} + + {{travel.ref}} + + + + + + {{::travel.stickers}} + + {{travel.kg}} + + + + + + {{::travel.loadedKg}}{{::travel.volumeKg}}{{::travel.warehouseOutName}}{{::travel.shipped | date: 'dd/MM/yyyy'}}{{::travel.warehouseInName}}{{::travel.landed | date: 'dd/MM/yyyy'}}
{{::entry.id}} - - {{::entry.supplierName}} - - {{::entry.ref}} - {{::entry.stickers}} - - {{::entry.loadedkg}} - {{::entry.volumeKg}} - - - {{::entry.notes}} + + + {{::entry.supplierName}} - - - - {{::entry.evaNotes}} - - - - - - - - - - + {{::entry.invoiceAmount | currency: 'EUR': 2}}{{::entry.invoiceNumber}}{{::entry.stickers}}{{::entry.loadedkg}}{{::entry.volumeKg}}
+
+
+ - + + diff --git a/modules/travel/front/extra-community/index.js b/modules/travel/front/extra-community/index.js index a380c1ed8..2028c9c19 100644 --- a/modules/travel/front/extra-community/index.js +++ b/modules/travel/front/extra-community/index.js @@ -14,16 +14,23 @@ class Controller extends Section { draggable.addEventListener('dragend', event => this.dragEnd(event)); - this.draggableElement = 'a[draggable]'; - this.droppableElement = 'vn-tbody[vn-droppable]'; + draggable.addEventListener('dragover', + event => this.dragOver(event)); + draggable.addEventListener('dragenter', + event => this.dragEnter(event)); + draggable.addEventListener('dragleave', + event => this.dragLeave(event)); + + this.draggableElement = 'tr[draggable]'; + this.droppableElement = 'tbody[vn-droppable]'; const twoDays = 2; - const shippedFrom = new Date(); + const shippedFrom = Date.vnNew(); shippedFrom.setDate(shippedFrom.getDate() - twoDays); shippedFrom.setHours(0, 0, 0, 0); const sevenDays = 7; - const landedTo = new Date(); + const landedTo = Date.vnNew(); landedTo.setDate(landedTo.getDate() + sevenDays); landedTo.setHours(23, 59, 59, 59); @@ -32,16 +39,17 @@ class Controller extends Section { landedTo: landedTo, continent: 'AM' }; + + this.smartTableOptions = {}; } - get hasDateRange() { - const userParams = this.$.model.userParams; - const hasLanded = userParams.landedTo; - const hasShipped = userParams.shippedFrom; - const hasContinent = userParams.continent; - const hasWarehouseOut = userParams.warehouseOutFk; + onDragInterval() { + if (this.dragClientY > 0 && this.dragClientY < 75) + this.$window.scrollTo(0, this.$window.scrollY - 10); - return hasLanded || hasShipped || hasContinent || hasWarehouseOut; + const maxHeight = window.screen.availHeight - (window.outerHeight - window.innerHeight); + if (this.dragClientY > maxHeight - 75 && this.dragClientY < maxHeight) + this.$window.scrollTo(0, this.$window.scrollY + 10); } findDraggable($event) { @@ -65,6 +73,7 @@ class Controller extends Section { const id = parseInt(draggable.id); this.entryId = id; this.entry = draggable; + this.interval = setInterval(() => this.onDragInterval(), 50); } dragEnd($event) { @@ -72,6 +81,8 @@ class Controller extends Section { draggable.classList.remove('dragging'); this.entryId = null; this.entry = null; + + clearInterval(this.interval); } onDrop($event) { @@ -91,6 +102,37 @@ class Controller extends Section { } } + undrop() { + if (!this.dropping) return; + this.dropping.classList.remove('dropping'); + this.dropping = null; + } + + dragOver($event) { + this.dragClientY = $event.clientY; + $event.preventDefault(); + } + + dragEnter($event) { + let element = this.findDroppable($event); + if (element) this.dropCount++; + + if (element != this.dropping) { + this.undrop(); + if (element) element.classList.add('dropping'); + this.dropping = element; + } + } + + dragLeave($event) { + let element = this.findDroppable($event); + + if (element) { + this.dropCount--; + if (this.dropCount == 0) this.undrop(); + } + } + save(id, data) { const endpoint = `Travels/${id}`; this.$http.patch(endpoint, data) @@ -99,13 +141,16 @@ class Controller extends Section { get reportParams() { const userParams = this.$.model.userParams; + const currentFilter = this.$.model.currentFilter; + return Object.assign({ - authorization: this.vnToken.token + authorization: this.vnToken.token, + filter: currentFilter }, userParams); } showReport() { - this.vnReport.show('extra-community', this.reportParams); + this.vnReport.show(`Travels/extra-community-pdf`, this.reportParams); } } diff --git a/modules/travel/front/extra-community/index.spec.js b/modules/travel/front/extra-community/index.spec.js index 59688a46c..18ddee665 100644 --- a/modules/travel/front/extra-community/index.spec.js +++ b/modules/travel/front/extra-community/index.spec.js @@ -14,20 +14,9 @@ describe('Travel Component vnTravelExtraCommunity', () => { controller.$.model.refresh = jest.fn(); })); - describe('hasDateRange()', () => { - it('should return truthy when shippedFrom or landedTo are set as userParams', () => { - const now = new Date(); - controller.$.model.userParams = {shippedFrom: now, landedTo: now}; - - const result = controller.hasDateRange; - - expect(result).toBeTruthy(); - }); - }); - describe('findDraggable()', () => { it('should find the draggable element', () => { - const draggable = document.createElement('a'); + const draggable = document.createElement('tr'); draggable.setAttribute('draggable', true); const $event = new Event('dragstart'); @@ -43,7 +32,7 @@ describe('Travel Component vnTravelExtraCommunity', () => { describe('findDroppable()', () => { it('should find the droppable element', () => { - const droppable = document.createElement('vn-tbody'); + const droppable = document.createElement('tbody'); droppable.setAttribute('vn-droppable', true); const $event = new Event('drop'); @@ -58,9 +47,9 @@ describe('Travel Component vnTravelExtraCommunity', () => { }); describe('dragStart()', () => { - it(`should add the class "dragging" to the draggable element + it(`should add the class "dragging" to the draggable element and then set the entryId controller property`, () => { - const draggable = document.createElement('a'); + const draggable = document.createElement('tr'); draggable.setAttribute('draggable', true); draggable.setAttribute('id', 3); @@ -78,9 +67,9 @@ describe('Travel Component vnTravelExtraCommunity', () => { }); describe('dragEnd()', () => { - it(`should remove the class "dragging" from the draggable element + it(`should remove the class "dragging" from the draggable element and then set the entryId controller property to null`, () => { - const draggable = document.createElement('a'); + const draggable = document.createElement('tr'); draggable.setAttribute('draggable', true); draggable.setAttribute('id', 3); draggable.classList.add('dragging'); @@ -100,13 +89,13 @@ describe('Travel Component vnTravelExtraCommunity', () => { describe('onDrop()', () => { it('should make an HTTP patch query', () => { - const droppable = document.createElement('vn-tbody'); + const droppable = document.createElement('tbody'); droppable.setAttribute('vn-droppable', true); droppable.setAttribute('id', 1); jest.spyOn(controller, 'findDroppable').mockReturnValue(droppable); - const oldDroppable = document.createElement('vn-tbody'); + const oldDroppable = document.createElement('tbody'); oldDroppable.setAttribute('vn-droppable', true); const entry = document.createElement('div'); oldDroppable.appendChild(entry); diff --git a/modules/travel/front/extra-community/locale/es.yml b/modules/travel/front/extra-community/locale/es.yml index dc231226f..ed6179c91 100644 --- a/modules/travel/front/extra-community/locale/es.yml +++ b/modules/travel/front/extra-community/locale/es.yml @@ -6,6 +6,6 @@ Phy. KG: KG físico Vol. KG: KG Vol. Search by travel id or reference: Buscar por id de travel o referencia Search by extra community travel: Buscar por envío extra comunitario -Continent Out: Continente salida +Continent Out: Cont. salida W. Shipped: F. envío -W. Landed: F. llegada \ No newline at end of file +W. Landed: F. llegada diff --git a/modules/travel/front/extra-community/style.scss b/modules/travel/front/extra-community/style.scss index f903f94ea..fb64822f9 100644 --- a/modules/travel/front/extra-community/style.scss +++ b/modules/travel/front/extra-community/style.scss @@ -3,7 +3,6 @@ vn-travel-extra-community { .header { margin-bottom: 16px; - font-size: 1.25rem; line-height: 1; padding: 7px; padding-bottom: 7px; @@ -15,6 +14,46 @@ vn-travel-extra-community { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + cursor: pointer; + .multi-line{ + padding-top: 15px; + padding-bottom: 15px; + } + } + + table[vn-droppable] { + border-radius: 0; + } + + tr[draggable] { + transition: all .5s; + cursor: move; + overflow: auto; + outline: 0; + height: 65px; + pointer-events: fill; + user-select: all; + } + + tr[draggable] *::selection { + background-color: transparent; + } + + tr[draggable]:hover { + background-color: $color-hover-cd; + } + + tr[draggable].dragging { + background-color: $color-primary-light; + color: $color-font-light; + font-weight: bold; + } + + + .multi-line{ + max-width: 200px; + word-wrap: normal; + white-space: normal; } vn-td-editable text { @@ -25,31 +64,4 @@ vn-travel-extra-community { border-radius: 0; color: $color-active } - - vn-td-editable:hover text:after { - font-family: 'Material Icons'; - content: 'edit'; - position: absolute; - right: -15px; - color: $color-spacer - } - - vn-table[vn-droppable] { - border-radius: 0; - } - - a[draggable] { - transition: all .5s; - cursor: move; - outline: 0; - } - - a[draggable]:hover { - background-color: $color-hover-cd - } - - a[draggable].dragging { - background-color: $color-success-light; - font-weight:bold - } -} \ No newline at end of file +} diff --git a/modules/travel/front/index/index.html b/modules/travel/front/index/index.html index 8510cf328..a768e4a29 100644 --- a/modules/travel/front/index/index.html +++ b/modules/travel/front/index/index.html @@ -2,6 +2,15 @@ + + + + @@ -9,23 +18,22 @@ - Id Reference - Agency + Agency Warehouse Out Shipped - Delivered + Warehouse In Landed - Received + + Total entries -
- {{::travel.id}} {{::travel.ref}} {{::travel.agencyModeName}} {{::travel.warehouseOutName}} @@ -34,14 +42,27 @@ {{::travel.shipped | date:'dd/MM/yyyy'}} - + + + + {{::travel.warehouseInName}} {{::travel.landed | date:'dd/MM/yyyy'}} - + + + + + {{::travel.totalEntries}} - @@ -78,38 +99,9 @@ fixed-bottom-right> - - - - - Filter by selection - - - Exclude selection - - - Remove filter - - - Remove all filters - - - Copy value - - - \ No newline at end of file diff --git a/modules/travel/front/index/index.js b/modules/travel/front/index/index.js index 5cae6fa06..a570146fe 100644 --- a/modules/travel/front/index/index.js +++ b/modules/travel/front/index/index.js @@ -1,5 +1,6 @@ import ngModule from '../module'; import Section from 'salix/components/section'; +import './style.scss'; export default class Controller extends Section { preview(travel) { @@ -10,7 +11,7 @@ export default class Controller extends Section { onCloneAccept(travel) { const params = JSON.stringify({ ref: travel.ref, - agencyModeFk: travel.agencyFk, + agencyModeFk: travel.agencyModeFk, shipped: travel.shipped, landed: travel.landed, warehouseInFk: travel.warehouseInFk, @@ -20,7 +21,7 @@ export default class Controller extends Section { } compareDate(date) { - let today = new Date(); + let today = Date.vnNew(); today.setHours(0, 0, 0, 0); date = new Date(date); @@ -30,37 +31,6 @@ export default class Controller extends Section { if (timeDifference == 0) return 'warning'; if (timeDifference < 0) return 'success'; } - - exprBuilder(param, value) { - switch (param) { - case 'search': - return /^\d+$/.test(value) - ? {'t.id': value} - : {'t.ref': {like: `%${value}%`}}; - case 'ref': - return {'t.ref': {like: `%${value}%`}}; - case 'shipped': - return {'t.shipped': {between: this.dateRange(value)}}; - case 'landed': - return {'t.landed': {between: this.dateRange(value)}}; - case 'id': - case 'agencyFk': - case 'warehouseOutFk': - case 'warehouseInFk': - case 'totalEntries': - param = `t.${param}`; - return {[param]: value}; - } - } - - dateRange(value) { - const minHour = new Date(value); - minHour.setHours(0, 0, 0, 0); - const maxHour = new Date(value); - maxHour.setHours(23, 59, 59, 59); - - return [minHour, maxHour]; - } } ngModule.vnComponent('vnTravelIndex', { diff --git a/modules/travel/front/index/index.spec.js b/modules/travel/front/index/index.spec.js index 1b2ab0a87..9083c4519 100644 --- a/modules/travel/front/index/index.spec.js +++ b/modules/travel/front/index/index.spec.js @@ -35,11 +35,11 @@ describe('Travel Component vnTravelIndex', () => { const travel = { ref: 1, - agencyFk: 1 + agencyModeFk: 1 }; const travelParams = { ref: travel.ref, - agencyModeFk: travel.agencyFk + agencyModeFk: travel.agencyModeFk }; const queryParams = JSON.stringify(travelParams); controller.onCloneAccept(travel); @@ -50,7 +50,7 @@ describe('Travel Component vnTravelIndex', () => { describe('compareDate()', () => { it('should return warning if the date passed to compareDate() is todays', () => { - const today = new Date(); + const today = Date.vnNew(); const result = controller.compareDate(today); @@ -58,7 +58,7 @@ describe('Travel Component vnTravelIndex', () => { }); it('should return success if the date passed to compareDate() is in the future', () => { - const tomorrow = new Date(); + const tomorrow = Date.vnNew(); tomorrow.setDate(tomorrow.getDate() + 1); const result = controller.compareDate(tomorrow); @@ -67,7 +67,7 @@ describe('Travel Component vnTravelIndex', () => { }); it('should return undefined if the date passed to compareDate() is in the past', () => { - const yesterday = new Date(); + const yesterday = Date.vnNew(); yesterday.setDate(yesterday.getDate() - 1); const result = controller.compareDate(yesterday); diff --git a/modules/travel/front/index/style.scss b/modules/travel/front/index/style.scss new file mode 100644 index 000000000..ca1cf538b --- /dev/null +++ b/modules/travel/front/index/style.scss @@ -0,0 +1,11 @@ +@import "variables"; + +vn-travel-index { + vn-icon { + color: $color-font-secondary + } + + vn-icon.active { + color: $color-success + } +} diff --git a/modules/travel/front/locale/es.yml b/modules/travel/front/locale/es.yml index 7231d37cd..043702b99 100644 --- a/modules/travel/front/locale/es.yml +++ b/modules/travel/front/locale/es.yml @@ -1,7 +1,7 @@ #Ordenar alfabeticamente Reference: Referencia -Warehouse Out: Almacén salida -Warehouse In: Almacén llegada +Warehouse Out: Alm salida +Warehouse In: Alm llegada Shipped from: Salida desde Shipped to: Salida hasta Landed from: Llegada desde @@ -10,12 +10,12 @@ Shipped: F. salida Landed: F. llegada Delivered: Enviado Received: Recibido -Travel id: Id envío -Search travels by id: Buscar envíos por identificador +Travel id: Id +Search travels by id: Buscar envíos por identificador o referencia New travel: Nuevo envío travel: envío # Sections Travels: Envíos Log: Historial -Thermographs: Termógrafos \ No newline at end of file +Thermographs: Termógrafos diff --git a/modules/travel/front/main/index.html b/modules/travel/front/main/index.html index feb1e8b01..131d9409e 100644 --- a/modules/travel/front/main/index.html +++ b/modules/travel/front/main/index.html @@ -1,20 +1,6 @@ - - - - - \ No newline at end of file + diff --git a/modules/travel/front/main/index.js b/modules/travel/front/main/index.js index d6f103033..6a153f21a 100644 --- a/modules/travel/front/main/index.js +++ b/modules/travel/front/main/index.js @@ -4,28 +4,6 @@ import ModuleMain from 'salix/components/module-main'; export default class Travel extends ModuleMain { constructor() { super(); - - this.filterParams = { - scopeDays: 1 - }; - } - - fetchParams($params) { - if (!Object.entries($params).length) - $params.scopeDays = 1; - - if (typeof $params.scopeDays === 'number') { - const shippedFrom = new Date(); - shippedFrom.setHours(0, 0, 0, 0); - - const shippedTo = new Date(shippedFrom.getTime()); - shippedTo.setDate(shippedTo.getDate() + $params.scopeDays); - shippedTo.setHours(23, 59, 59, 999); - - Object.assign($params, {shippedFrom, shippedTo}); - } - - return $params; } } diff --git a/modules/travel/front/main/index.spec.js b/modules/travel/front/main/index.spec.js deleted file mode 100644 index 6d9db4dc8..000000000 --- a/modules/travel/front/main/index.spec.js +++ /dev/null @@ -1,49 +0,0 @@ -import './index.js'; - -describe('Travel Component vnTravel', () => { - let controller; - - beforeEach(ngModule('travel')); - - beforeEach(inject($componentController => { - let $element = angular.element(`
`); - controller = $componentController('vnTravel', {$element}); - })); - - describe('fetchParams()', () => { - it('should return a range of dates with passed scope days', () => { - let params = controller.fetchParams({ - scopeDays: 2 - }); - const shippedFrom = new Date(); - shippedFrom.setHours(0, 0, 0, 0); - const shippedTo = new Date(shippedFrom.getTime()); - shippedTo.setDate(shippedTo.getDate() + params.scopeDays); - shippedTo.setHours(23, 59, 59, 999); - - const expectedParams = { - shippedFrom, - scopeDays: params.scopeDays, - shippedTo - }; - - expect(params).toEqual(expectedParams); - }); - - it('should return default value for scope days', () => { - let params = controller.fetchParams({ - scopeDays: 1 - }); - - expect(params.scopeDays).toEqual(1); - }); - - it('should return the given scope days', () => { - let params = controller.fetchParams({ - scopeDays: 2 - }); - - expect(params.scopeDays).toEqual(2); - }); - }); -}); diff --git a/modules/travel/front/search-panel/index.html b/modules/travel/front/search-panel/index.html index 8d4edec1a..dd8d98af1 100644 --- a/modules/travel/front/search-panel/index.html +++ b/modules/travel/front/search-panel/index.html @@ -1,109 +1,146 @@ -
-
- - - - - - - - - - - - - - - - -
- - - - - - Or - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
\ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Id/{{$ctrl.$t('Reference')}}: {{$ctrl.filter.search}} + + + {{$ctrl.$t('Agency')}}: {{agency.selection.name}} + + + {{$ctrl.$t('Warehouse Out')}}: {{warehouseOut.selection.name}} + + + {{$ctrl.$t('Warehouse In')}}: {{warehouseIn.selection.name}} + + + {{$ctrl.$t('Days onward')}}: {{$ctrl.filter.scopeDays}} + + + {{$ctrl.$t('Landed from')}}: {{$ctrl.filter.landedFrom | date:'dd/MM/yyyy'}} + + + {{$ctrl.$t('Landed to')}}: {{$ctrl.filter.landedTo | date:'dd/MM/yyyy'}} + + + {{$ctrl.$t('Continent Out')}}: {{continent.selection.name}} + + + {{$ctrl.$t('Total entries')}}: {{$ctrl.filter.totalEntries}} + +
+
diff --git a/modules/travel/front/search-panel/index.js b/modules/travel/front/search-panel/index.js index 877d4f9d3..9cf417da1 100644 --- a/modules/travel/front/search-panel/index.js +++ b/modules/travel/front/search-panel/index.js @@ -1,43 +1,69 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; +import './style.scss'; class Controller extends SearchPanel { constructor($, $element) { super($, $element); - this.filter = this.$.filter; + this.initFilter(); + this.fetchData(); } - get shippedFrom() { - return this._shippedFrom; + $onChanges() { + if (this.model) + this.applyFilters(); } - set shippedFrom(value) { - this._shippedFrom = value; - this.filter.scopeDays = null; + fetchData() { + this.$http.get('AgencyModes').then(res => { + this.agencyModes = res.data; + }); + this.$http.get('Warehouses').then(res => { + this.warehouses = res.data; + }); + this.$http.get('Continents').then(res => { + this.continents = res.data; + }); } - get shippedTo() { - return this._shippedTo; + initFilter() { + this.filter = {}; + if (this.$params.q) { + this.filter = JSON.parse(this.$params.q); + this.search = this.filter.search; + this.totalEntries = this.filter.totalEntries; + } + if (!this.filter.scopeDays) this.filter.scopeDays = 7; } - set shippedTo(value) { - this._shippedTo = value; - this.filter.scopeDays = null; + applyFilters(param) { + this.model.applyFilter({}, this.filter) + .then(() => { + if (param && this.model._orgData.length === 1) + this.$state.go('travel.card.summary', {id: this.model._orgData[0].id}); + else + this.$state.go(this.$state.current.name, {q: JSON.stringify(this.filter)}, {location: 'replace'}); + }); } - get scopeDays() { - return this._scopeDays; + removeParamFilter(param) { + if (this[param]) delete this[param]; + delete this.filter[param]; + this.applyFilters(); } - set scopeDays(value) { - this._scopeDays = value; - - this.filter.shippedFrom = null; - this.filter.shippedTo = null; + onKeyPress($event, param) { + if ($event.key === 'Enter') { + this.filter[param] = this[param]; + this.applyFilters(param === 'search'); + } } } ngModule.vnComponent('vnTravelSearchPanel', { template: require('./index.html'), - controller: Controller + controller: Controller, + bindings: { + model: '<' + } }); diff --git a/modules/travel/front/search-panel/index.spec.js b/modules/travel/front/search-panel/index.spec.js index a1f3c36b3..488143e80 100644 --- a/modules/travel/front/search-panel/index.spec.js +++ b/modules/travel/front/search-panel/index.spec.js @@ -8,41 +8,31 @@ describe('Travel Component vnTravelSearchPanel', () => { beforeEach(inject($componentController => { controller = $componentController('vnTravelSearchPanel', {$element: null}); controller.$t = () => {}; - controller.filter = {}; })); - describe('shippedFrom() setter', () => { - it('should clear the scope days when setting the from property', () => { - controller.filter.scopeDays = 1; + describe('applyFilters()', () => { + it('should apply filters', async() => { + controller.filter = {foo: 'bar'}; + controller.model = { + applyFilter: jest.fn().mockResolvedValue(), + _orgData: [{id: 1}] + }; + controller.$state = { + current: { + name: 'foo' + }, + go: jest.fn() + }; - controller.shippedFrom = new Date(); + await controller.applyFilters(true); - expect(controller.filter.scopeDays).toBeNull(); - expect(controller.shippedFrom).toBeDefined(); - }); - }); + expect(controller.model.applyFilter).toHaveBeenCalledWith({}, controller.filter); + expect(controller.$state.go).toHaveBeenCalledWith('travel.card.summary', {id: 1}); - describe('shippedTo() setter', () => { - it('should clear the scope days when setting the to property', () => { - controller.filter.scopeDays = 1; + await controller.applyFilters(false); - controller.shippedTo = new Date(); - - expect(controller.filter.scopeDays).toBeNull(); - expect(controller.shippedTo).toBeDefined(); - }); - }); - - describe('scopeDays() setter', () => { - it('should clear the date range when setting the scopeDays property', () => { - controller.filter.shippedFrom = new Date(); - controller.filter.shippedTo = new Date(); - - controller.scopeDays = 1; - - expect(controller.filter.shippedFrom).toBeNull(); - expect(controller.filter.shippedTo).toBeNull(); - expect(controller.scopeDays).toBeDefined(); + expect(controller.$state.go).toHaveBeenCalledWith(controller.$state.current.name, + {q: JSON.stringify(controller.filter)}, {location: 'replace'}); }); }); }); diff --git a/modules/travel/front/search-panel/style.scss b/modules/travel/front/search-panel/style.scss new file mode 100644 index 000000000..94fe7b239 --- /dev/null +++ b/modules/travel/front/search-panel/style.scss @@ -0,0 +1,37 @@ +@import "variables"; + +vn-travel-search-panel vn-side-menu { + .menu { + min-width: $right-menu-width; + } + & > div { + .input { + padding-left: $spacing-md; + padding-right: $spacing-md; + border-color: $color-spacer; + border-bottom: $border-thin; + } + .horizontal { + padding-left: $spacing-md; + padding-right: $spacing-md; + grid-auto-flow: column; + grid-column-gap: $spacing-sm; + align-items: center; + } + .chips { + display: flex; + flex-wrap: wrap; + padding: $spacing-md; + overflow: hidden; + max-width: 100%; + border-color: $color-spacer; + } + + .or { + align-self: center; + font-weight: bold; + font-size: 26px; + color: $color-font-secondary; + } + } +} diff --git a/modules/travel/front/summary/index.html b/modules/travel/front/summary/index.html index bd9d6c9cb..113128e0e 100644 --- a/modules/travel/front/summary/index.html +++ b/modules/travel/front/summary/index.html @@ -1,6 +1,6 @@
- @@ -36,7 +36,7 @@ value="{{$ctrl.travelData.warehouseIn.name}}"> @@ -80,7 +80,7 @@ - @@ -99,7 +99,7 @@ {{entry.cc}} {{entry.pallet}} {{entry.m3}} - +

- Thermograph

-

Thermograph @@ -168,6 +168,6 @@ - - \ No newline at end of file + diff --git a/modules/travel/front/summary/locale/es.yml b/modules/travel/front/summary/locale/es.yml index aa002fad0..aa6adc938 100644 --- a/modules/travel/front/summary/locale/es.yml +++ b/modules/travel/front/summary/locale/es.yml @@ -1,9 +1,9 @@ Reference: Referencia -Warehouse In: Almacén entrada -Warehouse Out: Almacén salida +Warehouse In: Alm. entrada +Warehouse Out: Alm. salida Shipped: F. envío Landed: F. entrega -Total entries: Entradas totales +Total entries: Ent. totales Delivered: Enviada Received: Recibida Agency: Agencia diff --git a/modules/wagon/back/methods/wagonType/createWagonType.js b/modules/wagon/back/methods/wagonType/createWagonType.js new file mode 100644 index 000000000..fed915b28 --- /dev/null +++ b/modules/wagon/back/methods/wagonType/createWagonType.js @@ -0,0 +1,57 @@ +module.exports = Self => { + Self.remoteMethodCtx('createWagonType', { + description: 'Creates a new wagon type', + accessType: 'WRITE', + accepts: [ + { + arg: 'name', + type: 'String', + required: true + }, + { + arg: 'divisible', + type: 'boolean', + required: true + }, { + arg: 'trays', + type: 'any', + required: true + } + ], + http: { + path: `/createWagonType`, + verb: 'PATCH' + } + }); + + Self.createWagonType = async(ctx, options) => { + const args = ctx.args; + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const newWagonType = await models.WagonType.create({name: args.name, divisible: args.divisible}, myOptions); + args.trays.forEach(async tray => { + await models.WagonTypeTray.create({ + typeFk: newWagonType.id, + height: tray.position, + colorFk: tray.color.id + }, myOptions); + }); + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/wagon/back/methods/wagonType/deleteWagonType.js b/modules/wagon/back/methods/wagonType/deleteWagonType.js new file mode 100644 index 000000000..46b65e32f --- /dev/null +++ b/modules/wagon/back/methods/wagonType/deleteWagonType.js @@ -0,0 +1,43 @@ +module.exports = Self => { + Self.remoteMethodCtx('deleteWagonType', { + description: 'Deletes a wagon type', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'Number', + required: true + } + ], + http: { + path: `/deleteWagonType`, + verb: 'DELETE' + } + }); + + Self.deleteWagonType = async(ctx, options) => { + const args = ctx.args; + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + await models.Wagon.destroyAll({typeFk: args.id}, myOptions); + await models.WagonTypeTray.destroyAll({typeFk: args.id}, myOptions); + await models.WagonType.destroyAll({id: args.id}, myOptions); + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/wagon/back/methods/wagonType/editWagonType.js b/modules/wagon/back/methods/wagonType/editWagonType.js new file mode 100644 index 000000000..bd5ad1f16 --- /dev/null +++ b/modules/wagon/back/methods/wagonType/editWagonType.js @@ -0,0 +1,64 @@ +module.exports = Self => { + Self.remoteMethodCtx('editWagonType', { + description: 'Edits a new wagon type', + accessType: 'WRITE', + accepts: [ + { + arg: 'id', + type: 'String', + required: true + }, + { + arg: 'name', + type: 'String', + required: true + }, + { + arg: 'divisible', + type: 'boolean', + required: true + }, { + arg: 'trays', + type: 'any', + required: true + } + ], + http: { + path: `/editWagonType`, + verb: 'PATCH' + } + }); + + Self.editWagonType = async(ctx, options) => { + const args = ctx.args; + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const wagonType = await models.WagonType.findById(args.id, null, myOptions); + wagonType.updateAttributes({name: args.name, divisible: args.divisible}, myOptions); + models.WagonTypeTray.destroyAll({typeFk: args.id}, myOptions); + args.trays.forEach(async tray => { + await models.WagonTypeTray.create({ + typeFk: args.id, + height: tray.position, + colorFk: tray.color.id + }, myOptions); + }); + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/wagon/back/methods/wagonType/specs/crudWagonType.spec.js b/modules/wagon/back/methods/wagonType/specs/crudWagonType.spec.js new file mode 100644 index 000000000..92ac61060 --- /dev/null +++ b/modules/wagon/back/methods/wagonType/specs/crudWagonType.spec.js @@ -0,0 +1,63 @@ +const models = require('vn-loopback/server/server').models; + +describe('WagonType crudWagonType()', () => { + const ctx = { + args: { + name: 'Mock wagon type', + divisible: true, + trays: [{position: 0, color: {id: 1}}, + {position: 50, color: {id: 2}}, + {position: 100, color: {id: 3}}] + } + }; + + it(`should create, edit and delete a new wagon type and its trays`, async() => { + const tx = await models.WagonType.beginTransaction({}); + + try { + const options = {transaction: tx}; + + // create + await models.WagonType.createWagonType(ctx, options); + + const newWagonType = await models.WagonType.findOne({where: {name: ctx.args.name}}, options); + const newWagonTrays = await models.WagonTypeTray.find({where: {typeFk: newWagonType.id}}, options); + + expect(newWagonType).not.toEqual(null); + expect(newWagonType.name).toEqual(ctx.args.name); + expect(newWagonType.divisible).toEqual(ctx.args.divisible); + expect(newWagonTrays.length).toEqual(ctx.args.trays.length); + + ctx.args = { + id: newWagonType.id, + name: 'Edited wagon type', + divisible: false, + trays: [{position: 0, color: {id: 1}}] + }; + + // edit + await models.WagonType.editWagonType(ctx, options); + + const editedWagonType = await models.WagonType.findById(newWagonType.id, null, options); + const editedWagonTrays = await models.WagonTypeTray.find({where: {typeFk: newWagonType.id}}, options); + + expect(editedWagonType.name).toEqual(ctx.args.name); + expect(editedWagonType.divisible).toEqual(ctx.args.divisible); + expect(editedWagonTrays.length).toEqual(ctx.args.trays.length); + + // delete + await models.WagonType.deleteWagonType(ctx, options); + + const deletedWagonType = await models.WagonType.findById(newWagonType.id, null, options); + const deletedWagonTrays = await models.WagonTypeTray.find({where: {typeFk: newWagonType.id}}, options); + + expect(deletedWagonType).toEqual(null); + expect(deletedWagonTrays).toEqual([]); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/wagon/back/model-config.json b/modules/wagon/back/model-config.json new file mode 100644 index 000000000..279d55e5c --- /dev/null +++ b/modules/wagon/back/model-config.json @@ -0,0 +1,23 @@ +{ + "Wagon": { + "dataSource": "vn" + }, + "WagonType": { + "dataSource": "vn" + }, + "WagonTypeColor": { + "dataSource": "vn" + }, + "WagonTypeTray": { + "dataSource": "vn" + }, + "WagonConfig": { + "dataSource": "vn" + }, + "CollectionWagon": { + "dataSource": "vn" + }, + "CollectionWagonTicket": { + "dataSource": "vn" + } +} diff --git a/modules/wagon/back/models/collection-wagon-ticket.json b/modules/wagon/back/models/collection-wagon-ticket.json new file mode 100644 index 000000000..04527205c --- /dev/null +++ b/modules/wagon/back/models/collection-wagon-ticket.json @@ -0,0 +1,43 @@ +{ + "name": "CollectionWagonTicket", + "base": "VnModel", + "options": { + "mysql": { + "table": "collectionWagonTicket" + } + }, + "properties": { + "ticketFk": { + "id": true, + "type": "number" + }, + "wagonFk": { + "type": "number", + "required": true + }, + "trayFk": { + "type": "number", + "required": true + }, + "side": { + "type": "string" + } + }, + "relations": { + "ticket": { + "type": "belongsTo", + "model": "Ticket", + "foreignKey": "ticketFk" + }, + "wagon": { + "type": "belongsTo", + "model": "Wagon", + "foreignKey": "wagonFk" + }, + "tray": { + "type": "belongsTo", + "model": "WagonTypeTray", + "foreignKey": "trayFk" + } + } +} diff --git a/modules/wagon/back/models/collection-wagon.json b/modules/wagon/back/models/collection-wagon.json new file mode 100644 index 000000000..f3f237428 --- /dev/null +++ b/modules/wagon/back/models/collection-wagon.json @@ -0,0 +1,34 @@ +{ + "name": "CollectionWagon", + "base": "VnModel", + "options": { + "mysql": { + "table": "collectionWagon" + } + }, + "properties": { + "collectionFk": { + "id": true, + "type": "number" + }, + "wagonFk": { + "type": "number", + "required": true + }, + "position": { + "type": "number" + } + }, + "relations": { + "collection": { + "type": "belongsTo", + "model": "Collection", + "foreignKey": "collectionFk" + }, + "wagon": { + "type": "belongsTo", + "model": "Wagon", + "foreignKey": "wagonFk" + } + } +} diff --git a/modules/wagon/back/models/wagon-config.json b/modules/wagon/back/models/wagon-config.json new file mode 100644 index 000000000..3d96e2864 --- /dev/null +++ b/modules/wagon/back/models/wagon-config.json @@ -0,0 +1,30 @@ +{ + "name": "WagonConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "wagonConfig" + } + }, + "properties": { + "id": { + "id": true, + "type": "number" + }, + "width": { + "type": "number" + }, + "height": { + "type": "string" + }, + "maxWagonHeight": { + "type": "number" + }, + "minHeightBetweenTrays": { + "type": "number" + }, + "maxTrays": { + "type": "number" + } + } +} diff --git a/modules/wagon/back/models/wagon-type-color.json b/modules/wagon/back/models/wagon-type-color.json new file mode 100644 index 000000000..573fd60f5 --- /dev/null +++ b/modules/wagon/back/models/wagon-type-color.json @@ -0,0 +1,21 @@ +{ + "name": "WagonTypeColor", + "base": "VnModel", + "options": { + "mysql": { + "table": "wagonTypeColor" + } + }, + "properties": { + "id": { + "id": true, + "type": "number" + }, + "name": { + "type": "string" + }, + "rgb": { + "type": "string" + } + } +} diff --git a/modules/wagon/back/models/wagon-type-tray.json b/modules/wagon/back/models/wagon-type-tray.json new file mode 100644 index 000000000..b61510bcf --- /dev/null +++ b/modules/wagon/back/models/wagon-type-tray.json @@ -0,0 +1,36 @@ +{ + "name": "WagonTypeTray", + "base": "VnModel", + "options": { + "mysql": { + "table": "wagonTypeTray" + } + }, + "properties": { + "id": { + "id": true, + "type": "number" + }, + "typeFk": { + "type": "number" + }, + "height": { + "type": "number" + }, + "colorFk": { + "type": "number" + } + }, + "relations": { + "type": { + "type": "belongsTo", + "model": "WagonType", + "foreignKey": "typeFk" + }, + "color": { + "type": "belongsTo", + "model": "WagonTypeColor", + "foreignKey": "colorFk" + } + } +} diff --git a/modules/wagon/back/models/wagon-type.js b/modules/wagon/back/models/wagon-type.js new file mode 100644 index 000000000..bebf7a9d9 --- /dev/null +++ b/modules/wagon/back/models/wagon-type.js @@ -0,0 +1,5 @@ +module.exports = Self => { + require('../methods/wagonType/createWagonType')(Self); + require('../methods/wagonType/editWagonType')(Self); + require('../methods/wagonType/deleteWagonType')(Self); +}; diff --git a/modules/wagon/back/models/wagon-type.json b/modules/wagon/back/models/wagon-type.json new file mode 100644 index 000000000..f57bf957d --- /dev/null +++ b/modules/wagon/back/models/wagon-type.json @@ -0,0 +1,21 @@ +{ + "name": "WagonType", + "base": "VnModel", + "options": { + "mysql": { + "table": "wagonType" + } + }, + "properties": { + "id": { + "id": true, + "type": "number" + }, + "name": { + "type": "string" + }, + "divisible": { + "type": "boolean" + } + } +} diff --git a/modules/wagon/back/models/wagon.json b/modules/wagon/back/models/wagon.json new file mode 100644 index 000000000..61ee61e61 --- /dev/null +++ b/modules/wagon/back/models/wagon.json @@ -0,0 +1,34 @@ +{ + "name": "Wagon", + "base": "VnModel", + "options": { + "mysql": { + "table": "wagon" + } + }, + "properties": { + "id": { + "id": true, + "type": "number" + }, + "label": { + "type": "number" + }, + "volume": { + "type": "number" + }, + "plate": { + "type": "string" + }, + "typeFk": { + "type": "number" + } + }, + "relations": { + "type": { + "type": "belongsTo", + "model": "WagonType", + "foreignKey": "typeFk" + } + } +} diff --git a/modules/worker/back/methods/calendar/absences.js b/modules/worker/back/methods/calendar/absences.js index ddf38a604..8420ed770 100644 --- a/modules/worker/back/methods/calendar/absences.js +++ b/modules/worker/back/methods/calendar/absences.js @@ -35,12 +35,12 @@ module.exports = Self => { Self.absences = async(ctx, workerFk, businessFk, year, options) => { const models = Self.app.models; - const started = new Date(); + const started = Date.vnNew(); started.setFullYear(year); started.setMonth(0); started.setDate(1); - const ended = new Date(); + const ended = Date.vnNew(); ended.setFullYear(year); ended.setMonth(12); ended.setDate(0); diff --git a/modules/worker/back/methods/calendar/specs/absences.spec.js b/modules/worker/back/methods/calendar/specs/absences.spec.js index 812b9c23c..365773182 100644 --- a/modules/worker/back/methods/calendar/specs/absences.spec.js +++ b/modules/worker/back/methods/calendar/specs/absences.spec.js @@ -6,7 +6,7 @@ describe('Worker absences()', () => { const workerId = 1106; const businessId = 1106; - const now = new Date(); + const now = Date.vnNew(); const year = now.getFullYear(); const [absences] = await app.models.Calendar.absences(ctx, workerId, businessId, year); @@ -22,7 +22,7 @@ describe('Worker absences()', () => { const businessId = 1106; const ctx = {req: {accessToken: {userId: 9}}}; - const now = new Date(); + const now = Date.vnNew(); const year = now.getFullYear(); const tx = await app.models.Calendar.beginTransaction({}); @@ -33,7 +33,7 @@ describe('Worker absences()', () => { const worker = await app.models.WorkerLabour.findById(businessId, null, options); await app.models.WorkerLabour.rawSql( - `UPDATE postgresql.business SET date_end = ? WHERE business_id = ?`, + `UPDATE vn.business SET ended = ? WHERE id = ?`, [null, worker.businessFk], options); const [absences] = await app.models.Calendar.absences(ctx, worker.id, businessId, year, options); @@ -55,15 +55,15 @@ describe('Worker absences()', () => { const workerId = 1106; const userId = 1106; - const today = new Date(); + const today = Date.vnNew(); // getting how many days in a year - const yearStart = new Date(); + const yearStart = Date.vnNew(); yearStart.setHours(0, 0, 0, 0); yearStart.setMonth(0); yearStart.setDate(1); - const yearEnd = new Date(); + const yearEnd = Date.vnNew(); const currentYear = yearEnd.getFullYear(); yearEnd.setFullYear(currentYear + 1); yearEnd.setHours(0, 0, 0, 0); @@ -92,13 +92,13 @@ describe('Worker absences()', () => { // normal test begins const contract = await app.models.WorkerLabour.findById(businessId, null, options); - const startingContract = new Date(); + const startingContract = Date.vnNew(); startingContract.setHours(0, 0, 0, 0); startingContract.setMonth(today.getMonth()); startingContract.setDate(1); await app.models.WorkerLabour.rawSql( - `UPDATE postgresql.business SET date_start = ?, date_end = ? WHERE business_id = ?`, + `UPDATE vn.business SET started = ?, ended = ? WHERE id = ?`, [startingContract, yearEnd, contract.businessFk], options ); diff --git a/modules/worker/back/methods/department/specs/removeChild.spec.js b/modules/worker/back/methods/department/specs/removeChild.spec.js index d83e1b819..b769bcaa6 100644 --- a/modules/worker/back/methods/department/specs/removeChild.spec.js +++ b/modules/worker/back/methods/department/specs/removeChild.spec.js @@ -8,7 +8,7 @@ describe('department removeChild()', () => { }); it('should remove a child department', async() => { - const childId = 1; + const childId = 44; removedChild = await app.models.Department.findById(childId); const result = await app.models.Department.removeChild(childId); diff --git a/modules/worker/back/methods/holiday/getByWarehouse.js b/modules/worker/back/methods/holiday/getByWarehouse.js index 093885d13..50029e62b 100644 --- a/modules/worker/back/methods/holiday/getByWarehouse.js +++ b/modules/worker/back/methods/holiday/getByWarehouse.js @@ -17,7 +17,7 @@ module.exports = Self => { }); Self.getByWarehouse = async warehouseFk => { - let beginningYear = new Date(); + let beginningYear = Date.vnNew(); beginningYear.setMonth(0); beginningYear.setDate(1); beginningYear.setHours(0, 0, 0, 0); diff --git a/modules/worker/back/methods/worker-time-control-mail/checkInbox.js b/modules/worker/back/methods/worker-time-control-mail/checkInbox.js index bfecb1605..4d9f98cc3 100644 --- a/modules/worker/back/methods/worker-time-control-mail/checkInbox.js +++ b/modules/worker/back/methods/worker-time-control-mail/checkInbox.js @@ -11,7 +11,7 @@ module.exports = Self => { }, http: { path: `/checkInbox`, - verb: 'GET' + verb: 'POST' } }); @@ -58,7 +58,6 @@ module.exports = Self => { emailBody = bufferCopy.toUpperCase().trim(); const bodyPositionOK = emailBody.match(/\bOK\b/i); - if (bodyPositionOK != null && (bodyPositionOK.index == 0 || bodyPositionOK.index == 122)) isEmailOk = true; else @@ -94,7 +93,7 @@ module.exports = Self => { }; async function emailConfirm(buffer) { - const now = new Date(); + const now = Date.vnNew(); const from = JSON.stringify(Imap.parseHeader(buffer).from); const subject = JSON.stringify(Imap.parseHeader(buffer).subject); @@ -122,7 +121,7 @@ module.exports = Self => { } async function emailReply(buffer, emailBody) { - const now = new Date(); + const now = Date.vnNew(); const from = JSON.stringify(Imap.parseHeader(buffer).from); const subject = JSON.stringify(Imap.parseHeader(buffer).subject); @@ -145,7 +144,7 @@ module.exports = Self => { await workerMail.updateAttributes({ updated: now, state: 'REVISE', - emailResponse: emailBody + reason: emailBody }); } else await sendMail(user, subject, emailBody); @@ -157,7 +156,7 @@ module.exports = Self => { let [user] = await Self.rawSql(`SELECT u.id,u.name FROM account.user u LEFT JOIN account.mailForward m on m.account = u.id - WHERE forwardTo =? OR + WHERE forwardTo =? OR CONCAT(u.name,'@verdnatura.es') = ?`, [userEmail[0], userEmail[0]]); diff --git a/modules/worker/back/methods/worker-time-control/addTimeEntry.js b/modules/worker/back/methods/worker-time-control/addTimeEntry.js index 06356cdaf..fef3cf223 100644 --- a/modules/worker/back/methods/worker-time-control/addTimeEntry.js +++ b/modules/worker/back/methods/worker-time-control/addTimeEntry.js @@ -46,30 +46,11 @@ module.exports = Self => { if (isSubordinate === false || (isSubordinate && isHimself && !isTeamBoss)) throw new UserError(`You don't have enough privileges`); - const minTime = new Date(args.timed); - minTime.setHours(0, 0, 0, 0); + query = `CALL vn.workerTimeControl_clockIn(?,?,?)`; + const [response] = await Self.rawSql(query, [workerId, args.timed, args.direction], myOptions); + if (response[0] && response[0].error) + throw new UserError(response[0].error); - query = `SELECT * FROM vn.workerLabour WHERE workerFk = ? AND (ended >= ? OR ended IS NULL);`; - const [workerLabour] = await Self.rawSql(query, [workerId, minTime]); - const absence = await models.Calendar.findOne({ - where: { - businessFk: workerLabour.businessFk, - dated: minTime - } - }); - if (absence) { - const absenceType = await models.AbsenceType.findById(absence.dayOffTypeFk, null, myOptions); - const isNotHalfAbsence = absenceType.code != 'halfHoliday' - && absenceType.code != 'halfPaidLeave' - && absenceType.code != 'halfFurlough'; - if (isNotHalfAbsence) - throw new UserError(`The worker has a marked absence that day`); - } - return models.WorkerTimeControl.create({ - userFk: workerId, - direction: args.direction, - timed: args.timed, - manual: true - }, myOptions); + return response; }; }; diff --git a/modules/worker/back/methods/worker-time-control/getMailStates.js b/modules/worker/back/methods/worker-time-control/getMailStates.js new file mode 100644 index 000000000..855b5adc3 --- /dev/null +++ b/modules/worker/back/methods/worker-time-control/getMailStates.js @@ -0,0 +1,61 @@ +module.exports = Self => { + Self.remoteMethodCtx('getMailStates', { + description: 'Get the states of a month about time control mail', + accessType: 'READ', + accepts: [{ + arg: 'id', + type: 'number', + description: 'The worker id', + http: {source: 'path'} + }, + { + arg: 'month', + type: 'number', + description: 'The number of the month' + }, + { + arg: 'year', + type: 'number', + description: 'The number of the year' + }], + returns: [{ + type: ['object'], + root: true + }], + http: { + path: `/:id/getMailStates`, + verb: 'GET' + } + }); + + Self.getMailStates = async(ctx, workerId, options) => { + const models = Self.app.models; + const args = ctx.args; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const times = await models.Time.find({ + fields: ['week'], + where: { + month: args.month, + year: args.year + } + }, myOptions); + + const weeks = times.map(time => time.week); + const weekNumbersSet = new Set(weeks); + const weekNumbers = Array.from(weekNumbersSet); + + const workerTimeControlMails = await models.WorkerTimeControlMail.find({ + where: { + workerFk: workerId, + year: args.year, + week: {inq: weekNumbers} + } + }, myOptions); + + return workerTimeControlMails; + }; +}; diff --git a/modules/worker/back/methods/worker-time-control/sendMail.js b/modules/worker/back/methods/worker-time-control/sendMail.js new file mode 100644 index 000000000..579a83112 --- /dev/null +++ b/modules/worker/back/methods/worker-time-control/sendMail.js @@ -0,0 +1,379 @@ +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; + +module.exports = Self => { + Self.remoteMethodCtx('sendMail', { + description: `Send an email with the hours booked to the employees who telecommuting. + It also inserts booked hours in cases where the employee is telecommuting`, + accessType: 'WRITE', + accepts: [{ + arg: 'workerId', + type: 'number', + description: 'The worker id' + }, + { + arg: 'week', + type: 'number' + }, + { + arg: 'year', + type: 'number' + }], + returns: [{ + type: 'Object', + root: true + }], + http: { + path: `/sendMail`, + verb: 'POST' + } + }); + + Self.sendMail = async(ctx, options) => { + const models = Self.app.models; + const conn = Self.dataSource.connector; + const args = ctx.args; + let tx; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const stmts = []; + let stmt; + + if (!args.week || !args.year) { + const from = Date.vnNew(); + const to = Date.vnNew(); + + const time = await models.Time.findOne({ + where: { + dated: {between: [from.setDate(from.getDate() - 10), to.setDate(to.getDate() - 4)]} + }, + order: 'week ASC' + }, myOptions); + + args.week = time.week; + args.year = time.year; + } + + const started = getStartDateOfWeekNumber(args.week, args.year); + started.setHours(0, 0, 0, 0); + + const ended = new Date(started); + ended.setDate(started.getDate() + 6); + ended.setHours(23, 59, 59, 999); + + stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate'); + stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate'); + + if (args.workerId) { + await models.WorkerTimeControl.destroyAll({ + userFk: args.workerId, + timed: {between: [started, ended]}, + isSendMail: true + }, myOptions); + + const where = { + workerFk: args.workerId, + year: args.year, + week: args.week + }; + await models.WorkerTimeControlMail.updateAll(where, { + updated: Date.vnNew(), state: 'SENDED' + }, myOptions); + + stmt = new ParameterizedSQL( + `CALL vn.timeControl_calculateByUser(?, ?, ?) + `, [args.workerId, started, ended]); + stmts.push(stmt); + + stmt = new ParameterizedSQL( + `CALL vn.timeBusiness_calculateByUser(?, ?, ?) + `, [args.workerId, started, ended]); + stmts.push(stmt); + } else { + await models.WorkerTimeControl.destroyAll({ + timed: {between: [started, ended]}, + isSendMail: true + }, myOptions); + + const where = { + year: args.year, + week: args.week + }; + await models.WorkerTimeControlMail.updateAll(where, { + updated: Date.vnNew(), state: 'SENDED' + }, myOptions); + + stmt = new ParameterizedSQL(`CALL vn.timeControl_calculateAll(?, ?)`, [started, ended]); + stmts.push(stmt); + + stmt = new ParameterizedSQL(`CALL vn.timeBusiness_calculateAll(?, ?)`, [started, ended]); + stmts.push(stmt); + } + + stmt = new ParameterizedSQL(` + SELECT CONCAT(u.name, '@verdnatura.es') receiver, + u.id workerFk, + tb.dated, + tb.timeWorkDecimal, + tb.timeWorkSexagesimal timeWorkSexagesimal, + tb.timeTable, + tc.timeWorkDecimal timeWorkedDecimal, + tc.timeWorkSexagesimal timeWorkedSexagesimal, + tb.type, + tb.businessFk, + tb.permissionRate, + d.isTeleworking + FROM tmp.timeBusinessCalculate tb + JOIN account.user u ON u.id = tb.userFk + JOIN department d ON d.id = tb.departmentFk + JOIN business b ON b.id = tb.businessFk + LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = tb.userFk AND tc.dated = tb.dated + LEFT JOIN worker w ON w.id = u.id + 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.timeBusinessCalculate tb + LEFT JOIN tmp.timeControlCalculate 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(?, u.id) = u.id + AND b.companyCodeFk = 'VNL' + AND w.businessFk + ORDER BY u.id, tb.dated + `, [args.workerId]); + const index = stmts.push(stmt) - 1; + + stmts.push('DROP TEMPORARY TABLE tmp.timeControlCalculate'); + stmts.push('DROP TEMPORARY TABLE tmp.timeBusinessCalculate'); + + const sql = ParameterizedSQL.join(stmts, ';'); + const days = await conn.executeStmt(sql, myOptions); + + let previousWorkerFk = days[index][0].workerFk; + let previousReceiver = days[index][0].receiver; + + const workerTimeControlConfig = await models.WorkerTimeControlConfig.findOne(null, myOptions); + + for (let day of days[index]) { + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + try { + workerFk = day.workerFk; + if (day.timeWorkDecimal > 0 && day.timeWorkedDecimal == null + && (day.permissionRate == null ? true : day.permissionRate)) { + if (day.timeTable == null) { + const timed = new Date(day.dated); + await models.WorkerTimeControl.create({ + userFk: day.workerFk, + timed: timed.setHours(workerTimeControlConfig.teleworkingStart / 3600), + manual: true, + direction: 'in', + isSendMail: true + }, myOptions); + + if (day.timeWorkDecimal >= workerTimeControlConfig.timeToBreakTime / 3600) { + await models.WorkerTimeControl.create({ + userFk: day.workerFk, + timed: timed.setHours(workerTimeControlConfig.teleworkingStartBreakTime / 3600), + manual: true, + direction: 'middle', + isSendMail: true + }, myOptions); + + await models.WorkerTimeControl.create({ + userFk: day.workerFk, + timed: timed.setHours( + workerTimeControlConfig.teleworkingStartBreakTime / 3600, + workerTimeControlConfig.breakTime / 60 + ), + manual: true, + direction: 'middle', + isSendMail: true + }, myOptions); + } + + const [hoursWork, minutesWork, secondsWork] = getTime(day.timeWorkSexagesimal); + await models.WorkerTimeControl.create({ + userFk: day.workerFk, + timed: timed.setHours( + workerTimeControlConfig.teleworkingStart / 3600 + hoursWork, + minutesWork, + secondsWork + ), + manual: true, + direction: 'out', + isSendMail: true + }, myOptions); + } else { + const weekDay = day.dated.getDay(); + const journeys = await models.Journey.find({ + where: { + business_id: day.businessFk, + day_id: weekDay + } + }, myOptions); + + let timeTableDecimalInSeconds = 0; + for (let journey of journeys) { + const start = Date.vnNew(); + const [startHours, startMinutes, startSeconds] = getTime(journey.start); + start.setHours(startHours, startMinutes, startSeconds, 0); + + const end = Date.vnNew(); + const [endHours, endMinutes, endSeconds] = getTime(journey.end); + end.setHours(endHours, endMinutes, endSeconds, 0); + + const result = (end - start) / 1000; + timeTableDecimalInSeconds += result; + } + + for (let journey of journeys) { + const timeTableDecimal = timeTableDecimalInSeconds / 3600; + if (day.timeWorkDecimal == timeTableDecimal) { + const timed = new Date(day.dated); + const [startHours, startMinutes, startSeconds] = getTime(journey.start); + await models.WorkerTimeControl.create({ + userFk: day.workerFk, + timed: timed.setHours(startHours, startMinutes, startSeconds), + manual: true, + isSendMail: true + }, myOptions); + + const [endHours, endMinutes, endSeconds] = getTime(journey.end); + await models.WorkerTimeControl.create({ + userFk: day.workerFk, + timed: timed.setHours(endHours, endMinutes, endSeconds), + manual: true, + isSendMail: true + }, myOptions); + } else { + const minStart = journeys.reduce(function(prev, curr) { + return curr.start < prev.start ? curr : prev; + }); + if (journey == minStart) { + const timed = new Date(day.dated); + const [startHours, startMinutes, startSeconds] = getTime(journey.start); + await models.WorkerTimeControl.create({ + userFk: day.workerFk, + timed: timed.setHours(startHours, startMinutes, startSeconds), + manual: true, + isSendMail: true + }, myOptions); + + const [hoursWork, minutesWork, secondsWork] = getTime(day.timeWorkSexagesimal); + await models.WorkerTimeControl.create({ + userFk: day.workerFk, + timed: timed.setHours( + startHours + hoursWork, + startMinutes + minutesWork, + startSeconds + secondsWork + ), + manual: true, + isSendMail: true + }, myOptions); + } + } + + if (day.timeWorkDecimal >= workerTimeControlConfig.timeToBreakTime / 3600) { + const minStart = journeys.reduce(function(prev, curr) { + return curr.start < prev.start ? curr : prev; + }); + if (journey == minStart) { + const timed = new Date(day.dated); + const [startHours, startMinutes, startSeconds] = getTime(journey.start); + await models.WorkerTimeControl.create({ + userFk: day.workerFk, + timed: timed.setHours(startHours + 1, startMinutes, startSeconds), + manual: true, + isSendMail: true + }, myOptions); + + await models.WorkerTimeControl.create({ + userFk: day.workerFk, + timed: timed.setHours(startHours + 1, startMinutes + 20, startSeconds), + manual: true, + isSendMail: true + }, myOptions); + } + } + } + const timed = new Date(day.dated); + const firstWorkerTimeControl = await models.WorkerTimeControl.findOne({ + where: { + userFk: day.workerFk, + timed: {between: [timed.setHours(0, 0, 0, 0), timed.setHours(23, 59, 59, 999)]} + }, + order: 'timed ASC' + }, myOptions); + + if (firstWorkerTimeControl) + await firstWorkerTimeControl.updateAttribute('direction', 'in', myOptions); + + const lastWorkerTimeControl = await models.WorkerTimeControl.findOne({ + where: { + userFk: day.workerFk, + timed: {between: [timed.setHours(0, 0, 0, 0), timed.setHours(23, 59, 59, 999)]} + }, + order: 'timed DESC' + }, myOptions); + + if (lastWorkerTimeControl) + await lastWorkerTimeControl.updateAttribute('direction', 'out', myOptions); + } + } + + const lastDay = days[index][days[index].length - 1]; + if (day.workerFk != previousWorkerFk || day == lastDay) { + const salix = await models.Url.findOne({ + where: { + appName: 'salix', + environment: process.env.NODE_ENV || 'dev' + } + }, myOptions); + + const timestamp = started.getTime() / 1000; + const url = `${salix.url}worker/${previousWorkerFk}/time-control?timestamp=${timestamp}`; + + await models.WorkerTimeControl.weeklyHourRecordEmail(ctx, previousReceiver, args.week, args.year, url); + + previousWorkerFk = day.workerFk; + previousReceiver = day.receiver; + } + + if (tx) { + await tx.commit(); + delete myOptions.transaction; + } + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + } + + return true; + }; + + function getStartDateOfWeekNumber(week, year) { + const simple = new Date(year, 0, 1 + (week - 1) * 7); + const dow = simple.getDay(); + const weekStart = simple; + if (dow <= 4) + weekStart.setDate(simple.getDate() - simple.getDay() + 1); + else + weekStart.setDate(simple.getDate() + 8 - simple.getDay()); + return weekStart; + } + + function getTime(timeString) { + const [hours, minutes, seconds] = timeString.split(':'); + return [parseInt(hours), parseInt(minutes), parseInt(seconds)]; + } +}; diff --git a/modules/worker/back/methods/worker-time-control/specs/filter.spec.js b/modules/worker/back/methods/worker-time-control/specs/filter.spec.js index 927d83df3..0c4d229f2 100644 --- a/modules/worker/back/methods/worker-time-control/specs/filter.spec.js +++ b/modules/worker/back/methods/worker-time-control/specs/filter.spec.js @@ -3,9 +3,9 @@ const models = require('vn-loopback/server/server').models; describe('workerTimeControl filter()', () => { it('should return 1 result filtering by id', async() => { const ctx = {req: {accessToken: {userId: 1106}}, args: {workerFk: 1106}}; - const firstHour = new Date(); + const firstHour = Date.vnNew(); firstHour.setHours(7, 0, 0, 0); - const lastHour = new Date(); + const lastHour = Date.vnNew(); lastHour.setDate(lastHour.getDate() + 1); lastHour.setHours(15, 0, 0, 0); @@ -21,9 +21,9 @@ describe('workerTimeControl filter()', () => { it('should return a privilege error for a non subordinate worker', async() => { const ctx = {req: {accessToken: {userId: 1107}}, args: {workerFk: 1106}}; - const firstHour = new Date(); + const firstHour = Date.vnNew(); firstHour.setHours(7, 0, 0, 0); - const lastHour = new Date(); + const lastHour = Date.vnNew(); lastHour.setDate(lastHour.getDate() + 1); lastHour.setHours(15, 0, 0, 0); diff --git a/modules/worker/back/methods/worker-time-control/specs/getMailStates.spec.js b/modules/worker/back/methods/worker-time-control/specs/getMailStates.spec.js new file mode 100644 index 000000000..cbad32323 --- /dev/null +++ b/modules/worker/back/methods/worker-time-control/specs/getMailStates.spec.js @@ -0,0 +1,29 @@ +const models = require('vn-loopback/server/server').models; + +describe('workerTimeControl getMailStates()', () => { + const workerId = 9; + const ctx = {args: { + month: 12, + year: 2000 + }}; + + it('should get the states of a month about time control mail', async() => { + const tx = await models.WorkerTimeControl.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const response = await models.WorkerTimeControl.getMailStates(ctx, workerId, options); + + expect(response[0].state).toEqual('REVISE'); + expect(response[1].state).toEqual('SENDED'); + expect(response[2].state).toEqual('CONFIRMED'); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); + diff --git a/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js b/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js new file mode 100644 index 000000000..24bfd6904 --- /dev/null +++ b/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js @@ -0,0 +1,120 @@ +const models = require('vn-loopback/server/server').models; + +describe('workerTimeControl sendMail()', () => { + const workerId = 18; + const activeCtx = { + getLocale: () => { + return 'en'; + } + }; + const ctx = {req: activeCtx, args: {}}; + + it('should fill time control of a worker without records in Journey and with rest', async() => { + const tx = await models.WorkerTimeControl.beginTransaction({}); + + try { + const options = {transaction: tx}; + + await models.WorkerTimeControl.sendMail(ctx, options); + + const workerTimeControl = await models.WorkerTimeControl.find({ + where: {userFk: workerId} + }, options); + + expect(workerTimeControl[0].timed.getHours()).toEqual(8); + expect(workerTimeControl[1].timed.getHours()).toEqual(9); + expect(`${workerTimeControl[2].timed.getHours()}:${workerTimeControl[2].timed.getMinutes()}`).toEqual('9:20'); + expect(workerTimeControl[3].timed.getHours()).toEqual(16); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should fill time control of a worker without records in Journey and without rest', async() => { + const workdayOf20Hours = 3; + const tx = await models.WorkerTimeControl.beginTransaction({}); + + try { + const options = {transaction: tx}; + query = `UPDATE business b + SET b.calendarTypeFk = ? + WHERE b.workerFk = ?; `; + await models.WorkerTimeControl.rawSql(query, [workdayOf20Hours, workerId], options); + + await models.WorkerTimeControl.sendMail(ctx, options); + + const workerTimeControl = await models.WorkerTimeControl.find({ + where: {userFk: workerId} + }, options); + + expect(workerTimeControl[0].timed.getHours()).toEqual(8); + expect(workerTimeControl[1].timed.getHours()).toEqual(12); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should fill time control of a worker with records in Journey and with rest', async() => { + const tx = await models.WorkerTimeControl.beginTransaction({}); + + try { + const options = {transaction: tx}; + query = `INSERT INTO postgresql.journey(journey_id, day_id, start, end, business_id) + VALUES + (1, 1, '09:00:00', '13:00:00', ?), + (2, 1, '14:00:00', '19:00:00', ?);`; + await models.WorkerTimeControl.rawSql(query, [workerId, workerId, workerId], options); + + await models.WorkerTimeControl.sendMail(ctx, options); + + const workerTimeControl = await models.WorkerTimeControl.find({ + where: {userFk: workerId} + }, options); + + expect(workerTimeControl[0].timed.getHours()).toEqual(9); + expect(workerTimeControl[2].timed.getHours()).toEqual(10); + expect(`${workerTimeControl[3].timed.getHours()}:${workerTimeControl[3].timed.getMinutes()}`).toEqual('10:20'); + expect(workerTimeControl[1].timed.getHours()).toEqual(13); + expect(workerTimeControl[4].timed.getHours()).toEqual(14); + expect(workerTimeControl[5].timed.getHours()).toEqual(19); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should fill time control of a worker with records in Journey and without rest', async() => { + const tx = await models.WorkerTimeControl.beginTransaction({}); + + try { + const options = {transaction: tx}; + query = `INSERT INTO postgresql.journey(journey_id, day_id, start, end, business_id) + VALUES + (1, 1, '12:30:00', '14:00:00', ?);`; + await models.WorkerTimeControl.rawSql(query, [workerId, workerId, workerId], options); + + await models.WorkerTimeControl.sendMail(ctx, options); + + const workerTimeControl = await models.WorkerTimeControl.find({ + where: {userFk: workerId} + }, options); + + expect(`${workerTimeControl[0].timed.getHours()}:${workerTimeControl[0].timed.getMinutes()}`).toEqual('12:30'); + expect(workerTimeControl[1].timed.getHours()).toEqual(14); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); + diff --git a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js index 69fcbe90c..e90c849b7 100644 --- a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js +++ b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js @@ -1,6 +1,6 @@ -const app = require('vn-loopback/server/server'); +/* eslint max-len: ["error", { "code": 150 }]*/ +const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); -const models = app.models; describe('workerTimeControl add/delete timeEntry()', () => { const HHRRId = 37; @@ -8,6 +8,14 @@ describe('workerTimeControl add/delete timeEntry()', () => { const employeeId = 1; const salesPersonId = 1106; const salesBossId = 19; + const hankPymId = 1107; + const jessicaJonesId = 1110; + const monday = 1; + const tuesday = 2; + const thursday = 4; + const friday = 5; + const saturday = 6; + const sunday = 7; const activeCtx = { accessToken: {userId: 50}, }; @@ -19,190 +27,689 @@ describe('workerTimeControl add/delete timeEntry()', () => { }); }); - it('should fail to add a time entry if the target user is not a subordinate', async() => { - activeCtx.accessToken.userId = employeeId; - const workerId = 2; + describe('as Role errors', () => { + it('should fail to add a time entry if the target user is not a subordinate', async() => { + activeCtx.accessToken.userId = employeeId; + const workerId = 2; - let error; + let error; - try { - ctx.args = {timed: new Date(), direction: 'in'}; - await models.WorkerTimeControl.addTimeEntry(ctx, workerId); - } catch (e) { - error = e; - } + try { + ctx.args = {timed: Date.vnNew(), direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId); + } catch (e) { + error = e; + } - expect(error).toBeDefined(); - expect(error.statusCode).toBe(400); - expect(error.message).toBe(`You don't have enough privileges`); + expect(error).toBeDefined(); + expect(error.statusCode).toBe(400); + expect(error.message).toBe(`You don't have enough privileges`); + }); + + it('should fail to add if the current and the target user are the same and is not team boss', async() => { + activeCtx.accessToken.userId = employeeId; + const workerId = employeeId; + let error; + + try { + ctx.args = {timed: Date.vnNew(), direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId); + } catch (e) { + error = e; + } + + expect(error).toBeDefined(); + expect(error.statusCode).toBe(400); + expect(error.message).toBe(`You don't have enough privileges`); + }); + + it('should add if the current user is team boss and the target user is himself', async() => { + activeCtx.accessToken.userId = teamBossId; + const workerId = teamBossId; + + const tx = await models.WorkerTimeControl.beginTransaction({}); + try { + const options = {transaction: tx}; + + const todayAtOne = Date.vnNew(); + todayAtOne.setHours(1, 0, 0, 0); + + ctx.args = {timed: todayAtOne, direction: 'in'}; + const [createdTimeEntry] = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + expect(createdTimeEntry.id).toBeDefined(); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should try but fail to delete his own time entry', async() => { + activeCtx.accessToken.userId = salesBossId; + const workerId = salesBossId; + + let error; + const tx = await models.WorkerTimeControl.beginTransaction({}); + try { + const options = {transaction: tx}; + + const todayAtOne = Date.vnNew(); + todayAtOne.setHours(1, 0, 0, 0); + + ctx.args = {timed: todayAtOne, direction: 'in'}; + const [createdTimeEntry] = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + activeCtx.accessToken.userId = salesPersonId; + await models.WorkerTimeControl.deleteTimeEntry(ctx, createdTimeEntry.id, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error).toBeDefined(); + expect(error.statusCode).toBe(400); + expect(error.message).toBe(`You don't have enough privileges`); + }); + + it('should delete the created time entry for the team boss as himself', async() => { + activeCtx.accessToken.userId = teamBossId; + const workerId = teamBossId; + + const tx = await models.WorkerTimeControl.beginTransaction({}); + try { + const options = {transaction: tx}; + + const todayAtOne = Date.vnNew(); + todayAtOne.setHours(1, 0, 0, 0); + + ctx.args = {timed: todayAtOne, direction: 'in'}; + const [createdTimeEntry] = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + expect(createdTimeEntry.id).toBeDefined(); + + await models.WorkerTimeControl.deleteTimeEntry(ctx, createdTimeEntry.id, options); + + const deletedTimeEntry = await models.WorkerTimeControl.findById(createdTimeEntry.id, null, options); + + expect(deletedTimeEntry).toBeNull(); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should delete the created time entry for the team boss as HHRR', async() => { + activeCtx.accessToken.userId = HHRRId; + const workerId = teamBossId; + + const tx = await models.WorkerTimeControl.beginTransaction({}); + try { + const options = {transaction: tx}; + + const todayAtOne = Date.vnNew(); + todayAtOne.setHours(1, 0, 0, 0); + + ctx.args = {timed: todayAtOne, direction: 'in'}; + const [createdTimeEntry] = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + expect(createdTimeEntry.id).toBeDefined(); + + await models.WorkerTimeControl.deleteTimeEntry(ctx, createdTimeEntry.id, options); + + const deletedTimeEntry = await models.WorkerTimeControl.findById(createdTimeEntry.id, null, options); + + expect(deletedTimeEntry).toBeNull(); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should edit the created time entry for the team boss as HHRR', async() => { + activeCtx.accessToken.userId = HHRRId; + const workerId = teamBossId; + + const tx = await models.WorkerTimeControl.beginTransaction({}); + try { + const options = {transaction: tx}; + + const todayAtOne = Date.vnNew(); + todayAtOne.setHours(1, 0, 0, 0); + + ctx.args = {timed: todayAtOne, direction: 'in'}; + const [createdTimeEntry] = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + expect(createdTimeEntry.id).toBeDefined(); + + ctx.args = {direction: 'out'}; + const updatedTimeEntry = await models.WorkerTimeControl.updateTimeEntry(ctx, createdTimeEntry.id, options); + + expect(updatedTimeEntry.direction).toEqual('out'); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); }); - it('should fail to add if the current and the target user are the same and is not team boss', async() => { - activeCtx.accessToken.userId = employeeId; - const workerId = employeeId; - let error; + describe('WorkerTimeControl_clockIn calls', () => { + it('should fail to add a time entry if the target user has an absence that day', async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + activeCtx.accessToken.userId = salesBossId; + const workerId = hankPymId; + const date = Date.vnNew(); + date.setDate(date.getDate() - 16); + date.setHours(8, 0, 0); + let error; - try { - ctx.args = {timed: new Date(), direction: 'in'}; - await models.WorkerTimeControl.addTimeEntry(ctx, workerId); - } catch (e) { - error = e; - } - - expect(error).toBeDefined(); - expect(error.statusCode).toBe(400); - expect(error.message).toBe(`You don't have enough privileges`); - }); - - it('should add if the current user is team boss and the target user is a himself', async() => { - activeCtx.accessToken.userId = teamBossId; - const workerId = teamBossId; - - const tx = await models.WorkerTimeControl.beginTransaction({}); - try { + const tx = await models.WorkerTimeControl.beginTransaction({}); const options = {transaction: tx}; + try { + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); - const todayAtSix = new Date(); - todayAtSix.setHours(18, 30, 0, 0); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } - ctx.args = {timed: todayAtSix, direction: 'in'}; - const createdTimeEntry = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + expect(error.message).toBe(`No está permitido trabajar`); + }); - expect(createdTimeEntry.id).toBeDefined(); + it('should fail to add a time entry for a worker without an existing contract', async() => { + activeCtx.accessToken.userId = salesBossId; + const workerId = hankPymId; + const date = Date.vnNew(); + date.setFullYear(date.getFullYear() - 2); + let error; - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); + const tx = await models.WorkerTimeControl.beginTransaction({}); + try { + const options = {transaction: tx}; + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); - it('should fail to add a time entry if the target user has absent that day', async() => { - activeCtx.accessToken.userId = salesBossId; - const workerId = salesPersonId; - let error; + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } - const calendar = await app.models.Calendar.findById(3); + expect(error.message).toBe(`No hay un contrato en vigor`); + }); - try { - ctx.args = {timed: new Date(calendar.dated), direction: 'in'}; - await models.WorkerTimeControl.addTimeEntry(ctx, workerId); - } catch (e) { - error = e; - } + describe('direction errors', () => { + it('should throw an error when trying "in" direction twice', async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + activeCtx.accessToken.userId = salesBossId; + const workerId = hankPymId; - expect(error.message).toBe(`The worker has a marked absence that day`); - }); + let date = Date.vnNew(); + date.setDate(date.getDate() - 21); + date = weekDay(date, monday); + let error; - it('should try but fail to delete his own time entry', async() => { - activeCtx.accessToken.userId = salesBossId; - const workerId = salesBossId; + const tx = await models.WorkerTimeControl.beginTransaction({}); + const options = {transaction: tx}; + date.setHours(8, 0, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); - let error; - const tx = await models.WorkerTimeControl.beginTransaction({}); - try { - const options = {transaction: tx}; + try { + date.setHours(10, 0, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); - const todayAtSeven = new Date(); - todayAtSeven.setHours(19, 30, 0, 0); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } - ctx.args = {timed: todayAtSeven, direction: 'in'}; - const createdTimeEntry = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + expect(error.message).toBe(`Dirección incorrecta`); + }); - activeCtx.accessToken.userId = salesPersonId; - await models.WorkerTimeControl.deleteTimeEntry(ctx, createdTimeEntry.id, options); + it('should throw an error when trying "in" direction after insert "in" and "middle"', async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + activeCtx.accessToken.userId = salesBossId; + const workerId = hankPymId; - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } + let date = Date.vnNew(); + date.setDate(date.getDate() - 21); + date = weekDay(date, monday); + let error; - expect(error).toBeDefined(); - expect(error.statusCode).toBe(400); - expect(error.message).toBe(`You don't have enough privileges`); - }); + const tx = await models.WorkerTimeControl.beginTransaction({}); + const options = {transaction: tx}; - it('should delete the created time entry for the team boss as himself', async() => { - activeCtx.accessToken.userId = teamBossId; - const workerId = teamBossId; + date.setHours(8, 0, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + date.setHours(9, 0, 0); + ctx.args = {timed: date, direction: 'middle'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); - const tx = await models.WorkerTimeControl.beginTransaction({}); - try { - const options = {transaction: tx}; + try { + date.setHours(10, 0, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); - const todayAtFive = new Date(); - todayAtFive.setHours(17, 30, 0, 0); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } - ctx.args = {timed: todayAtFive, direction: 'in'}; - const createdTimeEntry = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + expect(error.message).toBe(`Dirección incorrecta`); + }); - expect(createdTimeEntry.id).toBeDefined(); + it('Should throw an error when trying "out" before closing a "middle" couple', async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + activeCtx.accessToken.userId = salesBossId; + const workerId = hankPymId; - await models.WorkerTimeControl.deleteTimeEntry(ctx, createdTimeEntry.id, options); + let date = Date.vnNew(); + date.setDate(date.getDate() - 21); + date = weekDay(date, monday); + let error; - const deletedTimeEntry = await models.WorkerTimeControl.findById(createdTimeEntry.id, null, options); + const tx = await models.WorkerTimeControl.beginTransaction({}); + const options = {transaction: tx}; - expect(deletedTimeEntry).toBeNull(); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); + date.setHours(8, 0, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + date.setHours(9, 0, 0); + ctx.args = {timed: date, direction: 'middle'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); - it('should delete the created time entry for the team boss as HHRR', async() => { - activeCtx.accessToken.userId = HHRRId; - const workerId = teamBossId; + try { + date.setHours(10, 0, 0); + ctx.args = {timed: date, direction: 'out'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); - const tx = await models.WorkerTimeControl.beginTransaction({}); - try { - const options = {transaction: tx}; + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } - const todayAtFive = new Date(); - todayAtFive.setHours(17, 30, 0, 0); + expect(error.message).toBe(`Dirección incorrecta`); + }); - ctx.args = {timed: todayAtFive, direction: 'in'}; - const createdTimeEntry = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + it('should throw an error when trying "middle" after "out"', async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + activeCtx.accessToken.userId = salesBossId; + const workerId = hankPymId; - expect(createdTimeEntry.id).toBeDefined(); + let date = Date.vnNew(); + date.setDate(date.getDate() - 21); + date = weekDay(date, monday); + let error; - await models.WorkerTimeControl.deleteTimeEntry(ctx, createdTimeEntry.id, options); + const tx = await models.WorkerTimeControl.beginTransaction({}); + const options = {transaction: tx}; - const deletedTimeEntry = await models.WorkerTimeControl.findById(createdTimeEntry.id, null, options); + date.setHours(8, 0, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + date.setHours(9, 0, 0); + ctx.args = {timed: date, direction: 'out'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); - expect(deletedTimeEntry).toBeNull(); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); + try { + date.setHours(10, 0, 0); + ctx.args = {timed: date, direction: 'middle'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); - it('should edit the created time entry for the team boss as HHRR', async() => { - activeCtx.accessToken.userId = HHRRId; - const workerId = teamBossId; + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } - const tx = await models.WorkerTimeControl.beginTransaction({}); - try { - const options = {transaction: tx}; + expect(error.message).toBe(`Dirección incorrecta`); + }); - const todayAtFive = new Date(); - todayAtFive.setHours(17, 30, 0, 0); + it('should throw an error when trying "out" direction twice', async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + activeCtx.accessToken.userId = salesBossId; + const workerId = hankPymId; - ctx.args = {timed: todayAtFive, direction: 'in'}; - const createdTimeEntry = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + let date = Date.vnNew(); + date.setDate(date.getDate() - 21); + date = weekDay(date, monday); + let error; - expect(createdTimeEntry.id).toBeDefined(); + const tx = await models.WorkerTimeControl.beginTransaction({}); + const options = {transaction: tx}; - ctx.args = {direction: 'out'}; - const updatedTimeEntry = await models.WorkerTimeControl.updateTimeEntry(ctx, createdTimeEntry.id, options); + date.setHours(8, 0, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + date.setHours(9, 0, 0); + ctx.args = {timed: date, direction: 'out'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); - expect(updatedTimeEntry.direction).toEqual('out'); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } + try { + date.setHours(10, 0, 0); + ctx.args = {timed: date, direction: 'out'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } + + expect(error.message).toBe(`Dirección incorrecta`); + }); + }); + + describe('12h rest', () => { + it('should throw an error when the 12h rest is not fulfilled yet', async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + + activeCtx.accessToken.userId = salesBossId; + const workerId = hankPymId; + + let date = Date.vnNew(); + date.setDate(date.getDate() - 21); + date = weekDay(date, monday); + let error; + + const tx = await models.WorkerTimeControl.beginTransaction({}); + const options = {transaction: tx}; + + date.setHours(8, 0, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + date.setHours(16, 0, 0); + ctx.args = {timed: date, direction: 'out'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + try { + date = weekDay(date, tuesday); + date.setHours(4, 0, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } + + expect(error.message).toBe(`Descanso diario 12h.`); + }); + + it('should not fail as the 12h rest is fulfilled', async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + activeCtx.accessToken.userId = salesBossId; + const workerId = hankPymId; + + let date = Date.vnNew(); + date.setDate(date.getDate() - 21); + date = weekDay(date, monday); + let error; + + const tx = await models.WorkerTimeControl.beginTransaction({}); + const options = {transaction: tx}; + + date.setHours(8, 0, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + date.setHours(16, 0, 0); + ctx.args = {timed: date, direction: 'out'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + try { + date = weekDay(date, tuesday); + date.setHours(4, 1, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } + + expect(error).not.toBeDefined; + }); + }); + + describe('for 3500kg drivers with enforced 9h rest', () => { + it('should throw an error when the 9h enforced rest is not fulfilled', async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + activeCtx.accessToken.userId = salesBossId; + const workerId = jessicaJonesId; + + let date = Date.vnNew(); + date.setDate(date.getDate() - 21); + date = weekDay(date, monday); + let error; + + const tx = await models.WorkerTimeControl.beginTransaction({}); + const options = {transaction: tx}; + + date.setHours(8, 0, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + date.setHours(16, 0, 0); + ctx.args = {timed: date, direction: 'out'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + try { + date = weekDay(date, tuesday); + date.setHours(1, 0, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } + + expect(error.message).toBe(`Descanso diario 9h.`); + }); + + it('should not fail when the 9h enforced rest is fulfilled', async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + activeCtx.accessToken.userId = salesBossId; + const workerId = jessicaJonesId; + + let date = Date.vnNew(); + date.setDate(date.getDate() - 21); + date = weekDay(date, monday); + let error; + + const tx = await models.WorkerTimeControl.beginTransaction({}); + const options = {transaction: tx}; + + date.setHours(8, 0, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + date.setHours(16, 0, 0); + ctx.args = {timed: date, direction: 'out'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + try { + date = weekDay(date, tuesday); + date.setHours(1, 1, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } + + expect(error).not.toBeDefined; + }); + }); + + describe('for 36h weekly rest', () => { + it('should throw an error when the 36h weekly rest is not fulfilled', async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + activeCtx.accessToken.userId = salesBossId; + const workerId = hankPymId; + + let date = Date.vnNew(); + date.setMonth(date.getMonth() - 2); + date.setDate(1); + let error; + + const tx = await models.WorkerTimeControl.beginTransaction({}); + const options = {transaction: tx}; + + await populateWeek(date, monday, sunday, ctx, workerId, options); + date = nextWeek(date); + await populateWeek(date, monday, thursday, ctx, workerId, options); + date = weekDay(date, friday); + date.setHours(7, 59, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + try { + date.setHours(8, 1, 0); + ctx.args = {timed: date, direction: 'out'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } + + expect(error.message).toBe(`Descanso semanal 36h. / 72h.`); + }); + + it('should throw an error when the 36h weekly rest is not fulfilled again', async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + activeCtx.accessToken.userId = salesBossId; + const workerId = hankPymId; + + let date = Date.vnNew(); + date.setMonth(date.getMonth() - 2); + date.setDate(1); + let error; + + const tx = await models.WorkerTimeControl.beginTransaction({}); + const options = {transaction: tx}; + + await populateWeek(date, monday, sunday, ctx, workerId, options); + date = nextWeek(date); + await populateWeek(date, monday, thursday, ctx, workerId, options); + + try { + date = weekDay(date, saturday); + date.setHours(3, 59, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } + + expect(error.message).toBe(`Descanso semanal 36h. / 72h.`); + }); + }); + + describe('for 72h weekly rest', () => { + it('should throw when the 72h weekly rest is not fulfilled yet', async() => { + pending('https://redmine.verdnatura.es/issues/4707'); + activeCtx.accessToken.userId = salesBossId; + const workerId = hankPymId; + + let date = Date.vnNew(); + date.setMonth(date.getMonth() - 2); + date.setDate(1); + let error; + + const tx = await models.WorkerTimeControl.beginTransaction({}); + const options = {transaction: tx}; + + await populateWeek(date, monday, sunday, ctx, workerId, options); + date = nextWeek(date); + await populateWeek(date, monday, thursday, ctx, workerId, options); + date = nextWeek(date); + await populateWeek(date, monday, friday, ctx, workerId, options); + date = nextWeek(date); + await populateWeek(date, monday, saturday, ctx, workerId, options); + date = nextWeek(date); + await populateWeek(date, monday, saturday, ctx, workerId, options); + date = lastWeek(date); + + try { + date = weekDay(date, sunday); + date.setHours(8, 0, 0); + ctx.args = {timed: date, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + error = e; + } + + expect(error.message).toBe(`Descanso semanal 36h. / 72h.`); + }); + }); }); }); + +function weekDay(date, dayToSet) { + const currentDay = date.getDay(); + const distance = dayToSet - currentDay; + + date.setDate(date.getDate() + distance); + return date; +} + +function nextWeek(date) { + const sunday = 7; + const currentDay = date.getDay(); + let newDate = date; + if (currentDay != 0) + newDate = weekDay(date, sunday); + + newDate.setDate(newDate.getDate() + 1); + return newDate; +} + +function lastWeek(date) { + const monday = 1; + newDate = weekDay(date, monday); + + newDate.setDate(newDate.getDate() - 1); + return newDate; +} + +async function populateWeek(date, dayStart, dayEnd, ctx, workerId, options) { + const dateStart = new Date(weekDay(date, dayStart)); + const dateEnd = new Date(dateStart); + dateEnd.setDate(dateStart.getDate() + dayEnd); + + for (let i = dayStart; i <= dayEnd; i++) { + dateStart.setHours(8, 0, 0); + ctx.args = {timed: dateStart, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + dateStart.setHours(16, 0, 0); + ctx.args = {timed: dateStart, direction: 'out'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + dateStart.setDate(dateStart.getDate() + 1); + } +} diff --git a/modules/worker/back/methods/worker-time-control/updateWorkerTimeControlMail.js b/modules/worker/back/methods/worker-time-control/updateWorkerTimeControlMail.js new file mode 100644 index 000000000..642ff90d2 --- /dev/null +++ b/modules/worker/back/methods/worker-time-control/updateWorkerTimeControlMail.js @@ -0,0 +1,89 @@ +const UserError = require('vn-loopback/util/user-error'); +module.exports = Self => { + Self.remoteMethodCtx('updateWorkerTimeControlMail', { + description: 'Updates the state of WorkerTimeControlMail', + accessType: 'WRITE', + accepts: [{ + arg: 'workerId', + type: 'number', + required: true + }, + { + arg: 'year', + type: 'number', + required: true + }, + { + arg: 'week', + type: 'number', + required: true + }, + { + arg: 'state', + type: 'string', + required: true + }, + { + arg: 'reason', + type: 'string' + }], + returns: { + type: 'boolean', + root: true + }, + http: { + path: `/updateWorkerTimeControlMail`, + verb: 'POST' + } + }); + + Self.updateWorkerTimeControlMail = async(ctx, options) => { + const models = Self.app.models; + const args = ctx.args; + const userId = ctx.req.accessToken.userId; + + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const isHimself = userId == args.workerId; + if (!isHimself) + throw new UserError(`You don't have enough privileges`); + + const workerTimeControlMail = await models.WorkerTimeControlMail.findOne({ + where: { + workerFk: args.workerId, + year: args.year, + week: args.week + } + }, myOptions); + + if (!workerTimeControlMail) throw new UserError(`There aren't records for this week`); + + const oldState = workerTimeControlMail.state; + const oldReason = workerTimeControlMail.reason; + + await workerTimeControlMail.updateAttributes({ + state: args.state, + reason: args.reason || null + }, myOptions); + + const logRecord = { + originFk: args.workerId, + userFk: userId, + action: 'update', + changedModel: 'WorkerTimeControlMail', + oldInstance: { + state: oldState, + reason: oldReason + }, + newInstance: { + state: args.state, + reason: args.reason + } + }; + + return models.WorkerLog.create(logRecord, myOptions); + }; +}; diff --git a/modules/worker/back/methods/worker-time-control/weeklyHourRecordEmail.js b/modules/worker/back/methods/worker-time-control/weeklyHourRecordEmail.js new file mode 100644 index 000000000..6feadb936 --- /dev/null +++ b/modules/worker/back/methods/worker-time-control/weeklyHourRecordEmail.js @@ -0,0 +1,53 @@ +const {Email} = require('vn-print'); + +module.exports = Self => { + Self.remoteMethodCtx('weeklyHourRecordEmail', { + description: 'Sends the weekly hour record', + accessType: 'WRITE', + accepts: [ + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: true, + }, + { + arg: 'week', + type: 'number', + required: true, + }, + { + arg: 'year', + type: 'number', + required: true + }, + { + arg: 'url', + type: 'string', + required: true + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: '/weekly-hour-hecord-email', + verb: 'POST' + } + }); + + Self.weeklyHourRecordEmail = async(ctx, recipient, week, year, url) => { + const params = { + recipient: recipient, + lang: ctx.req.getLocale(), + week: week, + year: year, + url: url + }; + + const email = new Email('weekly-hour-record', params); + + return email.send(); + }; +}; diff --git a/modules/worker/back/methods/worker/activeContract.js b/modules/worker/back/methods/worker/activeContract.js index 05dcee6b5..d3d439cd0 100644 --- a/modules/worker/back/methods/worker/activeContract.js +++ b/modules/worker/back/methods/worker/activeContract.js @@ -27,7 +27,7 @@ module.exports = Self => { if (!isSubordinate) throw new UserError(`You don't have enough privileges`); - const now = new Date(); + const now = Date.vnNew(); return models.WorkerLabour.findOne({ where: { diff --git a/modules/worker/back/methods/worker/allocatePDA.js b/modules/worker/back/methods/worker/allocatePDA.js new file mode 100644 index 000000000..8d0d25d2d --- /dev/null +++ b/modules/worker/back/methods/worker/allocatePDA.js @@ -0,0 +1,66 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('allocatePDA', { + description: 'Deallocate the PDA of the worker', + accepts: [{ + arg: 'id', + type: 'number', + required: true, + description: 'The worker id', + http: {source: 'path'} + }, { + arg: 'pda', + type: 'number', + required: true, + description: 'The pda id' + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/:id/allocatePDA`, + verb: 'POST' + } + }); + + Self.allocatePDA = async(ctx, options) => { + const models = Self.app.models; + const args = ctx.args; + let tx; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const pda = await models.DeviceProduction.findById(args.pda, myOptions); + if (pda.stateFk != 'idle') throw new UserError(`The PDA state is not idle`); + await pda.updateAttributes({stateFk: 'active'}, myOptions); + await models.DeviceProductionUser.create({ + deviceProductionFk: args.pda, + userFk: args.id, + created: new Date() + }, myOptions); + + if (tx) await tx.commit(); + + return { + deviceProductionFk: pda.id, + deviceProduction: { + modelFk: pda.modelFk, + serialNumber: pda.serialNumber + } + }; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/worker/back/methods/worker/createAbsence.js b/modules/worker/back/methods/worker/createAbsence.js index b3a3fce16..43a9f4d23 100644 --- a/modules/worker/back/methods/worker/createAbsence.js +++ b/modules/worker/back/methods/worker/createAbsence.js @@ -65,9 +65,9 @@ module.exports = Self => { if (args.dated < labour.started || (labour.ended != null && args.dated > labour.ended)) throw new UserError(`The contract was not active during the selected date`); - query = `SELECT * - FROM vn.workerTimeControl - WHERE userFk = ? AND timed BETWEEN DATE(?) AND CONCAT(DATE(?), ' 23:59:59') + query = `SELECT * + FROM vn.workerTimeControl + WHERE userFk = ? AND timed BETWEEN DATE(?) AND CONCAT(DATE(?), ' 23:59:59') LIMIT 1;`; const [hasHoursRecorded] = await Self.rawSql(query, [id, args.dated, args.dated]); @@ -80,18 +80,16 @@ module.exports = Self => { if (hasHoursRecorded && isNotHalfAbsence) throw new UserError(`The worker has hours recorded that day`); - const date = new Date(); - const now = new Date(); + const date = Date.vnNew(); + const now = Date.vnNew(); date.setHours(0, 0, 0, 0); const [result] = await Self.rawSql( `SELECT COUNT(*) halfHolidayCounter - FROM vn.calendar c - JOIN postgresql.business b ON b.business_id = c.businessFk - JOIN postgresql.profile p ON p.profile_id = b.client_id - JOIN vn.person pe ON pe.id = p.person_id - WHERE c.dayOffTypeFk = 6 - AND pe.workerFk = ? - AND c.dated BETWEEN util.firstDayOfYear(?) + FROM vn.calendar c + JOIN vn.business b ON b.id = c.businessFk + WHERE c.dayOffTypeFk = 6 + AND b.workerFk = ? + AND c.dated BETWEEN util.firstDayOfYear(?) AND LAST_DAY(DATE_ADD(?, INTERVAL 12 - MONTH(?) MONTH))`, [id, date, now, now]); const hasHalfHoliday = result.halfHolidayCounter > 0; diff --git a/modules/worker/back/methods/worker/deallocatePDA.js b/modules/worker/back/methods/worker/deallocatePDA.js new file mode 100644 index 000000000..7fa7855d1 --- /dev/null +++ b/modules/worker/back/methods/worker/deallocatePDA.js @@ -0,0 +1,53 @@ +module.exports = Self => { + Self.remoteMethodCtx('deallocatePDA', { + description: 'Deallocate the worker\'s PDA', + accepts: [{ + arg: 'id', + type: 'number', + required: true, + description: 'The worker id', + http: {source: 'path'} + }, { + arg: 'pda', + type: 'number', + required: true, + description: 'The pda id' + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/:id/deallocatePDA`, + verb: 'POST' + } + }); + + Self.deallocatePDA = async(ctx, options) => { + const models = Self.app.models; + const args = ctx.args; + let tx; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const pda = await models.DeviceProduction.findById(args.pda, myOptions); + await pda.updateAttributes({stateFk: 'idle'}, myOptions); + await models.DeviceProductionUser.destroyAll({userFk: args.id, deviceProductionFk: args.pda}, myOptions); + + if (tx) await tx.commit(); + + return pda; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/worker/back/methods/worker/filter.js b/modules/worker/back/methods/worker/filter.js index d08b27a18..71a8da96f 100644 --- a/modules/worker/back/methods/worker/filter.js +++ b/modules/worker/back/methods/worker/filter.js @@ -13,55 +13,59 @@ module.exports = Self => { type: 'Object', description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', http: {source: 'query'} - }, { - arg: 'tags', - type: ['Object'], - description: 'List of tags to filter with', - http: {source: 'query'} - }, { + }, + { arg: 'search', type: 'String', description: `If it's and integer searchs by id, otherwise it searchs by name`, http: {source: 'query'} - }, { + }, + { arg: 'id', type: 'Integer', description: 'The worker id', http: {source: 'query'} - }, { + }, + { arg: 'userFk', type: 'Integer', description: 'The user id', http: {source: 'query'} - }, { + }, + { arg: 'fi', type: 'String', description: 'The worker fi', http: {source: 'query'} - }, { + }, + { arg: 'departmentFk', type: 'Integer', description: 'The worker department id', http: {source: 'query'} - }, { + }, + { arg: 'extension', type: 'Integer', description: 'The worker extension id', http: {source: 'query'} - }, { + }, + { arg: 'firstName', type: 'String', description: 'The worker firstName', http: {source: 'query'} - }, { - arg: 'name', + }, + { + arg: 'lastName', type: 'String', - description: 'The worker name', + description: 'The worker lastName', http: {source: 'query'} - }, { - arg: 'nickname', + }, + { + arg: 'userName', type: 'String', - description: 'The worker nickname', + description: 'The worker user name', http: {source: 'query'} } ], @@ -93,10 +97,10 @@ module.exports = Self => { return {'w.id': value}; case 'userFk': return {'w.userFk': value}; - case 'name': - return {'w.lastName': {like: `%${value}%`}}; case 'firstName': return {'w.firstName': {like: `%${value}%`}}; + case 'lastName': + return {'w.lastName': {like: `%${value}%`}}; case 'extension': return {'p.extension': value}; case 'fi': diff --git a/modules/worker/back/methods/worker/holidays.js b/modules/worker/back/methods/worker/holidays.js index 339b84b7b..9c214e0f7 100644 --- a/modules/worker/back/methods/worker/holidays.js +++ b/modules/worker/back/methods/worker/holidays.js @@ -45,37 +45,21 @@ module.exports = Self => { if (!isSubordinate) throw new UserError(`You don't have enough privileges`); - const started = new Date(); + const started = Date.vnNew(); started.setFullYear(args.year); started.setMonth(0); started.setDate(1); started.setHours(0, 0, 0, 0); - const ended = new Date(); + const ended = Date.vnNew(); ended.setFullYear(args.year); ended.setMonth(12); ended.setDate(0); ended.setHours(23, 59, 59, 59); - const filter = { - where: { - and: [ - {workerFk: id}, - { - or: [ - {started: {between: [started, ended]}}, - {ended: {between: [started, ended]}}, - {and: [{started: {lt: started}}, {ended: {gt: ended}}]}, - {and: [{started: {lt: started}}, {ended: null}]} - ] - } - ], - - } - }; - const contracts = await models.WorkerLabour.find(filter, myOptions); - let [firstContract] = contracts; - const payedHolidays = firstContract.payedHolidays; + const filter = {where: {businessFk: args.businessFk}}; + const contract = await models.WorkerLabour.findOne(filter, myOptions); + const payedHolidays = contract.payedHolidays; let queryIndex; const year = started.getFullYear(); diff --git a/modules/worker/back/methods/worker/new.js b/modules/worker/back/methods/worker/new.js new file mode 100644 index 000000000..a7bb883cd --- /dev/null +++ b/modules/worker/back/methods/worker/new.js @@ -0,0 +1,256 @@ +/* eslint max-len: ["error", { "code": 130 }]*/ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('new', { + description: 'Creates a new worker and returns the id', + accessType: 'WRITE', + accepts: [ + { + arg: 'fi', + type: 'string', + description: `The worker fi`, + required: true, + }, + { + arg: 'name', + type: 'string', + description: `The user name`, + required: true, + }, + { + arg: 'firstName', + type: 'string', + description: `The worker firstname`, + required: true, + }, + { + arg: 'lastNames', + type: 'string', + description: `The worker lastnames`, + required: true, + }, + { + arg: 'email', + type: 'string', + description: `The worker email`, + required: true, + }, + { + arg: 'street', + type: 'string', + description: `The worker address`, + required: true, + }, + { + arg: 'city', + type: 'string', + description: `The worker city`, + required: true, + }, + { + arg: 'provinceFk', + type: 'number', + description: `The worker province`, + required: true, + }, + { + arg: 'iban', + type: 'string', + description: `The worker iban`, + required: true, + }, + { + arg: 'bankEntityFk', + type: 'number', + description: `The worker bank entity`, + required: true, + }, + { + arg: 'companyFk', + type: 'number', + description: `The worker company`, + required: true, + }, + { + arg: 'postcode', + type: 'string', + description: `The worker postcode`, + required: true, + }, + { + arg: 'phone', + type: 'string', + description: `The worker phone`, + required: true, + }, + { + arg: 'code', + type: 'string', + description: `The worker code`, + required: true, + }, + { + arg: 'bossFk', + type: 'number', + description: `The worker boss`, + required: true, + }, + { + arg: 'birth', + type: 'date', + description: `The worker birth`, + required: true, + } + ], + returns: { + type: 'number', + root: true, + }, + http: { + path: `/new`, + verb: 'POST', + }, + }); + + Self.new = async(ctx, options) => { + const models = Self.app.models; + const myOptions = {}; + const args = ctx.args; + + let tx; + + if (typeof options == 'object') Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + let client; + + try { + client = await models.Client.findOne( + { + where: {fi: args.fi}, + }, + myOptions + ); + + if (!client) { + const nickname = args.firstName.concat(' ', args.lastNames); + const workerConfig = await models.WorkerConfig.findOne({fields: ['roleFk']}); + const [randomPassword] = await models.Worker.rawSql( + 'SELECT account.passwordGenerate() as password;' + ); + + const user = await models.Account.create( + { + name: args.name, + nickname, + password: randomPassword.password, + email: args.email, + roleFk: workerConfig.roleFk, + }, + myOptions + ); + + await models.UserAccount.create( + { + id: user.id, + }, + myOptions + ); + + await models.Worker.rawSql( + 'CALL vn.clientCreate(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', + [ + args.firstName, + args.lastNames, + args.fi, + args.street, + args.postalCode, + args.city, + args.provinceFk, + args.companyFk, + args.phone, + args.email, + user.id, + ], + myOptions + ); + + const address = await models.Address.create( + { + clientFk: user.id, + street: args.street, + city: args.city, + provinceFk: args.provinceFk, + postalCode: args.postalCode, + mobile: args.phone, + nickname: nickname, + isDefaultAddress: true, + }, + myOptions + ); + + client = await models.Client.findById( + user.id, + {fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk']}, + myOptions + ); + + await client.updateAttributes( + { + iban: args.iban, + bankEntityFk: args.bankEntityFk, + defaultAddressFk: address.id, + }, + myOptions + ); + } + + const user = await models.Account.findById(client.id, null, myOptions); + await user.updateAttribute('email', args.email, myOptions); + + await models.Worker.rawSql( + 'CALL vn.workerCreate(?, ?, ?, ?, ?, ?, ?)', + [ + args.firstName, + args.lastNames, + args.code, + args.bossFk, + client.id, + args.fi, + args.birth, + ], + myOptions + ); + + if (tx) await tx.commit(); + } catch (error) { + if (tx) await tx.rollback(); + const code = error.code; + const message = error.sqlMessage; + + if (code === 'ER_DUP_ENTRY' && message.includes(`for key 'mail'`)) + throw new UserError(`This personal mail already exists`); + + if (code === 'ER_DUP_ENTRY' && message.includes(`CodigoTrabajador_UNIQUE`)) + throw new UserError(`This worker code already exists`); + + if (code === 'ER_DUP_ENTRY' && message.includes(`PRIMARY`)) + throw new UserError(`This worker already exists`); + + throw error; + } + + await models.user.resetPassword({ + email: args.email, + emailTemplate: 'worker-welcome', + id: client.id + }); + + return {id: client.id}; + }; +}; diff --git a/modules/worker/back/methods/worker/specs/allocatePDA.spec.js b/modules/worker/back/methods/worker/specs/allocatePDA.spec.js new file mode 100644 index 000000000..5c80b6408 --- /dev/null +++ b/modules/worker/back/methods/worker/specs/allocatePDA.spec.js @@ -0,0 +1,46 @@ +const models = require('vn-loopback/server/server').models; + +describe('Worker allocatePDA()', () => { + it('should allocate a new worker\'s PDA', async() => { + const tx = await models.Worker.beginTransaction({}); + try { + const workerWithoutPDA = 1101; + const PDAWithIdleState = 4; + const options = {transaction: tx}; + const ctx = {args: {id: workerWithoutPDA, pda: PDAWithIdleState}}; + + await models.Worker.allocatePDA(ctx, options); + const deviceProduction = await models.DeviceProduction.findById(PDAWithIdleState, null, options); + const deviceProductionUser = await models.DeviceProductionUser + .findById(PDAWithIdleState, null, options); + + expect(deviceProduction.stateFk).toEqual('active'); + expect(deviceProductionUser).not.toBeNull(); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should throw error trying to allocate a non idle PDA', async() => { + const tx = await models.Worker.beginTransaction({}); + let error; + try { + const workerWithoutPDA = 1101; + const PDAWithActiveState = 1; + const options = {transaction: tx}; + const ctx = {args: {id: workerWithoutPDA, pda: PDAWithActiveState}}; + + await models.Worker.allocatePDA(ctx, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error).toBeDefined(); + }); +}); diff --git a/modules/worker/back/methods/worker/specs/createAbsence.spec.js b/modules/worker/back/methods/worker/specs/createAbsence.spec.js index 7214e815e..346e43c51 100644 --- a/modules/worker/back/methods/worker/specs/createAbsence.spec.js +++ b/modules/worker/back/methods/worker/specs/createAbsence.spec.js @@ -10,7 +10,7 @@ describe('Worker createAbsence()', () => { args: { businessFk: 18, absenceTypeId: 1, - dated: new Date() + dated: Date.vnNew() } }; @@ -45,7 +45,7 @@ describe('Worker createAbsence()', () => { args: { businessFk: 18, absenceTypeId: 1, - dated: new Date() + dated: Date.vnNew() } }; ctx.req.__ = value => { @@ -82,7 +82,7 @@ describe('Worker createAbsence()', () => { id: 1, businessFk: 1, absenceTypeId: 6, - dated: new Date() + dated: Date.vnNew() } }; const workerId = 1; @@ -111,7 +111,7 @@ describe('Worker createAbsence()', () => { id: 1106, businessFk: 1106, absenceTypeId: 1, - dated: new Date() + dated: Date.vnNew() } }; const workerId = 1106; diff --git a/modules/worker/back/methods/worker/specs/deallocatePDA.spec.js b/modules/worker/back/methods/worker/specs/deallocatePDA.spec.js new file mode 100644 index 000000000..bddd017cd --- /dev/null +++ b/modules/worker/back/methods/worker/specs/deallocatePDA.spec.js @@ -0,0 +1,26 @@ +const models = require('vn-loopback/server/server').models; + +describe('Worker deallocatePDA()', () => { + it('should deallocate a worker\'s PDA', async() => { + const tx = await models.Worker.beginTransaction({}); + try { + const workerWithPDA = 1; + const PDAWithActiveState = 1; + const options = {transaction: tx}; + const ctx = {args: {id: workerWithPDA, pda: PDAWithActiveState}}; + + await models.Worker.deallocatePDA(ctx, options); + const deviceProduction = await models.DeviceProduction.findById(PDAWithActiveState, null, options); + const deviceProductionUser = await models.DeviceProductionUser + .findById(PDAWithActiveState, null, options); + + expect(deviceProduction.stateFk).toEqual('idle'); + expect(deviceProductionUser).toBe(null); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/worker/back/methods/worker/specs/deleteAbsence.spec.js b/modules/worker/back/methods/worker/specs/deleteAbsence.spec.js index a105669cf..0f3f913dc 100644 --- a/modules/worker/back/methods/worker/specs/deleteAbsence.spec.js +++ b/modules/worker/back/methods/worker/specs/deleteAbsence.spec.js @@ -28,7 +28,7 @@ describe('Worker deleteAbsence()', () => { const createdAbsence = await app.models.Calendar.create({ businessFk: businessId, dayOffTypeFk: 1, - dated: new Date() + dated: Date.vnNew() }, options); ctx.args = {absenceId: createdAbsence.id}; @@ -59,7 +59,7 @@ describe('Worker deleteAbsence()', () => { const createdAbsence = await app.models.Calendar.create({ businessFk: businessId, dayOffTypeFk: 1, - dated: new Date() + dated: Date.vnNew() }, options); ctx.args = {absenceId: createdAbsence.id}; diff --git a/modules/worker/back/methods/worker/specs/filter.spec.js b/modules/worker/back/methods/worker/specs/filter.spec.js index c1bc05ae8..2eb353576 100644 --- a/modules/worker/back/methods/worker/specs/filter.spec.js +++ b/modules/worker/back/methods/worker/specs/filter.spec.js @@ -16,7 +16,7 @@ describe('worker filter()', () => { }); it('should return 2 results filtering by name', async() => { - let result = await app.models.Worker.filter({args: {filter: {}, name: 'agency'}}); + let result = await app.models.Worker.filter({args: {filter: {}, firstName: 'agency'}}); expect(result.length).toEqual(2); expect(result[0].nickname).toEqual('agencyNick'); diff --git a/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js b/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js index 054a829e5..f5b06cc9e 100644 --- a/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js +++ b/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js @@ -3,10 +3,10 @@ const models = require('vn-loopback/server/server').models; describe('Worker getWorkedHours()', () => { it(`should return the expected hours and the worked hours of a given date`, async() => { const workerID = 1106; - const started = new Date(); + const started = Date.vnNew(); started.setHours(0, 0, 0, 0); - const ended = new Date(); + const ended = Date.vnNew(); ended.setHours(23, 59, 59, 999); const [result] = await models.Worker.getWorkedHours(workerID, started, ended); diff --git a/modules/worker/back/methods/worker/specs/holidays.spec.js b/modules/worker/back/methods/worker/specs/holidays.spec.js index 317bc8f0f..f23b247ca 100644 --- a/modules/worker/back/methods/worker/specs/holidays.spec.js +++ b/modules/worker/back/methods/worker/specs/holidays.spec.js @@ -17,7 +17,7 @@ describe('Worker holidays()', () => { }); it('should now get the absence calendar for a full year contract', async() => { - const now = new Date(); + const now = Date.vnNew(); const year = now.getFullYear(); ctx.args = {businessFk: businessId, year: year}; @@ -27,4 +27,15 @@ describe('Worker holidays()', () => { expect(result.totalHolidays).toEqual(27.5); expect(result.holidaysEnjoyed).toEqual(5); }); + + it('should now get the payed holidays calendar for a worker', async() => { + const now = Date.vnNew(); + const year = now.getFullYear(); + + ctx.args = {businessFk: businessId, year: year}; + + const result = await app.models.Worker.holidays(ctx, workerId); + + expect(result.payedHolidays).toEqual(8); + }); }); diff --git a/modules/worker/back/methods/worker/specs/new.spec.js b/modules/worker/back/methods/worker/specs/new.spec.js new file mode 100644 index 000000000..f695ab80e --- /dev/null +++ b/modules/worker/back/methods/worker/specs/new.spec.js @@ -0,0 +1,139 @@ +const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); + +describe('Worker new', () => { + beforeAll(async() => { + const activeCtx = { + accessToken: {userId: 9}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + + const employeeId = 1; + const defaultWorker = { + fi: '78457139E', + name: 'defaultWorker', + firstName: 'default', + lastNames: 'worker', + email: 'defaultWorker@mydomain.com', + street: 'S/ defaultWorkerStreet', + city: 'defaultWorkerCity', + provinceFk: 1, + iban: 'ES8304879798578129532677', + bankEntityFk: 128, + companyFk: 442, + postcode: '46680', + phone: '123456789', + code: 'DWW', + bossFk: 9, + birth: '2022-12-11T23:00:00.000Z' + }; + + it('should return error if personal mail already exists', async() => { + const user = await models.Account.findById(employeeId, {fields: ['email']}); + + const tx = await models.Worker.beginTransaction({}); + + let error; + try { + const options = {transaction: tx}; + const ctx = { + args: Object.assign({}, defaultWorker, {email: user.email}) + }; + + await models.Worker.new(ctx, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toEqual('This personal mail already exists'); + }); + + it('should return error if worker code already exists', async() => { + const worker = await models.Worker.findById(employeeId, {fields: ['code']}); + + const tx = await models.Worker.beginTransaction({}); + + let error; + try { + const options = {transaction: tx}; + const ctx = { + args: Object.assign({}, defaultWorker, {code: worker.code}) + }; + + await models.Worker.new(ctx, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toEqual('This worker code already exists'); + }); + + it('should return error if worker already exists', async() => { + const worker = await models.Client.findById(employeeId, {fields: ['fi']}); + + const tx = await models.Worker.beginTransaction({}); + + let error; + try { + const options = {transaction: tx}; + const ctx = { + args: Object.assign({}, defaultWorker, {fi: worker.fi}) + }; + await models.Worker.new(ctx, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error.message).toEqual('This worker already exists'); + }); + + it('should create a new worker', async() => { + const newWorker = await models.Worker.new({args: defaultWorker}); + + await models.Worker.destroyById(newWorker.id); + await models.Address.destroyAll({clientFk: newWorker.id}); + await models.Mandate.destroyAll({clientFk: newWorker.id}); + await models.Client.destroyById(newWorker.id); + await models.Account.destroyById(newWorker.id); + + expect(newWorker.id).toBeDefined(); + }); + + it('should create a new worker in client', async() => { + const bruceWayneId = 1101; + const client = await models.Client.findById(bruceWayneId, {fields: ['fi', 'email']}); + + const newWorkerData = { + args: Object.assign( + {}, + defaultWorker, + { + fi: client.fi, + email: client.email + }) + }; + const newWorker = await models.Worker.new(newWorkerData); + + await models.Worker.destroyById(newWorker.id); + + expect(newWorker.id).toEqual(bruceWayneId); + }); +}); diff --git a/modules/worker/back/methods/worker/specs/updateAbsence.spec.js b/modules/worker/back/methods/worker/specs/updateAbsence.spec.js index 6339b3163..a624fc1d3 100644 --- a/modules/worker/back/methods/worker/specs/updateAbsence.spec.js +++ b/modules/worker/back/methods/worker/specs/updateAbsence.spec.js @@ -21,7 +21,7 @@ describe('Worker updateAbsence()', () => { createdAbsence = await app.models.Calendar.create({ businessFk: businessId, dayOffTypeFk: 1, - dated: new Date() + dated: Date.vnNew() }); }); diff --git a/modules/worker/back/model-config.json b/modules/worker/back/model-config.json index c6b984bd2..63fc65827 100644 --- a/modules/worker/back/model-config.json +++ b/modules/worker/back/model-config.json @@ -1,7 +1,7 @@ { "AbsenceType": { "dataSource": "vn" - }, + }, "Calendar": { "dataSource": "vn" }, @@ -16,11 +16,32 @@ }, "Department": { "dataSource": "vn" - }, + }, + "Device": { + "dataSource": "vn" + }, + "DeviceProduction": { + "dataSource": "vn" + }, + "DeviceProductionModels": { + "dataSource": "vn" + }, + "DeviceProductionState": { + "dataSource": "vn" + }, + "DeviceProductionUser": { + "dataSource": "vn" + }, "EducationLevel": { "dataSource": "vn" }, - "Sector": { + "Journey": { + "dataSource": "vn" + }, + "ProfileType":{ + "dataSource": "vn" + }, + "Time": { "dataSource": "vn" }, "WorkCenter": { @@ -29,37 +50,43 @@ "WorkCenterHoliday": { "dataSource": "vn" }, - "WorkerDms": { + "Worker": { "dataSource": "vn" }, - "Worker": { + "WorkerConfig": { + "dataSource": "vn" + }, + "WorkerDepartment": { + "dataSource": "vn" + }, + "WorkerDisableExcluded": { + "dataSource": "vn" + }, + "WorkerDms": { "dataSource": "vn" }, "WorkerLabour": { "dataSource": "vn" }, + "WorkerLog": { + "dataSource": "vn" + }, "WorkerMana": { "dataSource": "vn" }, + "WorkerMedia": { + "dataSource": "vn" + }, "WorkerTeam": { "dataSource": "vn" }, "WorkerTeamCollegues": { "dataSource": "vn" }, - "WorkerMedia": { - "dataSource": "vn" - }, - "WorkerDepartment": { - "dataSource": "vn" - }, "WorkerTimeControl": { "dataSource": "vn" }, - "Device": { - "dataSource": "vn" - }, - "WorkerLog": { + "WorkerTimeControlConfig": { "dataSource": "vn" }, "WorkerTimeControlParams": { @@ -67,6 +94,9 @@ }, "WorkerTimeControlMail": { "dataSource": "vn" + }, + "Operator": { + "dataSource": "vn" } } diff --git a/modules/worker/back/models/device-production-models.json b/modules/worker/back/models/device-production-models.json new file mode 100644 index 000000000..dcf447520 --- /dev/null +++ b/modules/worker/back/models/device-production-models.json @@ -0,0 +1,15 @@ +{ + "name": "DeviceProductionModels", + "base": "VnModel", + "options": { + "mysql": { + "table": "deviceProductionModels" + } + }, + "properties": { + "code": { + "type": "string", + "id": true + } + } +} diff --git a/modules/worker/back/models/device-production-state.json b/modules/worker/back/models/device-production-state.json new file mode 100644 index 000000000..32695621a --- /dev/null +++ b/modules/worker/back/models/device-production-state.json @@ -0,0 +1,18 @@ +{ + "name": "DeviceProductionState", + "base": "VnModel", + "options": { + "mysql": { + "table": "deviceProductionState" + } + }, + "properties": { + "code": { + "type": "string", + "id": true + }, + "description": { + "type": "string" + } + } +} diff --git a/modules/worker/back/models/device-production-user.json b/modules/worker/back/models/device-production-user.json new file mode 100644 index 000000000..568e79413 --- /dev/null +++ b/modules/worker/back/models/device-production-user.json @@ -0,0 +1,33 @@ +{ + "name": "DeviceProductionUser", + "base": "VnModel", + "options": { + "mysql": { + "table": "deviceProductionUser" + } + }, + "properties": { + "deviceProductionFk": { + "type": "number", + "id": true + }, + "userFk": { + "type": "number" + }, + "created": { + "type": "date" + } + }, + "relations": { + "deviceProduction": { + "type": "belongsTo", + "model": "DeviceProduction", + "foreignKey": "deviceProductionFk" + }, + "user": { + "type": "belongsTo", + "model": "User", + "foreignKey": "userFk" + } + } +} diff --git a/modules/worker/back/models/device-production.json b/modules/worker/back/models/device-production.json new file mode 100644 index 000000000..63672500b --- /dev/null +++ b/modules/worker/back/models/device-production.json @@ -0,0 +1,54 @@ +{ + "name": "DeviceProduction", + "base": "VnModel", + "options": { + "mysql": { + "table": "deviceProduction" + } + }, + "properties": { + "id": { + "type": "number", + "id": true + }, + "imei": { + "type": "string" + }, + "modelFk": { + "type": "number" + }, + "macWifi": { + "type" : "string" + }, + "serialNumber": { + "type" : "string" + }, + "android_id": { + "type" : "string" + }, + "purchased": { + "type" : "date" + }, + "stateFk": { + "type" : "string" + }, + "isInScaleFusion": { + "type" : "boolean" + }, + "description": { + "type" : "string" + } + }, + "relations": { + "model": { + "type": "belongsTo", + "model": "DeviceProductionModels", + "foreignKey": "modelFk" + }, + "state": { + "type": "belongsTo", + "model": "DeviceProductionState", + "foreignKey": "stateFk" + } + } +} diff --git a/modules/worker/back/models/journey.json b/modules/worker/back/models/journey.json new file mode 100644 index 000000000..b7d5f2817 --- /dev/null +++ b/modules/worker/back/models/journey.json @@ -0,0 +1,27 @@ +{ + "name": "Journey", + "base": "VnModel", + "options": { + "mysql": { + "table": "postgresql.journey" + } + }, + "properties": { + "journey_id": { + "id": true, + "type": "number" + }, + "day_id": { + "type": "number" + }, + "start": { + "type": "date" + }, + "end": { + "type": "date" + }, + "business_id": { + "type": "number" + } + } +} diff --git a/modules/worker/back/models/operator.json b/modules/worker/back/models/operator.json new file mode 100644 index 000000000..db8a8c451 --- /dev/null +++ b/modules/worker/back/models/operator.json @@ -0,0 +1,44 @@ +{ + "name": "Operator", + "base": "VnModel", + "options": { + "mysql": { + "table": "operator" + } + }, + "properties": { + "workerFk": { + "id": true, + "type": "number", + "required": true + }, + "numberOfWagons": { + "type": "number" + }, + "trainFk": { + "type": "number", + "required": true + }, + "itemPackingTypeFk": { + "type": "string", + "required": true + }, + "warehouseFk": { + "type": "number", + "required": true + }, + "sectorFk ": { + "type": "number" + }, + "labelerFk ": { + "type": "number" + } + }, + "relations": { + "sector": { + "type": "belongsTo", + "model": "Sector", + "foreignKey": "sectorFk" + } + } +} \ No newline at end of file diff --git a/modules/worker/back/models/profile-type.json b/modules/worker/back/models/profile-type.json new file mode 100644 index 000000000..d1d750de8 --- /dev/null +++ b/modules/worker/back/models/profile-type.json @@ -0,0 +1,19 @@ +{ + "name": "ProfileType", + "base": "VnModel", + "options": { + "mysql": { + "table": "profileType" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string" + } + } +} diff --git a/modules/worker/back/models/time.json b/modules/worker/back/models/time.json new file mode 100644 index 000000000..e2f1161d7 --- /dev/null +++ b/modules/worker/back/models/time.json @@ -0,0 +1,24 @@ +{ + "name": "Time", + "base": "VnModel", + "options": { + "mysql": { + "table": "time" + } + }, + "properties": { + "dated": { + "id": true, + "type": "date" + }, + "year": { + "type": "number" + }, + "month": { + "type": "number" + }, + "week": { + "type": "number" + } + } +} diff --git a/modules/worker/back/models/worker-config.json b/modules/worker/back/models/worker-config.json new file mode 100644 index 000000000..05cdfef42 --- /dev/null +++ b/modules/worker/back/models/worker-config.json @@ -0,0 +1,27 @@ +{ + "name": "WorkerConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "workerConfig" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "roleFk": { + "type": "number" + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} diff --git a/modules/worker/back/models/worker-time-control-config.json b/modules/worker/back/models/worker-time-control-config.json new file mode 100644 index 000000000..b96e2ae3b --- /dev/null +++ b/modules/worker/back/models/worker-time-control-config.json @@ -0,0 +1,27 @@ +{ + "name": "WorkerTimeControlConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "workerTimeControlConfig" + } + }, + "properties": { + "id": { + "id": true, + "type": "number" + }, + "breakTime": { + "type": "number" + }, + "timeToBreakTime": { + "type": "number" + }, + "teleworkingStart": { + "type": "number" + }, + "teleworkingStartBreakTime": { + "type": "number" + } + } +} diff --git a/modules/worker/back/models/worker-time-control-mail.json b/modules/worker/back/models/worker-time-control-mail.json index daf3d5155..78b99881d 100644 --- a/modules/worker/back/models/worker-time-control-mail.json +++ b/modules/worker/back/models/worker-time-control-mail.json @@ -9,8 +9,7 @@ "properties": { "id": { "id": true, - "type": "number", - "required": true + "type": "number" }, "workerFk": { "type": "number" @@ -27,7 +26,7 @@ "updated": { "type": "date" }, - "emailResponse": { + "reason": { "type": "string" } }, diff --git a/modules/worker/back/models/worker-time-control.js b/modules/worker/back/models/worker-time-control.js index 45f4e2194..5b13e17f2 100644 --- a/modules/worker/back/models/worker-time-control.js +++ b/modules/worker/back/models/worker-time-control.js @@ -5,6 +5,10 @@ module.exports = Self => { require('../methods/worker-time-control/addTimeEntry')(Self); require('../methods/worker-time-control/deleteTimeEntry')(Self); require('../methods/worker-time-control/updateTimeEntry')(Self); + require('../methods/worker-time-control/sendMail')(Self); + require('../methods/worker-time-control/updateWorkerTimeControlMail')(Self); + require('../methods/worker-time-control/weeklyHourRecordEmail')(Self); + require('../methods/worker-time-control/getMailStates')(Self); Self.rewriteDbError(function(err) { if (err.code === 'ER_DUP_ENTRY') diff --git a/modules/worker/back/models/worker-time-control.json b/modules/worker/back/models/worker-time-control.json index ab07802ca..bc3e53501 100644 --- a/modules/worker/back/models/worker-time-control.json +++ b/modules/worker/back/models/worker-time-control.json @@ -22,6 +22,9 @@ }, "direction": { "type": "string" + }, + "isSendMail": { + "type": "boolean" } }, "relations": { diff --git a/modules/worker/back/models/worker.js b/modules/worker/back/models/worker.js index ec6c4af28..fa17640a8 100644 --- a/modules/worker/back/models/worker.js +++ b/modules/worker/back/models/worker.js @@ -13,4 +13,11 @@ module.exports = Self => { require('../methods/worker/contracts')(Self); require('../methods/worker/holidays')(Self); require('../methods/worker/activeContract')(Self); + require('../methods/worker/new')(Self); + require('../methods/worker/deallocatePDA')(Self); + require('../methods/worker/allocatePDA')(Self); + + Self.validatesUniquenessOf('locker', { + message: 'This locker has already been assigned' + }); }; diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index f7a344358..d21094f26 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -49,6 +49,15 @@ }, "labelerFk": { "type" : "number" + }, + "mobileExtension": { + "type" : "number" + }, + "code": { + "type" : "string" + }, + "locker": { + "type" : "number" } }, "relations": { @@ -88,4 +97,4 @@ "foreignKey": "sectorFk" } } -} \ No newline at end of file +} diff --git a/modules/worker/back/models/workerDisableExcluded.json b/modules/worker/back/models/workerDisableExcluded.json new file mode 100644 index 000000000..48083748d --- /dev/null +++ b/modules/worker/back/models/workerDisableExcluded.json @@ -0,0 +1,26 @@ +{ + "name": "WorkerDisableExcluded", + "base": "VnModel", + "options": { + "mysql": { + "table": "workerDisableExcluded" + } + }, + "properties": { + "workerFk": { + "id": true, + "type": "number" + }, + "dated": { + "type": "date" + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/modules/worker/front/basic-data/index.html b/modules/worker/front/basic-data/index.html index cbe683185..d89d88f2e 100644 --- a/modules/worker/front/basic-data/index.html +++ b/modules/worker/front/basic-data/index.html @@ -11,7 +11,7 @@ @@ -24,11 +24,19 @@ + + + + - - + + - - + + + + diff --git a/modules/worker/front/basic-data/locale/es.yml b/modules/worker/front/basic-data/locale/es.yml index 278335265..edf08de90 100644 --- a/modules/worker/front/basic-data/locale/es.yml +++ b/modules/worker/front/basic-data/locale/es.yml @@ -3,4 +3,7 @@ Origin country: País origen Education level: Nivel educación SSN: NSS Married: Casado/a -Single: Soltero/a \ No newline at end of file +Single: Soltero/a +Business phone: Teléfono de empresa +Mobile extension: Extensión móvil +Locker: Taquilla diff --git a/modules/worker/front/calendar/index.html b/modules/worker/front/calendar/index.html index cff4d0bc9..c9eacbd82 100644 --- a/modules/worker/front/calendar/index.html +++ b/modules/worker/front/calendar/index.html @@ -25,11 +25,11 @@
{{'Contract' | translate}} #{{$ctrl.businessId}}
- {{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}} + {{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}} {{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}}
- {{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}} + {{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}} {{'of' | translate}} {{$ctrl.contractHolidays.totalHours || 0}} {{'hours' | translate}}
@@ -40,11 +40,11 @@
{{'Year' | translate}} {{$ctrl.year}}
- {{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}} + {{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}} {{'of' | translate}} {{$ctrl.yearHolidays.totalHolidays || 0}} {{'days' | translate}}
- {{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}} + {{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}} {{'of' | translate}} {{$ctrl.yearHolidays.totalHours || 0}} {{'hours' | translate}}
@@ -66,7 +66,7 @@ order="businessFk DESC" limit="5"> -
#{{businessFk}}
+
#{{businessFk}}
{{started | date: 'dd/MM/yyyy'}} - {{ended ? (ended | date: 'dd/MM/yyyy') : 'Indef.'}}
@@ -87,17 +87,17 @@ - Festive + Festive - Current day + Current day
- diff --git a/modules/worker/front/calendar/index.js b/modules/worker/front/calendar/index.js index 95e1fc134..4ca0fc929 100644 --- a/modules/worker/front/calendar/index.js +++ b/modules/worker/front/calendar/index.js @@ -5,7 +5,7 @@ import './style.scss'; class Controller extends Section { constructor($element, $) { super($element, $); - this.date = new Date(); + this.date = Date.vnNew(); this.events = {}; this.buildYearFilter(); } @@ -15,7 +15,7 @@ class Controller extends Section { } set year(value) { - const newYear = new Date(); + const newYear = Date.vnNew(); newYear.setFullYear(value); this.date = newYear; @@ -76,7 +76,7 @@ class Controller extends Section { } buildYearFilter() { - const now = new Date(); + const now = Date.vnNew(); now.setFullYear(now.getFullYear() + 1); const maxYear = now.getFullYear(); diff --git a/modules/worker/front/calendar/index.spec.js b/modules/worker/front/calendar/index.spec.js index 1da4066d9..586a7223d 100644 --- a/modules/worker/front/calendar/index.spec.js +++ b/modules/worker/front/calendar/index.spec.js @@ -6,7 +6,7 @@ describe('Worker', () => { let $httpParamSerializer; let $scope; let controller; - let year = new Date().getFullYear(); + let year = Date.vnNew().getFullYear(); beforeEach(ngModule('worker')); @@ -67,7 +67,7 @@ describe('Worker', () => { controller.getIsSubordinate = jest.fn(); controller.getActiveContract = jest.fn(); - let today = new Date(); + let today = Date.vnNew(); let tomorrow = new Date(today.getTime()); tomorrow.setDate(tomorrow.getDate() + 1); @@ -105,7 +105,7 @@ describe('Worker', () => { describe('getContractHolidays()', () => { it(`should return the worker holidays amount and then set the contractHolidays property`, () => { - const today = new Date(); + const today = Date.vnNew(); const year = today.getFullYear(); const serializedParams = $httpParamSerializer({year}); @@ -119,7 +119,7 @@ describe('Worker', () => { describe('formatDay()', () => { it(`should set the day element style`, () => { - const today = new Date(); + const today = Date.vnNew(); controller.events[today.getTime()] = { name: 'Holiday', @@ -170,7 +170,7 @@ describe('Worker', () => { it(`should call to the create() method`, () => { jest.spyOn(controller, 'create').mockReturnThis(); - const selectedDay = new Date(); + const selectedDay = Date.vnNew(); const $event = { target: { closest: () => { @@ -188,7 +188,7 @@ describe('Worker', () => { it(`should call to the delete() method`, () => { jest.spyOn(controller, 'delete').mockReturnThis(); - const selectedDay = new Date(); + const selectedDay = Date.vnNew(); const expectedEvent = { dated: selectedDay, type: 'holiday', @@ -212,7 +212,7 @@ describe('Worker', () => { it(`should call to the edit() method`, () => { jest.spyOn(controller, 'edit').mockReturnThis(); - const selectedDay = new Date(); + const selectedDay = Date.vnNew(); const expectedEvent = { dated: selectedDay, type: 'leaveOfAbsence', @@ -238,7 +238,7 @@ describe('Worker', () => { it(`should make a HTTP POST query and then call to the repaintCanceller() method`, () => { jest.spyOn(controller, 'repaintCanceller').mockReturnThis(); - const dated = new Date(); + const dated = Date.vnNew(); const calendarElement = {}; const expectedResponse = {id: 10}; @@ -287,7 +287,7 @@ describe('Worker', () => { const expectedParams = {absenceId: 10}; const calendarElement = {}; - const selectedDay = new Date(); + const selectedDay = Date.vnNew(); const expectedEvent = { dated: selectedDay, type: 'leaveOfAbsence', diff --git a/modules/worker/front/create/index.html b/modules/worker/front/create/index.html new file mode 100644 index 000000000..5f5ab9d07 --- /dev/null +++ b/modules/worker/front/create/index.html @@ -0,0 +1,194 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + {{code}} - {{town.name}} ({{town.province.name}}, + {{town.province.country.country}}) + + + + + + + + {{name}} ({{country.country}}) + + + + + + {{name}}, {{province.name}} + ({{province.country.country}}) + + + + + + + + + + + + + + + + + + + + + + {{bic}} {{name}} + + + + + + + + + + + + + +
+ + + diff --git a/modules/worker/front/create/index.js b/modules/worker/front/create/index.js new file mode 100644 index 000000000..7966926b0 --- /dev/null +++ b/modules/worker/front/create/index.js @@ -0,0 +1,133 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section { + constructor($element, $) { + super($element, $); + this.worker = {companyFk: this.vnConfig.user.companyFk}; + } + + onSubmit() { + return this.$.watcher.submit().then(json => { + this.$state.go('worker.card.basicData', {id: json.data.id}); + }); + } + + get ibanCountry() { + if (!this.worker || !this.worker.iban) return false; + + let countryCode = this.worker.iban.substr(0, 2); + + return countryCode; + } + + autofillBic() { + if (!this.worker || !this.worker.iban) return; + + let bankEntityId = parseInt(this.worker.iban.substr(4, 4)); + let filter = {where: {id: bankEntityId}}; + + this.$http.get(`BankEntities`, {filter}).then(response => { + const hasData = response.data && response.data[0]; + + if (hasData) + this.worker.bankEntityFk = response.data[0].id; + else if (!hasData) + this.worker.bankEntityFk = null; + }); + } + + generateCodeUser() { + if (!this.worker.firstName || !this.worker.lastNames) return; + + const totalName = this.worker.firstName.concat(' ' + this.worker.lastNames).toLowerCase(); + const totalNameArray = totalName.split(' '); + let newCode = ''; + + for (let part of totalNameArray) + newCode += part.charAt(0); + + this.worker.code = newCode.toUpperCase().slice(0, 3); + this.worker.name = totalNameArray[0] + newCode.slice(1); + + if (!this.worker.companyFk) + this.worker.companyFk = this.vnConfig.user.companyFk; + } + + get province() { + return this._province; + } + + // Province auto complete + set province(selection) { + this._province = selection; + + if (!selection) return; + + const country = selection.country; + + if (!this.worker.countryFk) + this.worker.countryFk = country.id; + } + + get town() { + return this._town; + } + + // Town auto complete + set town(selection) { + this._town = selection; + + if (!selection) return; + + const province = selection.province; + const country = province.country; + const postcodes = selection.postcodes; + + if (!this.worker.provinceFk) + this.worker.provinceFk = province.id; + + if (!this.worker.countryFk) + this.worker.countryFk = country.id; + + if (postcodes.length === 1) + this.worker.postcode = postcodes[0].code; + } + + get postcode() { + return this._postcode; + } + + // Postcode auto complete + set postcode(selection) { + this._postcode = selection; + + if (!selection) return; + + const town = selection.town; + const province = town.province; + const country = province.country; + + if (!this.worker.city) + this.worker.city = town.name; + + if (!this.worker.provinceFk) + this.worker.provinceFk = province.id; + + if (!this.worker.countryFk) + this.worker.countryFk = country.id; + } + + onResponse(response) { + this.worker.postcode = response.code; + this.worker.city = response.city; + this.worker.provinceFk = response.provinceFk; + } +} + +Controller.$inject = ['$element', '$scope']; + +ngModule.vnComponent('vnWorkerCreate', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/worker/front/create/index.spec.js b/modules/worker/front/create/index.spec.js new file mode 100644 index 000000000..c2e9acce0 --- /dev/null +++ b/modules/worker/front/create/index.spec.js @@ -0,0 +1,133 @@ +import './index'; + +describe('Worker', () => { + describe('Component vnWorkerCreate', () => { + let $scope; + let $state; + let controller; + + beforeEach(ngModule('worker')); + + beforeEach(inject(($componentController, $rootScope, _$state_) => { + $scope = $rootScope.$new(); + $state = _$state_; + $scope.watcher = { + submit: () => { + return { + then: callback => { + callback({data: {id: '1234'}}); + } + }; + } + }; + const $element = angular.element(''); + controller = $componentController('vnWorkerCreate', {$element, $scope}); + controller.worker = {}; + controller.vnConfig = {user: {companyFk: 1}}; + })); + + describe('onSubmit()', () => { + it(`should call submit() on the watcher then expect a callback`, () => { + jest.spyOn($state, 'go'); + controller.onSubmit(); + + expect(controller.$state.go).toHaveBeenCalledWith('worker.card.basicData', {id: '1234'}); + }); + }); + + describe('province() setter', () => { + it(`should set countryFk property`, () => { + controller.worker.countryFk = null; + controller.province = { + id: 1, + name: 'New york', + country: { + id: 2, + name: 'USA' + } + }; + + expect(controller.worker.countryFk).toEqual(2); + }); + }); + + describe('town() setter', () => { + it(`should set provinceFk property`, () => { + controller.town = { + provinceFk: 1, + code: 46001, + province: { + id: 1, + name: 'New york', + country: { + id: 2, + name: 'USA' + } + }, + postcodes: [] + }; + + expect(controller.worker.provinceFk).toEqual(1); + }); + + it(`should set provinceFk property and fill the postalCode if there's just one`, () => { + controller.town = { + provinceFk: 1, + code: 46001, + province: { + id: 1, + name: 'New york', + country: { + id: 2, + name: 'USA' + } + }, + postcodes: [{code: '46001'}] + }; + + expect(controller.worker.provinceFk).toEqual(1); + expect(controller.worker.postcode).toEqual('46001'); + }); + }); + + describe('postcode() setter', () => { + it(`should set the town, provinceFk and contryFk properties`, () => { + controller.postcode = { + townFk: 1, + code: 46001, + town: { + id: 1, + name: 'New York', + province: { + id: 1, + name: 'New york', + country: { + id: 2, + name: 'USA' + } + } + } + }; + + expect(controller.worker.city).toEqual('New York'); + expect(controller.worker.provinceFk).toEqual(1); + expect(controller.worker.countryFk).toEqual(2); + }); + }); + + describe('generateCodeUser()', () => { + it(`should generate worker code, name and company `, () => { + controller.worker = { + firstName: 'default', + lastNames: 'generate worker' + }; + + controller.generateCodeUser(); + + expect(controller.worker.code).toEqual('DGW'); + expect(controller.worker.name).toEqual('defaultgw'); + expect(controller.worker.companyFk).toEqual(controller.vnConfig.user.companyFk); + }); + }); + }); +}); diff --git a/modules/worker/front/create/locale/es.yml b/modules/worker/front/create/locale/es.yml new file mode 100644 index 000000000..8c79d770c --- /dev/null +++ b/modules/worker/front/create/locale/es.yml @@ -0,0 +1,12 @@ +Firstname: Nombre +Lastname: Apellidos +Fi: DNI/NIF/NIE +Birth: Fecha de nacimiento +Code: Código de trabajador +Province: Provincia +City: Población +ProfileType: Tipo de perfil +Street: Dirección +Postcode: Código postal +Web user: Usuario Web +Access permission: Permiso de acceso diff --git a/modules/worker/front/descriptor/index.html b/modules/worker/front/descriptor/index.html index 01681ebb8..58ac3d9e6 100644 --- a/modules/worker/front/descriptor/index.html +++ b/modules/worker/front/descriptor/index.html @@ -14,6 +14,20 @@ + + + Click to exclude the user from getting disabled + + + Click to allow the user to be disabled + +
+
+ + +
@@ -91,14 +91,14 @@ - @@ -193,8 +193,85 @@ - + + + + + + + + + + + + + +
+ + + + + +
+ + + + +
+
+
+
+ + + + + + + +
diff --git a/modules/zone/front/events/index.js b/modules/zone/front/events/index.js index 0df16a42a..b86330126 100644 --- a/modules/zone/front/events/index.js +++ b/modules/zone/front/events/index.js @@ -1,5 +1,6 @@ import ngModule from '../module'; import Section from 'salix/components/section'; +import './style.scss'; class Controller extends Section { constructor($element, $, vnWeekDays) { @@ -20,6 +21,16 @@ class Controller extends Section { return `Zones/${this.$params.id}/exclusions`; } + get checked() { + const geos = this.$.model.data || []; + const checkedLines = []; + for (let geo of geos) { + if (geo.checked) + checkedLines.push(geo); + } + return checkedLines; + } + refresh() { this.$.data = null; this.$.$applyAsync(() => { @@ -48,33 +59,56 @@ class Controller extends Section { : this.$t('Everyday'); } - onSelection(days, type, weekday, events, exclusions) { + onSelection(days, type, weekday, events, exclusions, exclusionGeos) { if (this.editMode == 'include') { if (events.length) - this.edit(events[0]); - else - this.create(type, days, weekday); - } else { - if (exclusions.length) - this.exclusionDelete(exclusions); - else - this.exclusionCreate(days); + return this.editInclusion(events[0]); + return this.createInclusion(type, days, weekday); + } else if (this.editMode == 'exclude') { + if (exclusions.length || exclusionGeos.length) + return this.editExclusion(exclusions[0] || {}, exclusionGeos); + return this.createExclusion(days); } } + editExclusion(exclusion, exclusionGeos) { + this.isNew = false; + this.excludeSelected = angular.copy(exclusion); + this.excludeSelected.type = exclusionGeos.length ? + 'specificLocations' : 'all'; + + this.exclusionGeos = new Set(); + if (exclusionGeos.length) { + this.excludeSelected.id = exclusionGeos[0].zoneExclusionFk; + exclusionGeos.forEach(x => this.exclusionGeos.add(x.geoFk)); + } + + this.$.excludeDialog.show(); + } + + createExclusion(days) { + this.isNew = true; + this.excludeSelected = { + type: 'all', + dated: days[0] + }; + this.exclusionGeos = new Set(); + this.$.excludeDialog.show(); + } + onEditClick(row, event) { if (event.defaultPrevented) return; - this.edit(row); + this.editInclusion(row); } - edit(row) { + editInclusion(row) { this.isNew = false; this.selected = angular.copy(row); this.selected.wdays = this.vnWeekDays.fromSet(row.weekDays); - this.$.dialog.show(); + this.$.includeDialog.show(); } - create(type, days, weekday) { + createInclusion(type, days, weekday) { this.isNew = true; if (type == 'weekday') { @@ -92,7 +126,7 @@ class Controller extends Section { }; } - this.$.dialog.show(); + this.$.includeDialog.show(); } onIncludeResponse(response) { @@ -132,6 +166,19 @@ class Controller extends Section { } } + onExcludeResponse(response) { + const type = this.excludeSelected.type; + switch (response) { + case 'accept': { + if (type == 'all') + return this.exclusionCreate(); + return this.exclusionGeoCreate(); + } + case 'delete': + return this.exclusionDelete(this.excludeSelected); + } + } + onDeleteClick(id, event) { if (event.defaultPrevented) return; event.preventDefault(); @@ -149,31 +196,121 @@ class Controller extends Section { .then(() => this.refresh()); } - exclusionCreate(days) { - let exclusions = days.map(dated => { - return {dated}; - }); + exclusionCreate() { + const excludeSelected = this.excludeSelected; + const dated = excludeSelected.dated; + let req; - this.$http.post(this.exclusionsPath, exclusions) + if (this.isNew) + req = this.$http.post(this.exclusionsPath, [{dated}]); + if (!this.isNew) + req = this.$http.put(`${this.exclusionsPath}/${excludeSelected.id}`, {dated}); + + return req.then(() => { + this.refresh(); + }); + } + + exclusionGeoCreate() { + const excludeSelected = this.excludeSelected; + let req; + const geoIds = []; + this.exclusionGeos.forEach(id => geoIds.push(id)); + + if (this.isNew) { + const params = { + zoneFk: parseInt(this.$params.id), + date: excludeSelected.dated, + geoIds + }; + req = this.$http.post(`Zones/exclusionGeo`, params); + } else { + const params = { + zoneExclusionFk: this.excludeSelected.id, + geoIds + }; + req = this.$http.post(`Zones/updateExclusionGeo`, params); + } + return req.then(() => this.refresh()); + } + + exclusionDelete(exclusion) { + const path = `${this.exclusionsPath}/${exclusion.id}`; + return this.$http.delete(path) .then(() => this.refresh()); } - exclusionDelete(exclusions) { - let reqs = []; + set excludeSearch(value) { + this._excludeSearch = value; + if (!value) this.onSearch(); + } - for (let exclusion of exclusions) { - if (!exclusion.id) continue; - let path = `${this.exclusionsPath}/${exclusion.id}`; - reqs.push(this.$http.delete(path)); + get excludeSearch() { + return this._excludeSearch; + } + + onKeyDown(event) { + if (event.key == 'Enter') { + event.preventDefault(); + this.onSearch(); + } + } + + onSearch() { + const params = {search: this._excludeSearch}; + if (this.excludeSelected.type == 'specificLocations') { + this.$.model.applyFilter({}, params).then(() => { + const data = this.$.model.data; + this.getChecked(data); + this.$.treeview.data = data; + }); + } + } + + onFetch(item) { + const params = item ? {parentId: item.id} : null; + return this.$.model.applyFilter({}, params).then(() => { + const data = this.$.model.data; + this.getChecked(data); + return data; + }); + } + + onSort(a, b) { + if (b.selected !== a.selected) { + if (a.selected == null) + return 1; + if (b.selected == null) + return -1; + return b.selected - a.selected; } - this.$q.all(reqs) - .then(() => this.refresh()); + return a.name.localeCompare(b.name); + } + + getChecked(data) { + for (let geo of data) { + geo.checked = this.exclusionGeos.has(geo.id); + if (geo.childs) this.getChecked(geo.childs); + } + } + + onItemCheck(geoId, checked) { + if (checked) + this.exclusionGeos.add(geoId); + else + this.exclusionGeos.delete(geoId); } } Controller.$inject = ['$element', '$scope', 'vnWeekDays']; ngModule.vnComponent('vnZoneEvents', { template: require('./index.html'), - controller: Controller + controller: Controller, + bindings: { + zone: '<' + }, + require: { + card: '^vnZoneCard' + } }); diff --git a/modules/zone/front/events/index.spec.js b/modules/zone/front/events/index.spec.js index ed2c91c31..558d97b6f 100644 --- a/modules/zone/front/events/index.spec.js +++ b/modules/zone/front/events/index.spec.js @@ -1,4 +1,5 @@ import './index'; +import crudModel from 'core/mocks/crud-model'; describe('component vnZoneEvents', () => { let $scope; @@ -34,7 +35,8 @@ describe('component vnZoneEvents', () => { const query = `Zones/getEventsFiltered?ended=${date}&started=${date}&zoneFk=${params.zoneFk}`; const response = { events: 'myEvents', - exclusions: 'myExclusions' + exclusions: 'myExclusions', + geoExclusions: 'myGeoExclusions', }; $httpBackend.whenGET(query).respond(response); controller.refresh(); @@ -48,71 +50,129 @@ describe('component vnZoneEvents', () => { }); describe('onSelection()', () => { - it('should call the edit() method', () => { - jest.spyOn(controller, 'edit').mockReturnThis(); + it('should call the editInclusion() method', () => { + jest.spyOn(controller, 'editInclusion').mockReturnThis(); const weekday = {}; const days = []; const type = 'EventType'; const events = [{name: 'Event'}]; const exclusions = []; + const exclusionsGeo = []; controller.editMode = 'include'; - controller.onSelection(days, type, weekday, events, exclusions); + controller.onSelection(days, type, weekday, events, exclusions, exclusionsGeo); - expect(controller.edit).toHaveBeenCalledWith({name: 'Event'}); + expect(controller.editInclusion).toHaveBeenCalledWith({name: 'Event'}); }); - it('should call the create() method', () => { - jest.spyOn(controller, 'create').mockReturnThis(); + it('should call the createInclusion() method', () => { + jest.spyOn(controller, 'createInclusion').mockReturnThis(); - const weekday = {dated: new Date()}; + const weekday = {dated: Date.vnNew()}; const days = [weekday]; const type = 'EventType'; const events = []; const exclusions = []; + const exclusionsGeo = []; controller.editMode = 'include'; - controller.onSelection(days, type, weekday, events, exclusions); + controller.onSelection(days, type, weekday, events, exclusions, exclusionsGeo); - expect(controller.create).toHaveBeenCalledWith(type, days, weekday); + expect(controller.createInclusion).toHaveBeenCalledWith(type, days, weekday); }); - it('should call the exclusionDelete() method', () => { - jest.spyOn(controller, 'exclusionDelete').mockReturnThis(); + it('should call the editExclusion() method with exclusions', () => { + jest.spyOn(controller, 'editExclusion').mockReturnThis(); const weekday = {}; const days = []; const type = 'EventType'; const events = []; - const exclusions = [{id: 1}]; - controller.editMode = 'delete'; - controller.onSelection(days, type, weekday, events, exclusions); + const exclusions = [{name: 'Exclusion'}]; + const exclusionsGeo = []; + controller.editMode = 'exclude'; + controller.onSelection(days, type, weekday, events, exclusions, exclusionsGeo); - expect(controller.exclusionDelete).toHaveBeenCalledWith(exclusions); + expect(controller.editExclusion).toHaveBeenCalled(); }); - it('should call the exclusionCreate() method', () => { - jest.spyOn(controller, 'exclusionCreate').mockReturnThis(); + it('should call the editExclusion() method with exclusionsGeo', () => { + jest.spyOn(controller, 'editExclusion').mockReturnThis(); const weekday = {}; - const days = [{dated: new Date()}]; + const days = []; const type = 'EventType'; const events = []; const exclusions = []; - controller.editMode = 'delete'; - controller.onSelection(days, type, weekday, events, exclusions); + const exclusionsGeo = [{name: 'GeoExclusion'}]; + controller.editMode = 'exclude'; + controller.onSelection(days, type, weekday, events, exclusions, exclusionsGeo); - expect(controller.exclusionCreate).toHaveBeenCalledWith(days); + expect(controller.editExclusion).toHaveBeenCalled(); + }); + + it('should call the createExclusion() method', () => { + jest.spyOn(controller, 'createExclusion').mockReturnThis(); + + const weekday = {}; + const days = [{dated: Date.vnNew()}]; + const type = 'EventType'; + const events = []; + const exclusions = []; + const exclusionsGeo = []; + controller.editMode = 'exclude'; + controller.onSelection(days, type, weekday, events, exclusions, exclusionsGeo); + + expect(controller.createExclusion).toHaveBeenCalledWith(days); }); }); - describe('create()', () => { - it('shoud set the selected property and then call the dialog show() method', () => { - controller.$.dialog = {show: jest.fn()}; + describe('editExclusion()', () => { + it('shoud set the excludeSelected.type = "specificLocations" and then call the excludeDialog show() method', () => { + controller.$.excludeDialog = {show: jest.fn()}; + + const exclusionGeos = [{id: 1}]; + const exclusions = []; + + controller.editExclusion(exclusions, exclusionGeos); + + expect(controller.excludeSelected.type).toEqual('specificLocations'); + expect(controller.$.excludeDialog.show).toHaveBeenCalledWith(); + }); + + it('shoud set the excludeSelected.type = "all" and then call the excludeDialog show() method', () => { + controller.$.excludeDialog = {show: jest.fn()}; + + const exclusionGeos = []; + const exclusions = [{id: 1}]; + + controller.editExclusion(exclusions, exclusionGeos); + + expect(controller.excludeSelected.type).toEqual('all'); + expect(controller.$.excludeDialog.show).toHaveBeenCalledWith(); + }); + }); + + describe('createExclusion()', () => { + it('shoud set the excludeSelected property and then call the excludeDialog show() method', () => { + controller.$.excludeDialog = {show: jest.fn()}; + + const days = [Date.vnNew()]; + controller.createExclusion(days); + + expect(controller.excludeSelected).toBeDefined(); + expect(controller.isNew).toBeTruthy(); + expect(controller.$.excludeDialog.show).toHaveBeenCalledWith(); + }); + }); + + describe('createInclusion()', () => { + it('shoud set the selected property and then call the includeDialog show() method', () => { + controller.$.includeDialog = {show: jest.fn()}; const type = 'weekday'; - const days = [new Date()]; + const days = [Date.vnNew()]; const weekday = 1; - controller.create(type, days, weekday); + controller.createInclusion(type, days, weekday); const selection = controller.selected; const firstWeekday = selection.wdays[weekday]; @@ -120,23 +180,23 @@ describe('component vnZoneEvents', () => { expect(selection.type).toEqual('indefinitely'); expect(firstWeekday).toBeTruthy(); expect(controller.isNew).toBeTruthy(); - expect(controller.$.dialog.show).toHaveBeenCalledWith(); + expect(controller.$.includeDialog.show).toHaveBeenCalledWith(); }); - it('shoud set the selected property with the first day and then call the dialog show() method', () => { - controller.$.dialog = {show: jest.fn()}; + it('shoud set the selected property with the first day and then call the includeDialog show() method', () => { + controller.$.includeDialog = {show: jest.fn()}; const type = 'nonListedType'; - const days = [new Date()]; + const days = [Date.vnNew()]; const weekday = 1; - controller.create(type, days, weekday); + controller.createInclusion(type, days, weekday); const selection = controller.selected; expect(selection.type).toEqual('day'); expect(selection.dated).toEqual(days[0]); expect(controller.isNew).toBeTruthy(); - expect(controller.$.dialog.show).toHaveBeenCalledWith(); + expect(controller.$.includeDialog.show).toHaveBeenCalledWith(); }); }); @@ -180,6 +240,35 @@ describe('component vnZoneEvents', () => { }); }); + describe('onExcludeResponse()', () => { + it('should call the exclusionCreate() method', () => { + jest.spyOn(controller, 'exclusionCreate').mockReturnThis(); + + controller.excludeSelected = {type: 'all'}; + controller.onExcludeResponse('accept'); + + expect(controller.exclusionCreate).toHaveBeenCalledWith(); + }); + + it('should call the exclusionGeoCreate() method', () => { + jest.spyOn(controller, 'exclusionGeoCreate').mockReturnThis(); + + controller.excludeSelected = {type: 'specificLocations'}; + controller.onExcludeResponse('accept'); + + expect(controller.exclusionGeoCreate).toHaveBeenCalledWith(); + }); + + it('should call the exclusionDelete() method', () => { + jest.spyOn(controller, 'exclusionDelete').mockReturnThis(); + + controller.excludeSelected = {id: 1, type: 'all'}; + controller.onExcludeResponse('delete'); + + expect(controller.exclusionDelete).toHaveBeenCalledWith(controller.excludeSelected); + }); + }); + describe('onDeleteResponse()', () => { it('shoud make an HTTP DELETE query and then call the refresh() method', () => { jest.spyOn(controller, 'refresh').mockReturnThis(); @@ -197,9 +286,10 @@ describe('component vnZoneEvents', () => { it('shoud make an HTTP POST query and then call the refresh() method', () => { jest.spyOn(controller, 'refresh').mockReturnThis(); - const dates = [new Date()]; + controller.excludeSelected = {}; + controller.isNew = true; $httpBackend.expect('POST', `Zones/1/exclusions`).respond({id: 1}); - controller.exclusionCreate(dates); + controller.exclusionCreate(); $httpBackend.flush(); expect(controller.refresh).toHaveBeenCalledWith(); @@ -210,25 +300,41 @@ describe('component vnZoneEvents', () => { it('shoud make an HTTP DELETE query once and then call the refresh() method', () => { jest.spyOn(controller, 'refresh').mockReturnThis(); - const exclusions = [{id: 1}]; + const exclusions = {id: 1}; const firstExclusionId = 1; - $httpBackend.when('DELETE', `Zones/1/exclusions/${firstExclusionId}`).respond(200); + $httpBackend.expectDELETE(`Zones/1/exclusions/${firstExclusionId}`).respond(200); controller.exclusionDelete(exclusions); $httpBackend.flush(); expect(controller.refresh).toHaveBeenCalledWith(); }); + }); - it('shoud make an HTTP DELETE query for every event and then call the refresh() method', () => { - jest.spyOn(controller, 'refresh').mockReturnThis(); - jest.spyOn(controller.$http, 'delete').mockReturnValue(200); + describe('onSearch()', () => { + it('should call the applyFilter() method and then set the data', () => { + jest.spyOn(controller, 'getChecked').mockReturnValue([1, 2, 3]); - const exclusions = [{id: 1}, {id: 2}, {id: 3}, {id: 4}]; - controller.exclusionDelete(exclusions); - $scope.$apply(); + controller.$.treeview = {}; + controller.$.model = crudModel; + controller.excludeSelected = {type: 'specificLocations'}; + controller._excludeSearch = 'es'; - expect(controller.$http.delete).toHaveBeenCalledTimes(4); - expect(controller.refresh).toHaveBeenCalledWith(); + controller.onSearch(); + const treeviewData = controller.$.treeview.data; + + expect(treeviewData).toBeDefined(); + expect(treeviewData.length).toEqual(3); + }); + }); + + describe('onFetch()', () => { + it('should call the applyFilter() method and then return the model data', () => { + jest.spyOn(controller, 'getChecked').mockReturnValue([1, 2, 3]); + + controller.$.model = crudModel; + const result = controller.onFetch(); + + expect(result.length).toEqual(3); }); }); }); diff --git a/modules/zone/front/events/locale/es.yml b/modules/zone/front/events/locale/es.yml index eb581a719..d6eee9f67 100644 --- a/modules/zone/front/events/locale/es.yml +++ b/modules/zone/front/events/locale/es.yml @@ -4,3 +4,9 @@ Exclude: Excluir Events: Eventos Add event: Añadir evento Edit event: Editar evento +All: Todo +Specific locations: Localizaciones concretas +Locations where it is not distributed: Localizaciones en las que no se reparte +You must select a location: Debes seleccionar una localización +Add exclusion: Añadir exclusión +Edit exclusion: Editar exclusión diff --git a/modules/zone/front/events/style.scss b/modules/zone/front/events/style.scss new file mode 100644 index 000000000..49a6e87a6 --- /dev/null +++ b/modules/zone/front/events/style.scss @@ -0,0 +1,11 @@ +@import "variables"; + + .width{ + width: 600px + } + + .treeview{ + max-height: 300px; + overflow: auto; + } + diff --git a/modules/zone/front/locale/es.yml b/modules/zone/front/locale/es.yml index c40dc5c20..7c9e783ab 100644 --- a/modules/zone/front/locale/es.yml +++ b/modules/zone/front/locale/es.yml @@ -13,6 +13,7 @@ Indefinitely: Indefinido Inflation: Inflación Locations: Localizaciones Maximum m³: M³ máximo +Max m³: Medida máxima New zone: Nueva zona One day: Un día Pick up: Recogida diff --git a/modules/zone/front/location/style.scss b/modules/zone/front/location/style.scss index 2316a2622..24d685a51 100644 --- a/modules/zone/front/location/style.scss +++ b/modules/zone/front/location/style.scss @@ -1,19 +1,21 @@ @import "variables"; -vn-treeview-child { - .content > .vn-check:not(.indeterminate):not(.checked) { - color: $color-alert; +vn-zone-location { + vn-treeview-child { + .content > .vn-check:not(.indeterminate):not(.checked) { + color: $color-alert; - & > .btn { - border-color: $color-alert; + & > .btn { + border-color: $color-alert; + } + } + .content > .vn-check.checked { + color: $color-notice; + + & > .btn { + background-color: $color-notice; + border-color: $color-notice + } } } - .content > .vn-check.checked { - color: $color-notice; - - & > .btn { - background-color: $color-notice; - border-color: $color-notice - } - } -} \ No newline at end of file +} diff --git a/modules/zone/front/routes.json b/modules/zone/front/routes.json index e08f97314..7f67260da 100644 --- a/modules/zone/front/routes.json +++ b/modules/zone/front/routes.json @@ -85,10 +85,13 @@ "description": "Warehouses" }, { - "url": "/events", + "url": "/events?q", "state": "zone.card.events", "component": "vn-zone-events", - "description": "Calendar" + "description": "Calendar", + "params": { + "zone": "$ctrl.zone" + } }, { "url": "/location?q", diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..7e86dbba9 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,44462 @@ +{ + "name": "salix-back", + "version": "23.08.01", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "salix-back", + "version": "23.08.01", + "license": "GPL-3.0", + "dependencies": { + "axios": "^1.2.2", + "base64url": "^3.0.1", + "bcrypt": "^5.0.1", + "bmp-js": "^0.1.0", + "compression": "^1.7.3", + "form-data": "^4.0.0", + "fs-extra": "^5.0.0", + "ftps": "^1.2.0", + "gm": "^1.25.0", + "got": "^10.7.0", + "helmet": "^3.21.2", + "i18n": "^0.8.4", + "image-type": "^4.1.0", + "imap": "^0.8.19", + "jsdom": "^16.7.0", + "jszip": "^3.10.0", + "ldapjs": "^2.2.0", + "loopback": "^3.28.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": "^18.0.5", + "read-chunk": "^3.2.0", + "require-yaml": "0.0.1", + "sharp": "^0.31.3", + "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.5.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/@ampproject/remapping": { + "version": "2.1.2", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.0" + }, + "engines": { + "node": ">=6.0.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.17.7", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.17.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.1.0", + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.7", + "@babel/helper-compilation-targets": "^7.17.7", + "@babel/helper-module-transforms": "^7.17.7", + "@babel/helpers": "^7.17.8", + "@babel/parser": "^7.17.8", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.3", + "@babel/types": "^7.17.0", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/debug": { + "version": "4.3.4", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@babel/core/node_modules/ms": { + "version": "2.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/@babel/core/node_modules/semver": { + "version": "6.3.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/generator": { + "version": "7.17.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.17.0", + "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.17.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.17.7", + "@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-compilation-targets/node_modules/semver": { + "version": "6.3.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/helper-create-class-features-plugin": { + "version": "7.17.6", + "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.17.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "regexpu-core": "^5.0.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-define-polyfill-provider": { + "version": "0.3.1", + "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-define-polyfill-provider/node_modules/debug": { + "version": "4.3.4", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@babel/helper-define-polyfill-provider/node_modules/ms": { + "version": "2.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/@babel/helper-define-polyfill-provider/node_modules/semver": { + "version": "6.3.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "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.17.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.17.0" + }, + "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.17.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.17.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.3", + "@babel/types": "^7.17.0" + }, + "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.17.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.17.0" + }, + "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.17.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.3", + "@babel/types": "^7.17.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.16.10", + "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/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/parser": { + "version": "7.17.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.17.6", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.17.6", + "@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.17.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.17.0", + "@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.11", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.16.10", + "@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.17.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.17.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-transforms": "^7.17.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-simple-access": "^7.17.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.17.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-module-transforms": "^7.17.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.11", + "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.11", + "@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-env/node_modules/semver": { + "version": "6.3.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "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.17.7", + "dev": true, + "license": "MIT", + "dependencies": { + "clone-deep": "^4.0.1", + "find-cache-dir": "^2.0.0", + "make-dir": "^2.1.0", + "pirates": "^4.0.5", + "source-map-support": "^0.5.16" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/register/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/@babel/register/node_modules/semver": { + "version": "5.7.1", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/@babel/runtime": { + "version": "7.17.8", + "dev": true, + "license": "MIT", + "dependencies": { + "regenerator-runtime": "^0.13.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/runtime-corejs3": { + "version": "7.17.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.17.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.3", + "@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.17.3", + "@babel/types": "^7.17.0", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/debug": { + "version": "4.3.4", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@babel/traverse/node_modules/ms": { + "version": "2.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/@babel/types": { + "version": "7.17.0", + "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/debug": { + "version": "4.3.4", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.13.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/js-yaml": { + "version": "3.14.1", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@eslint/eslintrc/node_modules/ms": { + "version": "2.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/@eslint/eslintrc/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/@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/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/mime": { + "version": "2.6.0", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "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/config-array/node_modules/debug": { + "version": "4.3.4", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/ms": { + "version": "2.1.2", + "dev": true, + "license": "MIT" + }, + "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/load-nyc-config/node_modules/js-yaml": { + "version": "3.14.1", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "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/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-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/core/node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "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/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/semver": { + "version": "6.3.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "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/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/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@jest/transform/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/@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/@jridgewell/resolve-uri": { + "version": "3.0.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.11", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@mapbox/node-pre-gyp": { + "version": "1.0.10", + "license": "BSD-3-Clause", + "dependencies": { + "detect-libc": "^2.0.0", + "https-proxy-agent": "^5.0.0", + "make-dir": "^3.1.0", + "node-fetch": "^2.6.7", + "nopt": "^5.0.0", + "npmlog": "^5.0.1", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.11" + }, + "bin": { + "node-pre-gyp": "bin/node-pre-gyp" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/agent-base": { + "version": "6.0.2", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/ansi-regex": { + "version": "5.0.1", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/are-we-there-yet": { + "version": "2.0.0", + "license": "ISC", + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/chownr": { + "version": "2.0.0", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/debug": { + "version": "4.3.4", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/gauge": { + "version": "3.0.2", + "license": "ISC", + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.2", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.1", + "object-assign": "^4.1.1", + "signal-exit": "^3.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/https-proxy-agent": { + "version": "5.0.1", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/lru-cache": { + "version": "6.0.0", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@mapbox/node-pre-gyp/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/@mapbox/node-pre-gyp/node_modules/make-dir/node_modules/semver": { + "version": "6.3.0", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/mkdirp": { + "version": "1.0.4", + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/ms": { + "version": "2.1.2", + "license": "MIT" + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/nopt": { + "version": "5.0.0", + "license": "ISC", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/npmlog": { + "version": "5.0.1", + "license": "ISC", + "dependencies": { + "are-we-there-yet": "^2.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^3.0.0", + "set-blocking": "^2.0.0" + } + }, + "node_modules/@mapbox/node-pre-gyp/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/@mapbox/node-pre-gyp/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/@mapbox/node-pre-gyp/node_modules/semver": { + "version": "7.3.8", + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/string_decoder": { + "version": "1.3.0", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/@mapbox/node-pre-gyp/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" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/strip-ansi": { + "version": "6.0.1", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/tar": { + "version": "6.1.11", + "license": "ISC", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^3.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/yallist": { + "version": "4.0.0", + "license": "ISC" + }, + "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", + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/@types/babel__core": { + "version": "7.1.19", + "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.11", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/keyv": { + "version": "3.1.4", + "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.23", + "license": "MIT" + }, + "node_modules/@types/normalize-package-data": { + "version": "2.4.1", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/prettier": { + "version": "2.4.4", + "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/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": "21.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==", + "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", + "license": "BSD-3-Clause" + }, + "node_modules/abbrev": { + "version": "1.1.1", + "license": "ISC" + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "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.8", + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/acorn": { + "version": "7.4.1", + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-globals": { + "version": "6.0.0", + "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", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/agent-base": { + "version": "4.3.0", + "license": "MIT", + "dependencies": { + "es6-promisify": "^5.0.0" + }, + "engines": { + "node": ">= 4.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", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.1.0" + } + }, + "node_modules/ansi-align/node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-align/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-align/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/ansi-align/node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.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": "2.1.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "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" + } + }, + "node_modules/ansi-wrap": { + "version": "0.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "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/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", + "dev": true, + "license": "ISC", + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "node_modules/are-we-there-yet/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/are-we-there-yet/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/are-we-there-yet/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "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-parallel": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/array-parallel/-/array-parallel-0.1.3.tgz", + "integrity": "sha512-TDPTwSWW5E4oiFiKmz6RGJ/a80Y91GuLgUYuLd49+XBS75tYo8PNgaT2K/OxuQYqkoI852MDGBorg9OcUSTQ8w==" + }, + "node_modules/array-series": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/array-series/-/array-series-0.1.5.tgz", + "integrity": "sha512-L0XlBwfx9QetHOsbLDrE/vh2t018w9462HM3iaFfxRiK83aJjAt/Ja3NMkOW7FICwWTlQBa3ZbL5FKhuQWkDrg==" + }, + "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.1102.0", + "license": "Apache-2.0", + "dependencies": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.16.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/sax": { + "version": "1.2.1", + "license": "ISC" + }, + "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": "1.2.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.2.tgz", + "integrity": "sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==", + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "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-loader": { + "version": "8.2.4", + "dev": true, + "license": "MIT", + "dependencies": { + "find-cache-dir": "^3.3.1", + "loader-utils": "^2.0.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/semver": { + "version": "6.3.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "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.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.13.11", + "@babel/helper-define-polyfill-provider": "^0.3.1", + "semver": "^6.1.1" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/babel-plugin-polyfill-corejs2/node_modules/semver": { + "version": "6.3.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/babel-plugin-polyfill-corejs3": { + "version": "0.5.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.3.1", + "core-js-compat": "^3.21.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/babel-plugin-polyfill-regenerator": { + "version": "0.3.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.3.1" + }, + "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.0.2", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/base64url": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", + "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==", + "engines": { + "node": ">=6.0.0" + } + }, + "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": { + "version": "5.1.0", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@mapbox/node-pre-gyp": "^1.0.10", + "node-addon-api": "^5.0.0" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "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.2", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/binary-extensions": { + "version": "1.13.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/bl": { + "version": "2.2.1", + "license": "MIT", + "dependencies": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/bl/node_modules/isarray": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/bl/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/bl/node_modules/string_decoder": { + "version": "1.1.1", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "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.2", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "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.7", + "raw-body": "2.4.3", + "type-is": "~1.6.18" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/body-parser/node_modules/bytes": { + "version": "3.1.2", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/body-parser/node_modules/depd": { + "version": "1.1.2", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "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/bowser": { + "version": "2.9.0", + "license": "MIT" + }, + "node_modules/boxen": { + "version": "5.1.2", + "dev": true, + "license": "MIT", + "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-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen/node_modules/camelcase": { + "version": "6.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/boxen/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen/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/boxen/node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen/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/boxen/node_modules/wrap-ansi": { + "version": "7.0.0", + "dev": true, + "license": "MIT", + "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": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/browser-process-hrtime": { + "version": "1.0.0", + "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-sign/node_modules/string_decoder": { + "version": "1.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/browserify-zlib": { + "version": "0.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "pako": "~1.0.5" + } + }, + "node_modules/browserslist": { + "version": "4.20.2", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + } + ], + "license": "MIT", + "dependencies": { + "caniuse-lite": "^1.0.30001317", + "electron-to-chromium": "^1.4.84", + "escalade": "^3.1.1", + "node-releases": "^2.0.2", + "picocolors": "^1.0.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "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", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "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/buffer/node_modules/isarray": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/bufferstreams": { + "version": "1.0.1", + "dev": true, + "dependencies": { + "readable-stream": "^1.0.33" + }, + "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/rimraf": { + "version": "2.7.1", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.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.30001320", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + } + ], + "license": "CC-BY-4.0" + }, + "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": "4.1.2", + "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/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/anymatch": { + "version": "2.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + } + }, + "node_modules/chokidar/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/chokidar/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/chokidar/node_modules/braces/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/chokidar/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/chokidar/node_modules/fill-range/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/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/chokidar/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/chokidar/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/chokidar/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/chokidar/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/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/class-utils/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/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", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/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/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "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-deep/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/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/cloneable-readable/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/cloneable-readable/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/cloneable-readable/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "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": "4.2.3", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1", + "color-string": "^1.9.0" + }, + "engines": { + "node": ">=12.5.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "license": "MIT" + }, + "node_modules/color-string": { + "version": "1.9.1", + "license": "MIT", + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "node_modules/color-support": { + "version": "1.1.3", + "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.20.3", + "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/concat-map": { + "version": "0.0.1", + "license": "MIT" + }, + "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/concat-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/concat-stream/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/concat-stream/node_modules/string_decoder": { + "version": "1.3.0", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "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/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.2", + "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/rimraf": { + "version": "2.7.1", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.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/core-js": { + "version": "3.21.1", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-js-compat": { + "version": "3.21.1", + "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.21.1", + "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.5", + "license": "MIT", + "dependencies": { + "node-fetch": "2.6.7" + } + }, + "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/json5": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/css-loader/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/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/cssesc": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/cssom": { + "version": "0.4.4", + "license": "MIT" + }, + "node_modules/cssstyle": { + "version": "2.3.0", + "license": "MIT", + "dependencies": { + "cssom": "~0.3.6" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cssstyle/node_modules/cssom": { + "version": "0.3.8", + "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", + "license": "MIT", + "dependencies": { + "abab": "^2.0.3", + "whatwg-mimetype": "^2.3.0", + "whatwg-url": "^8.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/data-urls/node_modules/tr46": { + "version": "2.1.0", + "license": "MIT", + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/data-urls/node_modules/webidl-conversions": { + "version": "6.1.0", + "license": "BSD-2-Clause", + "engines": { + "node": ">=10.4" + } + }, + "node_modules/data-urls/node_modules/whatwg-url": { + "version": "8.7.0", + "license": "MIT", + "dependencies": { + "lodash": "^4.7.0", + "tr46": "^2.1.0", + "webidl-conversions": "^6.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/date-and-time": { + "version": "0.6.3", + "license": "MIT" + }, + "node_modules/date-format": { + "version": "4.0.14", + "license": "MIT", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/dateformat": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decimal.js": { + "version": "10.3.1", + "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", + "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": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/define-property/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/define-property/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/define-property/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/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/del/node_modules/pify": { + "version": "2.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/del/node_modules/rimraf": { + "version": "2.7.1", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "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": "2.0.1", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "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.1045489", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1045489.tgz", + "integrity": "sha512-D+PTmWulkuQW4D1NTiCRCFxF7pQPn0hgp4YyX4wAQ6xYXKOadSWPR3ENGDQ47MW/Ewc9v2rpC/UEEGahgBYpSQ==" + }, + "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", + "license": "MIT", + "dependencies": { + "webidl-conversions": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/domexception/node_modules/webidl-conversions": { + "version": "5.0.0", + "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/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/duplexify/node_modules/isarray": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/duplexify/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/duplexify/node_modules/string_decoder": { + "version": "1.1.1", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.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/each-props/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/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.96", + "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", + "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/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "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/enhanced-resolve/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/enhanced-resolve/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "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/error-ex/node_modules/is-arrayish": { + "version": "0.2.1", + "dev": true, + "license": "MIT" + }, + "node_modules/errs": { + "version": "0.3.2", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/es-abstract": { + "version": "1.19.2", + "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.3", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.1", + "is-string": "^1.0.7", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.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.59", + "dev": true, + "hasInstallScript": true, + "license": "ISC", + "dependencies": { + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.3", + "next-tick": "^1.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "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", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "license": "MIT" + }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/escodegen": { + "version": "2.0.0", + "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", + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/escodegen/node_modules/levn": { + "version": "0.3.0", + "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", + "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", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/escodegen/node_modules/source-map": { + "version": "0.6.1", + "license": "BSD-3-Clause", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/escodegen/node_modules/type-check": { + "version": "0.3.2", + "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-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/debug": { + "version": "4.3.4", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "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.13.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/js-yaml": { + "version": "3.14.1", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "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/ms": { + "version": "2.1.2", + "dev": true, + "license": "MIT" + }, + "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/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/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/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", + "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/define-property": { + "version": "0.2.5", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/expand-brackets/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/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/express": { + "version": "4.17.3", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.19.2", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.4.2", + "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.7", + "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/depd": { + "version": "1.1.2", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "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.6.0", + "dev": true, + "license": "ISC" + }, + "node_modules/extend": { + "version": "3.0.2", + "license": "MIT" + }, + "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/extend-shallow/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/extend-shallow/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/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/extend-shallow": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extendable": "^0.1.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", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "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/extract-zip/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/extract-zip/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/extsprintf": { + "version": "1.4.1", + "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", + "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", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "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/json5": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/file-loader/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/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/filed-mimefix": { + "version": "0.1.3", + "license": "ASL 2.0", + "dependencies": { + "mime": "^1.4.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/filelist": { + "version": "1.0.2", + "license": "Apache-2.0", + "dependencies": { + "minimatch": "^3.0.4" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "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/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-cache-dir/node_modules/find-up": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/find-cache-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/find-cache-dir/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/find-cache-dir/node_modules/p-locate": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/find-cache-dir/node_modules/path-exists": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/find-cache-dir/node_modules/pkg-dir": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/find-cache-dir/node_modules/semver": { + "version": "5.7.1", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "dev": true, + "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/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/findup-sync/node_modules/braces/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/findup-sync/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/findup-sync/node_modules/fill-range/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/findup-sync/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/findup-sync/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/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/findup-sync/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/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/fined/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/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/flatted": { + "version": "3.2.7", + "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/flush-write-stream/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/flush-write-stream/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/flush-write-stream/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "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": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "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.2", + "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/from2/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/from2/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/from2/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.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-minipass": { + "version": "2.1.0", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "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-mkdirp-stream/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/fs-mkdirp-stream/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/fs-mkdirp-stream/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/fs-mkdirp-stream/node_modules/through2": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "node_modules/fs-mkdirp-stream/node_modules/xtend": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "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/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/rimraf": { + "version": "2.7.1", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.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", + "dev": true, + "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/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/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/gcs-resumable-upload/node_modules/abort-controller": { + "version": "2.0.3", + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "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": "2.0.5", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "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-stream/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/glob-stream/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/glob-stream/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.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/glob-watcher/node_modules/anymatch": { + "version": "2.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + } + }, + "node_modules/glob-watcher/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/glob-watcher/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/glob-watcher/node_modules/braces/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/glob-watcher/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/glob-watcher/node_modules/fill-range/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/glob-watcher/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/glob-watcher/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/glob-watcher/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/glob-watcher/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/global-dirs": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "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", + "dev": true, + "license": "ISC", + "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/globby/node_modules/pify": { + "version": "2.3.0", + "dev": true, + "license": "MIT", + "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/globule/node_modules/minimatch": { + "version": "3.0.8", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/glogg": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "sparkles": "^1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/gm": { + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/gm/-/gm-1.25.0.tgz", + "integrity": "sha512-4kKdWXTtgQ4biIo7hZA396HT062nDVVHPjQcurNZ3o/voYN+o5FUC5kOwuORbpExp3XbTJ3SU7iRipiIhQtovw==", + "dependencies": { + "array-parallel": "~0.1.3", + "array-series": "~0.1.5", + "cross-spawn": "^4.0.0", + "debug": "^3.1.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/gm/node_modules/cross-spawn": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", + "integrity": "sha512-yAXz/pA1tD8Gtg2S98Ekf/sewp3Lcp3YoFKJ4Hkp5h5yLWnKVTDU0kwjKJ8NDCYcfTLfyGkzTikst+jWypT1iA==", + "dependencies": { + "lru-cache": "^4.0.1", + "which": "^1.2.9" + } + }, + "node_modules/gm/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/gm/node_modules/lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dependencies": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "node_modules/gm/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/gm/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/gm/node_modules/yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==" + }, + "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/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/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/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/mime": { + "version": "2.6.0", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "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-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-concat/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/gulp-concat/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/gulp-concat/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/gulp-concat/node_modules/through2": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "node_modules/gulp-concat/node_modules/xtend": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/gulp-env": { + "version": "0.4.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ini": "^1.3.4", + "through2": "^2.0.0" + } + }, + "node_modules/gulp-env/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/gulp-env/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/gulp-env/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/gulp-env/node_modules/through2": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "node_modules/gulp-env/node_modules/xtend": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "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/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/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/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/gulp-install/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/gulp-install/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/gulp-install/node_modules/through2": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "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-install/node_modules/xtend": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "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-nodemon/node_modules/binary-extensions": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/gulp-nodemon/node_modules/chokidar": { + "version": "3.5.3", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT", + "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/gulp-nodemon/node_modules/debug": { + "version": "3.2.7", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/gulp-nodemon/node_modules/has-flag": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/gulp-nodemon/node_modules/is-binary-path": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/gulp-nodemon/node_modules/ms": { + "version": "2.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/gulp-nodemon/node_modules/nodemon": { + "version": "2.0.15", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "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/gulp-nodemon/node_modules/readdirp": { + "version": "3.6.0", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/gulp-nodemon/node_modules/semver": { + "version": "5.7.1", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/gulp-nodemon/node_modules/supports-color": { + "version": "5.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "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-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/escape-string-regexp": { + "version": "1.0.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/gulp-util/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/gulp-util/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/gulp-util/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/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/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/gulp-util/node_modules/replace-ext": { + "version": "0.0.1", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gulp-util/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.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/through2": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "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-util/node_modules/xtend": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "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/js-yaml": { + "version": "3.14.1", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "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/gulp-yaml/node_modules/bufferstreams": { + "version": "1.1.0", + "dev": true, + "dependencies": { + "readable-stream": "^2.0.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/gulp-yaml/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/gulp-yaml/node_modules/js-yaml": { + "version": "3.14.1", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/gulp-yaml/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/gulp-yaml/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/gulp-yaml/node_modules/through2": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "node_modules/gulp-yaml/node_modules/xtend": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/gulp/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/node_modules/camelcase": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gulp/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/gulp/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/gulp/node_modules/get-caller-file": { + "version": "1.0.3", + "dev": true, + "license": "ISC" + }, + "node_modules/gulp/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/node_modules/invert-kv": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gulp/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/gulp/node_modules/lcid": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "invert-kv": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gulp/node_modules/os-locale": { + "version": "1.4.0", + "dev": true, + "license": "MIT", + "dependencies": { + "lcid": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gulp/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/gulp/node_modules/require-main-filename": { + "version": "1.0.1", + "dev": true, + "license": "ISC" + }, + "node_modules/gulp/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/gulp/node_modules/which-module": { + "version": "1.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/gulp/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/gulp/node_modules/y18n": { + "version": "3.2.2", + "dev": true, + "license": "ISC" + }, + "node_modules/gulp/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/gulp/node_modules/yargs-parser": { + "version": "5.0.1", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^3.0.0", + "object.assign": "^4.1.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-bigints": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "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.3", + "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/is-number": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-values/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/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", + "dev": true, + "license": "MIT", + "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-base/node_modules/string_decoder": { + "version": "1.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "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/hpack.js/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/hpack.js/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/hpack.js/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.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", + "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-loader-jest/node_modules/json5": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/html-loader-jest/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/html-loader/node_modules/json5": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/html-loader/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/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-minifier/node_modules/commander": { + "version": "2.17.1", + "dev": true, + "license": "MIT" + }, + "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/html-webpack-plugin/node_modules/json5": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/html-webpack-plugin/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/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/htmlparser2/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/htmlparser2/node_modules/string_decoder": { + "version": "1.3.0", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "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.6", + "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", + "license": "MIT", + "dependencies": { + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/http-proxy-agent/node_modules/agent-base": { + "version": "6.0.2", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/http-proxy-agent/node_modules/debug": { + "version": "4.3.4", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/http-proxy-agent/node_modules/ms": { + "version": "2.1.2", + "license": "MIT" + }, + "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/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/http-proxy-middleware/node_modules/braces/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/http-proxy-middleware/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/http-proxy-middleware/node_modules/fill-range/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/http-proxy-middleware/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/http-proxy-middleware/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/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-proxy-middleware/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/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": "2.2.4", + "license": "MIT", + "dependencies": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + }, + "engines": { + "node": ">= 4.5.0" + } + }, + "node_modules/https-proxy-agent/node_modules/debug": { + "version": "3.2.7", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/https-proxy-agent/node_modules/ms": { + "version": "2.1.3", + "license": "MIT" + }, + "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/immediate": { + "version": "3.0.6", + "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", + "dev": true, + "license": "MIT", + "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/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.2", + "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": "3.0.1", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sindresorhus/invert-kv?sponsor=1" + } + }, + "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.3.2", + "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", + "dev": true, + "license": "MIT", + "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", + "dev": true, + "license": "MIT", + "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", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.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-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": "5.0.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "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", + "dev": true, + "license": "MIT" + }, + "node_modules/isarray": { + "version": "0.0.1", + "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-instrument/node_modules/semver": { + "version": "6.3.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "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/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/semver": { + "version": "6.3.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "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/debug": { + "version": "4.3.4", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/istanbul-lib-source-maps/node_modules/ms": { + "version": "2.1.2", + "dev": true, + "license": "MIT" + }, + "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.4", + "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.4", + "license": "Apache-2.0", + "dependencies": { + "async": "0.9.x", + "chalk": "^4.0.2", + "filelist": "^1.0.1", + "minimatch": "^3.0.4" + }, + "bin": { + "jake": "bin/cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jake/node_modules/async": { + "version": "0.9.2", + "license": "MIT" + }, + "node_modules/jasmine": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-4.5.0.tgz", + "integrity": "sha512-9olGRvNZyADIwYL9XBNBst5BTU/YaePzuddK+YRslc7rI9MdTIE4r3xaBKbv2GEmzYYUfMOdTR8/i6JfLZaxSQ==", + "dev": true, + "dependencies": { + "glob": "^7.1.6", + "jasmine-core": "^4.5.0" + }, + "bin": { + "jasmine": "bin/jasmine.js" + } + }, + "node_modules/jasmine-core": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-4.5.0.tgz", + "integrity": "sha512-9PMzyvhtocxb3aXJVOPqBDswdgyAeSB81QnLop4npOpbqnheaTEwPc9ZloQeVswugPManznQBjD8kWDTjlnHuw==", + "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-reporters/node_modules/mkdirp": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "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-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-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-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-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-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-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.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/jest-junit/node_modules/ansi-styles": { + "version": "3.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/jest-junit/node_modules/chalk": { + "version": "2.4.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/jest-junit/node_modules/color-convert": { + "version": "1.9.3", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/jest-junit/node_modules/color-name": { + "version": "1.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-junit/node_modules/escape-string-regexp": { + "version": "1.0.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/jest-junit/node_modules/has-flag": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "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/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.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/jest-junit/node_modules/supports-color": { + "version": "5.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "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-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-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/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/jest-resolve/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/jest-resolve/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/jest-resolve/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/jest-resolve/node_modules/type-fest": { + "version": "0.8.1", + "dev": true, + "license": "(MIT OR CC0-1.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-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/strip-bom": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "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/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/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-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/camelcase": { + "version": "6.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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-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/merge-stream": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/jest/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/jmespath": { + "version": "0.16.0", + "license": "Apache-2.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": "4.1.0", + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/js-yaml/node_modules/argparse": { + "version": "2.0.1", + "license": "Python-2.0" + }, + "node_modules/js2xmlparser": { + "version": "3.0.0", + "license": "Apache-2.0", + "dependencies": { + "xmlcreate": "^1.0.1" + } + }, + "node_modules/jsbarcode": { + "version": "3.11.5", + "resolved": "https://registry.npmjs.org/jsbarcode/-/jsbarcode-3.11.5.tgz", + "integrity": "sha512-zv3KsH51zD00I/LrFzFSM6dst7rDn0vIMzaiZFL7qusTjPZiPtxg3zxetp0RR7obmjTw4f6NyGgbdkBCgZUIrA==", + "bin": { + "auto.js": "bin/barcodes/CODE128/auto.js", + "Barcode.js": "bin/barcodes/Barcode.js", + "barcodes": "bin/barcodes", + "canvas.js": "bin/renderers/canvas.js", + "checksums.js": "bin/barcodes/MSI/checksums.js", + "codabar": "bin/barcodes/codabar", + "CODE128": "bin/barcodes/CODE128", + "CODE128_AUTO.js": "bin/barcodes/CODE128/CODE128_AUTO.js", + "CODE128.js": "bin/barcodes/CODE128/CODE128.js", + "CODE128A.js": "bin/barcodes/CODE128/CODE128A.js", + "CODE128B.js": "bin/barcodes/CODE128/CODE128B.js", + "CODE128C.js": "bin/barcodes/CODE128/CODE128C.js", + "CODE39": "bin/barcodes/CODE39", + "constants.js": "bin/barcodes/ITF/constants.js", + "defaults.js": "bin/options/defaults.js", + "EAN_UPC": "bin/barcodes/EAN_UPC", + "EAN.js": "bin/barcodes/EAN_UPC/EAN.js", + "EAN13.js": "bin/barcodes/EAN_UPC/EAN13.js", + "EAN2.js": "bin/barcodes/EAN_UPC/EAN2.js", + "EAN5.js": "bin/barcodes/EAN_UPC/EAN5.js", + "EAN8.js": "bin/barcodes/EAN_UPC/EAN8.js", + "encoder.js": "bin/barcodes/EAN_UPC/encoder.js", + "ErrorHandler.js": "bin/exceptions/ErrorHandler.js", + "exceptions": "bin/exceptions", + "exceptions.js": "bin/exceptions/exceptions.js", + "fixOptions.js": "bin/help/fixOptions.js", + "GenericBarcode": "bin/barcodes/GenericBarcode", + "getOptionsFromElement.js": "bin/help/getOptionsFromElement.js", + "getRenderProperties.js": "bin/help/getRenderProperties.js", + "help": "bin/help", + "index.js": "bin/renderers/index.js", + "index.tmp.js": "bin/barcodes/index.tmp.js", + "ITF": "bin/barcodes/ITF", + "ITF.js": "bin/barcodes/ITF/ITF.js", + "ITF14.js": "bin/barcodes/ITF/ITF14.js", + "JsBarcode.js": "bin/JsBarcode.js", + "linearizeEncodings.js": "bin/help/linearizeEncodings.js", + "merge.js": "bin/help/merge.js", + "MSI": "bin/barcodes/MSI", + "MSI.js": "bin/barcodes/MSI/MSI.js", + "MSI10.js": "bin/barcodes/MSI/MSI10.js", + "MSI1010.js": "bin/barcodes/MSI/MSI1010.js", + "MSI11.js": "bin/barcodes/MSI/MSI11.js", + "MSI1110.js": "bin/barcodes/MSI/MSI1110.js", + "object.js": "bin/renderers/object.js", + "options": "bin/options", + "optionsFromStrings.js": "bin/help/optionsFromStrings.js", + "pharmacode": "bin/barcodes/pharmacode", + "renderers": "bin/renderers", + "shared.js": "bin/renderers/shared.js", + "svg.js": "bin/renderers/svg.js", + "UPC.js": "bin/barcodes/EAN_UPC/UPC.js", + "UPCE.js": "bin/barcodes/EAN_UPC/UPCE.js" + } + }, + "node_modules/jsbn": { + "version": "0.1.1", + "license": "MIT" + }, + "node_modules/jsdom": { + "version": "16.7.0", + "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", + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/jsdom/node_modules/agent-base": { + "version": "6.0.2", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/jsdom/node_modules/debug": { + "version": "4.3.4", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/form-data": { + "version": "3.0.1", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jsdom/node_modules/https-proxy-agent": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jsdom/node_modules/ms": { + "version": "2.1.2", + "license": "MIT" + }, + "node_modules/jsdom/node_modules/tough-cookie": { + "version": "4.0.0", + "license": "BSD-3-Clause", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.1.2" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsdom/node_modules/tr46": { + "version": "2.1.0", + "license": "MIT", + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jsdom/node_modules/webidl-conversions": { + "version": "6.1.0", + "license": "BSD-2-Clause", + "engines": { + "node": ">=10.4" + } + }, + "node_modules/jsdom/node_modules/whatwg-url": { + "version": "8.7.0", + "license": "MIT", + "dependencies": { + "lodash": "^4.7.0", + "tr46": "^2.1.0", + "webidl-conversions": "^6.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "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/json5": { + "version": "2.2.1", + "dev": true, + "license": "MIT", + "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/extsprintf": { + "version": "1.3.0", + "engines": [ + "node >=0.6.0" + ], + "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/jszip": { + "version": "3.10.0", + "license": "(MIT OR GPL-3.0-or-later)", + "dependencies": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, + "node_modules/jszip/node_modules/isarray": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/jszip/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/jszip/node_modules/string_decoder": { + "version": "1.1.1", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.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.1.1", + "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", + "dev": true, + "license": "MIT", + "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/lazystream/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/lazystream/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/lazystream/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/lcid": { + "version": "3.1.1", + "license": "MIT", + "dependencies": { + "invert-kv": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "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.2", + "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/lie": { + "version": "3.3.0", + "license": "MIT", + "dependencies": { + "immediate": "~3.0.5" + } + }, + "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/liftoff/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/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/pify": { + "version": "2.3.0", + "dev": true, + "license": "MIT", + "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": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + }, + "engines": { + "node": ">=8.9.0" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "dev": true, + "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.truncate": { + "version": "4.4.2", + "dev": true, + "license": "MIT" + }, + "node_modules/log4js": { + "version": "6.7.0", + "license": "Apache-2.0", + "dependencies": { + "date-format": "^4.0.14", + "debug": "^4.3.4", + "flatted": "^3.2.7", + "rfdc": "^1.3.0", + "streamroller": "^3.1.3" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/log4js/node_modules/debug": { + "version": "4.3.4", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/log4js/node_modules/ms": { + "version": "2.1.2", + "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/debug": { + "version": "4.3.4", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/loopback-boot/node_modules/ms": { + "version": "2.1.2", + "license": "MIT" + }, + "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-explorer/node_modules/ms": { + "version": "2.1.3", + "license": "MIT" + }, + "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-component-storage/node_modules/ms": { + "version": "2.1.3", + "license": "MIT" + }, + "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/ms": { + "version": "2.1.3", + "license": "MIT" + }, + "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.4", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/loopback-connector-mysql/node_modules/strong-globalize/node_modules/ms": { + "version": "2.1.2", + "license": "MIT" + }, + "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/debug": { + "version": "4.3.4", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/loopback-connector/node_modules/ms": { + "version": "2.1.2", + "license": "MIT" + }, + "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-datasource-juggler/node_modules/ms": { + "version": "2.1.3", + "license": "MIT" + }, + "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-filters/node_modules/ms": { + "version": "2.1.3", + "license": "MIT" + }, + "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-phase/node_modules/ms": { + "version": "2.1.3", + "license": "MIT" + }, + "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-swagger/node_modules/ms": { + "version": "2.1.3", + "license": "MIT" + }, + "node_modules/loopback/node_modules/depd": { + "version": "1.1.2", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "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": "1.3.0", + "license": "MIT", + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/make-dir/node_modules/pify": { + "version": "3.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "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/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/matchdep/node_modules/braces/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/matchdep/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/matchdep/node_modules/fill-range/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/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-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/is-number": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/matchdep/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/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/matchdep/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/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": "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/memory-fs": { + "version": "0.4.1", + "dev": true, + "license": "MIT", + "dependencies": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "node_modules/memory-fs/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/memory-fs/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/memory-fs/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "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/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/merge-stream/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/merge-stream/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/merge-stream/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "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.5", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "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": "1.6.0", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.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.1.2", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.6", + "license": "MIT" + }, + "node_modules/minipass": { + "version": "3.3.4", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass/node_modules/yallist": { + "version": "4.0.0", + "license": "ISC" + }, + "node_modules/minizlib": { + "version": "2.1.2", + "license": "MIT", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minizlib/node_modules/yallist": { + "version": "4.0.0", + "license": "ISC" + }, + "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/mississippi/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/mississippi/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/mississippi/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/mississippi/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/mississippi/node_modules/through2": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "node_modules/mississippi/node_modules/xtend": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "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/mixin-deep/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/mkdirp": { + "version": "0.5.6", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "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/rimraf": { + "version": "2.7.1", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "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/msgpack5/node_modules/isarray": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/msgpack5/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/msgpack5/node_modules/string_decoder": { + "version": "1.1.1", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "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/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/mysql/node_modules/bignumber.js": { + "version": "9.0.0", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/mysql/node_modules/isarray": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/mysql/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/mysql/node_modules/string_decoder": { + "version": "1.1.1", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "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/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.3", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "dev": true, + "license": "MIT" + }, + "node_modules/next-tick": { + "version": "1.1.0", + "dev": true, + "license": "ISC" + }, + "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": "3.28.0", + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-abi/node_modules/lru-cache": { + "version": "6.0.0", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-abi/node_modules/semver": { + "version": "7.3.8", + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-abi/node_modules/yallist": { + "version": "4.0.0", + "license": "ISC" + }, + "node_modules/node-addon-api": { + "version": "5.0.0", + "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.7", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "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/nopt": { + "version": "3.0.6", + "dev": true, + "license": "ISC", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, + "node_modules/node-gyp/node_modules/rimraf": { + "version": "2.7.1", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "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/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/node-libs-browser/node_modules/punycode": { + "version": "1.4.1", + "dev": true, + "license": "MIT" + }, + "node_modules/node-libs-browser/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/node-libs-browser/node_modules/readable-stream/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/node-libs-browser/node_modules/string_decoder": { + "version": "1.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/node-libs-browser/node_modules/string_decoder/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/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.2", + "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-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/escape-string-regexp": { + "version": "1.0.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "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/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-ssh/node_modules/semver": { + "version": "6.3.0", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "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.3", + "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.19", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "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", + "simple-update-notifier": "^1.0.7", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/binary-extensions": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/nodemon/node_modules/chokidar": { + "version": "3.5.3", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT", + "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/has-flag": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/nodemon/node_modules/is-binary-path": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nodemon/node_modules/ms": { + "version": "2.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon/node_modules/readdirp": { + "version": "3.6.0", + "dev": true, + "license": "MIT", + "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/supports-color": { + "version": "5.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/nopt": { + "version": "1.0.10", + "dev": true, + "license": "MIT", + "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-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", + "dev": true, + "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/number-is-nan": { + "version": "1.0.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nwsapi": { + "version": "2.2.0", + "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/define-property": { + "version": "0.2.5", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^0.1.0" + }, + "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/ordered-read-streams/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/ordered-read-streams/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/ordered-read-streams/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "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": "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/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", + "dev": true, + "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", + "dev": true, + "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", + "dev": true, + "license": "MIT", + "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", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/package-json/node_modules/@szmarczak/http-timer": { + "version": "1.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "defer-to-connect": "^1.0.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/package-json/node_modules/cacheable-request": { + "version": "6.1.0", + "dev": true, + "license": "MIT", + "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/cacheable-request/node_modules/get-stream": { + "version": "5.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/package-json/node_modules/cacheable-request/node_modules/lowercase-keys": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/package-json/node_modules/decompress-response": { + "version": "3.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-response": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/package-json/node_modules/defer-to-connect": { + "version": "1.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/package-json/node_modules/get-stream": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/package-json/node_modules/got": { + "version": "9.6.0", + "dev": true, + "license": "MIT", + "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/json-buffer": { + "version": "3.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/package-json/node_modules/keyv": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.0" + } + }, + "node_modules/package-json/node_modules/lowercase-keys": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/package-json/node_modules/mimic-response": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/package-json/node_modules/normalize-url": { + "version": "4.5.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/package-json/node_modules/p-cancelable": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/package-json/node_modules/responselike": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "lowercase-keys": "^1.0.0" + } + }, + "node_modules/package-json/node_modules/semver": { + "version": "6.3.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/package-json/node_modules/to-readable-stream": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/pako": { + "version": "1.0.11", + "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/parallel-transform/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/parallel-transform/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/parallel-transform/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "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": "2.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "error-ex": "^1.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "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", + "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", + "dev": true, + "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/path-type/node_modules/pify": { + "version": "2.3.0", + "dev": true, + "license": "MIT", + "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", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==" + }, + "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": "4.0.1", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "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.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "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/mime": { + "version": "2.6.0", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "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/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/ms": { + "version": "2.1.3", + "dev": true, + "license": "MIT" + }, + "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.9", + "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": "7.1.1", + "license": "MIT", + "dependencies": { + "detect-libc": "^2.0.0", + "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": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "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", + "dev": true, + "license": "MIT", + "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-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "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", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "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", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-goat": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/puppeteer": { + "version": "18.2.1", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-18.2.1.tgz", + "integrity": "sha512-7+UhmYa7wxPh2oMRwA++k8UGVDxh3YdWFB52r9C3tM81T6BU7cuusUSxImz0GEYSOYUKk/YzIhkQ6+vc0gHbxQ==", + "hasInstallScript": true, + "dependencies": { + "https-proxy-agent": "5.0.1", + "progress": "2.0.3", + "proxy-from-env": "1.1.0", + "puppeteer-core": "18.2.1" + }, + "engines": { + "node": ">=14.1.0" + } + }, + "node_modules/puppeteer-cluster": { + "version": "0.23.0", + "license": "MIT", + "dependencies": { + "debug": "^4.3.3" + }, + "peerDependencies": { + "puppeteer": ">=1.5.0" + } + }, + "node_modules/puppeteer-cluster/node_modules/debug": { + "version": "4.3.4", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/puppeteer-cluster/node_modules/ms": { + "version": "2.1.2", + "license": "MIT" + }, + "node_modules/puppeteer-core": { + "version": "18.2.1", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-18.2.1.tgz", + "integrity": "sha512-MRtTAZfQTluz3U2oU/X2VqVWPcR1+94nbA2V6ZrSZRVEwLqZ8eclZ551qGFQD/vD2PYqHJwWOW/fpC721uznVw==", + "dependencies": { + "cross-fetch": "3.1.5", + "debug": "4.3.4", + "devtools-protocol": "0.0.1045489", + "extract-zip": "2.0.1", + "https-proxy-agent": "5.0.1", + "proxy-from-env": "1.1.0", + "rimraf": "3.0.2", + "tar-fs": "2.1.1", + "unbzip2-stream": "1.4.3", + "ws": "8.9.0" + }, + "engines": { + "node": ">=14.1.0" + } + }, + "node_modules/puppeteer-core/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/puppeteer-core/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/puppeteer-core/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/puppeteer-core/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/puppeteer-core/node_modules/ws": { + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.9.0.tgz", + "integrity": "sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/puppeteer/node_modules/agent-base": { + "version": "6.0.2", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/puppeteer/node_modules/debug": { + "version": "4.3.4", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/puppeteer/node_modules/https-proxy-agent": { + "version": "5.0.1", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/puppeteer/node_modules/ms": { + "version": "2.1.2", + "license": "MIT" + }, + "node_modules/qs": { + "version": "6.9.7", + "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.3", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "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.2", + "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/json5": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/raw-loader/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/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/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-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/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/read-pkg-up/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/read-pkg-up/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/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/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/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/readdirp/node_modules/braces/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/readdirp/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/readdirp/node_modules/fill-range/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/readdirp/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/readdirp/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/readdirp/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "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/readdirp/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/readdirp/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/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": "10.0.1", + "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/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": "5.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^10.0.1", + "regjsgen": "^0.6.0", + "regjsparser": "^0.8.2", + "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", + "dev": true, + "license": "MIT", + "dependencies": { + "rc": "^1.2.8" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/registry-url": { + "version": "5.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "rc": "^1.2.8" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/regjsgen": { + "version": "0.6.0", + "dev": true, + "license": "MIT" + }, + "node_modules/regjsparser": { + "version": "0.8.4", + "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-bom-stream/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/remove-bom-stream/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/remove-bom-stream/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/remove-bom-stream/node_modules/through2": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "node_modules/remove-bom-stream/node_modules/xtend": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "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/css-select": { + "version": "4.3.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.0.1", + "domhandler": "^4.3.1", + "domutils": "^2.8.0", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/renderkid/node_modules/css-what": { + "version": "6.0.1", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "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.1", + "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/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/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": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "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", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "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/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": "2.0.0", + "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.22.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.8.1", + "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/retry-request/node_modules/debug": { + "version": "4.3.4", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/retry-request/node_modules/ms": { + "version": "2.1.2", + "license": "MIT" + }, + "node_modules/rfdc": { + "version": "1.3.0", + "license": "MIT" + }, + "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/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/anymatch": { + "version": "2.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + } + }, + "node_modules/sane/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/sane/node_modules/braces/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/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/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/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/sane/node_modules/fill-range/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/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-number": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/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/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/normalize-path": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "remove-trailing-separator": "^1.0.1" + }, + "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/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/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.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/sass-graph/node_modules/ansi-styles": { + "version": "3.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "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/color-convert": { + "version": "1.9.3", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/sass-graph/node_modules/color-name": { + "version": "1.1.3", + "dev": true, + "license": "MIT" + }, + "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/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/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/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/json5": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/sass-loader/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/sass-loader/node_modules/semver": { + "version": "6.3.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/sax": { + "version": "1.2.4", + "license": "ISC" + }, + "node_modules/saxes": { + "version": "5.0.1", + "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": "5.3.0", + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/semver-diff": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/semver-diff/node_modules/semver": { + "version": "6.3.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "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/depd": { + "version": "1.1.2", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "license": "MIT" + }, + "node_modules/seq-queue": { + "version": "0.0.5", + "dev": true + }, + "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/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/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/set-value/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/set-value/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/setimmediate": { + "version": "1.0.5", + "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.31.3", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.31.3.tgz", + "integrity": "sha512-XcR4+FCLBFKw1bdB+GEhnUNXNXvnt0tDo4WsBsraKymuo/IAuPuCBVAL2wIkUw2r/dwFW5Q5+g66Kwl2dgDFVg==", + "hasInstallScript": true, + "dependencies": { + "color": "^4.2.3", + "detect-libc": "^2.0.1", + "node-addon-api": "^5.0.0", + "prebuild-install": "^7.1.1", + "semver": "^7.3.8", + "simple-get": "^4.0.1", + "tar-fs": "^2.1.1", + "tunnel-agent": "^0.6.0" + }, + "engines": { + "node": ">=14.15.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "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.8", + "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.7", + "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.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": { + "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-update-notifier": { + "version": "1.0.7", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "~7.0.0" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/simple-update-notifier/node_modules/semver": { + "version": "7.0.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "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/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/define-property": { + "version": "0.2.5", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon/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/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.6.0", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^3.2.7", + "eventsource": "^1.1.0", + "faye-websocket": "^0.11.4", + "inherits": "^2.0.4", + "url-parse": "^1.5.10" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://tidelift.com/funding/github/npm/sockjs-client" + } + }, + "node_modules/sockjs-client/node_modules/debug": { + "version": "3.2.7", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/sockjs-client/node_modules/ms": { + "version": "2.1.3", + "dev": true, + "license": "MIT" + }, + "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.6", + "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/debug": { + "version": "4.3.4", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/spdy-transport/node_modules/ms": { + "version": "2.1.2", + "dev": true, + "license": "MIT" + }, + "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/spdy-transport/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/spdy-transport/node_modules/string_decoder": { + "version": "1.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/spdy/node_modules/debug": { + "version": "4.3.4", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/spdy/node_modules/ms": { + "version": "2.1.2", + "dev": true, + "license": "MIT" + }, + "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/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/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/static-extend/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/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/stdout-stream/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/stdout-stream/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/stdout-stream/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "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-browserify/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/stream-browserify/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/stream-browserify/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "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-http/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/stream-http/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/stream-http/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/stream-http/node_modules/xtend": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/stream-serializer": { + "version": "1.1.2", + "license": "MIT" + }, + "node_modules/stream-shift": { + "version": "1.0.1", + "license": "MIT" + }, + "node_modules/streamroller": { + "version": "3.1.3", + "license": "MIT", + "dependencies": { + "date-format": "^4.0.14", + "debug": "^4.3.4", + "fs-extra": "^8.1.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/streamroller/node_modules/debug": { + "version": "4.3.4", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/streamroller/node_modules/fs-extra": { + "version": "8.1.0", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/streamroller/node_modules/ms": { + "version": "2.1.2", + "license": "MIT" + }, + "node_modules/streamsearch": { + "version": "0.1.2", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/string_decoder": { + "version": "0.10.31", + "license": "MIT" + }, + "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-length/node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-length/node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "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.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": "3.0.1", + "license": "MIT", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "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": "2.0.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "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/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/ms": { + "version": "2.1.3", + "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/which": { + "version": "1.3.1", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/strong-error-handler/node_modules/xtend": { + "version": "4.0.2", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "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/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/strong-globalize/node_modules/debug": { + "version": "4.3.4", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/strong-globalize/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/strong-globalize/node_modules/get-stream": { + "version": "4.1.0", + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/strong-globalize/node_modules/invert-kv": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/strong-globalize/node_modules/is-stream": { + "version": "1.1.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strong-globalize/node_modules/lcid": { + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "invert-kv": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/strong-globalize/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/strong-globalize/node_modules/ms": { + "version": "2.1.2", + "license": "MIT" + }, + "node_modules/strong-globalize/node_modules/npm-run-path": { + "version": "2.0.2", + "license": "MIT", + "dependencies": { + "path-key": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/strong-globalize/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/strong-globalize/node_modules/path-key": { + "version": "2.0.1", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/strong-globalize/node_modules/semver": { + "version": "5.7.1", + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/strong-globalize/node_modules/shebang-command": { + "version": "1.2.0", + "license": "MIT", + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strong-globalize/node_modules/shebang-regex": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strong-globalize/node_modules/which": { + "version": "1.3.1", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "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/debug": { + "version": "4.3.4", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "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/mkdirp": { + "version": "1.0.4", + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/strong-remoting/node_modules/ms": { + "version": "2.1.2", + "license": "MIT" + }, + "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.6", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "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/json5": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/style-loader/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/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": "7.2.0", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "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-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.4", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.11.2", + "btoa": "^1.2.1", + "cookie": "~0.4.1", + "cross-fetch": "^3.1.5", + "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/fast-json-patch": { + "version": "3.1.1", + "license": "MIT" + }, + "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", + "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.11.0", + "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/ansi-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "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/table/node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.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/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/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/tar-stream/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/tar-stream/node_modules/string_decoder": { + "version": "1.3.0", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "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/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/serialize-javascript": { + "version": "4.0.0", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "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/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": "3.0.2", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "2 || 3" + } + }, + "node_modules/through2-filter": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "through2": "~2.0.0", + "xtend": "~4.0.0" + } + }, + "node_modules/through2-filter/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/through2-filter/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/through2-filter/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/through2-filter/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/node_modules/xtend": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/through2/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/through2/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/through2/node_modules/string_decoder": { + "version": "1.3.0", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.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": "5.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.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-through/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/to-through/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/to-through/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/to-through/node_modules/through2": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "node_modules/to-through/node_modules/xtend": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "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/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/tr46": { + "version": "0.0.3", + "license": "MIT" + }, + "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", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/unbzip2-stream/node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/unbzip2-stream/node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "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.6", + "license": "MIT", + "dependencies": { + "sprintf-js": "^1.1.1", + "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/unset-value/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/upath": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4", + "yarn": "*" + } + }, + "node_modules/update-notifier": { + "version": "5.1.0", + "dev": true, + "license": "BSD-2-Clause", + "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/configstore": { + "version": "5.0.1", + "dev": true, + "license": "BSD-2-Clause", + "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", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier/node_modules/dot-prop": { + "version": "5.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier/node_modules/is-obj": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier/node_modules/lru-cache": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/update-notifier/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/update-notifier/node_modules/make-dir/node_modules/semver": { + "version": "6.3.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/update-notifier/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/update-notifier/node_modules/unique-string": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "crypto-random-string": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier/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/update-notifier/node_modules/xdg-basedir": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC" + }, + "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.10", + "dev": true, + "license": "MIT", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/url-parse-lax": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "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/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-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-fs/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/vinyl-fs/node_modules/readable-stream": { + "version": "2.3.7", + "dev": true, + "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/vinyl-fs/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/vinyl-fs/node_modules/through2": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "node_modules/vinyl-fs/node_modules/xtend": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "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/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", + "license": "MIT", + "dependencies": { + "browser-process-hrtime": "^1.0.0" + } + }, + "node_modules/w3c-xmlserializer": { + "version": "2.0.0", + "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/binary-extensions": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/watchpack/node_modules/chokidar": { + "version": "3.5.3", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "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/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/readdirp": { + "version": "3.6.0", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.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": "3.0.1", + "license": "BSD-2-Clause" + }, + "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.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-cli/node_modules/ansi-styles": { + "version": "3.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/webpack-cli/node_modules/chalk": { + "version": "2.4.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/webpack-cli/node_modules/chalk/node_modules/supports-color": { + "version": "5.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "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/color-convert": { + "version": "1.9.3", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/webpack-cli/node_modules/color-name": { + "version": "1.1.3", + "dev": true, + "license": "MIT" + }, + "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/escape-string-regexp": { + "version": "1.0.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "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/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/has-flag": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "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/json5": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/webpack-cli/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/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/pkg-dir": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "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/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/mime": { + "version": "2.6.0", + "dev": true, + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "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": "4.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/ansi-styles": { + "version": "3.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "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/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/color-convert": { + "version": "1.9.3", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/webpack-dev-server/node_modules/color-name": { + "version": "1.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/webpack-dev-server/node_modules/debug": { + "version": "4.3.4", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "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/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/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/globby/node_modules/pify": { + "version": "2.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack-dev-server/node_modules/has-flag": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "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/ms": { + "version": "2.1.2", + "dev": true, + "license": "MIT" + }, + "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/pkg-dir": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/punycode": { + "version": "1.3.2", + "dev": true, + "license": "MIT" + }, + "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/rimraf": { + "version": "2.7.1", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "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/semver": { + "version": "6.3.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "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/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/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/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/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/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/webpack/node_modules/braces/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/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/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/webpack/node_modules/fill-range/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/webpack/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/webpack/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/webpack/node_modules/json5": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/webpack/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/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/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/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/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", + "license": "MIT", + "dependencies": { + "iconv-lite": "0.4.24" + } + }, + "node_modules/whatwg-mimetype": { + "version": "2.3.0", + "license": "MIT" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "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": "2.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", + "dev": true, + "license": "MIT", + "dependencies": { + "string-width": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/widest-line/node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/widest-line/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/widest-line/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/widest-line/node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.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/word-count": { + "version": "0.2.2", + "license": "MIT" + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "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": "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/wrap-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/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/wrap-ansi/node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "license": "ISC" + }, + "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/ws": { + "version": "7.5.7", + "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", + "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", + "license": "MIT" + }, + "node_modules/xmlcreate": { + "version": "1.0.2", + "license": "Apache-2.0" + }, + "node_modules/xmldom": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.6.0.tgz", + "integrity": "sha512-iAcin401y58LckRZ0TkI4k0VSM1Qg0KGSc3i8rU+xrxe19A/BN1zHyVSJY7uoutVlaTSzYyk/v5AmkewAP7jtg==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/xtend": { + "version": "1.0.3", + "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/yaml-loader/node_modules/js-yaml": { + "version": "3.14.1", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "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": "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/yargs-parser": { + "version": "18.1.3", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/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/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "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", + "jsbarcode": "^3.11.5", + "jsonexport": "^3.2.0", + "juice": "^5.2.0", + "log4js": "^6.7.0", + "mysql2": "^1.7.0", + "nodemailer": "^4.7.0", + "puppeteer-cluster": "^0.23.0", + "qrcode": "^1.4.2", + "strftime": "^0.10.0", + "vue": "^2.6.10", + "vue-i18n": "^8.15.0", + "vue-server-renderer": "^2.6.10", + "xmldom": "^0.6.0" + } + }, + "print/node_modules/@babel/parser": { + "version": "7.19.3", + "license": "MIT", + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "print/node_modules/@vue/compiler-sfc": { + "version": "2.7.10", + "dependencies": { + "@babel/parser": "^7.18.4", + "postcss": "^8.4.14", + "source-map": "^0.6.1" + } + }, + "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": "5.0.1", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "print/node_modules/ansi-styles": { + "version": "3.2.1", + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "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.4", + "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/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/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": "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/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/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/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/csstype": { + "version": "3.1.1", + "license": "MIT" + }, + "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/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/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/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/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/graceful-fs": { + "version": "4.2.10", + "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-flag": { + "version": "3.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "print/node_modules/hash-sum": { + "version": "2.0.0", + "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/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/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.10.0", + "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/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-db": { + "version": "1.52.0", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "print/node_modules/mime-types": { + "version": "2.1.35", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.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/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/nanoid": { + "version": "3.3.4", + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "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/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-key": { + "version": "2.0.1", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "print/node_modules/path-parse": { + "version": "1.0.7", + "license": "MIT" + }, + "print/node_modules/performance-now": { + "version": "2.1.0", + "license": "MIT" + }, + "print/node_modules/picocolors": { + "version": "1.0.0", + "license": "ISC" + }, + "print/node_modules/pngjs": { + "version": "5.0.0", + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, + "print/node_modules/postcss": { + "version": "8.4.17", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.4", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "print/node_modules/pseudomap": { + "version": "1.0.2", + "license": "ISC" + }, + "print/node_modules/psl": { + "version": "1.9.0", + "license": "MIT" + }, + "print/node_modules/punycode": { + "version": "2.1.1", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "print/node_modules/qrcode": { + "version": "1.5.1", + "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.22.1", + "license": "MIT", + "dependencies": { + "is-core-module": "^2.9.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/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": "6.0.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.6.1", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "print/node_modules/source-map-js": { + "version": "1.0.2", + "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.3", + "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/strip-ansi": { + "version": "6.0.1", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "print/node_modules/supports-color": { + "version": "5.5.0", + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "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/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.7.10", + "license": "MIT", + "dependencies": { + "@vue/compiler-sfc": "2.7.10", + "csstype": "^3.1.0" + } + }, + "print/node_modules/vue-i18n": { + "version": "8.27.2", + "license": "MIT" + }, + "print/node_modules/vue-server-renderer": { + "version": "2.7.10", + "license": "MIT", + "dependencies": { + "chalk": "^4.1.2", + "hash-sum": "^2.0.0", + "he": "^1.2.0", + "lodash.template": "^4.5.0", + "lodash.uniq": "^4.5.0", + "resolve": "^1.22.0", + "serialize-javascript": "^6.0.0", + "source-map": "0.5.6" + } + }, + "print/node_modules/vue-server-renderer/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/vue-server-renderer/node_modules/chalk": { + "version": "4.1.2", + "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" + } + }, + "print/node_modules/vue-server-renderer/node_modules/color-convert": { + "version": "2.0.1", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "print/node_modules/vue-server-renderer/node_modules/color-name": { + "version": "1.1.4", + "license": "MIT" + }, + "print/node_modules/vue-server-renderer/node_modules/has-flag": { + "version": "4.0.0", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "print/node_modules/vue-server-renderer/node_modules/source-map": { + "version": "0.5.6", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "print/node_modules/vue-server-renderer/node_modules/supports-color": { + "version": "7.2.0", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "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/dom-serializer": { + "version": "1.4.1", + "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.1", + "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.3.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.1", + "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/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-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/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" + } + } + }, + "dependencies": { + "@ampproject/remapping": { + "version": "2.1.2", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.0" + } + }, + "@babel/code-frame": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/highlight": "^7.16.7" + } + }, + "@babel/compat-data": { + "version": "7.17.7", + "dev": true + }, + "@babel/core": { + "version": "7.17.8", + "dev": true, + "requires": { + "@ampproject/remapping": "^2.1.0", + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.7", + "@babel/helper-compilation-targets": "^7.17.7", + "@babel/helper-module-transforms": "^7.17.7", + "@babel/helpers": "^7.17.8", + "@babel/parser": "^7.17.8", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.3", + "@babel/types": "^7.17.0", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "dev": true + }, + "semver": { + "version": "6.3.0", + "dev": true + } + } + }, + "@babel/generator": { + "version": "7.17.7", + "dev": true, + "requires": { + "@babel/types": "^7.17.0", + "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.17.7", + "dev": true, + "requires": { + "@babel/compat-data": "^7.17.7", + "@babel/helper-validator-option": "^7.16.7", + "browserslist": "^4.17.5", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "dev": true + } + } + }, + "@babel/helper-create-class-features-plugin": { + "version": "7.17.6", + "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.17.0", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "regexpu-core": "^5.0.1" + } + }, + "@babel/helper-define-polyfill-provider": { + "version": "0.3.1", + "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" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "dev": true + }, + "semver": { + "version": "6.3.0", + "dev": true + } + } + }, + "@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.17.7", + "dev": true, + "requires": { + "@babel/types": "^7.17.0" + } + }, + "@babel/helper-module-imports": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-module-transforms": { + "version": "7.17.7", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-simple-access": "^7.17.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.3", + "@babel/types": "^7.17.0" + } + }, + "@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.17.7", + "dev": true, + "requires": { + "@babel/types": "^7.17.0" + } + }, + "@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.17.8", + "dev": true, + "requires": { + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.3", + "@babel/types": "^7.17.0" + } + }, + "@babel/highlight": { + "version": "7.16.10", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@babel/parser": { + "version": "7.17.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.17.6", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.17.6", + "@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.17.3", + "dev": true, + "requires": { + "@babel/compat-data": "^7.17.0", + "@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.11", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.16.10", + "@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.17.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.17.7", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.17.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-simple-access": "^7.17.7", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-systemjs": { + "version": "7.17.8", + "dev": true, + "requires": { + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-module-transforms": "^7.17.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.11", + "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.11", + "@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" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "dev": true + } + } + }, + "@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.17.7", + "dev": true, + "requires": { + "clone-deep": "^4.0.1", + "find-cache-dir": "^2.0.0", + "make-dir": "^2.1.0", + "pirates": "^4.0.5", + "source-map-support": "^0.5.16" + }, + "dependencies": { + "make-dir": { + "version": "2.1.0", + "dev": true, + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + } + }, + "semver": { + "version": "5.7.1", + "dev": true + } + } + }, + "@babel/runtime": { + "version": "7.17.8", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@babel/runtime-corejs3": { + "version": "7.17.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.17.3", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.3", + "@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.17.3", + "@babel/types": "^7.17.0", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.17.0", + "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": { + "debug": { + "version": "4.3.4", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "globals": { + "version": "13.13.0", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "js-yaml": { + "version": "3.14.1", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "ms": { + "version": "2.1.2", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "dev": true + }, + "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" + } + } + }, + "@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": { + "mime": { + "version": "2.6.0" + } + } + }, + "@humanwhocodes/config-array": { + "version": "0.5.0", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.0", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "dev": true + } + } + }, + "@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" + }, + "dependencies": { + "js-yaml": { + "version": "3.14.1", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.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" + } + }, + "@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-regex": { + "version": "5.0.1", + "dev": true + }, + "strip-ansi": { + "version": "6.0.1", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "@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": { + "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" + } + }, + "semver": { + "version": "6.3.0", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "dev": true + } + } + }, + "@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": { + "source-map": { + "version": "0.6.1", + "dev": true + }, + "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" + } + } + } + }, + "@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" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.0.5", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.11", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.4", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "@mapbox/node-pre-gyp": { + "version": "1.0.10", + "requires": { + "detect-libc": "^2.0.0", + "https-proxy-agent": "^5.0.0", + "make-dir": "^3.1.0", + "node-fetch": "^2.6.7", + "nopt": "^5.0.0", + "npmlog": "^5.0.1", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.11" + }, + "dependencies": { + "agent-base": { + "version": "6.0.2", + "requires": { + "debug": "4" + } + }, + "ansi-regex": { + "version": "5.0.1" + }, + "are-we-there-yet": { + "version": "2.0.0", + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + } + }, + "chownr": { + "version": "2.0.0" + }, + "debug": { + "version": "4.3.4", + "requires": { + "ms": "2.1.2" + } + }, + "gauge": { + "version": "3.0.2", + "requires": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.2", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.1", + "object-assign": "^4.1.1", + "signal-exit": "^3.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.2" + } + }, + "https-proxy-agent": { + "version": "5.0.1", + "requires": { + "agent-base": "6", + "debug": "4" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0" + }, + "lru-cache": { + "version": "6.0.0", + "requires": { + "yallist": "^4.0.0" + } + }, + "make-dir": { + "version": "3.1.0", + "requires": { + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0" + } + } + }, + "mkdirp": { + "version": "1.0.4" + }, + "ms": { + "version": "2.1.2" + }, + "nopt": { + "version": "5.0.0", + "requires": { + "abbrev": "1" + } + }, + "npmlog": { + "version": "5.0.1", + "requires": { + "are-we-there-yet": "^2.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^3.0.0", + "set-blocking": "^2.0.0" + } + }, + "readable-stream": { + "version": "3.6.0", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1" + }, + "semver": { + "version": "7.3.8", + "requires": { + "lru-cache": "^6.0.0" + } + }, + "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" + } + }, + "strip-ansi": { + "version": "6.0.1", + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "tar": { + "version": "6.1.11", + "requires": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^3.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + } + }, + "yallist": { + "version": "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" + }, + "@types/babel__core": { + "version": "7.1.19", + "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.11", + "dev": true + }, + "@types/keyv": { + "version": "3.1.4", + "requires": { + "@types/node": "*" + } + }, + "@types/mime": { + "version": "1.3.2" + }, + "@types/minimatch": { + "version": "3.0.5", + "dev": true + }, + "@types/node": { + "version": "17.0.23" + }, + "@types/normalize-package-data": { + "version": "2.4.1", + "dev": true + }, + "@types/prettier": { + "version": "2.4.4", + "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": { + "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": "21.0.0", + "dev": true + }, + "@types/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==", + "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" + }, + "abbrev": { + "version": "1.1.1" + }, + "abort-controller": { + "version": "3.0.0", + "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.8", + "requires": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + } + }, + "acorn": { + "version": "7.4.1" + }, + "acorn-globals": { + "version": "6.0.0", + "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" + }, + "agent-base": { + "version": "4.3.0", + "requires": { + "es6-promisify": "^5.0.0" + } + }, + "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", + "dev": true, + "requires": { + "string-width": "^4.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.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" + } + }, + "strip-ansi": { + "version": "6.0.1", + "dev": true, + "requires": { + "ansi-regex": "^5.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": "2.1.1" + }, + "ansi-styles": { + "version": "4.3.0", + "requires": { + "color-convert": "^2.0.1" + } + }, + "ansi-wrap": { + "version": "0.1.0", + "dev": true + }, + "anymatch": { + "version": "3.1.2", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "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", + "dev": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "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-parallel": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/array-parallel/-/array-parallel-0.1.3.tgz", + "integrity": "sha512-TDPTwSWW5E4oiFiKmz6RGJ/a80Y91GuLgUYuLd49+XBS75tYo8PNgaT2K/OxuQYqkoI852MDGBorg9OcUSTQ8w==" + }, + "array-series": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/array-series/-/array-series-0.1.5.tgz", + "integrity": "sha512-L0XlBwfx9QetHOsbLDrE/vh2t018w9462HM3iaFfxRiK83aJjAt/Ja3NMkOW7FICwWTlQBa3ZbL5FKhuQWkDrg==" + }, + "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.1102.0", + "requires": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.16.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "uuid": "3.3.2", + "xml2js": "0.4.19" + }, + "dependencies": { + "sax": { + "version": "1.2.1" + }, + "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": "1.2.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.2.tgz", + "integrity": "sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==", + "requires": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "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" + } + }, + "babel-loader": { + "version": "8.2.4", + "dev": true, + "requires": { + "find-cache-dir": "^3.3.1", + "loader-utils": "^2.0.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" + } + }, + "semver": { + "version": "6.3.0", + "dev": true + } + } + }, + "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.1", + "dev": true, + "requires": { + "@babel/compat-data": "^7.13.11", + "@babel/helper-define-polyfill-provider": "^0.3.1", + "semver": "^6.1.1" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "dev": true + } + } + }, + "babel-plugin-polyfill-corejs3": { + "version": "0.5.2", + "dev": true, + "requires": { + "@babel/helper-define-polyfill-provider": "^0.3.1", + "core-js-compat": "^3.21.0" + } + }, + "babel-plugin-polyfill-regenerator": { + "version": "0.3.1", + "dev": true, + "requires": { + "@babel/helper-define-polyfill-provider": "^0.3.1" + } + }, + "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.0.2" + }, + "base64url": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", + "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==" + }, + "batch": { + "version": "0.6.1", + "dev": true + }, + "bcp47": { + "version": "1.1.2" + }, + "bcrypt": { + "version": "5.1.0", + "requires": { + "@mapbox/node-pre-gyp": "^1.0.10", + "node-addon-api": "^5.0.0" + } + }, + "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.2" + }, + "binary-extensions": { + "version": "1.13.1", + "dev": true + }, + "bl": { + "version": "2.2.1", + "requires": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0" + }, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "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.2", + "requires": { + "bytes": "3.1.2", + "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.7", + "raw-body": "2.4.3", + "type-is": "~1.6.18" + }, + "dependencies": { + "bytes": { + "version": "3.1.2" + }, + "depd": { + "version": "1.1.2" + } + } + }, + "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" + } + }, + "bowser": { + "version": "2.9.0" + }, + "boxen": { + "version": "5.1.2", + "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-regex": { + "version": "5.0.1", + "dev": true + }, + "camelcase": { + "version": "6.3.0", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.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" + } + }, + "strip-ansi": { + "version": "6.0.1", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "type-fest": { + "version": "0.20.2", + "dev": true + }, + "wrap-ansi": { + "version": "7.0.0", + "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": "3.0.2", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "brorand": { + "version": "1.1.0", + "dev": true + }, + "browser-process-hrtime": { + "version": "1.0.0" + }, + "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 + }, + "string_decoder": { + "version": "1.3.0", + "dev": true, + "requires": { + "safe-buffer": "~5.2.0" + } + } + } + }, + "browserify-zlib": { + "version": "0.2.0", + "dev": true, + "requires": { + "pako": "~1.0.5" + } + }, + "browserslist": { + "version": "4.20.2", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001317", + "electron-to-chromium": "^1.4.84", + "escalade": "^3.1.1", + "node-releases": "^2.0.2", + "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" + }, + "dependencies": { + "isarray": { + "version": "1.0.0" + } + } + }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==" + }, + "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.0.1", + "dev": true, + "requires": { + "readable-stream": "^1.0.33" + } + }, + "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": { + "rimraf": { + "version": "2.7.1", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "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.30001320", + "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": "4.1.2", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.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": { + "anymatch": { + "version": "2.0.0", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "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" + } + } + } + }, + "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" + } + } + } + }, + "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" + } + }, + "to-regex-range": { + "version": "2.1.1", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "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" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "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", + "dev": true + }, + "cliui": { + "version": "6.0.0", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.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" + } + }, + "strip-ansi": { + "version": "6.0.1", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "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" + }, + "dependencies": { + "is-plain-object": { + "version": "2.0.4", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + } + } + }, + "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" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "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": "4.2.3", + "requires": { + "color-convert": "^2.0.1", + "color-string": "^1.9.0" + } + }, + "color-convert": { + "version": "2.0.1", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4" + }, + "color-string": { + "version": "1.9.1", + "requires": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "color-support": { + "version": "1.1.3" + }, + "colors": { + "version": "1.4.0", + "dev": true + }, + "combined-stream": { + "version": "1.0.8", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.20.3" + }, + "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" + } + }, + "concat-map": { + "version": "0.0.1" + }, + "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" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1" + }, + "string_decoder": { + "version": "1.3.0", + "requires": { + "safe-buffer": "~5.2.0" + } + } + } + }, + "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" + } + }, + "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.2" + }, + "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": { + "rimraf": { + "version": "2.7.1", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "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" + } + }, + "core-js": { + "version": "3.21.1", + "dev": true + }, + "core-js-compat": { + "version": "3.21.1", + "dev": true, + "requires": { + "browserslist": "^4.19.1", + "semver": "7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.0.0", + "dev": true + } + } + }, + "core-js-pure": { + "version": "3.21.1" + }, + "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.5", + "requires": { + "node-fetch": "2.6.7" + } + }, + "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": { + "json5": { + "version": "1.0.1", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + }, + "schema-utils": { + "version": "1.0.0", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + } + } + }, + "cssesc": { + "version": "3.0.0", + "dev": true + }, + "cssom": { + "version": "0.4.4" + }, + "cssstyle": { + "version": "2.3.0", + "requires": { + "cssom": "~0.3.6" + }, + "dependencies": { + "cssom": { + "version": "0.3.8" + } + } + }, + "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", + "requires": { + "abab": "^2.0.3", + "whatwg-mimetype": "^2.3.0", + "whatwg-url": "^8.0.0" + }, + "dependencies": { + "tr46": { + "version": "2.1.0", + "requires": { + "punycode": "^2.1.1" + } + }, + "webidl-conversions": { + "version": "6.1.0" + }, + "whatwg-url": { + "version": "8.7.0", + "requires": { + "lodash": "^4.7.0", + "tr46": "^2.1.0", + "webidl-conversions": "^6.1.0" + } + } + } + }, + "date-and-time": { + "version": "0.6.3" + }, + "date-format": { + "version": "4.0.14" + }, + "dateformat": { + "version": "2.2.0", + "dev": true + }, + "debug": { + "version": "2.6.9", + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "dev": true + }, + "decimal.js": { + "version": "10.3.1" + }, + "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" + }, + "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": "2.0.2", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "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" + } + } + } + }, + "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" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "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": "2.0.1" + }, + "detect-newline": { + "version": "3.1.0", + "dev": true + }, + "detect-node": { + "version": "2.1.0", + "dev": true + }, + "devtools-protocol": { + "version": "0.0.1045489", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1045489.tgz", + "integrity": "sha512-D+PTmWulkuQW4D1NTiCRCFxF7pQPn0hgp4YyX4wAQ6xYXKOadSWPR3ENGDQ47MW/Ewc9v2rpC/UEEGahgBYpSQ==" + }, + "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", + "requires": { + "webidl-conversions": "^5.0.0" + }, + "dependencies": { + "webidl-conversions": { + "version": "5.0.0" + } + } + }, + "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" + } + }, + "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" + }, + "dependencies": { + "isarray": { + "version": "1.0.0" + }, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "each-props": { + "version": "1.3.2", + "dev": true, + "requires": { + "is-plain-object": "^2.0.1", + "object.defaults": "^1.1.0" + }, + "dependencies": { + "is-plain-object": { + "version": "2.0.4", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + } + } + }, + "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.96", + "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" + }, + "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": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "memory-fs": { + "version": "0.5.0", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "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" + }, + "dependencies": { + "is-arrayish": { + "version": "0.2.1", + "dev": true + } + } + }, + "errs": { + "version": "0.3.2" + }, + "es-abstract": { + "version": "1.19.2", + "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.3", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.1", + "is-string": "^1.0.7", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.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.59", + "dev": true, + "requires": { + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.3", + "next-tick": "^1.1.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", + "dev": true + }, + "escape-html": { + "version": "1.0.3" + }, + "escape-string-regexp": { + "version": "2.0.0" + }, + "escodegen": { + "version": "2.0.0", + "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" + }, + "levn": { + "version": "0.3.0", + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "optionator": { + "version": "0.8.3", + "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" + }, + "source-map": { + "version": "0.6.1", + "optional": true + }, + "type-check": { + "version": "0.3.2", + "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-regex": { + "version": "5.0.1", + "dev": true + }, + "debug": { + "version": "4.3.4", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "escape-string-regexp": { + "version": "4.0.0", + "dev": true + }, + "globals": { + "version": "13.13.0", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "js-yaml": { + "version": "3.14.1", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "lru-cache": { + "version": "6.0.0", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "ms": { + "version": "2.1.2", + "dev": true + }, + "semver": { + "version": "7.3.5", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.1", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "dev": true + }, + "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" + }, + "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": { + "define-property": { + "version": "0.2.5", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "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" + } + }, + "express": { + "version": "4.17.3", + "requires": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.19.2", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.4.2", + "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.7", + "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": { + "depd": { + "version": "1.1.2" + }, + "safe-buffer": { + "version": "5.2.1" + } + } + }, + "ext": { + "version": "1.6.0", + "dev": true, + "requires": { + "type": "^2.5.0" + }, + "dependencies": { + "type": { + "version": "2.6.0", + "dev": true + } + } + }, + "extend": { + "version": "3.0.2" + }, + "extend-shallow": { + "version": "3.0.2", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + }, + "is-plain-object": { + "version": "2.0.4", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + } + } + }, + "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" + } + }, + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.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", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "requires": { + "@types/yauzl": "^2.9.1", + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "extsprintf": { + "version": "1.4.1" + }, + "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" + }, + "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", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "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": { + "json5": { + "version": "1.0.1", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + }, + "schema-utils": { + "version": "0.4.7", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-keywords": "^3.1.0" + } + } + } + }, + "file-type": { + "version": "10.11.0" + }, + "filed-mimefix": { + "version": "0.1.3", + "requires": { + "mime": "^1.4.0" + } + }, + "filelist": { + "version": "1.0.2", + "requires": { + "minimatch": "^3.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "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" + } + }, + "find-cache-dir": { + "version": "2.1.0", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^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" + } + }, + "make-dir": { + "version": "2.1.0", + "dev": true, + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + } + }, + "p-locate": { + "version": "3.0.0", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "dev": true + }, + "pkg-dir": { + "version": "3.0.0", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + }, + "semver": { + "version": "5.7.1", + "dev": true + } + } + }, + "find-up": { + "version": "4.1.0", + "dev": true, + "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": { + "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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "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" + } + } + } + }, + "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" + } + }, + "to-regex-range": { + "version": "2.1.1", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "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" + }, + "dependencies": { + "is-plain-object": { + "version": "2.0.4", + "dev": true, + "requires": { + "isobject": "^3.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" + } + }, + "flatted": { + "version": "3.2.7" + }, + "flush-write-stream": { + "version": "1.1.1", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "readable-stream": "^2.3.6" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, + "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": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "form-data-encoder": { + "version": "1.7.2" + }, + "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" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.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-minipass": { + "version": "2.1.0", + "requires": { + "minipass": "^3.0.0" + } + }, + "fs-mkdirp-stream": { + "version": "1.0.0", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "through2": "^2.0.3" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "xtend": { + "version": "4.0.2", + "dev": true + } + } + }, + "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" + }, + "fstream": { + "version": "1.0.12", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "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", + "dev": true, + "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" + } + }, + "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" + } + }, + "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" + }, + "dependencies": { + "abort-controller": { + "version": "2.0.3", + "requires": { + "event-target-shim": "^5.0.0" + } + } + } + }, + "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": "2.0.5", + "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" + } + }, + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.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" + }, + "dependencies": { + "anymatch": { + "version": "2.0.0", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "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" + } + } + } + }, + "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" + } + }, + "to-regex-range": { + "version": "2.1.1", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "global-dirs": { + "version": "3.0.0", + "dev": true, + "requires": { + "ini": "2.0.0" + }, + "dependencies": { + "ini": { + "version": "2.0.0", + "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" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "dev": true + } + } + }, + "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" + } + }, + "minimatch": { + "version": "3.0.8", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "glogg": { + "version": "1.0.2", + "dev": true, + "requires": { + "sparkles": "^1.0.0" + } + }, + "gm": { + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/gm/-/gm-1.25.0.tgz", + "integrity": "sha512-4kKdWXTtgQ4biIo7hZA396HT062nDVVHPjQcurNZ3o/voYN+o5FUC5kOwuORbpExp3XbTJ3SU7iRipiIhQtovw==", + "requires": { + "array-parallel": "~0.1.3", + "array-series": "~0.1.5", + "cross-spawn": "^4.0.0", + "debug": "^3.1.0" + }, + "dependencies": { + "cross-spawn": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", + "integrity": "sha512-yAXz/pA1tD8Gtg2S98Ekf/sewp3Lcp3YoFKJ4Hkp5h5yLWnKVTDU0kwjKJ8NDCYcfTLfyGkzTikst+jWypT1iA==", + "requires": { + "lru-cache": "^4.0.1", + "which": "^1.2.9" + } + }, + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==" + } + } + }, + "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": { + "base64-js": { + "version": "1.5.1" + }, + "semver": { + "version": "5.7.1" + } + } + }, + "google-p12-pem": { + "version": "1.0.5", + "requires": { + "node-forge": "^0.10.0", + "pify": "^4.0.0" + } + }, + "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": { + "mime": { + "version": "2.6.0" + } + } + }, + "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" + }, + "dependencies": { + "ansi-colors": { + "version": "1.1.0", + "dev": true, + "requires": { + "ansi-wrap": "^0.1.0" + } + }, + "camelcase": { + "version": "3.0.0", + "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" + } + }, + "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" + } + }, + "get-caller-file": { + "version": "1.0.3", + "dev": true + }, + "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" + } + }, + "invert-kv": { + "version": "1.0.0", + "dev": true + }, + "isarray": { + "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" + } + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "require-main-filename": { + "version": "1.0.1", + "dev": true + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "which-module": { + "version": "1.0.0", + "dev": true + }, + "wrap-ansi": { + "version": "2.1.0", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + } + }, + "y18n": { + "version": "3.2.2", + "dev": true + }, + "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" + } + }, + "yargs-parser": { + "version": "5.0.1", + "dev": true, + "requires": { + "camelcase": "^3.0.0", + "object.assign": "^4.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" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "xtend": { + "version": "4.0.2", + "dev": true + } + } + }, + "gulp-env": { + "version": "0.4.0", + "dev": true, + "requires": { + "ini": "^1.3.4", + "through2": "^2.0.0" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "xtend": { + "version": "4.0.2", + "dev": true + } + } + }, + "gulp-file": { + "version": "0.4.0", + "dev": true, + "requires": { + "through2": "^0.4.1", + "vinyl": "^2.1.0" + }, + "dependencies": { + "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" + } + }, + "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": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "which": { + "version": "1.3.1", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "xtend": { + "version": "4.0.2", + "dev": true + } + } + }, + "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" + }, + "dependencies": { + "binary-extensions": { + "version": "2.2.0", + "dev": true + }, + "chokidar": { + "version": "3.5.3", + "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" + } + }, + "has-flag": { + "version": "3.0.0", + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "ms": { + "version": "2.1.3", + "dev": true + }, + "nodemon": { + "version": "2.0.15", + "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" + } + }, + "readdirp": { + "version": "3.6.0", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "semver": { + "version": "5.7.1", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "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-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 + }, + "escape-string-regexp": { + "version": "1.0.5", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "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" + } + }, + "object-assign": { + "version": "3.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "replace-ext": { + "version": "0.0.1", + "dev": true + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "supports-color": { + "version": "2.0.0", + "dev": true + }, + "through2": { + "version": "2.0.5", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "vinyl": { + "version": "0.5.3", + "dev": true, + "requires": { + "clone": "^1.0.0", + "clone-stats": "^0.0.1", + "replace-ext": "0.0.1" + } + }, + "xtend": { + "version": "4.0.2", + "dev": true + } + } + }, + "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": { + "js-yaml": { + "version": "3.14.1", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + } + } + }, + "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" + }, + "dependencies": { + "bufferstreams": { + "version": "1.1.0", + "dev": true, + "requires": { + "readable-stream": "^2.0.2" + } + }, + "isarray": { + "version": "1.0.0", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "xtend": { + "version": "4.0.2", + "dev": true + } + } + }, + "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" + } + }, + "has-bigints": { + "version": "1.0.1", + "dev": true + }, + "has-flag": { + "version": "4.0.0" + }, + "has-gulplog": { + "version": "0.1.0", + "dev": true, + "requires": { + "sparkles": "^1.0.0" + } + }, + "has-symbols": { + "version": "1.0.3" + }, + "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": { + "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" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "has-yarn": { + "version": "2.1.0", + "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 + }, + "string_decoder": { + "version": "1.3.0", + "dev": true, + "requires": { + "safe-buffer": "~5.2.0" + } + } + } + }, + "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" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "hpkp": { + "version": "2.0.0" + }, + "hsts": { + "version": "2.2.0", + "requires": { + "depd": "2.0.0" + } + }, + "html-encoding-sniffer": { + "version": "2.0.1", + "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" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + } + } + }, + "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" + } + }, + "json5": { + "version": "1.0.1", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.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" + }, + "dependencies": { + "commander": { + "version": "2.17.1", + "dev": true + } + } + }, + "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" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + } + } + }, + "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" + } + }, + "safe-buffer": { + "version": "5.2.1" + }, + "string_decoder": { + "version": "1.3.0", + "requires": { + "safe-buffer": "~5.2.0" + } + } + } + }, + "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.6", + "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", + "requires": { + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" + }, + "dependencies": { + "agent-base": { + "version": "6.0.2", + "requires": { + "debug": "4" + } + }, + "debug": { + "version": "4.3.4", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2" + } + } + }, + "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": { + "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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "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" + } + } + } + }, + "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" + } + }, + "to-regex-range": { + "version": "2.1.1", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "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": "2.2.4", + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.3" + } + } + }, + "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" + } + }, + "immediate": { + "version": "3.0.6" + }, + "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", + "dev": true + }, + "import-local": { + "version": "3.1.0", + "dev": true, + "requires": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.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.2" + }, + "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": "3.0.1" + }, + "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.3.2" + }, + "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", + "dev": true, + "requires": { + "global-dirs": "^3.0.0", + "is-path-inside": "^3.0.2" + }, + "dependencies": { + "is-path-inside": { + "version": "3.0.3", + "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", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "dev": true + }, + "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": "5.0.0" + }, + "is-potential-custom-element-name": { + "version": "1.0.1" + }, + "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", + "dev": true + }, + "isarray": { + "version": "0.0.1" + }, + "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" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "dev": true + } + } + }, + "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": { + "make-dir": { + "version": "3.1.0", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "semver": { + "version": "6.3.0", + "dev": true + } + } + }, + "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": { + "debug": { + "version": "4.3.4", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "dev": true + } + } + }, + "istanbul-reports": { + "version": "3.1.4", + "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.4", + "requires": { + "async": "0.9.x", + "chalk": "^4.0.2", + "filelist": "^1.0.1", + "minimatch": "^3.0.4" + }, + "dependencies": { + "async": { + "version": "0.9.2" + } + } + }, + "jasmine": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-4.5.0.tgz", + "integrity": "sha512-9olGRvNZyADIwYL9XBNBst5BTU/YaePzuddK+YRslc7rI9MdTIE4r3xaBKbv2GEmzYYUfMOdTR8/i6JfLZaxSQ==", + "dev": true, + "requires": { + "glob": "^7.1.6", + "jasmine-core": "^4.5.0" + } + }, + "jasmine-core": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-4.5.0.tgz", + "integrity": "sha512-9PMzyvhtocxb3aXJVOPqBDswdgyAeSB81QnLop4npOpbqnheaTEwPc9ZloQeVswugPManznQBjD8kWDTjlnHuw==", + "dev": true + }, + "jasmine-reporters": { + "version": "2.5.0", + "dev": true, + "requires": { + "@xmldom/xmldom": "^0.7.3", + "mkdirp": "^1.0.4" + }, + "dependencies": { + "mkdirp": { + "version": "1.0.4", + "dev": true + } + } + }, + "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" + }, + "dependencies": { + "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" + } + } + } + }, + "jest-changed-files": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/types": "^26.6.2", + "execa": "^4.0.0", + "throat": "^5.0.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" + } + }, + "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" + } + }, + "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" + } + }, + "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" + } + }, + "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" + } + }, + "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.1", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "dev": true + }, + "has-flag": { + "version": "3.0.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" + } + }, + "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.1", + "dev": true + } + } + }, + "supports-color": { + "version": "5.5.0", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "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" + } + }, + "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" + } + }, + "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": { + "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" + } + }, + "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" + } + }, + "type-fest": { + "version": "0.8.1", + "dev": true + } + } + }, + "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" + } + }, + "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": { + "strip-bom": { + "version": "4.0.0", + "dev": true + } + } + }, + "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": { + "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" + } + }, + "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" + } + }, + "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": { + "camelcase": { + "version": "6.3.0", + "dev": true + } + } + }, + "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" + } + }, + "jest-worker": { + "version": "26.6.2", + "dev": true, + "requires": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" + }, + "dependencies": { + "merge-stream": { + "version": "2.0.0", + "dev": true + } + } + }, + "jmespath": { + "version": "0.16.0" + }, + "js-base64": { + "version": "2.6.4", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "dev": true + }, + "js-yaml": { + "version": "4.1.0", + "requires": { + "argparse": "^2.0.1" + }, + "dependencies": { + "argparse": { + "version": "2.0.1" + } + } + }, + "js2xmlparser": { + "version": "3.0.0", + "requires": { + "xmlcreate": "^1.0.1" + } + }, + "jsbarcode": { + "version": "3.11.5", + "resolved": "https://registry.npmjs.org/jsbarcode/-/jsbarcode-3.11.5.tgz", + "integrity": "sha512-zv3KsH51zD00I/LrFzFSM6dst7rDn0vIMzaiZFL7qusTjPZiPtxg3zxetp0RR7obmjTw4f6NyGgbdkBCgZUIrA==" + }, + "jsbn": { + "version": "0.1.1" + }, + "jsdom": { + "version": "16.7.0", + "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" + }, + "agent-base": { + "version": "6.0.2", + "requires": { + "debug": "4" + } + }, + "debug": { + "version": "4.3.4", + "requires": { + "ms": "2.1.2" + } + }, + "form-data": { + "version": "3.0.1", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "https-proxy-agent": { + "version": "5.0.0", + "requires": { + "agent-base": "6", + "debug": "4" + } + }, + "ms": { + "version": "2.1.2" + }, + "tough-cookie": { + "version": "4.0.0", + "requires": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.1.2" + } + }, + "tr46": { + "version": "2.1.0", + "requires": { + "punycode": "^2.1.1" + } + }, + "webidl-conversions": { + "version": "6.1.0" + }, + "whatwg-url": { + "version": "8.7.0", + "requires": { + "lodash": "^4.7.0", + "tr46": "^2.1.0", + "webidl-conversions": "^6.1.0" + } + } + } + }, + "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" + }, + "json5": { + "version": "2.2.1", + "dev": true + }, + "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" + }, + "extsprintf": { + "version": "1.3.0" + }, + "verror": { + "version": "1.10.0", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + } + } + }, + "jszip": { + "version": "3.10.0", + "requires": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + }, + "dependencies": { + "isarray": { + "version": "1.0.0" + }, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "requires": { + "safe-buffer": "~5.1.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.1.1", + "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", + "dev": true, + "requires": { + "package-json": "^6.3.0" + } + }, + "lazystream": { + "version": "1.0.1", + "dev": true, + "requires": { + "readable-stream": "^2.0.5" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "lcid": { + "version": "3.1.1", + "requires": { + "invert-kv": "^3.0.0" + } + }, + "ldap-filter": { + "version": "0.3.3", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "ldapjs": { + "version": "2.3.2", + "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" + }, + "lie": { + "version": "3.3.0", + "requires": { + "immediate": "~3.0.5" + } + }, + "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" + }, + "dependencies": { + "is-plain-object": { + "version": "2.0.4", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + } + } + }, + "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": { + "pify": { + "version": "2.3.0", + "dev": true + }, + "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": "2.0.2", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + } + }, + "locate-path": { + "version": "5.0.0", + "dev": true, + "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.truncate": { + "version": "4.4.2", + "dev": true + }, + "log4js": { + "version": "6.7.0", + "requires": { + "date-format": "^4.0.14", + "debug": "^4.3.4", + "flatted": "^3.2.7", + "rfdc": "^1.3.0", + "streamroller": "^3.1.3" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2" + } + } + }, + "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": { + "depd": { + "version": "1.1.2" + } + } + }, + "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": { + "debug": { + "version": "4.3.4", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2" + } + } + }, + "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" + } + }, + "ms": { + "version": "2.1.3" + } + } + }, + "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" + } + }, + "ms": { + "version": "2.1.3" + } + } + }, + "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" + }, + "debug": { + "version": "4.3.4", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2" + }, + "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" + } + }, + "ms": { + "version": "2.1.3" + }, + "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.4", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "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" + }, + "ms": { + "version": "2.1.3" + } + } + }, + "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" + } + }, + "ms": { + "version": "2.1.3" + } + } + }, + "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" + } + }, + "ms": { + "version": "2.1.3" + } + } + }, + "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" + } + }, + "ms": { + "version": "2.1.3" + } + } + }, + "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": "1.3.0", + "requires": { + "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0" + } + } + }, + "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": { + "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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "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-glob": { + "version": "3.1.0", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + }, + "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" + } + } + } + }, + "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" + } + }, + "to-regex-range": { + "version": "2.1.1", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "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": "5.1.1", + "requires": { + "map-age-cleaner": "^0.1.3", + "mimic-fn": "^2.1.0", + "p-is-promise": "^2.1.0" + } + }, + "memory-fs": { + "version": "0.4.1", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "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" + } + }, + "merge-descriptors": { + "version": "1.0.1" + }, + "merge-stream": { + "version": "1.0.1", + "dev": true, + "requires": { + "readable-stream": "^2.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "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.5", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "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": "1.6.0" + }, + "mime-db": { + "version": "1.52.0" + }, + "mime-types": { + "version": "2.1.35", + "requires": { + "mime-db": "1.52.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.1.2", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.6" + }, + "minipass": { + "version": "3.3.4", + "requires": { + "yallist": "^4.0.0" + }, + "dependencies": { + "yallist": { + "version": "4.0.0" + } + } + }, + "minizlib": { + "version": "2.1.2", + "requires": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "dependencies": { + "yallist": { + "version": "4.0.0" + } + } + }, + "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" + }, + "dependencies": { + "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" + } + }, + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "xtend": { + "version": "4.0.2", + "dev": true + } + } + }, + "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" + } + }, + "is-plain-object": { + "version": "2.0.4", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + } + } + }, + "mkdirp": { + "version": "0.5.6", + "requires": { + "minimist": "^1.2.6" + } + }, + "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": { + "rimraf": { + "version": "2.7.1", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "ms": { + "version": "2.0.0" + }, + "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" + }, + "dependencies": { + "isarray": { + "version": "1.0.0" + }, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "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" + } + } + }, + "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" + }, + "dependencies": { + "bignumber.js": { + "version": "9.0.0" + }, + "isarray": { + "version": "1.0.0" + }, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "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" + } + }, + "napi-build-utils": { + "version": "1.0.2" + }, + "natural-compare": { + "version": "1.4.0", + "dev": true + }, + "negotiator": { + "version": "0.6.3" + }, + "neo-async": { + "version": "2.6.2", + "dev": true + }, + "next-tick": { + "version": "1.1.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": "3.28.0", + "requires": { + "semver": "^7.3.5" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.3.8", + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0" + } + } + }, + "node-addon-api": { + "version": "5.0.0" + }, + "node-domexception": { + "version": "1.0.0" + }, + "node-fetch": { + "version": "2.6.7", + "requires": { + "whatwg-url": "^5.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": { + "nopt": { + "version": "3.0.6", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "rimraf": { + "version": "2.7.1", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "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 + }, + "isarray": { + "version": "1.0.0", + "dev": true + }, + "punycode": { + "version": "1.4.1", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + }, + "dependencies": { + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "string_decoder": { + "version": "1.3.0", + "dev": true, + "requires": { + "safe-buffer": "~5.2.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.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.2", + "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-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" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "dev": true + }, + "lru-cache": { + "version": "4.1.5", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "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" + } + }, + "semver": { + "version": "6.3.0" + } + } + }, + "node.extend": { + "version": "2.0.2", + "dev": true, + "requires": { + "has": "^1.0.3", + "is": "^3.2.1" + } + }, + "nodemailer": { + "version": "6.7.3" + }, + "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.19", + "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", + "simple-update-notifier": "^1.0.7", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "dependencies": { + "binary-extensions": { + "version": "2.2.0", + "dev": true + }, + "chokidar": { + "version": "3.5.3", + "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" + } + }, + "has-flag": { + "version": "3.0.0", + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "ms": { + "version": "2.1.3", + "dev": true + }, + "readdirp": { + "version": "3.6.0", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "semver": { + "version": "5.7.1", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "nopt": { + "version": "1.0.10", + "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" + } + }, + "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", + "dev": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1" + }, + "nwsapi": { + "version": "2.2.0" + }, + "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": { + "define-property": { + "version": "0.2.5", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "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" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "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": "5.0.0", + "requires": { + "execa": "^4.0.0", + "lcid": "^3.0.0", + "mem": "^5.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", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "dev": true, + "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", + "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", + "dev": true + }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "dev": true, + "requires": { + "defer-to-connect": "^1.0.1" + } + }, + "cacheable-request": { + "version": "6.1.0", + "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" + }, + "dependencies": { + "get-stream": { + "version": "5.2.0", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "dev": true + } + } + }, + "decompress-response": { + "version": "3.3.0", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "defer-to-connect": { + "version": "1.1.3", + "dev": true + }, + "get-stream": { + "version": "4.1.0", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "got": { + "version": "9.6.0", + "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" + } + }, + "json-buffer": { + "version": "3.0.0", + "dev": true + }, + "keyv": { + "version": "3.1.0", + "dev": true, + "requires": { + "json-buffer": "3.0.0" + } + }, + "lowercase-keys": { + "version": "1.0.1", + "dev": true + }, + "mimic-response": { + "version": "1.0.1", + "dev": true + }, + "normalize-url": { + "version": "4.5.1", + "dev": true + }, + "p-cancelable": { + "version": "1.1.0", + "dev": true + }, + "responselike": { + "version": "1.0.2", + "dev": true, + "requires": { + "lowercase-keys": "^1.0.0" + } + }, + "semver": { + "version": "6.3.0", + "dev": true + }, + "to-readable-stream": { + "version": "1.0.0", + "dev": true + } + } + }, + "pako": { + "version": "1.0.11" + }, + "parallel-transform": { + "version": "1.2.0", + "dev": true, + "requires": { + "cyclist": "^1.0.1", + "inherits": "^2.0.3", + "readable-stream": "^2.1.5" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "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": "2.2.0", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "parse-node-version": { + "version": "1.0.1", + "dev": true + }, + "parse-passwd": { + "version": "1.0.0", + "dev": true + }, + "parse5": { + "version": "6.0.1" + }, + "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", + "dev": true + }, + "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" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "dev": true + } + } + }, + "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", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==" + }, + "performance-now": { + "version": "2.1.0" + }, + "picocolors": { + "version": "1.0.0", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "dev": true + }, + "pify": { + "version": "4.0.1" + }, + "pinkie": { + "version": "2.0.4", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "pirates": { + "version": "4.0.5", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "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": { + "mime": { + "version": "2.6.0" + } + } + }, + "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" + } + } + } + }, + "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" + } + }, + "ms": { + "version": "2.1.3", + "dev": true + } + } + }, + "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.9", + "dev": true, + "requires": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + } + }, + "postcss-value-parser": { + "version": "3.3.1", + "dev": true + }, + "prebuild-install": { + "version": "7.1.1", + "requires": { + "detect-libc": "^2.0.0", + "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": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + } + }, + "precond": { + "version": "0.2.3" + }, + "prelude-ls": { + "version": "1.2.1", + "dev": true + }, + "prepend-http": { + "version": "2.0.0", + "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-regex": { + "version": "5.0.1", + "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", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "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", + "dev": true, + "requires": { + "escape-goat": "^2.0.0" + } + }, + "puppeteer": { + "version": "18.2.1", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-18.2.1.tgz", + "integrity": "sha512-7+UhmYa7wxPh2oMRwA++k8UGVDxh3YdWFB52r9C3tM81T6BU7cuusUSxImz0GEYSOYUKk/YzIhkQ6+vc0gHbxQ==", + "requires": { + "https-proxy-agent": "5.0.1", + "progress": "2.0.3", + "proxy-from-env": "1.1.0", + "puppeteer-core": "18.2.1" + }, + "dependencies": { + "agent-base": { + "version": "6.0.2", + "requires": { + "debug": "4" + } + }, + "debug": { + "version": "4.3.4", + "requires": { + "ms": "2.1.2" + } + }, + "https-proxy-agent": { + "version": "5.0.1", + "requires": { + "agent-base": "6", + "debug": "4" + } + }, + "ms": { + "version": "2.1.2" + } + } + }, + "puppeteer-cluster": { + "version": "0.23.0", + "requires": { + "debug": "^4.3.3" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2" + } + } + }, + "puppeteer-core": { + "version": "18.2.1", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-18.2.1.tgz", + "integrity": "sha512-MRtTAZfQTluz3U2oU/X2VqVWPcR1+94nbA2V6ZrSZRVEwLqZ8eclZ551qGFQD/vD2PYqHJwWOW/fpC721uznVw==", + "requires": { + "cross-fetch": "3.1.5", + "debug": "4.3.4", + "devtools-protocol": "0.0.1045489", + "extract-zip": "2.0.1", + "https-proxy-agent": "5.0.1", + "proxy-from-env": "1.1.0", + "rimraf": "3.0.2", + "tar-fs": "2.1.1", + "unbzip2-stream": "1.4.3", + "ws": "8.9.0" + }, + "dependencies": { + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "requires": { + "debug": "4" + } + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "requires": { + "agent-base": "6", + "debug": "4" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "ws": { + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.9.0.tgz", + "integrity": "sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg==", + "requires": {} + } + } + }, + "qs": { + "version": "6.9.7" + }, + "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.3", + "requires": { + "bytes": "3.1.2", + "http-errors": "1.8.1", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "dependencies": { + "bytes": { + "version": "3.1.2" + } + } + }, + "raw-loader": { + "version": "1.0.0", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "schema-utils": "^1.0.0" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + }, + "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" + } + }, + "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" + } + }, + "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" + }, + "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" + } + } + } + }, + "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" + } + }, + "readdirp": { + "version": "2.2.1", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "micromatch": "^3.1.10", + "readable-stream": "^2.0.2" + }, + "dependencies": { + "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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "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" + } + } + } + }, + "isarray": { + "version": "1.0.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" + } + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "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": "10.0.1", + "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" + } + }, + "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": "5.0.1", + "dev": true, + "requires": { + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^10.0.1", + "regjsgen": "^0.6.0", + "regjsparser": "^0.8.2", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.0.0" + } + }, + "registry-auth-token": { + "version": "4.2.1", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, + "registry-url": { + "version": "5.1.0", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, + "regjsgen": { + "version": "0.6.0", + "dev": true + }, + "regjsparser": { + "version": "0.8.4", + "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" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "xtend": { + "version": "4.0.2", + "dev": true + } + } + }, + "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": { + "css-select": { + "version": "4.3.0", + "dev": true, + "requires": { + "boolbase": "^1.0.0", + "css-what": "^6.0.1", + "domhandler": "^4.3.1", + "domutils": "^2.8.0", + "nth-check": "^2.0.1" + } + }, + "css-what": { + "version": "6.0.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.1", + "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" + } + }, + "nth-check": { + "version": "2.0.1", + "dev": true, + "requires": { + "boolbase": "^1.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": "1.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", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "qs": { + "version": "6.5.3" + } + } + }, + "require-directory": { + "version": "2.1.1", + "dev": true + }, + "require-from-string": { + "version": "2.0.2", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "dev": true + }, + "require-yaml": { + "version": "0.0.1", + "requires": { + "js-yaml": "" + } + }, + "requires-port": { + "version": "1.0.0", + "dev": true + }, + "resolve": { + "version": "1.22.0", + "dev": true, + "requires": { + "is-core-module": "^2.8.1", + "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" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2" + } + } + }, + "rfdc": { + "version": "1.3.0" + }, + "rimraf": { + "version": "3.0.2", + "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": { + "anymatch": { + "version": "2.0.0", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.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" + } + }, + "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" + } + }, + "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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "get-stream": { + "version": "4.1.0", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "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-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" + } + }, + "normalize-path": { + "version": "2.1.1", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "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 + }, + "to-regex-range": { + "version": "2.1.1", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "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.1", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "cliui": { + "version": "5.0.0", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "color-convert": { + "version": "1.9.3", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "dev": true + }, + "emoji-regex": { + "version": "7.0.3", + "dev": true + }, + "find-up": { + "version": "3.0.0", + "dev": true, + "requires": { + "locate-path": "^3.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 + }, + "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" + } + }, + "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": { + "json5": { + "version": "1.0.1", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + }, + "semver": { + "version": "6.3.0", + "dev": true + } + } + }, + "sax": { + "version": "1.2.4" + }, + "saxes": { + "version": "5.0.1", + "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": "5.3.0" + }, + "semver-diff": { + "version": "3.1.1", + "dev": true, + "requires": { + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "dev": true + } + } + }, + "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": { + "depd": { + "version": "1.1.2" + }, + "ms": { + "version": "2.1.3" + } + } + }, + "seq-queue": { + "version": "0.0.5", + "dev": true + }, + "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": { + "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 + }, + "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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-plain-object": { + "version": "2.0.4", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + } + } + }, + "setimmediate": { + "version": "1.0.5" + }, + "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.31.3", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.31.3.tgz", + "integrity": "sha512-XcR4+FCLBFKw1bdB+GEhnUNXNXvnt0tDo4WsBsraKymuo/IAuPuCBVAL2wIkUw2r/dwFW5Q5+g66Kwl2dgDFVg==", + "requires": { + "color": "^4.2.3", + "detect-libc": "^2.0.1", + "node-addon-api": "^5.0.0", + "prebuild-install": "^7.1.1", + "semver": "^7.3.8", + "simple-get": "^4.0.1", + "tar-fs": "^2.1.1", + "tunnel-agent": "^0.6.0" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.3.8", + "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.7" + }, + "simple-concat": { + "version": "1.0.1" + }, + "simple-get": { + "version": "4.0.1", + "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" + } + }, + "simple-update-notifier": { + "version": "1.0.7", + "dev": true, + "requires": { + "semver": "~7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.0.0", + "dev": true + } + } + }, + "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": { + "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": { + "define-property": { + "version": "0.2.5", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "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.6.0", + "dev": true, + "requires": { + "debug": "^3.2.7", + "eventsource": "^1.1.0", + "faye-websocket": "^0.11.4", + "inherits": "^2.0.4", + "url-parse": "^1.5.10" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.3", + "dev": true + } + } + }, + "source-list-map": { + "version": "2.0.1", + "dev": true + }, + "source-map": { + "version": "0.5.6", + "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" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "dev": true + } + } + }, + "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": { + "debug": { + "version": "4.3.4", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "dev": true + }, + "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 + }, + "string_decoder": { + "version": "1.3.0", + "dev": true, + "requires": { + "safe-buffer": "~5.2.0" + } + } + } + }, + "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" + } + }, + "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" + } + }, + "static-extend": { + "version": "0.1.2", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "statuses": { + "version": "1.5.0" + }, + "stdout-stream": { + "version": "1.4.1", + "dev": true, + "requires": { + "readable-stream": "^2.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "stream-browserify": { + "version": "2.0.2", + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "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" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "xtend": { + "version": "4.0.2", + "dev": true + } + } + }, + "stream-serializer": { + "version": "1.1.2" + }, + "stream-shift": { + "version": "1.0.1" + }, + "streamroller": { + "version": "3.1.3", + "requires": { + "date-format": "^4.0.14", + "debug": "^4.3.4", + "fs-extra": "^8.1.0" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "requires": { + "ms": "2.1.2" + } + }, + "fs-extra": { + "version": "8.1.0", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "ms": { + "version": "2.1.2" + } + } + }, + "streamsearch": { + "version": "0.1.2" + }, + "string_decoder": { + "version": "0.10.31" + }, + "string-length": { + "version": "4.0.2", + "dev": true, + "requires": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "dev": true + }, + "strip-ansi": { + "version": "6.0.1", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "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" + } + }, + "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": "3.0.1", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "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": "2.0.1" + }, + "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" + } + }, + "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" + }, + "ms": { + "version": "2.1.3" + }, + "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" + } + } + } + }, + "which": { + "version": "1.3.1", + "requires": { + "isexe": "^2.0.0" + } + }, + "xtend": { + "version": "4.0.2" + }, + "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": { + "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" + } + }, + "debug": { + "version": "4.3.4", + "requires": { + "ms": "2.1.2" + } + }, + "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" + } + }, + "invert-kv": { + "version": "2.0.0" + }, + "is-stream": { + "version": "1.1.0" + }, + "lcid": { + "version": "2.0.0", + "requires": { + "invert-kv": "^2.0.0" + } + }, + "mem": { + "version": "4.3.0", + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^2.0.0", + "p-is-promise": "^2.0.0" + } + }, + "ms": { + "version": "2.1.2" + }, + "npm-run-path": { + "version": "2.0.2", + "requires": { + "path-key": "^2.0.0" + } + }, + "os-locale": { + "version": "3.1.0", + "requires": { + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.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" + } + } + } + }, + "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" + }, + "debug": { + "version": "4.3.4", + "requires": { + "ms": "2.1.2" + } + }, + "ejs": { + "version": "3.1.6", + "requires": { + "jake": "^10.6.1" + } + }, + "mkdirp": { + "version": "1.0.4" + }, + "ms": { + "version": "2.1.2" + }, + "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.6", + "requires": { + "minimist": "^1.2.6" + } + } + } + }, + "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": { + "json5": { + "version": "1.0.1", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + }, + "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": "7.2.0", + "requires": { + "has-flag": "^4.0.0" + } + }, + "supports-hyperlinks": { + "version": "2.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0", + "supports-color": "^7.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.4", + "requires": { + "@babel/runtime-corejs3": "^7.11.2", + "btoa": "^1.2.1", + "cookie": "~0.4.1", + "cross-fetch": "^3.1.5", + "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": { + "fast-json-patch": { + "version": "3.1.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" + }, + "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.11.0", + "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" + } + }, + "ansi-regex": { + "version": "5.0.1", + "dev": true + }, + "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" + } + }, + "strip-ansi": { + "version": "6.0.1", + "dev": true, + "requires": { + "ansi-regex": "^5.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": { + "base64-js": { + "version": "1.5.1" + }, + "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" + } + }, + "safe-buffer": { + "version": "5.2.1" + }, + "string_decoder": { + "version": "1.3.0", + "requires": { + "safe-buffer": "~5.2.0" + } + } + } + }, + "teeny-request": { + "version": "3.11.3", + "requires": { + "https-proxy-agent": "^2.2.1", + "node-fetch": "^2.2.0", + "uuid": "^3.3.2" + } + }, + "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": { + "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" + } + }, + "serialize-javascript": { + "version": "4.0.0", + "dev": true, + "requires": { + "randombytes": "^2.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": "3.0.2", + "requires": { + "inherits": "^2.0.4", + "readable-stream": "2 || 3" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1" + }, + "string_decoder": { + "version": "1.3.0", + "requires": { + "safe-buffer": "~5.2.0" + } + } + } + }, + "through2-filter": { + "version": "3.0.0", + "dev": true, + "requires": { + "through2": "~2.0.0", + "xtend": "~4.0.0" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "xtend": { + "version": "4.0.2", + "dev": true + } + } + }, + "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" + } + }, + "to-regex-range": { + "version": "5.0.1", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "to-through": { + "version": "2.0.0", + "dev": true, + "requires": { + "through2": "^2.0.3" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "xtend": { + "version": "4.0.2", + "dev": true + } + } + }, + "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" + } + }, + "tough-cookie": { + "version": "2.5.0", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, + "tr46": { + "version": "0.0.3" + }, + "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", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "requires": { + "buffer": "^5.2.1", + "through": "^2.3.8" + }, + "dependencies": { + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "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.6", + "requires": { + "sprintf-js": "^1.1.1", + "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 + }, + "isarray": { + "version": "1.0.0", + "dev": true + } + } + }, + "upath": { + "version": "1.2.0", + "dev": true + }, + "update-notifier": { + "version": "5.1.0", + "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": { + "configstore": { + "version": "5.0.1", + "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", + "dev": true + }, + "dot-prop": { + "version": "5.3.0", + "dev": true, + "requires": { + "is-obj": "^2.0.0" + } + }, + "is-obj": { + "version": "2.0.0", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "make-dir": { + "version": "3.1.0", + "dev": true, + "requires": { + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "dev": true + } + } + }, + "semver": { + "version": "7.3.5", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "unique-string": { + "version": "2.0.0", + "dev": true, + "requires": { + "crypto-random-string": "^2.0.0" + } + }, + "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" + } + }, + "xdg-basedir": { + "version": "4.0.0", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "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.10", + "dev": true, + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "url-parse-lax": { + "version": "3.0.0", + "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" + } + }, + "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" + } + }, + "vinyl-bufferstream": { + "version": "1.0.1", + "dev": true, + "requires": { + "bufferstreams": "1.0.1" + } + }, + "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" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "dev": true, + "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" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "xtend": { + "version": "4.0.2", + "dev": true + } + } + }, + "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", + "jsbarcode": "^3.11.5", + "jsonexport": "^3.2.0", + "juice": "^5.2.0", + "log4js": "^6.7.0", + "mysql2": "^1.7.0", + "nodemailer": "^4.7.0", + "puppeteer-cluster": "^0.23.0", + "qrcode": "^1.4.2", + "strftime": "^0.10.0", + "vue": "^2.6.10", + "vue-i18n": "^8.15.0", + "vue-server-renderer": "^2.6.10", + "xmldom": "^0.6.0" + }, + "dependencies": { + "@babel/parser": { + "version": "7.19.3" + }, + "@vue/compiler-sfc": { + "version": "2.7.10", + "requires": { + "@babel/parser": "^7.18.4", + "postcss": "^8.4.14", + "source-map": "^0.6.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": "5.0.1" + }, + "ansi-styles": { + "version": "3.2.1", + "requires": { + "color-convert": "^1.9.0" + } + }, + "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.4" + }, + "asynckit": { + "version": "0.4.0" + }, + "aws-sign2": { + "version": "0.7.0" + }, + "aws4": { + "version": "1.11.0" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "boolbase": { + "version": "1.0.0" + }, + "camelcase": { + "version": "5.3.1" + }, + "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" + } + }, + "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" + } + }, + "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" + }, + "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" + }, + "csstype": { + "version": "3.1.1" + }, + "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" + } + }, + "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" + }, + "extsprintf": { + "version": "1.3.0" + }, + "fast-deep-equal": { + "version": "3.1.3" + }, + "fast-json-stable-stringify": { + "version": "2.1.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" + } + }, + "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" + } + }, + "graceful-fs": { + "version": "4.2.10" + }, + "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-flag": { + "version": "3.0.0" + }, + "hash-sum": { + "version": "2.0.0" + }, + "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" + } + }, + "iconv-lite": { + "version": "0.5.2", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "image-size": { + "version": "0.7.5" + }, + "inherits": { + "version": "2.0.4" + }, + "intl": { + "version": "1.2.5" + }, + "is-core-module": { + "version": "2.10.0", + "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" + }, + "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-db": { + "version": "1.52.0" + }, + "mime-types": { + "version": "2.1.35", + "requires": { + "mime-db": "1.52.0" + } + }, + "mimer": { + "version": "1.1.1" + }, + "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" + } + } + }, + "nanoid": { + "version": "3.3.4" + }, + "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" + }, + "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-key": { + "version": "2.0.1" + }, + "path-parse": { + "version": "1.0.7" + }, + "performance-now": { + "version": "2.1.0" + }, + "picocolors": { + "version": "1.0.0" + }, + "pngjs": { + "version": "5.0.0" + }, + "postcss": { + "version": "8.4.17", + "requires": { + "nanoid": "^3.3.4", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + } + }, + "pseudomap": { + "version": "1.0.2" + }, + "psl": { + "version": "1.9.0" + }, + "punycode": { + "version": "2.1.1" + }, + "qrcode": { + "version": "1.5.1", + "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.22.1", + "requires": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "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": "6.0.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.6.1" + }, + "source-map-js": { + "version": "1.0.2" + }, + "sprintf-js": { + "version": "1.0.3" + }, + "sqlstring": { + "version": "2.3.3" + }, + "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" + } + }, + "strip-ansi": { + "version": "6.0.1", + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "supports-color": { + "version": "5.5.0", + "requires": { + "has-flag": "^3.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" + }, + "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.7.10", + "requires": { + "@vue/compiler-sfc": "2.7.10", + "csstype": "^3.1.0" + } + }, + "vue-i18n": { + "version": "8.27.2" + }, + "vue-server-renderer": { + "version": "2.7.10", + "requires": { + "chalk": "^4.1.2", + "hash-sum": "^2.0.0", + "he": "^1.2.0", + "lodash.template": "^4.5.0", + "lodash.uniq": "^4.5.0", + "resolve": "^1.22.0", + "serialize-javascript": "^6.0.0", + "source-map": "0.5.6" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4" + }, + "has-flag": { + "version": "4.0.0" + }, + "source-map": { + "version": "0.5.6" + }, + "supports-color": { + "version": "7.2.0", + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "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": { + "dom-serializer": { + "version": "1.4.1", + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + }, + "dependencies": { + "domhandler": { + "version": "4.3.1", + "requires": { + "domelementtype": "^2.2.0" + } + } + } + }, + "domelementtype": { + "version": "2.3.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.1", + "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" + } + } + } + }, + "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-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" + } + } + }, + "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" + } + } + } + }, + "w3c-hr-time": { + "version": "1.0.2", + "requires": { + "browser-process-hrtime": "^1.0.0" + } + }, + "w3c-xmlserializer": { + "version": "2.0.0", + "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": { + "binary-extensions": { + "version": "2.2.0", + "dev": true, + "optional": true + }, + "chokidar": { + "version": "3.5.3", + "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" + } + }, + "is-binary-path": { + "version": "2.1.0", + "dev": true, + "optional": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "readdirp": { + "version": "3.6.0", + "dev": true, + "optional": true, + "requires": { + "picomatch": "^2.2.1" + } + } + } + }, + "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": "3.0.1" + }, + "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 + }, + "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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "eslint-scope": { + "version": "4.0.3", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "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" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "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" + } + } + } + }, + "json5": { + "version": "1.0.1", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + }, + "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" + } + }, + "schema-utils": { + "version": "1.0.0", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "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.1", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "cliui": { + "version": "5.0.0", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "color-convert": { + "version": "1.9.3", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "dev": true + }, + "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 + }, + "escape-string-regexp": { + "version": "1.0.5", + "dev": true + }, + "find-up": { + "version": "3.0.0", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "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" + } + }, + "has-flag": { + "version": "3.0.0", + "dev": true + }, + "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 + }, + "json5": { + "version": "1.0.1", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + }, + "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 + }, + "pkg-dir": { + "version": "3.0.0", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + }, + "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" + } + }, + "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": { + "mime": { + "version": "2.6.0", + "dev": true + } + } + }, + "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": "4.1.1", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "cliui": { + "version": "5.0.0", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + }, + "dependencies": { + "strip-ansi": { + "version": "5.2.0", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "color-convert": { + "version": "1.9.3", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "dev": true + }, + "debug": { + "version": "4.3.4", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "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" + } + }, + "emoji-regex": { + "version": "7.0.3", + "dev": true + }, + "find-up": { + "version": "3.0.0", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "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" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "dev": true + } + } + }, + "has-flag": { + "version": "3.0.0", + "dev": true + }, + "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" + } + }, + "ms": { + "version": "2.1.2", + "dev": true + }, + "p-locate": { + "version": "3.0.0", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "dev": true + }, + "pkg-dir": { + "version": "3.0.0", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + }, + "punycode": { + "version": "1.3.2", + "dev": true + }, + "resolve-cwd": { + "version": "2.0.0", + "dev": true, + "requires": { + "resolve-from": "^3.0.0" + } + }, + "resolve-from": { + "version": "3.0.0", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "schema-utils": { + "version": "1.0.0", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + }, + "semver": { + "version": "6.3.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" + }, + "dependencies": { + "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" + } + }, + "url": { + "version": "0.11.0", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "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": { + "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", + "requires": { + "iconv-lite": "0.4.24" + } + }, + "whatwg-mimetype": { + "version": "2.3.0" + }, + "whatwg-url": { + "version": "5.0.0", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.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": "2.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", + "dev": true, + "requires": { + "string-width": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.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" + } + }, + "strip-ansi": { + "version": "6.0.1", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "with-open-file": { + "version": "0.1.7", + "requires": { + "p-finally": "^1.0.0", + "p-try": "^2.1.0", + "pify": "^4.0.1" + } + }, + "word-count": { + "version": "0.2.2" + }, + "word-wrap": { + "version": "1.2.3" + }, + "worker-farm": { + "version": "1.7.0", + "dev": true, + "requires": { + "errno": "~0.1.7" + } + }, + "wrap-ansi": { + "version": "6.2.0", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.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" + } + }, + "strip-ansi": { + "version": "6.0.1", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "wrappy": { + "version": "1.0.2" + }, + "write-file-atomic": { + "version": "2.4.3", + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, + "ws": { + "version": "7.5.7", + "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" + }, + "xml2js": { + "version": "0.4.23", + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + } + }, + "xmlbuilder": { + "version": "11.0.1" + }, + "xmlchars": { + "version": "2.2.0" + }, + "xmlcreate": { + "version": "1.0.2" + }, + "xmldom": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.6.0.tgz", + "integrity": "sha512-iAcin401y58LckRZ0TkI4k0VSM1Qg0KGSc3i8rU+xrxe19A/BN1zHyVSJY7uoutVlaTSzYyk/v5AmkewAP7jtg==" + }, + "xtend": { + "version": "1.0.3" + }, + "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" + }, + "dependencies": { + "js-yaml": { + "version": "3.14.1", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + } + } + }, + "yamljs": { + "version": "0.3.0", + "requires": { + "argparse": "^1.0.7", + "glob": "^7.0.5" + } + }, + "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" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.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" + } + }, + "strip-ansi": { + "version": "6.0.1", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "yargs-parser": { + "version": "18.1.3", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "requires": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + } + } +} diff --git a/package.json b/package.json index a10e445ed..8fa177646 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "1.0.0", + "version": "23.14.01", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", @@ -12,19 +12,24 @@ "node": ">=14" }, "dependencies": { - "axios": "^0.25.0", + "axios": "^1.2.2", + "base64url": "^3.0.1", + "bcrypt": "^5.0.1", "bmp-js": "^0.1.0", "compression": "^1.7.3", + "form-data": "^4.0.0", "fs-extra": "^5.0.0", "ftps": "^1.2.0", + "gm": "^1.25.0", "got": "^10.7.0", "helmet": "^3.21.2", "i18n": "^0.8.4", "image-type": "^4.1.0", "imap": "^0.8.19", + "jsdom": "^16.7.0", "jszip": "^3.10.0", "ldapjs": "^2.2.0", - "loopback": "^3.26.0", + "loopback": "^3.28.0", "loopback-boot": "3.3.1", "loopback-component-explorer": "^6.5.0", "loopback-component-storage": "3.6.1", @@ -36,10 +41,10 @@ "node-ssh": "^11.0.0", "object-diff": "0.0.4", "object.pick": "^1.3.0", - "puppeteer": "^7.1.0", + "puppeteer": "^18.0.5", "read-chunk": "^3.2.0", "require-yaml": "0.0.1", - "sharp": "^0.27.1", + "sharp": "^0.31.3", "smbhash": "0.0.1", "strong-error-handler": "^2.3.2", "uuid": "^3.3.3", @@ -77,7 +82,7 @@ "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": "^4.5.0", "jasmine-reporters": "^2.4.0", "jasmine-spec-reporter": "^7.0.0", "jest": "^26.0.1", diff --git a/print/boot.js b/print/boot.js deleted file mode 100644 index d5c06264c..000000000 --- a/print/boot.js +++ /dev/null @@ -1,54 +0,0 @@ -const express = require('express'); -const path = require('path'); -const fs = require('fs'); - -const templatesPath = path.resolve(__dirname, './templates'); -const componentsPath = path.resolve(__dirname, './core/components'); - -module.exports = async app => { - global.appPath = __dirname; - - process.env.OPENSSL_CONF = '/etc/ssl/'; - - // Extended locale intl polyfill - const IntlPolyfill = require('intl'); - Intl.NumberFormat = IntlPolyfill.NumberFormat; - Intl.DateTimeFormat = IntlPolyfill.DateTimeFormat; - - // Init database instance - require('./core/database').init(); - // Init SMTP Instance - require('./core/smtp').init(); - require('./core/mixins'); - require('./core/filters'); - require('./core/directives'); - // Init router - require('./core/router')(app); - - /** - * Serve component static files - */ - const componentsDir = fs.readdirSync(componentsPath); - componentsDir.forEach(componentName => { - const componentDir = path.join(componentsPath, '/', componentName); - const assetsDir = `${componentDir}/assets`; - - app.use(`/api/${componentName}/assets`, express.static(assetsDir)); - }); - - /** - * Serve static files - */ - const templatesDir = fs.readdirSync(templatesPath); - templatesDir.forEach(directory => { - const templateTypeDir = path.join(templatesPath, '/', directory); - const templates = fs.readdirSync(templateTypeDir); - - templates.forEach(templateName => { - const templateDir = path.join(templatesPath, '/', directory, '/', templateName); - const assetsDir = `${templateDir}/assets`; - - app.use(`/api/${templateName}/assets`, express.static(assetsDir)); - }); - }); -}; diff --git a/print/common/css/email.css b/print/common/css/email.css index 6e6350ff5..5fe3b955e 100644 --- a/print/common/css/email.css +++ b/print/common/css/email.css @@ -31,3 +31,8 @@ h1 { font-weight: 100; font-size: 1.5em } + +h6 { + font-weight: 100; + font-size: 1.2em +} diff --git a/print/common/css/misc.css b/print/common/css/misc.css index df8bf571a..ce6c641a0 100644 --- a/print/common/css/misc.css +++ b/print/common/css/misc.css @@ -49,4 +49,10 @@ .page-break-after { page-break-after: always; +} + +.ellipsize { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; } \ No newline at end of file diff --git a/print/core/cluster.js b/print/core/cluster.js new file mode 100644 index 000000000..23b3d88e9 --- /dev/null +++ b/print/core/cluster.js @@ -0,0 +1,43 @@ +const {Cluster} = require('puppeteer-cluster'); +const log4js = require('log4js'); +const {cpus} = require('os'); + +module.exports = { + init() { + if (!this.pool) { + Cluster.launch({ + concurrency: Cluster.CONCURRENCY_CONTEXT, + maxConcurrency: cpus().length, + puppeteerOptions: { + headless: true, + args: [ + '--no-sandbox', + '--disable-setuid-sandbox', + '--no-zygote' + ] + } + }) + .then(cluster => { + this.pool = cluster; + + log4js.configure({ + appenders: { + out: {type: 'stdout'} + }, + categories: {default: {appenders: ['out'], level: 'info'}}, + }); + + const logger = log4js.getLogger(); + + cluster.on('taskerror', (err, data, willRetry) => { + if (willRetry) + logger.warn(`[Print] => ${err.message}\nThis job will be retried`); + else + logger.error(`[Print] => ${err.message}`); + }); + + cluster.on('queue', () => logger.info('Printing task initialized by pool')); + }); + } + } +}; diff --git a/print/core/component.js b/print/core/component.js index 37656c240..06ef3033a 100644 --- a/print/core/component.js +++ b/print/core/component.js @@ -53,21 +53,21 @@ class Component { } async getUserLocale() { - let locale = this.args.auth.locale; + let lang = this.args.lang; // Fetches user locale from mixing method getLocale() if (this.args.recipientId) { const component = await this.component(); - locale = await component.getLocale(this.args.recipientId); + lang = await component.getLocale(this.args.recipientId); } const messages = this.locale.messages; - const userTranslations = messages[locale]; + const userTranslations = messages[lang]; if (!userTranslations) { - const fallbackLocale = config.i18n.fallbackLocale; + const fallbackLang = config.i18n.fallbackLocale; - return messages[fallbackLocale]; + return messages[fallbackLang]; } return userTranslations; diff --git a/print/core/components/attachment/assets/css/import.js b/print/core/components/attachment/assets/css/import.js index c742fdf90..fec23d870 100644 --- a/print/core/components/attachment/assets/css/import.js +++ b/print/core/components/attachment/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/core/components/attachment/assets/css/style.css b/print/core/components/attachment/assets/css/style.css index 775c43ada..37fde9285 100644 --- a/print/core/components/attachment/assets/css/style.css +++ b/print/core/components/attachment/assets/css/style.css @@ -4,19 +4,22 @@ div { } a { - background-color: #F5F5F5; + background-color: #fcfcfc; border: 1px solid #CCC; display: flex; vertical-align: middle; box-sizing: border-box; min-width: 150px; text-decoration: none; - border-radius: 3px; + border-radius: 8px; color: #8dba25 } a > div.icon { + border-radius: 5px; + padding: 2px 5px; + background-color: red; font-weight: bold; - font-size: 18px; - color: #555 + font-size: 12px; + color: #FFF } \ No newline at end of file diff --git a/print/core/components/attachment/attachment.html b/print/core/components/attachment/attachment.html index 88fa64434..0044190a7 100644 --- a/print/core/components/attachment/attachment.html +++ b/print/core/components/attachment/attachment.html @@ -1,6 +1,10 @@ -
+ \ No newline at end of file diff --git a/print/core/components/attachment/attachment.js b/print/core/components/attachment/attachment.js index 5c78a895c..30e1944a4 100755 --- a/print/core/components/attachment/attachment.js +++ b/print/core/components/attachment/attachment.js @@ -4,10 +4,10 @@ module.exports = { attachmentPath() { const filename = this.attachment.filename; const component = this.attachment.component; - if (this.attachment.cid) + if (this.attachment.cid && component) return `/api/${component}/assets/files/${filename}`; - else - return `/api/report/${component}?${this.getHttpParams()}`; + else if (this.attachment.path) + return `/api/${this.attachment.path}?${this.getHttpParams()}`; } }, methods: { @@ -15,7 +15,7 @@ module.exports = { const props = this.args; let query = ''; for (let param in props) { - if (!(props[param] instanceof Object)) { + if (props[param] && !(props[param] instanceof Object)) { if (query != '') query += '&'; query += `${param}=${props[param]}`; } diff --git a/print/core/components/email-body/assets/css/import.js b/print/core/components/email-body/assets/css/import.js new file mode 100644 index 000000000..4b4bb7086 --- /dev/null +++ b/print/core/components/email-body/assets/css/import.js @@ -0,0 +1,11 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) + .mergeStyles(); diff --git a/print/core/components/email-body/email-body.html b/print/core/components/email-body/email-body.html new file mode 100644 index 000000000..962d029d2 --- /dev/null +++ b/print/core/components/email-body/email-body.html @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + +
+
+
+
+ +
+
+ +
+
+
+ + +
+
+ +
+
+
+
+
+
+
+ + diff --git a/print/core/components/email-body/email-body.js b/print/core/components/email-body/email-body.js new file mode 100644 index 000000000..4b59bed2e --- /dev/null +++ b/print/core/components/email-body/email-body.js @@ -0,0 +1,12 @@ + +const Component = require(`vn-print/core/component`); +const emailHeader = new Component('email-header'); +const emailFooter = new Component('email-footer'); + +module.exports = { + components: { + 'email-header': emailHeader.build(), + 'email-footer': emailFooter.build() + }, + name: 'email-body', +}; diff --git a/print/core/components/email-footer/assets/css/import.js b/print/core/components/email-footer/assets/css/import.js index c742fdf90..4f6f631f7 100644 --- a/print/core/components/email-footer/assets/css/import.js +++ b/print/core/components/email-footer/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`, `${__dirname}/style.css`]) - .mergeStyles(); + .mergeStyles(); \ No newline at end of file diff --git a/print/core/components/email-footer/email-footer.html b/print/core/components/email-footer/email-footer.html index a033ec633..9c5df59a9 100644 --- a/print/core/components/email-footer/email-footer.html +++ b/print/core/components/email-footer/email-footer.html @@ -3,7 +3,7 @@
- +
{{ $t('buttons.webAcccess')}} diff --git a/print/core/components/email-footer/locale/en.yml b/print/core/components/email-footer/locale/en.yml index d18bfe315..cbaf55143 100644 --- a/print/core/components/email-footer/locale/en.yml +++ b/print/core/components/email-footer/locale/en.yml @@ -2,7 +2,7 @@ buttons: webAcccess: Visit our website info: Help us to improve fiscalAddress: VERDNATURA LEVANTE SL, B97367486 C/ Fenollar, 2. 46680 ALGEMESI - · www.verdnatura.es · clientes@verdnatura.es + · verdnatura.es · clientes@verdnatura.es disclaimer: '- NOTICE - This message is private and confidential, and should be used exclusively by the person receiving it. If you have received this message by mistake, please notify the sender and delete that message and any attached documents that it may contain. diff --git a/print/core/components/email-footer/locale/es.yml b/print/core/components/email-footer/locale/es.yml index 1269a3e60..73b30af34 100644 --- a/print/core/components/email-footer/locale/es.yml +++ b/print/core/components/email-footer/locale/es.yml @@ -2,7 +2,7 @@ buttons: webAcccess: Visita nuestra Web info: Ayúdanos a mejorar fiscalAddress: VERDNATURA LEVANTE SL, B97367486 C/ Fenollar, 2. 46680 ALGEMESI - · www.verdnatura.es · clientes@verdnatura.es + · verdnatura.es · clientes@verdnatura.es disclaimer: '- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si has recibido este mensaje por error, te rogamos lo comuniques al remitente y borres dicho mensaje y cualquier diff --git a/print/core/components/email-footer/locale/fr.yml b/print/core/components/email-footer/locale/fr.yml index 70d4381e6..6c18eec44 100644 --- a/print/core/components/email-footer/locale/fr.yml +++ b/print/core/components/email-footer/locale/fr.yml @@ -2,7 +2,7 @@ buttons: webAcccess: Visitez notre site web info: Aidez-nous à améliorer fiscalAddress: VERDNATURA LEVANTE SL, B97367486 C/ Fenollar, 2. 46680 ALGEMESI - · www.verdnatura.es · clientes@verdnatura.es + · verdnatura.es · clientes@verdnatura.es disclaimer: "- AVIS - Ce message est privé et confidentiel et doit être utilisé exclusivement par le destinataire. Si vous avez reçu ce message par erreur, veuillez en informer l'expéditeur et supprimer ce message ainsi que tous les diff --git a/print/core/components/email-footer/locale/pt.yml b/print/core/components/email-footer/locale/pt.yml index b8161dd19..bb552b62a 100644 --- a/print/core/components/email-footer/locale/pt.yml +++ b/print/core/components/email-footer/locale/pt.yml @@ -2,7 +2,7 @@ buttons: webAcccess: Visite o nosso site info: Ajude-nos a melhorar fiscalAddress: VERDNATURA LEVANTE SL, B97367486 C/ Fenollar, 2. 46680 ALGEMESI - · www.verdnatura.es · clientes@verdnatura.es + · verdnatura.es · clientes@verdnatura.es disclaimer: '- AVISO - Esta mensagem é privada e confidencial e deve ser usada exclusivamente pela pessoa que a recebe. Se você recebeu esta mensagem por engano, notifique o remetente e exclua essa mensagem e todos os documentos anexos que ela possa conter. diff --git a/print/core/components/email-header/assets/css/import.js b/print/core/components/email-header/assets/css/import.js index c742fdf90..4f6f631f7 100644 --- a/print/core/components/email-header/assets/css/import.js +++ b/print/core/components/email-header/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`, `${__dirname}/style.css`]) - .mergeStyles(); + .mergeStyles(); \ No newline at end of file diff --git a/print/core/components/email-header/email-header.html b/print/core/components/email-header/email-header.html index 87834e2ae..5df4b8a96 100644 --- a/print/core/components/email-header/email-header.html +++ b/print/core/components/email-header/email-header.html @@ -1,7 +1,7 @@
diff --git a/print/core/components/report-body/assets/css/import.js b/print/core/components/report-body/assets/css/import.js new file mode 100644 index 000000000..953c68a56 --- /dev/null +++ b/print/core/components/report-body/assets/css/import.js @@ -0,0 +1,10 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, + `${vnPrintPath}/common/css/misc.css`]) + .mergeStyles(); diff --git a/print/core/components/report-body/report-body.html b/print/core/components/report-body/report-body.html new file mode 100644 index 000000000..827014d2e --- /dev/null +++ b/print/core/components/report-body/report-body.html @@ -0,0 +1,20 @@ + + + + + + + + + +
+ + + + + + + +
+ + diff --git a/print/core/components/report-body/report-body.js b/print/core/components/report-body/report-body.js new file mode 100644 index 000000000..493443006 --- /dev/null +++ b/print/core/components/report-body/report-body.js @@ -0,0 +1,12 @@ + +const Component = require(`vn-print/core/component`); +const reportHeader = new Component('report-header'); +const reportFooter = new Component('report-footer'); + +module.exports = { + name: 'report-body', + components: { + 'report-header': reportHeader.build(), + 'report-footer': reportFooter.build() + }, +}; diff --git a/print/core/components/report-footer/assets/css/import.js b/print/core/components/report-footer/assets/css/import.js index a2a9334cb..71fa00f4b 100644 --- a/print/core/components/report-footer/assets/css/import.js +++ b/print/core/components/report-footer/assets/css/import.js @@ -1,8 +1,11 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, - `${appPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, + `${vnPrintPath}/common/css/misc.css`, `${__dirname}/style.css`]) - .mergeStyles(); + .mergeStyles(); \ No newline at end of file diff --git a/print/core/components/report-header/assets/css/import.js b/print/core/components/report-header/assets/css/import.js index a2a9334cb..e21d3821a 100644 --- a/print/core/components/report-header/assets/css/import.js +++ b/print/core/components/report-header/assets/css/import.js @@ -1,8 +1,11 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, - `${appPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, + `${vnPrintPath}/common/css/misc.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/core/components/report-header/locale/en.yml b/print/core/components/report-header/locale/en.yml index 334f50ce9..9989cd81f 100644 --- a/print/core/components/report-header/locale/en.yml +++ b/print/core/components/report-header/locale/en.yml @@ -1,2 +1,2 @@ company: - contactData: www.verdnatura.es - clientes@verdnatura.es \ No newline at end of file + contactData: verdnatura.es - clientes@verdnatura.es \ No newline at end of file diff --git a/print/core/components/report-header/locale/es.yml b/print/core/components/report-header/locale/es.yml index fe4222eb0..eb8419f0a 100644 --- a/print/core/components/report-header/locale/es.yml +++ b/print/core/components/report-header/locale/es.yml @@ -1,2 +1,2 @@ company: - contactData: www.verdnatura.es - clientes@verdnatura.es + contactData: verdnatura.es - clientes@verdnatura.es diff --git a/print/core/components/report-header/locale/fr.yml b/print/core/components/report-header/locale/fr.yml index fe4222eb0..eb8419f0a 100644 --- a/print/core/components/report-header/locale/fr.yml +++ b/print/core/components/report-header/locale/fr.yml @@ -1,2 +1,2 @@ company: - contactData: www.verdnatura.es - clientes@verdnatura.es + contactData: verdnatura.es - clientes@verdnatura.es diff --git a/print/core/components/report-header/locale/pt.yml b/print/core/components/report-header/locale/pt.yml index 4e138c69c..2ecb247f2 100644 --- a/print/core/components/report-header/locale/pt.yml +++ b/print/core/components/report-header/locale/pt.yml @@ -1,2 +1,2 @@ company: - contactData: · www.verdnatura.es · clientes@verdnatura.es \ No newline at end of file + contactData: · verdnatura.es · clientes@verdnatura.es \ No newline at end of file diff --git a/print/core/database.js b/print/core/database.js index 6c690afc6..ddc0153bd 100644 --- a/print/core/database.js +++ b/print/core/database.js @@ -1,21 +1,21 @@ const mysql = require('mysql2'); -const config = require('./config.js'); const fs = require('fs-extra'); -const PoolConnection = mysql.PoolConnection; module.exports = { - init() { - if (!this.pool) { - const datasources = config.datasources; - const pool = mysql.createPoolCluster(); + defaultDataSource: 'vn', - for (let datasource of datasources) - pool.add(datasource.name, datasource.options); + init(dataSource) { + if (!this.connections) { + this.connections = []; - this.pool = pool; + const dataSources = ['vn', 'osticket']; + for (const name of dataSources) + this.connections[name] = dataSource[name].connector.client; + + this.pool = this.connections[this.defaultDataSource]; } - return this.pool; + return this.connections; }, /** @@ -24,15 +24,8 @@ module.exports = { * * @return {Object} - Pool connection */ - getConnection(name = 'default') { - let pool = this.pool; - return new Promise((resolve, reject) => { - pool.getConnection(name, function(error, connection) { - if (error) return reject(error); - - resolve(connection); - }); - }); + getConnection(name = this.defaultDataSource) { + return this.connections[name]; }, /** @@ -44,28 +37,14 @@ module.exports = { * @return {Object} - Result promise */ rawSql(query, params, connection) { - let pool = this.pool; - if (params instanceof PoolConnection) - connection = params; - if (connection) pool = connection; - return new Promise((resolve, reject) => { - if (!connection) { - pool.getConnection('default', function(error, conn) { - if (error) return reject(error); + let db = this.getConnection(); + if (connection) db = connection; - conn.query(query, params, (error, rows) => { - if (error) return reject(error); - conn.release(); - resolve(rows); - }); - }); - } else { - connection.query(query, params, (error, rows) => { - if (error) return reject(error); - resolve(rows); - }); - } + db.query(query, params, (error, rows) => { + if (error) return reject(error); + resolve(rows); + }); }); }, @@ -87,22 +66,25 @@ module.exports = { * Returns the first row from a given raw sql * @param {String} query - The raw SQL query * @param {Object} params - Parameterized values + * @param {Object} connection - Optional pool connection * * @return {Object} - Result promise */ - findOne(query, params) { - return this.rawSql(query, params).then(([row]) => row); + findOne(query, params, connection) { + return this.rawSql(query, params, connection) + .then(([row]) => row); }, /** * Returns the first row from a given SQL file * @param {String} queryName - The SQL file name * @param {Object} params - Parameterized values + * @param {Object} connection - Optional pool connection * * @return {Object} - Result promise */ - findOneFromDef(queryName, params) { - return this.rawSqlFromDef(queryName, params) + findOneFromDef(queryName, params, connection) { + return this.rawSqlFromDef(queryName, params, connection) .then(([row]) => row); }, @@ -110,11 +92,12 @@ module.exports = { * Returns the first property from a given raw sql * @param {String} query - The raw SQL query * @param {Object} params - Parameterized values + * @param {Object} connection - Optional pool connection * * @return {Object} - Result promise */ - findValue(query, params) { - return this.findOne(query, params).then(row => { + findValue(query, params, connection) { + return this.findOne(query, params, connection).then(row => { return Object.values(row)[0]; }); }, @@ -123,13 +106,13 @@ module.exports = { * Returns the first property from a given SQL file * @param {String} queryName - The SQL file name * @param {Object} params - Parameterized values + * @param {Object} connection - Optional pool connection * * @return {Object} - Result promise */ - findValueFromDef(queryName, params) { - return this.findOneFromDef(queryName, params).then(row => { - return Object.values(row)[0]; - }); + findValueFromDef(queryName, params, connection) { + return this.findOneFromDef(queryName, params, connection) + .then(row => Object.values(row)[0]); }, /** diff --git a/print/core/directives/index.js b/print/core/directives/index.js deleted file mode 100644 index 3ba4d8895..000000000 --- a/print/core/directives/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// Import global directives -require('./pin'); diff --git a/print/core/directives/pin.js b/print/core/directives/pin.js deleted file mode 100644 index bf4bb6e6e..000000000 --- a/print/core/directives/pin.js +++ /dev/null @@ -1,9 +0,0 @@ -// DIRECTIVES NOT WORKING -const Vue = require('vue'); -Vue.directive('pin', { - bind: function(el, binding, vnode) { - el.style.position = 'fixed'; - el.style.top = binding.value + 'px'; - el.style.backgroundColor = 'red'; - } -}); diff --git a/print/core/email.js b/print/core/email.js index bc8345cab..6e96f5c2e 100644 --- a/print/core/email.js +++ b/print/core/email.js @@ -1,6 +1,5 @@ const path = require('path'); const smtp = require('./smtp'); -const config = require('./config'); const Component = require('./component'); const Report = require('./report'); @@ -33,7 +32,7 @@ class Email extends Component { const rendered = await this.render(); const attachments = []; const getAttachments = async(componentPath, files) => { - for (file of files) { + for (const file of files) { const fileCopy = Object.assign({}, file); const fileName = fileCopy.filename; @@ -55,15 +54,22 @@ class Email extends Component { } }; - if (instance.components) { - const components = instance.components; - for (let componentName in components) { - const component = components[componentName]; - const componentPath = `./components/${componentName}`; - await getAttachments(componentPath, component.attachments); + async function getSubcomponentAttachments(instance) { + if (instance.components) { + const components = instance.components; + for (let componentName in components) { + const component = components[componentName]; + const componentPath = `./components/${componentName}`; + await getAttachments(componentPath, component.attachments); + + if (component.components) + await getSubcomponentAttachments(component) + } } } + await getSubcomponentAttachments(instance) + if (this.attachments) await getAttachments(this.path, this.attachments); @@ -73,10 +79,9 @@ class Email extends Component { } const localeSubject = await this.getSubject(); - const replyTo = this.args.replyTo || this.args.auth.email; const mailOptions = { to: this.args.recipient, - replyTo: replyTo, + replyTo: this.args.replyTo || '', subject: localeSubject, html: rendered, attachments: attachments diff --git a/print/core/filters/index.js b/print/core/filters/index.js index efc398508..bfd99c504 100644 --- a/print/core/filters/index.js +++ b/print/core/filters/index.js @@ -4,5 +4,4 @@ require('./uppercase'); require('./currency'); require('./percentage'); require('./number'); -require('./zerofill'); diff --git a/print/core/filters/specs/zerofill.spec.js b/print/core/filters/specs/zerofill.spec.js deleted file mode 100644 index 1c00ff4a7..000000000 --- a/print/core/filters/specs/zerofill.spec.js +++ /dev/null @@ -1,9 +0,0 @@ -import zerofill from '../zerofill.js'; - -describe('zerofill filter', () => { - const superDuperNumber = 1984; - - it('should filter the number filling it with zeros up to 6 characters length', () => { - expect(zerofill(superDuperNumber, '000000')).toEqual('001984'); - }); -}); diff --git a/print/core/filters/zerofill.js b/print/core/filters/zerofill.js deleted file mode 100644 index c3d18079b..000000000 --- a/print/core/filters/zerofill.js +++ /dev/null @@ -1,10 +0,0 @@ -const Vue = require('vue'); - -const zerofill = function(value, pad) { - const valueStr = String(value); - return pad.substring(0, pad.length - valueStr.length) + valueStr; -}; - -Vue.filter('zerofill', zerofill); - -module.exports = zerofill; diff --git a/print/core/mixins/prop-validator.js b/print/core/mixins/prop-validator.js index 16c71a6db..cb41d3dd8 100644 --- a/print/core/mixins/prop-validator.js +++ b/print/core/mixins/prop-validator.js @@ -4,7 +4,7 @@ const validator = { const props = this.$options.props; const invalidProps = []; - for (prop in props) { + for (const prop in props) { const isObject = typeof props[prop] === 'object'; const isRequired = props[prop].required; const isNotDefined = this[prop] === undefined; @@ -19,7 +19,7 @@ const validator = { throw new Error(`Required properties not found [${required}]`); } }, - props: ['isPreview', 'authorization'] + props: ['isPreview', 'access_token'] }; Vue.mixin(validator); diff --git a/print/core/mixins/user-locale.js b/print/core/mixins/user-locale.js index 0e4727334..18b4c68c5 100644 --- a/print/core/mixins/user-locale.js +++ b/print/core/mixins/user-locale.js @@ -24,7 +24,7 @@ const userLocale = { }); } }, - props: ['auth', 'recipientId'] + props: ['recipientId'] }; Vue.mixin(userLocale); diff --git a/print/core/mixins/vn-report.js b/print/core/mixins/vn-report.js new file mode 100644 index 000000000..4831d8cd9 --- /dev/null +++ b/print/core/mixins/vn-report.js @@ -0,0 +1,23 @@ +const Component = require(`vn-print/core/component`); +const reportHeader = new Component('report-header'); +const reportFooter = new Component('report-footer'); +const reportBody = new Component('report-body'); +const NotFoundError = require('vn-loopback/util/not-found-error'); + +module.exports = { + components: { + 'report-body': reportBody.build(), + 'report-header': reportHeader.build(), + 'report-footer': reportFooter.build() + }, + methods: { + checkMainEntity: function(entity) { + if (entity == null) + throw new NotFoundError(); + }, + formatDate: function(date, format) { + const filters = this.$options.filters; + return filters.date(date, format); + } + }, +}; diff --git a/print/core/report.js b/print/core/report.js index 093f5e99e..c5182d1a8 100644 --- a/print/core/report.js +++ b/print/core/report.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const config = require('./config'); const Component = require('./component'); -const puppeteer = require('puppeteer'); +const Cluster = require('./cluster'); if (!process.env.OPENSSL_CONF) process.env.OPENSSL_CONF = '/etc/ssl/'; @@ -32,39 +32,30 @@ class Report extends Component { if (fs.existsSync(fullPath)) options = require(optionsPath); - const browser = await puppeteer.launch({ - headless: true, - args: [ - '--no-sandbox', - '--disable-setuid-sandbox', - '--single-process', - '--no-zygote' - ] + return new Promise(resolve => { + Cluster.pool.queue({}, async({page}) => { + await page.emulateMediaType('screen'); + await page.setContent(template); + + const element = await page.$('#pageFooter'); + + let footer = '\n'; + if (element) { + footer = await page.evaluate(el => { + const html = el.innerHTML; + el.remove(); + return html; + }, element); + } + + options.headerTemplate = '\n'; + options.footerTemplate = footer; + + const stream = await page.pdf(options); + + resolve(stream); + }); }); - - const page = (await browser.pages())[0]; - await page.emulateMedia('screen'); - await page.setContent(template); - - const element = await page.$('#pageFooter'); - - let footer = '\n'; - if (element) { - footer = await page.evaluate(el => { - const html = el.innerHTML; - el.remove(); - return html; - }, element); - } - - options.headerTemplate = '\n'; - options.footerTemplate = footer; - - const buffer = await page.pdf(options); - - await browser.close(); - - return buffer; } /** diff --git a/print/core/router.js b/print/core/router.js deleted file mode 100644 index cd64ba07e..000000000 --- a/print/core/router.js +++ /dev/null @@ -1,62 +0,0 @@ -const db = require('./database'); - -module.exports = app => { - const routes = require('../methods/routes'); - - const paths = routes.map(route => route.url); - - app.use(paths, async function(request, response, next) { - try { - const token = getToken(request); - const query = `SELECT at.id, at.userId, eu.email, u.lang, at.ttl, at.created - FROM salix.AccessToken at - JOIN account.user u ON u.id = at.userid - JOIN account.emailUser eu ON eu.userFk = u.id - WHERE at.id = ?`; - - const auth = await db.findOne(query, [token]); - - if (!auth || isTokenExpired(auth.created, auth.ttl)) - throw new Error('Invalid authorization token'); - - const args = Object.assign({}, request.query); - const props = Object.assign(args, request.body); - props.authorization = auth.id; - - response.locals = props; - response.locals.auth = { - userId: auth.userId, - token: auth.id, - email: auth.email, - locale: auth.lang - }; - - next(); - } catch (error) { - next(error); - } - }); - - // Register routes - for (let route of routes) - app.use(route.url, route.cb); - - function getToken(request) { - const headers = request.headers; - const queryParams = request.query; - - return headers.authorization || queryParams.authorization; - } - - function isTokenExpired(created, ttl) { - const date = new Date(created); - const currentDate = new Date(); - - date.setSeconds(date.getSeconds() + ttl); - - if (currentDate > date) - return true; - - return false; - } -}; diff --git a/print/core/smtp.js b/print/core/smtp.js index 50a413673..61b115b5a 100644 --- a/print/core/smtp.js +++ b/print/core/smtp.js @@ -8,10 +8,12 @@ module.exports = { this.transporter = nodemailer.createTransport(config.smtp); }, - send(options) { + async send(options) { options.from = `${config.app.senderName} <${config.app.senderEmail}>`; if (process.env.NODE_ENV !== 'production') { + const notProductionError = {message: 'This not production, this email not sended'}; + await this.mailLog(options, notProductionError); if (!config.smtp.auth.user) return Promise.resolve(true); @@ -24,29 +26,35 @@ module.exports = { throw err; }).finally(async() => { - const attachments = []; - if (options.attachments) { - for (let attachment of options.attachments) { - const fileName = attachment.filename; - const filePath = attachment.path; - if (fileName.includes('.png')) return; - - if (fileName || filePath) - attachments.push(filePath ? filePath : fileName); - } - } - - const fileNames = attachments.join(',\n'); - await db.rawSql(` - INSERT INTO vn.mail (receiver, replyTo, sent, subject, body, attachment, status) - VALUES (?, ?, 1, ?, ?, ?, ?)`, [ - options.to, - options.replyTo, - options.subject, - options.text || options.html, - fileNames, - error && error.message || 'Sent' - ]); + await this.mailLog(options, error); }); + }, + + async mailLog(options, error) { + const attachments = []; + if (options.attachments) { + for (let attachment of options.attachments) { + const fileName = attachment.filename; + const filePath = attachment.path; + if (fileName.includes('.png')) continue; + + if (fileName || filePath) + attachments.push(filePath ? filePath : fileName); + } + } + + const fileNames = attachments.join(',\n'); + + await db.rawSql(` + INSERT INTO vn.mail (receiver, replyTo, sent, subject, body, attachment, status) + VALUES (?, ?, 1, ?, ?, ?, ?)`, [ + options.to, + options.replyTo, + options.subject, + options.text || options.html, + fileNames, + error && error.message || 'Sent' + ]); } + }; diff --git a/print/core/stylesheet.js b/print/core/stylesheet.js index 42a44fb57..195044f02 100644 --- a/print/core/stylesheet.js +++ b/print/core/stylesheet.js @@ -1,4 +1,5 @@ const fs = require('fs-extra'); +const path = require('path'); class Stylesheet { constructor(files) { @@ -7,8 +8,9 @@ class Stylesheet { } mergeStyles() { - for (const file of this.files) + for (const file of this.files) { this.css.push(fs.readFileSync(file)); + } return this.css.join('\n'); } diff --git a/print/index.js b/print/index.js new file mode 100644 index 000000000..2ed713897 --- /dev/null +++ b/print/index.js @@ -0,0 +1,53 @@ +const express = require('express'); +const path = require('path'); +const fs = require('fs'); + +const templatesPath = path.resolve(__dirname, './templates'); +const componentsPath = path.resolve(__dirname, './core/components'); + +module.exports = { + async boot(app) { + // Extended locale intl polyfill + const IntlPolyfill = require('intl'); + Intl.NumberFormat = IntlPolyfill.NumberFormat; + Intl.DateTimeFormat = IntlPolyfill.DateTimeFormat; + + // Init database instance + require('./core/database').init(app.dataSources); + require('./core/smtp').init(); + require('./core/cluster').init(); + require('./core/mixins'); + require('./core/filters'); + + const componentsDir = fs.readdirSync(componentsPath); + componentsDir.forEach(componentName => { + const componentDir = path.join(componentsPath, '/', componentName); + const assetsDir = `${componentDir}/assets`; + + app.use(`/api/${componentName}/assets`, express.static(assetsDir)); + }); + + /** + * Serve static files + */ + const templatesDir = fs.readdirSync(templatesPath); + templatesDir.forEach(directory => { + const templateTypeDir = path.join(templatesPath, '/', directory); + const templates = fs.readdirSync(templateTypeDir); + + templates.forEach(templateName => { + const templateDir = path.join(templatesPath, '/', directory, '/', templateName); + const assetsDir = `${templateDir}/assets`; + + app.use(`/api/${templateName}/assets`, express.static(assetsDir)); + }); + }); + + return true; + }, + Email: require('./core/email'), + Report: require('./core/report'), + storage: require('./core/storage'), + smtp: require('./core/smtp'), + db: require('./core/database') +}; diff --git a/print/methods/closure/closeByAgency.js b/print/methods/closure/closeByAgency.js deleted file mode 100644 index 7807de23a..000000000 --- a/print/methods/closure/closeByAgency.js +++ /dev/null @@ -1,58 +0,0 @@ -const db = require('vn-print/core/database'); -const closure = require('./closure'); - -module.exports = async function(request, response, next) { - try { - const reqArgs = request.query; - - if (!reqArgs.agencyModeId) - throw new Error('The argument agencyModeId is required'); - - if (!reqArgs.warehouseId) - throw new Error('The argument warehouseId is required'); - - if (!reqArgs.to) - throw new Error('The argument to is required'); - - response.status(200).json({ - message: 'Success' - }); - - const agencyIds = reqArgs.agencyModeId.split(','); - const tickets = await db.rawSql(` - SELECT - t.id, - t.clientFk, - c.name clientName, - c.email recipient, - c.salesPersonFk, - c.isToBeMailed, - c.hasToInvoice, - co.hasDailyInvoice, - eu.email salesPersonEmail - FROM expedition e - JOIN ticket t ON t.id = e.ticketFk - JOIN ticketState ts ON ts.ticketFk = t.id - JOIN alertLevel al ON al.id = ts.alertLevel - JOIN client c ON c.id = t.clientFk - 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 al.code = 'PACKED' - AND t.agencyModeFk IN(?) - AND t.warehouseFk = ? - AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) - AND util.dayEnd(?) - AND t.refFk IS NULL - GROUP BY e.ticketFk`, [ - agencyIds, - reqArgs.warehouseId, - reqArgs.to, - reqArgs.to - ]); - - await closure.start(tickets, response.locals); - } catch (error) { - next(error); - } -}; diff --git a/print/methods/closure/closure.js b/print/methods/closure/closure.js deleted file mode 100644 index 2b58205e3..000000000 --- a/print/methods/closure/closure.js +++ /dev/null @@ -1,149 +0,0 @@ -const db = require('vn-print/core/database'); -const Report = require('vn-print/core/report'); -const Email = require('vn-print/core/email'); -const smtp = require('vn-print/core/smtp'); -const config = require('vn-print/core/config'); -const storage = require('vn-print/core/storage'); - -module.exports = { - async start(tickets, reqArgs) { - if (tickets.length == 0) return; - - const failedtickets = []; - for (const ticket of tickets) { - try { - await db.rawSql(`CALL vn.ticket_closeByTicket(?)`, [ticket.id]); - - const invoiceOut = await db.findOne(` - SELECT io.id, io.ref, io.serial, cny.code companyCode, io.issued - FROM ticket t - JOIN invoiceOut io ON io.ref = t.refFk - JOIN company cny ON cny.id = io.companyFk - WHERE t.id = ? - `, [ticket.id]); - - const mailOptions = { - overrideAttachments: true, - attachments: [] - }; - - const isToBeMailed = ticket.recipient && ticket.salesPersonFk && ticket.isToBeMailed; - - if (invoiceOut) { - const args = Object.assign({ - invoiceId: invoiceOut.id, - recipientId: ticket.clientFk, - recipient: ticket.recipient, - replyTo: ticket.salesPersonEmail - }, reqArgs); - - const invoiceReport = new Report('invoice', args); - const stream = await invoiceReport.toPdfStream(); - - const issued = invoiceOut.issued; - const year = issued.getFullYear().toString(); - const month = (issued.getMonth() + 1).toString(); - const day = issued.getDate().toString(); - - const fileName = `${year}${invoiceOut.ref}.pdf`; - - // Store invoice - storage.write(stream, { - type: 'invoice', - path: `${year}/${month}/${day}`, - fileName: fileName - }); - - await db.rawSql('UPDATE invoiceOut SET hasPdf = true WHERE id = ?', [invoiceOut.id]); - - if (isToBeMailed) { - const invoiceAttachment = { - filename: fileName, - content: stream - }; - - if (invoiceOut.serial == 'E' && invoiceOut.companyCode == 'VNL') { - const exportation = new Report('exportation', args); - const stream = await exportation.toPdfStream(); - const fileName = `CITES-${invoiceOut.ref}.pdf`; - - mailOptions.attachments.push({ - filename: fileName, - content: stream - }); - } - - mailOptions.attachments.push(invoiceAttachment); - - const email = new Email('invoice', args); - await email.send(mailOptions); - } - } else if (isToBeMailed) { - const args = Object.assign({ - ticketId: ticket.id, - recipientId: ticket.clientFk, - recipient: ticket.recipient, - replyTo: ticket.salesPersonEmail - }, reqArgs); - - const email = new Email('delivery-note-link', args); - await email.send(); - } - } catch (error) { - // Domain not found - if (error.responseCode == 450) - return invalidEmail(ticket); - - // Save tickets on a list of failed ids - failedtickets.push({ - id: ticket.id, - stacktrace: error - }); - } - } - - // Send email with failed tickets - if (failedtickets.length > 0) { - let body = 'This following tickets have failed:

'; - - for (const ticket of failedtickets) { - body += `Ticket: ${ticket.id} -
${ticket.stacktrace}

`; - } - - smtp.send({ - to: config.app.reportEmail, - subject: '[API] Nightly ticket closure report', - html: body - }); - } - }, - - async invalidEmail(ticket) { - await db.rawSql(`UPDATE client SET email = NULL WHERE id = ?`, [ - ticket.clientFk - ]); - - const oldInstance = `{"email": "${ticket.recipient}"}`; - const newInstance = `{"email": ""}`; - await db.rawSql(` - INSERT INTO clientLog (originFk, userFk, action, changedModel, oldInstance, newInstance) - VALUES (?, NULL, 'UPDATE', 'Client', ?, ?)`, [ - ticket.clientFk, - oldInstance, - newInstance - ]); - - const body = `No se ha podido enviar el albarán ${ticket.id} - al cliente ${ticket.clientFk} - ${ticket.clientName} - porque la dirección de email "${ticket.recipient}" no es correcta o no está disponible.

- Para evitar que se repita este error, se ha eliminado la dirección de email de la ficha del cliente. - Actualiza la dirección de email con una correcta.`; - - smtp.send({ - to: ticket.salesPersonEmail, - subject: 'No se ha podido enviar el albarán', - html: body - }); - } -}; diff --git a/print/methods/closure/index.js b/print/methods/closure/index.js deleted file mode 100644 index fcca76f71..000000000 --- a/print/methods/closure/index.js +++ /dev/null @@ -1,9 +0,0 @@ -const express = require('express'); -const router = new express.Router(); - -router.get('/all', require('./closeAll')); -router.get('/by-ticket', require('./closeByTicket')); -router.get('/by-agency', require('./closeByAgency')); -router.get('/by-route', require('./closeByRoute')); - -module.exports = router; diff --git a/print/methods/csv/delivery-note/download.js b/print/methods/csv/delivery-note/download.js deleted file mode 100644 index d369d5f4a..000000000 --- a/print/methods/csv/delivery-note/download.js +++ /dev/null @@ -1,24 +0,0 @@ -const path = require('path'); -const db = require('vn-print/core/database'); - -const {toCSV} = require('../csv'); -const sqlPath = path.join(__dirname, 'sql'); - -module.exports = async function(request, response, next) { - try { - const reqArgs = request.query; - if (!reqArgs.ticketId) - throw new Error('The argument ticketId is required'); - - const ticketId = reqArgs.ticketId; - const sales = await db.rawSqlFromDef(`${sqlPath}/sales`, [ticketId]); - const content = toCSV(sales); - const fileName = `ticket_${ticketId}.csv`; - - response.setHeader('Content-type', 'text/csv'); - response.setHeader('Content-Disposition', `inline; filename="${fileName}"`); - response.end(content); - } catch (error) { - next(error); - } -}; diff --git a/print/methods/csv/delivery-note/send.js b/print/methods/csv/delivery-note/send.js deleted file mode 100644 index 478f20f57..000000000 --- a/print/methods/csv/delivery-note/send.js +++ /dev/null @@ -1,40 +0,0 @@ -const path = require('path'); -const db = require('vn-print/core/database'); -const Email = require('vn-print/core/email'); - -const {toCSV} = require('../csv'); -const sqlPath = path.join(__dirname, 'sql'); - -module.exports = async function(request, response, next) { - try { - const reqArgs = request.query; - if (!reqArgs.ticketId) - throw new Error('The argument ticketId is required'); - - const ticketId = reqArgs.ticketId; - const ticket = await db.findOneFromDef(`${sqlPath}/ticket`, [ticketId]); - const sales = await db.rawSqlFromDef(`${sqlPath}/sales`, [ticketId]); - - const args = Object.assign({ - ticketId: (String(ticket.id)), - recipientId: ticket.clientFk, - recipient: ticket.recipient, - replyTo: ticket.salesPersonEmail - }, response.locals); - - const content = toCSV(sales); - const fileName = `ticket_${ticketId}.csv`; - const email = new Email('delivery-note', args); - await email.send({ - overrideAttachments: true, - attachments: [{ - filename: fileName, - content: content - }] - }); - - response.status(200).json({message: 'Success'}); - } catch (error) { - next(error); - } -}; diff --git a/print/methods/csv/delivery-note/sql/sales.sql b/print/methods/csv/delivery-note/sql/sales.sql deleted file mode 100644 index e5b419571..000000000 --- a/print/methods/csv/delivery-note/sql/sales.sql +++ /dev/null @@ -1,35 +0,0 @@ -SELECT io.ref Invoice, - io.issued InvoiceDate, - s.ticketFk Ticket, - s.itemFk Item, - s.concept Description, - i.size, - i.subName Producer, - s.quantity Quantity, - s.price Price, - s.discount Discount, - s.created Created, - tc.code Taxcode, - tc.description TaxDescription, - i.tag5, - i.value5, - i.tag6, - i.value6, - i.tag7, - i.value7, - i.tag8, - i.value8, - i.tag9, - i.value9, - i.tag10, - i.value10 -FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.supplier s2 ON s2.id = t.companyFk - JOIN vn.itemTaxCountry itc ON itc.itemFk = i.id - AND itc.countryFk = s2.countryFk - JOIN vn.taxClass tc ON tc.id = itc.taxClassFk - LEFT JOIN vn.invoiceOut io ON io.id = t.refFk -WHERE s.ticketFk = ? -ORDER BY s.ticketFk, s.created \ No newline at end of file diff --git a/print/methods/csv/delivery-note/sql/ticket.sql b/print/methods/csv/delivery-note/sql/ticket.sql deleted file mode 100644 index b80c7c42c..000000000 --- a/print/methods/csv/delivery-note/sql/ticket.sql +++ /dev/null @@ -1,9 +0,0 @@ -SELECT - t.id, - t.clientFk, - c.email recipient, - eu.email salesPersonEmail -FROM ticket t - JOIN client c ON c.id = t.clientFk - LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk -WHERE t.id = ? \ No newline at end of file diff --git a/print/methods/csv/index.js b/print/methods/csv/index.js deleted file mode 100644 index 6bdd1b60d..000000000 --- a/print/methods/csv/index.js +++ /dev/null @@ -1,9 +0,0 @@ -const express = require('express'); -const router = new express.Router(); - -router.get('/delivery-note/download', require('./delivery-note/download')); -router.get('/delivery-note/send', require('./delivery-note/send')); -router.get('/invoice/download', require('./invoice/download')); -router.get('/invoice/send', require('./invoice/send')); - -module.exports = router; diff --git a/print/methods/csv/invoice/download.js b/print/methods/csv/invoice/download.js deleted file mode 100644 index 593d2d8d0..000000000 --- a/print/methods/csv/invoice/download.js +++ /dev/null @@ -1,24 +0,0 @@ -const path = require('path'); -const db = require('vn-print/core/database'); - -const {toCSV} = require('../csv'); -const sqlPath = path.join(__dirname, 'sql'); - -module.exports = async function(request, response, next) { - try { - const reqArgs = request.query; - if (!reqArgs.invoiceId) - throw new Error('The argument invoiceId is required'); - - const invoiceId = reqArgs.invoiceId; - const sales = await db.rawSqlFromDef(`${sqlPath}/sales`, [invoiceId]); - const content = toCSV(sales); - const fileName = `invoice_${invoiceId}.csv`; - - response.setHeader('Content-type', 'text/csv'); - response.setHeader('Content-Disposition', `inline; filename="${fileName}"`); - response.end(content); - } catch (error) { - next(error); - } -}; diff --git a/print/methods/csv/invoice/send.js b/print/methods/csv/invoice/send.js deleted file mode 100644 index 919d7aeb1..000000000 --- a/print/methods/csv/invoice/send.js +++ /dev/null @@ -1,40 +0,0 @@ -const path = require('path'); -const db = require('vn-print/core/database'); -const Email = require('vn-print/core/email'); - -const {toCSV} = require('../csv'); -const sqlPath = path.join(__dirname, 'sql'); - -module.exports = async function(request, response, next) { - try { - const reqArgs = request.query; - if (!reqArgs.invoiceId) - throw new Error('The argument invoiceId is required'); - - const invoiceId = reqArgs.invoiceId; - const invoice = await db.findOneFromDef(`${sqlPath}/invoice`, [invoiceId]); - const sales = await db.rawSqlFromDef(`${sqlPath}/sales`, [invoiceId]); - - const args = Object.assign({ - invoiceId: (String(invoice.id)), - recipientId: invoice.clientFk, - recipient: invoice.recipient, - replyTo: invoice.salesPersonEmail - }, response.locals); - - const content = toCSV(sales); - const fileName = `invoice_${invoiceId}.csv`; - const email = new Email('invoice', args); - await email.send({ - overrideAttachments: true, - attachments: [{ - filename: fileName, - content: content - }] - }); - - response.status(200).json({message: 'Success'}); - } catch (error) { - next(error); - } -}; diff --git a/print/methods/csv/invoice/sql/invoice.sql b/print/methods/csv/invoice/sql/invoice.sql deleted file mode 100644 index 853aaddc0..000000000 --- a/print/methods/csv/invoice/sql/invoice.sql +++ /dev/null @@ -1,9 +0,0 @@ -SELECT - io.id, - io.clientFk, - c.email recipient, - eu.email salesPersonEmail -FROM invoiceOut io - JOIN client c ON c.id = io.clientFk - LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk -WHERE io.id = ? \ No newline at end of file diff --git a/print/methods/csv/invoice/sql/sales.sql b/print/methods/csv/invoice/sql/sales.sql deleted file mode 100644 index 34b5af1f7..000000000 --- a/print/methods/csv/invoice/sql/sales.sql +++ /dev/null @@ -1,35 +0,0 @@ -SELECT io.ref Invoice, - io.issued InvoiceDate, - s.ticketFk Ticket, - s.itemFk Item, - s.concept Description, - i.size, - i.subName Producer, - s.quantity Quantity, - s.price Price, - s.discount Discount, - s.created Created, - tc.code Taxcode, - tc.description TaxDescription, - i.tag5, - i.value5, - i.tag6, - i.value6, - i.tag7, - i.value7, - i.tag8, - i.value8, - i.tag9, - i.value9, - i.tag10, - i.value10 -FROM sale s - JOIN ticket t ON t.id = s.ticketFk - JOIN item i ON i.id = s.itemFk - JOIN supplier s2 ON s2.id = t.companyFk - JOIN itemTaxCountry itc ON itc.itemFk = i.id - AND itc.countryFk = s2.countryFk - JOIN taxClass tc ON tc.id = itc.taxClassFk - JOIN invoiceOut io ON io.ref = t.refFk -WHERE io.id = ? -ORDER BY s.ticketFk, s.created \ No newline at end of file diff --git a/print/methods/email/email.js b/print/methods/email/email.js deleted file mode 100644 index 5d6882f7d..000000000 --- a/print/methods/email/email.js +++ /dev/null @@ -1,16 +0,0 @@ -const Email = require('vn-print/core/email'); - -module.exports = async function(request, response, next) { - try { - const templateName = request.params.name; - const args = response.locals; - const email = new Email(templateName, args); - await email.send(); - - response.status(200).json({ - message: 'Sent' - }); - } catch (error) { - next(error); - } -}; diff --git a/print/methods/email/index.js b/print/methods/email/index.js deleted file mode 100644 index 10c2d2325..000000000 --- a/print/methods/email/index.js +++ /dev/null @@ -1,7 +0,0 @@ -const express = require('express'); -const router = new express.Router(); - -router.get('/:name', require('./email')); -router.get('/:name/preview', require('./preview')); - -module.exports = router; diff --git a/print/methods/email/preview.js b/print/methods/email/preview.js deleted file mode 100644 index e6a1aaf35..000000000 --- a/print/methods/email/preview.js +++ /dev/null @@ -1,14 +0,0 @@ -const Email = require('vn-print/core/email'); - -module.exports = async function(request, response, next) { - try { - const templateName = request.params.name; - const args = Object.assign({isPreview: true}, response.locals); - const email = new Email(templateName, args); - const template = await email.render(); - - response.send(template); - } catch (error) { - next(error); - } -}; diff --git a/print/methods/report/document.js b/print/methods/report/document.js deleted file mode 100644 index b24abf4ac..000000000 --- a/print/methods/report/document.js +++ /dev/null @@ -1,17 +0,0 @@ -const Report = require('vn-print/core/report'); - -module.exports = async function(request, response, next) { - try { - const reportName = request.params.name; - const args = response.locals; - const report = new Report(reportName, args); - const stream = await report.toPdfStream(); - const fileName = await report.getFileName(); - - response.setHeader('Content-type', 'application/pdf'); - response.setHeader('Content-Disposition', `inline; filename="${fileName}"`); - response.end(stream); - } catch (error) { - next(error); - } -}; diff --git a/print/methods/report/index.js b/print/methods/report/index.js deleted file mode 100644 index c422c76df..000000000 --- a/print/methods/report/index.js +++ /dev/null @@ -1,7 +0,0 @@ -const express = require('express'); -const router = new express.Router(); - -router.get('/:name', require('./document')); -router.get('/:name/preview', require('./preview')); - -module.exports = router; diff --git a/print/methods/report/preview.js b/print/methods/report/preview.js deleted file mode 100644 index 0d6ad6f43..000000000 --- a/print/methods/report/preview.js +++ /dev/null @@ -1,13 +0,0 @@ -const Report = require('vn-print/core/report'); - -module.exports = async function(request, response, next) { - try { - const reportName = request.params.name; - const report = new Report(reportName, request.query); - const template = await report.render(); - - response.send(template); - } catch (error) { - next(error); - } -}; diff --git a/print/methods/routes.js b/print/methods/routes.js deleted file mode 100644 index 28671b3da..000000000 --- a/print/methods/routes.js +++ /dev/null @@ -1,22 +0,0 @@ -module.exports = [ - { - url: '/api/report', - cb: require('./report') - }, - { - url: '/api/email', - cb: require('./email') - }, - { - url: '/api/csv', - cb: require('./csv') - }, - { - url: '/api/closure', - cb: require('./closure') - }, - { - url: '/api/schedule', - cb: require('./schedule') - } -]; diff --git a/print/methods/schedule/consumption.js b/print/methods/schedule/consumption.js deleted file mode 100644 index 39d39105b..000000000 --- a/print/methods/schedule/consumption.js +++ /dev/null @@ -1,58 +0,0 @@ -const db = require('vn-print/core/database'); -const Email = require('vn-print/core/email'); - -module.exports = async function(request, response, next) { - try { - const reqArgs = request.body; - - if (!reqArgs.clientIds) - throw new Error('The argument clientIds is required'); - if (!reqArgs.from) - throw new Error('The argument from is required'); - if (!reqArgs.to) - throw new Error('The argument to is required'); - - response.status(200).json({ - message: 'Success' - }); - - const clientIds = reqArgs.clientIds; - - const clients = await db.rawSql(` - SELECT - c.id, - c.email, - eu.email salesPersonEmail - FROM client c - JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk - JOIN ticket t ON t.clientFk = c.id - JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - WHERE c.id IN(?) - AND it.isPackaging = FALSE - AND DATE(t.shipped) BETWEEN ? AND ? - GROUP BY c.id`, [clientIds, reqArgs.from, reqArgs.to]); - - 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); - } -}; diff --git a/print/methods/schedule/index.js b/print/methods/schedule/index.js deleted file mode 100644 index 05d54b2ed..000000000 --- a/print/methods/schedule/index.js +++ /dev/null @@ -1,7 +0,0 @@ -const express = require('express'); -const router = new express.Router(); - -router.post('/consumption', require('./consumption')); -router.post('/invoice', require('./invoice')); - -module.exports = router; diff --git a/print/methods/schedule/invoice.js b/print/methods/schedule/invoice.js deleted file mode 100644 index 7128cebbd..000000000 --- a/print/methods/schedule/invoice.js +++ /dev/null @@ -1,115 +0,0 @@ -const db = require('vn-print/core/database'); -const Email = require('vn-print/core/email'); -const Report = require('vn-print/core/report'); -const storage = require('vn-print/core/storage'); - -module.exports = async function(request, response, next) { - try { - response.status(200).json({ - message: 'Success' - }); - - const invoices = await db.rawSql(` - SELECT - io.id, - io.clientFk, - io.issued, - io.ref, - c.email recipient, - c.salesPersonFk, - c.isToBeMailed, - c.hasToInvoice, - co.hasDailyInvoice, - eu.email salesPersonEmail - FROM invoiceOut_queue ioq - JOIN invoiceOut io ON io.id = ioq.invoiceFk - JOIN client c ON c.id = io.clientFk - 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 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, - recipient: invoiceOut.recipient, - replyTo: invoiceOut.salesPersonEmail - }, response.locals); - - const invoiceReport = new Report('invoice', args); - const stream = await invoiceReport.toPdfStream(); - - const issued = invoiceOut.issued; - const year = issued.getFullYear().toString(); - const month = (issued.getMonth() + 1).toString(); - const day = issued.getDate().toString(); - - const fileName = `${year}${invoiceOut.ref}.pdf`; - - // Store invoice - storage.write(stream, { - type: 'invoice', - path: `${year}/${month}/${day}`, - fileName: fileName - }); - - connection.query('UPDATE invoiceOut SET hasPdf = true WHERE id = ?', [invoiceOut.id]); - - const isToBeMailed = invoiceOut.recipient && invoiceOut.salesPersonFk && invoiceOut.isToBeMailed; - - if (isToBeMailed) { - const mailOptions = { - overrideAttachments: true, - attachments: [] - }; - - const invoiceAttachment = { - filename: fileName, - content: stream - }; - - if (invoiceOut.serial == 'E' && invoiceOut.companyCode == 'VNL') { - const exportation = new Report('exportation', args); - const stream = await exportation.toPdfStream(); - const fileName = `CITES-${invoiceOut.ref}.pdf`; - - mailOptions.attachments.push({ - filename: fileName, - content: stream - }); - } - - mailOptions.attachments.push(invoiceAttachment); - - const email = new Email('invoice', args); - await email.send(mailOptions); - } - // Update queue status - const date = new Date(); - sql = `UPDATE invoiceOut_queue - SET status = "printed", - printed = ? - WHERE invoiceFk = ?`; - connection.query(sql, [date, invoiceOut.id]); - connection.query('COMMIT'); - } catch (error) { - connection.query('ROLLBACK'); - connection.release(); - sql = `UPDATE invoiceOut_queue - SET status = ? - WHERE invoiceFk = ?`; - await db.rawSql(sql, [error.message, invoiceId]); - } - } - } catch (error) { - next(error); - } -}; diff --git a/print/package-lock.json b/print/package-lock.json deleted file mode 100644 index c824de5df..000000000 --- a/print/package-lock.json +++ /dev/null @@ -1,1676 +0,0 @@ -{ - "name": "vn-print", - "version": "2.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@types/mime-types": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.0.tgz", - "integrity": "sha1-nKUs2jY/aZxpRmwqbM2q2RPqenM=" - }, - "agent-base": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", - "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==" - }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "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", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, - "async": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz", - "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==" - }, - "async-limiter": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" - }, - "aws4": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", - "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" - }, - "base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "boolbase": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "buffer-alloc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", - "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", - "requires": { - "buffer-alloc-unsafe": "^1.1.0", - "buffer-fill": "^1.0.0" - } - }, - "buffer-alloc-unsafe": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", - "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" - }, - "buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" - }, - "buffer-fill": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", - "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" - }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "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", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz", - "integrity": "sha1-qbqoYKP5tZWmuBsahocxIe06Jp4=", - "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": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "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", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "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", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", - "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", - "requires": { - "boolbase": "~1.0.0", - "css-what": "2.1", - "domutils": "1.5.1", - "nth-check": "~1.0.1" - } - }, - "css-what": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", - "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==" - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "datauri": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/datauri/-/datauri-2.0.0.tgz", - "integrity": "sha512-zS2HSf9pI5XPlNZgIqJg/wCJpecgU/HA6E/uv2EfaWnW1EiTGLfy/EexTIsC9c99yoCOTXlqeeWk4FkCSuO3/g==", - "requires": { - "image-size": "^0.7.3", - "mimer": "^1.0.0" - } - }, - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "requires": { - "ms": "2.1.2" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" - }, - "deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "denque": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz", - "integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==" - }, - "dijkstrajs": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.1.tgz", - "integrity": "sha1-082BIh4+pAdCz83lVtTpnpjdxxs=" - }, - "dom-serializer": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", - "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", - "requires": { - "domelementtype": "^1.3.0", - "entities": "^1.1.1" - } - }, - "domelementtype": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==" - }, - "domhandler": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", - "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", - "requires": { - "domelementtype": "1" - } - }, - "domutils": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", - "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" - }, - "entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "extract-zip": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", - "integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==", - "requires": { - "concat-stream": "^1.6.2", - "debug": "^2.6.9", - "mkdirp": "^0.5.4", - "yauzl": "^2.10.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - } - } - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" - }, - "fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", - "requires": { - "pend": "~1.2.0" - } - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "requires": { - "locate-path": "^3.0.0" - } - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "generate-function": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", - "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==", - "requires": { - "is-property": "^1.0.2" - } - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "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.6", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" - }, - "har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "requires": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - } - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" - }, - "hash-sum": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz", - "integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=" - }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==" - }, - "htmlparser2": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", - "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", - "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", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "https-proxy-agent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", - "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", - "requires": { - "agent-base": "5", - "debug": "4" - } - }, - "iconv-lite": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.2.tgz", - "integrity": "sha512-kERHXvpSaB4aU3eANwidg79K8FlrN77m8G9V+0vOR3HYaRifrlwMEpT7ZBJqLSEIHnEgJTHcWK82wwLwwKwtag==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" - }, - "image-size": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.7.5.tgz", - "integrity": "sha512-Hiyv+mXHfFEP7LzUL/llg9RwFxxY+o9N3JVLIeG5E7iFIFAalxvRU9UZthBdYDEVnzHMgjnKJPPpay5BWf1g9g==" - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "intl": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/intl/-/intl-1.2.5.tgz", - "integrity": "sha1-giRKIZDE5Bn4Nx9ao02qNCDiq94=" - }, - "is-core-module": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", - "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", - "requires": { - "has": "^1.0.3" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" - }, - "is-property": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", - "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=" - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "jsonexport": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonexport/-/jsonexport-3.2.0.tgz", - "integrity": "sha512-GbO9ugb0YTZatPd/hqCGR0FSwbr82H6OzG04yzdrG7XOe4QZ0jhQ+kOsB29zqkzoYJLmLxbbrFiuwbQu891XnQ==" - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "juice": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/juice/-/juice-5.2.0.tgz", - "integrity": "sha512-0l6GZmT3efexyaaay3SchKT5kG311N59TEFP5lfvEy0nz9SNqjx311plJ3b4jze7arsmDsiHQLh/xnAuk0HFTQ==", - "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": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "lodash._reinterpolate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", - "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=" - }, - "lodash.assignin": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.assignin/-/lodash.assignin-4.2.0.tgz", - "integrity": "sha1-uo31+4QesKPoBEIysOJjqNxqKKI=" - }, - "lodash.bind": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/lodash.bind/-/lodash.bind-4.2.1.tgz", - "integrity": "sha1-euMBfpOWIqwxt9fX3LGzTbFpDTU=" - }, - "lodash.defaults": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", - "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" - }, - "lodash.filter": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.filter/-/lodash.filter-4.6.0.tgz", - "integrity": "sha1-ZosdSYFgOuHMWm+nYBQ+SAtMSs4=" - }, - "lodash.flatten": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", - "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" - }, - "lodash.foreach": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz", - "integrity": "sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM=" - }, - "lodash.map": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz", - "integrity": "sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=" - }, - "lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" - }, - "lodash.pick": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", - "integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=" - }, - "lodash.reduce": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz", - "integrity": "sha1-8atrg5KZrUj3hKu/R2WW8DuRTTs=" - }, - "lodash.reject": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.reject/-/lodash.reject-4.6.0.tgz", - "integrity": "sha1-gNZJLcFHCGS79YNTO2UfQqn1JBU=" - }, - "lodash.some": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz", - "integrity": "sha1-G7nzFO9ri63tE7VJFpsqlF62jk0=" - }, - "lodash.template": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz", - "integrity": "sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==", - "requires": { - "lodash._reinterpolate": "^3.0.0", - "lodash.templatesettings": "^4.0.0" - } - }, - "lodash.templatesettings": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz", - "integrity": "sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==", - "requires": { - "lodash._reinterpolate": "^3.0.0" - } - }, - "lodash.unescape": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz", - "integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=" - }, - "lodash.uniq": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", - "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" - }, - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "requires": { - "yallist": "^3.0.2" - } - }, - "mensch": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/mensch/-/mensch-0.3.4.tgz", - "integrity": "sha512-IAeFvcOnV9V0Yk+bFhYR07O3yNina9ANIN5MoXBKYJ/RLYPurd2d0yw14MDhpr9/momp0WofT1bPUh3hkzdi/g==" - }, - "mime": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", - "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==" - }, - "mime-db": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz", - "integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ==" - }, - "mime-types": { - "version": "2.1.29", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz", - "integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==", - "requires": { - "mime-db": "1.46.0" - } - }, - "mimer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mimer/-/mimer-1.1.0.tgz", - "integrity": "sha512-y9dVfy2uiycQvDNiAYW6zp49ZhFlXDMr5wfdOiMbdzGM/0N5LNR6HTUn3un+WUQcM0koaw8FMTG1bt5EnHJdvQ==" - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" - }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "requires": { - "minimist": "^1.2.5" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "mysql2": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-1.7.0.tgz", - "integrity": "sha512-xTWWQPjP5rcrceZQ7CSTKR/4XIDeH/cRkNH/uzvVGQ7W5c7EJ0dXeJUusk7OKhIoHj7uFKUxDVSCfLIl+jluog==", - "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", - "resolved": "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.2.tgz", - "integrity": "sha512-wiFWqxoLL3PGVReSZpjLVxyJ1bRqe+KKJVbr4hGs1KWfTZTQyezHFBbuKj9hsizHyGV2ne7EMjHdxEGAybD5SA==", - "requires": { - "lru-cache": "^4.1.3" - }, - "dependencies": { - "lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" - } - } - }, - "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" - }, - "nodemailer": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-4.7.0.tgz", - "integrity": "sha512-IludxDypFpYw4xpzKdMAozBSkzKHmNBvGanUREjJItgJ2NYcK/s8+PggVhj7c2yGFQykKsnnmv1+Aqo0ZfjHmw==" - }, - "nth-check": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", - "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", - "requires": { - "boolbase": "~1.0.0" - } - }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" - }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" - }, - "pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, - "pngjs": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", - "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==" - }, - "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==" - }, - "proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" - }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" - }, - "psl": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", - "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" - }, - "puppeteer": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-2.1.1.tgz", - "integrity": "sha512-LWzaDVQkk1EPiuYeTOj+CZRIjda4k2s5w4MK4xoH2+kgWV/SDlkYHmxatDdtYrciHUKSXTsGgPgPP8ILVdBsxg==", - "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.4.4", - "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.4.4.tgz", - "integrity": "sha512-oLzEC5+NKFou9P0bMj5+v6Z40evexeE29Z9cummZXZ9QXyMr3lphkURzxjXgPJC5azpxcshoDWV1xE46z+/c3Q==", - "requires": { - "buffer": "^5.4.3", - "buffer-alloc": "^1.2.0", - "buffer-from": "^1.1.1", - "dijkstrajs": "^1.0.1", - "isarray": "^2.0.1", - "pngjs": "^3.3.0", - "yargs": "^13.2.4" - } - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "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", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" - }, - "resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", - "requires": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" - } - }, - "rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "requires": { - "glob": "^7.1.3" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" - }, - "seq-queue": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz", - "integrity": "sha1-1WgS4cAXpuTnw+Ojeh2m143TyT4=" - }, - "serialize-javascript": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-3.1.0.tgz", - "integrity": "sha512-JIJT1DGiWmIKhzRsG91aS6Ze4sFUrYbltlkg2onR5OrnNM02Kl/hnY/T4FN2omvyeBbQmMJv+K4cPOpGzOTFBg==", - "requires": { - "randombytes": "^2.1.0" - } - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" - }, - "slick": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/slick/-/slick-1.12.2.tgz", - "integrity": "sha1-vQSN23TefRymkV+qSldXCzVQwtc=" - }, - "source-map": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", - "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=" - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" - }, - "sqlstring": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.2.tgz", - "integrity": "sha512-vF4ZbYdKS8OnoJAWBmMxCQDkiEBkGQYU7UZPtL8flbDRSNkhaXvRJ279ZtI6M+zDaQovVU4tuRgzK5fVhvFAhg==" - }, - "sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", - "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.0", - "resolved": "https://registry.npmjs.org/strftime/-/strftime-0.10.0.tgz", - "integrity": "sha1-s/D6QZKVICpaKJ9ta+n0kJphcZM=" - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "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", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "requires": { - "safe-buffer": "~5.2.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" - }, - "tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" - }, - "uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "requires": { - "punycode": "^2.1.0" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" - }, - "valid-data-url": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/valid-data-url/-/valid-data-url-2.0.0.tgz", - "integrity": "sha512-dyCZnv3aCey7yfTgIqdZanKl7xWAEEKCbgmR7SKqyK6QT/Z07ROactrgD1eA37C69ODRj7rNOjzKWVPh0EUjBA==" - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "vue": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.12.tgz", - "integrity": "sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg==" - }, - "vue-i18n": { - "version": "8.24.1", - "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.24.1.tgz", - "integrity": "sha512-iqM+npjvI9SGOAYkw1Od/y4O74gpvn5WOHeb3K125TmDJssvR62tDMMLIasPmKNbePZ1BMZ6d5jOBsrB/cK8Lw==" - }, - "vue-server-renderer": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/vue-server-renderer/-/vue-server-renderer-2.6.12.tgz", - "integrity": "sha512-3LODaOsnQx7iMFTBLjki8xSyOxhCtbZ+nQie0wWY4iOVeEtTg1a3YQAjd82WvKxrWHHTshjvLb7OXMc2/dYuxw==", - "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", - "resolved": "https://registry.npmjs.org/web-resource-inliner/-/web-resource-inliner-4.3.4.tgz", - "integrity": "sha512-agVAgRhOOi4GVlvKK34oM23tDgH8390HfLnZY2HZl8OFBwKNvUJkH7t89AT2iluQP8w9VHAAKX6Z8EN7/9tqKA==", - "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", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "dom-serializer": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.2.0.tgz", - "integrity": "sha512-n6kZFH/KlCrqs/1GHMOd5i2fd/beQHuehKdWvNNffbGHTr/almdhuVvTVFb3V7fglz+nC50fFusu3lY33h12pA==", - "requires": { - "domelementtype": "^2.0.1", - "domhandler": "^4.0.0", - "entities": "^2.0.0" - }, - "dependencies": { - "domhandler": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.0.0.tgz", - "integrity": "sha512-KPTbnGQ1JeEMQyO1iYXoagsI6so/C96HZiFyByU3T6iAzpXn8EGEvct6unm1ZGoed8ByO2oirxgwxBmqKF9haA==", - "requires": { - "domelementtype": "^2.1.0" - } - } - } - }, - "domelementtype": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.1.0.tgz", - "integrity": "sha512-LsTgx/L5VpD+Q8lmsXSHW2WpA+eBlZ9HPf3erD1IoPF00/3JKHZ3BknUVA2QGDNu69ZNmyFmCWBSO45XjYKC5w==" - }, - "domhandler": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-3.3.0.tgz", - "integrity": "sha512-J1C5rIANUbuYK+FuFL98650rihynUOEzRLxW+90bKZRWB6A1X1Tf82GxR1qAWLyfNPRvjqfip3Q5tdYlmAa9lA==", - "requires": { - "domelementtype": "^2.0.1" - } - }, - "domutils": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.5.0.tgz", - "integrity": "sha512-Ho16rzNMOFk2fPwChGh3D2D9OEHAfG19HgmRR2l+WLSsIstNsAYBzePH412bL0y5T44ejABIVfTHQ8nqi/tBCg==", - "requires": { - "dom-serializer": "^1.0.1", - "domelementtype": "^2.0.1", - "domhandler": "^4.0.0" - }, - "dependencies": { - "domhandler": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.0.0.tgz", - "integrity": "sha512-KPTbnGQ1JeEMQyO1iYXoagsI6so/C96HZiFyByU3T6iAzpXn8EGEvct6unm1ZGoed8ByO2oirxgwxBmqKF9haA==", - "requires": { - "domelementtype": "^2.1.0" - } - } - } - }, - "entities": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", - "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==" - }, - "htmlparser2": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-4.1.0.tgz", - "integrity": "sha512-4zDq1a1zhE4gQso/c5LP1OtrhYTncXNSpvJYtWJBtXAETPlMfi3IFNjGuQbYLuVY4ZR0QMqRVvo4Pdy9KLyP8Q==", - "requires": { - "domelementtype": "^2.0.1", - "domhandler": "^3.0.0", - "domutils": "^2.0.0", - "entities": "^2.0.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" - }, - "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "ws": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", - "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", - "requires": { - "async-limiter": "~1.0.0" - } - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" - }, - "y18n": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", - "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==" - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" - }, - "yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", - "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", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", - "requires": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - } - } -} diff --git a/print/package.json b/print/package.json index 09ef2b1c8..65a8687b3 100755 --- a/print/package.json +++ b/print/package.json @@ -16,15 +16,18 @@ "fs-extra": "^7.0.1", "intl": "^1.2.5", "js-yaml": "^3.13.1", + "jsbarcode": "^3.11.5", "jsonexport": "^3.2.0", "juice": "^5.2.0", + "log4js": "^6.7.0", "mysql2": "^1.7.0", "nodemailer": "^4.7.0", - "puppeteer": "^2.0.0", + "puppeteer-cluster": "^0.23.0", "qrcode": "^1.4.2", "strftime": "^0.10.0", "vue": "^2.6.10", "vue-i18n": "^8.15.0", - "vue-server-renderer": "^2.6.10" + "vue-server-renderer": "^2.6.10", + "xmldom": "^0.6.0" } } diff --git a/print/templates/email/balance-compensation/assets/css/import.js b/print/templates/email/balance-compensation/assets/css/import.js new file mode 100644 index 000000000..4b4bb7086 --- /dev/null +++ b/print/templates/email/balance-compensation/assets/css/import.js @@ -0,0 +1,11 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) + .mergeStyles(); diff --git a/print/templates/email/balance-compensation/attachments.json b/print/templates/email/balance-compensation/attachments.json new file mode 100644 index 000000000..d2bf461c5 --- /dev/null +++ b/print/templates/email/balance-compensation/attachments.json @@ -0,0 +1,6 @@ +[ + { + "filename": "balance-compensation.pdf", + "component": "balance-compensation" + } +] \ No newline at end of file diff --git a/print/templates/email/balance-compensation/balance-compensation.html b/print/templates/email/balance-compensation/balance-compensation.html new file mode 100644 index 000000000..96a301a81 --- /dev/null +++ b/print/templates/email/balance-compensation/balance-compensation.html @@ -0,0 +1,17 @@ + +
+
+

{{$t('description.instructions')}} {{client.name}}

+

{{$t('description.attached')}}

+

{{$t('description.response')}}

+

{{$t('description.regards')}}

+
+
+
+
+ + +
+
+
\ No newline at end of file diff --git a/print/templates/email/balance-compensation/balance-compensation.js b/print/templates/email/balance-compensation/balance-compensation.js new file mode 100755 index 000000000..408f940ac --- /dev/null +++ b/print/templates/email/balance-compensation/balance-compensation.js @@ -0,0 +1,36 @@ +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); +const attachment = new Component('attachment'); + +module.exports = { + name: 'balance-compensation', + async serverPrefetch() { + this.client = await this.fetchClient(this.id); + }, + methods: { + fetchClient(id) { + return this.findOneFromDef('client', [id]); + }, + }, + components: { + 'email-body': emailBody.build(), + 'attachment': attachment.build() + }, + data() { + return { + attachments: [ + { + filename: 'balance-compensation.pdf', + type: 'pdf', + path: `Receipts/${this.id}/balance-compensation-pdf` + } + ] + }; + }, + props: { + id: { + type: Number, + required: true + } + } +}; diff --git a/print/templates/email/balance-compensation/locale/es.yml b/print/templates/email/balance-compensation/locale/es.yml new file mode 100644 index 000000000..44253bee2 --- /dev/null +++ b/print/templates/email/balance-compensation/locale/es.yml @@ -0,0 +1,6 @@ +subject: Compensación VerdNatura SL +description: + instructions: Buenos días, + attached: Adjuntamos escrito para su confirmación + response: Rogamos su respuesta a la mayor brevedad + regards: Un saludo \ No newline at end of file diff --git a/print/templates/email/balance-compensation/sql/client.sql b/print/templates/email/balance-compensation/sql/client.sql new file mode 100644 index 000000000..1e842d69d --- /dev/null +++ b/print/templates/email/balance-compensation/sql/client.sql @@ -0,0 +1,5 @@ +SELECT + c.name +FROM client c + JOIN receipt r ON r.clientFk = c.id +WHERE r.id = ?; \ No newline at end of file diff --git a/print/templates/email/book-entries-imported-incorrectly/assets/css/import.js b/print/templates/email/book-entries-imported-incorrectly/assets/css/import.js new file mode 100644 index 000000000..1582b82c5 --- /dev/null +++ b/print/templates/email/book-entries-imported-incorrectly/assets/css/import.js @@ -0,0 +1,12 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) + .mergeStyles(); + diff --git a/print/templates/email/book-entries-imported-incorrectly/book-entries-imported-incorrectly.html b/print/templates/email/book-entries-imported-incorrectly/book-entries-imported-incorrectly.html new file mode 100644 index 000000000..044ae0312 --- /dev/null +++ b/print/templates/email/book-entries-imported-incorrectly/book-entries-imported-incorrectly.html @@ -0,0 +1,8 @@ + +
+
+

{{ $t('title') }}

+

+
+
+
diff --git a/print/templates/email/book-entries-imported-incorrectly/book-entries-imported-incorrectly.js b/print/templates/email/book-entries-imported-incorrectly/book-entries-imported-incorrectly.js new file mode 100755 index 000000000..c8a427d30 --- /dev/null +++ b/print/templates/email/book-entries-imported-incorrectly/book-entries-imported-incorrectly.js @@ -0,0 +1,15 @@ +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); + +module.exports = { + name: 'book-entries-imported-incorrectly', + components: { + 'email-body': emailBody.build(), + }, + props: { + bookEntries: { + type: String, + required: true + } + } +}; diff --git a/print/templates/email/book-entries-imported-incorrectly/locale/en.yml b/print/templates/email/book-entries-imported-incorrectly/locale/en.yml new file mode 100644 index 000000000..30c5dd292 --- /dev/null +++ b/print/templates/email/book-entries-imported-incorrectly/locale/en.yml @@ -0,0 +1,5 @@ +subject: Book entries imported incorrectly +title: Book entries imported incorrectly +description: There are book entries that differ between the info from XDiario and the one that has been imported into Sage.

+ Book entries nº {0}

+ If you consider that it is due to a computer error, forward this email to cau@verdnatura.es diff --git a/print/templates/email/book-entries-imported-incorrectly/locale/es.yml b/print/templates/email/book-entries-imported-incorrectly/locale/es.yml new file mode 100644 index 000000000..f48ad0a3b --- /dev/null +++ b/print/templates/email/book-entries-imported-incorrectly/locale/es.yml @@ -0,0 +1,5 @@ +subject: Asientos contables importados incorrectamente +title: Asientos contables importados incorrectamente +description: Existen asientos que difieren entre la info. de XDiario y la que se ha importado a Sage.

+ Asientos nº {0}

+ Si considera que es debido a un error informático, reenvíe este correo a cau@verdnatura.es diff --git a/print/templates/email/buyer-week-waste/assets/css/import.js b/print/templates/email/buyer-week-waste/assets/css/import.js index c742fdf90..7360587f7 100644 --- a/print/templates/email/buyer-week-waste/assets/css/import.js +++ b/print/templates/email/buyer-week-waste/assets/css/import.js @@ -1,9 +1,13 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`, `${__dirname}/style.css`]) .mergeStyles(); + diff --git a/print/templates/email/buyer-week-waste/buyer-week-waste.html b/print/templates/email/buyer-week-waste/buyer-week-waste.html index 273706c9f..d8b7a622b 100644 --- a/print/templates/email/buyer-week-waste/buyer-week-waste.html +++ b/print/templates/email/buyer-week-waste/buyer-week-waste.html @@ -1,76 +1,37 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }}

-

{{$t('dear')}},

-

-
-
- -
-
- - - - - - - - - - - - - - - - - -
{{$t('buyer')}}{{$t('percentage')}}{{$t('dwindle')}}{{$t('total')}}
{{waste.buyer}}{{(waste.percentage / 100) | percentage(2, 2, $i18n.locale)}}{{waste.dwindle | currency('EUR', $i18n.locale)}}{{waste.total | currency('EUR', $i18n.locale)}}
-

- -
-
- - -
-
- -
-
- -
-
-
-
- - \ No newline at end of file + +
+
+

{{ $t('title') }}

+

{{$t('dear')}},

+

+
+
+
+
+ + + + + + + + + + + + + + + + + +
{{$t('buyer')}}{{$t('percentage')}}{{$t('dwindle')}}{{$t('total')}}
{{waste.buyer}}{{(waste.percentage / 100) | percentage(2, 2, $i18n.locale)}}{{waste.dwindle | currency('EUR', $i18n.locale)}}{{waste.total | currency('EUR', $i18n.locale)}}
+

+ +
+
+
\ No newline at end of file diff --git a/print/templates/email/buyer-week-waste/buyer-week-waste.js b/print/templates/email/buyer-week-waste/buyer-week-waste.js index 9af477e82..1ae40cd98 100755 --- a/print/templates/email/buyer-week-waste/buyer-week-waste.js +++ b/print/templates/email/buyer-week-waste/buyer-week-waste.js @@ -1,6 +1,5 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); module.exports = { name: 'buyer-week-waste', @@ -14,7 +13,7 @@ module.exports = { dated: function() { const filters = this.$options.filters; - return filters.date(new Date(), '%d-%m-%Y'); + return filters.date(Date.vnNew(), '%d-%m-%Y'); } }, methods: { @@ -23,8 +22,7 @@ module.exports = { } }, components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build() + 'email-body': emailBody.build() }, props: {} }; diff --git a/print/templates/email/campaign-metrics/assets/css/import.js b/print/templates/email/campaign-metrics/assets/css/import.js index b44d6bd37..4b4bb7086 100644 --- a/print/templates/email/campaign-metrics/assets/css/import.js +++ b/print/templates/email/campaign-metrics/assets/css/import.js @@ -1,8 +1,11 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`]) + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) .mergeStyles(); diff --git a/print/templates/email/campaign-metrics/campaign-metrics.html b/print/templates/email/campaign-metrics/campaign-metrics.html index ff8c661ee..8d9300e33 100644 --- a/print/templates/email/campaign-metrics/campaign-metrics.html +++ b/print/templates/email/campaign-metrics/campaign-metrics.html @@ -1,46 +1,9 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }}

-

{{$t('dear')}},

-

-
-
- -
-
- -
-
- -
-
-
-
- - \ No newline at end of file + +
+
+

{{ $t('title') }}

+

{{$t('dear')}},

+

+
+
+
\ No newline at end of file diff --git a/print/templates/email/campaign-metrics/campaign-metrics.js b/print/templates/email/campaign-metrics/campaign-metrics.js index 2bd93b725..541dff7b3 100755 --- a/print/templates/email/campaign-metrics/campaign-metrics.js +++ b/print/templates/email/campaign-metrics/campaign-metrics.js @@ -1,6 +1,5 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); module.exports = { name: 'campaign-metrics', @@ -16,12 +15,11 @@ module.exports = { } }, components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build() + 'email-body': emailBody.build(), }, props: { - recipientId: { - type: [Number, String], + id: { + type: Number, required: true }, from: { diff --git a/print/templates/email/claim-pickup-order/assets/css/import.js b/print/templates/email/claim-pickup-order/assets/css/import.js index b44d6bd37..1582b82c5 100644 --- a/print/templates/email/claim-pickup-order/assets/css/import.js +++ b/print/templates/email/claim-pickup-order/assets/css/import.js @@ -1,8 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`]) + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) .mergeStyles(); + diff --git a/print/templates/email/claim-pickup-order/claim-pickup-order.html b/print/templates/email/claim-pickup-order/claim-pickup-order.html index f674dcee8..b21ed3ceb 100644 --- a/print/templates/email/claim-pickup-order/claim-pickup-order.html +++ b/print/templates/email/claim-pickup-order/claim-pickup-order.html @@ -1,46 +1,10 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }}

-

{{$t('description.dear')}},

-

{{$t('description.instructions')}}

-
-
- -
-
- -
-
- -
-
-
-
- - \ No newline at end of file + +
+
+

{{ $t('title', [id]) }}

+

{{ $t('description.dear') }},

+

+

{{ $t('description.conclusion') }}

+
+
+
\ No newline at end of file diff --git a/print/templates/email/claim-pickup-order/claim-pickup-order.js b/print/templates/email/claim-pickup-order/claim-pickup-order.js index cf4ba7d12..f8ab8e7fd 100755 --- a/print/templates/email/claim-pickup-order/claim-pickup-order.js +++ b/print/templates/email/claim-pickup-order/claim-pickup-order.js @@ -1,16 +1,27 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); module.exports = { name: 'claim-pickup-order', components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build() + 'email-body': emailBody.build(), + }, + async serverPrefetch() { + this.ticket = await this.fetchTicket(this.id); + + if (!this.ticket) + throw new Error('Something went wrong'); + + this.instructions = this.$t('description.instructions', [this.id, this.ticket.id]); + }, + methods: { + fetchTicket(id) { + return this.findOneFromDef('ticket', [id]); + } }, props: { - claimId: { - type: [Number, String], + id: { + type: Number, required: true } } diff --git a/print/templates/email/claim-pickup-order/locale/es.yml b/print/templates/email/claim-pickup-order/locale/es.yml index fe08fb0a8..9ff30158e 100644 --- a/print/templates/email/claim-pickup-order/locale/es.yml +++ b/print/templates/email/claim-pickup-order/locale/es.yml @@ -1,5 +1,10 @@ -subject: Orden de recogida -title: Orden de recogida +subject: Reclamación Verdnatura +title: Reclamación Verdnatura {0} description: - dear: Estimado cliente - instructions: Aqui tienes tu orden de recogida. \ No newline at end of file + dear: Estimado cliente + instructions: 'Le informamos que se ha aceptado su solicitud de reclamación nº {0} correspondiente al pedido {1}. + Para tramitar la recogida, rellene el SIGUIENTE FORMULARIO en un plazo máximo de 24h. +

Cuando recibamos el género en nuestras instalaciones emitiremos el abono correspondiente. + Debe imprimir el archivo adjunto e incluirlo en la caja. En el caso de no poder imprimirlo, identifique la caja con el número de reclamación CLARAMENTE LEGIBLE.' + conclusion: Un saludo diff --git a/print/templates/email/claim-pickup-order/sql/ticket.sql b/print/templates/email/claim-pickup-order/sql/ticket.sql new file mode 100644 index 000000000..28b78c987 --- /dev/null +++ b/print/templates/email/claim-pickup-order/sql/ticket.sql @@ -0,0 +1,4 @@ +SELECT + c.ticketFk as id +FROM claim c +WHERE c.id = ? diff --git a/print/templates/email/client-debt-statement/assets/css/import.js b/print/templates/email/client-debt-statement/assets/css/import.js index b44d6bd37..4b4bb7086 100644 --- a/print/templates/email/client-debt-statement/assets/css/import.js +++ b/print/templates/email/client-debt-statement/assets/css/import.js @@ -1,8 +1,11 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`]) + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) .mergeStyles(); diff --git a/print/templates/email/client-debt-statement/client-debt-statement.html b/print/templates/email/client-debt-statement/client-debt-statement.html index e63eba7f7..b02da93af 100644 --- a/print/templates/email/client-debt-statement/client-debt-statement.html +++ b/print/templates/email/client-debt-statement/client-debt-statement.html @@ -1,55 +1,15 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }}

-

{{$t('description.instructions')}}

-
-
- -
-
- - -
-
- -
-
- -
-
- -
-
-
-
- - \ No newline at end of file + +
+
+

{{ $t('title') }}

+

{{$t('description.instructions')}}

+
+
+
+
+ + +
+
+
\ No newline at end of file diff --git a/print/templates/email/client-debt-statement/client-debt-statement.js b/print/templates/email/client-debt-statement/client-debt-statement.js index f32f9e239..d050a9ae3 100755 --- a/print/templates/email/client-debt-statement/client-debt-statement.js +++ b/print/templates/email/client-debt-statement/client-debt-statement.js @@ -1,22 +1,27 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); const attachment = new Component('attachment'); -const attachments = require('./attachments.json'); module.exports = { name: 'client-debt-statement', components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build(), + 'email-body': emailBody.build(), 'attachment': attachment.build() }, data() { - return {attachments}; + return { + attachments: [ + { + filename: 'client-debt-statement.pdf', + type: 'pdf', + path: `Clients/${this.id}/client-debt-statement-pdf` + } + ] + }; }, props: { - recipientId: { - type: [Number, String], + id: { + type: Number, required: true }, from: { diff --git a/print/templates/email/client-welcome/assets/css/import.js b/print/templates/email/client-welcome/assets/css/import.js index b44d6bd37..4b4bb7086 100644 --- a/print/templates/email/client-welcome/assets/css/import.js +++ b/print/templates/email/client-welcome/assets/css/import.js @@ -1,8 +1,11 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`]) + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) .mergeStyles(); diff --git a/print/templates/email/client-welcome/client-welcome.html b/print/templates/email/client-welcome/client-welcome.html index 07b61b3e6..3554b6e92 100644 --- a/print/templates/email/client-welcome/client-welcome.html +++ b/print/templates/email/client-welcome/client-welcome.html @@ -1,92 +1,56 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }}

-

{{$t('dearClient')}},

-

- -

-

{{$t('clientId')}}: {{client.id}}
-
{{$t('user')}}: {{client.userName}}
-
{{$t('password')}}: ******** - ({{$t('passwordResetText')}}) -
-

+ +
+
+

{{ $t('title') }}

+

{{$t('dearClient')}},

+

-

{{$t('sections.howToBuy.title')}}

-

{{$t('sections.howToBuy.description')}}

-
    -
  1. - -
  2. -
-

{{$t('sections.howToBuy.stock')}}

-

{{$t('sections.howToBuy.delivery')}}

- -

{{$t('sections.howToPay.title')}}

-

{{$t('sections.howToPay.description')}}

-
    -
  • - -
  • -
+

+

{{$t('clientId')}}: {{client.id}}
+
{{$t('user')}}: {{client.userName}}
+
{{$t('password')}}: ******** + ({{$t('passwordResetText')}}) +
+

-

{{$t('sections.toConsider.title')}}

-

{{$t('sections.toConsider.description')}}

+

{{$t('sections.howToBuy.title')}}

+

{{$t('sections.howToBuy.description')}}

+
    +
  1. + +
  2. +
+

{{$t('sections.howToBuy.stock')}}

+

{{$t('sections.howToBuy.delivery')}}

-

{{$t('sections.claimsPolicy.title')}}

-

{{$t('sections.claimsPolicy.description')}}

+

{{$t('sections.howToPay.title')}}

+

{{$t('sections.howToPay.description')}}

+
    +
  • + +
  • +
-

-

-

- {{$t('salesPersonName')}}: {{client.salesPersonName}} -
-
- {{$t('salesPersonPhone')}}: {{client.salesPersonPhone}} -
-
- {{$t('salesPersonEmail')}}: - {{client.salesPersonEmail}} -
-

-
-
- -
-
- -
-
- -
-
-
-
- - \ No newline at end of file +

{{$t('sections.toConsider.title')}}

+

{{$t('sections.toConsider.description')}}

+ +

{{$t('sections.claimsPolicy.title')}}

+

{{$t('sections.claimsPolicy.description')}}

+ +

+

+

+ {{$t('salesPersonName')}}: {{client.salesPersonName}} +
+
+ {{$t('salesPersonPhone')}}: {{client.salesPersonPhone}} +
+
+ {{$t('salesPersonEmail')}}: + {{client.salesPersonEmail}} +
+

+
+
+ diff --git a/print/templates/email/client-welcome/client-welcome.js b/print/templates/email/client-welcome/client-welcome.js index eeb11bb78..9fbcf86a6 100755 --- a/print/templates/email/client-welcome/client-welcome.js +++ b/print/templates/email/client-welcome/client-welcome.js @@ -1,24 +1,22 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); module.exports = { name: 'client-welcome', async serverPrefetch() { - this.client = await this.fetchClient(this.recipientId); + this.client = await this.fetchClient(this.id); }, methods: { - fetchClient(clientId) { - return this.findOneFromDef('client', [clientId]); + fetchClient(id) { + return this.findOneFromDef('client', [id]); }, }, components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build() + 'email-body': emailBody.build(), }, props: { - recipientId: { - type: [Number, String], + id: { + type: Number, required: true } } diff --git a/print/templates/email/client-welcome/locale/es.yml b/print/templates/email/client-welcome/locale/es.yml index 42426dc74..478fd242c 100644 --- a/print/templates/email/client-welcome/locale/es.yml +++ b/print/templates/email/client-welcome/locale/es.yml @@ -1,8 +1,8 @@ subject: Bienvenido a Verdnatura title: "¡Te damos la bienvenida!" dearClient: Estimado cliente -clientData: 'Tus datos para poder comprar en la web de Verdnatura (https://www.verdnatura.es) +clientData: 'Tus datos para poder comprar en la web de Verdnatura (https://shop.verdnatura.es) o en nuestras aplicaciones para iOS y Android, son' diff --git a/print/templates/email/credit-request/assets/css/import.js b/print/templates/email/credit-request/assets/css/import.js index b44d6bd37..89b2afaa5 100644 --- a/print/templates/email/credit-request/assets/css/import.js +++ b/print/templates/email/credit-request/assets/css/import.js @@ -1,8 +1,11 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`]) - .mergeStyles(); + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) + .mergeStyles(); \ No newline at end of file diff --git a/print/templates/email/credit-request/credit-request.html b/print/templates/email/credit-request/credit-request.html index e63eba7f7..b02da93af 100644 --- a/print/templates/email/credit-request/credit-request.html +++ b/print/templates/email/credit-request/credit-request.html @@ -1,55 +1,15 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }}

-

{{$t('description.instructions')}}

-
-
- -
-
- - -
-
- -
-
- -
-
- -
-
-
-
- - \ No newline at end of file + +
+
+

{{ $t('title') }}

+

{{$t('description.instructions')}}

+
+
+
+
+ + +
+
+
\ No newline at end of file diff --git a/print/templates/email/credit-request/credit-request.js b/print/templates/email/credit-request/credit-request.js index 69463f43a..358fe6904 100755 --- a/print/templates/email/credit-request/credit-request.js +++ b/print/templates/email/credit-request/credit-request.js @@ -1,17 +1,28 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); const attachment = new Component('attachment'); -const attachments = require('./attachments.json'); module.exports = { name: 'credit-request', components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build(), + 'email-body': emailBody.build(), 'attachment': attachment.build() }, data() { - return {attachments}; + return { + attachments: [ + { + filename: 'credit-request.pdf', + type: 'pdf', + path: `Clients/${this.id}/credit-request-pdf` + } + ] + }; }, + props: { + id: { + type: Number, + required: true + } + } }; diff --git a/print/templates/email/delivery-note-link/assets/css/import.js b/print/templates/email/delivery-note-link/assets/css/import.js index c742fdf90..fec23d870 100644 --- a/print/templates/email/delivery-note-link/assets/css/import.js +++ b/print/templates/email/delivery-note-link/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/email/delivery-note-link/assets/css/style.css b/print/templates/email/delivery-note-link/assets/css/style.css index 5db85befa..2956202f8 100644 --- a/print/templates/email/delivery-note-link/assets/css/style.css +++ b/print/templates/email/delivery-note-link/assets/css/style.css @@ -2,4 +2,8 @@ border: 2px dashed #8dba25; border-radius: 3px; text-align: center +} + +a { + color: #8dba25 } \ No newline at end of file diff --git a/print/templates/email/delivery-note-link/delivery-note-link.html b/print/templates/email/delivery-note-link/delivery-note-link.html index ab58cbb24..55165c6b3 100644 --- a/print/templates/email/delivery-note-link/delivery-note-link.html +++ b/print/templates/email/delivery-note-link/delivery-note-link.html @@ -1,69 +1,24 @@ - - - - - - {{ $t('subject') }} - - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }}

-

{{$t('dear')}}

-

-
-
- -
-
-

{{$t('copyLink')}}

- -
-
- -
-
-

-

-

-
-
- - -
-
- -
-
- -
-
-
-
- - \ No newline at end of file + +
+
+

{{ $t('title') }}

+

{{$t('dear')}}

+

+
+
+
+
+

{{$t('copyLink')}}

+ +
+
+
+
+

+

+

+
+
+
diff --git a/print/templates/email/delivery-note-link/delivery-note-link.js b/print/templates/email/delivery-note-link/delivery-note-link.js index 471b370d9..0bc8970c2 100755 --- a/print/templates/email/delivery-note-link/delivery-note-link.js +++ b/print/templates/email/delivery-note-link/delivery-note-link.js @@ -1,16 +1,14 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); module.exports = { name: 'delivery-note-link', components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build() + 'email-body': emailBody.build(), }, props: { - ticketId: { - type: [Number, String], + id: { + type: Number, required: true } } diff --git a/print/templates/email/delivery-note-link/locale/en.yml b/print/templates/email/delivery-note-link/locale/en.yml index aaa545525..2fccb56c6 100644 --- a/print/templates/email/delivery-note-link/locale/en.yml +++ b/print/templates/email/delivery-note-link/locale/en.yml @@ -2,7 +2,7 @@ subject: Your delivery note title: Your delivery note dear: Dear client description: The delivery note from the order {0} is now available.
- You can download it by clicking this link. + You can download it by clicking this link. copyLink: 'As an alternative, you can copy the following link in your browser:' poll: If you wish, you can answer our satisfaction survey to help us provide better service. Your opinion is very important for us! diff --git a/print/templates/email/delivery-note-link/locale/es.yml b/print/templates/email/delivery-note-link/locale/es.yml index 0bafd459a..d6d134f58 100644 --- a/print/templates/email/delivery-note-link/locale/es.yml +++ b/print/templates/email/delivery-note-link/locale/es.yml @@ -2,7 +2,7 @@ subject: Tu albarán title: Tu albarán dear: Estimado cliente description: Ya está disponible el albarán correspondiente al pedido {0}.
- Puedes verlo haciendo clic en este enlace. + Puedes verlo haciendo clic en este enlace. copyLink: 'Como alternativa, puedes copiar el siguiente enlace en tu navegador:' poll: Si lo deseas, puedes responder a nuestra encuesta de satisfacción para ayudarnos a prestar un mejor servicio. ¡Tu opinión es muy importante para nosotros! diff --git a/print/templates/email/delivery-note-link/locale/fr.yml b/print/templates/email/delivery-note-link/locale/fr.yml index bcb16c09f..642679089 100644 --- a/print/templates/email/delivery-note-link/locale/fr.yml +++ b/print/templates/email/delivery-note-link/locale/fr.yml @@ -2,7 +2,7 @@ subject: Votre bon de livraison title: Votre bon de livraison dear: Cher client, description: Le bon de livraison correspondant à la commande {0} est maintenant disponible.
- Vous pouvez le voir en cliquant sur ce lien. + Vous pouvez le voir en cliquant sur ce lien. copyLink: 'Vous pouvez également copier le lien suivant dans votre navigateur:' poll: Si vous le souhaitez, vous pouvez répondre à notre questionaire de satisfaction pour nous aider à améliorer notre service. Votre avis est très important pour nous! diff --git a/print/templates/email/delivery-note-link/locale/pt.yml b/print/templates/email/delivery-note-link/locale/pt.yml index 1aab4b6d8..7aa0f3b8a 100644 --- a/print/templates/email/delivery-note-link/locale/pt.yml +++ b/print/templates/email/delivery-note-link/locale/pt.yml @@ -2,9 +2,9 @@ subject: Sua nota de entrega title: Sua nota de entrega dear: Estimado cliente description: Já está disponível sua nota de entrega correspondente a encomenda numero {0}.
- Para ver-lo faça um clique neste link. + Para ver-lo faça um clique neste link. copyLink: 'Como alternativa, podes copiar o siguinte link no teu navegador:' poll: Si o deseja, podes responder nosso questionário de satiscação para ajudar-nos a prestar-vos um melhor serviço. Tua opinião é muito importante para nós! help: Cualquer dúvida que surja, no hesites em consultar-la, Estamos aqui para atender-te! -conclusion: Obrigado por tua atenção! \ No newline at end of file +conclusion: Obrigado por tua atenção! diff --git a/print/templates/email/delivery-note/assets/css/import.js b/print/templates/email/delivery-note/assets/css/import.js index b44d6bd37..4b4bb7086 100644 --- a/print/templates/email/delivery-note/assets/css/import.js +++ b/print/templates/email/delivery-note/assets/css/import.js @@ -1,8 +1,11 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`]) + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) .mergeStyles(); diff --git a/print/templates/email/delivery-note/delivery-note.html b/print/templates/email/delivery-note/delivery-note.html index 96c53b1d7..6525d8059 100644 --- a/print/templates/email/delivery-note/delivery-note.html +++ b/print/templates/email/delivery-note/delivery-note.html @@ -1,49 +1,12 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }}

-

{{$t('dear')}},

-

-

-

-

-
-
- -
-
- -
-
- -
-
-
-
- - \ No newline at end of file + +
+
+

{{ $t('title') }}

+

{{$t('dear')}},

+

+

+

+

+
+
+
\ No newline at end of file diff --git a/print/templates/email/delivery-note/delivery-note.js b/print/templates/email/delivery-note/delivery-note.js index ffd2fe202..90e59fc2d 100755 --- a/print/templates/email/delivery-note/delivery-note.js +++ b/print/templates/email/delivery-note/delivery-note.js @@ -1,16 +1,14 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); module.exports = { name: 'delivery-note', components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build() + 'email-body': emailBody.build(), }, props: { - ticketId: { - type: [Number, String], + id: { + type: Number, required: true } } diff --git a/print/templates/email/driver-route/assets/css/import.js b/print/templates/email/driver-route/assets/css/import.js index b44d6bd37..4b4bb7086 100644 --- a/print/templates/email/driver-route/assets/css/import.js +++ b/print/templates/email/driver-route/assets/css/import.js @@ -1,8 +1,11 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`]) + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) .mergeStyles(); diff --git a/print/templates/email/driver-route/driver-route.html b/print/templates/email/driver-route/driver-route.html index 069edbfc4..b570e862b 100644 --- a/print/templates/email/driver-route/driver-route.html +++ b/print/templates/email/driver-route/driver-route.html @@ -1,45 +1,8 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }}

-

{{$t('description.instructions')}}

-
-
- -
-
- -
-
- -
-
-
-
- - \ No newline at end of file + +
+
+

{{ $t('title') }}

+

{{$t('description.instructions')}}

+
+
+
\ No newline at end of file diff --git a/print/templates/email/driver-route/driver-route.js b/print/templates/email/driver-route/driver-route.js index 378cd82ce..38f701fed 100755 --- a/print/templates/email/driver-route/driver-route.js +++ b/print/templates/email/driver-route/driver-route.js @@ -1,16 +1,14 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); module.exports = { name: 'driver-route', components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build() + 'email-body': emailBody.build(), }, props: { - routeId: { - type: [Number, String], + id: { + type: Number, required: true } } diff --git a/print/templates/email/email-verify/assets/css/import.js b/print/templates/email/email-verify/assets/css/import.js new file mode 100644 index 000000000..7360587f7 --- /dev/null +++ b/print/templates/email/email-verify/assets/css/import.js @@ -0,0 +1,13 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`, + `${__dirname}/style.css`]) + .mergeStyles(); + diff --git a/print/templates/email/email-verify/assets/css/style.css b/print/templates/email/email-verify/assets/css/style.css new file mode 100644 index 000000000..5db85befa --- /dev/null +++ b/print/templates/email/email-verify/assets/css/style.css @@ -0,0 +1,5 @@ +.external-link { + border: 2px dashed #8dba25; + border-radius: 3px; + text-align: center +} \ No newline at end of file diff --git a/print/templates/email/email-verify/email-verify.html b/print/templates/email/email-verify/email-verify.html new file mode 100644 index 000000000..b8a6e263c --- /dev/null +++ b/print/templates/email/email-verify/email-verify.html @@ -0,0 +1,48 @@ + + + + + + {{ $t('subject') }} + + + + + + + + +
+ +
+
+
+ +
+
+ +
+
+ +
+
+

+ {{ $t(`click`) }} + {{ $t('subject') }} +

+
+
+ + +
+
+ +
+
+ +
+
+
+
+ + diff --git a/print/templates/email/email-verify/email-verify.js b/print/templates/email/email-verify/email-verify.js new file mode 100755 index 000000000..4f2b29266 --- /dev/null +++ b/print/templates/email/email-verify/email-verify.js @@ -0,0 +1,17 @@ +const Component = require(`vn-print/core/component`); +const emailHeader = new Component('email-header'); +const emailFooter = new Component('email-footer'); + +module.exports = { + name: 'email-verify', + components: { + 'email-header': emailHeader.build(), + 'email-footer': emailFooter.build() + }, + props: { + url: { + type: String, + required: true + } + } +}; diff --git a/print/templates/email/email-verify/locale/en.yml b/print/templates/email/email-verify/locale/en.yml new file mode 100644 index 000000000..0298f53b4 --- /dev/null +++ b/print/templates/email/email-verify/locale/en.yml @@ -0,0 +1,3 @@ +subject: Email Verify +title: Email Verify +click: Click on the following link to verify this email. If you haven't requested this email, just ignore it diff --git a/print/templates/email/email-verify/locale/es.yml b/print/templates/email/email-verify/locale/es.yml new file mode 100644 index 000000000..37bd6ef27 --- /dev/null +++ b/print/templates/email/email-verify/locale/es.yml @@ -0,0 +1,3 @@ +subject: Verificar correo +title: Verificar correo +click: Pulsa en el siguiente link para verificar este correo. Si no has pedido este correo, simplemente ignóralo diff --git a/print/templates/email/incoterms-authorization/assets/css/import.js b/print/templates/email/incoterms-authorization/assets/css/import.js new file mode 100644 index 000000000..4b4bb7086 --- /dev/null +++ b/print/templates/email/incoterms-authorization/assets/css/import.js @@ -0,0 +1,11 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) + .mergeStyles(); diff --git a/print/templates/email/incoterms-authorization/attachments.json b/print/templates/email/incoterms-authorization/attachments.json new file mode 100644 index 000000000..9dfd945db --- /dev/null +++ b/print/templates/email/incoterms-authorization/attachments.json @@ -0,0 +1,6 @@ +[ + { + "filename": "incoterms-authorization.pdf", + "component": "incoterms-authorization" + } +] \ No newline at end of file diff --git a/print/templates/email/incoterms-authorization/incoterms-authorization.html b/print/templates/email/incoterms-authorization/incoterms-authorization.html new file mode 100644 index 000000000..98d2b333c --- /dev/null +++ b/print/templates/email/incoterms-authorization/incoterms-authorization.html @@ -0,0 +1,17 @@ + +
+
+

{{ $t('title') }}

+

{{$t('description.dear')}},

+

{{$t('description.instructions')}}

+

{{$t('description.conclusion')}}

+
+
+
+
+ + +
+
+
\ No newline at end of file diff --git a/print/templates/email/incoterms-authorization/incoterms-authorization.js b/print/templates/email/incoterms-authorization/incoterms-authorization.js new file mode 100755 index 000000000..cb3cebc09 --- /dev/null +++ b/print/templates/email/incoterms-authorization/incoterms-authorization.js @@ -0,0 +1,33 @@ +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); +const attachment = new Component('attachment'); + +module.exports = { + name: 'incoterms-authorization', + data() { + return { + attachments: [ + { + filename: 'incoterms-authorization.pdf', + type: 'pdf', + path: `Clients/${this.id}/incoterms-authorization-pdf` + } + ] + }; + }, + components: { + 'email-body': emailBody.build(), + 'attachment': attachment.build() + }, + props: { + id: { + type: Number, + required: true, + description: 'The client id' + }, + companyId: { + type: Number, + required: true + } + } +}; diff --git a/print/templates/email/incoterms-authorization/locale/es.yml b/print/templates/email/incoterms-authorization/locale/es.yml new file mode 100644 index 000000000..e8ce679fc --- /dev/null +++ b/print/templates/email/incoterms-authorization/locale/es.yml @@ -0,0 +1,6 @@ +subject: Autorización incoterms +title: Autorización incoterms +description: + dear: Estimado cliente + instructions: A continuación le adjuntamos la autorización incoterms que deberá entregar rellenada y firmada. + conclusion: ¡Gracias por su atención! \ No newline at end of file diff --git a/print/templates/email/incoterms-authorization/locale/fr.yml b/print/templates/email/incoterms-authorization/locale/fr.yml new file mode 100644 index 000000000..a2dc6fe3a --- /dev/null +++ b/print/templates/email/incoterms-authorization/locale/fr.yml @@ -0,0 +1,6 @@ +subject: Autorisation Incoterm +title: Autorisation Incoterm +description: + dear: Chers clients + instructions: Veuillez trouver ci-joint l'autorisation des INCOTERMS, une fois le document rempli doit être signé et renvoyé par e-mail. + conclusion: Dans l'attente de votre réponse, nous vous prions d'agréer, Madame, Monsieur, nos salutations distinguées. \ No newline at end of file diff --git a/print/templates/email/incoterms-authorization/locale/pt.yml b/print/templates/email/incoterms-authorization/locale/pt.yml new file mode 100644 index 000000000..bdf25ed0b --- /dev/null +++ b/print/templates/email/incoterms-authorization/locale/pt.yml @@ -0,0 +1,6 @@ +subject: Autorização do Incoterm +title: Autorização do Incoterm +description: + dear: Estimado cliente + instructions: Abaixo anexamos a autorização dos incoterms que deves preencher e reenviar-nos. + conclusion: Obrigado pela atenção. \ No newline at end of file diff --git a/print/templates/email/invoice-electronic/invoice-electronic.html b/print/templates/email/invoice-electronic/invoice-electronic.html new file mode 100644 index 000000000..fc96e0970 --- /dev/null +++ b/print/templates/email/invoice-electronic/invoice-electronic.html @@ -0,0 +1,13 @@ + + + + + + {{ $t('subject') }} + + +

{{ $t('title') }} {{name}}

+

{{ $t('clientMail') }} {{email}}

+

{{ $t('ticketId') }} {{ticketId}} + + diff --git a/print/templates/email/invoice-electronic/invoice-electronic.js b/print/templates/email/invoice-electronic/invoice-electronic.js new file mode 100644 index 000000000..2e1e739ac --- /dev/null +++ b/print/templates/email/invoice-electronic/invoice-electronic.js @@ -0,0 +1,21 @@ +module.exports = { + name: 'invoice-electronic', + props: { + name: { + type: [String], + required: true + }, + email: { + type: [String], + required: true + }, + ticketId: { + type: [Number], + required: true + }, + url: { + type: [String], + required: true + } + }, +}; diff --git a/print/templates/email/invoice-electronic/locale/en.yml b/print/templates/email/invoice-electronic/locale/en.yml new file mode 100644 index 000000000..5523a2fa3 --- /dev/null +++ b/print/templates/email/invoice-electronic/locale/en.yml @@ -0,0 +1,4 @@ +subject: A electronic invoice has been created +title: A new electronic invoice has been created for the client +clientMail: The client's email is +ticketId: The invoice's ticket is \ No newline at end of file diff --git a/print/templates/email/invoice-electronic/locale/es.yml b/print/templates/email/invoice-electronic/locale/es.yml new file mode 100644 index 000000000..2cbcfbb36 --- /dev/null +++ b/print/templates/email/invoice-electronic/locale/es.yml @@ -0,0 +1,4 @@ +subject: Se ha creado una factura electrónica +title: Se ha creado una nueva factura electrónica para el cliente +clientMail: El correo del cliente es +ticketId: El ticket de la factura es \ No newline at end of file diff --git a/print/templates/email/invoice/assets/css/import.js b/print/templates/email/invoice/assets/css/import.js index b44d6bd37..4b4bb7086 100644 --- a/print/templates/email/invoice/assets/css/import.js +++ b/print/templates/email/invoice/assets/css/import.js @@ -1,8 +1,11 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`]) + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) .mergeStyles(); diff --git a/print/templates/email/invoice/invoice.html b/print/templates/email/invoice/invoice.html index 66bad472a..9d0e4562c 100644 --- a/print/templates/email/invoice/invoice.html +++ b/print/templates/email/invoice/invoice.html @@ -1,49 +1,12 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }}

-

{{$t('dear')}},

-

-

-

-

-
-
- -
-
- -
-
- -
-
-
-
- - \ No newline at end of file + +

+
+

{{ $t('title') }}

+

{{$t('dear')}},

+

+

+

+

+
+
+ \ No newline at end of file diff --git a/print/templates/email/invoice/invoice.js b/print/templates/email/invoice/invoice.js index d92b65cb3..cb90e461f 100755 --- a/print/templates/email/invoice/invoice.js +++ b/print/templates/email/invoice/invoice.js @@ -1,24 +1,21 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); - +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); module.exports = { name: 'invoice', async serverPrefetch() { - this.invoice = await this.fetchInvoice(this.invoiceId); + this.invoice = await this.fetchInvoice(this.reference); }, methods: { - fetchInvoice(invoiceId) { - return this.findOneFromDef('invoice', [invoiceId]); + fetchInvoice(reference) { + return this.findOneFromDef('invoice', [reference]); }, }, components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build() + 'email-body': emailBody.build(), }, props: { - invoiceId: { - type: [Number, String], + reference: { + type: String, required: true } } diff --git a/print/templates/email/invoice/sql/invoice.sql b/print/templates/email/invoice/sql/invoice.sql index 195621a36..b6f845fb0 100644 --- a/print/templates/email/invoice/sql/invoice.sql +++ b/print/templates/email/invoice/sql/invoice.sql @@ -4,4 +4,4 @@ SELECT FROM invoiceOut io JOIN ticket t ON t.refFk = io.ref JOIN client c ON c.id = io.clientFk -WHERE io.id = ? \ No newline at end of file +WHERE t.refFk = ? \ No newline at end of file diff --git a/print/templates/email/invoiceIn/assets/css/import.js b/print/templates/email/invoiceIn/assets/css/import.js new file mode 100644 index 000000000..4b4bb7086 --- /dev/null +++ b/print/templates/email/invoiceIn/assets/css/import.js @@ -0,0 +1,11 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) + .mergeStyles(); diff --git a/print/templates/email/invoiceIn/attachments.json b/print/templates/email/invoiceIn/attachments.json new file mode 100644 index 000000000..cd23d3f92 --- /dev/null +++ b/print/templates/email/invoiceIn/attachments.json @@ -0,0 +1,6 @@ +[ + { + "filename": "invoiceIn.pdf", + "component": "invoiceIn" + } +] diff --git a/print/templates/email/invoiceIn/invoiceIn.html b/print/templates/email/invoiceIn/invoiceIn.html new file mode 100644 index 000000000..15abb8177 --- /dev/null +++ b/print/templates/email/invoiceIn/invoiceIn.html @@ -0,0 +1,10 @@ + +
+
+

{{ $t('title') }}

+

{{$t('dear')}},

+

+

+
+
+
\ No newline at end of file diff --git a/print/templates/email/invoiceIn/invoiceIn.js b/print/templates/email/invoiceIn/invoiceIn.js new file mode 100755 index 000000000..4889436de --- /dev/null +++ b/print/templates/email/invoiceIn/invoiceIn.js @@ -0,0 +1,8 @@ +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); +module.exports = { + name: 'invoiceIn', + components: { + 'email-body': emailBody.build(), + } +}; diff --git a/print/templates/email/invoiceIn/locale/en.yml b/print/templates/email/invoiceIn/locale/en.yml new file mode 100644 index 000000000..e238ecf61 --- /dev/null +++ b/print/templates/email/invoiceIn/locale/en.yml @@ -0,0 +1,5 @@ +subject: Your agricultural receipt +title: Your agricultural receipt +dear: Dear supplier +description: Attached you can find agricultural receipt generated from your last deliveries. Please return a signed and stamped copy to our administration department. +conclusion: Thanks for your attention! diff --git a/print/templates/email/invoiceIn/locale/es.yml b/print/templates/email/invoiceIn/locale/es.yml new file mode 100644 index 000000000..456122c75 --- /dev/null +++ b/print/templates/email/invoiceIn/locale/es.yml @@ -0,0 +1,5 @@ +subject: Tu recibo agrícola +title: Tu recibo agrícola +dear: Estimado proveedor +description: Adjunto puede encontrar recibo agrícola generado de sus últimas entregas. Por favor, devuelva una copia firmada y sellada a nuestro de departamento de administración. +conclusion: ¡Gracias por tu atención! diff --git a/print/templates/email/invoiceIn/locale/fr.yml b/print/templates/email/invoiceIn/locale/fr.yml new file mode 100644 index 000000000..dd35631e5 --- /dev/null +++ b/print/templates/email/invoiceIn/locale/fr.yml @@ -0,0 +1,5 @@ +subject: Votre reçu agricole +title: Votre reçu agricole +dear: Cher Fournisseur +description: Vous trouverez en pièce jointe le reçu agricole généré à partir de vos dernières livraisons. Veuillez retourner une copie signée et tamponnée à notre service administratif. +conclusion: Merci pour votre attention! diff --git a/print/templates/email/invoiceIn/locale/pt.yml b/print/templates/email/invoiceIn/locale/pt.yml new file mode 100644 index 000000000..5dffc7acf --- /dev/null +++ b/print/templates/email/invoiceIn/locale/pt.yml @@ -0,0 +1,5 @@ +subject: A sua recibo agrícola +title: A sua recibo agrícola +dear: Caro Fornecedor +description: Em anexo encontra-se o recibo agrícola gerado a partir das suas últimas entregas. Por favor, devolva uma cópia assinada e carimbada ao nosso departamento de administração. +conclusion: Obrigado pela atenção. diff --git a/print/templates/email/letter-debtor-nd/assets/css/import.js b/print/templates/email/letter-debtor-nd/assets/css/import.js index 624404a6c..1582b82c5 100644 --- a/print/templates/email/letter-debtor-nd/assets/css/import.js +++ b/print/templates/email/letter-debtor-nd/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`]) + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) .mergeStyles(); diff --git a/print/templates/email/letter-debtor-nd/letter-debtor-nd.html b/print/templates/email/letter-debtor-nd/letter-debtor-nd.html index 64bc7ca69..44a34a9b4 100644 --- a/print/templates/email/letter-debtor-nd/letter-debtor-nd.html +++ b/print/templates/email/letter-debtor-nd/letter-debtor-nd.html @@ -1,88 +1,48 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }}

-

{{ $t('sections.introduction.title') }},

-

{{ $t('sections.introduction.description') }}

-

{{ $t('sections.introduction.terms') }}

+ +
+
+

{{ $t('title') }}

+

{{ $t('sections.introduction.title') }},

+

{{ $t('sections.introduction.description') }}

+

{{ $t('sections.introduction.terms') }}

-

- {{ $t('sections.payMethod.description') }}: -

    -
  1. - {{ option }} -
  2. -
-

+

+ {{ $t('sections.payMethod.description') }}: +

    +
  1. + {{ option }} +
  2. +
+

-

- {{ $t('sections.legalAction.description') }}: -

    -
  1. - {{ option }} -
  2. -
-

+

+ {{ $t('sections.legalAction.description') }}: +

    +
  1. + {{ option }} +
  2. +
+

-

-

+

+

-

-

-
{{debtor.bankName}}
-
{{debtor.iban}}
-
-
{{$t('transferAccount') }}
-
-
-

-
-
- -
-
- - -
-
- -
-
- -
-
- -
-
-
-
- - \ No newline at end of file +

+

+
{{debtor.bankName}}
+
{{debtor.iban}}
+
+
{{$t('transferAccount') }}
+
+
+

+
+
+
+
+ + +
+
+ \ No newline at end of file diff --git a/print/templates/email/letter-debtor-nd/letter-debtor-nd.js b/print/templates/email/letter-debtor-nd/letter-debtor-nd.js index 5e010d1ba..54ed9fed6 100755 --- a/print/templates/email/letter-debtor-nd/letter-debtor-nd.js +++ b/print/templates/email/letter-debtor-nd/letter-debtor-nd.js @@ -1,40 +1,42 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); const attachment = new Component('attachment'); -const attachments = require('./attachments.json'); module.exports = { name: 'letter-debtor-nd', async serverPrefetch() { - this.debtor = await this.fetchDebtor(this.recipientId, this.companyId); + this.debtor = await this.fetchDebtor(this.id, this.companyId); if (!this.debtor) throw new Error('Something went wrong'); }, data() { - return {attachments}; + return { + attachments: [ + { + filename: 'letter-debtor.pdf', + type: 'pdf', + path: `Clients/${this.id}/letter-debtor-pdf` + } + ] + }; }, methods: { - fetchDebtor(clientId, companyId) { - return this.findOneFromDef('client', [clientId, companyId]); + fetchDebtor(id, companyId) { + return this.findOneFromDef('client', [id, companyId]); } }, components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build(), + 'email-body': emailBody.build(), 'attachment': attachment.build() }, props: { - authorization: { - required: true - }, - recipientId: { - type: [Number, String], + id: { + type: Number, required: true }, companyId: { - type: [Number, String], + type: Number, required: true } } diff --git a/print/templates/email/letter-debtor-nd/sql/client.sql b/print/templates/email/letter-debtor-nd/sql/client.sql index aad907a4b..d5da5d0d5 100644 --- a/print/templates/email/letter-debtor-nd/sql/client.sql +++ b/print/templates/email/letter-debtor-nd/sql/client.sql @@ -5,6 +5,6 @@ SELECT be.name AS bankName FROM client c JOIN company AS cny - JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk + JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk JOIN bankEntity be ON be.id = sa.bankEntityFk WHERE c.id = ? AND cny.id = ? \ No newline at end of file diff --git a/print/templates/email/letter-debtor-st/assets/css/import.js b/print/templates/email/letter-debtor-st/assets/css/import.js index 624404a6c..1582b82c5 100644 --- a/print/templates/email/letter-debtor-st/assets/css/import.js +++ b/print/templates/email/letter-debtor-st/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`]) + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) .mergeStyles(); diff --git a/print/templates/email/letter-debtor-st/letter-debtor-st.html b/print/templates/email/letter-debtor-st/letter-debtor-st.html index c78657ec7..36f300c98 100644 --- a/print/templates/email/letter-debtor-st/letter-debtor-st.html +++ b/print/templates/email/letter-debtor-st/letter-debtor-st.html @@ -1,71 +1,31 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }} {{$i18n.locale}}

-

{{ $t('sections.introduction.title') }},

-

{{ $t('sections.introduction.description') }}

+ +
+
+

{{ $t('title') }}

+

{{ $t('sections.introduction.title') }},

+

{{ $t('sections.introduction.description') }}

-

{{ $t('checkExtract') }}

-

{{ $t('checkValidData') }}

-

{{ $t('payMethod') }}

-

{{ $t('conclusion') }}

+

{{ $t('checkExtract') }}

+

{{ $t('checkValidData') }}

+

{{ $t('payMethod') }}

+

{{ $t('conclusion') }}

-

-

-
{{debtor.bankName}}
-
{{debtor.iban}}
-
-
{{$t('transferAccount') }}
-
-
-

-
-
- -
-
- - -
-
- -
-
- -
-
- -
-
-
-
- - \ No newline at end of file +

+

+
{{debtor.bankName}}
+
{{debtor.iban}}
+
+
{{$t('transferAccount') }}
+
+
+

+
+ +
+
+ + +
+
+ \ No newline at end of file diff --git a/print/templates/email/letter-debtor-st/letter-debtor-st.js b/print/templates/email/letter-debtor-st/letter-debtor-st.js index a514097cf..e0a690f81 100755 --- a/print/templates/email/letter-debtor-st/letter-debtor-st.js +++ b/print/templates/email/letter-debtor-st/letter-debtor-st.js @@ -1,37 +1,42 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); const attachment = new Component('attachment'); -const attachments = require('./attachments.json'); module.exports = { name: 'letter-debtor-st', async serverPrefetch() { - this.debtor = await this.fetchDebtor(this.recipientId, this.companyId); + this.debtor = await this.fetchDebtor(this.id, this.companyId); if (!this.debtor) throw new Error('Something went wrong'); }, data() { - return {attachments}; + return { + attachments: [ + { + filename: 'letter-debtor.pdf', + type: 'pdf', + path: `Clients/${this.id}/letter-debtor-pdf` + } + ] + }; }, methods: { - fetchDebtor(clientId, companyId) { - return this.findOneFromDef('client', [clientId, companyId]); + fetchDebtor(id, companyId) { + return this.findOneFromDef('client', [id, companyId]); } }, components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build(), + 'email-body': emailBody.build(), 'attachment': attachment.build() }, props: { - recipientId: { - type: [Number, String], + id: { + type: Number, required: true }, companyId: { - type: [Number, String], + type: Number, required: true }, } diff --git a/print/templates/email/letter-debtor-st/locale/pt.yml b/print/templates/email/letter-debtor-st/locale/pt.yml new file mode 100644 index 000000000..6f6082345 --- /dev/null +++ b/print/templates/email/letter-debtor-st/locale/pt.yml @@ -0,0 +1,16 @@ +subject: Aviso inicial por saldo devedor +title: Aviso inicial por saldo devedor +sections: + introduction: + title: Estimado cliente + description: Através do presente escrito comunicamos-lhe que, segundo os nossos dados contáveis, + a sua conta tem um saldo pendente de liquidar. +checkExtract: Solicitamos-lhe que comprove que o extrato anexado corresponde com os dados que dispõe. + O nosso departamento de administração aclarará qualquer dúvida que possa ter, + e igualmente lhe facilitará qualquer documento que solicite. +checkValidData: Se ao comprovar os dados aportados, resultam corretos, rogamos que proceda com a regularizar a situação +payMethod: Se não deseja acudir pessoalmente às nossas oficinas, pode realizar o pagamento mediante + transferência bancaria à conta que figura ao pé do comunicado, a indicar o seu número de cliente, + ou bem pode realizar o pagamento através do nosso sítio web. +conclusion: De antemão agradecemos-lhe a sua amável colaboração. +transferAccount: Dados para transferência bancária diff --git a/print/templates/email/letter-debtor-st/sql/client.sql b/print/templates/email/letter-debtor-st/sql/client.sql index aad907a4b..d5da5d0d5 100644 --- a/print/templates/email/letter-debtor-st/sql/client.sql +++ b/print/templates/email/letter-debtor-st/sql/client.sql @@ -5,6 +5,6 @@ SELECT be.name AS bankName FROM client c JOIN company AS cny - JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk + JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk JOIN bankEntity be ON be.id = sa.bankEntityFk WHERE c.id = ? AND cny.id = ? \ No newline at end of file diff --git a/print/templates/email/osticket-report/assets/css/import.js b/print/templates/email/osticket-report/assets/css/import.js index c742fdf90..7360587f7 100644 --- a/print/templates/email/osticket-report/assets/css/import.js +++ b/print/templates/email/osticket-report/assets/css/import.js @@ -1,9 +1,13 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`, `${__dirname}/style.css`]) .mergeStyles(); + diff --git a/print/templates/email/osticket-report/osticket-report.html b/print/templates/email/osticket-report/osticket-report.html index a9cf9a24a..94e2f4b85 100644 --- a/print/templates/email/osticket-report/osticket-report.html +++ b/print/templates/email/osticket-report/osticket-report.html @@ -1,99 +1,59 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- - - -
-
-
-

{{technician.name}} ({{technician.tickets.length}})

-
- - - - - - - - - - - - - - - - - - - -
{{$t('author')}}{{$t('dated')}}{{$t('ticketSubject')}}{{$t('ticketDescription')}}{{$t('resolution')}}
{{ticket.author}} -
- 🔓 {{ticket.created | date('%d-%m-%Y %H:%M')}} -
-
- 🔒 {{ticket.closed | date('%d-%m-%Y %H:%M')}} -
-
- - {{ticket.number}} - {{ticket.subject}} - -
-
-
- - -
-
- -
-
- -
-
-
-
- - \ No newline at end of file + + +
+
+
+

{{technician.name}} ({{technician.tickets.length}})

+
+ + + + + + + + + + + + + + + + + + + +
{{$t('author')}}{{$t('dated')}}{{$t('ticketSubject')}}{{$t('ticketDescription')}}{{$t('resolution')}}
{{ticket.author}} +
🔓 {{ticket.created | date('%d-%m-%Y %H:%M')}}
+
🔒 {{ticket.closed | date('%d-%m-%Y %H:%M')}}
+
+ + {{ticket.number}} - {{ticket.subject}} + +
+
+
+
diff --git a/print/templates/email/osticket-report/osticket-report.js b/print/templates/email/osticket-report/osticket-report.js index 45fadd4f1..0d39947d5 100755 --- a/print/templates/email/osticket-report/osticket-report.js +++ b/print/templates/email/osticket-report/osticket-report.js @@ -1,6 +1,5 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); module.exports = { name: 'osticket-report', @@ -38,7 +37,7 @@ module.exports = { dated: function() { const filters = this.$options.filters; - return filters.date(new Date(), '%d-%m-%Y'); + return filters.date(Date.vnNew(), '%d-%m-%Y'); }, startedTime: function() { return new Date(this.started).getTime(); @@ -61,8 +60,7 @@ module.exports = { } }, components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build() + 'email-body': emailBody.build(), }, props: {} }; diff --git a/print/templates/email/payment-update/assets/css/import.js b/print/templates/email/payment-update/assets/css/import.js index b44d6bd37..1582b82c5 100644 --- a/print/templates/email/payment-update/assets/css/import.js +++ b/print/templates/email/payment-update/assets/css/import.js @@ -1,8 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`]) + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) .mergeStyles(); + diff --git a/print/templates/email/payment-update/payment-update.html b/print/templates/email/payment-update/payment-update.html index 98854beef..35989732d 100644 --- a/print/templates/email/payment-update/payment-update.html +++ b/print/templates/email/payment-update/payment-update.html @@ -1,66 +1,28 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }}

-

{{ $t('sections.introduction.title') }},

-

+ +
+
+

{{ $t('title') }}

+

{{ $t('sections.introduction.title') }},

+

-

-

- {{ $t('sections.pay.method') }}: - {{payMethod.name}} -
-
- {{ $t('sections.pay.day') }}: - {{ $t('sections.pay.dueDay', [payMethod.dueDay]) }} -
-

+

+

+ {{ $t('sections.pay.method') }}: + {{payMethod.name}} +
+
+ {{ $t('sections.pay.day') }}: + {{ $t('sections.pay.dueDay', [payMethod.dueDay]) }} +
+

-

-

-

- {{ $t('sections.pay.cardImplicates') }} -

+

+

+

+ {{ $t('sections.pay.cardImplicates') }} +

-

{{ $t('notifyAnError') }}

-
-
- -
-
- -
-
- -
-
-
-
- - \ No newline at end of file +

{{ $t('notifyAnError') }}

+ + + \ No newline at end of file diff --git a/print/templates/email/payment-update/payment-update.js b/print/templates/email/payment-update/payment-update.js index 2b92976a3..c03cf76ca 100755 --- a/print/templates/email/payment-update/payment-update.js +++ b/print/templates/email/payment-update/payment-update.js @@ -1,11 +1,10 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); module.exports = { name: 'payment-update', async serverPrefetch() { - this.payMethod = await this.fetchPayMethod(this.recipientId); + this.payMethod = await this.fetchPayMethod(this.id); if (!this.payMethod) throw new Error('Something went wrong'); @@ -16,18 +15,18 @@ module.exports = { }, }, methods: { - fetchPayMethod(clientId) { - return this.findOneFromDef('payMethod', [clientId]); + fetchPayMethod(id) { + return this.findOneFromDef('payMethod', [id]); } }, components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build() + 'email-body': emailBody.build(), }, props: { - recipientId: { - type: [Number, String], - required: true + id: { + type: Number, + required: true, + description: 'The client id' } } }; diff --git a/print/templates/email/printer-setup/assets/css/import.js b/print/templates/email/printer-setup/assets/css/import.js index b44d6bd37..4b4bb7086 100644 --- a/print/templates/email/printer-setup/assets/css/import.js +++ b/print/templates/email/printer-setup/assets/css/import.js @@ -1,8 +1,11 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`]) + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) .mergeStyles(); diff --git a/print/templates/email/printer-setup/assets/files/model.ezp b/print/templates/email/printer-setup/assets/files/model.ezp index 98e3302bc..dba98e0ee 100644 Binary files a/print/templates/email/printer-setup/assets/files/model.ezp and b/print/templates/email/printer-setup/assets/files/model.ezp differ diff --git a/print/templates/email/printer-setup/locale/es.yml b/print/templates/email/printer-setup/locale/es.yml index 77a3a7299..f47592fcf 100644 --- a/print/templates/email/printer-setup/locale/es.yml +++ b/print/templates/email/printer-setup/locale/es.yml @@ -7,37 +7,27 @@ description: followGuide: Puedes utilizar como guía, el vídeo del montaje del ribon y la cinta https://www.youtube.com/watch?v=qhb0kgQF3o8. También - necesitarás el QLabel, el programa para imprimir las cintas. - downloadFrom: Puedes descargarlo desde este enlace https://godex.s3-accelerate.amazonaws.com/gGnOPoojkP6vC1lgmrbEqQ.file?v01 + necesitarás el GoLabel, el programa para imprimir las cintas. + downloadFrom: Puedes descargarlo desde este enlace https://godex.s3-accelerate.amazonaws.com/_6f5glRrVhQAEBGhdUsqJA.file?v01 downloadDriver: En este enlace puedes descargar el driver de la impresora https://es.seagullscientific.com/support/downloads/drivers/godex/download/ sections: - QLabel: - title: Utilización de QLabel + GoLabel: + title: Utilización de GoLabel description: Para utilizar el programa de impresión de cintas sigue estos pasos steps: - - Abre el programa QLabel - - Haz clic en el icono de la barra superior con forma de 'carpeta' - - Selecciona el archivo llamado 'model.ezp' adjunto en este correo, y haz clic - en abrir - - Ve a 'File' -> 'Save as' y guárdalo en el escritorio con otro nombre - - Cierra el Qlabel y abre el archivo que acabamos de guardar - - Haz clic encima del texto con el botón secundario del ratón - - Elige la primera opción 'setup' - - Cambia el texto para imprimir - - Haz clic en el botón 'Ok' - - Desplázate con el ratón para ver la medida máxima que ocupa el texto - - Haz clic encima del texto con el botón secundario del ratón - - Elige la segunda opción 'Setup printer' - - Haz clic en la primera pestaña 'Label Setup' - - Modifica la propiedad 'Paper Height' con la medida máxima consultada anteriormente - - 'Comprueba el puerto de la impresora, botón de de la derecha ''SETUP PRINTER'' - y en la parte derecha, igual como la imagen que adjuntamos, seleccionar la que - ponga ''USB00x: GODEX''' - - Haz clic en el botón 'Ok' - - Haz clic sobre el icono de la impresora - - Haz clic en 'Print' + - Abre el programa GoLabel + - Haz clic en el icono de la barra superior con forma de carpeta con una hoja. + - Selecciona el archivo llamado 'model.ezp'(que seguramente este en 'Descargas') adjunto en este correo, haz clic en abrir. + - Una vez abierto el archivo, haz doble click sobre el texto, en el cuadro que nos sale pulse donde esta el texto de ejemplo (En este caso "TUS HERMANOS") y nos saldra en ese mismo recuadro a la parte izquierda para editarlo y escribir lo que quiera. + - Cuando ya tenga el texto que desee pulse en el boton 'OK'. + - Ve a 'Archivo' → 'Guardar Como' y guárdelo en el escritorio en el escritorio con otro nombre. + - Luego para imprimir primero deberá configurar la impresora. + - Pulse en el octavo icono de la barra de arriba, que en este caso será una impresora con un engranaje naranja. + - Una vez ahí, pulsaremos en el desplegable de modelo de impresora y elegiremos el modelo que coincida con el nuestro 'G***'. + - Pulse guardar y ya tendremos nuestra impresora con la configuración guardada. + - Y por último, para imprimir, haz click en el noveno icono, el cual corresponde a una impresora azul. help: title: "¿Necesitas ayuda?" description: Si necesitas ayuda, descárgate nuestro programa de soporte para poder diff --git a/print/templates/email/printer-setup/printer-setup.html b/print/templates/email/printer-setup/printer-setup.html index fff21eb90..fe4db90d3 100644 --- a/print/templates/email/printer-setup/printer-setup.html +++ b/print/templates/email/printer-setup/printer-setup.html @@ -1,90 +1,49 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }}

-

{{$t('description.dear')}},

-

{{$t('description.instructions')}}

-

-

-

+ +
+
+

{{ $t('title') }}

+

{{$t('description.dear')}},

+

{{$t('description.instructions')}}

+

+

+

-

{{$t('sections.QLabel.title')}}

-

{{$t('sections.QLabel.description')}}:

-
    -
  1. - -
  2. -
-
-
- -
-
-

{{$t('sections.help.title')}}

-

{{$t('sections.help.description')}}

-

-
-
- -
-
-
- {{$t('salesPersonName')}}: {{client.salesPersonName}} -
-
- {{$t('salesPersonPhone')}}: {{client.salesPersonPhone}} -
-
- {{$t('salesPersonEmail')}}: - {{client.salesPersonEmail}} -
-
-
- -
-
- - -
-
- -
-
- -
-
- -
-
-
-
- - \ No newline at end of file +

{{$t('sections.GoLabel.title')}}

+

{{$t('sections.GoLabel.description')}}:

+
    +
  1. + +
  2. +
+ + +
+
+

{{$t('sections.help.title')}}

+

{{$t('sections.help.description')}}

+

+
+
+
+
+
+ {{$t('salesPersonName')}}: {{client.salesPersonName}} +
+
+ {{$t('salesPersonPhone')}}: {{client.salesPersonPhone}} +
+
+ {{$t('salesPersonEmail')}}: + {{client.salesPersonEmail}} +
+
+
+
+
+ + +
+
+ \ No newline at end of file diff --git a/print/templates/email/printer-setup/printer-setup.js b/print/templates/email/printer-setup/printer-setup.js index 95dff8ebb..8e892737a 100755 --- a/print/templates/email/printer-setup/printer-setup.js +++ b/print/templates/email/printer-setup/printer-setup.js @@ -1,30 +1,28 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); const attachment = new Component('attachment'); const attachments = require('./attachments.json'); module.exports = { name: 'printer-setup', async serverPrefetch() { - this.client = await this.fetchClient(this.recipientId); + this.client = await this.fetchClient(this.id); }, data() { return {attachments}; }, methods: { - fetchClient(clientId) { - return this.findOneFromDef('client', [clientId]); + fetchClient(id) { + return this.findOneFromDef('client', [id]); } }, components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build(), + 'email-body': emailBody.build(), 'attachment': attachment.build() }, props: { - recipientId: { - type: [Number, String], + id: { + type: Number, required: true } } diff --git a/print/templates/email/recover-password/assets/css/import.js b/print/templates/email/recover-password/assets/css/import.js new file mode 100644 index 000000000..7360587f7 --- /dev/null +++ b/print/templates/email/recover-password/assets/css/import.js @@ -0,0 +1,13 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`, + `${__dirname}/style.css`]) + .mergeStyles(); + diff --git a/print/templates/email/recover-password/assets/css/style.css b/print/templates/email/recover-password/assets/css/style.css new file mode 100644 index 000000000..5db85befa --- /dev/null +++ b/print/templates/email/recover-password/assets/css/style.css @@ -0,0 +1,5 @@ +.external-link { + border: 2px dashed #8dba25; + border-radius: 3px; + text-align: center +} \ No newline at end of file diff --git a/print/templates/email/recover-password/locale/es.yml b/print/templates/email/recover-password/locale/es.yml new file mode 100644 index 000000000..c72b108ee --- /dev/null +++ b/print/templates/email/recover-password/locale/es.yml @@ -0,0 +1,3 @@ +subject: Recuperar contraseña +title: Recuperar contraseña +Click on the following link to change your password.: Pulsa en el siguiente link para cambiar tu contraseña. diff --git a/print/templates/email/recover-password/recover-password.html b/print/templates/email/recover-password/recover-password.html new file mode 100644 index 000000000..a654b3d5f --- /dev/null +++ b/print/templates/email/recover-password/recover-password.html @@ -0,0 +1,48 @@ + + + + + + {{ $t('subject') }} + + + + + + + + +
+ +
+
+
+ +
+
+ +
+
+ +
+
+

+ {{ $t('Click on the following link to change your password.') }} + {{ $t('subject') }} +

+
+
+ + +
+
+ +
+
+ +
+
+
+
+ + diff --git a/print/templates/email/recover-password/recover-password.js b/print/templates/email/recover-password/recover-password.js new file mode 100755 index 000000000..d8448f370 --- /dev/null +++ b/print/templates/email/recover-password/recover-password.js @@ -0,0 +1,17 @@ +const Component = require(`vn-print/core/component`); +const emailHeader = new Component('email-header'); +const emailFooter = new Component('email-footer'); + +module.exports = { + name: 'recover-password', + components: { + 'email-header': emailHeader.build(), + 'email-footer': emailFooter.build() + }, + props: { + url: { + type: String, + required: true + } + } +}; diff --git a/print/templates/email/sepa-core/assets/css/import.js b/print/templates/email/sepa-core/assets/css/import.js index b44d6bd37..1582b82c5 100644 --- a/print/templates/email/sepa-core/assets/css/import.js +++ b/print/templates/email/sepa-core/assets/css/import.js @@ -1,8 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`]) + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) .mergeStyles(); + diff --git a/print/templates/email/sepa-core/sepa-core.html b/print/templates/email/sepa-core/sepa-core.html index 88acdbf86..d584605dd 100644 --- a/print/templates/email/sepa-core/sepa-core.html +++ b/print/templates/email/sepa-core/sepa-core.html @@ -1,57 +1,21 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }}

-

{{$t('description.dear')}},

-
-

{{$t('description.conclusion')}}

-
-
- -
-
- - -
-
- -
-
- -
-
- -
-
-
-
- - \ No newline at end of file + +
+
+

{{ $t('title') }}

+

{{$t('description.dear')}},

+
+

{{$t('description.conclusion')}}

+
+
+
+
+ + +
+
+
diff --git a/print/templates/email/sepa-core/sepa-core.js b/print/templates/email/sepa-core/sepa-core.js index 743c6719c..15a61e1b1 100755 --- a/print/templates/email/sepa-core/sepa-core.js +++ b/print/templates/email/sepa-core/sepa-core.js @@ -1,7 +1,5 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); -const attachment = new Component('attachment'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); const attachments = require('./attachments.json'); module.exports = { @@ -10,17 +8,15 @@ module.exports = { return {attachments}; }, components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build(), - 'attachment': attachment.build() + 'email-body': emailBody.build() }, props: { - recipientId: { - type: [Number, String], + id: { + type: Number, required: true }, companyId: { - type: [Number, String], + type: Number, required: true } } diff --git a/print/templates/email/supplier-campaign-metrics/assets/css/import.js b/print/templates/email/supplier-campaign-metrics/assets/css/import.js index b44d6bd37..4b4bb7086 100644 --- a/print/templates/email/supplier-campaign-metrics/assets/css/import.js +++ b/print/templates/email/supplier-campaign-metrics/assets/css/import.js @@ -1,8 +1,11 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/email.css`]) + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) .mergeStyles(); diff --git a/print/templates/email/supplier-campaign-metrics/supplier-campaign-metrics.html b/print/templates/email/supplier-campaign-metrics/supplier-campaign-metrics.html index ff8c661ee..79d856632 100644 --- a/print/templates/email/supplier-campaign-metrics/supplier-campaign-metrics.html +++ b/print/templates/email/supplier-campaign-metrics/supplier-campaign-metrics.html @@ -1,46 +1,9 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

{{ $t('title') }}

-

{{$t('dear')}},

-

-
-
- -
-
- -
-
- -
-
-
-
- - \ No newline at end of file + +
+
+

{{ $t('title') }}

+

{{$t('dear')}},

+

+
+
+
diff --git a/print/templates/email/supplier-campaign-metrics/supplier-campaign-metrics.js b/print/templates/email/supplier-campaign-metrics/supplier-campaign-metrics.js index 3cf290e4d..3a673d2e4 100755 --- a/print/templates/email/supplier-campaign-metrics/supplier-campaign-metrics.js +++ b/print/templates/email/supplier-campaign-metrics/supplier-campaign-metrics.js @@ -1,6 +1,5 @@ -const Component = require(`${appPath}/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); module.exports = { name: 'supplier-campaign-metrics', @@ -16,12 +15,11 @@ module.exports = { } }, components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build() + 'email-body': emailBody.build() }, props: { - recipientId: { - type: [Number, String], + id: { + type: Number, required: true }, from: { diff --git a/print/templates/email/supplier-pay-method-update/assets/css/import.js b/print/templates/email/supplier-pay-method-update/assets/css/import.js new file mode 100644 index 000000000..4b4bb7086 --- /dev/null +++ b/print/templates/email/supplier-pay-method-update/assets/css/import.js @@ -0,0 +1,11 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) + .mergeStyles(); diff --git a/print/templates/email/supplier-pay-method-update/locale/en.yml b/print/templates/email/supplier-pay-method-update/locale/en.yml new file mode 100644 index 000000000..f04ccc5ce --- /dev/null +++ b/print/templates/email/supplier-pay-method-update/locale/en.yml @@ -0,0 +1,3 @@ +subject: Pay method updated +title: Pay method updated +description: The pay method of the supplier {0} has been updated from {1} to {2} diff --git a/print/templates/email/supplier-pay-method-update/locale/es.yml b/print/templates/email/supplier-pay-method-update/locale/es.yml new file mode 100644 index 000000000..59ee0e02f --- /dev/null +++ b/print/templates/email/supplier-pay-method-update/locale/es.yml @@ -0,0 +1,3 @@ +subject: Método de pago actualizado +title: Método de pago actualizado +description: Se ha actualizado el método de pago del proveedor {0} de {1} a {2} diff --git a/print/templates/email/supplier-pay-method-update/supplier-pay-method-update.html b/print/templates/email/supplier-pay-method-update/supplier-pay-method-update.html new file mode 100644 index 000000000..df8543cd9 --- /dev/null +++ b/print/templates/email/supplier-pay-method-update/supplier-pay-method-update.html @@ -0,0 +1,8 @@ + +
+
+

{{ $t('title') }}

+

+
+
+
diff --git a/print/templates/email/supplier-pay-method-update/supplier-pay-method-update.js b/print/templates/email/supplier-pay-method-update/supplier-pay-method-update.js new file mode 100755 index 000000000..283b2689c --- /dev/null +++ b/print/templates/email/supplier-pay-method-update/supplier-pay-method-update.js @@ -0,0 +1,23 @@ +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); + +module.exports = { + name: 'supplier-pay-method-update', + components: { + 'email-body': emailBody.build(), + }, + props: { + name: { + type: String, + required: true + }, + oldPayMethod: { + type: String, + required: true + }, + newPayMethod: { + type: String, + required: true + } + } +}; diff --git a/print/templates/email/vehicle-event-expired/assets/css/import.js b/print/templates/email/vehicle-event-expired/assets/css/import.js new file mode 100644 index 000000000..4b4bb7086 --- /dev/null +++ b/print/templates/email/vehicle-event-expired/assets/css/import.js @@ -0,0 +1,11 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) + .mergeStyles(); diff --git a/print/templates/email/vehicle-event-expired/attachments.json b/print/templates/email/vehicle-event-expired/attachments.json new file mode 100644 index 000000000..6b56392a0 --- /dev/null +++ b/print/templates/email/vehicle-event-expired/attachments.json @@ -0,0 +1,6 @@ +[ + { + "filename": "vehicle-event-expired.pdf", + "component": "vehicle-event-expired" + } +] diff --git a/print/templates/email/vehicle-event-expired/locale/es.yml b/print/templates/email/vehicle-event-expired/locale/es.yml new file mode 100644 index 000000000..f6fff468c --- /dev/null +++ b/print/templates/email/vehicle-event-expired/locale/es.yml @@ -0,0 +1,3 @@ +subject: Expiración Tarjetas Vehículos +title: Expiración Tarjetas Vehículos +description: A continuación se adjunta el informe de expiración de tarjetas vehículos diff --git a/print/templates/email/vehicle-event-expired/vehicle-event-expired.html b/print/templates/email/vehicle-event-expired/vehicle-event-expired.html new file mode 100644 index 000000000..f4c1ebc1b --- /dev/null +++ b/print/templates/email/vehicle-event-expired/vehicle-event-expired.html @@ -0,0 +1,8 @@ + +
+
+

{{ $t('title') }}

+

+
+
+
diff --git a/print/templates/email/vehicle-event-expired/vehicle-event-expired.js b/print/templates/email/vehicle-event-expired/vehicle-event-expired.js new file mode 100755 index 000000000..1c228d2b5 --- /dev/null +++ b/print/templates/email/vehicle-event-expired/vehicle-event-expired.js @@ -0,0 +1,9 @@ +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); + +module.exports = { + name: 'vehicle-event-expired', + components: { + 'email-body': emailBody.build() + } +}; diff --git a/print/templates/email/weekly-hour-record/assets/css/import.js b/print/templates/email/weekly-hour-record/assets/css/import.js new file mode 100644 index 000000000..1582b82c5 --- /dev/null +++ b/print/templates/email/weekly-hour-record/assets/css/import.js @@ -0,0 +1,12 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) + .mergeStyles(); + diff --git a/print/templates/email/weekly-hour-record/locale/en.yml b/print/templates/email/weekly-hour-record/locale/en.yml new file mode 100644 index 000000000..817e5451e --- /dev/null +++ b/print/templates/email/weekly-hour-record/locale/en.yml @@ -0,0 +1,6 @@ +subject: Weekly time log +title: Record of hours week {0} year {1} +dear: Dear worker +description: Access the following link:

+ {0}

+ Click 'SATISFIED' if you agree with the hours worked. Otherwise, press 'NOT SATISFIED', detailing the cause of the disagreement. diff --git a/print/templates/email/weekly-hour-record/locale/es.yml b/print/templates/email/weekly-hour-record/locale/es.yml new file mode 100644 index 000000000..b70862f16 --- /dev/null +++ b/print/templates/email/weekly-hour-record/locale/es.yml @@ -0,0 +1,6 @@ +subject: Registro de horas semanal +title: Registro de horas semana {0} año {1} +dear: Estimado trabajador +description: Acceda al siguiente enlace:

+ {0}

+ Pulse 'CONFORME' si esta de acuerdo con las horas trabajadas. En caso contrario pulse 'NO CONFORME', detallando la causa de la disconformidad. diff --git a/print/templates/email/weekly-hour-record/weekly-hour-record.html b/print/templates/email/weekly-hour-record/weekly-hour-record.html new file mode 100644 index 000000000..84abb4c61 --- /dev/null +++ b/print/templates/email/weekly-hour-record/weekly-hour-record.html @@ -0,0 +1,9 @@ + +
+
+

{{ $t('title', [week, year]) }}

+

{{$t('dear')}},

+

+
+
+
diff --git a/print/templates/email/weekly-hour-record/weekly-hour-record.js b/print/templates/email/weekly-hour-record/weekly-hour-record.js new file mode 100755 index 000000000..8fdaea0ce --- /dev/null +++ b/print/templates/email/weekly-hour-record/weekly-hour-record.js @@ -0,0 +1,23 @@ +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); + +module.exports = { + name: 'weekly-hour-record', + components: { + 'email-body': emailBody.build() + }, + props: { + week: { + type: Number, + required: true + }, + year: { + type: Number, + required: true + }, + url: { + type: String, + required: true + } + } +}; diff --git a/print/templates/email/worker-welcome/assets/css/import.js b/print/templates/email/worker-welcome/assets/css/import.js new file mode 100644 index 000000000..4b4bb7086 --- /dev/null +++ b/print/templates/email/worker-welcome/assets/css/import.js @@ -0,0 +1,11 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) + .mergeStyles(); diff --git a/print/templates/email/worker-welcome/locale/es.yml b/print/templates/email/worker-welcome/locale/es.yml new file mode 100644 index 000000000..d53a4e1f0 --- /dev/null +++ b/print/templates/email/worker-welcome/locale/es.yml @@ -0,0 +1,8 @@ +subject: Bienvenido a Verdnatura +title: "¡Te damos la bienvenida!" +dearWorker: Estimado trabajador +workerData: 'Estos son los datos de tu usuario de Verdnatura. + Usuario: {0}. Haz click aquí para +
establecer tu contraseña + .' diff --git a/print/templates/email/worker-welcome/sql/worker.sql b/print/templates/email/worker-welcome/sql/worker.sql new file mode 100644 index 000000000..f75d135d9 --- /dev/null +++ b/print/templates/email/worker-welcome/sql/worker.sql @@ -0,0 +1,7 @@ +SELECT + u.id, + u.name, + e.email +FROM account.user u + LEFT JOIN account.emailUser e ON e.userFk = u.id +WHERE u.id = ?; diff --git a/print/templates/email/worker-welcome/worker-welcome.html b/print/templates/email/worker-welcome/worker-welcome.html new file mode 100644 index 000000000..fbb05d149 --- /dev/null +++ b/print/templates/email/worker-welcome/worker-welcome.html @@ -0,0 +1,9 @@ + +
+
+

{{ $t('title', [id]) }}

+

{{ $t('dearWorker') }},

+

+
+
+
diff --git a/print/templates/email/worker-welcome/worker-welcome.js b/print/templates/email/worker-welcome/worker-welcome.js new file mode 100755 index 000000000..043a172a1 --- /dev/null +++ b/print/templates/email/worker-welcome/worker-welcome.js @@ -0,0 +1,27 @@ +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); + +module.exports = { + name: 'worker-welcome', + async serverPrefetch() { + this.worker = await this.fetchWorker(this.id); + }, + methods: { + fetchWorker(id) { + return this.findOneFromDef('worker', [id]); + }, + }, + components: { + 'email-body': emailBody.build(), + }, + props: { + id: { + type: Number, + required: true + }, + url: { + type: String, + required: true + } + } +}; diff --git a/print/templates/reports/balance-compensation/balance-compensation.html b/print/templates/reports/balance-compensation/balance-compensation.html new file mode 100644 index 000000000..c7448eeb9 --- /dev/null +++ b/print/templates/reports/balance-compensation/balance-compensation.html @@ -0,0 +1,31 @@ + +
+
+
+
+

{{$t('Place')}} {{formatDate(new Date(), '%d-%m-%Y')}}

+

{{$t('Compensation') | uppercase}}

+

{{$t('In one hand')}}:

+

+ {{company.name}} {{$t('CIF')}} {{company.nif}} {{$t('Home')}} {{company.street}}, + {{company.city}}. +

+

{{$t('In other hand')}}:

+

+ {{$t('Sr')}} {{client.name}} {{$t('NIF')}} {{client.fi}} {{$t('Home')}} {{client.street}}, + {{client.city}}. +

+

{{$t('Agree') | uppercase}}

+

+ {{$t('Date')}} {{formatDate(receipt.payed, '%d-%m-%Y')}} {{$t('Compensate')}} {{receipt.amountPaid}} € + {{$t('From client')}} {{client.name}} {{$t('Against the balance of')}}: {{receipt.description}}. +

+

+ {{$t('Reception')}} administracion@verdnatura.es +

+
{{$t('Greetings')}}
+
+
+
+
+
diff --git a/print/templates/reports/balance-compensation/balance-compensation.js b/print/templates/reports/balance-compensation/balance-compensation.js new file mode 100644 index 000000000..c2c2e9288 --- /dev/null +++ b/print/templates/reports/balance-compensation/balance-compensation.js @@ -0,0 +1,37 @@ +const vnReport = require('../../../core/mixins/vn-report.js'); +const app = require('vn-loopback/server/server'); + +module.exports = { + name: 'balance-compensation', + mixins: [vnReport], + async serverPrefetch() { + this.receipt = await app.models.Receipt.findOne({ + fields: ['amountPaid', 'payed', 'clientFk', 'companyFk', 'description'], + include: [ + { + relation: 'client', + scope: { + fields: ['name', 'street', 'fi', 'city'], + } + }, { + relation: 'supplier', + scope: { + fields: ['name', 'street', 'nif', 'city'], + } + } + ], + where: {id: this.id} + }); + this.client = this.receipt.client(); + this.company = this.receipt.supplier(); + + this.checkMainEntity(this.receipt); + }, + props: { + id: { + type: Number, + required: true, + description: 'The receipt id' + } + } +}; diff --git a/print/templates/reports/balance-compensation/css/import.js b/print/templates/reports/balance-compensation/css/import.js new file mode 100644 index 000000000..37a98dfdd --- /dev/null +++ b/print/templates/reports/balance-compensation/css/import.js @@ -0,0 +1,12 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, + `${__dirname}/style.css`]) + .mergeStyles(); diff --git a/print/templates/reports/balance-compensation/locale/es.yml b/print/templates/reports/balance-compensation/locale/es.yml new file mode 100644 index 000000000..1c76274ae --- /dev/null +++ b/print/templates/reports/balance-compensation/locale/es.yml @@ -0,0 +1,16 @@ +reportName: compensacion-saldo +Place: Algemesí, a +Compensation: Compensación de saldos deudores y acreedores +In one hand: De una parte +CIF: con CIF +NIF: con NIF +Home: y domicilio sito en +In other hand: De la otra +Sr: Don/Doña +Agree: Acuerdan +Date: En fecha de +Compensate: se ha compensado el saldo de +From client: del cliente/proveedor +Against the balance of: contra el saldo de +Reception: Por favor, rogamos confirmen la recepción de esta compensación al email +Greetings: Saludos cordiales, diff --git a/print/templates/reports/campaign-metrics/assets/css/import.js b/print/templates/reports/campaign-metrics/assets/css/import.js index fd8796c2b..37a98dfdd 100644 --- a/print/templates/reports/campaign-metrics/assets/css/import.js +++ b/print/templates/reports/campaign-metrics/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/campaign-metrics/campaign-metrics.html b/print/templates/reports/campaign-metrics/campaign-metrics.html index 725c03e4d..ad60c511c 100644 --- a/print/templates/reports/campaign-metrics/campaign-metrics.html +++ b/print/templates/reports/campaign-metrics/campaign-metrics.html @@ -1,95 +1,72 @@ - - - - - - - - - -
- - - -
-
-
-
-

{{$t('title')}}

-
- - - - - - - - - - - - - - - -
{{$t('Client')}}{{client.id}}
{{$t('From')}}{{from | date('%d-%m-%Y')}}
{{$t('To')}}{{to | date('%d-%m-%Y')}}
-
-
-
-
-
{{$t('clientData')}}
-
-

{{client.socialName}}

-
- {{client.street}} -
-
- {{client.postcode}}, {{client.city}} ({{client.province}}) -
-
- {{client.country}} -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
{{$t('Code')}}{{$t('Quantity')}}{{$t('Concept')}}
{{sale.itemFk | zerofill('000000')}}{{Math.trunc(sale.subtotal)}}{{sale.concept}}
- - {{sale.tag5}} {{sale.value5}} - - - {{sale.tag6}} {{sale.value6}} - - - {{sale.tag7}} {{sale.value7}} - -
-
+ +
+
+
+
+

{{$t('title')}}

+
+ + + + + + + + + + + + + + + +
{{$t('Client')}}{{client.id}}
{{$t('From')}}{{formatDate(from, '%d-%m-%Y')}}
{{$t('To')}}{{formatDate(to, '%d-%m-%Y')}}
+
+
+
+
+
{{$t('clientData')}}
+
+

{{client.socialName}}

+
{{client.street}}
+
{{client.postcode}}, {{client.city}} ({{client.province}})
+
{{client.country}}
- - - -
- - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + +
{{$t('Code')}}{{$t('Quantity')}}{{$t('Concept')}}
{{sale.itemFk}}{{Math.trunc(sale.subtotal)}}{{sale.concept}}
+ {{sale.tag5}} {{sale.value5}} + {{sale.tag6}} {{sale.value6}} + {{sale.tag7}} {{sale.value7}} +
+ + + + diff --git a/print/templates/reports/campaign-metrics/campaign-metrics.js b/print/templates/reports/campaign-metrics/campaign-metrics.js index 6669ce067..45bca88dc 100755 --- a/print/templates/reports/campaign-metrics/campaign-metrics.js +++ b/print/templates/reports/campaign-metrics/campaign-metrics.js @@ -1,32 +1,18 @@ -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); +const vnReport = require('../../../core/mixins/vn-report.js'); module.exports = { name: 'campaign-metrics', + mixins: [vnReport], async serverPrefetch() { - this.client = await this.fetchClient(this.recipientId); - this.sales = await this.fetchSales(this.recipientId, this.from, this.to); - - if (!this.client) - throw new Error('Something went wrong'); - }, - methods: { - fetchClient(clientId) { - return this.findOneFromDef('client', [clientId]); - }, - fetchSales(clientId, from, to) { - return this.rawSqlFromDef('sales', [clientId, from, to]); - }, - }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() + this.client = await this.findOneFromDef('client', [this.id]); + this.checkMainEntity(this.client); + this.sales = await this.rawSqlFromDef('sales', [this.id, this.from, this.to]); }, props: { - recipientId: { - type: [Number, String], - required: true + id: { + type: Number, + required: true, + description: 'The client id' }, from: { required: true diff --git a/print/templates/reports/claim-pickup-order/assets/css/import.js b/print/templates/reports/claim-pickup-order/assets/css/import.js index fd8796c2b..37a98dfdd 100644 --- a/print/templates/reports/claim-pickup-order/assets/css/import.js +++ b/print/templates/reports/claim-pickup-order/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/claim-pickup-order/claim-pickup-order.html b/print/templates/reports/claim-pickup-order/claim-pickup-order.html index 1f6db4966..000568ef2 100644 --- a/print/templates/reports/claim-pickup-order/claim-pickup-order.html +++ b/print/templates/reports/claim-pickup-order/claim-pickup-order.html @@ -1,97 +1,77 @@ - - - - - - - - - -
- - - -
-
-
-
-

{{$t('title')}}

- - - - - - - - - - - - - - - - - - - -
{{$t('claimId')}}{{claimId}}
{{$t('clientId')}}{{client.id}}
{{$t('phone')}}{{client.phone}}
{{$t('date')}}{{dated}}
-
-
-
-
{{$t('clientData')}}
-
-

{{client.nickname}}

-
- {{client.street}} -
-
- {{client.postalCode}}, {{client.city}} ({{client.province}}) -
-
- {{client.country}} -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
{{$t('reference')}}{{$t('quantity')}}{{$t('claims')}}{{$t('concept')}}
{{sale.id}}{{sale.quantity}}{{sale.claimQuantity}}{{sale.concept}}
- -
-
{{$t('clientSignature')}}
-
-

{{client.name}}

-
-
- -

-

{{claimConfig.pickupContact}}

-
+ +
+
+
+
+

{{$t('title')}}

+ + + + + + + + + + + + + + + + + + + +
{{$t('claimId')}}{{id}}
{{$t('clientId')}}{{client.id}}
{{$t('phone')}}{{client.phone}}
{{$t('date')}}{{formatDate(new Date(), '%d-%m-%Y')}}
+
+
+
+
{{$t('clientData')}}
+
+

{{client.nickname}}

+
{{client.street}}
+
{{client.postalCode}}, {{client.city}} ({{client.province}})
+
{{client.country}}
- - - -
- - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + +
{{$t('reference')}}{{$t('quantity')}}{{$t('claims')}}{{$t('concept')}}
{{sale.id}}{{sale.quantity}}{{sale.claimQuantity}}{{sale.concept}}
+ +
+
{{$t('clientSignature')}}
+
+

{{client.name}}

+
+
+ + + + diff --git a/print/templates/reports/claim-pickup-order/claim-pickup-order.js b/print/templates/reports/claim-pickup-order/claim-pickup-order.js index bf975e9f2..cc5cec1ea 100755 --- a/print/templates/reports/claim-pickup-order/claim-pickup-order.js +++ b/print/templates/reports/claim-pickup-order/claim-pickup-order.js @@ -1,43 +1,18 @@ -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); +const vnReport = require('../../../core/mixins/vn-report.js'); module.exports = { name: 'claim-pickup-order', + mixins: [vnReport], async serverPrefetch() { - this.client = await this.fetchClient(this.claimId); - this.sales = await this.fetchSales(this.claimId); - this.claimConfig = await this.fetchClaimConfig(); - - if (!this.client) - throw new Error('Something went wrong'); - }, - computed: { - dated: function() { - const filters = this.$options.filters; - - return filters.date(new Date(), '%d-%m-%Y'); - } - }, - methods: { - fetchClient(claimId) { - return this.findOneFromDef('client', [claimId]); - }, - fetchSales(claimId) { - return this.rawSqlFromDef('sales', [claimId]); - }, - fetchClaimConfig() { - return this.findOneFromDef('claimConfig'); - }, - }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() + this.client = await this.findOneFromDef('client', [this.id]); + this.checkMainEntity(this.client); + this.sales = await this.rawSqlFromDef('sales', [this.id]); }, props: { - claimId: { - type: [Number, String], - required: true + id: { + type: Number, + required: true, + description: 'The claim id' } - } + }, }; diff --git a/print/templates/reports/claim-pickup-order/locale/es.yml b/print/templates/reports/claim-pickup-order/locale/es.yml index 388c1f1a6..5ee5ecda7 100644 --- a/print/templates/reports/claim-pickup-order/locale/es.yml +++ b/print/templates/reports/claim-pickup-order/locale/es.yml @@ -11,7 +11,3 @@ concept: Concepto clientSignature: Firma del cliente claim: Reclamación {0} phone: Teléfono -sections: - agency: - description: 'Para agilizar su recogida, por favor, póngase en contacto con la oficina - de Logista Parcel.' diff --git a/print/templates/reports/claim-pickup-order/sql/claimConfig.sql b/print/templates/reports/claim-pickup-order/sql/claimConfig.sql deleted file mode 100644 index 9d744ca6d..000000000 --- a/print/templates/reports/claim-pickup-order/sql/claimConfig.sql +++ /dev/null @@ -1,2 +0,0 @@ -SELECT pickupContact - FROM claimConfig; \ No newline at end of file diff --git a/print/templates/reports/client-debt-statement/assets/css/import.js b/print/templates/reports/client-debt-statement/assets/css/import.js index fd8796c2b..37a98dfdd 100644 --- a/print/templates/reports/client-debt-statement/assets/css/import.js +++ b/print/templates/reports/client-debt-statement/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/client-debt-statement/client-debt-statement.html b/print/templates/reports/client-debt-statement/client-debt-statement.html index 88bf15bdb..30fbbe003 100644 --- a/print/templates/reports/client-debt-statement/client-debt-statement.html +++ b/print/templates/reports/client-debt-statement/client-debt-statement.html @@ -1,95 +1,78 @@ - - - - - - - - - -
- - - -
-
-
-
-
-

{{$t('title')}}

- - - - - - - - - - - -
{{$t('clientId')}}{{client.id}}
{{$t('date')}}{{dated}}
-
-
-
-
-
{{$t('clientData')}}
-
-

{{client.socialName}}

-
- {{client.street}} -
-
- {{client.postcode}}, {{client.city}} ({{client.province}}) -
-
- {{client.country}} -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('date')}}{{$t('concept')}}{{$t('invoiced')}}{{$t('payed')}}{{$t('balance')}}
{{sale.issued | date('%d-%m-%Y')}}{{sale.ref}}{{sale.debtOut}}{{sale.debtIn}}{{getBalance(sale)}}
- Total - {{getTotalDebtOut() | currency('EUR', $i18n.locale)}} - {{getTotalDebtIn() | currency('EUR', $i18n.locale)}}{{totalBalance | currency('EUR', $i18n.locale)}}
-
+ +
+
+
+
+
+

{{$t('title')}}

+ + + + + + + + + + + +
{{$t('clientId')}}{{client.id}}
{{$t('date')}}{{formatDate(new Date(), '%d-%m-%Y')}}
+
+
+
+
+
{{$t('clientData')}}
+
+

{{client.socialName}}

+
{{client.street}}
+
{{client.postcode}}, {{client.city}} ({{client.province}})
+
{{client.country}}
- - - -
- - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('date')}}{{$t('concept')}}{{$t('invoiced')}}{{$t('payed')}}{{$t('balance')}}
{{formatDate(sale.issued, '%d-%m-%Y')}}{{sale.ref}}{{sale.debtOut}}{{sale.debtIn}}{{getBalance(sale)}}
+ Total + {{getTotalDebtOut() | currency('EUR', $i18n.locale)}} + {{getTotalDebtIn() | currency('EUR', $i18n.locale)}}{{totalBalance | currency('EUR', $i18n.locale)}}
+ + + + diff --git a/print/templates/reports/client-debt-statement/client-debt-statement.js b/print/templates/reports/client-debt-statement/client-debt-statement.js index f006b0a92..a74595200 100755 --- a/print/templates/reports/client-debt-statement/client-debt-statement.js +++ b/print/templates/reports/client-debt-statement/client-debt-statement.js @@ -1,44 +1,18 @@ -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); +const vnReport = require('../../../core/mixins/vn-report.js'); module.exports = { name: 'client-debt-statement', + mixins: [vnReport], async serverPrefetch() { - this.client = await this.fetchClient(this.recipientId); - this.sales = await this.fetchSales(this.recipientId, this.from); - - if (!this.client) - throw new Error('Something went wrong'); - }, - computed: { - dated: function() { - const filters = this.$options.filters; - - return filters.date(new Date(), '%d-%m-%Y'); - } + this.client = await this.findOneFromDef('client', [this.id]); + this.checkMainEntity(this.client); + this.sales = await this.rawSqlFromDef('sales', + [this.from, this.id, this.from, this.id, this.from, this.id, this.from, this.id, this.from, this.id]); }, data() { return {totalBalance: 0.00}; }, methods: { - fetchClient(clientId) { - return this.findOneFromDef('client', [clientId]); - }, - fetchSales(clientId, from) { - return this.rawSqlFromDef('sales', [ - from, - clientId, - from, - clientId, - from, - clientId, - from, - clientId, - from, - clientId - ]); - }, getBalance(sale) { if (sale.debtOut) this.totalBalance += parseFloat(sale.debtOut); @@ -63,14 +37,11 @@ module.exports = { return debtIn.toFixed(2); }, }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() - }, props: { - recipientId: { - type: [Number, String], - required: true + id: { + type: Number, + required: true, + description: 'The client id' }, from: { required: true diff --git a/print/templates/reports/cmr-authorization/assets/css/import.js b/print/templates/reports/cmr-authorization/assets/css/import.js deleted file mode 100644 index a2a9334cb..000000000 --- a/print/templates/reports/cmr-authorization/assets/css/import.js +++ /dev/null @@ -1,8 +0,0 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); - -module.exports = new Stylesheet([ - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, - `${appPath}/common/css/misc.css`, - `${__dirname}/style.css`]) - .mergeStyles(); diff --git a/print/templates/reports/cmr-authorization/cmr-authorization.html b/print/templates/reports/cmr-authorization/cmr-authorization.html deleted file mode 100644 index 2d8342a47..000000000 --- a/print/templates/reports/cmr-authorization/cmr-authorization.html +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - -
- - - -
-
-

-

-

-

- -
-
-

{{client.name}}

-
-

- - - - - - - - - - - - - - - -
{{$t('signer.representative')}}:
{{$t('signer.representativeRole')}}:
{{$t('signer.signed')}}:
-

-
-
-

{{$t('signature')}}

- -

-

Juan Vicente Ferrer Roig
-
Director
-

{{$t('issued', [ - 'Algemesí', - issued.getDate(), - $t('months')[issued.getMonth()], - issued.getFullYear()]) - }} -

-

-
-
- -
-
- - - -
- - \ No newline at end of file diff --git a/print/templates/reports/cmr-authorization/cmr-authorization.js b/print/templates/reports/cmr-authorization/cmr-authorization.js deleted file mode 100755 index 1adc75fa6..000000000 --- a/print/templates/reports/cmr-authorization/cmr-authorization.js +++ /dev/null @@ -1,29 +0,0 @@ -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); - -module.exports = { - name: 'cmr-authorization', - async serverPrefetch() { - this.ticket = await this.findOneFromDef('ticket', [this.ticketId]); - if (!this.ticket) - throw new Error('Something went wrong'); - - this.client = await this.findOneFromDef('client', [this.ticket.clientFk]); - }, - computed: { - issued: function() { - return new Date(); - } - }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() - }, - props: { - ticketId: { - type: [Number, String], - required: true - } - } -}; diff --git a/print/templates/reports/cmr-authorization/sql/ticket.sql b/print/templates/reports/cmr-authorization/sql/ticket.sql deleted file mode 100644 index c6c994f7d..000000000 --- a/print/templates/reports/cmr-authorization/sql/ticket.sql +++ /dev/null @@ -1,12 +0,0 @@ -SELECT - t.id, - t.clientFk, - cty.country, - w.name AS warehouse -FROM ticket t - JOIN warehouse w ON w.id = t.warehouseFk - JOIN address a ON a.id = t.addressFk - JOIN province p ON p.id = a.provinceFk - JOIN autonomy au ON au.id = p.autonomyFk - JOIN country cty ON cty.id = au.countryFk -WHERE t.id = ? \ No newline at end of file diff --git a/print/templates/reports/collection-label/assets/css/import.js b/print/templates/reports/collection-label/assets/css/import.js new file mode 100644 index 000000000..37a98dfdd --- /dev/null +++ b/print/templates/reports/collection-label/assets/css/import.js @@ -0,0 +1,12 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, + `${__dirname}/style.css`]) + .mergeStyles(); diff --git a/print/templates/reports/collection-label/assets/css/style.css b/print/templates/reports/collection-label/assets/css/style.css new file mode 100644 index 000000000..eb300f850 --- /dev/null +++ b/print/templates/reports/collection-label/assets/css/style.css @@ -0,0 +1,45 @@ +html { + font-family: Arial, Helvetica, sans-serif; + margin-top: -6px; +} +* { + box-sizing: border-box; + text-align: center; + font-size: 26px; +} +#vertical { + writing-mode: vertical-rl; + height: 230px; + font-size: 29px; + margin-left: -13px; +} +#outline { + border: 1px solid black; + padding: 5px; + height: 37px; + width: 100px; + max-width: 100px; +} +#nickname { + font-size: 22px; + max-width: 50px; +} +#agencyDescripton { + font-size: 32px; + width: 375px; + font-weight: bold; +} +#bold { + font-weight: bold; +} +#barcode{ + width: 370px; +} +#shipped { + font-weight: bold; + width: 50px; + max-width: 100px; +} +#ticketFk { + font-size: 32px; +} \ No newline at end of file diff --git a/print/templates/reports/collection-label/collection-label.html b/print/templates/reports/collection-label/collection-label.html new file mode 100644 index 000000000..a699d4ac5 --- /dev/null +++ b/print/templates/reports/collection-label/collection-label.html @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{getVertical(labelData)}} + {{labelData.clientFk ? `${labelData.ticketFk} « ${labelData.clientFk}` : labelData.ticketFk}} + {{labelData.shipped || '---'}}
{{labelData.workerCode || '---'}}
{{labelCount || labelData.labelCount || 0}}
{{labelData.code == 'V' ? (labelData.size || 0) + 'cm' : (labelData.volume || 0) + 'm³'}}
{{getAgencyDescripton(labelData)}}
{{labelData.lineCount || 0}}
{{labelData.nickName ? labelData.nickName.toUpperCase() : '---'}}{{labelData.shippedHour || labelData.zoneHour}}
+ + \ No newline at end of file diff --git a/print/templates/reports/collection-label/collection-label.js b/print/templates/reports/collection-label/collection-label.js new file mode 100644 index 000000000..d45ecb2bc --- /dev/null +++ b/print/templates/reports/collection-label/collection-label.js @@ -0,0 +1,77 @@ +const jsBarcode = require('jsbarcode'); +const {DOMImplementation, XMLSerializer} = require('xmldom'); +const vnReport = require('../../../core/mixins/vn-report.js'); + +module.exports = { + name: 'collection-label', + mixins: [vnReport], + props: { + id: { + type: Number, + required: true, + description: 'The ticket or collection id' + }, + labelCount: { + type: Number, + required: false, + description: 'The number of labels' + } + }, + async serverPrefetch() { + let ticketIds; + const res = await this.rawSqlFromDef('tickets', [this.id]); + + if (res.length) { + ticketIds = []; + for (const row of res) + ticketIds.push(row.ticketFk); + } else + ticketIds = [this.id]; + + this.labelsData = await this.rawSqlFromDef('labelsData', [ticketIds]); + this.checkMainEntity(this.labelsData); + }, + methods: { + getBarcode(id) { + const xmlSerializer = new XMLSerializer(); + const document = new DOMImplementation().createDocument('http://www.w3.org/1999/xhtml', 'html', null); + const svgNode = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + + jsBarcode(svgNode, id, { + xmlDocument: document, + format: 'code128', + displayValue: false, + width: 3.8, + height: 115, + }); + return xmlSerializer.serializeToString(svgNode); + }, + getVertical(labelData) { + let value; + if (labelData.collectionFk) { + value = `${labelData.collectionFk} ~ `; + if (labelData.code == 'V') + value = value + `${labelData.wagon}-${labelData.level}`; + else + value = value + `${labelData.color.substring(0, 4)}`; + } else + value = '-'.repeat(19); + + return value; + }, + getAgencyDescripton(labelData) { + let value; + if (labelData.agencyDescription) + value = labelData.agencyDescription.toUpperCase().substring(0, 11); + else + value = '---'; + + if (labelData.routeFk) { + let routeFk = labelData.routeFk.toString(); + value = `${value} [${routeFk.substring(routeFk.length - 3)}]`; + } + + return value; + }, + }, +}; diff --git a/print/templates/reports/collection-label/locale/es.yml b/print/templates/reports/collection-label/locale/es.yml new file mode 100644 index 000000000..a54d3bad8 --- /dev/null +++ b/print/templates/reports/collection-label/locale/es.yml @@ -0,0 +1 @@ +reportName: labelCollection \ No newline at end of file diff --git a/print/templates/reports/collection-label/options.json b/print/templates/reports/collection-label/options.json new file mode 100644 index 000000000..ad5ad4750 --- /dev/null +++ b/print/templates/reports/collection-label/options.json @@ -0,0 +1,11 @@ +{ + "width": "10.4cm", + "height": "4.9cm", + "margin": { + "top": "0.3cm", + "right": "0.3cm", + "bottom": "0cm", + "left": "0.2cm" + }, + "printBackground": true +} \ No newline at end of file diff --git a/print/templates/reports/collection-label/sql/labelsData.sql b/print/templates/reports/collection-label/sql/labelsData.sql new file mode 100644 index 000000000..fef692272 --- /dev/null +++ b/print/templates/reports/collection-label/sql/labelsData.sql @@ -0,0 +1,38 @@ +SELECT c.itemPackingTypeFk code, + tc.collectionFk, + SUBSTRING('ABCDEFGH', tc.wagon, 1) wagon, + tc.`level`, + t.id ticketFk, + COALESCE(et.description, zo.name, am.name) agencyDescription, + cc.code color, + t.clientFk, + CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume, + MAX(i.`size`) `size`, + w.code workerCode, + TIME_FORMAT(t.shipped, '%H:%i') shippedHour, + TIME_FORMAT(zo.`hour`, '%H:%i') zoneHour, + DATE_FORMAT(t.shipped, '%d/%m/%y') shipped, + tt.labelCount, + t.nickName, + COUNT(*) lineCount, + rm.routeFk + FROM vn.ticket t + JOIN vn.ticketCollection tc ON tc.ticketFk = t.id + JOIN vn.collection c ON c.id = tc.collectionFk + LEFT 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.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.`zone` zo ON t.zoneFk = zo.id + LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk + LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + WHERE t.id IN (?) + GROUP BY t.id + ORDER BY cc.`code`; \ No newline at end of file diff --git a/print/templates/reports/collection-label/sql/tickets.sql b/print/templates/reports/collection-label/sql/tickets.sql new file mode 100644 index 000000000..05deeba83 --- /dev/null +++ b/print/templates/reports/collection-label/sql/tickets.sql @@ -0,0 +1,3 @@ +SELECT ticketFk + FROM ticketCollection + WHERE collectionFk = ? \ No newline at end of file diff --git a/print/templates/reports/credit-request/assets/css/import.js b/print/templates/reports/credit-request/assets/css/import.js index fd8796c2b..37a98dfdd 100644 --- a/print/templates/reports/credit-request/assets/css/import.js +++ b/print/templates/reports/credit-request/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/credit-request/credit-request.html b/print/templates/reports/credit-request/credit-request.html index 975115eef..c8e3f8c34 100644 --- a/print/templates/reports/credit-request/credit-request.html +++ b/print/templates/reports/credit-request/credit-request.html @@ -1,190 +1,164 @@ - - - - - - - + +
- - - - -
-
-

{{$t('fields.title')}}

-
-
- - - - - - - - - -
{{$t('fields.date')}}: -
- -
-
- - -
-
-
-
-

{{$t('fields.companyInfo')}}

+ +
+
+

{{$t('fields.title')}}

+
+
+ + + + + + + +
{{$t('fields.date')}}: +
+ +
+
+
+
+
+
+

{{$t('fields.companyInfo')}}

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('fields.companyName')}}: +
+
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('fields.companyName')}}: -
- -
-
{{$t('fields.businessType')}}: -
- -
-
{{$t('fields.antiquity')}}: -
- -
-
{{$t('fields.surface')}}: -
- -
-
{{$t('fields.numberOfEmployees')}}: -
- -
-
{{$t('fields.owner')}}: -
- -
-
{{$t('fields.phone')}}: -
- -
-
{{$t('fields.payer')}}: -
- -
-
{{$t('fields.phone')}}: -
- -
-
+
{{$t('fields.businessType')}}: +
+
+
{{$t('fields.antiquity')}}: +
+ +
+
{{$t('fields.surface')}}: +
+ +
+
{{$t('fields.numberOfEmployees')}}: +
+ +
+
{{$t('fields.owner')}}: +
+ +
+
{{$t('fields.phone')}}: +
+ +
+
{{$t('fields.payer')}}: +
+ +
+
{{$t('fields.phone')}}: +
+ +
+
+
+
+
+
+
+
+
+
+

{{$t('fields.economicInfo')}}

+
+
+ + + + + + + + + + + + + + + +
{{$t('fields.previousSalesVolume')}}: +
+ +
+
{{$t('fields.forecastedSalesVolume')}}: +
+ +
+
{{$t('fields.forecastedPurchases')}}: +
+ +
+
+
+
+
+
+
+
+
+ + + + + + + - -
{{$t('fields.personFilling')}}: +
+
- - - - -
-
-
-
-

{{$t('fields.economicInfo')}}

-
-
- - - - - - - - - - - - - - - -
{{$t('fields.previousSalesVolume')}}: -
- -
-
{{$t('fields.forecastedSalesVolume')}}: -
- -
-
{{$t('fields.forecastedPurchases')}}: -
- -
-
-
+
{{$t('fields.phone')}}: +
+
- - - - -
-
-
- - - - - - - - - -
{{$t('fields.personFilling')}}: -
- -
-
{{$t('fields.phone')}}: -
- -
-
-
-
-
- - - - -
- - \ No newline at end of file + +
+ + + + + diff --git a/print/templates/reports/credit-request/credit-request.js b/print/templates/reports/credit-request/credit-request.js index d04106493..75e0b2263 100755 --- a/print/templates/reports/credit-request/credit-request.js +++ b/print/templates/reports/credit-request/credit-request.js @@ -1,20 +1,7 @@ -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); +const vnReport = require('../../../core/mixins/vn-report.js'); -const rptCreditRequest = { +module.exports = { name: 'credit-request', - computed: { - dated: function() { - const filters = this.$options.filters; - - return filters.date(new Date(), '%d-%m-%Y'); - } - }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() - } + mixins: [vnReport], }; -module.exports = rptCreditRequest; diff --git a/print/templates/reports/delivery-note/assets/css/import.js b/print/templates/reports/delivery-note/assets/css/import.js index fd8796c2b..37a98dfdd 100644 --- a/print/templates/reports/delivery-note/assets/css/import.js +++ b/print/templates/reports/delivery-note/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/delivery-note/assets/css/style.css b/print/templates/reports/delivery-note/assets/css/style.css index f99c385fa..8405ae78d 100644 --- a/print/templates/reports/delivery-note/assets/css/style.css +++ b/print/templates/reports/delivery-note/assets/css/style.css @@ -37,4 +37,9 @@ h2 { .phytosanitary-info { margin-top: 10px +} + +.observations{ + text-align: justify; + text-justify: inter-word; } \ No newline at end of file diff --git a/print/templates/reports/delivery-note/delivery-note.html b/print/templates/reports/delivery-note/delivery-note.html index 35f9a2960..0be5a30f0 100644 --- a/print/templates/reports/delivery-note/delivery-note.html +++ b/print/templates/reports/delivery-note/delivery-note.html @@ -1,293 +1,252 @@ - - - - - - - - - -
- - - - -
-
-
-
-
-

{{$t(type)}}

- - - - - - - - - - - - - - - - - - - -
{{$t('clientId')}}{{client.id}}
{{$t(type)}}{{ticket.id}}
{{$t('date')}}{{ticket.shipped | date('%d-%m-%Y')}}
{{$t('packages')}}{{ticket.packages}}
-
-
-
-
-
{{$t('deliveryAddress')}}
-
-

{{address.nickname}}

-
- {{address.street}} -
-
- {{address.postalCode}}, {{address.city}} ({{address.province}}) -
-
-
- -
-
{{$t('fiscalData')}}
-
-
- {{client.socialName}} -
-
- {{client.street}} -
-
- {{client.fi}} -
-
-
-
-
- - -

{{$t('saleLines')}}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('reference')}}{{$t('quantity')}}{{$t('concept')}}{{$t('price')}}{{$t('discount')}}{{$t('vat')}}{{$t('amount')}}
{{sale.itemFk | zerofill('000000')}}{{sale.quantity}}{{sale.concept}}{{sale.price | currency('EUR', $i18n.locale)}}{{(sale.discount / 100) | percentage}}{{sale.vatType}}{{sale.price * sale.quantity * (1 - sale.discount / 100) | currency('EUR', $i18n.locale)}}
- - {{sale.tag5}} {{sale.value5}} - - - {{sale.tag6}} {{sale.value6}} - - - {{sale.tag7}} {{sale.value7}} - -
- {{$t('subtotal')}} - {{getSubTotal() | currency('EUR', $i18n.locale)}}
- - -
- -
-

{{$t('services.title')}}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('services.theader.quantity')}}{{$t('services.theader.concept')}}{{$t('services.theader.price')}}{{$t('services.theader.vat')}}{{$t('services.theader.amount')}}
{{service.quantity}}{{service.description}}{{service.price | currency('EUR', $i18n.locale)}}{{service.taxDescription}}{{service.price | currency('EUR', $i18n.locale)}}
- {{$t('services.tfoot.subtotal')}} - {{serviceTotal | currency('EUR', $i18n.locale)}}
- * {{ $t('services.warning') }} -
- -
-
- -
-

{{$t('packagings.title')}}

- - - - - - - - - - - - - - - -
{{$t('packagings.theader.reference')}}{{$t('packagings.theader.quantity')}}{{$t('packagings.theader.concept')}}
{{packaging.itemFk | zerofill('000000')}}{{packaging.quantity}}{{packaging.name}}
-
- -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('taxes.title')}}
{{$t('taxes.theader.type')}}{{$t('taxes.theader.taxBase')}}{{$t('taxes.theader.tax')}}{{$t('taxes.theader.fee')}}
{{tax.name}} - {{tax.Base | currency('EUR', $i18n.locale)}} - {{tax.vatPercent | percentage}}{{tax.tax | currency('EUR', $i18n.locale)}}
{{$t('subtotal')}} - {{getTotalBase() | currency('EUR', $i18n.locale)}} - {{getTotalTax()| currency('EUR', $i18n.locale)}}
{{$t('total')}}{{getTotal() | currency('EUR', $i18n.locale)}}
-
- + + +
+
+
+
+
+

{{$t(deliverNoteType)}}

+ + + + + + + + + + + + + + + + + + + +
{{$t('clientId')}}{{client.id}}
{{$t(deliverNoteType)}}{{ticket.id}}
{{$t('date')}}{{formatDate(ticket.shipped, '%d-%m-%Y')}}
{{$t('packages')}}{{ticket.packages}}
+
+
+
+
+
{{$t('deliveryAddress')}}
+
+

{{address.nickname}}

+
{{address.street}}
+
{{address.postalCode}}, {{address.city}} ({{address.province}})
+
+
- -
-
-
-
-
-
- -
-
- {{$t('plantPassport')}}
-
-
-
-
-
- A - {{getBotanical()}} -
-
- B - ES17462130 -
-
- C - {{ticket.id}} -
-
- D - ES -
-
-
-
-
- -
+
+
{{$t('fiscalData')}}
+
+
{{client.socialName}}
+
{{client.street}}
+
{{client.fi}}
+
+
+
+
+ +

{{$t('saleLines')}}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('reference')}}{{$t('quantity')}}{{$t('concept')}}{{$t('price')}}{{$t('discount')}}{{$t('vat')}}{{$t('amount')}}
{{sale.itemFk}}{{sale.quantity}}{{sale.concept}}{{sale.price | currency('EUR', $i18n.locale)}}{{(sale.discount / 100) | percentage}}{{sale.vatType}} + {{sale.price * sale.quantity * (1 - sale.discount / 100) | currency('EUR', $i18n.locale)}} +
+ {{sale.tag5}} {{sale.value5}} + {{sale.tag6}} {{sale.value6}} + {{sale.tag7}} {{sale.value7}} +
+ {{$t('subtotal')}} + {{getSubTotal() | currency('EUR', $i18n.locale)}}
+ +
+
+

{{$t('services.title')}}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('services.theader.quantity')}}{{$t('services.theader.concept')}}{{$t('services.theader.price')}}{{$t('services.theader.vat')}}{{$t('services.theader.amount')}}
{{service.quantity}}{{service.description}}{{service.price | currency('EUR', $i18n.locale)}}{{service.taxDescription}}{{service.price | currency('EUR', $i18n.locale)}}
+ {{$t('services.tfoot.subtotal')}} + {{serviceTotal | currency('EUR', $i18n.locale)}}
+ * {{ $t('services.warning') }} +
+
+
+
+

{{$t('packagings.title')}}

+ + + + + + + + + + + + + + + +
{{$t('packagings.theader.reference')}}{{$t('packagings.theader.quantity')}}{{$t('packagings.theader.concept')}}
{{packaging.itemFk}}{{packaging.quantity}}{{packaging.name}}
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('taxes.title')}}
{{$t('taxes.theader.type')}}{{$t('taxes.theader.taxBase')}}{{$t('taxes.theader.tax')}}{{$t('taxes.theader.fee')}}
{{tax.name}}{{tax.Base | currency('EUR', $i18n.locale)}}{{tax.vatPercent | percentage}}{{tax.tax | currency('EUR', $i18n.locale)}}
{{$t('subtotal')}}{{getTotalBase() | currency('EUR', $i18n.locale)}}{{getTotalTax()| currency('EUR', $i18n.locale)}}
{{$t('total')}}{{getTotal() | currency('EUR', $i18n.locale)}}
+
+ +
+
+
+
- -
-
-
{{$t('digitalSignature')}}
-
- -
{{signature.created | date('%d-%m-%Y')}}
-
-
+
+
- +
{{$t('plantPassport')}}
+
+
+
+
+ A + {{getBotanical()}} +
+
+ B + ES17462130 +
+
+ C + {{ticket.id}} +
+
+ D + ES
- - - -
- - \ No newline at end of file + + + +
+
+
+
{{$t('digitalSignature')}}
+
+ +
{{formatDate(signature.created, '%d-%m-%Y')}}
+
+
+
+
+
+
+

{{$t('observations')}}

+

{{ticket.description}}

+
+
+ + + + \ No newline at end of file diff --git a/print/templates/reports/delivery-note/delivery-note.js b/print/templates/reports/delivery-note/delivery-note.js index f9dba0578..50d5720ad 100755 --- a/print/templates/reports/delivery-note/delivery-note.js +++ b/print/templates/reports/delivery-note/delivery-note.js @@ -1,28 +1,21 @@ -const config = require(`${appPath}/core/config`); -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); +const config = require(`vn-print/core/config`); +const vnReport = require('../../../core/mixins/vn-report.js'); const md5 = require('md5'); const fs = require('fs-extra'); module.exports = { name: 'delivery-note', - created() { - if (!this.type) - this.type = 'deliveryNote'; - }, + mixins: [vnReport], async serverPrefetch() { - this.client = await this.fetchClient(this.ticketId); - this.ticket = await this.fetchTicket(this.ticketId); - this.sales = await this.fetchSales(this.ticketId); - this.address = await this.fetchAddress(this.ticketId); - this.services = await this.fetchServices(this.ticketId); - this.taxes = await this.fetchTaxes(this.ticketId); - this.packagings = await this.fetchPackagings(this.ticketId); - this.signature = await this.fetchSignature(this.ticketId); - - if (!this.ticket) - throw new Error('Something went wrong'); + this.ticket = await this.findOneFromDef('ticket', [this.id]); + this.checkMainEntity(this.ticket); + this.client = await this.findOneFromDef('client', [this.id]); + this.sales = await this.rawSqlFromDef('sales', [this.id]); + this.address = await this.findOneFromDef(`address`, [this.id]); + this.services = await this.rawSqlFromDef('services', [this.id]); + this.taxes = await this.findOneFromDef('taxes', [this.id]); + this.packagings = await this.rawSqlFromDef('packagings', [this.id]); + this.signature = await this.findOneFromDef('signature', [this.id]); }, data() { return {totalBalance: 0.00}; @@ -41,6 +34,9 @@ module.exports = { return `data:image/png;base64, ${base64}`; }, + deliverNoteType() { + return this.type ? this.type : 'deliveryNote'; + }, serviceTotal() { let total = 0.00; this.services.forEach(service => { @@ -50,39 +46,17 @@ module.exports = { return total; }, showPrices() { - return this.type != 'withoutPrices'; + return this.deliverNoteType != 'withoutPrices'; }, footerType() { - const translatedType = this.$t(this.type); - return `${translatedType} ${this.ticketId}`; + const translatedType = this.$t(this.deliverNoteType); + return `${translatedType} ${this.id}`; + }, + hasObservations() { + return this.ticket.description !== null; } }, methods: { - fetchClient(ticketId) { - return this.findOneFromDef('client', [ticketId]); - }, - fetchTicket(ticketId) { - return this.findOneFromDef('ticket', [ticketId]); - }, - fetchAddress(ticketId) { - return this.findOneFromDef(`address`, [ticketId]); - }, - fetchSignature(ticketId) { - return this.findOneFromDef('signature', [ticketId]); - }, - fetchTaxes(ticketId) { - return this.findOneFromDef(`taxes`, [ticketId]); - }, - fetchSales(ticketId) { - return this.rawSqlFromDef('sales', [ticketId]); - }, - fetchPackagings(ticketId) { - return this.rawSqlFromDef('packagings', [ticketId]); - }, - fetchServices(ticketId) { - return this.rawSqlFromDef('services', [ticketId]); - }, - getSubTotal() { let subTotal = 0.00; this.sales.forEach(sale => { @@ -122,14 +96,11 @@ module.exports = { ).join(', '); } }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() - }, props: { - ticketId: { - type: [Number, String], - required: true + id: { + type: Number, + required: true, + description: 'The ticket id' }, type: { type: String, diff --git a/print/templates/reports/delivery-note/locale/en.yml b/print/templates/reports/delivery-note/locale/en.yml index c74b87520..5902da8b3 100644 --- a/print/templates/reports/delivery-note/locale/en.yml +++ b/print/templates/reports/delivery-note/locale/en.yml @@ -46,4 +46,5 @@ taxes: fee: Fee tfoot: subtotal: Subtotal - total: Total \ No newline at end of file + total: Total +observations: Observations \ No newline at end of file diff --git a/print/templates/reports/delivery-note/locale/es.yml b/print/templates/reports/delivery-note/locale/es.yml index 5c5a6af4d..d87198f45 100644 --- a/print/templates/reports/delivery-note/locale/es.yml +++ b/print/templates/reports/delivery-note/locale/es.yml @@ -47,4 +47,5 @@ taxes: fee: Cuota tfoot: subtotal: Subtotal - total: Total \ No newline at end of file + total: Total +observations: Observaciones \ No newline at end of file diff --git a/print/templates/reports/delivery-note/locale/fr.yml b/print/templates/reports/delivery-note/locale/fr.yml index df7ca053b..603623a47 100644 --- a/print/templates/reports/delivery-note/locale/fr.yml +++ b/print/templates/reports/delivery-note/locale/fr.yml @@ -47,4 +47,5 @@ taxes: fee: Quote tfoot: subtotal: Total partiel - total: Total \ No newline at end of file + total: Total +observations: Observations \ No newline at end of file diff --git a/print/templates/reports/delivery-note/locale/pt.yml b/print/templates/reports/delivery-note/locale/pt.yml index 1f418b31f..fb49d230b 100644 --- a/print/templates/reports/delivery-note/locale/pt.yml +++ b/print/templates/reports/delivery-note/locale/pt.yml @@ -47,4 +47,5 @@ taxes: fee: Compartilhado tfoot: subtotal: Subtotal - total: Total \ No newline at end of file + total: Total +observations: Observações \ No newline at end of file diff --git a/print/templates/reports/delivery-note/sql/ticket.sql b/print/templates/reports/delivery-note/sql/ticket.sql index f78c72544..9eac2d322 100644 --- a/print/templates/reports/delivery-note/sql/ticket.sql +++ b/print/templates/reports/delivery-note/sql/ticket.sql @@ -2,7 +2,11 @@ SELECT t.id, t.shipped, c.code companyCode, - t.packages + t.packages, + tto.description FROM ticket t JOIN company c ON c.id = t.companyFk + LEFT JOIN ticketObservation tto + ON tto.ticketFk = t.id + AND tto.observationTypeFk = (SELECT id FROM observationType WHERE code = 'deliveryNote') WHERE t.id = ? \ No newline at end of file diff --git a/print/templates/reports/driver-route/assets/css/import.js b/print/templates/reports/driver-route/assets/css/import.js index fd8796c2b..37a98dfdd 100644 --- a/print/templates/reports/driver-route/assets/css/import.js +++ b/print/templates/reports/driver-route/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/driver-route/driver-route.html b/print/templates/reports/driver-route/driver-route.html index 5d840958d..1475b8e77 100644 --- a/print/templates/reports/driver-route/driver-route.html +++ b/print/templates/reports/driver-route/driver-route.html @@ -1,162 +1,141 @@ - - - - - - - - - -
- - - -
-
-

{{$t('route')}} {{route.id}}

-
-
{{$t('information')}}
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('route')}}{{route.id}}{{$t('driver')}}{{route.userNickName}}
{{$t('date')}}{{route.created | date('%d-%m-%Y')}}{{$t('vehicle')}}{{route.vehicleTradeMark}} {{route.vehicleModel}}
{{$t('time')}}{{route.time | date('%H:%M')}}{{route.plateNumber}}
{{$t('volume')}}{{route.m3}}{{$t('agency')}}{{route.agencyName}}
-
- - - - - - - - - - - - - - - -
-

Hora inicio

-
-

Hora fin

-
-

Km inicio

-
-

Km fin

-
-
- -
-
-
- -
-
-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - - - -
{{$t('order')}}{{$t('ticket')}}{{$t('client')}}{{$t('address')}}{{$t('packages')}}{{$t('packagingType')}}
{{ticket.priority}}{{ticket.id}}{{ticket.clientFk}} {{ticket.addressName}} - {{ticket.addressFk.toString().substr(0, - ticket.addressFk.toString().length - 3)}} - - {{ticket.addressFk.toString().substr(-3, 3)}} - - {{ticket.packages}}{{ticket.itemPackingTypes}}
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('street')}}{{ticket.street}}{{$t('postcode')}}{{ticket.postalCode}}
{{$t('city')}}{{ticket.city}}{{$t('agency')}}{{ticket.ticketAgency}}
{{$t('mobile')}}{{ticket.mobile}}{{$t('phone')}}{{ticket.phone}}
{{$t('warehouse')}}{{ticket.warehouseName}}{{$t('salesPerson')}}{{ticket.salesPersonName}}
-
-

{{ticket.description}}

-

{{$t('stowaway')}}: {{ticket.shipFk}}

-
-
-
+ +
+
+

{{$t('route')}} {{route.id}}

+
+
{{$t('information')}}
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('route')}}{{route.id}}{{$t('driver')}}{{route.userNickName}}
{{$t('date')}}{{formatDate(route.created, '%d-%m-%Y')}}{{$t('vehicle')}}{{route.vehicleTradeMark}} {{route.vehicleModel}}
{{$t('time')}}{{formatDate(route.time, '%H:%M')}}{{route.plateNumber}}
{{$t('volume')}}{{route.m3}}{{$t('agency')}}{{route.agencyName}}
+
+ + + + + + + + + + + + + + + +
+

Hora inicio

+
+

Hora fin

+
+

Km inicio

+
+

Km fin

+
+
+ +
+
+
+ +
+
- - - -
- - \ No newline at end of file + + +
+
+ + + + + + + + + + + + + + + + + + + + + +
{{$t('order')}}{{$t('ticket')}}{{$t('client')}}{{$t('address')}}{{$t('packages')}}{{$t('packagingType')}}
{{ticket.priority}}{{ticket.id}}{{ticket.clientFk}} {{ticket.addressName}} + {{ticket.addressFk.toString().substr(0, ticket.addressFk.toString().length - 3)}} + {{ticket.addressFk.toString().substr(-3, 3)}} + {{ticket.packages}}{{ticket.itemPackingTypes}}
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('street')}}{{ticket.street}}{{$t('postcode')}}{{ticket.postalCode}}
{{$t('city')}}{{ticket.city}}{{$t('agency')}}{{ticket.ticketAgency}}
{{$t('mobile')}}{{ticket.mobile}}{{$t('phone')}}{{ticket.phone}}
{{$t('warehouse')}}{{ticket.warehouseName}}{{$t('salesPerson')}}{{ticket.salesPersonName}}
+
+

{{ticket.description}}

+
+
+
+ + + + diff --git a/print/templates/reports/driver-route/driver-route.js b/print/templates/reports/driver-route/driver-route.js index c34de37cc..c166e3809 100755 --- a/print/templates/reports/driver-route/driver-route.js +++ b/print/templates/reports/driver-route/driver-route.js @@ -1,13 +1,17 @@ -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); +const vnReport = require('../../../core/mixins/vn-report.js'); module.exports = { name: 'driver-route', + mixins: [vnReport], async serverPrefetch() { - const routesId = this.routeId.split(','); - const routes = await this.fetchRoutes(routesId); - const tickets = await this.fetchTickets(routesId); + let ids = this.id; + + const hasMultipleRoutes = String(this.id).includes(','); + if (hasMultipleRoutes) + ids = this.id.split(','); + + const routes = await this.rawSqlFromDef('routes', [ids]); + const tickets = await this.rawSqlFromDef('tickets', [ids, ids]); const map = new Map(); @@ -22,25 +26,13 @@ module.exports = { this.routes = routes; - if (!this.routes) - throw new Error('Something went wrong'); - }, - methods: { - fetchRoutes(routesId) { - return this.rawSqlFromDef('routes', [routesId]); - }, - fetchTickets(routesId) { - return this.rawSqlFromDef('tickets', [routesId, routesId]); - } - }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() + this.checkMainEntity(this.routes); }, props: { - routeId: { - type: [Number, String], - required: true + id: { + type: Number, + required: true, + description: 'The route id' } } }; diff --git a/print/templates/reports/driver-route/locale/es.yml b/print/templates/reports/driver-route/locale/es.yml index 4c922ba64..8f986b0d2 100644 --- a/print/templates/reports/driver-route/locale/es.yml +++ b/print/templates/reports/driver-route/locale/es.yml @@ -20,7 +20,6 @@ phone: Teléfono warehouse: Almacén salesPerson: Comercial import: Importe -stowaway: Encajado dentro del ticket -route: Ruta +route: Ruta routeId: Ruta {0} -ticket: Ticket \ No newline at end of file +ticket: Ticket diff --git a/print/templates/reports/driver-route/sql/tickets.sql b/print/templates/reports/driver-route/sql/tickets.sql index 8806a0473..09e73819b 100644 --- a/print/templates/reports/driver-route/sql/tickets.sql +++ b/print/templates/reports/driver-route/sql/tickets.sql @@ -17,7 +17,6 @@ SELECT 0 AS import, am.name ticketAgency, tob.description, - s.shipFk, u.nickName salesPersonName, ipkg.itemPackingTypes FROM route r @@ -30,7 +29,6 @@ FROM route r LEFT JOIN province p ON a.provinceFk = p.id LEFT JOIN warehouse wh ON wh.id = t.warehouseFk LEFT JOIN agencyMode am ON am.id = t.agencyModeFk - LEFT JOIN stowaway s ON s.id = t.id LEFT JOIN ( SELECT t.id AS ticketFk, GROUP_CONCAT(DISTINCT(i.itemPackingTypeFk)) AS itemPackingTypes diff --git a/print/templates/reports/entry-order/assets/css/import.js b/print/templates/reports/entry-order/assets/css/import.js index fd8796c2b..37a98dfdd 100644 --- a/print/templates/reports/entry-order/assets/css/import.js +++ b/print/templates/reports/entry-order/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/entry-order/entry-order.html b/print/templates/reports/entry-order/entry-order.html index 956d4e2f6..5d362dea9 100644 --- a/print/templates/reports/entry-order/entry-order.html +++ b/print/templates/reports/entry-order/entry-order.html @@ -1,127 +1,102 @@ - - - - - - - - - -
- - - - -
-
-
-
-
-

{{$t('title')}}

- - - - - - - - - - - - - - - -
{{$t('entryId')}}{{entry.id}}
{{$t('date')}}{{entry.landed | date('%d-%m-%Y')}}
{{$t('ref')}}{{entry.ref}}
-
-
-
-
-
{{$t('supplierData')}}
-
-

{{supplier.name}}

-
- {{supplier.street}} -
-
- {{supplier.postCode}}, {{supplier.city}}, ({{supplier.province}}) -
-
- {{supplier.nif}} -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('boxes')}}{{$t('packing')}}{{$t('concept')}}{{$t('quantity')}}{{$t('price')}}{{$t('amount')}}
{{buy.box}}{{buy.packing}}{{buy.itemName}}{{buy.quantity | number($i18n.locale)}}{{buy.buyingValue | currency('EUR', $i18n.locale)}}{{buy.buyingValue * buy.quantity | currency('EUR', $i18n.locale)}}
- - {{buy.tag5}} {{buy.value5}} - - - {{buy.tag6}} {{buy.value6}} - - - {{buy.tag7}} {{buy.value7}} - -
- {{$t('total')}} - {{getTotal() | currency('EUR', $i18n.locale)}}
- -
-
-
-
-

{{$t('notes')}}

-
- {{entry.notes}} -
-
-
-
-
-
+ + +
+
+
+
+
+

{{$t('title')}}

+ + + + + + + + + + + + + + + +
{{$t('entryId')}}{{entry.id}}
{{$t('date')}}{{formatDate(entry.landed,'%d-%m-%Y')}}
{{$t('ref')}}{{entry.invoiceNumber}}
+
+
+
+
+
{{$t('supplierData')}}
+
+

{{supplier.name}}

+
{{supplier.street}}
+
{{supplier.postCode}}, {{supplier.city}}, ({{supplier.province}})
+
{{supplier.nif}}
- - - -
- - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('boxes')}}{{$t('packing')}}{{$t('concept')}}{{$t('quantity')}}{{$t('price')}}{{$t('amount')}}
{{buy.box}}{{buy.packing}}{{buy.itemName}}{{buy.quantity | number($i18n.locale)}}{{buy.buyingValue | currency('EUR', $i18n.locale)}} + {{buy.buyingValue * buy.quantity | currency('EUR', $i18n.locale)}} +
+ {{buy.tag5}} {{buy.value5}} + {{buy.tag6}} {{buy.value6}} + {{buy.tag7}} {{buy.value7}} +
+ {{$t('total')}} + {{getTotal() | currency('EUR', $i18n.locale)}}
+
+
+
+
+

{{$t('notes')}}

+
{{entry.notes}}
+
+
+
+
+ + + + diff --git a/print/templates/reports/entry-order/entry-order.js b/print/templates/reports/entry-order/entry-order.js index 52a56bf03..d31ad1a36 100755 --- a/print/templates/reports/entry-order/entry-order.js +++ b/print/templates/reports/entry-order/entry-order.js @@ -1,30 +1,18 @@ -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); +const vnReport = require('../../../core/mixins/vn-report.js'); module.exports = { name: 'entry-order', + mixins: [vnReport], async serverPrefetch() { - this.supplier = await this.fetchSupplier(this.entryId); - this.entry = await this.fetchEntry(this.entryId); - this.buys = await this.fetchBuys(this.entryId); - - if (!this.entry) - throw new Error('Something went wrong'); + this.entry = await this.findOneFromDef('entry', [this.id]); + this.checkMainEntity(this.entry); + this.supplier = await this.findOneFromDef('supplier', [this.id]); + this.buys = await this.rawSqlFromDef('buys', [this.id]); }, data() { return {totalBalance: 0.00}; }, methods: { - fetchSupplier(entryId) { - return this.findOneFromDef('supplier', [entryId]); - }, - fetchEntry(entryId) { - return this.findOneFromDef('entry', [entryId]); - }, - fetchBuys(entryId) { - return this.rawSqlFromDef('buys', [entryId]); - }, getTotal() { let total = 0.00; this.buys.forEach(buy => { @@ -34,14 +22,11 @@ module.exports = { return total; } }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() - }, props: { - entryId: { - type: [Number, String], - required: true + id: { + type: Number, + required: true, + description: 'The entry id' } } }; diff --git a/print/templates/reports/entry-order/sql/entry.sql b/print/templates/reports/entry-order/sql/entry.sql index 44feaae01..57b8d9293 100644 --- a/print/templates/reports/entry-order/sql/entry.sql +++ b/print/templates/reports/entry-order/sql/entry.sql @@ -1,10 +1,10 @@ SELECT e.id, - e.ref, + e.invoiceNumber, e.notes, c.code companyCode, t.landed FROM entry e JOIN travel t ON t.id = e.travelFk JOIN company c ON c.id = e.companyFk -WHERE e.id = ? \ No newline at end of file +WHERE e.id = ? diff --git a/print/templates/reports/expedition-pallet-label/assets/css/import.js b/print/templates/reports/expedition-pallet-label/assets/css/import.js new file mode 100644 index 000000000..37a98dfdd --- /dev/null +++ b/print/templates/reports/expedition-pallet-label/assets/css/import.js @@ -0,0 +1,12 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, + `${__dirname}/style.css`]) + .mergeStyles(); diff --git a/print/templates/reports/expedition-pallet-label/assets/css/style.css b/print/templates/reports/expedition-pallet-label/assets/css/style.css new file mode 100644 index 000000000..bd7366486 --- /dev/null +++ b/print/templates/reports/expedition-pallet-label/assets/css/style.css @@ -0,0 +1,70 @@ +html { + font-family: Arial, Helvetica, sans-serif; +} +* { + box-sizing: border-box; + font-size: 25px; +} +#truck { + width: 100%; + max-width: 150px; + height: 90px; + background-color: black; + color: white; + font-size: 50px; + font-weight: bold; + text-align: center; +} +.mainTable { + width: 100%; + border: 10px solid; + border-radius: 20px; + -moz-border-radius: 20px; + -webkit-border-radius: 10px; + border-collapse: separate; + border-spacing: 0px; +} +.zoneTable{ + width: 100%; + margin: 0 auto; + border-collapse: collapse; +} +#routeFk, #zone, #labels{ + font-size: 30px; +} +#routeFk{ + width: 120px; + padding-top: 5px; + padding-bottom: 5px; + max-width: 120px; + text-align: center; +} +#zone{ + width: 305px; + max-width: 305px; + text-align: center; +} +#labels{ + text-align: center; +} +#black { + background-color: rgb(102, 102, 102); + color: white; +} +#QR { + padding: 25px; + margin-left: 35px; + float:left; +} +#barcode{ + text-align: center; +} +#right { + float: right; + margin-top: 20px; + width: 250; + max-width: 250px; +} +#additionalInfo { + padding-top: 20px; +} \ No newline at end of file diff --git a/print/templates/reports/expedition-pallet-label/expedition-pallet-label.html b/print/templates/reports/expedition-pallet-label/expedition-pallet-label.html new file mode 100644 index 000000000..e4360c79d --- /dev/null +++ b/print/templates/reports/expedition-pallet-label/expedition-pallet-label.html @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + +
{{labelData.truck || '---'}}
+
+ + + + + + + + + + + + + +
{{labelData.routeFk}}{{labelData.zone || '---'}}{{labelData.labels}}
{{labelData.routeFk}}{{labelData.zone || '---'}}{{labelData.labels || '--'}}
+
+ + +
+ + \ No newline at end of file diff --git a/print/templates/reports/expedition-pallet-label/expedition-pallet-label.js b/print/templates/reports/expedition-pallet-label/expedition-pallet-label.js new file mode 100644 index 000000000..d2fa59612 --- /dev/null +++ b/print/templates/reports/expedition-pallet-label/expedition-pallet-label.js @@ -0,0 +1,57 @@ +const vnReport = require('../../../core/mixins/vn-report.js'); +const jsBarcode = require('jsbarcode'); +const {DOMImplementation, XMLSerializer} = require('xmldom'); +const qrcode = require('qrcode'); + +module.exports = { + name: 'expedition-pallet-label', + mixins: [vnReport], + props: { + id: { + type: Number, + required: true, + description: 'The pallet id' + }, + userFk: { + type: Number, + required: true, + description: 'The user id' + } + }, + async serverPrefetch() { + this.labelsData = await this.rawSqlFromDef('labelData', this.id); + this.username = await this.findOneFromDef('username', this.userFk); + this.labelData = this.labelsData[0]; + this.checkMainEntity(this.labelData); + + let QRdata = JSON.stringify({ + company: 'vnl', + user: this.userFk, + created: Date.vnNew(), + table: 'expeditionPallet', + id: this.id + }); + + this.QR = await this.getQR(QRdata); + }, + methods: { + getQR(id) { + const data = String(id); + return qrcode.toDataURL(data, {margin: 0}); + }, + getBarcode(id) { + const xmlSerializer = new XMLSerializer(); + const document = new DOMImplementation().createDocument('http://www.w3.org/1999/xhtml', 'html', null); + const svgNode = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + + jsBarcode(svgNode, id, { + xmlDocument: document, + format: 'code128', + displayValue: false, + width: 6, + height: 90, + }); + return xmlSerializer.serializeToString(svgNode); + }, + }, +}; diff --git a/print/templates/reports/expedition-pallet-label/locale/es.yml b/print/templates/reports/expedition-pallet-label/locale/es.yml new file mode 100644 index 000000000..f97730aef --- /dev/null +++ b/print/templates/reports/expedition-pallet-label/locale/es.yml @@ -0,0 +1 @@ +reportName: labelPalletExpedition \ No newline at end of file diff --git a/print/templates/reports/expedition-pallet-label/options.json b/print/templates/reports/expedition-pallet-label/options.json new file mode 100644 index 000000000..5814b2c0f --- /dev/null +++ b/print/templates/reports/expedition-pallet-label/options.json @@ -0,0 +1,11 @@ +{ + "width": "10cm", + "height": "15cm", + "margin": { + "top": "0.3cm", + "right": "0.07cm", + "bottom": "0cm", + "left": "0cm" + }, + "printBackground": true +} \ No newline at end of file diff --git a/print/templates/reports/expedition-pallet-label/sql/labelData.sql b/print/templates/reports/expedition-pallet-label/sql/labelData.sql new file mode 100644 index 000000000..0661dbe0f --- /dev/null +++ b/print/templates/reports/expedition-pallet-label/sql/labelData.sql @@ -0,0 +1,19 @@ +SELECT ep.id palletFk, + t.routeFk, + et2.description truck, + r.description `zone`, + COUNT(es.id) labels, + t.warehouseFk warehouseFk, + dayname(r.created) `dayName`, + et.id <=> rm.expeditionTruckFk isMatch + 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.id = ? + GROUP BY ep.id, t.routeFk + ORDER BY t.routeFk \ No newline at end of file diff --git a/print/templates/reports/expedition-pallet-label/sql/username.sql b/print/templates/reports/expedition-pallet-label/sql/username.sql new file mode 100644 index 000000000..e2ca3c65a --- /dev/null +++ b/print/templates/reports/expedition-pallet-label/sql/username.sql @@ -0,0 +1,3 @@ +SELECT `name` + FROM account.user + WHERE id = ? \ No newline at end of file diff --git a/print/templates/reports/exportation/assets/css/import.js b/print/templates/reports/exportation/assets/css/import.js index a2a9334cb..37a98dfdd 100644 --- a/print/templates/reports/exportation/assets/css/import.js +++ b/print/templates/reports/exportation/assets/css/import.js @@ -1,8 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, - `${appPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/exportation/exportation.html b/print/templates/reports/exportation/exportation.html index f08af2cdb..0800c024d 100644 --- a/print/templates/reports/exportation/exportation.html +++ b/print/templates/reports/exportation/exportation.html @@ -1,51 +1,35 @@ - - - - - - - - - -
- - - -
-
-

{{$t('title')}}

-

{{$t('toAttention')}}

-

-

-

    -
  • - {{responsibility}} -
  • -
-

-
-

{{$t('issued', [ - 'Algemesí', - invoice.issued.getDate(), - $t('months')[invoice.issued.getMonth()], - invoice.issued.getFullYear()]) - }} -

-

({{$t('signature')}})

- -

-

{{$t('signer.name')}}: JUAN VICENTE FERRER ROIG
-
{{$t('signer.ID')}}: 73943586N
-
{{$t('signer.position')}}: ADMINISTRADOR
-

-
-
-
- - - -
- - \ No newline at end of file + +
+
+

{{$t('title')}}

+

{{$t('toAttention')}}

+

+

+

    +
  • + {{responsibility}} +
  • +
+

+
+

{{$t('issued', [ + 'Algemesí', + invoice.issued.getDate(), + $t('months')[invoice.issued.getMonth()], + invoice.issued.getFullYear()]) + }} +

+

({{$t('signature')}})

+ +

+

{{$t('signer.name')}}: {{company.manager}}
+
{{$t('signer.ID')}}: {{company.managerFi}}
+
{{$t('signer.position')}}: {{$t('manager')}}
+

+
+
+
+ +
diff --git a/print/templates/reports/exportation/exportation.js b/print/templates/reports/exportation/exportation.js index fbf663249..123b350ee 100755 --- a/print/templates/reports/exportation/exportation.js +++ b/print/templates/reports/exportation/exportation.js @@ -1,35 +1,18 @@ -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); +const vnReport = require('../../../core/mixins/vn-report.js'); module.exports = { name: 'exportation', + mixins: [vnReport], async serverPrefetch() { - this.invoice = await this.fetchInvoice(this.invoiceId); - - if (!this.invoice) - throw new Error('Something went wrong'); - }, - methods: { - fetchInvoice(invoiceId) { - return this.findOneFromDef('invoice', [invoiceId]); - } - }, - computed: { - issued: function() { - const filters = this.$options.filters; - - return filters.date(this.invoice.issued, '%d-%m-%Y'); - } - }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() + this.invoice = await this.findOneFromDef('invoice', [this.reference]); + this.checkMainEntity(this.invoice); + this.company = await this.findOneFromDef('company', [this.invoice.companyFk]); }, props: { - invoiceId: { - type: [Number, String], - required: true + reference: { + type: Number, + required: true, + description: 'The invoice ref' } } }; diff --git a/print/templates/reports/exportation/locale/es.yml b/print/templates/reports/exportation/locale/es.yml index a689e245b..230263cb9 100644 --- a/print/templates/reports/exportation/locale/es.yml +++ b/print/templates/reports/exportation/locale/es.yml @@ -36,6 +36,7 @@ signer: name: Nombre del firmante ID: DNI del firmante position: Cargo del firmante +manager: Gerente months: - 'Enero' - 'Febrero' diff --git a/print/templates/reports/exportation/sql/company.sql b/print/templates/reports/exportation/sql/company.sql new file mode 100644 index 000000000..3ecef2071 --- /dev/null +++ b/print/templates/reports/exportation/sql/company.sql @@ -0,0 +1,9 @@ +SELECT + s.name, + s.city, + cl.name AS manager, + cl.fi AS managerFi +FROM company c + JOIN supplier s ON s.id = c.id + JOIN client cl ON cl.id = c.workerManagerFk +WHERE c.id = ? \ No newline at end of file diff --git a/print/templates/reports/exportation/sql/invoice.sql b/print/templates/reports/exportation/sql/invoice.sql index 8e92333dd..14e1568e2 100644 --- a/print/templates/reports/exportation/sql/invoice.sql +++ b/print/templates/reports/exportation/sql/invoice.sql @@ -1,6 +1,8 @@ SELECT io.id, io.ref, - io.issued + io.issued, + io.companyFk FROM invoiceOut io -WHERE io.id = ? \ No newline at end of file + LEFT JOIN ticket t ON t.refFk = io.ref +WHERE t.refFk = ? \ No newline at end of file diff --git a/print/templates/reports/extra-community/assets/css/import.js b/print/templates/reports/extra-community/assets/css/import.js index fd8796c2b..37a98dfdd 100644 --- a/print/templates/reports/extra-community/assets/css/import.js +++ b/print/templates/reports/extra-community/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/extra-community/extra-community.html b/print/templates/reports/extra-community/extra-community.html index 86baf858b..3153b6b03 100644 --- a/print/templates/reports/extra-community/extra-community.html +++ b/print/templates/reports/extra-community/extra-community.html @@ -1,84 +1,67 @@ - - - - - - - - - -
- - -
-
-

{{$t('title')}}

-
-
+ +
+
+

{{$t('title')}}

+
+
+
+
+
+
{{$t('information')}}
+
+
+ + + + + + + + + + + + + + + + + + + + + +
{{$t('reference')}}{{travel.ref}}{{$t('blockedKg')}}{{travel.kg | number($i18n.locale)}}
{{$t('packages')}}{{travel.stickers}}{{$t('volumeKg')}}{{travel.volumeKg | number($i18n.locale)}}
{{$t('shipped')}}{{formatDate(travel.shipped, '%d-%m-%Y')}}{{$t('physicalKg')}}{{travel.loadedKg | number($i18n.locale)}}
+
+
+
- -
-
-
-
{{$t('information')}}
-
-
- - - - - - - - - - - - - - - - - - - - - -
{{$t('reference')}}{{travel.ref}}{{$t('blockedKg')}}{{travel.kg | number($i18n.locale)}}
{{$t('packages')}}{{travel.stickers}}{{$t('volumeKg')}}{{travel.volumeKg | number($i18n.locale)}}
{{$t('shipped')}}{{travel.shipped | date('%d-%m-%Y')}}{{$t('physicalKg')}}{{travel.loadedKg | number($i18n.locale)}}
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
{{$t('supplier')}}{{$t('reference')}}{{$t('volKg')}}{{$t('phyKg')}}{{$t('packages')}}
{{entry.supplierName}}{{entry.ref}}{{entry.volumeKg | number($i18n.locale)}}{{entry.loadedKg | number($i18n.locale)}}{{entry.stickers}}
{{$t('noRows')}}
-
-
- - - -
- - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + +
{{$t('supplier')}}{{$t('reference')}}{{$t('volKg')}}{{$t('phyKg')}}{{$t('packages')}}
{{entry.supplierName}}{{entry.reference}}{{entry.volumeKg | number($i18n.locale)}}{{entry.loadedkg | number($i18n.locale)}}{{entry.stickers}}
{{$t('noRows')}}
+ + + + diff --git a/print/templates/reports/extra-community/extra-community.js b/print/templates/reports/extra-community/extra-community.js index 9843d6bb7..5d875d78f 100755 --- a/print/templates/reports/extra-community/extra-community.js +++ b/print/templates/reports/extra-community/extra-community.js @@ -1,107 +1,47 @@ -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); -const db = require(`${appPath}/core/database`); +const vnReport = require('../../../core/mixins/vn-report.js'); +const app = require('vn-loopback/server/server'); module.exports = { name: 'extra-community', + mixins: [vnReport], async serverPrefetch() { - this.filters = this.$options.filters; const args = { + search: this.search, landedTo: this.landedEnd, shippedFrom: this.shippedStart, continent: this.continent, id: this.id, - agencyFk: this.agencyFk, + agencyModeFk: this.agencyModeFk, warehouseInFk: this.warehouseInFk, warehouseOutFk: this.warehouseOutFk, totalEntries: this.totalEntries, ref: this.ref, cargoSupplierFk: this.cargoSupplierFk }; - - const travels = await this.fetchTravels(args); - const travelIds = travels.map(travel => travel.id); - const entries = await this.fetchEntries(travelIds); - - const map = new Map(); - for (let travel of travels) - map.set(travel.id, travel); - - for (let entry of entries) { - const travel = map.get(entry.travelFk); - if (!travel.entries) travel.entries = []; - travel.entries.push(entry); - } - - this.travels = travels; - - if (!this.travels) - throw new Error('Something went wrong'); + const ctx = {args: args}; + this.travels = await app.models.Travel.extraCommunityFilter(ctx, this.filter); }, computed: { - dated: function() { - return this.filters.date(new Date(), '%d-%m-%Y'); - }, landedEnd: function() { if (!this.landedTo) return; - - return this.filters.date(this.landedTo, '%Y-%m-%d'); + return this.formatDate(this.landedTo, '%Y-%m-%d'); }, shippedStart: function() { if (!this.shippedFrom) return; - - return this.filters.date(this.shippedFrom, '%Y-%m-%d'); + return this.formatDate(this.shippedFrom, '%Y-%m-%d'); } }, methods: { - fetchTravels(args) { - const where = db.buildWhere(args, (key, value) => { - switch (key) { - case 'shippedFrom': - return `t.shipped >= ${value}`; - case 'landedTo': - return `t.landed <= ${value}`; - case 'continent': - return `cnt.code = ${value}`; - case 'ref': - return {'t.ref': {like: `%${value}%`}}; - case 'id': - return `t.id = ${value}`; - case 'agencyFk': - return `am.id = ${value}`; - case 'warehouseOutFk': - return `wo.id = ${value}`; - case 'warehouseInFk': - return `w.id = ${value}`; - case 'cargoSupplierFk': - return `s.id = ${value}`; - } - }); - - let query = this.getSqlFromDef('travels'); - query = db.merge(query, where); - query = db.merge(query, 'GROUP BY t.id'); - query = db.merge(query, 'ORDER BY `shipped` ASC, `landed` ASC, `travelFk`, `loadPriority`, `agencyModeFk`, `evaNotes`'); - - return this.rawSql(query); - }, - - fetchEntries(travelIds) { - return this.rawSqlFromDef('entries', [travelIds]); - } - }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() }, props: [ + 'filter', + 'search', 'landedTo', 'shippedFrom', 'continent', - 'ref', + 'reference', 'id', - 'agencyFk', + 'agencyModeFk', 'warehouseOutFk', 'warehouseInFk', 'totalEntries', diff --git a/print/templates/reports/extra-community/sql/entries.sql b/print/templates/reports/extra-community/sql/entries.sql deleted file mode 100644 index ad2529a1c..000000000 --- a/print/templates/reports/extra-community/sql/entries.sql +++ /dev/null @@ -1,17 +0,0 @@ -SELECT - e.id, - e.travelFk, - e.ref, - s.name AS supplierName, - SUM(b.stickers) AS stickers, - CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg, - CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg -FROM travel t - JOIN entry e ON e.travelFk = t.id - JOIN buy b ON b.entryFk = e.id - JOIN packaging pkg ON pkg.id = b.packageFk - JOIN item i ON i.id = b.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN supplier s ON s.id = e.supplierFk - WHERE t.id IN(?) -GROUP BY e.id \ No newline at end of file diff --git a/print/templates/reports/extra-community/sql/travels.sql b/print/templates/reports/extra-community/sql/travels.sql deleted file mode 100644 index 167c8b1f8..000000000 --- a/print/templates/reports/extra-community/sql/travels.sql +++ /dev/null @@ -1,22 +0,0 @@ -SELECT - t.id, - t.ref, - t.shipped, - t.landed, - t.kg, - am.id AS agencyModeFk, - SUM(b.stickers) AS stickers, - CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg, - CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg -FROM travel t - LEFT JOIN supplier s ON s.id = t.cargoSupplierFk - LEFT JOIN entry e ON e.travelFk = t.id - LEFT JOIN buy b ON b.entryFk = e.id - LEFT JOIN packaging pkg ON pkg.id = b.packageFk - LEFT JOIN item i ON i.id = b.itemFk - LEFT JOIN itemType it ON it.id = i.typeFk - JOIN warehouse w ON w.id = t.warehouseInFk - JOIN warehouse wo ON wo.id = t.warehouseOutFk - JOIN country c ON c.id = wo.countryFk - LEFT JOIN continent cnt ON cnt.id = c.continentFk - JOIN agencyMode am ON am.id = t.agencyFk \ No newline at end of file diff --git a/print/templates/reports/incoterms-authorization/assets/css/import.js b/print/templates/reports/incoterms-authorization/assets/css/import.js new file mode 100644 index 000000000..37a98dfdd --- /dev/null +++ b/print/templates/reports/incoterms-authorization/assets/css/import.js @@ -0,0 +1,12 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, + `${__dirname}/style.css`]) + .mergeStyles(); diff --git a/print/templates/reports/cmr-authorization/assets/css/style.css b/print/templates/reports/incoterms-authorization/assets/css/style.css similarity index 69% rename from print/templates/reports/cmr-authorization/assets/css/style.css rename to print/templates/reports/incoterms-authorization/assets/css/style.css index adfe4b4c9..34545c951 100644 --- a/print/templates/reports/cmr-authorization/assets/css/style.css +++ b/print/templates/reports/incoterms-authorization/assets/css/style.css @@ -2,13 +2,8 @@ font-size: 1.2em } -.signature .dummy-signature { - width: 400px; - height: 190px; - display: block; - content: ''; - overflow: hidden; - clear:both +.signature { + margin-top: 100px } .signature img { diff --git a/print/templates/reports/cmr-authorization/assets/images/signature.png b/print/templates/reports/incoterms-authorization/assets/images/signature.png similarity index 100% rename from print/templates/reports/cmr-authorization/assets/images/signature.png rename to print/templates/reports/incoterms-authorization/assets/images/signature.png diff --git a/print/templates/reports/incoterms-authorization/incoterms-authorization.html b/print/templates/reports/incoterms-authorization/incoterms-authorization.html new file mode 100644 index 000000000..99a5e9caa --- /dev/null +++ b/print/templates/reports/incoterms-authorization/incoterms-authorization.html @@ -0,0 +1,61 @@ + +
+
+

+

+

+ +
+
+

{{client.name}}

+
+ + + + + + + + + + + + + + + +
{{$t('signer.representative')}}:
{{$t('signer.representativeRole')}}:
{{$t('signer.signed')}}:
+
+
+

{{ company.name }}

+ +
{{company.manager}}
+
{{$t('manager')}}
+
+
+
+
+ +
diff --git a/print/templates/reports/incoterms-authorization/incoterms-authorization.js b/print/templates/reports/incoterms-authorization/incoterms-authorization.js new file mode 100755 index 000000000..53425487e --- /dev/null +++ b/print/templates/reports/incoterms-authorization/incoterms-authorization.js @@ -0,0 +1,22 @@ +const vnReport = require('../../../core/mixins/vn-report.js'); + +module.exports = { + name: 'incoterms-authorization', + mixins: [vnReport], + async serverPrefetch() { + this.client = await this.findOneFromDef('client', [this.id]); + this.checkMainEntity(this.client); + this.company = await this.findOneFromDef('company', [this.companyId]); + }, + props: { + id: { + type: Number, + required: true, + description: 'The client id' + }, + companyId: { + type: Number, + required: true + } + } +}; diff --git a/print/templates/reports/cmr-authorization/locale/es.yml b/print/templates/reports/incoterms-authorization/locale/es.yml similarity index 58% rename from print/templates/reports/cmr-authorization/locale/es.yml rename to print/templates/reports/incoterms-authorization/locale/es.yml index 37e40202d..6936ebda9 100644 --- a/print/templates/reports/cmr-authorization/locale/es.yml +++ b/print/templates/reports/incoterms-authorization/locale/es.yml @@ -1,32 +1,32 @@ -reportName: autorizacion-cmr +reportName: autorizacion-incoterms description: '{socialName} una sociedad debidamente constituida con responsabilidad limitada y registrada conforme al derecho de sociedades de {country} y aquí representada por ___________________. {socialName}, con domicilio en {address}, CIF {fiscalID}. En adelante denominada {name}.' issued: 'En {0}, a {1} de {2} de {3}' -client: 'Client {0}' +client: 'Cliente {0}' declaration: '{socialName} declara por la presente que:' declarations: - - 'Todas las compras realizadas por {socialName} con Verdnatura Levante, S.L. se -entregan, Ex Works (Incoterms), en el almacén de Verdnatura Levante, S.L. situado en -{destinationWarehouse}.' - - '{socialName} reconoce que es importante para Verdnatura Levante, S.L. tener + - 'Todas las compras realizadas por {socialName} con {companyName} se +entregan, Ex Works (Incoterms), en el almacén de {companyName} situado en +{companyCity}.' + - '{socialName} reconoce que es importante para {companyName} tener comprobante de la entrega intracomunitaria de la mercancía a {destinationCountry} para poder facturar con 0% de IVA.' - 'Por tanto, al firmar este acuerdo, {socialName} declara que todos los bienes que -se compren a Verdnatura Levante, S.L. serán entregados a {destinationCountry}.' - - 'Además, {socialName} deberá, a primera solicitud de Verdnatura Levante, S.L., -proporcionar una prueba de que todos los productos comprados a Verdnatura Levante, S.L. han +se compren a {companyName} serán entregados a {destinationCountry}.' + - 'Además, {socialName} deberá, a primera solicitud de {companyName}, +proporcionar una prueba de que todos los productos comprados a {companyName} han sido entregados en {destinationCountry}.' - - 'Además de lo anterior, Verdnatura Levante, S.L. proporcionará a {socialName} + - 'Además de lo anterior, {companyName} proporcionará a {socialName} un resumen mensual en el que se incluyen todas las facturas (y las entregas correspondientes). -{socialName} firmará y devolverá el resumen mensual a Verdnatura Levante, +{socialName} firmará y devolverá el resumen mensual a {companyName}, S.L. dentro de los 5 días posteriores a la recepción del resumen.' -signature: Verdnatura Levante, S.L. signer: representative: Representante representativeRole: Cargo del representante signed: Fecha de firma +manager: Gerente months: - 'Enero' - 'Febrero' diff --git a/print/templates/reports/incoterms-authorization/locale/fr.yml b/print/templates/reports/incoterms-authorization/locale/fr.yml new file mode 100644 index 000000000..f1aeb0eff --- /dev/null +++ b/print/templates/reports/incoterms-authorization/locale/fr.yml @@ -0,0 +1,38 @@ +reportName: autorizacion-incoterms +description: '{socialName} une société dûment constituée à responsabilité limitée +et enregistrée en vertu du droit des sociétés de {country} et représentée aux présentes par +___________________. {socialName}, ayant son siège social {address}, +CIF {fiscalID}. Ci-après dénommé {name}.' +issued: 'A {0}, le {1} {2} {3}' +client: 'Client {0}' +declaration: '{socialName} déclare par la présente que:' +declarations: + - "Tous les achats réalisés par {socialName} avec {companyName} +sont livrés, Ex Works (Incoterms), sur l'entrepôt de {companyName} situé à {companyCity}." + - "{socialName} reconnaît qu'il est important pou {companyName} d'avoir +la preuve de la livraison intracommunautaire des biens à {destinationCountry} afin de pouvoir facturer à 0% de TVA." + - 'Par conséquent, en signant cet accord, {socialName} déclare que tous les biens achetés à {companyName} seront livrés à {destinationCountry}.' + - 'En outre, {socialName} doit, à la première demande de {companyName}, +fournir la preuve que tous les biens achetés à {companyName} ont été livrés à {destinationCountry}.' + - 'En plus de ce qui précède, {companyName} fournira à {socialName} +un résumé mensuel comprenant toutes les factures (et les livraisons correspondantes). +{socialName} signera et retournera le résumé mensuel à {companyName}, +dans les 5 jours suivant la réception du résumé.' +signer: + representative: Représentant + representativeRole: Position du représentant + signed: Date de la signature +manager: Gérente +months: + - 'Janvier' + - 'Fevrier' + - 'Mars' + - 'Avril' + - 'Mai' + - 'Juin' + - 'Juillet' + - 'Août' + - 'Septembre' + - 'Octobre' + - 'Novembre' + - 'Decembre' \ No newline at end of file diff --git a/print/templates/reports/incoterms-authorization/locale/pt.yml b/print/templates/reports/incoterms-authorization/locale/pt.yml new file mode 100644 index 000000000..2d33e6a1a --- /dev/null +++ b/print/templates/reports/incoterms-authorization/locale/pt.yml @@ -0,0 +1,42 @@ +reportName: autorizacion-incoterms +description: '{socialName} uma sociedade devidamente constituída com responsabilidade limitada e registada +conforme ao direito de sociedades da {country} e aqui representada por +___________________. {socialName}, com domicílio em {address}, +CIF {fiscalID}. Em adiante denominada {name}.' +issued: 'Em {0}, em {1} de {2} de {3}' +client: 'Cliente {0}' +declaration: '{socialName} declara através da presente que:' +declarations: + - 'Todas as compras realizadas por {socialName} a {companyName} se entregam, + Ex Works (Incoterms), no armazém da {companyName} situado em +{companyCity}.' + - '{socialName} reconhece ser importante para {companyName} + ter o comprovante da entrega intracomunitária da mercadoria a {destinationCountry} + para poder faturar com 0% de IVA.' + - 'Portanto, ao assinar este acordo, {socialName} declara que todos os bens + que se comprem na {companyName} serão entregues na {destinationCountry}.' + - 'Além disto, {socialName} deverá, na primeira solicitude da {companyName}, + proporcionar uma prova de que todos os produtos comprados na {companyName} + foram entregues na {destinationCountry}.' + - 'Além do anterio, {companyName} proporcionará a {socialName} +um resumo mensal onde se incluem todas as faturas (e as entregas correspondentes). +{socialName} assinará e devolverá o resumo mensal à {companyName}, +dentro dos 5 dias posteriores à receção do resumo.' +signer: + representative: Representante + representativeRole: Cargo de representante + signed: Data da assinatura +manager: Gerente +months: + - 'Janeiro' + - 'Fevereiro' + - 'Marchar' + - 'abril' + - 'Poderia' + - 'Junho' + - 'Julho' + - 'Agosto' + - 'Setembro' + - 'Outubro' + - 'Novembro' + - 'Dezembro' \ No newline at end of file diff --git a/print/templates/reports/cmr-authorization/sql/client.sql b/print/templates/reports/incoterms-authorization/sql/client.sql similarity index 100% rename from print/templates/reports/cmr-authorization/sql/client.sql rename to print/templates/reports/incoterms-authorization/sql/client.sql diff --git a/print/templates/reports/incoterms-authorization/sql/company.sql b/print/templates/reports/incoterms-authorization/sql/company.sql new file mode 100644 index 000000000..39c3290d1 --- /dev/null +++ b/print/templates/reports/incoterms-authorization/sql/company.sql @@ -0,0 +1,8 @@ +SELECT + s.name, + s.city, + cl.name AS manager +FROM company c + JOIN supplier s ON s.id = c.id + JOIN client cl ON cl.id = c.workerManagerFk +WHERE c.id = ? \ No newline at end of file diff --git a/print/templates/reports/invoice-incoterms/assets/css/import.js b/print/templates/reports/invoice-incoterms/assets/css/import.js index fd8796c2b..37a98dfdd 100644 --- a/print/templates/reports/invoice-incoterms/assets/css/import.js +++ b/print/templates/reports/invoice-incoterms/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/invoice-incoterms/invoice-incoterms.html b/print/templates/reports/invoice-incoterms/invoice-incoterms.html index f30667042..1915828ba 100644 --- a/print/templates/reports/invoice-incoterms/invoice-incoterms.html +++ b/print/templates/reports/invoice-incoterms/invoice-incoterms.html @@ -1,123 +1,94 @@ - - - - - - - - - -
- - - - -
-
-
-
-
-

{{$t('title')}}

- - - - - - - - - - - - - - - -
{{$t('clientId')}}{{client.id}}
{{$t('invoice')}}{{invoice.ref}}
{{$t('date')}}{{invoice.issued | date('%d-%m-%Y')}}
-
-
-
-
-
{{$t('invoiceData')}}
-
-

{{client.socialName}}

-
- {{client.postalAddress}} -
-
- {{client.postcodeCity}} -
-
- {{$t('fiscalId')}}: {{client.fi}} -
-
-
-
-
- -
-
{{$t('incotermsTitle')}}
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- {{$t('incoterms')}} - {{incoterms.incotermsFk}} - {{incoterms.incotermsName}}
- {{$t('productDescription')}} - {{incoterms.intrastat}}
{{$t('expeditionDescription')}}
{{$t('packageNumber')}}{{incoterms.packages}}
{{$t('packageGrossWeight')}}{{incoterms.weight}} KG
{{$t('packageCubing')}}{{incoterms.volume}} m3
- -

-

- {{$t('customsInfo')}} - {{incoterms.customsAgentName}} -
-
- ( - {{incoterms.customsAgentNif}} - {{incoterms.customsAgentStreet}} - - ☎ {{incoterms.customsAgentPhone}} - - - ✉ {{incoterms.customsAgentEmail}} - - ) -
-

-

- {{$t('productDisclaimer')}} -

-
-
-
+ + +
+
+
+
+
+

{{$t('title')}}

+ + + + + + + + + + + + + + + +
{{$t('clientId')}}{{client.id}}
{{$t('invoice')}}{{invoice.ref}}
{{$t('date')}}{{formatDate(invoice.issued, '%d-%m-%Y')}}
+
+
+
+
+
{{$t('invoiceData')}}
+
+

{{client.socialName}}

+
{{client.postalAddress}}
+
{{client.postcodeCity}}
+
{{$t('fiscalId')}}: {{client.fi}}
-
- - \ No newline at end of file + + + + +
+
{{$t('incotermsTitle')}}
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('incoterms')}}{{incoterms.incotermsFk}} - {{incoterms.incotermsName}}
{{$t('productDescription')}}{{incoterms.intrastat}}
{{$t('expeditionDescription')}}
{{$t('packageNumber')}}{{incoterms.packages}}
{{$t('packageGrossWeight')}}{{incoterms.weight}} KG
{{$t('packageCubing')}}{{incoterms.volume}} m3
+ +
+ {{$t('customsInfo')}} + {{incoterms.customsAgentName}} +
+
+ ( + {{incoterms.customsAgentNif}} + {{incoterms.customsAgentStreet}} + ☎ {{incoterms.customsAgentPhone}} + ✉ {{incoterms.customsAgentEmail}} + ) +
+

+ {{$t('productDisclaimer')}} +

+
+
+ + + + diff --git a/print/templates/reports/invoice-incoterms/invoice-incoterms.js b/print/templates/reports/invoice-incoterms/invoice-incoterms.js index 99e23e15f..fcaffe5de 100755 --- a/print/templates/reports/invoice-incoterms/invoice-incoterms.js +++ b/print/templates/reports/invoice-incoterms/invoice-incoterms.js @@ -1,39 +1,19 @@ -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); +const vnReport = require('../../../core/mixins/vn-report.js'); module.exports = { name: 'invoice-incoterms', + mixins: [vnReport], async serverPrefetch() { - this.invoice = await this.fetchInvoice(this.invoiceId); - this.client = await this.fetchClient(this.invoiceId); - this.incoterms = await this.fetchIncoterms(this.invoiceId); - - if (!this.invoice) - throw new Error('Something went wrong'); - }, - computed: { - - }, - methods: { - fetchInvoice(invoiceId) { - return this.findOneFromDef('invoice', [invoiceId]); - }, - fetchClient(invoiceId) { - return this.findOneFromDef('client', [invoiceId]); - }, - fetchIncoterms(invoiceId) { - return this.findOneFromDef('incoterms', [invoiceId, invoiceId, invoiceId]); - } - }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() + this.invoice = await this.findOneFromDef('invoice', [this.reference]); + this.checkMainEntity(this.invoice); + this.client = await this.findOneFromDef('client', [this.reference]); + this.incoterms = await this.findOneFromDef('incoterms', [this.reference, this.reference, this.reference]); }, props: { - invoiceId: { - type: [Number, String], - required: true + reference: { + type: Number, + required: true, + description: 'The invoice ref' } } }; diff --git a/print/templates/reports/invoice-incoterms/sql/client.sql b/print/templates/reports/invoice-incoterms/sql/client.sql index dd6035222..3e66c15c9 100644 --- a/print/templates/reports/invoice-incoterms/sql/client.sql +++ b/print/templates/reports/invoice-incoterms/sql/client.sql @@ -9,4 +9,5 @@ FROM vn.invoiceOut io JOIN vn.country cty ON cty.id = c.countryFk LEFT JOIN vn.invoiceOutSerial ios ON ios.code = io.serial AND ios.taxAreaFk = 'CEE' -WHERE io.id = ? \ No newline at end of file + LEFT JOIN ticket t ON t.refFk = io.ref +WHERE t.refFk = ? \ No newline at end of file diff --git a/print/templates/reports/invoice-incoterms/sql/incoterms.sql b/print/templates/reports/invoice-incoterms/sql/incoterms.sql index 5d894a4b2..6bb895129 100644 --- a/print/templates/reports/invoice-incoterms/sql/incoterms.sql +++ b/print/templates/reports/invoice-incoterms/sql/incoterms.sql @@ -51,7 +51,7 @@ SELECT io.issued, FROM vn.invoiceOut io JOIN vn.ticket t ON t.refFk = io.ref JOIN vn.saleVolume sv ON sv.ticketFk = t.id - WHERE io.id = ? + WHERE t.refFk = ? ) sub2 ON TRUE JOIN vn.itemTaxCountry itc ON itc.countryFk = su.countryFk AND itc.itemFk = s.itemFk JOIN vn.taxClass tc ON tc.id = itc.taxClassFk @@ -66,6 +66,7 @@ SELECT io.issued, JOIN vn.sale s ON t.id = s.ticketFk JOIN vn.item i ON i.id = s.itemFk JOIN vn.intrastat ir ON ir.id = i.intrastatFk - WHERE io.id = ? + WHERE t.refFk = ? )sub3 ON TRUE - WHERE io.id = ? + WHERE t.refFk = ? + diff --git a/print/templates/reports/invoice-incoterms/sql/invoice.sql b/print/templates/reports/invoice-incoterms/sql/invoice.sql index b9a929183..571ea2af3 100644 --- a/print/templates/reports/invoice-incoterms/sql/invoice.sql +++ b/print/templates/reports/invoice-incoterms/sql/invoice.sql @@ -14,4 +14,5 @@ FROM invoiceOut io JOIN company cny ON cny.id = io.companyFk JOIN supplierAccount sa ON sa.id = cny.supplierAccountFk LEFT JOIN invoiceOutSerial ios ON ios.code = io.serial -WHERE io.id = ? \ No newline at end of file + LEFT JOIN ticket t ON t.refFk = io.ref +WHERE t.refFk = ? \ No newline at end of file diff --git a/print/templates/reports/invoice/assets/css/import.js b/print/templates/reports/invoice/assets/css/import.js index fd8796c2b..37a98dfdd 100644 --- a/print/templates/reports/invoice/assets/css/import.js +++ b/print/templates/reports/invoice/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/invoice/invoice.html b/print/templates/reports/invoice/invoice.html index 1d646a0db..7a1ed3319 100644 --- a/print/templates/reports/invoice/invoice.html +++ b/print/templates/reports/invoice/invoice.html @@ -1,319 +1,271 @@ - - - - - - - - - -
+ + + +
+
+
+
+
+

{{$t('title')}}

+ + + + + + + + + + + + + + + +
{{$t('clientId')}}{{client.id}}
{{$t('invoice')}}{{invoice.ref}}
{{$t('date')}}{{formatDate(invoice.issued, '%d-%m-%Y')}}
+
+
+
+
+
{{$t('invoiceData')}}
+
+

{{client.socialName}}

+
{{client.postalAddress}}
+
{{client.postcodeCity}}
+
{{$t('fiscalId')}}: {{client.fi}}
+
+
+
+
+
+

{{$t('rectifiedInvoices')}}

+ + + + + + + + + + + + + + + + + +
{{$t('invoice')}}{{$t('issued')}}{{$t('amount')}}{{$t('description')}}
{{row.ref}}{{formatDate(row.issued, '%d-%m-%Y')}}{{row.amount | currency('EUR', $i18n.locale)}}{{row.description}}
+
+
+
+
+

{{$t('deliveryNote')}}

+
+
+
+ {{ticket.id}} +
+
+
+

{{$t('shipped')}}

+
+
+
+ {{formatDate(ticket.shipped, '%d-%m-%Y')}} +
+
+ +

{{ticket.nickname}}

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('reference')}}{{$t('quantity')}}{{$t('concept')}}{{$t('price')}}{{$t('discount')}}{{$t('vat')}}{{$t('amount')}}
{{sale.itemFk}}{{sale.quantity}}{{sale.concept}}{{sale.price | currency('EUR', $i18n.locale)}}{{(sale.discount / 100) | percentage}}{{sale.vatType}}{{saleImport(sale) | currency('EUR', $i18n.locale)}}
+ {{sale.tag5}} {{sale.value5}} + {{sale.tag6}} {{sale.value6}} + {{sale.tag7}} {{sale.value7}} +
+ {{$t('subtotal')}} + {{ticketSubtotal(ticket) | currency('EUR', $i18n.locale)}}
+
- - - +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('taxBreakdown')}}
{{$t('type')}}{{$t('taxBase')}}{{$t('tax')}}{{$t('fee')}}
{{tax.name}}{{tax.base | currency('EUR', $i18n.locale)}}{{tax.vatPercent | percentage}}{{tax.vat | currency('EUR', $i18n.locale)}}
{{$t('subtotal')}} + {{sumTotal(taxes, 'base') | currency('EUR', $i18n.locale)}} + {{sumTotal(taxes, 'vat') | currency('EUR', $i18n.locale)}}
{{$t('total')}}{{taxTotal | currency('EUR', $i18n.locale)}}
- - - - -
-
-
-
-
-

{{$t('title')}}

- - - - - - - - - - - - - - - -
{{$t('clientId')}}{{client.id}}
{{$t('invoice')}}{{invoice.ref}}
{{$t('date')}}{{invoice.issued | date('%d-%m-%Y')}}
-
-
-
-
-
{{$t('invoiceData')}}
-
-

{{client.socialName}}

-
- {{client.postalAddress}} -
-
- {{client.postcodeCity}} -
-
- {{$t('fiscalId')}}: {{client.fi}} -
-
-
+
+
{{$t('notes')}}
+
+ {{invoice.footNotes}} +
+
+
+
+
+
+
+
+
+
+
{{$t('plantPassport')}}
- - -
-

{{$t('rectifiedInvoices')}}

- - - - - - - - - - - - - - - - - -
{{$t('invoice')}}{{$t('issued')}}{{$t('amount')}}{{$t('description')}}
{{row.ref}}{{row.issued | date}}{{row.amount | currency('EUR', $i18n.locale)}}{{row.description}}
+
+
+
+ A + {{botanical}}
- - - -
-
-
-

{{$t('deliveryNote')}} -

-
-
- {{ticket.id}} -
-
-
-

{{$t('shipped')}}

-
-
-
- {{ticket.shipped | date}} -
-
- -

{{ticket.nickname}}

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('reference')}}{{$t('quantity')}}{{$t('concept')}}{{$t('price')}}{{$t('discount')}}{{$t('vat')}}{{$t('amount')}}
{{sale.itemFk | zerofill('000000')}}{{sale.quantity}}{{sale.concept}}{{sale.price | currency('EUR', $i18n.locale)}}{{(sale.discount / 100) | percentage}}{{sale.vatType}}{{saleImport(sale) | currency('EUR', $i18n.locale)}}
- - {{sale.tag5}} {{sale.value5}} - - - {{sale.tag6}} {{sale.value6}} - - - {{sale.tag7}} {{sale.value7}} - -
- {{$t('subtotal')}} - {{ticketSubtotal(ticket) | currency('EUR', $i18n.locale)}}
+
+ B + ES17462130
- - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('taxBreakdown')}}
{{$t('type')}} - {{$t('taxBase')}} - {{$t('tax')}}{{$t('fee')}}
{{tax.name}} - {{tax.base | currency('EUR', $i18n.locale)}} - {{tax.vatPercent | percentage}}{{tax.vat | currency('EUR', $i18n.locale)}}
{{$t('subtotal')}} - {{sumTotal(taxes, 'base') | currency('EUR', $i18n.locale)}} - {{sumTotal(taxes, 'vat') | currency('EUR', $i18n.locale)}}
{{$t('total')}}{{taxTotal | currency('EUR', $i18n.locale)}}
- -
-
{{$t('notes')}}
-
- {{invoice.footNotes}} -
-
-
- - - -
-
-
-
-
-
- -
-
- {{$t('plantPassport')}}
-
-
-
-
-
- A - {{botanical}} -
-
- B - ES17462130 -
-
- C - {{ticketsId}} -
-
- D - ES -
-
-
-
-
- +
+ C + {{ticketsId}}
- - - -
-

{{$t('intrastat')}}

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('code')}}{{$t('description')}}{{$t('stems')}}{{$t('netKg')}}{{$t('amount')}}
{{row.code}}{{row.description}}{{row.stems | number($i18n.locale)}}{{row.netKg | number($i18n.locale)}}{{row.subtotal | currency('EUR', $i18n.locale)}}
- {{sumTotal(intrastat, 'stems') | number($i18n.locale)}} - - {{sumTotal(intrastat, 'netKg') | number($i18n.locale)}} - - {{sumTotal(intrastat, 'subtotal') | currency('EUR', $i18n.locale)}} -
+
+ D + ES
- - - -
-
-
-
{{$t('observations')}}
-
-
{{$t('wireTransfer')}}
-
{{$t('accountNumber', [invoice.iban])}}
-
-
-
-
- -
- - - -
- - \ No newline at end of file + + + +
+

{{$t('intrastat')}}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('code')}}{{$t('description')}}{{$t('stems')}}{{$t('netKg')}}{{$t('amount')}}
{{row.code}}{{row.description || $t('services') }}{{row.stems | number($i18n.locale)}}{{row.netKg | number($i18n.locale)}}{{row.subtotal | currency('EUR', $i18n.locale)}}
+ {{sumTotal(intrastat, 'stems') | number($i18n.locale)}} + + {{sumTotal(intrastat, 'netKg') | number($i18n.locale)}} + + {{sumTotal(intrastat, 'subtotal') | currency('EUR', $i18n.locale)}} +
+
+
+
+
+
{{$t('observations')}}
+
+
+
{{$t('wireTransfer')}}
+
{{$t('accountNumber', [invoice.iban])}}
+
+
+ {{ticketObservations}} +
+
+
+
+
+ + + + diff --git a/print/templates/reports/invoice/invoice.js b/print/templates/reports/invoice/invoice.js index c5abfad7e..42988113f 100755 --- a/print/templates/reports/invoice/invoice.js +++ b/print/templates/reports/invoice/invoice.js @@ -1,29 +1,35 @@ -const Component = require(`${appPath}/core/component`); -const Report = require(`${appPath}/core/report`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); +const Report = require(`vn-print/core/report`); +const vnReport = require('../../../core/mixins/vn-report.js'); const invoiceIncoterms = new Report('invoice-incoterms'); module.exports = { name: 'invoice', + mixins: [vnReport], async serverPrefetch() { - this.invoice = await this.fetchInvoice(this.invoiceId); - this.client = await this.fetchClient(this.invoiceId); - this.taxes = await this.fetchTaxes(this.invoiceId); - this.intrastat = await this.fetchIntrastat(this.invoiceId); - this.rectified = await this.fetchRectified(this.invoiceId); - this.hasIncoterms = await this.fetchHasIncoterms(this.invoiceId); + this.invoice = await this.findOneFromDef('invoice', [this.reference]); + this.checkMainEntity(this.invoice); + this.client = await this.findOneFromDef('client', [this.reference]); + this.taxes = await this.rawSqlFromDef(`taxes`, [this.reference]); + this.hasIntrastat = await this.findValueFromDef(`hasIntrastat`, [this.reference]); + this.intrastat = await this.rawSqlFromDef(`intrastat`, + [this.reference, this.reference, this.reference, this.reference]); + this.rectified = await this.rawSqlFromDef(`rectified`, [this.reference]); + this.hasIncoterms = await this.findValueFromDef(`hasIncoterms`, [this.reference]); - const tickets = await this.fetchTickets(this.invoiceId); - const sales = await this.fetchSales(this.invoiceId); + const tickets = await this.rawSqlFromDef('tickets', [this.reference]); + const sales = await this.rawSqlFromDef('sales', [this.reference, this.reference]); const map = new Map(); + this.ticketObservations = ''; for (let ticket of tickets) { ticket.sales = []; map.set(ticket.id, ticket); + + if (ticket.description) this.ticketObservations += ticket.description + ' '; } + this.ticketObservations = this.ticketObservations.trim(); for (let sale of sales) { const ticket = map.get(sale.ticketFk); @@ -32,9 +38,6 @@ module.exports = { } this.tickets = tickets; - - if (!this.invoice) - throw new Error('Something went wrong'); }, data() { return {totalBalance: 0.00}; @@ -65,30 +68,6 @@ module.exports = { } }, methods: { - fetchInvoice(invoiceId) { - return this.findOneFromDef('invoice', [invoiceId]); - }, - fetchClient(invoiceId) { - return this.findOneFromDef('client', [invoiceId]); - }, - fetchTickets(invoiceId) { - return this.rawSqlFromDef('tickets', [invoiceId]); - }, - fetchSales(invoiceId) { - return this.rawSqlFromDef('sales', [invoiceId, invoiceId]); - }, - fetchTaxes(invoiceId) { - return this.rawSqlFromDef(`taxes`, [invoiceId]); - }, - fetchIntrastat(invoiceId) { - return this.rawSqlFromDef(`intrastat`, [invoiceId]); - }, - fetchRectified(invoiceId) { - return this.rawSqlFromDef(`rectified`, [invoiceId]); - }, - fetchHasIncoterms(invoiceId) { - return this.findValueFromDef(`hasIncoterms`, [invoiceId]); - }, saleImport(sale) { const price = sale.quantity * sale.price; @@ -110,14 +89,12 @@ module.exports = { } }, components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build(), 'invoice-incoterms': invoiceIncoterms.build() }, props: { - invoiceId: { - type: [Number, String], - required: true + reference: { + type: String, + description: 'The invoice ref' } } }; diff --git a/print/templates/reports/invoice/locale/en.yml b/print/templates/reports/invoice/locale/en.yml index 4e4688b55..336592f0c 100644 --- a/print/templates/reports/invoice/locale/en.yml +++ b/print/templates/reports/invoice/locale/en.yml @@ -33,4 +33,5 @@ issued: Issued plantPassport: Plant passport observations: Observations wireTransfer: "Pay method: Transferencia" -accountNumber: "Account number: {0}" \ No newline at end of file +accountNumber: "Account number: {0}" +services: Services \ No newline at end of file diff --git a/print/templates/reports/invoice/locale/es.yml b/print/templates/reports/invoice/locale/es.yml index d37e77943..32f6fc708 100644 --- a/print/templates/reports/invoice/locale/es.yml +++ b/print/templates/reports/invoice/locale/es.yml @@ -33,4 +33,5 @@ issued: F. emisión plantPassport: Pasaporte fitosanitario observations: Observaciones wireTransfer: "Forma de pago: Transferencia" -accountNumber: "Número de cuenta: {0}" \ No newline at end of file +accountNumber: "Número de cuenta: {0}" +services: Servicios \ No newline at end of file diff --git a/print/templates/reports/invoice/sql/client.sql b/print/templates/reports/invoice/sql/client.sql index dd6035222..4c35838f2 100644 --- a/print/templates/reports/invoice/sql/client.sql +++ b/print/templates/reports/invoice/sql/client.sql @@ -9,4 +9,5 @@ FROM vn.invoiceOut io JOIN vn.country cty ON cty.id = c.countryFk LEFT JOIN vn.invoiceOutSerial ios ON ios.code = io.serial AND ios.taxAreaFk = 'CEE' -WHERE io.id = ? \ No newline at end of file + LEFT JOIN vn.ticket t ON t.refFk = io.ref +WHERE t.refFk = ? \ No newline at end of file diff --git a/print/templates/reports/invoice/sql/hasIncoterms.sql b/print/templates/reports/invoice/sql/hasIncoterms.sql index 27f61f57c..40a6db384 100644 --- a/print/templates/reports/invoice/sql/hasIncoterms.sql +++ b/print/templates/reports/invoice/sql/hasIncoterms.sql @@ -3,6 +3,6 @@ SELECT IF(incotermsFk IS NULL, FALSE, TRUE) AS hasIncoterms JOIN invoiceOut io ON io.ref = t.refFk JOIN client c ON c.id = t.clientFk JOIN address a ON a.id = t.addressFk - WHERE io.id = ? + WHERE t.refFk = ? AND IF(c.hasToinvoiceByAddress = FALSE, c.defaultAddressFk, TRUE) LIMIT 1 \ No newline at end of file diff --git a/print/templates/reports/invoice/sql/hasIntrastat.sql b/print/templates/reports/invoice/sql/hasIntrastat.sql new file mode 100644 index 000000000..09eda94c2 --- /dev/null +++ b/print/templates/reports/invoice/sql/hasIntrastat.sql @@ -0,0 +1,4 @@ +SELECT taxAreaFk != 'NATIONAL' + FROM vn.invoiceOutSerial ios + JOIN vn.invoiceOut io ON io.serial = ios.code + WHERE io.ref = ?; diff --git a/print/templates/reports/invoice/sql/intrastat.sql b/print/templates/reports/invoice/sql/intrastat.sql index 6bf72c158..211ebfe71 100644 --- a/print/templates/reports/invoice/sql/intrastat.sql +++ b/print/templates/reports/invoice/sql/intrastat.sql @@ -1,18 +1,36 @@ -SELECT - ir.id AS code, - ir.description AS description, - CAST(SUM(IFNULL(i.stems,1) * s.quantity) AS DECIMAL(10,2)) as stems, - CAST(SUM(IF(sv.physicalWeight, sv.physicalWeight, i.density * sub.cm3delivery/1000000)) AS DECIMAL(10,2)) netKg, - CAST(SUM((s.quantity * s.price * (100 - s.discount) / 100 )) AS DECIMAL(10,2)) AS subtotal - FROM vn.sale s - LEFT JOIN (SELECT ic.itemFk, ic.cm3, 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 t.id = s.ticketFk - LEFT JOIN vn.invoiceOut io ON io.ref = t.refFk - LEFT JOIN vn.item i ON i.id = s.itemFk - JOIN vn.intrastat ir ON ir.id = i.intrastatFk - WHERE io.id = ? - GROUP BY i.intrastatFk; \ No newline at end of file +SELECT * + FROM ( + SELECT i.intrastatFk code, + it.description, + CAST(SUM(ROUND((s.quantity * s.price * (100 - s.discount) / 100 ) , 2))AS DECIMAL(10, 2)) subtotal, + SUM(IFNULL(i.stems, 1) * s.quantity) stems, + CAST(SUM(IFNULL(i.stems, 1) + * s.quantity + * IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000) + * IF(sub.totalWeight, sub.totalWeight / vn.invoiceOut_getWeight(?), 1) + AS DECIMAL(10,2)) netKg + FROM sale s + JOIN ticket t ON s.ticketFk = t.id + JOIN supplier su ON su.id = t.companyFk + JOIN item i ON i.id = s.itemFk + JOIN intrastat it ON it.id = i.intrastatFk + LEFT JOIN itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk + LEFT JOIN ( + SELECT SUM(weight)totalWeight + FROM vn.ticket + WHERE refFk = ? + AND weight + ) sub ON TRUE + WHERE t.refFk =? + GROUP BY i.intrastatFk + UNION ALL + SELECT NULL , + IF((SUM((ts.quantity * ts.price))), 'Servicios', NULL), + IFNULL(CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), 0), + 0 , + 0 + FROM vn.ticketService ts + JOIN vn.ticket t ON ts.ticketFk = t.id + WHERE t.refFk = ? + ) sub2 + WHERE `description` IS NOT NULL; diff --git a/print/templates/reports/invoice/sql/invoice.sql b/print/templates/reports/invoice/sql/invoice.sql index aacbb0016..0f12e4f53 100644 --- a/print/templates/reports/invoice/sql/invoice.sql +++ b/print/templates/reports/invoice/sql/invoice.sql @@ -13,4 +13,5 @@ FROM invoiceOut io JOIN company cny ON cny.id = io.companyFk JOIN supplierAccount sa ON sa.id = cny.supplierAccountFk LEFT JOIN invoiceOutSerial ios ON ios.code = io.serial -WHERE io.id = ? \ No newline at end of file + LEFT JOIN ticket t ON t.refFk = io.ref +WHERE t.refFk = ? \ No newline at end of file diff --git a/print/templates/reports/invoice/sql/rectified.sql b/print/templates/reports/invoice/sql/rectified.sql index 1255b973c..79ce733e3 100644 --- a/print/templates/reports/invoice/sql/rectified.sql +++ b/print/templates/reports/invoice/sql/rectified.sql @@ -1,9 +1,11 @@ -SELECT - io.amount, - io.ref, - io.issued, +SELECT + io2.amount, + io2.ref, + io2.issued, ict.description -FROM vn.invoiceCorrection ic - JOIN vn.invoiceOut io ON io.id = ic.correctedFk - JOIN vn.invoiceCorrectionType ict ON ict.id = ic.invoiceCorrectionTypeFk -where ic.correctingFk = ? \ No newline at end of file +FROM invoiceOut io + JOIN invoiceCorrection ic ON ic.correctingFk = io.id + JOIN invoiceOut io2 ON io2.id = ic.correctedFk + LEFT JOIN ticket t ON t.refFk = io.ref + JOIN invoiceCorrectionType ict ON ict.id = ic.invoiceCorrectionTypeFk +WHERE io.ref = ? diff --git a/print/templates/reports/invoice/sql/sales.sql b/print/templates/reports/invoice/sql/sales.sql index cff8794db..f5721a594 100644 --- a/print/templates/reports/invoice/sql/sales.sql +++ b/print/templates/reports/invoice/sql/sales.sql @@ -37,7 +37,7 @@ SELECT JOIN vn.itemTaxCountry itc ON itc.countryFk = su.countryFk AND itc.itemFk = s.itemFk JOIN vn.taxClass tc ON tc.id = itc.taxClassFk - WHERE io.id = ? + WHERE t.refFk = ? UNION ALL SELECT io.ref, @@ -69,4 +69,4 @@ SELECT JOIN vn.company co ON co.id = io.companyFk JOIN vn.supplierAccount sa ON sa.id = co.supplierAccountFk JOIN vn.taxClass tc ON tc.id = ts.taxClassFk - WHERE io.id = ? \ No newline at end of file + WHERE t.refFk = ? \ No newline at end of file diff --git a/print/templates/reports/invoice/sql/taxes.sql b/print/templates/reports/invoice/sql/taxes.sql index 19b1cc00e..5c04d2c74 100644 --- a/print/templates/reports/invoice/sql/taxes.sql +++ b/print/templates/reports/invoice/sql/taxes.sql @@ -6,6 +6,6 @@ SELECT FROM invoiceOutTax iot JOIN pgc ON pgc.code = iot.pgcFk LEFT JOIN pgcEqu pe ON pe.equFk = pgc.code - JOIN invoiceOut io ON io.id = iot.invoiceOutFk - WHERE invoiceOutFk = ? + JOIN invoiceOut io ON io.id = iot.invoiceOutFk + WHERE io.ref = ? ORDER BY iot.id \ No newline at end of file diff --git a/print/templates/reports/invoice/sql/tickets.sql b/print/templates/reports/invoice/sql/tickets.sql index 7d135bd03..a8385599c 100644 --- a/print/templates/reports/invoice/sql/tickets.sql +++ b/print/templates/reports/invoice/sql/tickets.sql @@ -1,8 +1,12 @@ SELECT t.id, t.shipped, - t.nickname -FROM invoiceOut io - JOIN ticket t ON t.refFk = io.ref -WHERE io.id = ? -ORDER BY t.shipped \ No newline at end of file + t.nickname, + tto.description +FROM invoiceOut io + JOIN ticket t ON t.refFk = io.REF + LEFT JOIN observationType ot ON ot.code = 'invoiceOut' + LEFT JOIN ticketObservation tto ON tto.ticketFk = t.id + AND tto.observationTypeFk = ot.id +WHERE t.refFk = ? +ORDER BY t.shipped diff --git a/print/templates/reports/invoiceIn/assets/css/import.js b/print/templates/reports/invoiceIn/assets/css/import.js new file mode 100644 index 000000000..37a98dfdd --- /dev/null +++ b/print/templates/reports/invoiceIn/assets/css/import.js @@ -0,0 +1,12 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, + `${__dirname}/style.css`]) + .mergeStyles(); diff --git a/print/templates/reports/invoiceIn/assets/css/style.css b/print/templates/reports/invoiceIn/assets/css/style.css new file mode 100644 index 000000000..9fda2a613 --- /dev/null +++ b/print/templates/reports/invoiceIn/assets/css/style.css @@ -0,0 +1,42 @@ +h2 { + font-weight: 100; + color: #555 +} + +.table-title { + margin-bottom: 15px; + font-size: .8rem +} + +.table-title h2 { + margin: 0 15px 0 0 +} + +.ticket-info { + font-size: 22px +} + + +#nickname h2 { + max-width: 400px; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +#phytosanitary { + padding-right: 10px +} + +#phytosanitary .flag img { + width: 100% +} + +#phytosanitary .flag .flag-text { + padding-left: 10px; + box-sizing: border-box; +} + +.phytosanitary-info { + margin-top: 10px +} \ No newline at end of file diff --git a/print/templates/reports/invoiceIn/assets/images/europe.png b/print/templates/reports/invoiceIn/assets/images/europe.png new file mode 100644 index 000000000..673be92ae Binary files /dev/null and b/print/templates/reports/invoiceIn/assets/images/europe.png differ diff --git a/print/templates/reports/invoiceIn/invoiceIn.html b/print/templates/reports/invoiceIn/invoiceIn.html new file mode 100644 index 000000000..22988b654 --- /dev/null +++ b/print/templates/reports/invoiceIn/invoiceIn.html @@ -0,0 +1,168 @@ + + +
+
+
+
+
+ + + + + + + + + + + + + + + +
{{$t('supplierId')}}{{invoice.supplierId}}
{{$t('invoiceId')}}{{invoice.supplierRef}}
{{$t('date')}}{{formatDate(invoice.created, '%d-%m-%Y')}}
+
+
+
+
+
{{$t('invoiceData')}}
+
+

{{invoice.name}}

+
{{invoice.postalAddress}}
+
{{invoice.postcodeCity}}
+
{{$t('fiscalId')}}: {{invoice.nif}}
+
{{$t('phone')}}: {{invoice.phone}}
+
+
+
+
+ +
+
+
+

{{$t('entry')}}

+
+
+
+ {{entry.id}} +
+
+
+

{{$t('date')}}

+
+
+
+ {{formatDate(entry.landed, '%d-%m-%Y')}} +
+
+ +
+

{{$t('reference')}}

+
+
+
+ {{entry.reference}} +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('item')}}{{$t('quantity')}}{{$t('buyingValue')}}{{$t('amount')}}
{{buy.name}}{{buy.quantity}}{{buy.buyingValue | currency('EUR', $i18n.locale)}}{{buyImport(buy) | currency('EUR', $i18n.locale)}}
+ {{buy.tag5}} {{buy.value5}} + {{buy.tag6}} {{buy.value6}} + {{buy.tag7}} {{buy.value7}} +
+ {{$t('subtotal')}} + {{entrySubtotal(entry) | currency('EUR', $i18n.locale)}}
+
+ +
+
+
+
{{$t('payMethod')}}: {{invoice.payMethod}}
+
+
{{$t('signer.received')}}:
+
{{$t('signer.signed')}}:
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('taxBreakdown')}}
{{tax.name}}{{tax.taxableBase | currency('EUR', $i18n.locale)}} + {{(tax.rate / 100) | percentage}}{{tax.vat | currency('EUR', $i18n.locale)}}
{{$t('subtotal')}} + {{sumTotal(taxes, 'taxableBase') | currency('EUR', $i18n.locale)}} + {{sumTotal(taxes, 'vat') | currency('EUR', $i18n.locale)}}
{{$t('total')}}{{taxTotal() | currency('EUR', $i18n.locale)}}
+ +
+
{{$t('notes')}}
+
+ {{invoice.footNotes}} +
+
+
+
+ + +
+
+ +
diff --git a/print/templates/reports/invoiceIn/invoiceIn.js b/print/templates/reports/invoiceIn/invoiceIn.js new file mode 100755 index 000000000..c59f4da7d --- /dev/null +++ b/print/templates/reports/invoiceIn/invoiceIn.js @@ -0,0 +1,86 @@ +const vnReport = require('../../../core/mixins/vn-report.js'); + +module.exports = { + name: 'invoiceIn', + mixins: [vnReport], + async serverPrefetch() { + this.invoice = await this.findOneFromDef('invoice', [this.id]); + this.checkMainEntity(this.invoice); + this.taxes = await this.fetchTaxes(this.id); + + let defaultTax = await this.findOneFromDef('defaultTax'); + + if (defaultTax) { + defaultTax = Object.assign(defaultTax, { + taxableBase: 0, + vat: (this.taxTotal() * defaultTax.rate / 100) + }); + this.taxes.push(defaultTax); + } + + const entries = await this.rawSqlFromDef('entry', [this.id]); + const buys = await this.rawSqlFromDef('buy', [this.id]); + + const map = new Map(); + + for (let entry of entries) { + entry.buys = []; + + map.set(entry.id, entry); + } + + for (let buy of buys) { + const entry = map.get(buy.entryFk); + + if (entry) entry.buys.push(buy); + } + + this.entries = entries; + }, + methods: { + async fetchTaxes(id) { + const taxes = await this.rawSqlFromDef(`taxes`, [id]); + return this.taxVat(taxes); + }, + buyImport(buy) { + return buy.quantity * buy.buyingValue; + }, + entrySubtotal(entry) { + let subTotal = 0.00; + for (let buy of entry.buys) + subTotal += this.buyImport(buy); + + return subTotal; + }, + sumTotal(rows, prop) { + let total = 0.00; + for (let row of rows) + total += parseFloat(row[prop]); + + return total; + }, + taxVat(taxes) { + for (tax of taxes) { + let vat = 0; + if (tax.rate && tax.taxableBase) + vat = (tax.rate / 100) * tax.taxableBase; + + tax.vat = vat; + } + + return taxes; + }, + taxTotal() { + const base = this.sumTotal(this.taxes, 'taxableBase'); + const vat = this.sumTotal(this.taxes, 'vat'); + + return base + vat; + } + }, + props: { + id: { + type: Number, + description: 'The invoice id' + } + } +}; diff --git a/print/templates/reports/invoiceIn/locale/en.yml b/print/templates/reports/invoiceIn/locale/en.yml new file mode 100644 index 000000000..5f41a9ceb --- /dev/null +++ b/print/templates/reports/invoiceIn/locale/en.yml @@ -0,0 +1,30 @@ +reportName: agricultural receip +title: Agricultural receip +invoiceId: Agricultural receip +supplierId: Proveedor +invoiceData: Invoice data +reference: Reference +fiscalId: FI / NIF +phone: Phone +date: Date +item: Item +quantity: Qty. +concept: Concept +buyingValue: PSP/u +discount: Disc. +vat: VAT +amount: Amount +type: Type +taxBase: Tax base +tax: Tax +fee: Fee +total: Total +subtotal: Subtotal +taxBreakdown: Tax breakdown +observations: Observations +payMethod: Pay method +entry: Entry +signer: + received: Received + signed: Signature +footer: Passive subject covered by the special agrarian regime. Please send this duly signed and sealed copy. Thanks. diff --git a/print/templates/reports/invoiceIn/locale/es.yml b/print/templates/reports/invoiceIn/locale/es.yml new file mode 100644 index 000000000..90f7db6bd --- /dev/null +++ b/print/templates/reports/invoiceIn/locale/es.yml @@ -0,0 +1,30 @@ +reportName: recibo agrícola +title: Recibo Agrícola +invoiceId: Recibo Agrícola +supplierId: Proveedor +invoiceData: Datos de facturación +reference: Referencia +fiscalId: CIF / NIF +phone: Tlf +date: Fecha +item: Artículo +quantity: Cant. +concept: Concepto +buyingValue: PVP/u +discount: Dto. +vat: IVA +amount: Importe +type: Tipo +taxBase: Base imp. +tax: Tasa +fee: Cuota +total: Total +subtotal: Subtotal +taxBreakdown: Desglose impositivo +observations: Observaciones +payMethod: Método de pago +entry: Entrada +signer: + received: Recibí + signed: Firma y sello +footer: Sujeto pasivo acogido al régimen especial agrario. Les rogamos remitan esta copia debidamente firmada y sellada. Gracias. diff --git a/print/templates/reports/invoiceIn/sql/buy.sql b/print/templates/reports/invoiceIn/sql/buy.sql new file mode 100644 index 000000000..28a80ff9c --- /dev/null +++ b/print/templates/reports/invoiceIn/sql/buy.sql @@ -0,0 +1,18 @@ +SELECT + b.id, + e.id entryFk, + it.name, + b.quantity, + b.buyingValue, + (b.quantity * b.buyingValue) total, + it.tag5, + it.value5, + it.tag6, + it.value6, + it.tag7, + it.value7 + FROM entry e + JOIN invoiceIn i ON i.id = e.invoiceInFk + JOIN buy b ON b.entryFk = e.id + JOIN item it ON it.id = b.itemFk + WHERE i.id = ? diff --git a/print/templates/reports/invoiceIn/sql/defaultTax.sql b/print/templates/reports/invoiceIn/sql/defaultTax.sql new file mode 100644 index 000000000..25f8a7090 --- /dev/null +++ b/print/templates/reports/invoiceIn/sql/defaultTax.sql @@ -0,0 +1,5 @@ +SELECT + id, + retentionRate rate, + retentionName name + FROM invoiceInConfig; diff --git a/print/templates/reports/invoiceIn/sql/entry.sql b/print/templates/reports/invoiceIn/sql/entry.sql new file mode 100644 index 000000000..d81a81afb --- /dev/null +++ b/print/templates/reports/invoiceIn/sql/entry.sql @@ -0,0 +1,8 @@ +SELECT + e.id, + t.landed, + e.reference + FROM entry e + JOIN invoiceIn i ON i.id = e.invoiceInFk + JOIN travel t ON t.id = e.travelFk + WHERE i.id = ? diff --git a/print/templates/reports/invoiceIn/sql/invoice.sql b/print/templates/reports/invoiceIn/sql/invoice.sql new file mode 100644 index 000000000..eea8e81a5 --- /dev/null +++ b/print/templates/reports/invoiceIn/sql/invoice.sql @@ -0,0 +1,14 @@ +SELECT + i.supplierRef, + s.id supplierId, + i.created, + s.name, + s.street AS postalAddress, + s.nif, + s.phone, + p.name payMethod + FROM invoiceIn i + JOIN supplier s ON s.id = i.supplierFk + JOIN company c ON c.id = i.companyFk + JOIN payMethod p ON p.id = s.payMethodFk + WHERE i.id = ? diff --git a/print/templates/reports/invoiceIn/sql/taxes.sql b/print/templates/reports/invoiceIn/sql/taxes.sql new file mode 100644 index 000000000..07b7be822 --- /dev/null +++ b/print/templates/reports/invoiceIn/sql/taxes.sql @@ -0,0 +1,9 @@ +SELECT + ti.iva as name, + ti.PorcentajeIva as rate, + iit.taxableBase + FROM invoiceIn ii + JOIN invoiceInTax iit ON ii.id = iit.invoiceInFk + JOIN sage.TiposIva ti ON ti.CodigoIva = iit.taxTypeSageFk + WHERE ii.id = ? + ORDER BY name DESC; diff --git a/print/templates/reports/item-label/assets/css/import.js b/print/templates/reports/item-label/assets/css/import.js index fd8796c2b..37a98dfdd 100644 --- a/print/templates/reports/item-label/assets/css/import.js +++ b/print/templates/reports/item-label/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/item-label/item-label.html b/print/templates/reports/item-label/item-label.html index 3f2d7ce69..66509ab38 100644 --- a/print/templates/reports/item-label/item-label.html +++ b/print/templates/reports/item-label/item-label.html @@ -1,35 +1,29 @@ - - - - - - - - - -
-
-
-

{{item.id}}

-
- -
-
-
-
{{item.name}}
-
{{tags.color}}
-
{{tags.producer}}
-
-
-
{{packing()}}
-
{{dated}}
-
{{labelPage}}
-
-
{{item.size}}
-
-
-
-
- - - + + +
+
+

{{item.id}}

+
+ +
+
+
+
{{item.name}}
+
{{tags.color}}
+
{{tags.producer}}
+
+
+
{{packing()}}
+
{{formatDate(new Date(), '%W/%d')}}
+
{{labelPage}}
+
+
{{item.size}}
+
+
+
+ +
diff --git a/print/templates/reports/item-label/item-label.js b/print/templates/reports/item-label/item-label.js index 730d8ad99..c5b9cdfd7 100755 --- a/print/templates/reports/item-label/item-label.js +++ b/print/templates/reports/item-label/item-label.js @@ -1,25 +1,17 @@ -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); +const vnReport = require('../../../core/mixins/vn-report.js'); const qrcode = require('qrcode'); module.exports = { name: 'item-label', + mixins: [vnReport], async serverPrefetch() { - this.item = await this.fetchItem(this.itemId, this.warehouseId); - this.tags = await this.fetchItemTags(this.itemId); - this.barcode = await this.getBarcodeBase64(this.itemId); - - if (!this.item) - throw new Error('Something went wrong'); + this.item = await this.findOneFromDef('item', [this.id, this.warehouseId]); + this.checkMainEntity(this.item); + this.tags = await this.fetchItemTags(this.id); + this.barcode = await this.getBarcodeBase64(this.id); }, computed: { - dated() { - const filters = this.$options.filters; - - return filters.date(new Date(), '%W/%d'); - }, labelPage() { const labelNumber = this.labelNumber ? this.labelNumber : 1; const totalLabels = this.totalLabels ? this.totalLabels : 1; @@ -28,41 +20,39 @@ module.exports = { } }, methods: { - fetchItem(id, warehouseId) { - return this.findOneFromDef('item', [id, warehouseId]); - }, - fetchItemTags(itemId) { - return this.rawSqlFromDef('itemTags', [itemId]).then(rows => { + fetchItemTags(id) { + return this.rawSqlFromDef('itemTags', [id]).then(rows => { const tags = {}; rows.forEach(row => tags[row.code] = row.value); return tags; }); }, - getBarcodeBase64(itemId) { - return qrcode.toDataURL(itemId, {margin: 0}); + getBarcodeBase64(id) { + const data = String(id); + + return qrcode.toDataURL(data, {margin: 0}); }, packing() { const stems = this.item.stems ? this.item.stems : 1; return `${this.item.packing}x${stems}`; } }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() - }, props: { - itemId: { - required: true + id: { + type: Number, + required: true, + description: 'The item id' }, warehouseId: { + type: Number, required: true }, labelNumber: { - type: String + type: Number }, totalLabels: { - type: String + type: Number } } }; diff --git a/print/templates/reports/item-label/locale/es.yml b/print/templates/reports/item-label/locale/es.yml new file mode 100644 index 000000000..278946f3e --- /dev/null +++ b/print/templates/reports/item-label/locale/es.yml @@ -0,0 +1 @@ +reportName: Etiqueta \ No newline at end of file diff --git a/print/templates/reports/item-label/sql/item.sql b/print/templates/reports/item-label/sql/item.sql index 4b042c320..46aacc2fa 100644 --- a/print/templates/reports/item-label/sql/item.sql +++ b/print/templates/reports/item-label/sql/item.sql @@ -3,9 +3,12 @@ SELECT i.name, i.stems, i.size, - b.packing + b.packing, + p.name as 'producer' FROM vn.item i JOIN cache.last_buy clb ON clb.item_id = i.id JOIN vn.buy b ON b.id = clb.buy_id JOIN vn.entry e ON e.id = b.entryFk + JOIN vn.producer p ON p.id = i.producerFk + WHERE i.id = ? AND clb.warehouse_id = ? \ No newline at end of file diff --git a/print/templates/reports/letter-debtor/assets/css/import.js b/print/templates/reports/letter-debtor/assets/css/import.js index fd8796c2b..37a98dfdd 100644 --- a/print/templates/reports/letter-debtor/assets/css/import.js +++ b/print/templates/reports/letter-debtor/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/letter-debtor/letter-debtor.html b/print/templates/reports/letter-debtor/letter-debtor.html index 88bf15bdb..30fbbe003 100644 --- a/print/templates/reports/letter-debtor/letter-debtor.html +++ b/print/templates/reports/letter-debtor/letter-debtor.html @@ -1,95 +1,78 @@ - - - - - - - - - -
- - - -
-
-
-
-
-

{{$t('title')}}

- - - - - - - - - - - -
{{$t('clientId')}}{{client.id}}
{{$t('date')}}{{dated}}
-
-
-
-
-
{{$t('clientData')}}
-
-

{{client.socialName}}

-
- {{client.street}} -
-
- {{client.postcode}}, {{client.city}} ({{client.province}}) -
-
- {{client.country}} -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('date')}}{{$t('concept')}}{{$t('invoiced')}}{{$t('payed')}}{{$t('balance')}}
{{sale.issued | date('%d-%m-%Y')}}{{sale.ref}}{{sale.debtOut}}{{sale.debtIn}}{{getBalance(sale)}}
- Total - {{getTotalDebtOut() | currency('EUR', $i18n.locale)}} - {{getTotalDebtIn() | currency('EUR', $i18n.locale)}}{{totalBalance | currency('EUR', $i18n.locale)}}
-
+ +
+
+
+
+
+

{{$t('title')}}

+ + + + + + + + + + + +
{{$t('clientId')}}{{client.id}}
{{$t('date')}}{{formatDate(new Date(), '%d-%m-%Y')}}
+
+
+
+
+
{{$t('clientData')}}
+
+

{{client.socialName}}

+
{{client.street}}
+
{{client.postcode}}, {{client.city}} ({{client.province}})
+
{{client.country}}
- - - -
- - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('date')}}{{$t('concept')}}{{$t('invoiced')}}{{$t('payed')}}{{$t('balance')}}
{{formatDate(sale.issued, '%d-%m-%Y')}}{{sale.ref}}{{sale.debtOut}}{{sale.debtIn}}{{getBalance(sale)}}
+ Total + {{getTotalDebtOut() | currency('EUR', $i18n.locale)}} + {{getTotalDebtIn() | currency('EUR', $i18n.locale)}}{{totalBalance | currency('EUR', $i18n.locale)}}
+ + + + diff --git a/print/templates/reports/letter-debtor/letter-debtor.js b/print/templates/reports/letter-debtor/letter-debtor.js index 354b1d8d8..4446b13ae 100755 --- a/print/templates/reports/letter-debtor/letter-debtor.js +++ b/print/templates/reports/letter-debtor/letter-debtor.js @@ -1,36 +1,17 @@ -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); +const vnReport = require('../../../core/mixins/vn-report.js'); module.exports = { name: 'letter-debtor', + mixins: [vnReport], async serverPrefetch() { - this.client = await this.fetchClient(this.recipientId); - this.sales = await this.fetchSales(this.recipientId, this.companyId); - - if (!this.client) - throw new Error('Something went wrong'); - }, - computed: { - dated: function() { - const filters = this.$options.filters; - - return filters.date(new Date(), '%d-%m-%Y'); - } + this.client = await this.findOneFromDef('client', [this.id]); + this.checkMainEntity(this.client); + this.sales = await this.findOneFromDef('sales', [this.id, this.companyId]); }, data() { return {totalBalance: 0.00}; }, methods: { - fetchClient(clientId) { - return this.findOneFromDef('client', [clientId]); - }, - fetchSales(clientId, companyId) { - return this.findOneFromDef('sales', [ - clientId, - companyId - ]); - }, getBalance(sale) { if (sale.debtOut) this.totalBalance += parseFloat(sale.debtOut); @@ -57,17 +38,14 @@ module.exports = { return debtIn.toFixed(2); }, }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() - }, props: { - recipientId: { - type: [Number, String], - required: true + id: { + type: Number, + required: true, + description: 'The client id' }, companyId: { - type: [Number, String], + type: Number, required: true } } diff --git a/print/templates/reports/previa-label/assets/css/import.js b/print/templates/reports/previa-label/assets/css/import.js new file mode 100644 index 000000000..37a98dfdd --- /dev/null +++ b/print/templates/reports/previa-label/assets/css/import.js @@ -0,0 +1,12 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, + `${__dirname}/style.css`]) + .mergeStyles(); diff --git a/print/templates/reports/previa-label/assets/css/style.css b/print/templates/reports/previa-label/assets/css/style.css new file mode 100644 index 000000000..1c9074924 --- /dev/null +++ b/print/templates/reports/previa-label/assets/css/style.css @@ -0,0 +1,85 @@ +* { + box-sizing: border-box; + padding-right: 1%; +} +.label { + font-size: 1.2em; + font-family: Arial, Helvetica, sans-serif; +} +.barcode { + float: left; + width: 40%; +} +.barcode h1 { + text-align: center; + font-size: 1.8em; + margin: 0 0 10px 0 +} +.barcode .image { + text-align: center +} +.barcode .image img { + width: 170px +} +.data { + float: left; + width: 60%; +} +.data .header { + background-color: #000; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + margin-bottom: 25px; + text-align: right; + font-size: 1.2em; + padding: 0.2em; + color: #FFF +} +.data .sector, +.data .producer { + text-transform: uppercase; + text-align: right; + font-size: 1.5em; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} +.data .sector-sm { + text-transform: uppercase; + text-align: right; + font-size: 1.2em; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} +.data .producer { + text-justify: inter-character; +} +.data .details { + border-top: 4px solid #000; + padding-top: 2px; +} +.data .details .package { + padding-right: 5px; + float: left; + width: 50%; +} +.package .packing, +.package .dated, +.package .labelNumber { + text-align: right +} +.package .packing { + font-size: 1.8em; + font-weight: 400 +} +.data .details .size { + background-color: #000; + text-align: center; + font-size: 3em; + padding: 0.2em 0; + float: left; + width: 50%; + color: #FFF +} \ No newline at end of file diff --git a/print/templates/reports/previa-label/locale/en.yml b/print/templates/reports/previa-label/locale/en.yml new file mode 100644 index 000000000..d380c702a --- /dev/null +++ b/print/templates/reports/previa-label/locale/en.yml @@ -0,0 +1,2 @@ +previous: PREVIOUS +report: Report diff --git a/print/templates/reports/previa-label/locale/es.yml b/print/templates/reports/previa-label/locale/es.yml new file mode 100644 index 000000000..26e83f02e --- /dev/null +++ b/print/templates/reports/previa-label/locale/es.yml @@ -0,0 +1,2 @@ +previous: PREVIA +report: Ticket diff --git a/print/templates/reports/previa-label/options.json b/print/templates/reports/previa-label/options.json new file mode 100644 index 000000000..98c5788b1 --- /dev/null +++ b/print/templates/reports/previa-label/options.json @@ -0,0 +1,11 @@ +{ + "width": "10.4cm", + "height": "4.8cm", + "margin": { + "top": "0cm", + "right": "0cm", + "bottom": "0cm", + "left": "0cm" + }, + "printBackground": true +} \ No newline at end of file diff --git a/print/templates/reports/previa-label/previa-label.html b/print/templates/reports/previa-label/previa-label.html new file mode 100644 index 000000000..1dc9b14d0 --- /dev/null +++ b/print/templates/reports/previa-label/previa-label.html @@ -0,0 +1,26 @@ + + +
+
+

{{previa.saleGroupFk}}

+
+ +
+
+
+
{{ $t('previous') }}
+
+ {{sector.description}} +
+
{{sector.description}}
+
{{ $t('report') }}#{{previa.ticketFk}}
+
+
+
{{previa.itemPackingTypeFk}}
+
{{previa.shippingHour}}:{{previa.shippingMinute}}
+
+
{{previa.items}}
+
+
+
+ \ No newline at end of file diff --git a/print/templates/reports/previa-label/previa-label.js b/print/templates/reports/previa-label/previa-label.js new file mode 100755 index 000000000..833a15499 --- /dev/null +++ b/print/templates/reports/previa-label/previa-label.js @@ -0,0 +1,30 @@ +const vnReport = require('../../../core/mixins/vn-report.js'); +const qrcode = require('qrcode'); + +module.exports = { + name: 'previa-label', + mixins: [vnReport], + async serverPrefetch() { + this.sector = await this.findOneFromDef('sector', [this.id]); + this.checkMainEntity(this.sector); + this.previa = await this.findOneFromDef('previa', [this.id]); + this.barcode = await this.getBarcodeBase64(this.id); + + if (this.previa) + this.previa = this.previa[0]; + }, + methods: { + getBarcodeBase64(id) { + const data = String(id); + + return qrcode.toDataURL(data, {margin: 0}); + }, + }, + props: { + id: { + type: Number, + required: true, + description: 'The saleGroupFk id' + }, + } +}; diff --git a/print/templates/reports/previa-label/sql/previa.sql b/print/templates/reports/previa-label/sql/previa.sql new file mode 100644 index 000000000..f73166f74 --- /dev/null +++ b/print/templates/reports/previa-label/sql/previa.sql @@ -0,0 +1 @@ +CALL vn.previousSticker_get(?) \ No newline at end of file diff --git a/print/templates/reports/previa-label/sql/sector.sql b/print/templates/reports/previa-label/sql/sector.sql new file mode 100644 index 000000000..77e84c033 --- /dev/null +++ b/print/templates/reports/previa-label/sql/sector.sql @@ -0,0 +1,4 @@ +SELECT s.description +FROM vn.saleGroup sg + JOIN vn.sector s ON sg.sectorFk = s.id +WHERE sg.id = ? \ No newline at end of file diff --git a/print/templates/reports/receipt/assets/css/import.js b/print/templates/reports/receipt/assets/css/import.js index a2a9334cb..37a98dfdd 100644 --- a/print/templates/reports/receipt/assets/css/import.js +++ b/print/templates/reports/receipt/assets/css/import.js @@ -1,8 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, - `${appPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/receipt/receipt.html b/print/templates/reports/receipt/receipt.html index 5dc1846f7..be0bfc375 100644 --- a/print/templates/reports/receipt/receipt.html +++ b/print/templates/reports/receipt/receipt.html @@ -1,45 +1,30 @@ - - - - - - - - - -
- - - -
-
-
-

{{$t('title')}}

-

- Recibo de {{client.socialName}}, - la cantidad de {{receipt.amountPaid}} € en concepto de 'entrega a cuenta', - quedando pendiente en la cuenta del cliente - un saldo de {{receipt.amountUnpaid}} €. -

-
- -

{{$t('payed', [ - 'Algemesí', - receipt.payed.getDate(), - $t('months')[receipt.payed.getMonth()], - receipt.payed.getFullYear()]) - }} -

-
-
-
-
- - - -
- - \ No newline at end of file + +
+
+
+

{{$t('title')}}

+

+ Recibo #{{receipt.id}} de {{client.socialName}}, + la cantidad de {{receipt.amountPaid}} € + en concepto de 'entrega a cuenta'. +

+
+ +

+ {{$t('payed', [ 'Algemesí', receipt.payed.getDate(), $t('months')[receipt.payed.getMonth()], + receipt.payed.getFullYear()]) }} +

+
+
+
+
+ +
diff --git a/print/templates/reports/receipt/receipt.js b/print/templates/reports/receipt/receipt.js index d7f4dd6da..89a431adf 100755 --- a/print/templates/reports/receipt/receipt.js +++ b/print/templates/reports/receipt/receipt.js @@ -1,32 +1,18 @@ -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); +const vnReport = require('../../../core/mixins/vn-report.js'); module.exports = { name: 'receipt', + mixins: [vnReport], async serverPrefetch() { - this.client = await this.fetchClient(this.receiptId); - this.receipt = await this.fetchReceipt(this.receiptId); - - if (!this.receipt) - throw new Error('Something went wrong'); - }, - methods: { - fetchClient(receiptId) { - return this.findOneFromDef('client', [receiptId]); - }, - fetchReceipt(receiptId) { - return this.findOneFromDef('receipt', [receiptId]); - } - }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() + this.receipt = await this.findOneFromDef('receipt', [this.id]); + this.checkMainEntity(this.receipt); + this.client = await this.findOneFromDef('client', [this.id]); }, props: { - receiptId: { - type: [Number, String], - required: true + id: { + type: Number, + required: true, + description: 'Receipt id' } } }; diff --git a/print/templates/reports/receipt/sql/receipt.sql b/print/templates/reports/receipt/sql/receipt.sql index b8f5a4112..4094d25b3 100644 --- a/print/templates/reports/receipt/sql/receipt.sql +++ b/print/templates/reports/receipt/sql/receipt.sql @@ -1,11 +1,10 @@ -SELECT - r.id, - r.amountPaid, - cr.amount AS amountUnpaid, - r.payed, +SELECT + r.id, + r.amountPaid, + r.payed, r.companyFk FROM receipt r JOIN client c ON c.id = r.clientFk JOIN vn.clientRisk cr ON cr.clientFk = c.id AND cr.companyFk = r.companyFk -WHERE r.id = ? \ No newline at end of file +WHERE r.id = ? diff --git a/print/templates/reports/sepa-core/assets/css/import.js b/print/templates/reports/sepa-core/assets/css/import.js index fd8796c2b..37a98dfdd 100644 --- a/print/templates/reports/sepa-core/assets/css/import.js +++ b/print/templates/reports/sepa-core/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/sepa-core/sepa-core.html b/print/templates/reports/sepa-core/sepa-core.html index c935bc2a8..a8c270ad5 100644 --- a/print/templates/reports/sepa-core/sepa-core.html +++ b/print/templates/reports/sepa-core/sepa-core.html @@ -1,201 +1,174 @@ - - - - - - - + + + + + + + + + + + + + + + + + + +
- - - -
-
-
-

{{$t('instructions.title')}}

-

- 1. {{$t('instructions.accountFields')}} -

-

- 2. {{$t('instructions.signDocument')}} -

-

- {{$t('instructions.thanks')}} -

-
-
-
+ +
+
+
+

{{$t('instructions.title')}}

+

1. {{$t('instructions.accountFields')}}

+

2. {{$t('instructions.signDocument')}}

+

{{$t('instructions.thanks')}}

+
+
+
- - - -
-
-

{{$t('title')}}

-
-
-
- {{$t('supplier.toCompleteBySupplier')}} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('supplier.orderReference')}}{{supplier.mandateCode}}
{{$t('supplier.identifier')}} -
ES89000B97367486
-
B97367486-000
-
{{$t('supplier.name')}}{{supplier.name}}
{{$t('supplier.street')}}{{supplier.street}}
{{$t('supplier.location')}}{{supplier.postCode}}, {{supplier.city}} ({{supplier.province}})
{{$t('supplier.country')}}{{supplier.country}}
+ +
+
+

{{$t('title')}}

+
+
+
{{$t('supplier.toCompleteBySupplier')}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('supplier.orderReference')}}{{supplier.mandateCode}}
{{$t('supplier.identifier')}} +
ES89000B97367486
+
B97367486-000
+
{{$t('supplier.name')}}{{supplier.name}}
{{$t('supplier.street')}}{{supplier.street}}
{{$t('supplier.location')}}{{supplier.postCode}}, {{supplier.city}} ({{supplier.province}})
{{$t('supplier.country')}}{{supplier.country}}
+
+
+ +

{{$t('description')}}

+

+ {{$t('documentCopy')}} +

+ +
+
+
{{$t('client.toCompleteByClient')}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - -
+ {{$t('client.name')}} +
{{$t('client.accountHolder')}}
+
{{client.socialName}}
{{$t('client.fiscalId')}}{{client.fi}}
{{$t('client.street')}}{{client.street}}
{{$t('client.location')}}{{client.postcode}}, {{client.city}} ({{client.province}})
{{$t('client.country')}}{{client.country}}
{{$t('client.swift')}} +
+
- - -

{{$t('description')}}

-

- {{$t('documentCopy')}} -

- -
-
-
- {{$t('client.toCompleteByClient')}} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- {{$t('client.name')}} -
{{$t('client.accountHolder')}}
-
{{client.socialName}}
- {{$t('client.fiscalId')}} - {{client.fi}}
{{$t('client.street')}}{{client.street}}
{{$t('client.location')}}{{client.postcode}}, {{client.city}} ({{client.province}})
{{$t('client.country')}}{{client.country}}
{{$t('client.swift')}} -
- -
-
{{$t('client.accountNumber')}}
-
- {{client.countryCode.substr(0, 1)}} - {{client.countryCode.substr(1, 1)}} - -
-
-
- {{client.countryCode.substr(0, 1)}} - {{client.countryCode.substr(1, 1)}} - -
-
-
- {{$t('client.accountNumberFormat', [ - $t(`${client.country}`), - client.ibanLength, - client.countryCode - ])}} - -
-
{{$t('client.paymentType')}} - - - - - - - - -
-
- X -
-
{{$t('client.recurrent')}}O -
- -
-
{{$t('client.unique')}}
-
{{$t('client.signLocation')}}{{dated}}, {{client.province}}
{{$t('client.sign')}}
+
{{$t('client.accountNumber')}}
+
+ {{client.countryCode.substr(0, 1)}} + {{client.countryCode.substr(1, 1)}} +
- - -

{{$t('mandatoryFields')}}

-

{{$t('sendOrder')}}

- - - - - -
- - \ No newline at end of file +
+
+ {{client.countryCode.substr(0, 1)}} + {{client.countryCode.substr(1, 1)}} + +
+
+
+ {{$t('client.accountNumberFormat', [ $t(`${client.country}`), + client.ibanLength, client.countryCode ])}} + +
+
{{$t('client.paymentType')}} + + + + + + + + +
+
+ X +
+
{{$t('client.recurrent')}}O +
+ +
+
{{$t('client.unique')}}
+
{{$t('client.signLocation')}}{{formatDate(new Date(), '%d-%m-%Y')}}, {{client.province}}
{{$t('client.sign')}}
+ + + +

{{$t('mandatoryFields')}}

+

{{$t('sendOrder')}}

+ + + + diff --git a/print/templates/reports/sepa-core/sepa-core.js b/print/templates/reports/sepa-core/sepa-core.js index 7e3dd3566..0e19d2a6a 100755 --- a/print/templates/reports/sepa-core/sepa-core.js +++ b/print/templates/reports/sepa-core/sepa-core.js @@ -1,53 +1,22 @@ -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); +const vnReport = require('../../../core/mixins/vn-report.js'); -const rptSepaCore = { +module.exports = { name: 'sepa-core', + mixins: [vnReport], async serverPrefetch() { - this.client = await this.fetchClient(this.recipientId, this.companyId); - this.supplier = await this.fetchSupplier(this.recipientId, this.companyId); - - if (!this.client) - throw new Error('Something went wrong'); - }, - computed: { - dated: function() { - const filters = this.$options.filters; - - return filters.date(new Date(), '%d-%m-%Y'); - } - }, - methods: { - fetchClient(clientId, companyId) { - return this.findOneFromDef('client', [ - companyId, - companyId, - clientId - ]); - }, - fetchSupplier(clientId, companyId) { - return this.findOneFromDef('supplier', [ - companyId, - companyId, - clientId - ]); - } - }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() + this.client = await this.findOneFromDef('client', [this.companyId, this.companyId, this.id]); + this.checkMainEntity(this.client); + this.supplier = await this.findOneFromDef('supplier', [this.companyId, this.companyId, this.id]); }, props: { - recipientId: { - type: [Number, String], - required: true + id: { + type: Number, + required: true, + description: 'The client id' }, companyId: { - type: [Number, String], + type: Number, required: true } } }; - -module.exports = rptSepaCore; diff --git a/print/templates/reports/supplier-campaign-metrics/assets/css/import.js b/print/templates/reports/supplier-campaign-metrics/assets/css/import.js index fd8796c2b..37a98dfdd 100644 --- a/print/templates/reports/supplier-campaign-metrics/assets/css/import.js +++ b/print/templates/reports/supplier-campaign-metrics/assets/css/import.js @@ -1,9 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/spacing.css`, - `${appPath}/common/css/misc.css`, - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/supplier-campaign-metrics/sql/entries.sql b/print/templates/reports/supplier-campaign-metrics/sql/entries.sql index aa458dda0..b48e99c23 100644 --- a/print/templates/reports/supplier-campaign-metrics/sql/entries.sql +++ b/print/templates/reports/supplier-campaign-metrics/sql/entries.sql @@ -1,6 +1,6 @@ SELECT e.id, - e.ref, + e.reference, e.supplierFk, t.shipped FROM vn.entry e diff --git a/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html b/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html index 1303f2266..08b27d0bd 100644 --- a/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html +++ b/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html @@ -1,105 +1,81 @@ - - - - - - - - - -
- - - -
-
-
-
-

{{$t('title')}}

-
- - - - - - - - - - - - - - - -
{{$t('Supplier')}}{{supplier.id}}
{{$t('From')}}{{from | date('%d-%m-%Y')}}
{{$t('To')}}{{to | date('%d-%m-%Y')}}
-
-
-
-
-
{{$t('supplierData')}}
-
-

{{supplier.supplierName}}

-
- {{supplier.street}} -
-
- {{supplier.postcode}}, {{supplier.city}} ({{supplier.province}}) -
-
- {{supplier.country}} -
-
-
-
-
-
-

- {{$t('entry')}} {{entry.id}} - {{$t('dated')}} {{entry.shipped | date('%d-%m-%Y')}} - {{$t('reference')}} {{entry.ref}} -

- - - - - - - - - - - - - - - - - - - - -
{{$t('itemName')}}{{$t('Quantity')}}{{$t('price')}}{{$t('total')}}
{{buy.itemName}}{{buy.quantity}}{{buy.price | currency('EUR', $i18n.locale)}}{{buy.quantity * buy.price | currency('EUR', $i18n.locale)}}
- - {{buy.tag5}} {{buy.value5}} - - - {{buy.tag6}} {{buy.value6}} - - - {{buy.tag7}} {{buy.value7}} - -
- -
-
+ +
+
+
+
+

{{$t('title')}}

+
+ + + + + + + + + + + + + + + +
{{$t('Supplier')}}{{supplier.id}}
{{$t('From')}}{{formatDate(from, '%d-%m-%Y')}}
{{$t('To')}}{{formatDate(to, '%d-%m-%Y')}}
+
+
+
+
+
{{$t('supplierData')}}
+
+

{{supplier.supplierName}}

+
{{supplier.street}}
+
{{supplier.postcode}}, {{supplier.city}} ({{supplier.province}})
+
{{supplier.country}}
- - - -
- - \ No newline at end of file + + + +
+

+ {{$t('entry')}} {{entry.id}} + {{$t('dated')}} {{formatDate(entry.shipped, '%d-%m-%Y')}} + {{$t('reference')}} {{entry.reference}} +

+ + + + + + + + + + + + + + + + + + + + +
{{$t('itemName')}}{{$t('Quantity')}}{{$t('price')}}{{$t('total')}}
{{buy.itemName}}{{buy.quantity}}{{buy.price | currency('EUR', $i18n.locale)}}{{buy.quantity * buy.price | currency('EUR', $i18n.locale)}}
+ {{buy.tag5}} {{buy.value5}} + {{buy.tag6}} {{buy.value6}} + {{buy.tag7}} {{buy.value7}} +
+
+ + + + diff --git a/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.js b/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.js index 1a460daa9..32a7e9b0a 100755 --- a/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.js +++ b/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.js @@ -1,19 +1,19 @@ -const Component = require(`${appPath}/core/component`); -const reportHeader = new Component('report-header'); -const reportFooter = new Component('report-footer'); +const vnReport = require('../../../core/mixins/vn-report.js'); module.exports = { name: 'supplier-campaign-metrics', + mixins: [vnReport], async serverPrefetch() { - this.supplier = await this.fetchSupplier(this.recipientId); - let entries = await this.fetchEntries(this.recipientId, this.from, this.to); + this.supplier = await this.findOneFromDef('supplier', [this.id]); + this.checkMainEntity(this.supplier); + let entries = await this.rawSqlFromDef('entries', [this.id, this.from, this.to]); const entriesId = []; for (let entry of entries) entriesId.push(entry.id); - const buys = await this.fetchBuys(entriesId); + const buys = await this.rawSqlFromDef('buys', [entriesId]); const entriesMap = new Map(); for (let entry of entries) @@ -29,28 +29,12 @@ module.exports = { } this.entries = entries; - if (!this.supplier) - throw new Error('Something went wrong'); - }, - methods: { - fetchSupplier(supplierId) { - return this.findOneFromDef('supplier', [supplierId]); - }, - fetchEntries(supplierId, from, to) { - return this.rawSqlFromDef('entries', [supplierId, from, to]); - }, - fetchBuys(entriesId) { - return this.rawSqlFromDef('buys', [entriesId]); - } - }, - components: { - 'report-header': reportHeader.build(), - 'report-footer': reportFooter.build() }, props: { - recipientId: { - type: [Number, String], - required: true + id: { + type: Number, + required: true, + description: 'The supplier id' }, from: { required: true diff --git a/print/templates/reports/vehicle-event-expired/assets/css/import.js b/print/templates/reports/vehicle-event-expired/assets/css/import.js new file mode 100644 index 000000000..37a98dfdd --- /dev/null +++ b/print/templates/reports/vehicle-event-expired/assets/css/import.js @@ -0,0 +1,12 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, + `${__dirname}/style.css`]) + .mergeStyles(); diff --git a/print/templates/reports/vehicle-event-expired/assets/css/style.css b/print/templates/reports/vehicle-event-expired/assets/css/style.css new file mode 100644 index 000000000..1b6428d3c --- /dev/null +++ b/print/templates/reports/vehicle-event-expired/assets/css/style.css @@ -0,0 +1,19 @@ +.column-oriented { + margin-top: 50px !important; +} + +.bottom-line > tr { + border-bottom: 1px solid #ccc; +} + +.bottom-line tr:nth-last-child() { + border-bottom: none; +} + +.report-info { + font-size: 20px +} + +.description strong { + text-transform: uppercase; +} \ No newline at end of file diff --git a/print/templates/reports/vehicle-event-expired/locale/es.yml b/print/templates/reports/vehicle-event-expired/locale/es.yml new file mode 100644 index 000000000..ba7685047 --- /dev/null +++ b/print/templates/reports/vehicle-event-expired/locale/es.yml @@ -0,0 +1,4 @@ +title: Expiración Tarjetas Vehículos +Plate: Matrícula +Concept: Concepto +expirationDate: Fecha caducidad \ No newline at end of file diff --git a/print/templates/reports/vehicle-event-expired/sql/vehicleEvents.sql b/print/templates/reports/vehicle-event-expired/sql/vehicleEvents.sql new file mode 100644 index 000000000..09f9e5853 --- /dev/null +++ b/print/templates/reports/vehicle-event-expired/sql/vehicleEvents.sql @@ -0,0 +1,7 @@ +SELECT + v.numberPlate, + ve.description, + ve.finished +FROM vehicleEvent ve + JOIN vehicle v ON v.id = ve.vehicleFk +WHERE ve.id IN (?) \ No newline at end of file diff --git a/print/templates/reports/vehicle-event-expired/vehicle-event-expired.html b/print/templates/reports/vehicle-event-expired/vehicle-event-expired.html new file mode 100644 index 000000000..7435f272d --- /dev/null +++ b/print/templates/reports/vehicle-event-expired/vehicle-event-expired.html @@ -0,0 +1,25 @@ + +
+
+
+

{{$t('title')}}

+
+ + + + + + + + + + + + + + + +
{{$t('Plate')}}{{$t('Concept')}}{{$t('expirationDate')}}
{{vehicleEvent.numberPlate}}{{vehicleEvent.description}}{{formatDate(vehicleEvent.finished, '%d-%m-%Y')}}
+
+
+
diff --git a/print/templates/reports/vehicle-event-expired/vehicle-event-expired.js b/print/templates/reports/vehicle-event-expired/vehicle-event-expired.js new file mode 100755 index 000000000..b49e770a5 --- /dev/null +++ b/print/templates/reports/vehicle-event-expired/vehicle-event-expired.js @@ -0,0 +1,15 @@ +const vnReport = require('../../../core/mixins/vn-report.js'); +module.exports = { + name: 'vehicle-event-expired', + mixins: [vnReport], + async serverPrefetch() { + this.vehicleEvents = await this.rawSqlFromDef('vehicleEvents', [this.eventIds]); + this.checkMainEntity(this.vehicleEvents); + }, + props: { + eventIds: { + type: [Array], + required: true + } + } +}; diff --git a/print/templates/reports/zone/assets/css/import.js b/print/templates/reports/zone/assets/css/import.js index a2a9334cb..37a98dfdd 100644 --- a/print/templates/reports/zone/assets/css/import.js +++ b/print/templates/reports/zone/assets/css/import.js @@ -1,8 +1,12 @@ -const Stylesheet = require(`${appPath}/core/stylesheet`); +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); module.exports = new Stylesheet([ - `${appPath}/common/css/layout.css`, - `${appPath}/common/css/report.css`, - `${appPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/report.css`, `${__dirname}/style.css`]) .mergeStyles(); diff --git a/print/templates/reports/zone/zone.html b/print/templates/reports/zone/zone.html index c1e8d1ec1..fe42fb2ad 100644 --- a/print/templates/reports/zone/zone.html +++ b/print/templates/reports/zone/zone.html @@ -1,16 +1,5 @@ - - - - - - - - - -
-
{{zone.agencyName}}
-
{{zone.id}}
-
{{zone.plateNumber}} {{zone.time | date('%H:%M')}}
-
- - \ No newline at end of file + +
{{zone.agencyName}}
+
{{zone.id}}
+
{{zone.plateNumber}} {{formatDate(zone.time, '%H:%M')}}
+
diff --git a/print/templates/reports/zone/zone.js b/print/templates/reports/zone/zone.js index d611e1e53..5baa41b8e 100755 --- a/print/templates/reports/zone/zone.js +++ b/print/templates/reports/zone/zone.js @@ -1,20 +1,17 @@ +const vnReport = require('../../../core/mixins/vn-report.js'); + module.exports = { name: 'zone', + mixins: [vnReport], async serverPrefetch() { - this.zone = await this.fetchZone(this.routeId); - - if (!this.zone) - throw new Error('Something went wrong'); - }, - methods: { - fetchZone(routeId) { - return this.findOneFromDef('zone', [routeId]); - } + this.zone = await this.findOneFromDef('zone', [this.id]); + this.checkMainEntity(this.zone); }, props: { - routeId: { - type: [Number, String], - required: true + id: { + type: Number, + required: true, + description: 'The zone id' } } };