Merge branch 'dev' into 6397-emailValidation
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Carlos Satorres 2024-02-01 11:48:48 +00:00
commit 6576bab305
68 changed files with 5612 additions and 6070 deletions

View File

@ -40,11 +40,11 @@ RUN apt-get update \
WORKDIR /salix WORKDIR /salix
COPY print/package.json print/package-lock.json print/ COPY print/package.json print/package-lock.json print/
RUN npm --prefix ./print install --omit=dev ./print RUN npm ci --no-audit --prefer-offline --omit=dev --prefix=print
COPY package.json package-lock.json ./ COPY package.json package-lock.json ./
COPY loopback/package.json loopback/ COPY loopback/package.json loopback/
RUN npm install --omit=dev RUN npm ci --no-audit --prefer-offline --omit=dev
COPY loopback loopback COPY loopback loopback
COPY back back COPY back back

9
Jenkinsfile vendored
View File

@ -9,17 +9,20 @@ pipeline {
options { options {
disableConcurrentBuilds() disableConcurrentBuilds()
} }
tools {
nodejs 'node-v20'
}
environment { environment {
PROJECT_NAME = 'salix' PROJECT_NAME = 'salix'
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
} }
tools {
nodejs 'node-v20'
}
stages { stages {
stage('Checkout') { stage('Checkout') {
steps { steps {
script { script {
// Uncomment to enable debugging
//env.DEBUG = 'strong-remoting:http-context,strong-remoting:shared-method'
switch (env.BRANCH_NAME) { switch (env.BRANCH_NAME) {
case 'dev': case 'dev':
env.NODE_ENV = 'dev' env.NODE_ENV = 'dev'

View File

@ -1,5 +1,5 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`analisis_ventas_update`() CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`analisis_ventas_update`()
BEGIN BEGIN
DECLARE vLastMonth DATE; DECLARE vLastMonth DATE;
@ -32,7 +32,7 @@ BEGIN
tm.year AS Año, tm.year AS Año,
tm.month AS Mes, tm.month AS Mes,
tm.week AS Semana, tm.week AS Semana,
v.vista AS Vista, dm.description AS Vista,
bt.importe AS Importe bt.importe AS Importe
FROM bs.ventas bt FROM bs.ventas bt
LEFT JOIN vn2008.Tipos tp ON tp.tipo_id = bt.tipo_id 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 JOIN vn2008.Movimientos m ON m.Id_Movimiento = bt.Id_Movimiento
LEFT JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket LEFT JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket
JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia 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.Consignatarios cs ON cs.Id_Consigna = t.Id_Consigna
LEFT JOIN vn2008.province p ON p.province_id = cs.province_id 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 vn2008.warehouse w ON w.id = t.warehouse_id
WHERE bt.fecha >= vLastMonth AND r.mercancia; WHERE bt.fecha >= vLastMonth AND r.mercancia;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -2,21 +2,23 @@ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_clockIn`( CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_clockIn`(
vWorkerFk INT, vWorkerFk INT,
vTimed DATETIME, vTimed DATETIME,
vDirection VARCHAR(10) vDirection VARCHAR(10),
vDevice VARCHAR(255)
) )
BEGIN BEGIN
/** /**
* Verifica si el empleado puede fichar * Verifica si el empleado puede fichar
* @param vWorkerFk Identificador del trabajador * @param vWorkerFk Identificador del trabajador
* @param vTimed valor de la fichada, IF vTimed IS NULL vTimed = NOW * @param vTimed Balor de la fichada, IF vTimed IS NULL vTimed = NOW
* @param vDirection solo se pueden pasa los valores del campo * @param vDirection Solo se pueden pasa los valores del campo
* workerTimeControl.direction ENUM('in', 'out', 'middle') * workerTimeControl.direction ENUM('in', 'out', 'middle')
* @return Si todo es correcto, retorna el número de id la tabla workerTimeControl. * @param vDevice Dispositivo en el que se ha fichado
* Si hay algún problema, devuelve el mesaje que se debe mostrar al usuario * @return Si todo es correcto, retorna el número de id la tabla workerTimeControl.
* Solo retorna el primer problema, en caso de no ocurrir ningún error se añadirá * Si hay algún problema, devuelve el mesaje que se debe mostrar al usuario
* fichada a la tabla vn.workerTimeControl * 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 vLastIn DATETIME;
DECLARE vLastOut DATETIME; DECLARE vLastOut DATETIME;
DECLARE vNextIn DATETIME; DECLARE vNextIn DATETIME;
@ -269,16 +271,16 @@ BEGIN
GROUP BY breakCounter GROUP BY breakCounter
HAVING hasError HAVING hasError
LIMIT 1; LIMIT 1;
IF vIsError THEN IF vIsError THEN
SET vErrorCode = 'BREAK_WEEK'; SET vErrorCode = 'BREAK_WEEK';
CALL util.throw(vErrorCode); CALL util.throw(vErrorCode);
END IF; END IF;
END IF; END IF;
-- SE PERMITE FICHAR -- Se permite fichar
INSERT INTO workerTimeControl(userFk, timed, direction, `manual`) INSERT INTO workerTimeControl(userFk, timed, direction, device, `manual`)
VALUES(vWorkerFk, vTimed, vDirection, vIsManual); VALUES(vWorkerFk, vTimed, vDirection, vDevice, vIsManual);
SELECT LAST_INSERT_ID() id; SELECT LAST_INSERT_ID() id;

View File

@ -31,7 +31,7 @@ FROM (
) )
JOIN `vn`.`route` `r` ON(`r`.`id` = `t`.`routeFk`) 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`) LEFT JOIN `vn`.`expeditionTruck` `et2` ON(`et2`.`id` = `rm`.`expeditionTruckFk`)
) )

View File

@ -20,14 +20,12 @@ proc: BEGIN
SET vDate2000 = util.VN_CURDATE() + INTERVAL (2000 - YEAR(util.VN_CURDATE())) YEAR; SET vDate2000 = util.VN_CURDATE() + INTERVAL (2000 - YEAR(util.VN_CURDATE())) YEAR;
SET vRangeDeleteTicket = 60; SET vRangeDeleteTicket = 60;
DELETE FROM Rutas_monitor WHERE fecha < vDate;
DELETE FROM cdr WHERE calldate < vDate18; DELETE FROM cdr WHERE calldate < vDate18;
DELETE FROM Monitoring WHERE ODBC_TIME < vDate; DELETE FROM Monitoring WHERE ODBC_TIME < vDate;
DELETE FROM Conteo WHERE Fecha < vDate; DELETE FROM Conteo WHERE Fecha < vDate;
DELETE FROM XDiario WHERE FECHA < vDate3 OR FECHA IS NULL; DELETE FROM XDiario WHERE FECHA < vDate3 OR FECHA IS NULL;
DELETE FROM mail WHERE DATE_ODBC < vDate; DELETE FROM mail WHERE DATE_ODBC < vDate;
DELETE FROM expeditions_deleted WHERE odbc_date < vDate26; 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 Movimientos_mark WHERE odbc_date < vDate;
DELETE FROM Splits WHERE Fecha < vDate18; DELETE FROM Splits WHERE Fecha < vDate18;
@ -47,8 +45,6 @@ proc: BEGIN
JOIN Tickets t ON m.Id_Ticket = t.Id_Ticket WHERE t.Fecha < vDate; JOIN Tickets t ON m.Id_Ticket = t.Id_Ticket WHERE t.Fecha < vDate;
DELETE FROM Remesas WHERE `Fecha Remesa` < vDate18; DELETE FROM Remesas WHERE `Fecha Remesa` < vDate18;
DELETE FROM sharingcart where datEND < vDate;
DELETE FROM sharingclient where datEND < vDate;
DELETE tt.* DELETE tt.*
FROM Tickets_turno tt FROM Tickets_turno tt

View File

@ -17,7 +17,20 @@ BEGIN
SELECT t.Id_Ticket, Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION SELECT t.Id_Ticket, Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION
FROM Tickets t FROM Tickets t
JOIN Consignatarios cs ON t.Id_Consigna = cs.Id_Consigna 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) WHERE t.Fecha BETWEEN v_Date AND util.dayEnd(v_Date)
AND t.Id_Cliente = v_Client_Id; AND t.Id_Cliente = v_Client_Id;

View File

@ -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`

View File

@ -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`

View File

@ -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`

View File

@ -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`

View File

@ -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`

View File

@ -1,6 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`observation_type`
AS SELECT `co`.`id` AS `observation_type_id`,
`co`.`description` AS `description`
FROM `vn`.`observationType` `co`

View File

@ -1,15 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`order`
AS SELECT `hedera`.`order`.`id` AS `id`,
`hedera`.`order`.`date_make` AS `date_make`,
`hedera`.`order`.`date_send` AS `date_send`,
`hedera`.`order`.`customer_id` AS `customer_id`,
`hedera`.`order`.`delivery_method_id` AS `delivery_method_id`,
`hedera`.`order`.`agency_id` AS `agency_id`,
`hedera`.`order`.`address_id` AS `address_id`,
`hedera`.`order`.`note` AS `note`,
`hedera`.`order`.`confirmed` AS `confirmed`,
`hedera`.`order`.`is_bionic` AS `is_bionic`,
`hedera`.`order`.`source_app` AS `source_app`
FROM `hedera`.`order`

View File

@ -1,6 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`order_Tickets`
AS SELECT `ot`.`orderFk` AS `order_id`,
`ot`.`ticketFk` AS `Id_Ticket`
FROM `vn`.`orderTicket` `ot`

View File

@ -1,7 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`order_component`
AS SELECT `c`.`order_row_id` AS `order_row_id`,
`c`.`component_id` AS `component_id`,
`c`.`price` AS `price`
FROM `hedera`.`order_component` `c`

View File

@ -1,14 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`order_row`
AS SELECT `order_row`.`id` AS `id`,
`order_row`.`order_id` AS `order_id`,
`order_row`.`item_id` AS `item_id`,
`order_row`.`warehouse_id` AS `warehouse_id`,
`order_row`.`shipment` AS `shipment`,
`order_row`.`amount` AS `amount`,
`order_row`.`price` AS `price`,
`order_row`.`rate` AS `rate`,
`order_row`.`created` AS `created`,
`order_row`.`Id_Movimiento` AS `Id_Movimiento`
FROM `hedera`.`order_row`

View File

@ -1,10 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`sharingcart`
AS SELECT `sc`.`id` AS `id`,
`sc`.`workerFk` AS `Id_Trabajador`,
`sc`.`started` AS `datSTART`,
`sc`.`ended` AS `datEND`,
`sc`.`workerSubstitute` AS `Id_Suplente`,
`sc`.`created` AS `odbc_date`
FROM `vn`.`sharingCart` `sc`

View File

@ -1,9 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`sharingclient`
AS SELECT `sc`.`id` AS `id`,
`sc`.`workerFk` AS `Id_Trabajador`,
`sc`.`started` AS `datSTART`,
`sc`.`ended` AS `datEND`,
`sc`.`clientFk` AS `Id_Cliente`
FROM `vn`.`sharingClient` `sc`

View File

@ -1,12 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`sms`
AS SELECT `t`.`id` AS `id`,
`t`.`senderFk` AS `Id_trabajador`,
`t`.`sender` AS `from`,
`t`.`destination` AS `to`,
`t`.`message` AS `text`,
`t`.`statusCode` AS `sent`,
`t`.`status` AS `response`,
`t`.`created` AS `DATE_ODBC`
FROM `vn`.`sms` `t`

View File

@ -1,11 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`tarifas`
AS SELECT `r`.`id` AS `tarifa_id`,
`r`.`dated` AS `fecha`,
`r`.`warehouseFk` AS `warehouse_id`,
`r`.`rate0` AS `t0`,
`r`.`rate1` AS `t1`,
`r`.`rate2` AS `t2`,
`r`.`rate3` AS `t3`
FROM `vn`.`rate` `r`

View File

@ -1,9 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`ticketCreationData`
AS SELECT dayname(`h`.`confirm_date`) AS `DiadelaSemana`,
HOUR(`h`.`confirm_date`) AS `Hora`,
cast(`h`.`confirm_date` AS date) AS `Fecha`,
`h`.`source_app` AS `Dispositivo`
FROM `hedera`.`order` `h`
WHERE `h`.`confirm_date` <> 0

View File

@ -1,38 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`ticketMRW`
AS SELECT `Tickets`.`Id_Agencia` AS `id_Agencia`,
`Tickets`.`empresa_id` AS `empresa_id`,
`Consignatarios`.`consignatario` AS `Consignatario`,
`Consignatarios`.`domicilio` AS `DOMICILIO`,
`Consignatarios`.`poblacion` AS `POBLACION`,
`Consignatarios`.`codPostal` AS `CODPOSTAL`,
`Consignatarios`.`telefono` AS `telefono`,
`Consignatarios`.`movil` AS `movil`,
`Clientes`.`if` AS `IF`,
`Tickets`.`Id_Ticket` AS `Id_Ticket`,
`Tickets`.`warehouse_id` AS `warehouse_id`,
`Consignatarios`.`id_consigna` AS `Id_Consigna`,
`Paises`.`Codigo` AS `CodigoPais`,
`Tickets`.`Fecha` AS `Fecha`,
`province`.`province_id` AS `province_id`,
`Tickets`.`landing` AS `landing`
FROM (
(
(
(
`vn2008`.`Clientes`
JOIN `vn2008`.`Consignatarios` ON(
`Clientes`.`id_cliente` = `Consignatarios`.`Id_cliente`
)
)
JOIN `vn2008`.`Tickets` ON(
`Consignatarios`.`id_consigna` = `Tickets`.`Id_Consigna`
)
)
JOIN `vn2008`.`province` ON(
`Consignatarios`.`province_id` = `province`.`province_id`
)
)
JOIN `vn2008`.`Paises` ON(`province`.`Paises_Id` = `Paises`.`Id`)
)

View File

@ -1,19 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`tr2`
AS SELECT `vn`.`travel`.`id` AS `id`,
`vn`.`travel`.`shipped` AS `shipped`,
`vn`.`travel`.`shipmentHour` AS `shipmentHour`,
`vn`.`travel`.`landed` AS `landed`,
`vn`.`travel`.`landingHour` AS `landingHour`,
`vn`.`travel`.`warehouseInFk` AS `warehouseInFk`,
`vn`.`travel`.`warehouseOutFk` AS `warehouseOutFk`,
`vn`.`travel`.`agencyModeFk` AS `agencyFk`,
`vn`.`travel`.`ref` AS `ref`,
`vn`.`travel`.`isDelivered` AS `isDelivered`,
`vn`.`travel`.`isReceived` AS `isReceived`,
`vn`.`travel`.`m3` AS `m3`,
`vn`.`travel`.`kg` AS `kg`,
`vn`.`travel`.`cargoSupplierFk` AS `cargoSupplierFk`,
`vn`.`travel`.`totalEntries` AS `totalEntries`
FROM `vn`.`travel`

View File

@ -1,11 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`travel_thermograph`
AS SELECT `tt`.`thermographFk` AS `thermograph_id`,
`tt`.`created` AS `odbc_date`,
`tt`.`warehouseFk` AS `warehouse_id`,
`tt`.`travelFk` AS `travel_id`,
`tt`.`temperatureFk` AS `temperature`,
`tt`.`result` AS `result`,
`tt`.`dmsFk` AS `gestdoc_id`
FROM `vn`.`travelThermograph` `tt`

View File

@ -1,5 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_account`
AS SELECT `a`.`id` AS `user_id`
FROM `account`.`account` `a`

View File

@ -1,15 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_analisis_ventas`
AS SELECT `bi`.`analisis_ventas`.`Familia` AS `Familia`,
`bi`.`analisis_ventas`.`Reino` AS `Reino`,
`bi`.`analisis_ventas`.`Comercial` AS `Comercial`,
`bi`.`analisis_ventas`.`Comprador` AS `Comprador`,
`bi`.`analisis_ventas`.`Provincia` AS `Provincia`,
`bi`.`analisis_ventas`.`almacen` AS `almacen`,
`bi`.`analisis_ventas`.`Año` AS `Año`,
`bi`.`analisis_ventas`.`Mes` AS `Mes`,
`bi`.`analisis_ventas`.`Semana` AS `Semana`,
`bi`.`analisis_ventas`.`Vista` AS `Vista`,
`bi`.`analisis_ventas`.`Importe` AS `Importe`
FROM `bi`.`analisis_ventas`

View File

@ -1,21 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_barcodes`
AS SELECT `Articles`.`Id_Article` AS `code`,
`Articles`.`Id_Article` AS `Id_Article`
FROM `vn2008`.`Articles`
UNION ALL
SELECT `barcodes`.`code` AS `code`,
`barcodes`.`Id_Article` AS `Id_Article`
FROM `vn2008`.`barcodes`
UNION ALL
SELECT `c`.`Id_Compra` AS `Id_Compra`,
`c`.`Id_Article` AS `Id_Article`
FROM (
(
`vn2008`.`Compres` `c`
JOIN `vn2008`.`Entradas` `e` ON(`c`.`Id_Entrada` = `e`.`Id_Entrada`)
)
JOIN `vn2008`.`travel` `tr` ON(`tr`.`id` = `e`.`travel_id`)
)
WHERE `tr`.`landing` >= `util`.`VN_CURDATE`() + INTERVAL -15 DAY

View File

@ -1,8 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_departure_limit`
AS SELECT `cache`.`departure_limit`.`warehouse_id` AS `warehouse_id`,
`cache`.`departure_limit`.`fecha` AS `fecha`,
`cache`.`departure_limit`.`hora` AS `hora`,
`cache`.`departure_limit`.`minSpeed` AS `minSpeed`
FROM `cache`.`departure_limit`

View File

@ -1,41 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_descuadre_bionic`
AS SELECT `t`.`Id_Ticket` AS `Id_Ticket`,
`t`.`Alias` AS `Alias`,
`m`.`Concepte` AS `Concepte`,
sum(`mc`.`Valor`) AS `suma_componente`,
`m`.`Preu` AS `Preu`,
`m`.`Descuento` AS `Descuento`,
`m`.`Preu` * (100 - `m`.`Descuento`) / 100 - sum(`mc`.`Valor`) AS `diferencia`,
`t`.`Fecha` AS `Fecha`,
`m`.`Preu` > 0
AND `tp`.`reino_id` <> 6
AND `a`.`tipo_id` NOT IN (7, 115) AS `benvenut`
FROM (
(
(
(
(
(
`vn2008`.`Movimientos` `m`
JOIN `vn2008`.`Tickets` `t` ON(`m`.`Id_Ticket` = `t`.`Id_Ticket`)
)
JOIN `vn2008`.`Clientes` `c` ON(`t`.`Id_Cliente` = `c`.`id_cliente`)
)
JOIN `vn2008`.`warehouse` `w` ON(`w`.`id` = `t`.`warehouse_id`)
)
JOIN `vn2008`.`Articles` `a` ON(`m`.`Id_Article` = `a`.`Id_Article`)
)
JOIN `vn2008`.`Tipos` `tp` ON(`a`.`tipo_id` = `tp`.`tipo_id`)
)
LEFT JOIN `vn2008`.`Movimientos_componentes` `mc` ON(`m`.`Id_Movimiento` = `mc`.`Id_Movimiento`)
)
WHERE `t`.`Fecha` >= '2015-09-01'
AND `t`.`empresa_id` IN (442, 791, 567)
AND `w`.`reserve` <> 0
AND `c`.`real` <> 0
AND `tp`.`reino_id` <> 6
GROUP BY `m`.`Id_Movimiento`
HAVING abs(`diferencia`) > 0.01
OR `diferencia` IS NULL

View File

@ -1,11 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_inter`
AS SELECT `tt`.`id` AS `inter_id`,
`tt`.`stateFk` AS `state_id`,
`tt`.`notes` AS `nota`,
`tt`.`created` AS `odbc_date`,
`tt`.`ticketFk` AS `Id_Ticket`,
`tt`.`userFk` AS `Id_Trabajador`,
`tt`.`supervisorFk` AS `Id_supervisor`
FROM `vn`.`ticketTracking` `tt`

View File

@ -1,23 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_miriam`
AS SELECT `M`.`Id_Article` AS `Id_Article`,
`M`.`Concepte` AS `Concepte`,
`M`.`Cantidad` AS `Cantidad`,
`M`.`Preu` AS `Preu`,
`M`.`Descuento` AS `Descuento`,
`T`.`Fecha` AS `Fecha`,
`T`.`Id_Cliente` AS `Id_Cliente`,
`M`.`Cantidad` * `M`.`Preu` * (100 - `M`.`Descuento`) / 100 AS `Importe`
FROM (
(
(
`vn2008`.`Tickets` `T`
JOIN `vn2008`.`Movimientos` `M` ON(`T`.`Id_Ticket` = `M`.`Id_Ticket`)
)
JOIN `vn2008`.`Articles` `A` ON(`M`.`Id_Article` = `A`.`Id_Article`)
)
JOIN `vn2008`.`Tipos` `TP` ON(`A`.`tipo_id` = `TP`.`tipo_id`)
)
WHERE `T`.`Fecha` >= '2011-01-01'
AND `A`.`tipo_id` = 7

View File

@ -1,35 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_price_fixed`
AS SELECT `pf`.`warehouse_id` AS `warehouse_id`,
`pf`.`item_id` AS `item_id`,
`pf`.`rate_0` AS `rate_0`,
`pf`.`rate_1` AS `rate_1`,
`pf`.`rate_2` AS `rate_2`,
`pf`.`rate_3` AS `rate_3`,
`pf`.`date_start` AS `date_start`,
`pf`.`date_end` AS `date_end`,
`pf`.`bonus` AS `bonus`,
`pf`.`grouping` AS `grouping`,
`pf`.`Packing` AS `Packing`,
`pf`.`caja` AS `caja`
FROM `vn2008`.`price_fixed` `pf`
WHERE `pf`.`warehouse_id` < 1000
UNION ALL
SELECT `wg`.`warehouse_id` AS `warehouse_id`,
`pf`.`item_id` AS `item_id`,
`pf`.`rate_0` AS `rate_0`,
`pf`.`rate_1` AS `rate_1`,
`pf`.`rate_2` AS `rate_2`,
`pf`.`rate_3` AS `rate_3`,
`pf`.`date_start` AS `date_start`,
`pf`.`date_end` AS `date_end`,
`pf`.`bonus` AS `bonus`,
`pf`.`grouping` AS `grouping`,
`pf`.`Packing` AS `Packing`,
`pf`.`caja` AS `caja`
FROM (
`vn2008`.`price_fixed` `pf`
JOIN `vn2008`.`warehouse_group` `wg`
)
WHERE `wg`.`warehouse_alias_id` + 1000 = `pf`.`warehouse_id`

View File

@ -1,20 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_price_fixed_group`
AS SELECT `pf`.`warehouse_id` AS `warehouse_id`,
`pf`.`item_id` AS `item_id`,
`pf`.`rate_0` AS `rate_0`,
`pf`.`rate_1` AS `rate_1`,
`pf`.`rate_2` AS `rate_2`,
`pf`.`rate_3` AS `rate_3`,
`pf`.`date_start` AS `date_start`,
`pf`.`date_end` AS `date_end`,
`pf`.`bonus` AS `bonus`,
`pf`.`grouping` AS `grouping`,
`pf`.`Packing` AS `Packing`,
`pf`.`caja` AS `caja`
FROM `vn2008`.`v_price_fixed` `pf`
GROUP BY `pf`.`warehouse_id`,
`pf`.`item_id`,
`pf`.`date_start`,
`pf`.`date_end`

View File

@ -1,15 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_ticket_amount`
AS 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`

View File

@ -1,10 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_warehouse`
AS SELECT `warehouse`.`id` AS `id`,
`warehouse`.`name` AS `almacen`
FROM `vn2008`.`warehouse`
UNION ALL
SELECT 1000 + `warehouse_alias`.`warehouse_alias_id` AS `warehouse_alias_id`,
concat(`warehouse_alias`.`alias`, '(G)') AS `concat(alias, '(G)')`
FROM `vn2008`.`warehouse_alias`

View File

@ -1,12 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_xsubclien`
AS SELECT DISTINCT `Facturas`.`Id_Cliente` AS `Id_Cliente`,
`Facturas`.`empresa_id` AS `empresa_id`
FROM `vn2008`.`Facturas`
WHERE `Facturas`.`Fecha` > `util`.`VN_CURDATE`() + INTERVAL -2 MONTH
UNION
SELECT `Recibos`.`Id_Cliente` AS `Id_Cliente`,
`Recibos`.`empresa_id` AS `empresa_id`
FROM `vn2008`.`Recibos`
WHERE `Recibos`.`Fechacobro` > `util`.`VN_CURDATE`() + INTERVAL -2 MONTH

View File

@ -17,7 +17,7 @@ AS SELECT `Clientes`.`Cuenta` AS `COD`,
`province`.`name` AS `PROVINCIA`, `province`.`name` AS `PROVINCIA`,
`Clientes`.`codPostal` AS `CODPOSTAL`, `Clientes`.`codPostal` AS `CODPOSTAL`,
`p`.`Codigo` AS `country_code`, `p`.`Codigo` AS `country_code`,
`v_xsubclien`.`empresa_id` AS `empresa_id`, sub.`empresa_id` AS `empresa_id`,
substr( substr(
`Clientes`.`e-mail`, `Clientes`.`e-mail`,
1, 1,
@ -39,8 +39,18 @@ FROM (
( (
( (
`vn2008`.`Clientes` `vn2008`.`Clientes`
JOIN `vn2008`.`v_xsubclien` ON( JOIN (
`Clientes`.`id_cliente` = `v_xsubclien`.`Id_Cliente` SELECT DISTINCT `Facturas`.`Id_Cliente` AS `Id_Cliente`,
`Facturas`.`empresa_id` AS `empresa_id`
FROM `vn2008`.`Facturas`
WHERE `Facturas`.`Fecha` > `util`.`VN_CURDATE`() + INTERVAL -2 MONTH
UNION
SELECT `Recibos`.`Id_Cliente` AS `Id_Cliente`,
`Recibos`.`empresa_id` AS `empresa_id`
FROM `vn2008`.`Recibos`
WHERE `Recibos`.`Fechacobro` > `util`.`VN_CURDATE`() + INTERVAL -2 MONTH
) sub ON(
`Clientes`.`id_cliente` = sub.`Id_Cliente`
) )
) )
LEFT JOIN `vn2008`.`Paises` `p` ON(`p`.`Id` = `Clientes`.`Id_Pais`) LEFT JOIN `vn2008`.`Paises` `p` ON(`p`.`Id` = `Clientes`.`Id_Pais`)
@ -50,7 +60,7 @@ FROM (
) )
) )
GROUP BY `Clientes`.`id_cliente`, GROUP BY `Clientes`.`id_cliente`,
`v_xsubclien`.`empresa_id` sub.`empresa_id`
UNION ALL UNION ALL
SELECT `Proveedores`.`cuenta` AS `Cuenta`, SELECT `Proveedores`.`cuenta` AS `Cuenta`,
`Proveedores`.`Proveedor` AS `Proveedor`, `Proveedores`.`Proveedor` AS `Proveedor`,
@ -68,7 +78,7 @@ SELECT `Proveedores`.`cuenta` AS `Cuenta`,
`prov`.`name` AS `Provincia`, `prov`.`name` AS `Provincia`,
`Proveedores`.`codpos` AS `CP`, `Proveedores`.`codpos` AS `CP`,
`p`.`Codigo` AS `country_code`, `p`.`Codigo` AS `country_code`,
`v_xsubprov`.`empresa_id` AS `empresa_id`, sub.`empresa_id` AS `empresa_id`,
substr( substr(
`c`.`email`, `c`.`email`,
1, 1,
@ -80,8 +90,22 @@ FROM (
( (
( (
`vn2008`.`Proveedores` `vn2008`.`Proveedores`
JOIN `vn2008`.`v_xsubprov` ON( JOIN (
`Proveedores`.`Id_Proveedor` = `v_xsubprov`.`proveedor_id` SELECT `recibida`.`proveedor_id` AS `proveedor_id`,
`recibida`.`empresa_id` AS `empresa_id`
FROM `vn2008`.`recibida`
WHERE `recibida`.`fecha` > `util`.`VN_CURDATE`() + INTERVAL -3 MONTH
GROUP BY `recibida`.`proveedor_id`,
`recibida`.`empresa_id`
UNION ALL
SELECT `pago`.`id_proveedor` AS `id_proveedor`,
`pago`.`empresa_id` AS `empresa_id`
FROM `vn2008`.`pago`
WHERE `pago`.`fecha` > `util`.`VN_CURDATE`() + INTERVAL -3 MONTH
GROUP BY `pago`.`id_proveedor`,
`pago`.`empresa_id`
) sub ON(
`Proveedores`.`Id_Proveedor` = sub.`proveedor_id`
) )
) )
LEFT JOIN `vn2008`.`Paises` `p` ON(`p`.`Id` = `Proveedores`.`pais_id`) LEFT JOIN `vn2008`.`Paises` `p` ON(`p`.`Id` = `Proveedores`.`pais_id`)
@ -93,8 +117,8 @@ FROM (
LEFT JOIN `vn`.`supplierContact` `c` ON(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`) LEFT JOIN `vn`.`supplierContact` `c` ON(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)
) )
WHERE `Proveedores`.`oficial` <> 0 WHERE `Proveedores`.`oficial` <> 0
GROUP BY `v_xsubprov`.`proveedor_id`, GROUP BY sub.`proveedor_id`,
`v_xsubprov`.`empresa_id` sub.`empresa_id`
UNION ALL UNION ALL
SELECT `Gastos`.`Id_Gasto` COLLATE utf8mb3_unicode_ci AS `Id_Gasto`, SELECT `Gastos`.`Id_Gasto` COLLATE utf8mb3_unicode_ci AS `Id_Gasto`,
`Gastos`.`Gasto` COLLATE utf8mb3_unicode_ci AS `Gasto`, `Gastos`.`Gasto` COLLATE utf8mb3_unicode_ci AS `Gasto`,
@ -136,7 +160,7 @@ SELECT lpad(right(`Proveedores`.`cuenta`, 5), 10, '47510000') AS `Cuenta`,
`prov`.`name` AS `Provincia`, `prov`.`name` AS `Provincia`,
`Proveedores`.`codpos` AS `CP`, `Proveedores`.`codpos` AS `CP`,
`p`.`Codigo` AS `country_code`, `p`.`Codigo` AS `country_code`,
`v_xsubprov`.`empresa_id` AS `empresa_id`, sub.`empresa_id` AS `empresa_id`,
substr( substr(
`c`.`email`, `c`.`email`,
1, 1,
@ -148,8 +172,22 @@ FROM (
( (
( (
`vn2008`.`Proveedores` `vn2008`.`Proveedores`
JOIN `vn2008`.`v_xsubprov` ON( JOIN (
`Proveedores`.`Id_Proveedor` = `v_xsubprov`.`proveedor_id` SELECT `recibida`.`proveedor_id` AS `proveedor_id`,
`recibida`.`empresa_id` AS `empresa_id`
FROM `vn2008`.`recibida`
WHERE `recibida`.`fecha` > `util`.`VN_CURDATE`() + INTERVAL -3 MONTH
GROUP BY `recibida`.`proveedor_id`,
`recibida`.`empresa_id`
UNION ALL
SELECT `pago`.`id_proveedor` AS `id_proveedor`,
`pago`.`empresa_id` AS `empresa_id`
FROM `vn2008`.`pago`
WHERE `pago`.`fecha` > `util`.`VN_CURDATE`() + INTERVAL -3 MONTH
GROUP BY `pago`.`id_proveedor`,
`pago`.`empresa_id`
) sub ON(
`Proveedores`.`Id_Proveedor` = sub.`proveedor_id`
) )
) )
LEFT JOIN `vn2008`.`Paises` `p` ON(`p`.`Id` = `Proveedores`.`pais_id`) LEFT JOIN `vn2008`.`Paises` `p` ON(`p`.`Id` = `Proveedores`.`pais_id`)
@ -165,5 +203,5 @@ WHERE (
OR `Proveedores`.`cuenta` LIKE '_____2____' OR `Proveedores`.`cuenta` LIKE '_____2____'
) )
AND `Proveedores`.`oficial` = 1 AND `Proveedores`.`oficial` = 1
GROUP BY `v_xsubprov`.`proveedor_id`, GROUP BY sub.`proveedor_id`,
`v_xsubprov`.`empresa_id` sub.`empresa_id`

View File

@ -1,16 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_xsubprov`
AS SELECT `recibida`.`proveedor_id` AS `proveedor_id`,
`recibida`.`empresa_id` AS `empresa_id`
FROM `vn2008`.`recibida`
WHERE `recibida`.`fecha` > `util`.`VN_CURDATE`() + INTERVAL -3 MONTH
GROUP BY `recibida`.`proveedor_id`,
`recibida`.`empresa_id`
UNION ALL
SELECT `pago`.`id_proveedor` AS `id_proveedor`,
`pago`.`empresa_id` AS `empresa_id`
FROM `vn2008`.`pago`
WHERE `pago`.`fecha` > `util`.`VN_CURDATE`() + INTERVAL -3 MONTH
GROUP BY `pago`.`id_proveedor`,
`pago`.`empresa_id`

View File

@ -1,8 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`vnCreditClassification`
AS SELECT `vn`.`creditClassification`.`id` AS `id`,
`vn`.`creditClassification`.`client` AS `client`,
`vn`.`creditClassification`.`dateStart` AS `dateStart`,
`vn`.`creditClassification`.`dateEnd` AS `dateEnd`
FROM `vn`.`creditClassification`

View File

@ -1,9 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`vnCreditInsurance`
AS SELECT `vn`.`creditInsurance`.`id` AS `id`,
`vn`.`creditInsurance`.`creditClassification` AS `creditClassification`,
`vn`.`creditInsurance`.`credit` AS `credit`,
`vn`.`creditInsurance`.`creationDate` AS `creationDate`,
`vn`.`creditInsurance`.`grade` AS `grade`
FROM `vn`.`creditInsurance`

View File

@ -1,8 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`vnSolunionCAP`
AS SELECT `vn`.`solunionCAP`.`creditInsurance` AS `creditInsurance`,
`vn`.`solunionCAP`.`dateStart` AS `dateStart`,
`vn`.`solunionCAP`.`dateEnd` AS `dateEnd`,
`vn`.`solunionCAP`.`dateLeaving` AS `dateLeaving`
FROM `vn`.`solunionCAP`

View File

@ -1,6 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`warehouse_alias`
AS SELECT `wa`.`id` AS `warehouse_alias_id`,
`wa`.`name` AS `alias`
FROM `vn`.`warehouseAlias` `wa`

View File

@ -1,7 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`workcenter_holiday`
AS SELECT `wh`.`workCenterFk` AS `workcenter_id`,
`wh`.`days` AS `day`,
`wh`.`year` AS `year`
FROM `vn`.`workCenterHoliday` `wh`

View File

@ -1,19 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`zoneNickname`
AS SELECT `ap`.`warehouse_id` AS `warehouse_id`,
`ap`.`agency_id` AS `agency_id`,
`ap`.`zona` AS `zona`,
concat(
'ZONA ',
`ap`.`zona`,
' ',
IF(`ap`.`zona` = 20, 'Madrid', `p`.`name`)
) AS `alias`
FROM (
`vn2008`.`Agencias_province` `ap`
JOIN `vn2008`.`province` `p` ON(`p`.`province_id` = `ap`.`province_id`)
)
GROUP BY `ap`.`zona`,
`ap`.`warehouse_id`,
`ap`.`agency_id`

View File

@ -0,0 +1 @@
ALTER TABLE vn.workerTimeControl ADD device varchar(255) DEFAULT NULL NULL COMMENT 'Dispositivo en el que se ha fichado' AFTER `order`;

View File

@ -0,0 +1 @@
ALTER TABLE vn.workerTimeControl CHANGE direction direction enum('in','out','middle') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'middle' NULL AFTER timed;

View File

@ -0,0 +1,4 @@
REVOKE SELECT, INSERT, UPDATE ON TABLE vn2008.Rutas_Master FROM productionAssi;
REVOKE SELECT ON TABLE vn2008.Rutas_monitor FROM employee;
REVOKE SELECT, INSERT, UPDATE, DELETE ON TABLE vn2008.tarifas FROM buyer;
REVOKE SELECT, UPDATE ON TABLE vn2008.tarifas FROM buyerBoss;

View File

@ -0,0 +1 @@
REVOKE SELECT ON TABLE vn2008.Vistas FROM employee;

View File

@ -22,6 +22,7 @@ services:
- 3000 - 3000
environment: environment:
- NODE_ENV - NODE_ENV
- DEBUG
configs: configs:
- source: datasources - source: datasources
target: /etc/salix/datasources.json target: /etc/salix/datasources.json

View File

@ -62,8 +62,10 @@
} }
}, },
"node_modules/angular-translate": { "node_modules/angular-translate": {
"version": "2.19.0", "version": "2.19.1",
"license": "MIT", "resolved": "https://registry.npmjs.org/angular-translate/-/angular-translate-2.19.1.tgz",
"integrity": "sha512-SrU40ndnL422vXiVoqVveCmSnCzMcIXxQgnl7Cv9krOKUg6B8KZK3ddYzidHR/rxVuySezYHNDgRvzQNKwAdNQ==",
"deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",
"dependencies": { "dependencies": {
"angular": "^1.8.0" "angular": "^1.8.0"
}, },
@ -185,7 +187,9 @@
} }
}, },
"angular-translate": { "angular-translate": {
"version": "2.19.0", "version": "2.19.1",
"resolved": "https://registry.npmjs.org/angular-translate/-/angular-translate-2.19.1.tgz",
"integrity": "sha512-SrU40ndnL422vXiVoqVveCmSnCzMcIXxQgnl7Cv9krOKUg6B8KZK3ddYzidHR/rxVuySezYHNDgRvzQNKwAdNQ==",
"requires": { "requires": {
"angular": "^1.8.0" "angular": "^1.8.0"
} }

View File

@ -333,7 +333,7 @@
"It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}", "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}",
"This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada", "This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada",
"This user does not have an assigned tablet": "Este usuario no tiene tablet asignada", "This user does not have an assigned tablet": "Este usuario no tiene tablet asignada",
"Incorrect pin": "Pin incorrecto.", "Incorrect pin": "Pin incorrecto",
"You already have the mailAlias": "Ya tienes este alias de correo", "You already have the mailAlias": "Ya tienes este alias de correo",
"The alias cant be modified": "Este alias de correo no puede ser modificado", "The alias cant be modified": "Este alias de correo no puede ser modificado",
"No tickets to invoice": "No hay tickets para facturar", "No tickets to invoice": "No hay tickets para facturar",

View File

@ -1,6 +1,6 @@
import './index'; import './index';
fdescribe('component vnRoleCard', () => { describe('component vnRoleCard', () => {
let controller; let controller;
let $httpBackend; let $httpBackend;

View File

@ -1,6 +1,6 @@
import './index'; import './index';
fdescribe('component vnRoleDescriptor', () => { describe('component vnRoleDescriptor', () => {
let controller; let controller;
let $httpBackend; let $httpBackend;

View File

@ -63,7 +63,7 @@ module.exports = Self => {
const isAvailable = itemStock.available > 0; const isAvailable = itemStock.available > 0;
if (!isAvailable || !ctx.args.quantity) if (!isAvailable)
throw new UserError(`This item is not available`); throw new UserError(`This item is not available`);
if (request.saleFk) if (request.saleFk)

View File

@ -72,24 +72,25 @@ module.exports = Self => {
async function createGestDoc(id) { async function createGestDoc(id) {
const ticket = await models.Ticket.findById(id, const ticket = await models.Ticket.findById(id,
{include: [ {
{ include: [
relation: 'warehouse', {
scope: { relation: 'warehouse',
fields: ['id'] scope: {
fields: ['id']
}
}, {
relation: 'client',
scope: {
fields: ['name']
}
}, {
relation: 'route',
scope: {
fields: ['id']
}
} }
}, { ]
relation: 'client',
scope: {
fields: ['name']
}
}, {
relation: 'route',
scope: {
fields: ['id']
}
}
]
}, myOptions); }, myOptions);
const dmsType = await models.DmsType.findOne({where: {code: 'Ticket'}, fields: ['id']}, myOptions); const dmsType = await models.DmsType.findOne({where: {code: 'Ticket'}, fields: ['id']}, myOptions);
const ctxUploadFile = Object.assign({}, ctx); const ctxUploadFile = Object.assign({}, ctx);
@ -125,17 +126,17 @@ module.exports = Self => {
if (await gestDocExists(ticketId)) if (await gestDocExists(ticketId))
throw new UserError('Ticket is already signed'); throw new UserError('Ticket is already signed');
if (location) setLocation(ticketId); if (location) await setLocation(ticketId);
if (!gestDocCreated) await createGestDoc(ticketId); if (!gestDocCreated) await createGestDoc(ticketId);
await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions); await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions);
const ticket = await models.Ticket.findById(ticketId, null, myOptions); const ticket = await models.Ticket.findById(ticketId, null, myOptions);
await ticket.updateAttribute('isSigned', true, myOptions); await ticket.updateAttribute('isSigned', true, myOptions);
const deliveryState = await models.State.find({ const deliveryState = await models.State.findOne({
where: { where: {
code: 'DELIVERED' code: 'DELIVERED'
} }
}, options); }, myOptions);
await models.Ticket.state(ctx, { await models.Ticket.state(ctx, {
ticketFk: ticketId, ticketFk: ticketId,

View File

@ -46,6 +46,6 @@ module.exports = Self => {
if (!isSubordinate || (isHimself && !isTeamBoss)) if (!isSubordinate || (isHimself && !isTeamBoss))
throw new UserError(`You don't have enough privileges`); throw new UserError(`You don't have enough privileges`);
return Self.clockIn(workerId, args.timed, args.direction, myOptions); return Self.clockIn(workerId, args.timed, args.direction, null, myOptions);
}; };
}; };

View File

@ -18,7 +18,10 @@ module.exports = Self => {
arg: 'direction', arg: 'direction',
type: 'string' type: 'string'
}, },
{
arg: 'device',
type: 'string'
},
], ],
http: { http: {
path: `/clockIn`, path: `/clockIn`,
@ -30,13 +33,19 @@ module.exports = Self => {
} }
}); });
Self.clockIn = async(workerFk, timed, direction, options) => { Self.clockIn = async(workerFk, timed, direction, device, options) => {
const myOptions = {}; const myOptions = {};
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
const query = 'CALL vn.workerTimeControl_clockIn(?, ?, ?)'; const query = 'CALL vn.workerTimeControl_clockIn(?, ?, ?, ?)';
const [[response]] = await Self.rawSql(query, [workerFk, timed, direction], myOptions); const [[response]] = await Self.rawSql(query, [
workerFk,
timed,
direction,
(device || null)],
myOptions);
if (response && response.error) if (response && response.error)
throw new UserError(response.error); throw new UserError(response.error);

View File

@ -1,7 +1,7 @@
const UserError = require('vn-loopback/util/user-error'); const UserError = require('vn-loopback/util/user-error');
module.exports = Self => { module.exports = Self => {
Self.remoteMethodCtx('login', { Self.remoteMethod('login', {
description: 'Consult the user\'s information and the buttons that must be activated after logging in', description: 'Consult the user\'s information and the buttons that must be activated after logging in',
accessType: 'READ', accessType: 'READ',
accepts: [ accepts: [
@ -21,15 +21,14 @@ module.exports = Self => {
} }
}); });
Self.login = async(ctx, pin, options) => { Self.login = async(pin, options) => {
const myOptions = {}; const myOptions = {};
const $t = ctx.req.__;
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
const query = `CALL vn.workerTimeControl_login(?)`; const query = `CALL vn.workerTimeControl_login(?)`;
const [[user]] = await Self.rawSql(query, [pin], myOptions); const [[user]] = await Self.rawSql(query, [pin], myOptions);
if (!user) throw new UserError($t('Incorrect pin')); if (!user) throw new UserError('Incorrect pin');
return user; return user;
}; };
}; };

View File

@ -30,7 +30,7 @@ describe('workerTimeControl clockIn()', () => {
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
await models.WorkerTimeControl.clockIn(workerId, inTime, 'in', options); await models.WorkerTimeControl.clockIn(workerId, inTime, 'in', 'test', options);
const isClockIn = await models.WorkerTimeControl.findOne({ const isClockIn = await models.WorkerTimeControl.findOne({
where: { where: {
userFk: workerId userFk: workerId

View File

@ -3,29 +3,15 @@ const LoopBackContext = require('loopback-context');
const UserError = require('vn-loopback/util/user-error'); const UserError = require('vn-loopback/util/user-error');
describe('workerTimeControl login()', () => { describe('workerTimeControl login()', () => {
let ctx;
beforeAll(async() => {
ctx = {
accessToken: {userId: 9},
req: {
headers: {origin: 'http://localhost'},
__: key => key
}
};
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: ctx
});
});
it('should correctly login', async() => { it('should correctly login', async() => {
const response = await models.WorkerTimeControl.login(ctx, 9); const response = await models.WorkerTimeControl.login(9);
expect(response.name).toBe('developer'); expect(response.name).toBe('developer');
}); });
it('should throw UserError if pin is not provided', async() => { it('should throw UserError if pin is not provided', async() => {
try { try {
await models.WorkerTimeControl.login(ctx); await models.WorkerTimeControl.login();
} catch (error) { } catch (error) {
expect(error).toBeInstanceOf(UserError); expect(error).toBeInstanceOf(UserError);
expect(error.message).toBe('Incorrect pin'); expect(error.message).toBe('Incorrect pin');

View File

@ -14,13 +14,16 @@
"timed": { "timed": {
"type": "date" "type": "date"
}, },
"direction": {
"type": "string"
},
"manual": { "manual": {
"type": "boolean" "type": "boolean"
}, },
"order": { "order": {
"type": "number" "type": "number"
}, },
"direction": { "device": {
"type": "string" "type": "string"
}, },
"isSendMail": { "isSendMail": {

8129
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -14,8 +14,6 @@
"dependencies": { "dependencies": {
"axios": "^1.2.2", "axios": "^1.2.2",
"base64url": "^3.0.1", "base64url": "^3.0.1",
"bcrypt": "^5.0.1",
"bmp-js": "^0.1.0",
"compression": "^1.7.3", "compression": "^1.7.3",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"fs-extra": "^5.0.0", "fs-extra": "^5.0.0",
@ -24,7 +22,6 @@
"got": "^10.7.0", "got": "^10.7.0",
"helmet": "^3.21.2", "helmet": "^3.21.2",
"i18n": "^0.8.4", "i18n": "^0.8.4",
"image-type": "^4.1.0",
"imap": "^0.8.19", "imap": "^0.8.19",
"jsdom": "^16.7.0", "jsdom": "^16.7.0",
"jszip": "^3.10.0", "jszip": "^3.10.0",
@ -36,21 +33,15 @@
"loopback-connector-mysql": "^6.2.0", "loopback-connector-mysql": "^6.2.0",
"loopback-connector-remote": "^3.4.1", "loopback-connector-remote": "^3.4.1",
"loopback-context": "^3.5.2", "loopback-context": "^3.5.2",
"mailparser": "^2.8.0",
"md5": "^2.2.1", "md5": "^2.2.1",
"node-ssh": "^11.0.0", "node-ssh": "^11.0.0",
"object-diff": "0.0.4",
"object.pick": "^1.3.0", "object.pick": "^1.3.0",
"puppeteer": "^20.3.0", "puppeteer": "^21.10.0",
"read-chunk": "^3.2.0",
"require-yaml": "0.0.1", "require-yaml": "0.0.1",
"smbhash": "0.0.1", "smbhash": "0.0.1",
"strong-error-handler": "^2.3.2", "strong-error-handler": "^2.3.2",
"url-loader": "^4.1.1",
"uuid": "^3.3.3",
"vn-loopback": "file:./loopback", "vn-loopback": "file:./loopback",
"vn-print": "file:./print", "vn-print": "file:./print"
"xml2js": "^0.4.23"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.7.7", "@babel/core": "^7.7.7",
@ -91,7 +82,6 @@
"json-loader": "^0.5.7", "json-loader": "^0.5.7",
"merge-stream": "^1.0.1", "merge-stream": "^1.0.1",
"minimist": "^1.2.5", "minimist": "^1.2.5",
"mysql2": "^1.7.0",
"node-sass": "^9.0.0", "node-sass": "^9.0.0",
"nodemon": "^2.0.16", "nodemon": "^2.0.16",
"plugin-error": "^1.0.1", "plugin-error": "^1.0.1",

2725
print/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,6 @@
"intl": "^1.2.5", "intl": "^1.2.5",
"js-yaml": "^3.13.1", "js-yaml": "^3.13.1",
"jsbarcode": "^3.11.5", "jsbarcode": "^3.11.5",
"jsonexport": "^3.2.0",
"juice": "^5.2.0", "juice": "^5.2.0",
"log4js": "^6.7.0", "log4js": "^6.7.0",
"mysql2": "^1.7.0", "mysql2": "^1.7.0",

View File

@ -18,7 +18,6 @@ module.exports = {
} }
}, },
async serverPrefetch() { async serverPrefetch() {
await this.rawSql('SET @hasPrevia := 0');
let ticketIds; let ticketIds;
const res = await this.rawSqlFromDef('tickets', [this.id]); const res = await this.rawSqlFromDef('tickets', [this.id]);
if (res.length) { if (res.length) {

View File

@ -16,7 +16,7 @@ SELECT c.itemPackingTypeFk code,
DATE_FORMAT(t.shipped, '%d/%m/%y') shipped, DATE_FORMAT(t.shipped, '%d/%m/%y') shipped,
tt.labelCount, tt.labelCount,
t.nickName, t.nickName,
SUM(IF(sgd.id, IF(@hasPrevia, 0, @hasPrevia := 1), 1)) lineCount, SUM(IF(sgd.id IS NULL, 1, 0)) + IF(sgd.id , 1, 0) lineCount,
rm.routeFk rm.routeFk
FROM vn.ticket t FROM vn.ticket t
JOIN vn.ticketCollection tc ON tc.ticketFk = t.id JOIN vn.ticketCollection tc ON tc.ticketFk = t.id