Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 4466-invoiceInRectificated
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
commit
c9b28d10bd
290
CHANGELOG.md
290
CHANGELOG.md
|
@ -5,299 +5,349 @@ 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).
|
||||
|
||||
## [2408.01] - 2024-02-22
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
## [2406.01] - 2024-02-08
|
||||
|
||||
### Added
|
||||
### Changed
|
||||
### Fixed
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
## [2404.01] - 2024-01-25
|
||||
|
||||
### Added
|
||||
### Changed
|
||||
### Fixed
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
## [2402.01] - 2024-01-11
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
## [2400.01] - 2024-01-04
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
## [2350.01] - 2023-12-14
|
||||
|
||||
### Características Añadidas 🆕
|
||||
- **Tickets → Expediciones:** Añadido soporte para Viaexpress
|
||||
|
||||
- **Tickets → Expediciones:** Añadido soporte para Viaexpress
|
||||
|
||||
## [2348.01] - 2023-11-30
|
||||
|
||||
### Características Añadidas 🆕
|
||||
- **Tickets → Adelantar:** Permite mover lineas sin generar negativos
|
||||
- **Tickets → Adelantar:** Permite modificar la fecha de los tickets
|
||||
- **Trabajadores → Notificaciones:** Nueva sección (lilium)
|
||||
|
||||
- **Tickets → Adelantar:** Permite mover lineas sin generar negativos
|
||||
- **Tickets → Adelantar:** Permite modificar la fecha de los tickets
|
||||
- **Trabajadores → Notificaciones:** Nueva sección (lilium)
|
||||
|
||||
### Correcciones 🛠️
|
||||
- **Tickets → RocketChat:** Arreglada detección de cambios
|
||||
|
||||
- **Tickets → RocketChat:** Arreglada detección de cambios
|
||||
|
||||
## [2346.01] - 2023-11-16
|
||||
|
||||
### Added
|
||||
### Changed
|
||||
### Fixed
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
## [2342.01] - 2023-11-02
|
||||
|
||||
### Added
|
||||
- (Usuarios -> Foto) Se muestra la foto del trabajador
|
||||
### Fixed
|
||||
- (Usuarios -> Historial) Abre el descriptor del usuario correctamente
|
||||
|
||||
- (Usuarios -> Foto) Se muestra la foto del trabajador
|
||||
|
||||
### Fixed
|
||||
|
||||
- (Usuarios -> Historial) Abre el descriptor del usuario correctamente
|
||||
|
||||
## [2340.01] - 2023-10-05
|
||||
|
||||
## [2338.01] - 2023-09-21
|
||||
|
||||
### Added
|
||||
- (Ticket -> Servicios) Se pueden abonar servicios
|
||||
- (Facturas -> Datos básicos) Muestra valores por defecto
|
||||
- (Facturas -> Borrado) Notificación al borrar un asiento ya enlazado en Sage
|
||||
|
||||
- (Ticket -> Servicios) Se pueden abonar servicios
|
||||
- (Facturas -> Datos básicos) Muestra valores por defecto
|
||||
- (Facturas -> Borrado) Notificación al borrar un asiento ya enlazado en Sage
|
||||
|
||||
### Changed
|
||||
- (Trabajadores -> Calendario) Icono de check arreglado cuando pulsas un tipo de dia
|
||||
|
||||
- (Trabajadores -> Calendario) Icono de check arreglado cuando pulsas un tipo de dia
|
||||
|
||||
## [2336.01] - 2023-09-07
|
||||
|
||||
## [2334.01] - 2023-08-24
|
||||
|
||||
### Added
|
||||
- (General -> Errores) Botón para enviar cau con los datos del error
|
||||
|
||||
- (General -> Errores) Botón para enviar cau con los datos del error
|
||||
|
||||
## [2332.01] - 2023-08-10
|
||||
|
||||
### Added
|
||||
- (Trabajadores -> Gestión documental) Soporte para Docuware
|
||||
- (General -> Agencia) Soporte para Viaexpress
|
||||
- (Tickets -> SMS) Nueva sección en Lilium
|
||||
|
||||
- (Trabajadores -> Gestión documental) Soporte para Docuware
|
||||
- (General -> Agencia) Soporte para Viaexpress
|
||||
- (Tickets -> SMS) Nueva sección en Lilium
|
||||
|
||||
### Changed
|
||||
- (General -> Tickets) Devuelve el motivo por el cual no es editable
|
||||
- (Desplegables -> Trabajadores) Mejorados
|
||||
- (General -> Clientes) Razón social y dirección en mayúsculas
|
||||
|
||||
- (General -> Tickets) Devuelve el motivo por el cual no es editable
|
||||
- (Desplegables -> Trabajadores) Mejorados
|
||||
- (General -> Clientes) Razón social y dirección en mayúsculas
|
||||
|
||||
### Fixed
|
||||
- (Clientes -> SMS) Al pasar el ratón por encima muestra el mensaje completo
|
||||
|
||||
- (Clientes -> SMS) Al pasar el ratón por encima muestra el mensaje completo
|
||||
|
||||
## [2330.01] - 2023-07-27
|
||||
|
||||
### Added
|
||||
- (Artículos -> Vista Previa) Añadido campo "Plástico reciclado"
|
||||
- (Rutas -> Troncales) Nueva sección
|
||||
- (Tickets -> Opciones) Opción establecer peso
|
||||
- (Clientes -> SMS) Nueva sección
|
||||
|
||||
- (Artículos -> Vista Previa) Añadido campo "Plástico reciclado"
|
||||
- (Rutas -> Troncales) Nueva sección
|
||||
- (Tickets -> Opciones) Opción establecer peso
|
||||
- (Clientes -> SMS) Nueva sección
|
||||
|
||||
### Changed
|
||||
- (General -> Iconos) Añadidos nuevos iconos
|
||||
- (Clientes -> Razón social) Permite crear clientes con la misma razón social según el país
|
||||
|
||||
- (General -> Iconos) Añadidos nuevos iconos
|
||||
- (Clientes -> Razón social) Permite crear clientes con la misma razón social según el país
|
||||
|
||||
## [2328.01] - 2023-07-13
|
||||
|
||||
### Added
|
||||
- (Clientes -> Morosos) Añadida columna "es trabajador"
|
||||
- (Trabajadores -> Departamentos) Nueva sección
|
||||
- (Trabajadores -> Departamentos) Añadido listado de Trabajadores por departamento
|
||||
- (Trabajadores -> Departamentos) Añadido características de departamento e información
|
||||
|
||||
- (Clientes -> Morosos) Añadida columna "es trabajador"
|
||||
- (Trabajadores -> Departamentos) Nueva sección
|
||||
- (Trabajadores -> Departamentos) Añadido listado de Trabajadores por departamento
|
||||
- (Trabajadores -> Departamentos) Añadido características de departamento e información
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
- (Trabajadores -> Departamentos) Arreglado búscador
|
||||
|
||||
- (Trabajadores -> Departamentos) Arreglado búscador
|
||||
|
||||
## [2326.01] - 2023-06-29
|
||||
|
||||
### Added
|
||||
- (Entradas -> Correo) Al cambiar el tipo de cambio enviará un correo a las personas designadas
|
||||
- (General -> Históricos) Botón para ver el estado del registro en cada punto
|
||||
- (General -> Históricos) Al filtar por registro se muestra todo el histórial desde que fue creado
|
||||
- (Tickets -> Índice) Permite enviar varios albaranes a Docuware
|
||||
|
||||
- (Entradas -> Correo) Al cambiar el tipo de cambio enviará un correo a las personas designadas
|
||||
- (General -> Históricos) Botón para ver el estado del registro en cada punto
|
||||
- (General -> Históricos) Al filtar por registro se muestra todo el histórial desde que fue creado
|
||||
- (Tickets -> Índice) Permite enviar varios albaranes a Docuware
|
||||
|
||||
### Changed
|
||||
- (General -> Históricos) Los registros se muestran agrupados por usuario y entidad
|
||||
- (Facturas -> Facturación global) Optimizada, generación de PDFs y notificaciones en paralelo
|
||||
|
||||
- (General -> Históricos) Los registros se muestran agrupados por usuario y entidad
|
||||
- (Facturas -> Facturación global) Optimizada, generación de PDFs y notificaciones en paralelo
|
||||
|
||||
### Fixed
|
||||
- (General -> Históricos) Duplicidades eliminadas
|
||||
- (Facturas -> Facturación global) Solucionados fallos que paran el proceso
|
||||
|
||||
- (General -> Históricos) Duplicidades eliminadas
|
||||
- (Facturas -> Facturación global) Solucionados fallos que paran el proceso
|
||||
|
||||
## [2324.01] - 2023-06-15
|
||||
|
||||
### Added
|
||||
- (Tickets -> Abono) Al abonar permite crear el ticket abono con almacén o sin almmacén
|
||||
- (General -> Desplegables) Mejorada eficiencia de carga de datos
|
||||
- (General -> Históricos) Ahora, ademas de los ids, se muestra la descripión de los atributos
|
||||
- (General -> Históricos) Botón para hacer más ágil mostrar sólo los cambios en un registro
|
||||
- (General -> Históricos) Filtro por cambios
|
||||
|
||||
- (Tickets -> Abono) Al abonar permite crear el ticket abono con almacén o sin almmacén
|
||||
- (General -> Desplegables) Mejorada eficiencia de carga de datos
|
||||
- (General -> Históricos) Ahora, ademas de los ids, se muestra la descripión de los atributos
|
||||
- (General -> Históricos) Botón para hacer más ágil mostrar sólo los cambios en un registro
|
||||
- (General -> Históricos) Filtro por cambios
|
||||
|
||||
### Changed
|
||||
- (General -> Permisos) Mejorada seguridad
|
||||
- (General -> Históricos) Elementos de la interfaz reorganizados para hacerla más ágil e intuitiva
|
||||
|
||||
- (General -> Permisos) Mejorada seguridad
|
||||
- (General -> Históricos) Elementos de la interfaz reorganizados para hacerla más ágil e intuitiva
|
||||
|
||||
### Fixed
|
||||
|
||||
-
|
||||
|
||||
|
||||
|
||||
## [2322.01] - 2023-06-01
|
||||
|
||||
### Added
|
||||
- (Tickets -> Crear Factura) Al facturar se envia automáticamente el pdf al cliente
|
||||
- (Artículos -> Histórico) Filtro para mostrar lo anterior al inventario
|
||||
- (Trabajadores -> Nuevo trabajador) Permite elegir el método de pago
|
||||
|
||||
- (Tickets -> Crear Factura) Al facturar se envia automáticamente el pdf al cliente
|
||||
- (Artículos -> Histórico) Filtro para mostrar lo anterior al inventario
|
||||
- (Trabajadores -> Nuevo trabajador) Permite elegir el método de pago
|
||||
|
||||
### Changed
|
||||
- (Trabajadores -> Nuevo trabajador) Los clientes se crean sin 'TR' pero se añade tipo de negocio 'Trabajador'
|
||||
- (Tickets -> Expediciones) Interfaz mejorada y contador añadido
|
||||
|
||||
- (Trabajadores -> Nuevo trabajador) Los clientes se crean sin 'TR' pero se añade tipo de negocio 'Trabajador'
|
||||
- (Tickets -> Expediciones) Interfaz mejorada y contador añadido
|
||||
|
||||
### Fixed
|
||||
- (Tickets -> Líneas) Se permite hacer split de líneas al mismo ticket
|
||||
- (Tickets -> Cambiar estado) Ahora muestra la lista completa de todos los estados
|
||||
|
||||
|
||||
- (Tickets -> Líneas) Se permite hacer split de líneas al mismo ticket
|
||||
- (Tickets -> Cambiar estado) Ahora muestra la lista completa de todos los estados
|
||||
|
||||
## [2320.01] - 2023-05-25
|
||||
|
||||
### Added
|
||||
- (Tickets -> Crear Factura) Al facturar se envia automáticamente el pdf al cliente
|
||||
|
||||
- (Tickets -> Crear Factura) Al facturar se envia automáticamente el pdf al cliente
|
||||
|
||||
### Changed
|
||||
- (Trabajadores -> Nuevo trabajador) Los clientes se crean sin 'TR' pero se añade tipo de negocio 'Trabajador'
|
||||
|
||||
- (Trabajadores -> Nuevo trabajador) Los clientes se crean sin 'TR' pero se añade tipo de negocio 'Trabajador'
|
||||
|
||||
### Fixed
|
||||
|
||||
-
|
||||
|
||||
|
||||
|
||||
## [2318.01] - 2023-05-08
|
||||
|
||||
### Added
|
||||
- (Usuarios -> Histórico) Nueva sección
|
||||
- (Roles -> Histórico) Nueva sección
|
||||
- (Trabajadores -> Dar de alta) Permite elegir el método de pago
|
||||
|
||||
- (Usuarios -> Histórico) Nueva sección
|
||||
- (Roles -> Histórico) Nueva sección
|
||||
- (Trabajadores -> Dar de alta) Permite elegir el método de pago
|
||||
|
||||
### Changed
|
||||
- (Artículo -> Precio fijado) Modificado el buscador superior por uno lateral
|
||||
- (Trabajadores -> Dar de alta) Quitada obligatoriedad del iban
|
||||
|
||||
- (Artículo -> Precio fijado) Modificado el buscador superior por uno lateral
|
||||
- (Trabajadores -> Dar de alta) Quitada obligatoriedad del iban
|
||||
|
||||
### Fixed
|
||||
- (Ticket -> Boxing) Arreglado selección de horas
|
||||
- (Cesta -> Índice) Optimizada búsqueda
|
||||
|
||||
|
||||
- (Ticket -> Boxing) Arreglado selección de horas
|
||||
- (Cesta -> Índice) Optimizada búsqueda
|
||||
|
||||
## [2314.01] - 2023-04-20
|
||||
|
||||
### Added
|
||||
- (Clientes -> Morosos) Ahora se puede filtrar por las columnas "Desde" y "Fecha Ú. O.". También se envia un email al comercial cuando se añade una nota.
|
||||
- (Monitor tickets) Muestra un icono al lado de la zona, si el ticket es frágil y se envía por agencia
|
||||
- (Facturas recibidas -> Bases negativas) Nueva sección
|
||||
|
||||
- (Clientes -> Morosos) Ahora se puede filtrar por las columnas "Desde" y "Fecha Ú. O.". También se envia un email al comercial cuando se añade una nota.
|
||||
- (Monitor tickets) Muestra un icono al lado de la zona, si el ticket es frágil y se envía por agencia
|
||||
- (Facturas recibidas -> Bases negativas) Nueva sección
|
||||
|
||||
### Fixed
|
||||
- (Clientes -> Morosos) Ahora se mantienen los elementos seleccionados al hacer sroll.
|
||||
|
||||
- (Clientes -> Morosos) Ahora se mantienen los elementos seleccionados al hacer sroll.
|
||||
|
||||
## [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
|
||||
|
||||
- (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
|
||||
|
||||
- (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
|
||||
|
||||
- (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
|
||||
|
||||
- (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
|
||||
|
||||
- (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
|
||||
|
||||
- (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.
|
||||
|
||||
- (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
|
||||
|
||||
- (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
|
||||
|
||||
- (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
|
||||
|
||||
- (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.
|
||||
|
||||
- (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
|
||||
|
||||
- (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
|
||||
|
||||
- (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
|
||||
|
||||
- (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
|
||||
|
||||
- (General) Al utilizar el traductor de Google se descuadraban los iconos
|
||||
|
||||
### Removed
|
||||
- (Tickets -> Control clientes) Eliminada sección
|
||||
|
||||
- (Tickets -> Control clientes) Eliminada sección
|
||||
|
|
|
@ -40,11 +40,11 @@ RUN apt-get update \
|
|||
WORKDIR /salix
|
||||
|
||||
COPY print/package.json print/package-lock.json print/
|
||||
RUN npm --prefix ./print install --omit=dev ./print
|
||||
RUN npm ci --no-audit --prefer-offline --omit=dev --prefix=print
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
COPY loopback/package.json loopback/
|
||||
RUN npm install --omit=dev
|
||||
RUN npm ci --no-audit --prefer-offline --omit=dev
|
||||
|
||||
COPY loopback loopback
|
||||
COPY back back
|
||||
|
|
|
@ -1,125 +1,160 @@
|
|||
#!/usr/bin/env groovy
|
||||
|
||||
def PROTECTED_BRANCH
|
||||
def FROM_GIT
|
||||
def RUN_TESTS
|
||||
|
||||
pre: {
|
||||
switch (env.BRANCH_NAME) {
|
||||
case 'test':
|
||||
env.NODE_ENV = 'test'
|
||||
env.BACK_REPLICAS = 2
|
||||
break
|
||||
case 'master':
|
||||
env.NODE_ENV = 'production'
|
||||
env.BACK_REPLICAS = 4
|
||||
break
|
||||
default:
|
||||
env.NODE_ENV = 'dev'
|
||||
env.BACK_REPLICAS = 1
|
||||
}
|
||||
|
||||
PROTECTED_BRANCH = [
|
||||
'dev',
|
||||
'test',
|
||||
'master'
|
||||
].contains(env.BRANCH_NAME)
|
||||
|
||||
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
|
||||
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
|
||||
|
||||
// Uncomment to enable debugging
|
||||
// https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference
|
||||
//env.DEBUG = 'strong-remoting:shared-method'
|
||||
}
|
||||
node {
|
||||
stage('Setup') {
|
||||
def packageJson = readJSON file: 'package.json'
|
||||
env.VERSION = packageJson.version
|
||||
|
||||
env.GIT_COMMIT_MSG = sh(
|
||||
script: 'git log -1 --pretty=%B ${GIT_COMMIT}',
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
setEnv()
|
||||
}
|
||||
}
|
||||
pipeline {
|
||||
agent any
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
}
|
||||
tools {
|
||||
nodejs 'node-v20'
|
||||
}
|
||||
environment {
|
||||
PROJECT_NAME = 'salix'
|
||||
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||
}
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
script {
|
||||
switch (env.BRANCH_NAME) {
|
||||
case 'master':
|
||||
env.NODE_ENV = 'production'
|
||||
env.BACK_REPLICAS = 4
|
||||
break
|
||||
case 'test':
|
||||
env.NODE_ENV = 'test'
|
||||
env.BACK_REPLICAS = 2
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
configFileProvider([
|
||||
configFile(fileId: "salix.groovy",
|
||||
variable: 'GROOVY_FILE')
|
||||
]) {
|
||||
load env.GROOVY_FILE
|
||||
}
|
||||
|
||||
setEnv()
|
||||
}
|
||||
}
|
||||
stage('Install') {
|
||||
environment {
|
||||
NODE_ENV = ""
|
||||
}
|
||||
steps {
|
||||
nodejs('node-v20') {
|
||||
sh 'npm install --no-audit --prefer-offline'
|
||||
sh 'gulp install --ci'
|
||||
parallel {
|
||||
stage('Backend') {
|
||||
steps {
|
||||
sh 'npm install --no-audit --prefer-offline'
|
||||
}
|
||||
}
|
||||
stage('Frontend') {
|
||||
when {
|
||||
expression { FROM_GIT }
|
||||
}
|
||||
steps {
|
||||
sh 'npm install --no-audit --prefer-offline --prefix=front'
|
||||
}
|
||||
}
|
||||
stage('Print') {
|
||||
when {
|
||||
expression { FROM_GIT }
|
||||
}
|
||||
steps {
|
||||
sh 'npm install --no-audit --prefer-offline --prefix=print'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
when { not { anyOf {
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}}}
|
||||
when {
|
||||
expression { RUN_TESTS }
|
||||
}
|
||||
environment {
|
||||
NODE_ENV = ""
|
||||
TZ = 'Europe/Madrid'
|
||||
}
|
||||
parallel {
|
||||
stage('Frontend') {
|
||||
steps {
|
||||
nodejs('node-v20') {
|
||||
sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Backend') {
|
||||
steps {
|
||||
nodejs('node-v20') {
|
||||
sh 'npm run test:back:ci'
|
||||
}
|
||||
sh 'npm run test:back:ci'
|
||||
}
|
||||
}
|
||||
stage('Frontend') {
|
||||
steps {
|
||||
sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=6'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
when { anyOf {
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}}
|
||||
when {
|
||||
expression { PROTECTED_BRANCH && FROM_GIT }
|
||||
}
|
||||
environment {
|
||||
CREDENTIALS = credentials('docker-registry')
|
||||
}
|
||||
steps {
|
||||
nodejs('node-v20') {
|
||||
sh 'gulp build'
|
||||
}
|
||||
|
||||
sh 'gulp build'
|
||||
dockerBuild()
|
||||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
when { anyOf {
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}}
|
||||
environment {
|
||||
DOCKER_HOST = "${env.SWARM_HOST}"
|
||||
when {
|
||||
expression { PROTECTED_BRANCH }
|
||||
}
|
||||
steps {
|
||||
sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}"
|
||||
}
|
||||
}
|
||||
stage('Database') {
|
||||
when { anyOf {
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}}
|
||||
steps {
|
||||
configFileProvider([
|
||||
configFile(fileId: "config.${env.NODE_ENV}.ini",
|
||||
variable: 'MYSQL_CONFIG')
|
||||
]) {
|
||||
sh 'cp "$MYSQL_CONFIG" db/config.$NODE_ENV.ini'
|
||||
}
|
||||
parallel {
|
||||
stage('Database') {
|
||||
steps {
|
||||
configFileProvider([
|
||||
configFile(fileId: "config.${env.NODE_ENV}.ini",
|
||||
variable: 'MYSQL_CONFIG')
|
||||
]) {
|
||||
sh 'mkdir -p db/remotes'
|
||||
sh 'cp "$MYSQL_CONFIG" db/remotes/$NODE_ENV.ini'
|
||||
}
|
||||
|
||||
sh 'db/import-changes.sh -f $NODE_ENV'
|
||||
sh 'npx myt push $NODE_ENV --force --commit'
|
||||
}
|
||||
}
|
||||
stage('Docker') {
|
||||
when {
|
||||
expression { FROM_GIT }
|
||||
}
|
||||
environment {
|
||||
DOCKER_HOST = "${env.SWARM_HOST}"
|
||||
}
|
||||
steps {
|
||||
sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
if (!['master', 'test'].contains(env.BRANCH_NAME)) {
|
||||
if (RUN_TESTS) {
|
||||
try {
|
||||
junit 'junitresults.xml'
|
||||
junit 'junit.xml'
|
||||
|
@ -127,18 +162,28 @@ pipeline {
|
|||
echo e.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
success {
|
||||
script {
|
||||
if (env.BRANCH_NAME == 'master' && FROM_GIT) {
|
||||
String message = env.GIT_COMMIT_MSG
|
||||
int index = message.indexOf('\n')
|
||||
if (index != -1)
|
||||
message = message.substring(0, index)
|
||||
|
||||
if (!env.COMMITTER_EMAIL || currentBuild.currentResult == 'SUCCESS') return;
|
||||
try {
|
||||
mail(
|
||||
to: env.COMMITTER_EMAIL,
|
||||
subject: "Pipeline: ${env.JOB_NAME} (${env.BUILD_NUMBER}): ${currentBuild.currentResult}",
|
||||
body: "Check status at ${env.BUILD_URL}"
|
||||
rocketSend(
|
||||
channel: 'vn-database',
|
||||
message: "*DB version uploaded:* ${message}"
|
||||
+"\n$COMMITTER_EMAIL ($BRANCH_NAME)"
|
||||
+"\n$GIT_URL/commit/$GIT_COMMIT",
|
||||
rawMessage: true
|
||||
)
|
||||
} catch (e) {
|
||||
echo e.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
unsuccessful {
|
||||
sendEmail()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +1,49 @@
|
|||
const Docker = require('../db/docker.js');
|
||||
/* eslint-disable no-console */
|
||||
const path = require('path');
|
||||
const Myt = require('@verdnatura/myt/myt');
|
||||
const Run = require('@verdnatura/myt/myt-run');
|
||||
let dataSources = require('../loopback/server/datasources.json');
|
||||
|
||||
let server;
|
||||
|
||||
process.on('warning', warning => {
|
||||
console.log(warning.name);
|
||||
console.log(warning.message);
|
||||
console.log(warning.stack);
|
||||
});
|
||||
|
||||
process.on('SIGUSR2', async() => {
|
||||
if (container) await container.rm();
|
||||
});
|
||||
process.on('SIGUSR2', rmServer);
|
||||
process.on('exit', rmServer);
|
||||
|
||||
process.on('exit', async function() {
|
||||
if (container) await container.rm();
|
||||
});
|
||||
async function rmServer() {
|
||||
if (!server) return;
|
||||
await server.rm();
|
||||
server = null;
|
||||
}
|
||||
|
||||
let container;
|
||||
async function test() {
|
||||
let isCI = false;
|
||||
console.log('Building and running DB container.');
|
||||
|
||||
if (process.argv[2] === 'ci')
|
||||
isCI = true;
|
||||
const isCI = process.argv[2] === 'ci';
|
||||
|
||||
container = new Docker();
|
||||
const myt = new Myt();
|
||||
await myt.init({
|
||||
workspace: path.join(__dirname, '..'),
|
||||
random: true,
|
||||
ci: isCI,
|
||||
tmpfs: process.platform == 'linux',
|
||||
network: isCI ? 'jenkins' : null
|
||||
});
|
||||
server = await myt.run(Run);
|
||||
await myt.deinit();
|
||||
const {dbConfig} = server;
|
||||
|
||||
console.log('Initializing backend.');
|
||||
|
||||
await container.run(isCI);
|
||||
dataSources = JSON.parse(JSON.stringify(dataSources));
|
||||
|
||||
Object.assign(dataSources.vn, {
|
||||
host: container.dbConf.host,
|
||||
port: container.dbConf.port
|
||||
host: dbConfig.host,
|
||||
port: dbConfig.port
|
||||
});
|
||||
|
||||
const bootOptions = {dataSources};
|
||||
|
@ -41,6 +55,8 @@ async function test() {
|
|||
// FIXME: Workaround to wait for loopback to be ready
|
||||
await app.models.Application.status();
|
||||
|
||||
console.log('Running tests.');
|
||||
|
||||
const Jasmine = require('jasmine');
|
||||
const jasmine = new Jasmine();
|
||||
|
||||
|
@ -76,9 +92,13 @@ async function test() {
|
|||
});
|
||||
|
||||
await jasmine.execute();
|
||||
|
||||
console.log('Stopping.');
|
||||
|
||||
if (app) await app.disconnect();
|
||||
if (container) await container.rm();
|
||||
console.log('App disconnected & container removed');
|
||||
await rmServer();
|
||||
|
||||
console.log('Tests ended.\n');
|
||||
}
|
||||
|
||||
test();
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
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');
|
|
@ -1,3 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Receipt', 'receiptPdf', '*', 'ALLOW', 'ROLE', 'salesAssistant');
|
|
@ -1,9 +0,0 @@
|
|||
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';
|
|
@ -1 +0,0 @@
|
|||
rename table `vn`.`invoiceOut_queue` to `vn`.`invoiceOutQueue`;
|
|
@ -1,5 +0,0 @@
|
|||
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';
|
|
@ -1,10 +0,0 @@
|
|||
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';
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
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);
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE `account`.`user` ADD hasGrant TINYINT(1) NOT NULL;
|
|
@ -1,2 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalId)
|
||||
VALUES ('WorkerDisableExcluded','*','*','ALLOW','hr');
|
|
@ -1,3 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Business', '*', '*', 'ALLOW', 'ROLE', 'hr');
|
|
@ -1,3 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Sale', 'usesMana', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -1,2 +0,0 @@
|
|||
INSERT INTO `vn`.`payDem` (id,payDem)
|
||||
VALUES (7,'0');
|
|
@ -1,4 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('InvoiceIn', 'invoiceInPdf', 'READ', 'ALLOW', 'ROLE', 'administrative'),
|
||||
('InvoiceIn', 'invoiceInEmail', 'WRITE', 'ALLOW', 'ROLE', 'administrative');
|
|
@ -1,2 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (model,property,accessType,principalId)
|
||||
VALUES ('Supplier','newSupplier','WRITE','administrative');
|
|
@ -1,63 +0,0 @@
|
|||
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;
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE `vn`.`supplier` MODIFY COLUMN payMethodFk tinyint(3) unsigned NULL;
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE `vn`.`supplier` MODIFY COLUMN supplierActivityFk varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL;
|
|
@ -1,5 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
|
||||
VALUES
|
||||
('ClaimRma', '*', 'READ', 'ALLOW', 'ROLE', 'claimManager'),
|
||||
('ClaimRma', '*', 'WRITE', 'ALLOW', 'ROLE', 'claimManager');
|
||||
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE `vn`.`claim` ADD rma varchar(100) NULL ;
|
|
@ -1,7 +0,0 @@
|
|||
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;
|
|
@ -1,3 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Notification', '*', 'WRITE', 'ALLOW', 'ROLE', 'developer');
|
|
@ -1,12 +0,0 @@
|
|||
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');
|
|
@ -1,56 +0,0 @@
|
|||
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';
|
|
@ -1,33 +0,0 @@
|
|||
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');
|
|
@ -1,2 +0,0 @@
|
|||
DELETE FROM `salix`.`ACL`
|
||||
WHERE model = 'UserPassword';
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE `vn`.`claimConfig` DROP COLUMN `pickupContact`;
|
|
@ -1,4 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
|
||||
VALUES
|
||||
('ItemShelving', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||
('ItemShelving', '*', 'WRITE', 'ALLOW', 'ROLE', 'production');
|
|
@ -1,4 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
|
||||
VALUES
|
||||
('ItemShelvingPlacementSupplyStock', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
|
||||
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE `vn`.`workerTimeControlMail` CHANGE emailResponse reason text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL;
|
|
@ -1,54 +0,0 @@
|
|||
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 ;
|
|
@ -1,2 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||
VALUES ('NotificationQueue','*','*','ALLOW','ROLE','employee');
|
|
@ -1,7 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('InvoiceOut', 'clientsToInvoice', 'WRITE', 'ALLOW', 'ROLE', 'invoicing');
|
||||
|
||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('InvoiceOut', 'invoiceClient', 'WRITE', 'ALLOW', 'ROLE', 'invoicing');
|
|
@ -1 +0,0 @@
|
|||
Alter table `vn`.`expedition` RENAME COLUMN itemFk TO itemFk__;
|
|
@ -1,8 +0,0 @@
|
|||
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
|
|
@ -1 +0,0 @@
|
|||
DROP PROCEDURE IF EXISTS `vn`.`collection_missingTrash`;
|
|
@ -1 +0,0 @@
|
|||
DROP TABLE `vn`.`invoiceOutQueue`;
|
|
@ -1,4 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Sale', 'editTracked', 'WRITE', 'ALLOW', 'ROLE', 'production'),
|
||||
('Sale', 'editFloramondo', 'WRITE', 'ALLOW', 'ROLE', 'salesAssistant');
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE `vn`.`greuge` CHANGE `userFK` `userFk` int(10) unsigned DEFAULT NULL NULL;
|
|
@ -1,4 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Receipt', 'balanceCompensationEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||
('Receipt', 'balanceCompensationPdf', 'READ', 'ALLOW', 'ROLE', 'employee');
|
|
@ -1,8 +0,0 @@
|
|||
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;
|
|
@ -1,14 +0,0 @@
|
|||
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');
|
|
@ -1,79 +0,0 @@
|
|||
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 ;
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
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.id,
|
||||
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.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.id, 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 ;
|
|
@ -1,6 +0,0 @@
|
|||
UPDATE
|
||||
`vn`.`client`
|
||||
SET
|
||||
hasElectronicInvoice = TRUE
|
||||
WHERE
|
||||
businessTypeFk = 'officialOrganism';
|
|
@ -1,4 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('MdbApp', 'lock', 'WRITE', 'ALLOW', 'ROLE', 'developer'),
|
||||
('MdbApp', 'unlock', 'WRITE', 'ALLOW', 'ROLE', 'developer');
|
|
@ -1,3 +0,0 @@
|
|||
UPDATE `vn`.`collection`
|
||||
SET sectorFk=1
|
||||
WHERE id=1;
|
|
@ -1 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`) VALUES ('Dms','saveSign','*','ALLOW','employee');
|
|
@ -1,3 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('TicketLog', 'getChanges', 'READ', 'ALLOW', 'ROLE', 'employee');
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE `vn`.`entry` DROP COLUMN `ref`;
|
|
@ -1,12 +0,0 @@
|
|||
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);
|
|
@ -1,225 +0,0 @@
|
|||
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 tmp.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 tmp.ticketToInvoice tt
|
||||
JOIN ticket t ON t.id = tt.id
|
||||
LIMIT 1;
|
||||
|
||||
-- Eliminem de tmp.ticketToInvoice els tickets que no han de ser facturats
|
||||
DELETE ti.*
|
||||
FROM tmp.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 tmp.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,
|
||||
siiTypeInvoiceOutFk
|
||||
)
|
||||
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 tmp.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 tmp.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 tmp.ticketToInvoice ti;
|
||||
|
||||
CALL invoiceExpenseMake(vNewInvoiceId);
|
||||
CALL invoiceTaxMake(vNewInvoiceId,vTaxArea);
|
||||
|
||||
UPDATE invoiceOut io
|
||||
JOIN (
|
||||
SELECT SUM(amount) AS total
|
||||
FROM invoiceOutExpense
|
||||
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 tmp.ticketToInvoice;
|
||||
|
||||
CALL `ticket_getTax`('NATIONAL');
|
||||
|
||||
SET @vTaxableBaseServices := 0.00;
|
||||
SET @vTaxCodeGeneral := NULL;
|
||||
|
||||
INSERT INTO vn.invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
|
||||
SELECT vNewInvoiceInId, @vTaxableBaseServices, sub.expenseFk, sub.taxTypeSageFk , sub.transactionTypeSageFk
|
||||
FROM (
|
||||
SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase, i.expenseFk, 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, expenseFk, taxTypeSageFk, transactionTypeSageFk)
|
||||
SELECT vNewInvoiceInId, SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral, @vTaxableBaseServices, 0) taxableBase, i.expenseFk, 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 `tmp`.`ticketToInvoice`;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,11 +0,0 @@
|
|||
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
|
|
@ -1,24 +0,0 @@
|
|||
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 ;
|
|
@ -1,8 +0,0 @@
|
|||
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
|
|
@ -1,104 +0,0 @@
|
|||
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');
|
|
@ -1,73 +0,0 @@
|
|||
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 ;
|
|
@ -1,2 +0,0 @@
|
|||
DROP PROCEDURE IF EXISTS `ticket_split`;
|
||||
DROP PROCEDURE IF EXISTS `ticket_merge`;
|
|
@ -1,4 +0,0 @@
|
|||
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);
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
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;
|
|
@ -1,60 +0,0 @@
|
|||
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 '#';
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
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');
|
|
@ -1,16 +0,0 @@
|
|||
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';
|
|
@ -1,28 +0,0 @@
|
|||
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');
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
UPDATE `vn`.`osTicketConfig`
|
||||
SET oldStatus='1,6'
|
||||
WHERE id=0;
|
||||
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`)
|
||||
VALUES ('ItemShelvingSale','*','*','ALLOW','employee');
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE `vn`.`supplier` ADD UNIQUE (name, countryFk);
|
|
@ -1,4 +0,0 @@
|
|||
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;
|
|
@ -1,3 +0,0 @@
|
|||
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');
|
|
@ -1,23 +0,0 @@
|
|||
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;
|
|
@ -1,5 +0,0 @@
|
|||
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';
|
|
@ -1,6 +0,0 @@
|
|||
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;
|
|
@ -1,5 +0,0 @@
|
|||
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';
|
|
@ -1,18 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
|
||||
VALUES ('VnUser', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
||||
|
||||
INSERT INTO `salix`.`ACL` (id, model, property, accessType, permission, principalType, principalId)
|
||||
VALUES ('VnUser', 'acl', 'READ', 'ALLOW', 'ROLE', 'account');
|
||||
|
||||
INSERT INTO `salix`.`ACL` (id, model, property, accessType, permission, principalType, principalId)
|
||||
VALUES ('VnUser', 'getCurrentUserData', 'READ', 'ALLOW', 'ROLE', 'account');
|
||||
|
||||
INSERT INTO `salix`.`ACL` (id, model, property, accessType, permission, principalType, principalId)
|
||||
VALUES ('VnUser', 'changePassword', '*', 'ALLOW', 'ROLE', 'account');
|
||||
|
||||
|
||||
|
||||
UPDATE `hedera`.`imageCollection` t
|
||||
SET t.model = 'VnUser'
|
||||
WHERE t.id = 6;
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Tag', 'onSubmit', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
|
@ -1,24 +0,0 @@
|
|||
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;
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
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 ;
|
|
@ -1,6 +0,0 @@
|
|||
UPDATE `vn`.`client`
|
||||
SET isToBeMailed = FALSE
|
||||
WHERE
|
||||
mailAddress is NULL
|
||||
AND email is NULL
|
||||
AND isToBeMailed = TRUE;
|
|
@ -1,3 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Client', 'getClientOrSupplierReference', 'READ', 'ALLOW', 'ROLE', 'employee');
|
|
@ -1,127 +0,0 @@
|
|||
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 ;
|
|
@ -1,6 +0,0 @@
|
|||
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';
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (model,property,accessType,principalId)
|
||||
VALUES
|
||||
('NotificationSubscription','*','*','employee'),
|
||||
('NotificationAcl','*','READ','employee');
|
|
@ -1,4 +0,0 @@
|
|||
ALTER TABLE `vn`.`itemConfig` ADD warehouseFk smallint(6) unsigned NULL;
|
||||
UPDATE `vn`.`itemConfig`
|
||||
SET warehouseFk=60
|
||||
WHERE id=0;
|
|
@ -1,4 +0,0 @@
|
|||
ALTER TABLE
|
||||
`util`.`notificationSubscription`
|
||||
ADD
|
||||
CONSTRAINT `notificationSubscription_UN` UNIQUE KEY (`notificationFk`, `userFk`);
|
|
@ -1,7 +0,0 @@
|
|||
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`);
|
|
@ -1,3 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('ItemConfig', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -1,16 +0,0 @@
|
|||
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);
|
|
@ -1,15 +0,0 @@
|
|||
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');
|
|
@ -1,74 +0,0 @@
|
|||
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 ;
|
|
@ -1,6 +0,0 @@
|
|||
ALTER TABLE vn.invoiceOutSerial
|
||||
ADD `type` ENUM('global', 'quick') DEFAULT NULL NULL;
|
||||
|
||||
UPDATE vn.invoiceOutSerial
|
||||
SET type = 'global'
|
||||
WHERE code IN ('A','V');
|
|
@ -1,6 +0,0 @@
|
|||
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;
|
||||
|
|
@ -1,258 +0,0 @@
|
|||
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 tmp.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 tmp.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 tmp.ticketToInvoice els tickets que no han de ser facturats
|
||||
DELETE ti.*
|
||||
FROM tmp.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 tmp.ticketToInvoice t
|
||||
JOIN sale s ON s.ticketFk = t.id;
|
||||
|
||||
SELECT COUNT(*) > 0 INTO vIsAnyServiceToInvoice
|
||||
FROM tmp.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,
|
||||
siiTypeInvoiceOutFk
|
||||
)
|
||||
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 tmp.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 tmp.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 tmp.ticketToInvoice ti;
|
||||
|
||||
CALL invoiceExpenseMake(vNewInvoiceId);
|
||||
CALL invoiceTaxMake(vNewInvoiceId,vTaxArea);
|
||||
|
||||
UPDATE invoiceOut io
|
||||
JOIN (
|
||||
SELECT SUM(amount) total
|
||||
FROM invoiceOutExpense
|
||||
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 tmp.ticketToInvoice;
|
||||
|
||||
CALL `ticket_getTax`('NATIONAL');
|
||||
|
||||
SET @vTaxableBaseServices := 0.00;
|
||||
SET @vTaxCodeGeneral := NULL;
|
||||
|
||||
INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
|
||||
SELECT vNewInvoiceInFk,
|
||||
@vTaxableBaseServices,
|
||||
sub.expenseFk,
|
||||
sub.taxTypeSageFk,
|
||||
sub.transactionTypeSageFk
|
||||
FROM (
|
||||
SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase,
|
||||
i.expenseFk,
|
||||
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, expenseFk, taxTypeSageFk, transactionTypeSageFk)
|
||||
SELECT vNewInvoiceInFk,
|
||||
SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral,
|
||||
@vTaxableBaseServices, 0) taxableBase,
|
||||
i.expenseFk,
|
||||
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 tmp.`ticketToInvoice`;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,3 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES ('Operator', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||
('Operator', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
|
@ -1,16 +0,0 @@
|
|||
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;
|
|
@ -1,4 +0,0 @@
|
|||
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');
|
|
@ -1,14 +0,0 @@
|
|||
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');
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
INSERT INTO `salix`.`ACL` ( model, property, accessType, permission, principalType, principalId)
|
||||
VALUES('Mail', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue