Merge branch 'dev' into 6669_ticketClosure
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
9f40cbc123
|
@ -1,4 +1,6 @@
|
|||
node_modules
|
||||
print/node_modules
|
||||
front/node_modules
|
||||
services
|
||||
front
|
||||
db
|
||||
e2e
|
||||
storage
|
||||
|
|
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
|
||||
|
|
|
@ -3,122 +3,191 @@
|
|||
def PROTECTED_BRANCH
|
||||
def FROM_GIT
|
||||
def RUN_TESTS
|
||||
def RUN_BUILD
|
||||
|
||||
def BRANCH_ENV = [
|
||||
test: 'test',
|
||||
master: 'production'
|
||||
]
|
||||
|
||||
node {
|
||||
stage('Setup') {
|
||||
env.BACK_REPLICAS = 1
|
||||
env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev'
|
||||
|
||||
PROTECTED_BRANCH = [
|
||||
'dev',
|
||||
'test',
|
||||
'master'
|
||||
].contains(env.BRANCH_NAME)
|
||||
|
||||
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
|
||||
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
|
||||
RUN_BUILD = PROTECTED_BRANCH && FROM_GIT
|
||||
|
||||
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
||||
echo "NODE_NAME: ${env.NODE_NAME}"
|
||||
echo "WORKSPACE: ${env.WORKSPACE}"
|
||||
|
||||
configFileProvider([
|
||||
configFile(fileId: 'salix.properties',
|
||||
variable: 'PROPS_FILE')
|
||||
]) {
|
||||
def props = readProperties file: PROPS_FILE
|
||||
props.each {key, value -> env."${key}" = value }
|
||||
props.each {key, value -> echo "${key}: ${value}" }
|
||||
}
|
||||
|
||||
if (PROTECTED_BRANCH) {
|
||||
configFileProvider([
|
||||
configFile(fileId: "salix.branch.${env.BRANCH_NAME}",
|
||||
variable: 'BRANCH_PROPS_FILE')
|
||||
]) {
|
||||
def props = readProperties file: BRANCH_PROPS_FILE
|
||||
props.each {key, value -> env."${key}" = value }
|
||||
props.each {key, value -> echo "${key}: ${value}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pipeline {
|
||||
agent any
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
}
|
||||
tools {
|
||||
nodejs 'node-v20'
|
||||
}
|
||||
environment {
|
||||
PROJECT_NAME = 'salix'
|
||||
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||
}
|
||||
tools {
|
||||
nodejs 'node-v20'
|
||||
}
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
script {
|
||||
switch (env.BRANCH_NAME) {
|
||||
case 'dev':
|
||||
env.NODE_ENV = 'dev'
|
||||
env.BACK_REPLICAS = 1
|
||||
break
|
||||
case 'test':
|
||||
env.NODE_ENV = 'test'
|
||||
env.BACK_REPLICAS = 2
|
||||
break
|
||||
case 'master':
|
||||
env.NODE_ENV = 'production'
|
||||
env.BACK_REPLICAS = 4
|
||||
break
|
||||
}
|
||||
|
||||
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()
|
||||
|
||||
PROTECTED_BRANCH = [
|
||||
'dev',
|
||||
'test',
|
||||
'master'
|
||||
].contains(env.BRANCH_NAME)
|
||||
|
||||
FROM_GIT = JOB_NAME.startsWith('gitea/')
|
||||
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
|
||||
}
|
||||
setEnv()
|
||||
}
|
||||
}
|
||||
stage('Install') {
|
||||
environment {
|
||||
NODE_ENV = ""
|
||||
NODE_ENV = ''
|
||||
}
|
||||
parallel {
|
||||
stage('Backend') {
|
||||
stage('Back') {
|
||||
steps {
|
||||
sh 'npm install --no-audit --prefer-offline'
|
||||
}
|
||||
}
|
||||
stage('Frontend') {
|
||||
when {
|
||||
expression { return FROM_GIT }
|
||||
}
|
||||
steps {
|
||||
sh 'npm install --no-audit --prefer-offline --prefix=front'
|
||||
sh 'pnpm install --prefer-offline'
|
||||
}
|
||||
}
|
||||
stage('Print') {
|
||||
when {
|
||||
expression { return FROM_GIT }
|
||||
expression { FROM_GIT }
|
||||
}
|
||||
steps {
|
||||
sh 'npm install --no-audit --prefer-offline --prefix=print'
|
||||
sh 'pnpm install --prefer-offline --prefix=print'
|
||||
}
|
||||
}
|
||||
stage('Front') {
|
||||
when {
|
||||
expression { FROM_GIT }
|
||||
}
|
||||
steps {
|
||||
sh 'pnpm install --prefer-offline --prefix=front'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
when {
|
||||
expression { return RUN_TESTS }
|
||||
}
|
||||
environment {
|
||||
NODE_ENV = ""
|
||||
TZ = 'Europe/Madrid'
|
||||
}
|
||||
stage('Stack') {
|
||||
parallel {
|
||||
stage('Backend') {
|
||||
steps {
|
||||
sh 'npm run test:back:ci'
|
||||
stage('Back') {
|
||||
stages {
|
||||
stage('Test') {
|
||||
when {
|
||||
expression { RUN_TESTS }
|
||||
}
|
||||
environment {
|
||||
NODE_ENV = ''
|
||||
}
|
||||
steps {
|
||||
sh 'npm run test:back:ci'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit(
|
||||
testResults: 'junitresults.xml',
|
||||
allowEmptyResults: true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
when {
|
||||
expression { RUN_BUILD }
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
def packageJson = readJSON file: 'package.json'
|
||||
env.VERSION = packageJson.version
|
||||
}
|
||||
sh 'docker-compose build back'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Frontend') {
|
||||
steps {
|
||||
sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=6'
|
||||
stage('Front') {
|
||||
when {
|
||||
expression { FROM_GIT }
|
||||
}
|
||||
stages {
|
||||
stage('Test') {
|
||||
when {
|
||||
expression { RUN_TESTS }
|
||||
}
|
||||
environment {
|
||||
NODE_ENV = ''
|
||||
}
|
||||
steps {
|
||||
sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=10'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit(
|
||||
testResults: 'junit.xml',
|
||||
allowEmptyResults: true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
when {
|
||||
expression { RUN_BUILD }
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
def packageJson = readJSON file: 'package.json'
|
||||
env.VERSION = packageJson.version
|
||||
}
|
||||
sh 'gulp build'
|
||||
sh 'docker-compose build front'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
stage('Push') {
|
||||
when {
|
||||
expression { return PROTECTED_BRANCH && FROM_GIT }
|
||||
expression { RUN_BUILD }
|
||||
}
|
||||
environment {
|
||||
CREDENTIALS = credentials('docker-registry')
|
||||
}
|
||||
steps {
|
||||
sh 'gulp build'
|
||||
dockerBuild()
|
||||
script {
|
||||
def packageJson = readJSON file: 'package.json'
|
||||
env.VERSION = packageJson.version
|
||||
}
|
||||
sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY'
|
||||
sh 'docker-compose push'
|
||||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
when {
|
||||
expression { return PROTECTED_BRANCH }
|
||||
expression { PROTECTED_BRANCH }
|
||||
}
|
||||
parallel {
|
||||
stage('Database') {
|
||||
|
@ -136,12 +205,16 @@ pipeline {
|
|||
}
|
||||
stage('Docker') {
|
||||
when {
|
||||
expression { return FROM_GIT }
|
||||
expression { FROM_GIT }
|
||||
}
|
||||
environment {
|
||||
DOCKER_HOST = "${env.SWARM_HOST}"
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
def packageJson = readJSON file: 'package.json'
|
||||
env.VERSION = packageJson.version
|
||||
}
|
||||
sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}"
|
||||
}
|
||||
}
|
||||
|
@ -149,21 +222,14 @@ pipeline {
|
|||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
if (RUN_TESTS) {
|
||||
try {
|
||||
junit 'junitresults.xml'
|
||||
junit 'junit.xml'
|
||||
} catch (e) {
|
||||
echo e.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
success {
|
||||
script {
|
||||
if (env.BRANCH_NAME == 'master' && FROM_GIT) {
|
||||
env.GIT_COMMIT_MSG = sh(
|
||||
script: 'git log -1 --pretty=%B ${GIT_COMMIT}',
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
String message = env.GIT_COMMIT_MSG
|
||||
int index = message.indexOf('\n')
|
||||
if (index != -1)
|
||||
|
@ -180,6 +246,7 @@ pipeline {
|
|||
}
|
||||
}
|
||||
unsuccessful {
|
||||
setEnv()
|
||||
sendEmail()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ RUN apt-get update \
|
|||
graphicsmagick \
|
||||
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
||||
&& apt-get install -y --no-install-recommends nodejs \
|
||||
&& npm install -g npm@9.6.6
|
||||
&& corepack enable pnpm
|
||||
|
||||
# Puppeteer
|
||||
|
||||
|
@ -39,12 +39,12 @@ RUN apt-get update \
|
|||
|
||||
WORKDIR /salix
|
||||
|
||||
COPY print/package.json print/package-lock.json print/
|
||||
RUN npm --prefix ./print install --omit=dev ./print
|
||||
COPY print/package.json print/pnpm-lock.yaml print/
|
||||
RUN pnpm install --prod --prefix=print
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
COPY loopback/package.json loopback/
|
||||
RUN npm install --omit=dev
|
||||
RUN pnpm install --prod
|
||||
|
||||
COPY loopback loopback
|
||||
COPY back back
|
|
@ -49,7 +49,6 @@ module.exports = Self => {
|
|||
Self.uploadFile = async(ctx, options) => {
|
||||
const models = Self.app.models;
|
||||
const TempContainer = models.TempContainer;
|
||||
const DmsContainer = models.DmsContainer;
|
||||
const fileOptions = {};
|
||||
const args = ctx.args;
|
||||
|
||||
|
@ -79,19 +78,21 @@ module.exports = Self => {
|
|||
|
||||
const addedDms = [];
|
||||
for (const uploadedFile of files) {
|
||||
const newDms = await createDms(ctx, uploadedFile, myOptions);
|
||||
const pathHash = DmsContainer.getHash(newDms.id);
|
||||
|
||||
const file = await TempContainer.getFile(tempContainer.name, uploadedFile.name);
|
||||
srcFile = path.join(file.client.root, file.container, file.name);
|
||||
|
||||
const dmsContainer = await DmsContainer.container(pathHash);
|
||||
const dstFile = path.join(dmsContainer.client.root, pathHash, newDms.file);
|
||||
|
||||
await fs.move(srcFile, dstFile, {
|
||||
overwrite: true
|
||||
});
|
||||
|
||||
const data = {
|
||||
workerFk: ctx.req.accessToken.userId,
|
||||
dmsTypeFk: args.dmsTypeId,
|
||||
companyFk: args.companyId,
|
||||
warehouseFk: args.warehouseId,
|
||||
reference: args.reference,
|
||||
description: args.description,
|
||||
contentType: args.contentType,
|
||||
hasFile: args.hasFile
|
||||
};
|
||||
const extension = await models.DmsContainer.getFileExtension(uploadedFile.name);
|
||||
const newDms = await Self.createFromFile(data, extension, srcFile, myOptions);
|
||||
addedDms.push(newDms);
|
||||
}
|
||||
|
||||
|
@ -107,27 +108,4 @@ module.exports = Self => {
|
|||
throw e;
|
||||
}
|
||||
};
|
||||
|
||||
async function createDms(ctx, file, myOptions) {
|
||||
const models = Self.app.models;
|
||||
const myUserId = ctx.req.accessToken.userId;
|
||||
const args = ctx.args;
|
||||
|
||||
const newDms = await Self.create({
|
||||
workerFk: myUserId,
|
||||
dmsTypeFk: args.dmsTypeId,
|
||||
companyFk: args.companyId,
|
||||
warehouseFk: args.warehouseId,
|
||||
reference: args.reference,
|
||||
description: args.description,
|
||||
contentType: file.type,
|
||||
hasFile: args.hasFile
|
||||
}, myOptions);
|
||||
|
||||
let fileName = file.name;
|
||||
const extension = models.DmsContainer.getFileExtension(fileName);
|
||||
fileName = `${newDms.id}.${extension}`;
|
||||
|
||||
return newDms.updateAttribute('file', fileName, myOptions);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -8,6 +8,26 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.validatesUniquenessOf('bic', {
|
||||
message: 'This BIC already exist.'
|
||||
message: 'This BIC already exist'
|
||||
});
|
||||
|
||||
Self.validatesPresenceOf('countryFk', {
|
||||
message: 'CountryFK cannot be empty'
|
||||
});
|
||||
|
||||
Self.validateAsync('bic', checkBic, {
|
||||
message: 'Bank entity id must be specified'
|
||||
});
|
||||
async function checkBic(err, done) {
|
||||
const filter = {
|
||||
fields: ['code'],
|
||||
where: {id: this.countryFk}
|
||||
};
|
||||
const country = await Self.app.models.Country.findOne(filter);
|
||||
const code = country ? country.code.toLowerCase() : null;
|
||||
|
||||
if (code == 'es' && !this.id)
|
||||
err();
|
||||
done();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = Self => {
|
||||
require('../methods/dms/downloadFile')(Self);
|
||||
|
@ -35,4 +37,32 @@ module.exports = Self => {
|
|||
|
||||
return [stream, dms.contentType, `filename="${dms.file}"`];
|
||||
};
|
||||
|
||||
Self.getPath = async function(dms) {
|
||||
const models = Self.app.models;
|
||||
const pathHash = await models.DmsContainer.getHash(dms.id);
|
||||
const dmsContainer = await models.DmsContainer.container(pathHash);
|
||||
const dstFile = path.join(dmsContainer.client.root, pathHash, dms.file);
|
||||
return dstFile;
|
||||
};
|
||||
|
||||
Self.createWithExtension = async function(data, extension, options) {
|
||||
const newDms = await Self.create(data, options);
|
||||
return newDms.updateAttribute('file', `${newDms.id}.${extension}`, options);
|
||||
};
|
||||
|
||||
Self.createFromFile = async function(data, extension, srcFile, options) {
|
||||
const dms = await Self.createWithExtension(data, extension, options);
|
||||
const dstFile = await Self.getPath(dms);
|
||||
await fs.move(srcFile, dstFile, {overwrite: true});
|
||||
return dms;
|
||||
};
|
||||
|
||||
Self.createFromStream = async function(data, extension, stream, options) {
|
||||
const dms = await Self.createWithExtension(data, extension, options);
|
||||
const dstFile = await Self.getPath(dms);
|
||||
const writeStream = await fs.createWriteStream(dstFile);
|
||||
await stream.pipe(writeStream);
|
||||
return dms;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/* eslint-disable no-console */
|
||||
const app = require('vn-loopback/server/server');
|
||||
let dataSources = require('../loopback/server/datasources.json');
|
||||
|
||||
async function init() {
|
||||
console.log('Initializing backend.');
|
||||
|
||||
dataSources = JSON.parse(JSON.stringify(dataSources));
|
||||
Object.assign(dataSources.vn, {
|
||||
host: process.env.DB_HOST,
|
||||
port: process.env.DB_PORT
|
||||
});
|
||||
|
||||
const bootOptions = {dataSources};
|
||||
await new Promise((resolve, reject) => {
|
||||
app.boot(bootOptions,
|
||||
err => err ? reject(err) : resolve());
|
||||
});
|
||||
// FIXME: Workaround to wait for loopback to be ready
|
||||
await app.models.Application.status();
|
||||
}
|
||||
|
||||
async function deinit() {
|
||||
console.log('Stopping backend.');
|
||||
await app.disconnect();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
init,
|
||||
deinit
|
||||
};
|
||||
|
||||
if (require.main === module)
|
||||
init();
|
159
back/tests.js
159
back/tests.js
|
@ -1,104 +1,123 @@
|
|||
/* eslint-disable no-console */
|
||||
const path = require('path');
|
||||
const getopts = require('getopts');
|
||||
const Myt = require('@verdnatura/myt/myt');
|
||||
const Run = require('@verdnatura/myt/myt-run');
|
||||
let dataSources = require('../loopback/server/datasources.json');
|
||||
const helper = require('./tests-helper');
|
||||
|
||||
let server;
|
||||
|
||||
process.on('warning', warning => {
|
||||
console.log(warning.name);
|
||||
console.log(warning.message);
|
||||
console.log(warning.stack);
|
||||
const opts = getopts(process.argv.slice(2), {
|
||||
string: [
|
||||
'network'
|
||||
],
|
||||
boolean: [
|
||||
'ci',
|
||||
'junit'
|
||||
]
|
||||
});
|
||||
|
||||
process.on('SIGUSR2', rmServer);
|
||||
process.on('exit', rmServer);
|
||||
let server;
|
||||
const PARALLEL = false;
|
||||
const SETUP_TIMEOUT = 15 * 60 * 1000;
|
||||
const SPEC_TIMEOUT = 30 * 1000;
|
||||
|
||||
async function rmServer() {
|
||||
if (!server) return;
|
||||
await server.rm();
|
||||
server = null;
|
||||
}
|
||||
process.on('exit', teardown);
|
||||
process.on('uncaughtException', onError);
|
||||
process.on('unhandledRejection', onError);
|
||||
|
||||
async function test() {
|
||||
const exitSignals = [
|
||||
'SIGINT',
|
||||
'SIGUSR1',
|
||||
'SIGUSR2'
|
||||
];
|
||||
for (const signal of exitSignals)
|
||||
process.on(signal, () => process.exit());
|
||||
|
||||
async function setup() {
|
||||
console.log('Building and running DB container.');
|
||||
|
||||
const isCI = process.argv[2] === 'ci';
|
||||
|
||||
const myt = new Myt();
|
||||
await myt.init({
|
||||
workspace: path.join(__dirname, '..'),
|
||||
random: true,
|
||||
ci: isCI,
|
||||
ci: opts.ci,
|
||||
tmpfs: process.platform == 'linux',
|
||||
network: isCI ? 'jenkins' : null
|
||||
network: opts.network || null
|
||||
});
|
||||
server = await myt.run(Run);
|
||||
await myt.deinit();
|
||||
|
||||
const {dbConfig} = server;
|
||||
process.env.DB_HOST = dbConfig.host;
|
||||
process.env.DB_PORT = dbConfig.port;
|
||||
|
||||
console.log('Initializing backend.');
|
||||
if (!PARALLEL)
|
||||
await helper.init();
|
||||
}
|
||||
|
||||
dataSources = JSON.parse(JSON.stringify(dataSources));
|
||||
Object.assign(dataSources.vn, {
|
||||
host: dbConfig.host,
|
||||
port: dbConfig.port
|
||||
});
|
||||
async function teardown() {
|
||||
if (!server) return;
|
||||
const oldServer = server;
|
||||
server = null;
|
||||
|
||||
const bootOptions = {dataSources};
|
||||
const app = require('vn-loopback/server/server');
|
||||
await new Promise((resolve, reject) => {
|
||||
app.boot(bootOptions,
|
||||
err => err ? reject(err) : resolve());
|
||||
});
|
||||
// FIXME: Workaround to wait for loopback to be ready
|
||||
await app.models.Application.status();
|
||||
if (!PARALLEL)
|
||||
await helper.deinit();
|
||||
|
||||
console.log('Running tests.');
|
||||
console.log('Stopping and removing DB container.');
|
||||
await oldServer.rm();
|
||||
}
|
||||
|
||||
const Jasmine = require('jasmine');
|
||||
const jasmine = new Jasmine();
|
||||
async function onError(err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
|
||||
jasmine.addReporter(new SpecReporter({
|
||||
spec: {
|
||||
displaySuccessful: isCI,
|
||||
displayPending: isCI
|
||||
},
|
||||
summary: {
|
||||
displayPending: false,
|
||||
}
|
||||
}));
|
||||
async function test() {
|
||||
let runner;
|
||||
const config = {
|
||||
globalSetup: setup,
|
||||
globalSetupTimeout: SETUP_TIMEOUT,
|
||||
globalTeardown: teardown,
|
||||
globalTeardownTimeout: SETUP_TIMEOUT,
|
||||
spec_dir: '.',
|
||||
spec_files: [
|
||||
'back/**/*[sS]pec.js',
|
||||
'loopback/**/*[sS]pec.js',
|
||||
'modules/*/back/**/*.[sS]pec.js'
|
||||
],
|
||||
helpers: []
|
||||
};
|
||||
|
||||
if (isCI) {
|
||||
const JunitReporter = require('jasmine-reporters');
|
||||
jasmine.addReporter(new JunitReporter.JUnitXmlReporter());
|
||||
if (PARALLEL) {
|
||||
const ParallelRunner = require('jasmine/parallel');
|
||||
runner = new ParallelRunner({numWorkers: 1});
|
||||
config.helpers.push(`back/tests-helper.js`);
|
||||
} else {
|
||||
const Jasmine = require('jasmine');
|
||||
runner = new Jasmine();
|
||||
|
||||
jasmine.exitOnCompletion = true;
|
||||
jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 900000;
|
||||
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
|
||||
runner.addReporter(new SpecReporter({
|
||||
spec: {
|
||||
displaySuccessful: opts.ci,
|
||||
displayPending: opts.ci
|
||||
},
|
||||
summary: {
|
||||
displayPending: false,
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
const backSpecs = [
|
||||
'./back/**/*[sS]pec.js',
|
||||
'./loopback/**/*[sS]pec.js',
|
||||
'./modules/*/back/**/*.[sS]pec.js'
|
||||
];
|
||||
if (opts.junit) {
|
||||
const JunitReporter = require('jasmine-reporters');
|
||||
runner.addReporter(new JunitReporter.JUnitXmlReporter());
|
||||
}
|
||||
if (opts.ci)
|
||||
runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = SPEC_TIMEOUT;
|
||||
|
||||
jasmine.loadConfig({
|
||||
spec_dir: '.',
|
||||
spec_files: backSpecs,
|
||||
helpers: [],
|
||||
});
|
||||
|
||||
await jasmine.execute();
|
||||
|
||||
console.log('Stopping.');
|
||||
|
||||
if (app) await app.disconnect();
|
||||
await rmServer();
|
||||
|
||||
console.log('Tests ended.\n');
|
||||
// runner.loadConfigFile('back/jasmine.json');
|
||||
runner.loadConfig(config);
|
||||
process.env.SPEC_IS_RUNNING = true;
|
||||
await runner.execute();
|
||||
}
|
||||
|
||||
test();
|
||||
|
|
|
@ -30,7 +30,7 @@ INSERT INTO vn.buy (id,entryFk,itemFk,quantity,dispatched,buyingValue,freightVal
|
|||
(18,10,15,500,0,55.0,1.0,0,1,1,1,0,0.0,1.0,'5',0.0,78.3,75.6,0.0,0,0,1,0,'2022-06-20 00:00:00',0,2.5),
|
||||
(19,10,11,5000,0,50.0,1.0,0,1,1,1,1,0.0,1.0,'4',0.0,99.6,99.4,0.0,0,0,1,0,'2022-06-20 00:00:00',0,2.5);
|
||||
*/
|
||||
INSERT INTO vn2008.Splits (Id_Split,Id_Ticket,Id_Entrada,Fecha,Notas)
|
||||
INSERT INTO vn.split (id,ticketFk,entryFk,dated,note)
|
||||
VALUES
|
||||
(1,7,2,'00-00-0000 00:00:00.000','nota1'),
|
||||
(2,10,6,'00-00-0000 00:00:00.000','nota2'),
|
||||
|
@ -66,16 +66,14 @@ UPDATE vn.supplier
|
|||
SET isTrucker = 1
|
||||
WHERE id = 2;
|
||||
|
||||
INSERT INTO vn.cmr (id, truckPlate, observations, senderInstruccions, paymentInstruccions, specialAgreements, created, companyFk, addressToFk, addressFromFk, supplierFk, packagesList, merchandiseDetail, state, landed, ead)
|
||||
VALUES (2, NULL, NULL, NULL, 'Carriage paid', NULL, '2022-06-27 13:31:11.000', 442, 3, 2, 2, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
-- XXX: tpv
|
||||
|
||||
UPDATE `vn`.`claimRatio` SET `claimAmount` = '10' WHERE (`clientFk` = '1101');
|
||||
|
||||
INSERT INTO `vn`.`agency` (`name`, `warehouseFk`, `warehouseAliasFk`, `isOwn`, `isAnyVolumeAllowed`) VALUES
|
||||
('Agencia', '1', '1', '1', '1'),
|
||||
('Otra agencia ', '1', '2', '0', '0');
|
||||
INSERT INTO `vn`.`agency` (`name`, `warehouseFk`, `isOwn`, `isAnyVolumeAllowed`)
|
||||
VALUES
|
||||
('Agencia', '1', '1', '1'),
|
||||
('Otra agencia ', '1', '0', '0');
|
||||
|
||||
INSERT INTO `vn`.`expedition` (`agencyModeFk`, `ticketFk`, `isBox`, `counter`, `workerFk`, `externalId`, `packagingFk`, `hostFk`, `itemPackingTypeFk`, `hasNewRoute`) VALUES
|
||||
('1', '1', 1, '1', '1', '1', '1', 'pc00', 'F', 0),
|
||||
|
|
|
@ -174,23 +174,18 @@ INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`,
|
|||
(19,'Francia', 1, 'FR', 1, 27, 4, 0, 1),
|
||||
(30,'Canarias', 1, 'IC', 1, 24, 4, 1, 2);
|
||||
|
||||
INSERT INTO `vn`.`warehouseAlias`(`id`, `name`)
|
||||
INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasDms`, `hasComission`, `countryFk`, `hasProduction`, `isOrigin`, `isDestiny`)
|
||||
VALUES
|
||||
(1, 'Main Warehouse'),
|
||||
(2, 'Gotham');
|
||||
(1, 'Warehouse One', 'ALG', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||
(2, 'Warehouse Two', NULL, 1, 1, 1, 1, 0, 1, 13, 1, 1, 0),
|
||||
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0),
|
||||
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1),
|
||||
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0),
|
||||
(13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 1, 0, 0, 0),
|
||||
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0);
|
||||
|
||||
INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasDms`, `hasComission`, `aliasFk`, `countryFk`, `hasProduction`)
|
||||
VALUES
|
||||
(1, 'Warehouse One', 'ALG', 1, 1, 1, 1, 1, 1, 2, 1, 1),
|
||||
(2, 'Warehouse Two', NULL, 1, 1, 1, 1, 0, 1, 2, 13, 1),
|
||||
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
|
||||
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
|
||||
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
|
||||
(13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 2, 1, 0),
|
||||
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 2, 1, 0);
|
||||
|
||||
INSERT INTO `vn`.`sectorType` (id,description)
|
||||
VALUES (1,'First type');
|
||||
INSERT INTO `vn`.`sectorType` (`id`, `code`)
|
||||
VALUES (1,'normal');
|
||||
|
||||
INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `code`, `typeFk`)
|
||||
VALUES
|
||||
|
@ -271,18 +266,18 @@ INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
|
|||
(3, 'PICKUP', 'Recogida'),
|
||||
(4, 'OTHER', 'Otros');
|
||||
|
||||
INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `warehouseAliasFk`)
|
||||
INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`)
|
||||
VALUES
|
||||
(1, 'inhouse pickup' , 1, 1),
|
||||
(2, 'Super-Man delivery' , 1, 1),
|
||||
(3, 'Teleportation device' , 1, 1),
|
||||
(4, 'Entanglement' , 1, 1),
|
||||
(5, 'Quantum break device' , 1, 1),
|
||||
(6, 'Walking' , 1, 1),
|
||||
(7, 'Gotham247' , 1, 1),
|
||||
(8, 'Gotham247Expensive' , 1, 1),
|
||||
(9, 'Refund' , 1, 1),
|
||||
(10, 'Other agency' , 1, 1);
|
||||
(1, 'inhouse pickup' , 1),
|
||||
(2, 'Super-Man delivery' , 1),
|
||||
(3, 'Teleportation device' , 1),
|
||||
(4, 'Entanglement' , 1),
|
||||
(5, 'Quantum break device' , 1),
|
||||
(6, 'Walking' , 1),
|
||||
(7, 'Gotham247' , 1),
|
||||
(8, 'Gotham247Expensive' , 1),
|
||||
(9, 'Refund' , 1),
|
||||
(10, 'Other agency' , 1);
|
||||
|
||||
UPDATE `vn`.`agencyMode` SET `id` = 1 WHERE `name` = 'inhouse pickup';
|
||||
UPDATE `vn`.`agencyMode` SET `id` = 2 WHERE `name` = 'Super-Man delivery';
|
||||
|
@ -569,13 +564,13 @@ INSERT INTO `vn`.`supplierActivity`(`code`, `name`)
|
|||
|
||||
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`)
|
||||
VALUES
|
||||
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
||||
(2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
||||
(69, 'Packaging', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
||||
(442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
|
||||
(567, 'Holland', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
||||
(791, 'Bros SL', 'Bros nick', 5115000791, 1, '37718083S', 0, util.VN_CURDATE(), 1, 'supplier address 7', 'ASGARD', 3, 46600, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
|
||||
(1381, 'Ornamentales', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V');
|
||||
(1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
||||
(2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
||||
(69, 'PACKAGING', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
||||
(442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
|
||||
(567, 'HOLLAND', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
||||
(791, 'BROS SL', 'Bros nick', 5115000791, 1, '37718083S', 0, util.VN_CURDATE(), 1, 'supplier address 7', 'ASGARD', 3, 46600, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
|
||||
(1381, 'ORNAMENTALES', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V');
|
||||
|
||||
INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`)
|
||||
VALUES
|
||||
|
@ -730,40 +725,40 @@ INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agen
|
|||
(6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 3),
|
||||
(7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 5);
|
||||
|
||||
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`)
|
||||
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`, `cmrFk`)
|
||||
VALUES
|
||||
(1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1),
|
||||
(2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 1, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2),
|
||||
(3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL),
|
||||
(4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL),
|
||||
(5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL),
|
||||
(6 , 1, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL),
|
||||
(7 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(8 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Bat cave', 121, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(9 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(10, 1, 1, 5, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'Ingram Street', 2, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(11, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(12, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(13, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(14, 1, 2, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1104, 'Malibu Point', 4, NULL, 0, 9, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(15, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(16, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(17, 1, 7, 2, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +12 HOUR), NULL),
|
||||
(19, 1, 5, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(20, 1, 5, 5, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL),
|
||||
(21, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL),
|
||||
(22, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Japan', 103, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL),
|
||||
(23, NULL, 8, 1, 7, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'address 21', 121, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(24 ,NULL, 8, 1, 7, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(25 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(26 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(27 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(28, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(29, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(30, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
|
||||
(32, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL);
|
||||
(1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1),
|
||||
(2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 1, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 2),
|
||||
(3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 3),
|
||||
(4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, NULL),
|
||||
(5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, NULL),
|
||||
(6 , 1, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, NULL),
|
||||
(7 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(8 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Bat cave', 121, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(9 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(10, 1, 1, 5, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'Ingram Street', 2, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(11, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(12, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(13, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(14, 1, 2, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1104, 'Malibu Point', 4, NULL, 0, 9, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(15, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(16, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(17, 1, 7, 2, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +12 HOUR), NULL, NULL),
|
||||
(19, 1, 5, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(20, 1, 5, 5, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL),
|
||||
(21, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL),
|
||||
(22, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Japan', 103, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL),
|
||||
(23, NULL, 8, 1, 7, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'address 21', 121, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(24 ,NULL, 8, 1, 7, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(25 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(26 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(27 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(28, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(29, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(30, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
|
||||
(32, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL);
|
||||
|
||||
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
|
||||
VALUES
|
||||
|
@ -2410,7 +2405,7 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
|
|||
(14, 'Ticket', 1, 1, 'ticket'),
|
||||
(15, 'Presupuestos', NULL, NULL, 'budgets'),
|
||||
(16, 'Logistica', NULL, NULL, 'logistics'),
|
||||
(17, 'cmr', NULL, NULL, 'cmr'),
|
||||
(17, 'cmr', 1, 1, 'cmr'),
|
||||
(18, 'dua', NULL, NULL, 'dua'),
|
||||
(19, 'inmovilizado', NULL, NULL, 'fixedAssets'),
|
||||
(20, 'Reclamación', 1, 1, 'claim');
|
||||
|
@ -3067,3 +3062,8 @@ INSERT INTO `vn`.`clientSms` (`id`, `clientFk`, `smsFk`, `ticketFk`)
|
|||
(4, 1103, 4, 32),
|
||||
(13, 1101, 1, NULL),
|
||||
(14, 1101, 4, 27);
|
||||
|
||||
INSERT INTO `vn`.`cmr` (id,truckPlate,observations,senderInstruccions,paymentInstruccions,specialAgreements,companyFk,addressToFk,addressFromFk,supplierFk,packagesList,merchandiseDetail,state)
|
||||
VALUES (1,'123456A','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',442,1,2,1,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'),
|
||||
(2,'123456N','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',69,3,4,2,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'),
|
||||
(3,'123456B','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',567,5,6,69,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet');
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `bi`.`nz`(vData DOUBLE)
|
||||
RETURNS double
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve 0, si el parámetro es NULL:
|
||||
*/
|
||||
DECLARE vResult DOUBLE;
|
||||
|
||||
SET vResult = IFNULL(vData,0);
|
||||
|
||||
RETURN vResult;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,5 +1,5 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`analisis_ventas_update`()
|
||||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`analisis_ventas_update`()
|
||||
BEGIN
|
||||
DECLARE vLastMonth DATE;
|
||||
|
||||
|
@ -32,7 +32,7 @@ BEGIN
|
|||
tm.year AS Año,
|
||||
tm.month AS Mes,
|
||||
tm.week AS Semana,
|
||||
v.vista AS Vista,
|
||||
dm.description AS Vista,
|
||||
bt.importe AS Importe
|
||||
FROM bs.ventas bt
|
||||
LEFT JOIN vn2008.Tipos tp ON tp.tipo_id = bt.tipo_id
|
||||
|
@ -44,10 +44,10 @@ BEGIN
|
|||
JOIN vn2008.Movimientos m ON m.Id_Movimiento = bt.Id_Movimiento
|
||||
LEFT JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket
|
||||
JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia
|
||||
LEFT JOIN vn2008.Vistas v ON v.vista_id = a.Vista
|
||||
LEFT JOIN vn.deliveryMethod dm ON dm.id = a.Vista
|
||||
LEFT JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.Id_Consigna
|
||||
LEFT JOIN vn2008.province p ON p.province_id = cs.province_id
|
||||
LEFT JOIN vn2008.warehouse w ON w.id = t.warehouse_id
|
||||
LEFT JOIN vn.warehouse w ON w.id = t.warehouse_id
|
||||
WHERE bt.fecha >= vLastMonth AND r.mercancia;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -130,13 +130,13 @@ BEGIN
|
|||
-- Calculamos el porcentaje del recobro para añadirlo al precio de venta
|
||||
UPDATE bi.claims_ratio cr
|
||||
JOIN (
|
||||
SELECT Id_Cliente, nz(SUM(Importe)) AS Greuge
|
||||
SELECT Id_Cliente, IFNULL(SUM(Importe), 0) AS Greuge
|
||||
FROM vn2008.Greuges
|
||||
WHERE Fecha <= util.VN_CURDATE()
|
||||
GROUP BY Id_Cliente
|
||||
) g ON g.Id_Cliente = cr.Id_Cliente
|
||||
SET recobro = GREATEST(0,round(nz(Greuge) /
|
||||
(nz(Consumo) * vMonthToRefund / 12 ) ,3));
|
||||
SET recobro = GREATEST(0,round(IFNULL(Greuge, 0) /
|
||||
(IFNULL(Consumo, 0) * vMonthToRefund / 12 ) ,3));
|
||||
|
||||
-- Protección neonatos
|
||||
UPDATE bi.claims_ratio cr
|
||||
|
|
|
@ -20,16 +20,16 @@ BEGIN
|
|||
c.movil,
|
||||
c.POBLACION poblacion,
|
||||
p.`name` provincia,
|
||||
vn2008.red(f.futur) futur,
|
||||
ROUND(f.futur, 2) futur,
|
||||
c.Credito credito,
|
||||
pm.`name` forma_pago,
|
||||
vn2008.red(c365 / 12) consumo_medio365,
|
||||
vn2008.red(c365) consumo365,
|
||||
vn2008.red(CmLy.peso) peso_mes_año_pasado,
|
||||
vn2008.red(CmLy.peso * 1.19) objetivo,
|
||||
ROUND(c365 / 12, 2) consumo_medio365,
|
||||
ROUND(c365, 2) consumo365,
|
||||
ROUND(CmLy.peso, 2) peso_mes_año_pasado,
|
||||
ROUND(CmLy.peso * 1.19, 2) objetivo,
|
||||
tr.CodigoTrabajador,
|
||||
vn2008.red(mes_actual.consumo) consumoMes,
|
||||
vn2008.red(IFNULL(mes_actual.consumo, 0) - IFNULL(CmLy.peso * 1.19, 0)) como_lo_llevo,
|
||||
ROUND(mes_actual.consumo, 2) consumoMes,
|
||||
ROUND(IFNULL(mes_actual.consumo, 0) - IFNULL(CmLy.peso * 1.19, 0), 2) como_lo_llevo,
|
||||
DATE(LastTicket) ultimo_ticket,
|
||||
dead.muerto,
|
||||
g.Greuge,
|
||||
|
|
|
@ -5,7 +5,8 @@ proc: BEGIN
|
|||
DECLARE vReserveDate DATETIME;
|
||||
DECLARE vParams CHAR(100);
|
||||
DECLARE vInventoryDate DATE;
|
||||
DECLARE vIsLogifloraDay BOOLEAN;
|
||||
DECLARE vLifeScope DATE;
|
||||
DECLARE vWarehouseFkInventory INT;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
|
@ -26,43 +27,42 @@ proc: BEGIN
|
|||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
-- Invoca al procedimiento que genera el stock virtual de Logiflora, si coincide con la peticion de refresco del disponible
|
||||
IF vn.isLogifloraDay(vDated, vWarehouse) THEN
|
||||
-- CALL edi.floramondo_offerRefresh;
|
||||
SET vIsLogifloraDay = TRUE;
|
||||
ELSE
|
||||
SET vIsLogifloraDay = FALSE;
|
||||
END IF;
|
||||
|
||||
-- Calcula algunos parámetros necesarios
|
||||
SET vStartDate = TIMESTAMP(vDated, '00:00:00');
|
||||
SELECT inventoried INTO vInventoryDate FROM vn.config;
|
||||
SELECT DATE_SUB(vStartDate, INTERVAL MAX(life) DAY) INTO vLifeScope FROM vn.itemType;
|
||||
SELECT SUBTIME(util.VN_NOW(), reserveTime) INTO vReserveDate
|
||||
FROM hedera.orderConfig;
|
||||
|
||||
SELECT w.id INTO vWarehouseFkInventory
|
||||
FROM vn.warehouse w
|
||||
WHERE w.code = 'inv';
|
||||
|
||||
-- Calcula el ultimo dia de vida para cada producto
|
||||
DROP TEMPORARY TABLE IF EXISTS itemRange;
|
||||
CREATE TEMPORARY TABLE itemRange
|
||||
(PRIMARY KEY (itemFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT c.itemFk,
|
||||
IF(it.life IS NULL,
|
||||
NULL,
|
||||
TIMESTAMP(TIMESTAMPADD(DAY, it.life, c.landing), '23:59:59')) ended
|
||||
FROM (
|
||||
SELECT b.itemFk, MAX(t.landed) landing
|
||||
FROM vn.buy b
|
||||
JOIN vn.entry e ON b.entryFk = e.id
|
||||
JOIN vn.travel t ON t.id = e.travelFk
|
||||
JOIN vn.warehouse w ON w.id = t.warehouseInFk
|
||||
WHERE t.landed BETWEEN vInventoryDate AND vStartDate
|
||||
AND t.warehouseInFk = vWarehouse
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
GROUP BY b.itemFk
|
||||
) c
|
||||
JOIN vn.item i ON i.id = c.itemFk
|
||||
SELECT i.id itemFk,
|
||||
util.dayEnd(DATE_ADD(c.maxLanded, INTERVAL it.life DAY)) ended, it.life
|
||||
FROM vn.item i
|
||||
LEFT JOIN (
|
||||
SELECT b.itemFk, MAX(t.landed) maxLanded
|
||||
FROM vn.buy b
|
||||
JOIN vn.entry e ON b.entryFk = e.id
|
||||
JOIN vn.travel t ON t.id = e.travelFk
|
||||
JOIN vn.warehouse w ON w.id = t.warehouseInFk
|
||||
JOIN vn.item i ON i.id = b.itemFk
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
WHERE t.landed BETWEEN vLifeScope AND vStartDate
|
||||
AND t.warehouseInFk = vWarehouse
|
||||
AND t.warehouseOutFk <> vWarehouseFkInventory
|
||||
AND it.life
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
GROUP BY b.itemFk
|
||||
) c ON i.id = c.itemFk
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
HAVING ended >= vStartDate OR ended IS NULL;
|
||||
HAVING ended >= vStartDate OR life IS NULL;
|
||||
|
||||
-- Calcula el ATP
|
||||
DELETE FROM available WHERE calc_id = vCalc;
|
||||
|
@ -86,7 +86,7 @@ proc: BEGIN
|
|||
WHERE i.landed >= vStartDate
|
||||
AND (ir.ended IS NULL OR i.landed <= ir.ended)
|
||||
AND i.warehouseInFk = vWarehouse
|
||||
AND (ISNULL(wf.entryFk) OR vIsLogifloraDay)
|
||||
AND ISNULL(wf.entryFk)
|
||||
UNION ALL
|
||||
SELECT i.itemFk, i.shipped, i.quantity
|
||||
FROM vn.itemEntryOut i
|
||||
|
|
|
@ -22,6 +22,7 @@ proc:BEGIN
|
|||
DECLARE vHasItemGroup BOOL;
|
||||
DECLARE vDescription VARCHAR(255);
|
||||
DECLARE vSaleFk INT;
|
||||
DECLARE vDefaultEntry INT;
|
||||
|
||||
-- Carga los datos necesarios del EKT
|
||||
SELECT e.ref, qty, package, putOrderFk MOD 1000000, i2.id , NOT ISNULL(eea.addressFk), NOT ISNULL(igto.group_code),
|
||||
|
@ -41,6 +42,9 @@ proc:BEGIN
|
|||
CALL vn.mail_insert('pako@verdnatura.es', 'nocontestar@verdnatura.es', CONCAT('Nuevo grupo en Floramondo: ', vDescription), vDescription);
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
SELECT defaultEntry INTO vDefaultEntry
|
||||
FROM vn.entryConfig;
|
||||
|
||||
-- Asigna la entrada
|
||||
SELECT vn.ekt_getEntry(vSelf) INTO vEntryFk;
|
||||
|
@ -100,10 +104,9 @@ proc:BEGIN
|
|||
LEFT JOIN ekt l ON l.ref = e.ref
|
||||
LEFT JOIN vn.buy b ON b.ektFk = l.id
|
||||
LEFT JOIN vn.item i ON i.id = b.itemFk
|
||||
JOIN vn2008.config cfg
|
||||
WHERE e.id = vSelf
|
||||
AND l.id != vSelf
|
||||
AND b.itemFk != cfg.generic_item
|
||||
AND b.itemFk != vDefaultEntry
|
||||
AND IF(t.s1, l.s1 = e.s1, TRUE)
|
||||
AND IF(t.s2, l.s2 = e.s2, TRUE)
|
||||
AND IF(t.s3, l.s3 = e.s3, TRUE)
|
||||
|
@ -142,7 +145,7 @@ proc:BEGIN
|
|||
SELECT vEntryFk,
|
||||
vSelf,
|
||||
(@t := IF(i.stems, i.stems, 1)) * e.pri / IFNULL(i.stemMultiplier, 1) buyingValue,
|
||||
IFNULL(vItem, cfg.generic_item) itemFk,
|
||||
IFNULL(vItem, vDefaultEntry) itemFk,
|
||||
e.qty stickers,
|
||||
@pac := IFNULL(i.stemMultiplier, 1) * e.pac / @t packing,
|
||||
IFNULL(b.`grouping`, e.pac),
|
||||
|
@ -153,8 +156,7 @@ proc:BEGIN
|
|||
FROM ekt e
|
||||
LEFT JOIN vn.buy b ON b.id = vBuy
|
||||
LEFT JOIN vn.item i ON i.id = b.itemFk
|
||||
LEFT JOIN vn.supplier s ON e.pro = s.id
|
||||
JOIN vn2008.config cfg
|
||||
LEFT JOIN vn.supplier s ON e.pro = s.id
|
||||
WHERE e.id = vSelf
|
||||
LIMIT 1;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ DELIMITER $$
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `edi`.`ekt_scan`(vBarcode VARCHAR(512))
|
||||
BEGIN
|
||||
/**
|
||||
* Busca transaciones a partir de un código de barras, las marca como escaneadas
|
||||
* Busca transaciones a partir de un codigo de barras, las marca como escaneadas
|
||||
* y las devuelve.
|
||||
* Ver https://wiki.verdnatura.es/index.php/Ekt#Algoritmos_de_lectura
|
||||
*
|
||||
|
@ -73,7 +73,7 @@ BEGIN
|
|||
INSERT INTO tmp.ekt
|
||||
SELECT id
|
||||
FROM ekt
|
||||
WHERE fec = vFec
|
||||
WHERE fec >= vFec - INTERVAL 1 DAY
|
||||
AND ((
|
||||
vKlo = vDefaultKlo
|
||||
AND (klo = vKlo OR klo IS NULL OR klo = 0)
|
||||
|
@ -82,7 +82,7 @@ BEGIN
|
|||
AND auction = vAuction
|
||||
AND agj = vShortAgj)
|
||||
)
|
||||
ORDER BY agj DESC
|
||||
ORDER BY agj DESC, fec DESC
|
||||
LIMIT 1;
|
||||
|
||||
SELECT COUNT(*) FROM tmp.ekt INTO vIsFound;
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `edi`.`ektK2`
|
||||
AS SELECT `eek`.`id` AS `id`,
|
||||
`eek`.`description` AS `description`
|
||||
FROM `edi`.`ektK1` `eek`
|
|
@ -0,0 +1,58 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`accountNumberToIban`(
|
||||
vAccount VARCHAR(20)
|
||||
)
|
||||
RETURNS varchar(4) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
/**
|
||||
* Calcula y genera el código IBAN correspondiente
|
||||
* a un número de cuenta bancaria español.
|
||||
*
|
||||
* @param vAccount Número de cuenta bancaria
|
||||
* @return vIban Código IBAN de 4 caracteres.
|
||||
*/
|
||||
DECLARE vIban VARCHAR(4);
|
||||
|
||||
SELECT
|
||||
CONCAT('ES',
|
||||
RIGHT(
|
||||
CONCAT(0,
|
||||
98-MOD(
|
||||
CONCAT(
|
||||
MOD(
|
||||
CONCAT(
|
||||
MOD(
|
||||
CONCAT(
|
||||
MOD(
|
||||
SUBSTRING(vAccount, 1, 8),
|
||||
97
|
||||
),
|
||||
SUBSTRING(vAccount,9,8)
|
||||
),
|
||||
97
|
||||
),
|
||||
SUBSTRING(
|
||||
CONCAT(vAccount, 142800),
|
||||
17,
|
||||
8
|
||||
)
|
||||
),
|
||||
97
|
||||
),
|
||||
SUBSTRING(
|
||||
CONCAT(vAccount, 142800),
|
||||
25,
|
||||
2
|
||||
)
|
||||
),
|
||||
97
|
||||
)
|
||||
),
|
||||
2
|
||||
)
|
||||
) INTO vIban;
|
||||
|
||||
RETURN vIban;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,32 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`intrastat_estimateNet`(
|
||||
vSelf INT,
|
||||
vStems INT
|
||||
)
|
||||
RETURNS double
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
/**
|
||||
* Calcula un valor neto estimado en función de
|
||||
* datos históricos de facturas intrastat.
|
||||
*
|
||||
* @param vSelf Id de intrastat
|
||||
* @param vStems Número de unidades
|
||||
* @return vNet
|
||||
*/
|
||||
DECLARE vNet DOUBLE;
|
||||
|
||||
SELECT ROUND(vStems / (SUM(average) / COUNT(average)), 2) INTO vNet
|
||||
FROM (
|
||||
SELECT *, stems / net average
|
||||
FROM invoiceInIntrastat
|
||||
WHERE intrastatFk = vSelf
|
||||
AND net
|
||||
AND stems > 0
|
||||
ORDER BY dated DESC
|
||||
LIMIT 20
|
||||
) sub;
|
||||
|
||||
RETURN vNet/2;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,14 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`nz`(vQuantity DOUBLE)
|
||||
RETURNS double
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
|
||||
DECLARE vResult DOUBLE;
|
||||
|
||||
SET vResult = IFNULL(vQuantity,0);
|
||||
|
||||
RETURN vResult;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -74,6 +74,8 @@ BEGIN
|
|||
WHERE b.id = vSelf;
|
||||
|
||||
END IF;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
|
||||
SELECT vSelf id;
|
||||
CALL buy_checkItem();
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_checkItem`()
|
||||
BEGIN
|
||||
/**
|
||||
* Checks if the item has weightByPiece or size null on any buy.
|
||||
*
|
||||
* @param tmp.buysToCheck(id as INT).
|
||||
*/
|
||||
DECLARE hasVolumetricAgency INT;
|
||||
|
||||
SELECT a.hasWeightVolumetric INTO hasVolumetricAgency
|
||||
FROM entry e
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
JOIN agencyMode a ON a.id = t.agencyModeFk
|
||||
JOIN buy b ON b.entryFk = e.id
|
||||
JOIN item i ON i.id = b.itemFk
|
||||
JOIN tmp.buysToCheck bt ON bt.id = b.id
|
||||
WHERE (i.weightByPiece IS NULL OR i.`size` IS NULL)
|
||||
AND a.hasWeightVolumetric
|
||||
LIMIT 1;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.buysToCheck;
|
||||
|
||||
IF hasVolumetricAgency THEN
|
||||
CALL util.throw('Some purchase line has an item without size or weight per stem in the volumetric agency.');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -88,6 +88,7 @@ BEGIN
|
|||
FROM vn.expeditionTruck
|
||||
WHERE eta < v3Month;
|
||||
|
||||
DELETE FROM XDiario WHERE FECHA < v3Month OR FECHA IS NULL;
|
||||
-- borrar travels sin entradas
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete;
|
||||
CREATE TEMPORARY TABLE tmp.thermographToDelete
|
||||
|
|
|
@ -48,7 +48,7 @@ BEGIN
|
|||
SELECT lc.companyFk,
|
||||
c.id,
|
||||
0,
|
||||
- (NZ(lc.credit) - NZ(lc.debit))
|
||||
- (IFNULL(lc.credit, 0) - IFNULL(lc.debit, 0))
|
||||
FROM tmp.ledgerComparative lc
|
||||
JOIN client c ON c.accountingAccount = lc.account
|
||||
WHERE lc.`date` BETWEEN vDateFrom AND vDateTo
|
||||
|
|
|
@ -70,9 +70,9 @@ BEGIN
|
|||
ish.created,
|
||||
ish.visible,
|
||||
IFNULL(
|
||||
IF(st.description = 'previousByPacking', ish.packing, g.`grouping`),
|
||||
IF(st.code = 'previousByPacking', ish.packing, g.`grouping`),
|
||||
1) `grouping`,
|
||||
st.description = 'previousPrepared' isPreviousPrepared,
|
||||
st.code = 'previousPrepared' isPreviousPrepared,
|
||||
iss.id itemShelvingSaleFk,
|
||||
ts.ticketFk,
|
||||
iss.id,
|
||||
|
|
|
@ -44,7 +44,7 @@ BEGIN
|
|||
|
||||
IF vCounter > 0 OR vASIEN > 0 THEN
|
||||
|
||||
UPDATE vn2008.XDiario x
|
||||
UPDATE vn.XDiario x
|
||||
JOIN vn.ledgerConfig lc ON lc.lastBookEntry = x.ASIEN
|
||||
SET x.ASIEN = vASIEN;
|
||||
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`fustControl`(vFromDated DATE, vToDated DATE)
|
||||
BEGIN
|
||||
|
||||
DECLARE vSijsnerClientFk INT DEFAULT 19752;
|
||||
|
||||
DECLARE vDateStart DATETIME;
|
||||
DECLARE vDateEnd DATETIME;
|
||||
|
||||
SET vDateStart = vFromDated;
|
||||
SET vDateEnd = util.Dayend(vToDated);
|
||||
|
||||
SELECT p.id FustCode,
|
||||
CAST(sent.stucks AS DECIMAL(10,0)) FH,
|
||||
CAST(tp.stucks AS DECIMAL(10,0)) Tickets,
|
||||
CAST(-sj.stucks AS DECIMAL(10,0)) Sijsner,
|
||||
CAST(IFNULL(sent.stucks,0) - IFNULL(tp.stucks,0) + IFNULL(sj.stucks,0) AS DECIMAL(10,0)) saldo
|
||||
FROM vn.packaging p
|
||||
LEFT JOIN (
|
||||
SELECT FustCode, sum(fustQuantity) stucks
|
||||
FROM (
|
||||
SELECT IFNULL(pe.equivalentFk ,b.packagingFk) FustCode, s.quantity / b.packing AS fustQuantity
|
||||
FROM vn.sale s
|
||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||
JOIN vn.warehouse w ON w.id = t.warehouseFk
|
||||
JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk
|
||||
JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = t.warehouseFk
|
||||
JOIN vn.buy b ON b.id = lb.buy_id
|
||||
JOIN vn.packaging p ON p.id = b.packagingFk
|
||||
LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id
|
||||
JOIN vn.address a ON a.id = t.addressFk
|
||||
JOIN vn.province p2 ON p2.id = a.provinceFk
|
||||
JOIN vn.country c ON c.id = p2.countryFk
|
||||
WHERE t.shipped BETWEEN vDateStart AND vDateEnd
|
||||
AND wa.name = 'VNH'
|
||||
AND p.isPackageReturnable
|
||||
AND c.country = 'FRANCIA') sub
|
||||
GROUP BY FustCode) sent ON sent.FustCode = p.id
|
||||
LEFT JOIN (
|
||||
SELECT FustCode, sum(quantity) stucks
|
||||
FROM (
|
||||
SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity
|
||||
FROM vn.ticketPackaging tp
|
||||
JOIN vn.ticket t ON t.id = tp.ticketFk
|
||||
JOIN vn.warehouse w ON w.id = t.warehouseFk
|
||||
JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk
|
||||
JOIN vn.packaging p ON p.id = tp.packagingFk
|
||||
LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id
|
||||
JOIN vn.address a ON a.id = t.addressFk
|
||||
JOIN vn.province p2 ON p2.id = a.provinceFk
|
||||
JOIN vn.country c ON c.id = p2.countryFk
|
||||
WHERE t.shipped BETWEEN vDateStart AND vDateEnd
|
||||
AND wa.name = 'VNH'
|
||||
AND p.isPackageReturnable
|
||||
AND c.country = 'FRANCIA'
|
||||
AND t.clientFk != vSijsnerClientFk
|
||||
AND tp.quantity > 0) sub
|
||||
GROUP BY FustCode) tp ON tp.FustCode = p.id
|
||||
LEFT JOIN (
|
||||
SELECT FustCode, sum(quantity) stucks
|
||||
FROM (
|
||||
SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity
|
||||
FROM vn.ticketPackaging tp
|
||||
JOIN vn.ticket t ON t.id = tp.ticketFk
|
||||
JOIN vn.warehouse w ON w.id = t.warehouseFk
|
||||
JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk
|
||||
JOIN vn.packaging p ON p.id = tp.packagingFk
|
||||
LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id
|
||||
WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, 1, vDateStart ) AND TIMESTAMPADD(DAY, 1, vDateEnd )
|
||||
AND wa.name = 'VNH'
|
||||
AND p.isPackageReturnable
|
||||
AND t.clientFk = vSijsnerClientFk) sub
|
||||
GROUP BY FustCode) sj ON sj.FustCode = p.id
|
||||
WHERE sent.stucks
|
||||
OR tp.stucks
|
||||
OR sj.stucks;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,36 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`fustControlDetail`(vFromDated DATE, vToDated DATE)
|
||||
BEGIN
|
||||
|
||||
DECLARE vSijsnerClientFk INT DEFAULT 19752;
|
||||
|
||||
DECLARE vDateStart DATETIME;
|
||||
DECLARE vDateEnd DATETIME;
|
||||
|
||||
SET vDateStart = vFromDated;
|
||||
SET vDateEnd = util.Dayend(vToDated);
|
||||
|
||||
SELECT a.nickname shopName,
|
||||
a.city ,
|
||||
IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode,
|
||||
tp.quantity,
|
||||
tp.ticketFk,
|
||||
CONCAT('From ', vFromDated,' to ', vToDated) AS dateRange
|
||||
FROM vn.ticketPackaging tp
|
||||
JOIN vn.ticket t ON t.id = tp.ticketFk
|
||||
JOIN vn.warehouse w ON w.id = t.warehouseFk
|
||||
JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk
|
||||
JOIN vn.packaging p ON p.id = tp.packagingFk
|
||||
LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id
|
||||
JOIN vn.address a ON a.id = t.addressFk
|
||||
JOIN vn.province p2 ON p2.id = a.provinceFk
|
||||
JOIN vn.country c ON c.id = p2.countryFk
|
||||
WHERE t.shipped BETWEEN vFromDated AND util.dayend(vToDated)
|
||||
AND wa.name = 'VNH'
|
||||
AND p.isPackageReturnable
|
||||
AND c.country = 'FRANCIA'
|
||||
AND t.clientFk != vSijsnerClientFk
|
||||
AND tp.quantity > 0;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,234 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `sage`.`invoiceIn_add`(vInvoiceInFk INT, vXDiarioFk INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Traslada la info de contabilidad relacionada con las facturas recibidas
|
||||
*
|
||||
* @vInvoiceInFk Factura recibida
|
||||
* @vXDiarioFk Id tabla XDiario
|
||||
*/
|
||||
DECLARE vInvoiceInOriginalFk INT;
|
||||
DECLARE vDone BOOL DEFAULT FALSE;
|
||||
DECLARE vBase DOUBLE;
|
||||
DECLARE vVat DOUBLE;
|
||||
DECLARE vRate DOUBLE;
|
||||
DECLARE vTransactionCode INT;
|
||||
DECLARE vCounter INT DEFAULT 0;
|
||||
DECLARE vTransactionCodeOld INT;
|
||||
DECLARE vTaxCode INT;
|
||||
DECLARE vTaxCodeOld INT;
|
||||
DECLARE vOperationCode VARCHAR(1);
|
||||
DECLARE vIsIntracommunity BOOL DEFAULT FALSE;
|
||||
DECLARE vSerialDua VARCHAR(1) DEFAULT 'D';
|
||||
DECLARE vInvoiceTypeReceived VARCHAR(1);
|
||||
DECLARE vInvoiceTypeInformative VARCHAR(1);
|
||||
DECLARE vIsInformativeExportation BOOL DEFAULT FALSE;
|
||||
|
||||
DECLARE vCursor CURSOR FOR
|
||||
SELECT it.taxableBase,
|
||||
CAST((( it.taxableBase / 100) * t.PorcentajeIva) AS DECIMAL (10,2)),
|
||||
t.PorcentajeIva,
|
||||
it.transactionTypeSageFk,
|
||||
it.taxTypeSageFk,
|
||||
tty.isIntracommunity,
|
||||
tt.ClaveOperacionDefecto
|
||||
FROM vn.invoiceIn i
|
||||
JOIN vn.invoiceInTax it ON it.InvoiceInFk = i.id
|
||||
JOIN TiposIva t ON t.CodigoIva = it.taxTypeSageFk
|
||||
JOIN taxType tty ON tty.id = t.CodigoIva
|
||||
JOIN TiposTransacciones tt ON tt.CodigoTransaccion = it.transactionTypeSageFk
|
||||
LEFT JOIN vn.dua d ON d.id = vInvoiceInFk
|
||||
WHERE i.id = vInvoiceInFk
|
||||
AND d.id IS NULL;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
DELETE FROM movContaIVA
|
||||
WHERE id = vXDiarioFk;
|
||||
|
||||
SELECT codeSage INTO vInvoiceTypeReceived
|
||||
FROM invoiceType WHERE code ='received';
|
||||
|
||||
SELECT codeSage INTO vInvoiceTypeInformative
|
||||
FROM invoiceType WHERE code ='informative';
|
||||
|
||||
INSERT INTO movContaIVA(id, LibreA1)
|
||||
VALUES (vXDiarioFk, vInvoiceInFk);
|
||||
|
||||
OPEN vCursor;
|
||||
|
||||
l: LOOP
|
||||
FETCH vCursor INTO vBase,
|
||||
vVat,
|
||||
vRate,
|
||||
vTransactionCode,
|
||||
vTaxCode,
|
||||
vIsIntracommunity,
|
||||
vOperationCode;
|
||||
|
||||
IF vDone THEN
|
||||
LEAVE l;
|
||||
END IF;
|
||||
|
||||
SET vTransactionCodeOld = vTransactionCode;
|
||||
SET vTaxCodeOld = vTaxCode;
|
||||
|
||||
IF vOperationCode IS NOT NULL THEN
|
||||
UPDATE movContaIVA
|
||||
SET ClaveOperacionFactura = vOperationCode
|
||||
WHERE id = vXDiarioFk;
|
||||
END IF;
|
||||
|
||||
SET vCounter = vCounter + 1;
|
||||
CASE vCounter
|
||||
WHEN 1 THEN
|
||||
UPDATE movContaIVA
|
||||
SET BaseIva1 = vBase,
|
||||
PorIva1 = vRate,
|
||||
CuotaIva1 = vVat,
|
||||
CodigoTransaccion1 = vTransactionCode,
|
||||
CodigoIva1 = vTaxCode
|
||||
WHERE id = vXDiarioFk;
|
||||
|
||||
WHEN 2 THEN
|
||||
UPDATE movContaIVA
|
||||
SET BaseIva2 = vBase,
|
||||
PorIva2 = vRate,
|
||||
CuotaIva2 = vVat,
|
||||
CodigoTransaccion2 = vTransactionCode,
|
||||
CodigoIva2 = vTaxCode
|
||||
WHERE id = vXDiarioFk;
|
||||
WHEN 3 THEN
|
||||
UPDATE movContaIVA
|
||||
SET BaseIva3 = vBase,
|
||||
PorIva3 = vRate,
|
||||
CuotaIva3 = vVat,
|
||||
CodigoTransaccion3 = vTransactionCode,
|
||||
CodigoIva3 = vTaxCode
|
||||
WHERE id = vXDiarioFk;
|
||||
WHEN 4 THEN
|
||||
UPDATE movContaIVA
|
||||
SET BaseIva4 = vBase,
|
||||
PorIva4 = vRate,
|
||||
CuotaIva4 = vVat,
|
||||
CodigoTransaccion4 = vTransactionCode,
|
||||
CodigoIva4 = vTaxCode
|
||||
WHERE id = vXDiarioFk;
|
||||
ELSE
|
||||
SELECT vXDiarioFk INTO vXDiarioFk;
|
||||
END CASE;
|
||||
|
||||
IF vIsIntracommunity THEN
|
||||
UPDATE movContaIVA
|
||||
SET Intracomunitaria = TRUE
|
||||
WHERE id = vXDiarioFk;
|
||||
END IF;
|
||||
|
||||
SET vTransactionCodeOld = vTransactionCode;
|
||||
SET vTaxCodeOld = vTaxCode;
|
||||
|
||||
END LOOP;
|
||||
|
||||
CLOSE vCursor;
|
||||
|
||||
SELECT d.ASIEN AND x.ASIEN IS NULL INTO vIsInformativeExportation
|
||||
FROM vn.dua d
|
||||
LEFT JOIN vn.XDiario x ON x.ASIEN = d.ASIEN
|
||||
AND x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci
|
||||
WHERE d.ASIEN = (
|
||||
SELECT ASIEN
|
||||
FROM vn.XDiario
|
||||
WHERE id = vXDiarioFk)
|
||||
LIMIT 1;
|
||||
|
||||
UPDATE movContaIVA mci
|
||||
JOIN tmp.invoiceIn ii ON ii.id = vInvoiceInFk
|
||||
JOIN vn.XDiario x ON x.id = mci.id
|
||||
LEFT JOIN tmp.invoiceDua id ON id.id = mci.id
|
||||
JOIN vn.supplier s ON s.id = ii.supplierFk
|
||||
JOIN Naciones n ON n.countryFk = s.countryFk
|
||||
SET mci.CodigoDivisa = ii.currencyFk,
|
||||
mci.Año = YEAR(ii.issued),
|
||||
mci.Serie = ii.serial,
|
||||
mci.Factura = ii.id,
|
||||
mci.FechaFactura = ii.issued,
|
||||
mci.ImporteFactura = IFNULL(mci.BaseIva1, 0) + IFNULL(mci.CuotaIva1, 0) +
|
||||
IFNULL(mci.BaseIva2, 0) + IFNULL(mci.CuotaIva2, 0) +
|
||||
IFNULL(mci.BaseIva3, 0) + IFNULL(mci.CuotaIva3, 0) +
|
||||
IFNULL(mci.BaseIva4, 0) + IFNULL(mci.CuotaIva4, 0),
|
||||
mci.TipoFactura = IF(id.id,
|
||||
IF( ii.serial = vSerialDua COLLATE utf8mb3_unicode_ci, vInvoiceTypeReceived, vInvoiceTypeInformative),
|
||||
IF(vIsInformativeExportation,vInvoiceTypeInformative, vInvoiceTypeReceived)),
|
||||
mci.CodigoCuentaFactura = x.SUBCTA,
|
||||
mci.CifDni = IF(LEFT(TRIM(s.nif), 2) = n.SiglaNacion, SUBSTRING(TRIM(s.nif), 3), s.nif),
|
||||
mci.Nombre = s.name,
|
||||
mci.SiglaNacion = n.SiglaNacion,
|
||||
mci.EjercicioFactura = YEAR(ii.issued),
|
||||
mci.FechaOperacion = ii.issued,
|
||||
mci.MantenerAsiento = TRUE,
|
||||
mci.SuFacturaNo = ii.supplierRef,
|
||||
mci.IvaDeducible1 = IF(id.id, FALSE, IF(IFNULL(mci.BaseIva1, FALSE) = FALSE, FALSE, ii.isVatDeductible)),
|
||||
mci.IvaDeducible2 = IF(id.id, FALSE, IF(IFNULL(mci.BaseIva2, FALSE) = FALSE, FALSE, ii.isVatDeductible)),
|
||||
mci.IvaDeducible3 = IF(id.id, FALSE, IF(IFNULL(mci.BaseIva3, FALSE) = FALSE, FALSE, ii.isVatDeductible)),
|
||||
mci.IvaDeducible4 = IF(id.id, FALSE, IF(IFNULL(mci.BaseIva4, FALSE) = FALSE, FALSE, ii.isVatDeductible)),
|
||||
mci.FechaFacturaOriginal = x.FECHA_EX
|
||||
WHERE mci.id = vXDiarioFk;
|
||||
|
||||
-- RETENCIONES
|
||||
UPDATE movContaIVA mci
|
||||
JOIN vn.invoiceIn ii ON ii.id = vInvoiceInFk
|
||||
JOIN vn.XDiario x ON x.id = mci.id
|
||||
JOIN vn.supplier s ON s.id = supplierFk
|
||||
JOIN vn.invoiceInTax iit ON iit.invoiceInFk = ii.id
|
||||
JOIN vn.expense e ON e.id = iit.expenseFk
|
||||
JOIN TiposRetencion t ON t.CodigoRetencion = ii.withholdingSageFk
|
||||
LEFT JOIN tmp.invoiceDua id ON id.id = mci.id
|
||||
JOIN (SELECT SUM(x2.BASEEURO) taxableBase, SUM(x2.EURODEBE) taxBase
|
||||
FROM vn.XDiario x1
|
||||
JOIN vn.XDiario x2 ON x1.ASIEN = x2.ASIEN
|
||||
WHERE x2.BASEEURO <> 0
|
||||
AND x1.id = vXDiarioFk
|
||||
)sub
|
||||
JOIN ClavesOperacion co ON co.Descripcion = 'Arrendamiento de locales de negocio'
|
||||
SET mci.CodigoRetencion = t.CodigoRetencion,
|
||||
mci.ClaveOperacionFactura = IF( t.Retencion = 'ARRENDAMIENTO Y SUBARRENDAMIENTO', co.ClaveOperacionFactura_, mci.ClaveOperacionFactura),
|
||||
mci.BaseRetencion = IF (t.Retencion = 'ACTIVIDADES AGRICOLAS O GANADERAS', sub.taxableBase + sub.taxBase, sub.taxableBase),
|
||||
mci.PorRetencion = t.PorcentajeRetencion,
|
||||
mci.ImporteRetencion = iit.taxableBase * - 1
|
||||
WHERE mci.id = vXDiarioFk
|
||||
AND e.name = 'Retenciones'
|
||||
AND id.id IS NULL;
|
||||
|
||||
SELECT correctedFk INTO vInvoiceInOriginalFk
|
||||
FROM vn.invoiceInCorrection
|
||||
WHERE correctingFk = vInvoiceInFk;
|
||||
|
||||
IF vInvoiceInOriginalFk THEN
|
||||
|
||||
UPDATE movContaIVA mci
|
||||
JOIN vn.invoiceInRefund iir ON iir.invoiceInRefundFk = vInvoiceInFk
|
||||
JOIN (SELECT issued,
|
||||
SUM(sub.taxableBase) taxableBase,
|
||||
SUM(ROUND((sub.taxableBase * sub.PorcentajeIva) / 100 , 2)) vat
|
||||
FROM(SELECT issued,
|
||||
SUM(iit.taxableBase) taxableBase,
|
||||
ti.PorcentajeIva
|
||||
FROM vn.invoiceIn i
|
||||
JOIN vn.invoiceInTax iit ON iit.invoiceInFk = i.id
|
||||
JOIN sage.TiposIva ti ON ti.CodigoIva = iit.taxTypeSageFk
|
||||
WHERE i.id = vInvoiceInOriginalFk
|
||||
GROUP BY ti.CodigoIva)sub
|
||||
)invoiceInOriginal
|
||||
JOIN ClavesOperacion co ON co.Descripcion = 'Factura rectificativa'
|
||||
SET mci.TipoRectificativa = iir.refundCategoryFk,
|
||||
mci.ClaseAbonoRectificativas = iir.refundType,
|
||||
mci.FechaFacturaOriginal = invoiceInOriginal.issued,
|
||||
mci.FechaOperacion = invoiceInOriginal.issued,
|
||||
mci.BaseImponibleOriginal = invoiceInOriginal.taxableBase,
|
||||
mci.CuotaIvaOriginal = invoiceInOriginal.vat,
|
||||
mci.ClaveOperacionFactura = co.ClaveOperacionFactura_
|
||||
WHERE mci.id = vXDiarioFk;
|
||||
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -8,27 +8,22 @@ BEGIN
|
|||
* @param vItemFk Identificador de vn.item
|
||||
* @param vSectorFk Identificador de vn.sector
|
||||
*/
|
||||
DECLARE vWarehouseAliasFk INT;
|
||||
|
||||
SELECT w.aliasFk INTO vWarehouseAliasFk
|
||||
FROM vn.sector s
|
||||
JOIN vn.warehouse w ON w.id = s.warehouseFk
|
||||
WHERE s.id = vSectorFk;
|
||||
|
||||
SELECT ish.shelvingFk shelving,
|
||||
p.code parking,
|
||||
sum(ish.visible) as stockTotal,
|
||||
ish.created,
|
||||
p.pickingOrder
|
||||
p.code parking,
|
||||
SUM(ish.visible) stockTotal,
|
||||
ish.created,
|
||||
p.pickingOrder
|
||||
FROM vn.itemShelving ish
|
||||
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||
JOIN vn.sector sc ON sc.id = p.sectorFk
|
||||
JOIN vn.warehouse w ON w.id = sc.warehouseFk
|
||||
WHERE w.aliasFk = vWarehouseAliasFk
|
||||
AND ish.visible > 0
|
||||
AND ish.itemFk = vItemFk
|
||||
WHERE sc.id = vSectorFk
|
||||
AND ish.visible > 0
|
||||
AND ish.itemFk = vItemFk
|
||||
GROUP BY ish.id
|
||||
ORDER BY (sc.id = vSectorFk) DESC, sh.priority DESC, ish.created, p.pickingOrder;
|
||||
ORDER BY sh.priority DESC,
|
||||
ish.created,
|
||||
p.pickingOrder;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
DELIMITER ;
|
|
@ -1,7 +1,13 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingRadar`(vSectorFk INT)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingRadar`(
|
||||
vSectorFk INT
|
||||
)
|
||||
proc:BEGIN
|
||||
|
||||
/**
|
||||
* Calcula la información detallada respecto un sector.
|
||||
*
|
||||
* @param vSectorFk Id de sector
|
||||
*/
|
||||
DECLARE vCalcVisibleFk INT;
|
||||
DECLARE vCalcAvailableFk INT;
|
||||
DECLARE hasFatherSector BOOLEAN;
|
||||
|
|
|
@ -15,11 +15,13 @@ BEGIN
|
|||
p.code,
|
||||
ish.id,
|
||||
s.priority,
|
||||
ish.isChecked
|
||||
ish.isChecked,
|
||||
ic.url
|
||||
FROM itemShelving ish
|
||||
JOIN item i ON i.id = ish.itemFk
|
||||
JOIN shelving s ON vSelf = s.code COLLATE utf8_unicode_ci
|
||||
LEFT JOIN parking p ON s.parkingFk = p.id
|
||||
JOIN hedera.imageConfig ic
|
||||
WHERE ish.shelvingFk COLLATE utf8_unicode_ci = vSelf;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -207,7 +207,7 @@ proc: BEGIN
|
|||
ENGINE = MEMORY
|
||||
SELECT ish.itemFk,
|
||||
p.sectorFk,
|
||||
st.description = 'previousPrepared' isPreviousPrepared,
|
||||
st.code = 'previousPrepared' isPreviousPrepared,
|
||||
sc.itemPackingTypeFk
|
||||
FROM itemShelving ish
|
||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
|
|
|
@ -85,7 +85,7 @@ BEGIN
|
|||
JOIN client c ON c.id = t.clientFk
|
||||
JOIN tmp.productionBuffer pb ON pb.ticketFk = t.id
|
||||
JOIN packagingConfig pc
|
||||
WHERE IF(st.description = 'previousByPacking',
|
||||
WHERE IF(st.code = 'previousByPacking',
|
||||
i.`size` > pc.previousPreparationMinimumSize
|
||||
AND (MOD(TRUNCATE(isa.quantity,0), isa.packing)= 0 ),
|
||||
TRUE)
|
||||
|
|
|
@ -21,11 +21,8 @@ BEGIN
|
|||
DECLARE vAgencyModeFk INT;
|
||||
DECLARE vNewPrice DECIMAL(10,2);
|
||||
DECLARE vOldPrice DECIMAL(10,2);
|
||||
DECLARE vOption INT DEFAULT NULL;
|
||||
DECLARE vOption VARCHAR(255);
|
||||
DECLARE vNewSaleFk INT;
|
||||
DECLARE vChangePrice INT DEFAULT 1;
|
||||
DECLARE vBuyerDiscount INT DEFAULT 4;
|
||||
DECLARE vManaDiscount INT DEFAULT 3;
|
||||
DECLARE vForceToGrouping INT DEFAULT 1;
|
||||
DECLARE vForceToPacking INT DEFAULT 2;
|
||||
DECLARE vFinalPrice DECIMAL(10,2);
|
||||
|
@ -85,16 +82,13 @@ BEGIN
|
|||
IF vNewPrice IS NULL THEN
|
||||
CALL util.throw('price retrieval failed');
|
||||
END IF;
|
||||
|
||||
IF vNewPrice > vOldPrice THEN
|
||||
SET vFinalPrice = vOldPrice;
|
||||
IF worker_isInDepartment('vt') THEN
|
||||
SET vOption = vManaDiscount;
|
||||
ELSE
|
||||
SET vOption = vBuyerDiscount;
|
||||
END IF;
|
||||
SET vOption = 'substitution';
|
||||
ELSE
|
||||
SET vFinalPrice = vNewPrice;
|
||||
SET vOption = vChangePrice;
|
||||
SET vOption = 'renewPrices';
|
||||
END IF;
|
||||
|
||||
START TRANSACTION;
|
||||
|
|
|
@ -60,7 +60,7 @@ BEGIN
|
|||
SELECT lc.companyFk,
|
||||
s.id,
|
||||
0,
|
||||
- (NZ(lc.debit) - NZ(lc.credit))
|
||||
- (IFNULL(lc.debit, 0) - IFNULL(lc.credit, 0))
|
||||
FROM tmp.ledgerComparative lc
|
||||
JOIN supplier s ON s.account = lc.account
|
||||
WHERE lc.`date` BETWEEN vDateFrom AND vDateTo
|
||||
|
|
|
@ -31,8 +31,8 @@ BEGIN
|
|||
CALL util.throw('ASSIGN_ZONE_FIRST');
|
||||
END IF;
|
||||
|
||||
SET vCanChangeState = (
|
||||
vStateCode <> 'ON_CHECKING' OR
|
||||
SET vCanChangeState = ((
|
||||
vStateCode <> 'ON_CHECKING' AND vStateCode <> 'CHECKED') OR
|
||||
vticketAlertLevel < vPackedAlertLevel
|
||||
)AND NOT (
|
||||
vTicketStateCode IN ('CHECKED', 'CHECKING')
|
||||
|
@ -51,5 +51,6 @@ BEGIN
|
|||
ELSE
|
||||
CALL util.throw('INCORRECT_TICKET_STATE');
|
||||
END IF;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -2,21 +2,23 @@ DELIMITER $$
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_clockIn`(
|
||||
vWorkerFk INT,
|
||||
vTimed DATETIME,
|
||||
vDirection VARCHAR(10)
|
||||
vDirection VARCHAR(10),
|
||||
vDevice VARCHAR(255)
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Verifica si el empleado puede fichar
|
||||
* @param vWorkerFk Identificador del trabajador
|
||||
* @param vTimed valor de la fichada, IF vTimed IS NULL vTimed = NOW
|
||||
* @param vDirection solo se pueden pasa los valores del campo
|
||||
* workerTimeControl.direction ENUM('in', 'out', 'middle')
|
||||
* @return Si todo es correcto, retorna el número de id la tabla workerTimeControl.
|
||||
* Si hay algún problema, devuelve el mesaje que se debe mostrar al usuario
|
||||
* Solo retorna el primer problema, en caso de no ocurrir ningún error se añadirá
|
||||
* fichada a la tabla vn.workerTimeControl
|
||||
*/
|
||||
|
||||
* Verifica si el empleado puede fichar
|
||||
* @param vWorkerFk Identificador del trabajador
|
||||
* @param vTimed Balor de la fichada, IF vTimed IS NULL vTimed = NOW
|
||||
* @param vDirection Solo se pueden pasa los valores del campo
|
||||
* workerTimeControl.direction ENUM('in', 'out', 'middle')
|
||||
* @param vDevice Dispositivo en el que se ha fichado
|
||||
* @return Si todo es correcto, retorna el número de id la tabla workerTimeControl.
|
||||
* Si hay algún problema, devuelve el mesaje que se debe mostrar al usuario
|
||||
* Solo retorna el primer problema, en caso de no ocurrir ningún error se añadirá
|
||||
* fichada a la tabla vn.workerTimeControl
|
||||
*/
|
||||
|
||||
DECLARE vLastIn DATETIME;
|
||||
DECLARE vLastOut DATETIME;
|
||||
DECLARE vNextIn DATETIME;
|
||||
|
@ -269,16 +271,16 @@ BEGIN
|
|||
GROUP BY breakCounter
|
||||
HAVING hasError
|
||||
LIMIT 1;
|
||||
|
||||
|
||||
IF vIsError THEN
|
||||
SET vErrorCode = 'BREAK_WEEK';
|
||||
CALL util.throw(vErrorCode);
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
-- SE PERMITE FICHAR
|
||||
INSERT INTO workerTimeControl(userFk, timed, direction, `manual`)
|
||||
VALUES(vWorkerFk, vTimed, vDirection, vIsManual);
|
||||
|
||||
-- Se permite fichar
|
||||
INSERT INTO workerTimeControl(userFk, timed, direction, device, `manual`)
|
||||
VALUES(vWorkerFk, vTimed, vDirection, vDevice, vIsManual);
|
||||
|
||||
SELECT LAST_INSERT_ID() id;
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`accountReconciliation_beforeInsert`
|
||||
BEFORE INSERT ON `accountReconciliation`
|
||||
FOR EACH ROW
|
||||
|
||||
SET NEW.calculatedCode = REPLACE(
|
||||
REPLACE(
|
||||
REPLACE(
|
||||
REPLACE(
|
||||
CONCAT(NEW.supplierAccountFk,NEW.operationDated,NEW.amount,NEW.concept,NEW.debitCredit)
|
||||
,' ','')
|
||||
,":",'')
|
||||
,'-','')
|
||||
,'.','')$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,15 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`awbInvoiceIn_afterDelete`
|
||||
AFTER DELETE ON `awbInvoiceIn`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
IF (NOT(SELECT COUNT(*) FROM invoiceInTax where invoiceInFk = OLD.invoiceInFk))
|
||||
AND
|
||||
(NOT(SELECT COUNT(*) FROM invoiceInDueDay where invoiceInFk = OLD.invoiceInFk))
|
||||
AND
|
||||
(NOT(SELECT isBooked FROM invoiceIn WHERE id = OLD.invoiceInFk) )
|
||||
THEN
|
||||
DELETE FROM invoiceIn WHERE id = OLD.invoiceInFk;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -41,8 +41,8 @@ trig:BEGIN
|
|||
FROM genericAllocation ga
|
||||
JOIN entry e ON e.id = NEW.entryFk
|
||||
JOIN travel tr on tr.id = e.travelFk
|
||||
WHERE ga.itemFk = vGenericFk
|
||||
AND tr.landed BETWEEN ga.startDated AND ga.endDated;
|
||||
WHERE ga.itemFk = vGenericFk
|
||||
AND tr.landed BETWEEN ga.startDated AND ga.endDated;
|
||||
IF vGenericInDate THEN
|
||||
SET NEW.itemOriginalFk = NEW.itemFk;
|
||||
SET NEW.itemFk = vGenericFk;
|
||||
|
@ -64,5 +64,12 @@ trig:BEGIN
|
|||
IF NEW.quantity < 0 THEN
|
||||
SET NEW.isIgnored = TRUE;
|
||||
END IF;
|
||||
|
||||
IF NOT (NEW.itemFk <=> OLD.itemFk) OR
|
||||
NOT (OLD.entryFk <=> NEW.entryFk) THEN
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
|
||||
SELECT NEW.id;
|
||||
CALL buy_checkItem();
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -13,5 +13,15 @@ BEGIN
|
|||
CALL travel_requestRecalc(OLD.travelFk);
|
||||
CALL travel_requestRecalc(NEW.travelFk);
|
||||
END IF;
|
||||
|
||||
|
||||
IF NOT (NEW.travelFk <=> OLD.travelFk) THEN
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
|
||||
SELECT b.id
|
||||
FROM buy b
|
||||
WHERE b.entryFk = NEW.id;
|
||||
|
||||
CALL buy_checkItem();
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -4,22 +4,22 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expedition_beforeInse
|
|||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE intcounter INT;
|
||||
DECLARE vShipFk INT;
|
||||
DECLARE vShipFk INT;
|
||||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
IF NEW.freightItemFk IS NOT NULL THEN
|
||||
|
||||
UPDATE ticket SET packages = nz(packages) + 1 WHERE id = NEW.ticketFk;
|
||||
UPDATE ticket SET packages = IFNULL(packages, 0) + 1 WHERE id = NEW.ticketFk;
|
||||
|
||||
SELECT IFNULL(MAX(counter),0) +1 INTO intcounter
|
||||
FROM expedition e
|
||||
FROM expedition e
|
||||
INNER JOIN ticket t1 ON e.ticketFk = t1.id
|
||||
LEFT JOIN ticketState ts ON ts.ticketFk = t1.id
|
||||
LEFT JOIN ticketState ts ON ts.ticketFk = t1.id
|
||||
INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped)
|
||||
AND t1.warehouseFk = t2.warehouseFk
|
||||
AND t1.warehouseFk = t2.warehouseFk
|
||||
WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk
|
||||
AND t1.agencyModeFk = t2.agencyModeFk;
|
||||
AND t1.agencyModeFk = t2.agencyModeFk;
|
||||
|
||||
SET NEW.`counter` = intcounter;
|
||||
END IF;
|
||||
|
|
|
@ -10,5 +10,18 @@ BEGIN
|
|||
SET commission = entry_getCommission(travelFk, currencyFk,supplierFk)
|
||||
WHERE travelFk = NEW.id;
|
||||
END IF;
|
||||
|
||||
IF NOT (NEW.agencyModeFk <=> OLD.agencyModeFk) THEN
|
||||
IF (SELECT hasWeightVolumetric FROM agencyMode WHERE id = NEW.agencyModeFk) THEN
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
|
||||
SELECT b.id
|
||||
FROM entry e
|
||||
JOIN buy b ON b.entryFk = e.id
|
||||
JOIN item i ON i.id = b.itemFk
|
||||
WHERE e.travelFk = NEW.id;
|
||||
|
||||
CALL buy_checkItem();
|
||||
END IF;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -4,15 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_beforeUpdate`
|
|||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
/*
|
||||
IF ((NOT NEW.shipped <=> OLD.shipped )
|
||||
OR (NOT NEW.landed <=> OLD.landed )
|
||||
OR (NOT NEW.warehouseInFk <=> OLD.warehouseInFk )
|
||||
OR (NOT NEW.warehouseOutFk <=> OLD.warehouseOutFk ))
|
||||
AND (OLD.totalEntries AND OLD.landed < CURDATE()) THEN
|
||||
CALL util.throw("Cannot past travels with entries");
|
||||
END IF;
|
||||
*/
|
||||
|
||||
IF NOT (NEW.landed <=> OLD.landed)
|
||||
OR NOT (NEW.shipped <=> OLD.shipped) THEN
|
||||
CALL travel_checkDates(NEW.shipped, NEW.landed);
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`warehouse_afterUpdate`
|
||||
AFTER UPDATE ON `warehouse`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
IF NEW.isFeedStock IS TRUE AND OLD.isFeedStock IS FALSE THEN
|
||||
INSERT IGNORE INTO warehouseAlias(`name`) VALUES(NEW.`name`);
|
||||
INSERT IGNORE INTO warehouseJoined(warehouseFk, warehouseAliasFk)
|
||||
VALUES(NEW.id,LAST_INSERT_ID());
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,24 +0,0 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn`.`bankPolicy`
|
||||
AS SELECT `bp`.`poliza_id` AS `id`,
|
||||
`bp`.`referencia` AS `ref`,
|
||||
`bp`.`importe` AS `amount`,
|
||||
`bp`.`com_dispuesto` AS `balanceInterestDrawn`,
|
||||
`bp`.`com_no_dispuesto` AS `commissionAvailableBalances`,
|
||||
`bp`.`com_anual` AS `openingCommission`,
|
||||
`bp`.`apertura` AS `started`,
|
||||
`bp`.`cierre` AS `ended`,
|
||||
`bp`.`Id_Banco` AS `bankFk`,
|
||||
`bp`.`empresa_id` AS `companyFk`,
|
||||
`bp`.`supplierFk` AS `supplierFk`,
|
||||
`bp`.`description` AS `description`,
|
||||
`bp`.`hasGuarantee` AS `hasGuarantee`,
|
||||
`bp`.`dmsFk` AS `dmsFk`,
|
||||
`bp`.`notaryFk` AS `notaryFk`,
|
||||
`bp`.`currencyFk` AS `currencyFk`,
|
||||
`bp`.`amortizationTypeFk` AS `amortizationTypeFk`,
|
||||
`bp`.`periodicityTypeFk` AS `periodicityTypeFk`,
|
||||
`bp`.`insuranceExpired` AS `insuranceExpired`
|
||||
FROM `vn2008`.`Bancos_poliza` `bp`
|
||||
ORDER BY `bp`.`poliza_id` DESC
|
|
@ -31,7 +31,7 @@ FROM (
|
|||
)
|
||||
JOIN `vn`.`route` `r` ON(`r`.`id` = `t`.`routeFk`)
|
||||
)
|
||||
LEFT JOIN `vn2008`.`Rutas_monitor` `rm` ON(`rm`.`Id_Ruta` = `r`.`id`)
|
||||
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `r`.`id`)
|
||||
)
|
||||
LEFT JOIN `vn`.`expeditionTruck` `et2` ON(`et2`.`id` = `rm`.`expeditionTruckFk`)
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn`.`itemShelvingAvailable`
|
||||
AS SELECT `s`.`id` AS `saleFk`,
|
||||
AS SELECT `s`.`id` `saleFk`,
|
||||
`tst`.`updated` AS `Modificado`,
|
||||
`s`.`ticketFk` AS `ticketFk`,
|
||||
0 AS `isPicked`,
|
||||
|
|
|
@ -15,7 +15,7 @@ AS SELECT `ish`.`itemFk` AS `itemFk`,
|
|||
`sh`.`parkingFk` AS `parkingFk`,
|
||||
`ish`.`id` AS `itemShelvingFk`,
|
||||
`ish`.`created` AS `created`,
|
||||
`st`.`description` = 'previousPrepared' AS `isPreviousPrepared`
|
||||
`st`.`code` = 'previousPrepared' AS `isPreviousPrepared`
|
||||
FROM (
|
||||
(
|
||||
(
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn`.`ticketStateToday`
|
||||
AS SELECT `ts`.`ticketFk` AS `ticket`,
|
||||
AS SELECT
|
||||
`ts`.`ticketFk` AS `ticketFk`,
|
||||
`ts`.`state` AS `state`,
|
||||
`ts`.`productionOrder` AS `productionOrder`,
|
||||
`ts`.`alertLevel` AS `alertLevel`,
|
||||
`ts`.`userFk` AS `worker`,
|
||||
`ts`.`userFk` AS `userFk`,
|
||||
`ts`.`code` AS `code`,
|
||||
`ts`.`updated` AS `updated`,
|
||||
`ts`.`isPicked` AS `isPicked`
|
||||
FROM (
|
||||
`vn`.`ticketState` `ts`
|
||||
JOIN `vn`.`ticket` `t` ON(`t`.`id` = `ts`.`ticketFk`)
|
||||
)
|
||||
WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`())
|
||||
FROM `ticketState` `ts`
|
||||
JOIN `ticket` `t` ON `t`.`id` = `ts`.`ticketFk`
|
||||
WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`());
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn`.`warehouseJoined`
|
||||
AS SELECT `wj`.`warehouse_id` AS `warehouseFk`,
|
||||
`wj`.`warehouse_alias_id` AS `warehouseAliasFk`
|
||||
FROM `vn2008`.`warehouse_joined` `wj`
|
|
@ -9,12 +9,11 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|||
lhp.m3,
|
||||
dl.minSpeed
|
||||
FROM ticket t
|
||||
JOIN ticketStateToday tst ON tst.ticket = t.id
|
||||
JOIN ticketStateToday tst ON tst.ticketFk = t.id
|
||||
JOIN state s ON s.id = tst.state
|
||||
JOIN saleVolume sv ON sv.ticketFk = t.id
|
||||
LEFT JOIN lastHourProduction lhp ON lhp.warehouseFk = t.warehouseFk
|
||||
JOIN warehouse w ON w.id = t.warehouseFk
|
||||
JOIN warehouseAlias wa ON wa.id = w.aliasFk
|
||||
STRAIGHT_JOIN `zone` z ON z.id = t.zoneFk
|
||||
LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
|
||||
AND zc.dated = util.VN_CURDATE()
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn2008`.`cc_to_iban`(cc VARCHAR(20))
|
||||
RETURNS varchar(4) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
DECLARE iban VARCHAR(4);
|
||||
select
|
||||
CONCAT('ES',
|
||||
RIGHT(
|
||||
concat(0,
|
||||
98-
|
||||
mod(
|
||||
concat(
|
||||
mod(
|
||||
concat(
|
||||
mod(
|
||||
concat(
|
||||
mod(
|
||||
substring(cc,1,8),
|
||||
97),
|
||||
substring(cc,9,8)
|
||||
),
|
||||
97),
|
||||
substring(
|
||||
concat(
|
||||
cc,
|
||||
142800
|
||||
),
|
||||
17,
|
||||
8
|
||||
)
|
||||
),
|
||||
97),
|
||||
substring(
|
||||
concat(
|
||||
cc,
|
||||
142800
|
||||
),
|
||||
25,
|
||||
2
|
||||
)
|
||||
),
|
||||
97)
|
||||
)
|
||||
,2)
|
||||
)into iban;
|
||||
RETURN iban;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,20 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn2008`.`intrastat_neto`(intINSTRASTAT INTEGER,intUNIDADES INTEGER)
|
||||
RETURNS double
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
|
||||
DECLARE n DOUBLE;
|
||||
|
||||
SELECT ROUND(intUNIDADES / (SUM(MEDIA) / COUNT(media)), 2) INTO n FROM
|
||||
(SELECT *, unidades / neto MEDIA
|
||||
FROM intrastat_data
|
||||
WHERE intrastat_id = intINSTRASTAT AND neto
|
||||
AND unidades > 0
|
||||
ORDER BY odbc_date DESC
|
||||
LIMIT 20) t;
|
||||
-- JGF 01/06 per a evitar Kg en negatiu
|
||||
RETURN n/2;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,14 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn2008`.`nz`(dblCANTIDAD DOUBLE)
|
||||
RETURNS double
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
|
||||
DECLARE dblRESULT DOUBLE;
|
||||
|
||||
SET dblRESULT = IFNULL(dblCANTIDAD,0);
|
||||
|
||||
RETURN dblRESULT;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,14 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn2008`.`red`(intCANTIDAD DOUBLE)
|
||||
RETURNS double
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
|
||||
DECLARE n DOUBLE;
|
||||
|
||||
SET n = SIGN(intCANTIDAD) * TRUNCATE( (ABS(intCANTIDAD) * 100) + 0.5001 ,0) /100 ;
|
||||
|
||||
RETURN n;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -7,19 +7,19 @@ BEGIN
|
|||
group_concat(CONCAT(' Asiento: ', ASIEN, '- importe:', quadre) SEPARATOR ' \r\n ')
|
||||
FROM (
|
||||
SELECT ASIEN, SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0)) quadre
|
||||
FROM XDiario
|
||||
FROM vn.XDiario
|
||||
WHERE enlazado = FALSE
|
||||
GROUP BY ASIEN
|
||||
HAVING ABS(SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0))) > 0.01
|
||||
) t
|
||||
HAVING count(*) > 0;
|
||||
|
||||
UPDATE XDiario XD
|
||||
UPDATE vn.XDiario XD
|
||||
INNER JOIN(
|
||||
SELECT XD.id, SUBCTA, Quadre FROM XDiario XD
|
||||
SELECT XD.id, SUBCTA, Quadre FROM vn.XDiario XD
|
||||
INNER JOIN (
|
||||
SELECT ASIEN, SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0)) as Quadre
|
||||
FROM XDiario
|
||||
FROM vn.XDiario
|
||||
WHERE enlazado = FALSE
|
||||
GROUP BY ASIEN
|
||||
HAVING Quadre != 0
|
||||
|
|
|
@ -20,14 +20,11 @@ proc: BEGIN
|
|||
SET vDate2000 = util.VN_CURDATE() + INTERVAL (2000 - YEAR(util.VN_CURDATE())) YEAR;
|
||||
SET vRangeDeleteTicket = 60;
|
||||
|
||||
DELETE FROM Rutas_monitor WHERE fecha < vDate;
|
||||
DELETE FROM cdr WHERE calldate < vDate18;
|
||||
DELETE FROM Monitoring WHERE ODBC_TIME < vDate;
|
||||
DELETE FROM Conteo WHERE Fecha < vDate;
|
||||
DELETE FROM XDiario WHERE FECHA < vDate3 OR FECHA IS NULL;
|
||||
DELETE FROM mail WHERE DATE_ODBC < vDate;
|
||||
DELETE FROM expeditions_deleted WHERE odbc_date < vDate26;
|
||||
DELETE FROM sms WHERE DATE_ODBC < vDate18;
|
||||
DELETE FROM Movimientos_mark WHERE odbc_date < vDate;
|
||||
DELETE FROM Splits WHERE Fecha < vDate18;
|
||||
|
||||
|
@ -47,8 +44,6 @@ proc: BEGIN
|
|||
JOIN Tickets t ON m.Id_Ticket = t.Id_Ticket WHERE t.Fecha < vDate;
|
||||
|
||||
DELETE FROM Remesas WHERE `Fecha Remesa` < vDate18;
|
||||
DELETE FROM sharingcart where datEND < vDate;
|
||||
DELETE FROM sharingclient where datEND < vDate;
|
||||
|
||||
DELETE tt.*
|
||||
FROM Tickets_turno tt
|
||||
|
|
|
@ -25,7 +25,7 @@ BEGIN
|
|||
FROM Clientes
|
||||
WHERE Id_Cliente = idCLI;
|
||||
CALL vn.ledger_next(max_asien);
|
||||
INSERT INTO XDiario (ASIEN,FECHA,SUBCTA,CONTRA,CONCEPTO,EURODEBE,EUROHABER,empresa_id)
|
||||
INSERT INTO vn.XDiario (ASIEN,FECHA,SUBCTA,CONTRA,CONCEPTO,EURODEBE,EUROHABER,empresa_id)
|
||||
SELECT max_asien,datFEC,SUBCTA,CONTRA,strCONCEPTO,EURODEBE,EUROHABER,idEMP
|
||||
FROM(SELECT cuenta_banco SUBCTA, cuenta_cliente CONTRA, 0 EURODEBE, dblIMPORTE EUROHABER
|
||||
UNION ALL
|
||||
|
|
|
@ -31,7 +31,7 @@ BEGIN
|
|||
stock.available
|
||||
FROM vn2008.Tickets t
|
||||
JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia
|
||||
JOIN vn2008.warehouse wh ON wh.id = t.warehouse_id
|
||||
JOIN vn.warehouse wh ON wh.id = t.warehouse_id
|
||||
JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket
|
||||
JOIN vn2008.Articles i ON i.Id_Article = m.Id_Article
|
||||
JOIN vn2008.Tipos tp ON tp.tipo_id = i.tipo_id
|
||||
|
@ -88,8 +88,8 @@ BEGIN
|
|||
FROM vn2008.Compres c
|
||||
JOIN vn2008.Entradas e ON e.Id_Entrada = c.Id_Entrada
|
||||
JOIN vn2008.travel tr ON tr.id = e.travel_id
|
||||
JOIN vn2008.warehouse whi ON whi.id = tr.warehouse_id
|
||||
JOIN vn2008.warehouse who ON who.id = tr.warehouse_id_out
|
||||
JOIN vn.warehouse whi ON whi.id = tr.warehouse_id
|
||||
JOIN vn.warehouse who ON who.id = tr.warehouse_id_out
|
||||
JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article
|
||||
JOIN vn2008.Tipos tp ON tp.tipo_id = a.tipo_id
|
||||
JOIN vn.confectionType ct ON ct.id = tp.confeccion
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`desglose_volume`(IN vAgencyFk INT)
|
||||
BEGIN
|
||||
|
||||
DECLARE vStarted DATETIME DEFAULT TIMESTAMP(util.VN_CURDATE());
|
||||
DECLARE vEnded DATETIME DEFAULT TIMESTAMP(util.VN_CURDATE(), '23:59:59');
|
||||
DECLARE vIsHolland BOOL;
|
||||
|
||||
SELECT (wa.name = 'Holanda') INTO vIsHolland
|
||||
FROM vn.agency a
|
||||
JOIN vn.warehouseAlias wa ON wa.id = a.warehouseAliasFk
|
||||
WHERE a.id = vAgencyFk;
|
||||
|
||||
IF vIsHolland THEN
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_PackagingEstimated;
|
||||
CREATE TEMPORARY TABLE tmp.ticket_PackagingEstimated
|
||||
(
|
||||
ticketFk INT PRIMARY KEY
|
||||
,carros DECIMAL(5,1) DEFAULT 0
|
||||
);
|
||||
|
||||
INSERT INTO tmp.ticket_PackagingEstimated(ticketFk, carros)
|
||||
SELECT sv.ticketFk, ROUND(vc.dutchCompressionRate * sum(sv.volume) / vc.trolleyM3,0)
|
||||
FROM vn.ticket t
|
||||
JOIN vn.saleVolume sv ON sv.ticketFk = t.id
|
||||
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
|
||||
JOIN vn.volumeConfig vc
|
||||
WHERE t.shipped BETWEEN vStarted AND vEnded
|
||||
AND am.agencyFk = vAgencyFk
|
||||
GROUP BY t.id;
|
||||
|
||||
SELECT a.nickname Provincia,
|
||||
count(*) expediciones,
|
||||
0 Bultos,
|
||||
sum(tpe.carros) Prevision
|
||||
FROM vn.ticket t
|
||||
JOIN vn.address a ON a.id = t.addressFk
|
||||
JOIN tmp.ticket_PackagingEstimated tpe ON tpe.ticketFk = t.id
|
||||
GROUP BY a.nickname;
|
||||
|
||||
ELSE
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_PackagingEstimated;
|
||||
CREATE TEMPORARY TABLE tmp.ticket_PackagingEstimated
|
||||
(
|
||||
ticketFk INT PRIMARY KEY
|
||||
,boxes INT DEFAULT 0
|
||||
);
|
||||
|
||||
INSERT INTO tmp.ticket_PackagingEstimated(ticketFk, boxes)
|
||||
SELECT sv.ticketFk, CEIL(1000 * sum(sv.volume) / vc.standardFlowerBox)
|
||||
FROM vn.ticket t
|
||||
JOIN vn.saleVolume sv ON sv.ticketFk = t.id
|
||||
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
|
||||
JOIN vn.volumeConfig vc
|
||||
WHERE t.shipped BETWEEN vStarted AND vEnded
|
||||
AND IFNULL(t.packages,0) = 0
|
||||
AND am.agencyFk = vAgencyFk
|
||||
GROUP BY t.id;
|
||||
|
||||
|
||||
SELECT p.name Provincia,
|
||||
count(*) expediciones,
|
||||
sum(t.packages) Bultos,
|
||||
sum(tpe.boxes) Prevision
|
||||
FROM vn.ticket t
|
||||
JOIN vn.address a ON a.id = t.addressFk
|
||||
JOIN vn.province p ON a.provinceFk = p.id
|
||||
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
|
||||
JOIN tmp.ticket_PackagingEstimated tpe ON tpe.ticketFk = t.id
|
||||
WHERE t.warehouseFk = 60
|
||||
AND t.shipped BETWEEN vStarted AND vEnded
|
||||
AND am.agencyFk = vAgencyFk
|
||||
GROUP BY p.name;
|
||||
|
||||
END IF;
|
||||
SELECT * FROM tmp.ticket_PackagingEstimated;
|
||||
DROP TEMPORARY TABLE tmp.ticket_PackagingEstimated;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -17,7 +17,20 @@ BEGIN
|
|||
SELECT t.Id_Ticket, Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION
|
||||
FROM Tickets t
|
||||
JOIN Consignatarios cs ON t.Id_Consigna = cs.Id_Consigna
|
||||
JOIN v_ticket_amount v ON v.Id_Ticket = t.Id_Ticket
|
||||
JOIN (
|
||||
SELECT `Movimientos`.`Id_Ticket` AS `Id_Ticket`,
|
||||
sum(
|
||||
`Movimientos`.`Cantidad` * `Movimientos`.`Preu` * (100 - `Movimientos`.`Descuento`) / 100
|
||||
) AS `amount`
|
||||
FROM (
|
||||
`vn2008`.`Movimientos`
|
||||
JOIN `vn2008`.`Tickets` ON(
|
||||
`Movimientos`.`Id_Ticket` = `Tickets`.`Id_Ticket`
|
||||
)
|
||||
)
|
||||
WHERE `Tickets`.`Fecha` >= `util`.`VN_CURDATE`() + INTERVAL -6 MONTH
|
||||
GROUP BY `Movimientos`.`Id_Ticket`
|
||||
) v ON v.Id_Ticket = t.Id_Ticket
|
||||
WHERE t.Fecha BETWEEN v_Date AND util.dayEnd(v_Date)
|
||||
AND t.Id_Cliente = v_Client_Id;
|
||||
|
||||
|
|
|
@ -8,16 +8,10 @@ BEGIN
|
|||
END;
|
||||
|
||||
START TRANSACTION;
|
||||
INSERT INTO vn.clientCredit(clientFk, amount)
|
||||
SELECT c.id, 0
|
||||
FROM vn.`client` c
|
||||
JOIN vn.payMethod pm ON pm.id = c.payMethodFk
|
||||
WHERE c.credit <> 0 AND pm.`code` = 'card';
|
||||
|
||||
UPDATE vn.`client` c
|
||||
JOIN vn.payMethod pm ON pm.id = c.payMethodFk
|
||||
JOIN vn.payMethod pm ON pm.id = c.payMethodFk
|
||||
SET credit = 0
|
||||
WHERE pm.`code` = 'card';
|
||||
WHERE pm.`code` = 'card';
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS clientes_credit;
|
||||
CREATE TEMPORARY TABLE clientes_credit
|
||||
|
@ -44,10 +38,6 @@ BEGIN
|
|||
UPDATE Clientes
|
||||
JOIN clientes_credit USING(Id_Cliente)
|
||||
SET Clientes.Credito = newCredit;
|
||||
|
||||
INSERT INTO credit(Id_Cliente, amount, Id_Trabajador)
|
||||
SELECT Id_Cliente, newCredit, NULL
|
||||
FROM clientes_credit;
|
||||
|
||||
DROP TEMPORARY TABLE clientes_credit;
|
||||
COMMIT;
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn2008`.`Conteo_afterInsert`
|
||||
AFTER INSERT ON `Conteo`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE intTravel INTEGER;
|
||||
SELECT t.id INTO intTravel FROM Compres c JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada
|
||||
JOIN travel t ON t.id = e.travel_id
|
||||
WHERE landing = util.VN_CURDATE() AND c.Id_Article = NEW.Id_Article AND warehouse_id = NEW.warehouse_id AND received <> TRUE LIMIT 1;
|
||||
IF (intTravel) then
|
||||
UPDATE travel SET received = TRUE WHERE id = intTravel;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,14 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn2008`.`account_conciliacion_beforeInsert`
|
||||
BEFORE INSERT ON `account_conciliacion`
|
||||
FOR EACH ROW
|
||||
set new.id_calculated = replace(
|
||||
replace(
|
||||
replace(
|
||||
replace(
|
||||
concat(new.Id_Proveedores_account,new.Fechaoperacion,new.importe,new.Concepto,new.DebeHaber)
|
||||
,' ','')
|
||||
,":",'')
|
||||
,'-','')
|
||||
,'.','')$$
|
||||
DELIMITER ;
|
|
@ -1,18 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn2008`.`agency_hour_afterUpdate`
|
||||
AFTER UPDATE ON `agency_hour`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE vAlreadyExists BOOLEAN DEFAULT FALSE;
|
||||
|
||||
SELECT COUNT(*) INTO vAlreadyExists
|
||||
FROM vn2008.agency_hour
|
||||
WHERE NEW.week_day <=> week_day AND NEW.province_id <=> province_id
|
||||
AND NEW.warehouse_id <=> warehouse_id AND NEW.max_hour <=> max_hour
|
||||
AND NEW.agency_id <=> agency_id;
|
||||
|
||||
IF vAlreadyExists > 1 THEN
|
||||
CALL util.throw('ALREADY_EXISTS');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,21 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn2008`.`agency_hour_beforeInsert`
|
||||
BEFORE INSERT ON `agency_hour`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE vAlreadyExists BOOLEAN DEFAULT FALSE;
|
||||
IF NEW.week_day IS NULL AND NEW.province_id IS NULL AND NEW.subtract_day = 0 AND NEW.max_hour = 0 THEN
|
||||
CALL util.throw ('FILL_MORE_FIELDS');
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(*) INTO vAlreadyExists
|
||||
FROM vn2008.agency_hour
|
||||
WHERE NEW.week_day <=> week_day AND NEW.province_id <=> province_id
|
||||
AND NEW.warehouse_id <=> warehouse_id AND NEW.max_hour <=> max_hour
|
||||
AND NEW.agency_id <=> agency_id;
|
||||
|
||||
IF vAlreadyExists > 1 THEN
|
||||
CALL util.throw('ALREADY_EXISTS');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,13 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn2008`.`awb_recibida_afterDelete`
|
||||
AFTER DELETE ON `awb_recibida`
|
||||
FOR EACH ROW
|
||||
IF (SELECT COUNT(*) FROM recibida_iva where recibida_id = OLD.recibida_id) = 0
|
||||
AND
|
||||
(SELECT COUNT(*) FROM recibida_vencimiento where recibida_id = OLD.recibida_id) = 0
|
||||
AND
|
||||
(SELECT contabilizada FROM recibida WHERE id = OLD.recibida_id) = 0
|
||||
THEN
|
||||
DELETE FROM recibida WHERE id = OLD.recibida_id;
|
||||
END IF$$
|
||||
DELIMITER ;
|
|
@ -1,7 +0,0 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Articles_botanical`
|
||||
AS SELECT `ab`.`itemFk` AS `Id_Article`,
|
||||
`ab`.`genusFk` AS `genus_id`,
|
||||
`ab`.`specieFk` AS `specie_id`
|
||||
FROM `vn`.`itemBotanical` `ab`
|
|
@ -0,0 +1,24 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Bancos_poliza`
|
||||
AS SELECT `bp`.`id` AS `poliza_id`,
|
||||
`bp`.`ref` AS `referencia`,
|
||||
`bp`.`amount` AS `importe`,
|
||||
`bp`.`committedFee` AS `com_dispuesto`,
|
||||
`bp`.`nonCommittedFee` AS `com_no_dispuesto`,
|
||||
`bp`.`annualFee` AS `com_anual`,
|
||||
`bp`.`started` AS `apertura`,
|
||||
`bp`.`ended` AS `cierre`,
|
||||
`bp`.`accountingFk` AS `Id_Banco`,
|
||||
`bp`.`companyFk` AS `empresa_id`,
|
||||
`bp`.`supplierFk` AS `supplierFk`,
|
||||
`bp`.`description` AS `description`,
|
||||
`bp`.`hasGuarantee` AS `hasGuarantee`,
|
||||
`bp`.`dmsFk` AS `dmsFk`,
|
||||
`bp`.`notaryFk` AS `notaryFk`,
|
||||
`bp`.`currencyFk` AS `currencyFk`,
|
||||
`bp`.`amortizationTypeFk` AS `amortizationTypeFk`,
|
||||
`bp`.`periodicityTypeFk` AS `periodicityTypeFk`,
|
||||
`bp`.`insuranceExpired` AS `insuranceExpired`
|
||||
FROM `vn`.`bankPolicy` `bp`
|
||||
ORDER BY `bp`.`id` DESC
|
|
@ -0,0 +1,6 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Entradas_orden`
|
||||
AS SELECT `eo`.`entryFk` AS `Id_Entrada`,
|
||||
`eo`.`order` AS `orden`
|
||||
FROM `vn`.`entryOrder` `eo`
|
|
@ -1,8 +0,0 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Equipos`
|
||||
AS SELECT `h`.`code` AS `alias`,
|
||||
`h`.`description` AS `descripcion`,
|
||||
`h`.`workerFk` AS `trabajador_id`,
|
||||
`h`.`windowsSerial` AS `windowsSerial`
|
||||
FROM `vn`.`host` `h`
|
|
@ -1,6 +0,0 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Prioridades`
|
||||
AS SELECT `qp`.`id` AS `Id_Prioridad`,
|
||||
`qp`.`priority` AS `Prioridad`
|
||||
FROM `vn`.`queuePriority` `qp`
|
|
@ -0,0 +1,6 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Proveedores_gestdoc`
|
||||
AS SELECT `sd`.`supplierFk` AS `Id_Proveedor`,
|
||||
`sd`.`dmsFk` AS `gestdoc_id`
|
||||
FROM `vn`.`supplierDms` `sd`
|
|
@ -0,0 +1,8 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Remesas`
|
||||
AS SELECT `r`.`id` AS `Id_Remesa`,
|
||||
`r`.`dated` AS `Fecha Remesa`,
|
||||
`r`.`accountingFk` AS `Banco`,
|
||||
`r`.`companyFk` AS `empresa_id`
|
||||
FROM `vn`.`remittance` `r`
|
|
@ -1,24 +0,0 @@
|
|||
|
||||
CREATE OR REPLACE DEFINER = `root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Rutas_Master`
|
||||
AS SELECT
|
||||
`rm`.`id` AS `id`,
|
||||
`rm`.`warehoseFk` AS `warehouse_id`,
|
||||
`rm`.`km` AS `km`,
|
||||
`rm`.`packages` AS `bultos`,
|
||||
`rm`.`vehicleCost` AS `vehiculos_coste`,
|
||||
`rm`.`staffCost` AS `personal_coste`,
|
||||
`rm`.`vehicle` AS `vehiculos_numero`,
|
||||
`rm`.`staff` AS `personal_numero`,
|
||||
`rm`.`fuel` AS `gasoil`,
|
||||
`rm`.`freelancers` AS `autonomos`,
|
||||
`rm`.`year` AS `año`,
|
||||
`rm`.`mounth` AS `mes`,
|
||||
`rm`.`expense` AS `gastos`,
|
||||
`rm`.`freelancersPackages` AS `bultos_autonomos`,
|
||||
`rm`.`kmCost` AS `coste_km`,
|
||||
`rm`.`packageCost` AS `coste_bulto`,
|
||||
`rm`.`freelancerPackageCost` AS `coste_bulto_autonomo` ,
|
||||
`rm`.`created` AS `odbc_date`
|
||||
FROM `vn`.`routeMaster` `rm`
|
|
@ -1,22 +0,0 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Rutas_Master`
|
||||
AS SELECT `rm`.`id` AS `id`,
|
||||
`rm`.`warehouseFk` AS `warehouse_id`,
|
||||
`rm`.`km` AS `km`,
|
||||
`rm`.`packages` AS `bultos`,
|
||||
`rm`.`vehicleCost` AS `vehiculos_coste`,
|
||||
`rm`.`staffCost` AS `personal_coste`,
|
||||
`rm`.`vehicle` AS `vehiculos_numero`,
|
||||
`rm`.`staff` AS `personal_numero`,
|
||||
`rm`.`fuel` AS `gasoil`,
|
||||
`rm`.`freelancers` AS `autonomos`,
|
||||
`rm`.`year` AS `año`,
|
||||
`rm`.`month` AS `mes`,
|
||||
`rm`.`expense` AS `gastos`,
|
||||
`rm`.`freelancersPackages` AS `bultos_autonomos`,
|
||||
`rm`.`kmCost` AS `coste_km`,
|
||||
`rm`.`packageCost` AS `coste_bulto`,
|
||||
`rm`.`freelancerPackageCost` AS `coste_bulto_autonomo`,
|
||||
`rm`.`created` AS `odbc_date`
|
||||
FROM `vn`.`routeMaster` `rm`
|
|
@ -1,18 +0,0 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Rutas_monitor`
|
||||
AS SELECT `vn`.`routesMonitor`.`routeFk` AS `Id_Ruta`,
|
||||
`vn`.`routesMonitor`.`name` AS `name`,
|
||||
`vn`.`routesMonitor`.`beachFk` AS `Ubicacion`,
|
||||
`vn`.`routesMonitor`.`ticketPacked` AS `pedidosEncajados`,
|
||||
`vn`.`routesMonitor`.`ticketFree` AS `pedidosLibres`,
|
||||
`vn`.`routesMonitor`.`ticketProduction` AS `pedidosProduccion`,
|
||||
`vn`.`routesMonitor`.`packages` AS `bultos`,
|
||||
`vn`.`routesMonitor`.`note` AS `notas`,
|
||||
`vn`.`routesMonitor`.`dated` AS `fecha`,
|
||||
`vn`.`routesMonitor`.`dockFk` AS `dockFk`,
|
||||
`vn`.`routesMonitor`.`m3` AS `m3`,
|
||||
`vn`.`routesMonitor`.`priority` AS `priority`,
|
||||
`vn`.`routesMonitor`.`etd` AS `etd`,
|
||||
`vn`.`routesMonitor`.`expeditionTruckFk` AS `expeditionTruckFk`
|
||||
FROM `vn`.`routesMonitor`
|
|
@ -0,0 +1,10 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Saldos_Prevision`
|
||||
AS SELECT `fb`.`id` AS `Saldos_Prevision_id`,
|
||||
`fb`.`description` AS `Descripcion`,
|
||||
`fb`.`amount` AS `Importe`,
|
||||
`fb`.`dated` AS `Fecha`,
|
||||
`fb`.`accountingFk` AS `Id_Banco`,
|
||||
`fb`.`companyFk` AS `empresa_id`
|
||||
FROM `vn`.`forecastedBalance` `fb`
|
|
@ -0,0 +1,9 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Splits`
|
||||
AS SELECT `s`.`id` AS `Id_Split`,
|
||||
`s`.`ticketFk` AS `Id_Ticket`,
|
||||
`s`.`entryFk` AS `Id_Entrada`,
|
||||
`s`.`dated` AS `Fecha`,
|
||||
`s`.`note` AS `Notas`
|
||||
FROM `vn`.`split` `s`
|
|
@ -0,0 +1,8 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Split_lines`
|
||||
AS SELECT `sl`.`id` AS `Id_Split_lines`,
|
||||
`sl`.`splitFk` AS `Id_Split`,
|
||||
`sl`.`itemFk` AS `Id_Article`,
|
||||
`sl`.`buyFk` AS `Id_Compra`
|
||||
FROM `vn`.`splitLine` `sl`
|
|
@ -1,14 +0,0 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Vehiculos`
|
||||
AS SELECT `v`.`id` AS `Id_Vehiculo`,
|
||||
`v`.`numberPlate` AS `Matricula`,
|
||||
`v`.`tradeMark` AS `Marca`,
|
||||
`v`.`model` AS `Modelo`,
|
||||
`v`.`companyFk` AS `empresa_id`,
|
||||
`v`.`warehouseFk` AS `warehouseFk`,
|
||||
`v`.`description` AS `description`,
|
||||
`v`.`m3` AS `m3`,
|
||||
`v`.`isActive` AS `active`,
|
||||
`v`.`deliveryPointFk` AS `deliveryPointFk`
|
||||
FROM `vn`.`vehicle` `v`
|
|
@ -0,0 +1,20 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Vehiculos_consumo`
|
||||
AS SELECT `vc`.`id` AS `Vehiculos_consumo_id`,
|
||||
`vc`.`vehicleFk` AS `Id_Vehiculo`,
|
||||
`vc`.`dated` AS `fecha`,
|
||||
`vc`.`km` AS `km`,
|
||||
`vc`.`liters` AS `litros`,
|
||||
`vc`.`price` AS `precio`,
|
||||
`vc`.`adblue` AS `adblue`,
|
||||
`vc`.`tolls` AS `peajes`,
|
||||
`vc`.`discount` AS `descuento`,
|
||||
`vc`.`silla` AS `silla`,
|
||||
`vc`.`created` AS `odbc_date`,
|
||||
`vc`.`others` AS `otros`,
|
||||
`vc`.`fuelTypeFk` AS `fuelTypeFk`,
|
||||
`vc`.`supplierFk` AS `proveedoresFk`,
|
||||
`vc`.`liters100km` AS `liters100km`,
|
||||
`vc`.`gasoline` AS `gasoline`
|
||||
FROM `vn`.`vehicleConsumption` `vc`
|
|
@ -1,17 +0,0 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`VerEspionaje`
|
||||
AS SELECT `Trabajadores`.`CodigoTrabajador` AS `CodigoTrabajador`,
|
||||
`vn2008`.`Espionajes`.`Fecha` AS `Fecha`,
|
||||
`vn2008`.`Espionajes`.`HoraEntrada` AS `HoraEntrada`,
|
||||
`vn2008`.`Espionajes`.`HoraSalida` AS `HoraSalida`,
|
||||
`vn2008`.`Espionajes`.`Id_Equipo` AS `Id_Equipo`,
|
||||
`Trabajadores`.`Id_Trabajador` AS `Id_Trabajador`
|
||||
FROM (
|
||||
`vn2008`.`Espionajes`
|
||||
JOIN `vn2008`.`Trabajadores` ON(
|
||||
`vn2008`.`Espionajes`.`Id_Trabajador` = `Trabajadores`.`Id_Trabajador`
|
||||
)
|
||||
)
|
||||
ORDER BY `Trabajadores`.`CodigoTrabajador`,
|
||||
`vn2008`.`Espionajes`.`Fecha`
|
|
@ -1,7 +0,0 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Vistas`
|
||||
AS SELECT `dm`.`id` AS `vista_id`,
|
||||
`dm`.`code` AS `code`,
|
||||
`dm`.`description` AS `vista`
|
||||
FROM `vn`.`deliveryMethod` `dm`
|
|
@ -1,56 +0,0 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`XDiario`
|
||||
AS SELECT `d`.`id` AS `id`,
|
||||
`d`.`ASIEN` AS `ASIEN`,
|
||||
`d`.`FECHA` AS `FECHA`,
|
||||
`d`.`SUBCTA` AS `SUBCTA`,
|
||||
`d`.`CONTRA` AS `CONTRA`,
|
||||
`d`.`CONCEPTO` AS `CONCEPTO`,
|
||||
`d`.`EURODEBE` AS `EURODEBE`,
|
||||
`d`.`EUROHABER` AS `EUROHABER`,
|
||||
`d`.`BASEEURO` AS `BASEEURO`,
|
||||
`d`.`SERIE` AS `SERIE`,
|
||||
`d`.`FACTURA` AS `FACTURA`,
|
||||
`d`.`IVA` AS `IVA`,
|
||||
`d`.`RECEQUIV` AS `RECEQUIV`,
|
||||
`d`.`CLAVE` AS `CLAVE`,
|
||||
`d`.`CAMBIO` AS `CAMBIO`,
|
||||
`d`.`DEBEME` AS `DEBEME`,
|
||||
`d`.`HABERME` AS `HABERME`,
|
||||
`d`.`AUXILIAR` AS `AUXILIAR`,
|
||||
`d`.`MONEDAUSO` AS `MONEDAUSO`,
|
||||
`d`.`TIPOOPE` AS `TIPOOPE`,
|
||||
`d`.`NFACTICK` AS `NFACTICK`,
|
||||
`d`.`TERIDNIF` AS `TERIDNIF`,
|
||||
`d`.`TERNIF` AS `TERNIF`,
|
||||
`d`.`TERNOM` AS `TERNOM`,
|
||||
`d`.`OPBIENES` AS `OPBIENES`,
|
||||
`d`.`L340` AS `L340`,
|
||||
`d`.`enlazado` AS `enlazado`,
|
||||
`d`.`FECHA_EX` AS `FECHA_EX`,
|
||||
`d`.`LRECT349` AS `LRECT349`,
|
||||
`d`.`empresa_id` AS `empresa_id`,
|
||||
`d`.`LDIFADUAN` AS `LDIFADUAN`,
|
||||
`d`.`METAL` AS `METAL`,
|
||||
`d`.`METALIMP` AS `METALIMP`,
|
||||
`d`.`CLIENTE` AS `CLIENTE`,
|
||||
`d`.`METALEJE` AS `METALEJE`,
|
||||
`d`.`FECHA_OP` AS `FECHA_OP`,
|
||||
`d`.`FACTURAEX` AS `FACTURAEX`,
|
||||
`d`.`TIPOCLAVE` AS `TIPOCLAVE`,
|
||||
`d`.`TIPOEXENCI` AS `TIPOEXENCI`,
|
||||
`d`.`TIPONOSUJE` AS `TIPONOSUJE`,
|
||||
`d`.`TIPOFACT` AS `TIPOFACT`,
|
||||
`d`.`TIPORECTIF` AS `TIPORECTIF`,
|
||||
`d`.`SERIE_RT` AS `SERIE_RT`,
|
||||
`d`.`FACTU_RT` AS `FACTU_RT`,
|
||||
`d`.`BASEIMP_RT` AS `BASEIMP_RT`,
|
||||
`d`.`BASEIMP_RF` AS `BASEIMP_RF`,
|
||||
`d`.`RECTIFICA` AS `RECTIFICA`,
|
||||
`d`.`FECHA_RT` AS `FECHA_RT`,
|
||||
`d`.`created` AS `created`,
|
||||
`d`.`updated` AS `updated`,
|
||||
`d`.`FECREGCON` AS `FECREGCON`,
|
||||
`d`.`enlazadoSage` AS `enlazadoSage`
|
||||
FROM `vn`.`XDiario` `d`
|
|
@ -0,0 +1,13 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`account_conciliacion`
|
||||
AS SELECT `ar`.`id` AS `idaccount_conciliacion`,
|
||||
`ar`.`supplierAccountFk` AS `Id_Proveedores_account`,
|
||||
`ar`.`operationDated` AS `Fechaoperacion`,
|
||||
`ar`.`valueDated` AS `FechaValor`,
|
||||
`ar`.`amount` AS `importe`,
|
||||
`ar`.`concept` AS `Concepto`,
|
||||
`ar`.`debitCredit` AS `DebeHaber`,
|
||||
`ar`.`calculatedCode` AS `id_calculated`,
|
||||
`ar`.`created` AS `odbc_date`
|
||||
FROM `vn`.`accountReconciliation` `ar`
|
|
@ -0,0 +1,8 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`account_detail`
|
||||
AS SELECT `ac`.`id` AS `account_detail_id`,
|
||||
`ac`.`value` AS `value`,
|
||||
`ac`.`accountDetailTypeFk` AS `account_detail_type_id`,
|
||||
`ac`.`supplierAccountFk` AS `Id_Proveedores_account`
|
||||
FROM `vn`.`accountDetail` `ac`
|
|
@ -0,0 +1,6 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`account_detail_type`
|
||||
AS SELECT `adt`.`id` AS `account_detail_type_id`,
|
||||
`adt`.`description` AS `description`
|
||||
FROM `vn`.`accountDetailType` `adt`
|
|
@ -4,7 +4,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|||
AS SELECT `a`.`id` AS `agency_id`,
|
||||
`a`.`name` AS `name`,
|
||||
`a`.`warehouseFk` AS `warehouse_id`,
|
||||
`a`.`warehouseAliasFk` AS `warehouse_alias_id`,
|
||||
`a`.`isOwn` AS `propios`,
|
||||
`a`.`workCenterFk` AS `workCenterFk`
|
||||
FROM `vn`.`agency` `a`
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`airline`
|
||||
AS SELECT `a`.`id` AS `airline_id`,
|
||||
`a`.`name` AS `name`
|
||||
FROM `vn`.`airline` `a`
|
|
@ -0,0 +1,6 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`airport`
|
||||
AS SELECT `a`.`id` AS `airport_id`,
|
||||
`a`.`name` AS `name`
|
||||
FROM `vn`.`airport` `a`
|
|
@ -0,0 +1,19 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`albaran`
|
||||
AS SELECT `dn`.`id` AS `albaran_id`,
|
||||
`dn`.`ref` AS `ref`,
|
||||
`dn`.`note` AS `note`,
|
||||
`dn`.`shipped` AS `fecha`,
|
||||
`dn`.`landed` AS `fecha_entrega`,
|
||||
`dn`.`amount` AS `valor`,
|
||||
`dn`.`supplierFk` AS `Id_Proveedor`,
|
||||
`dn`.`companyFk` AS `empresa_id`,
|
||||
`dn`.`warehouseFk` AS `warehouse_id`,
|
||||
`dn`.`stateFk` AS `albaran_state_id`,
|
||||
`dn`.`workerFk` AS `Id_Trabajador`,
|
||||
`dn`.`supervisorFk` AS `Id_Responsable`,
|
||||
`dn`.`departmentFk` AS `department_id`,
|
||||
`dn`.`invoiceInFk` AS `recibida_id`,
|
||||
`dn`.`farmingFk` AS `farmingFk`
|
||||
FROM `vn`.`deliveryNote` `dn`
|
|
@ -0,0 +1,6 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`albaran_gestdoc`
|
||||
AS SELECT `dnd`.`dmsFk` AS `gestdoc_id`,
|
||||
`dnd`.`deliveryNoteFk` AS `albaran_id`
|
||||
FROM `vn`.`deliveryNoteDms` `dnd`
|
|
@ -0,0 +1,6 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`albaran_state`
|
||||
AS SELECT `dn`.`id` AS `albaran_state_id`,
|
||||
`dn`.`state` AS `state`
|
||||
FROM `vn`.`deliveryNoteState` `dn`
|
|
@ -0,0 +1,14 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`awb_component`
|
||||
AS SELECT `ac`.`id` AS `id`,
|
||||
`ac`.`awbFk` AS `awb_id`,
|
||||
`ac`.`supplierFk` AS `Id_Proveedor`,
|
||||
`ac`.`typeFk` AS `awb_component_type_id`,
|
||||
`ac`.`awbRoleFk` AS `awb_role_id`,
|
||||
`ac`.`awbUnitFk` AS `awb_unit_id`,
|
||||
`ac`.`value` AS `value`,
|
||||
`ac`.`currencyFk` AS `Id_Moneda`,
|
||||
`ac`.`invoiceInFk` AS `recibida_id`
|
||||
FROM
|
||||
`vn`.`awbComponent` `ac`;
|
|
@ -0,0 +1,19 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`awb_component_template`
|
||||
AS SELECT`act`.`id` AS `awb_component_template_id`,
|
||||
`act`.`freightFk` AS `carguera_id`,
|
||||
`act`.`airportIn` AS `airport_in`,
|
||||
`act`.`airportOut` AS `airport_out`,
|
||||
`act`.`airlineFk` AS `airline_id`,
|
||||
`act`.`typeFk` AS `awb_component_type_id`,
|
||||
`act`.`dated` AS `Fecha`,
|
||||
`act`.`awbRoleFk` AS `awb_role_id`,
|
||||
`act`.`awbUnit` AS `awb_unit_id`,
|
||||
`act`.`value` AS `value`,
|
||||
`act`.`maxValue` AS `max_value`,
|
||||
`act`.`minValue` AS `min_value`,
|
||||
`act`.`currencyFk` AS `Id_Moneda`,
|
||||
`act`.`days` AS `days`
|
||||
FROM
|
||||
`vn`.`awbComponentTemplate` `act`;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue