diff --git a/db/routines/bi/procedures/analisis_ventas_update.sql b/db/routines/bi/procedures/analisis_ventas_update.sql index 04f9b6483..4f6a448ed 100644 --- a/db/routines/bi/procedures/analisis_ventas_update.sql +++ b/db/routines/bi/procedures/analisis_ventas_update.sql @@ -47,7 +47,7 @@ BEGIN 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 ; diff --git a/db/routines/vn/procedures/clean.sql b/db/routines/vn/procedures/clean.sql index 1734bea98..0e60fad1d 100644 --- a/db/routines/vn/procedures/clean.sql +++ b/db/routines/vn/procedures/clean.sql @@ -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 diff --git a/db/routines/vn/procedures/duaInvoiceInBooking.sql b/db/routines/vn/procedures/duaInvoiceInBooking.sql index 9e794f0ed..77924938b 100644 --- a/db/routines/vn/procedures/duaInvoiceInBooking.sql +++ b/db/routines/vn/procedures/duaInvoiceInBooking.sql @@ -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; diff --git a/db/routines/vn2008/procedures/XDiario_Quadrator.sql b/db/routines/vn2008/procedures/XDiario_Quadrator.sql index c95a3a892..93ddc231d 100644 --- a/db/routines/vn2008/procedures/XDiario_Quadrator.sql +++ b/db/routines/vn2008/procedures/XDiario_Quadrator.sql @@ -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 diff --git a/db/routines/vn2008/procedures/clean.sql b/db/routines/vn2008/procedures/clean.sql index f63edc80a..bd8a324c6 100644 --- a/db/routines/vn2008/procedures/clean.sql +++ b/db/routines/vn2008/procedures/clean.sql @@ -23,7 +23,6 @@ proc: BEGIN 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 Movimientos_mark WHERE odbc_date < vDate; diff --git a/db/routines/vn2008/procedures/cobro.sql b/db/routines/vn2008/procedures/cobro.sql index fb6010f38..26d906813 100644 --- a/db/routines/vn2008/procedures/cobro.sql +++ b/db/routines/vn2008/procedures/cobro.sql @@ -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 diff --git a/db/routines/vn2008/procedures/confection_control_source.sql b/db/routines/vn2008/procedures/confection_control_source.sql index f439e80f7..77b4df5f3 100644 --- a/db/routines/vn2008/procedures/confection_control_source.sql +++ b/db/routines/vn2008/procedures/confection_control_source.sql @@ -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 diff --git a/db/routines/vn2008/views/Vehiculos.sql b/db/routines/vn2008/views/Vehiculos.sql deleted file mode 100644 index 477ff657c..000000000 --- a/db/routines/vn2008/views/Vehiculos.sql +++ /dev/null @@ -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` diff --git a/db/routines/vn2008/views/XDiario.sql b/db/routines/vn2008/views/XDiario.sql deleted file mode 100644 index 0a9672d2e..000000000 --- a/db/routines/vn2008/views/XDiario.sql +++ /dev/null @@ -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` diff --git a/db/routines/vn2008/views/v_compres.sql b/db/routines/vn2008/views/v_compres.sql index 8c52e2a72..8bd6a4a64 100644 --- a/db/routines/vn2008/views/v_compres.sql +++ b/db/routines/vn2008/views/v_compres.sql @@ -53,7 +53,7 @@ AS SELECT `TP`.`Id_Tipo` AS `Familia`, `A`.`Color` AS `Color`, `A`.`Min` AS `Min`, `C`.`Costefijo` + `C`.`Embalajefijo` + `C`.`Comisionfija` + `C`.`Portefijo` AS `Coste`, - `W_OUT`.`fuente` AS `fuente`, + `W_OUT`.`isFeedStock` AS `fuente`, IF( `cb`.`Volumen` > 0, `cb`.`Volumen`, @@ -73,9 +73,9 @@ FROM ( ) JOIN `vn2008`.`travel` `TR` ON(`TR`.`id` = `E`.`travel_id`) ) - JOIN `vn2008`.`warehouse` `W_IN` ON(`W_IN`.`id` = `TR`.`warehouse_id`) + JOIN `vn`.`warehouse` `W_IN` ON(`W_IN`.`id` = `TR`.`warehouse_id`) ) - JOIN `vn2008`.`warehouse` `W_OUT` ON(`W_OUT`.`id` = `TR`.`warehouse_id_out`) + JOIN `vn`.`warehouse` `W_OUT` ON(`W_OUT`.`id` = `TR`.`warehouse_id_out`) ) JOIN `vn2008`.`Articles` `A` ON(`C`.`Id_Article` = `A`.`Id_Article`) ) @@ -85,6 +85,6 @@ FROM ( ) JOIN `vn2008`.`Cubos` `cb` ON(`cb`.`Id_Cubo` = `C`.`Id_Cubo`) ) -WHERE `W_IN`.`fuente` = 0 +WHERE `W_IN`.`isFeedStock` = 0 AND `E`.`Inventario` = 0 AND `E`.`Redada` = 0 diff --git a/db/routines/vn2008/views/v_ventes.sql b/db/routines/vn2008/views/v_ventes.sql deleted file mode 100644 index 9fd87a002..000000000 --- a/db/routines/vn2008/views/v_ventes.sql +++ /dev/null @@ -1,68 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`v_ventes` -AS SELECT `Agencias`.`Agencia` AS `Agencia`, - `A`.`Categoria` AS `Categoria`, - `A`.`tipo_id` AS `tipo_id`, - `A`.`Medida` AS `Medida`, - `A`.`Article` AS `Article`, - `A`.`Color` AS `Color`, - `CS`.`Id_cliente` AS `Id_Cliente`, - `TP`.`Id_Tipo` AS `Tipo`, - `T`.`Factura` AS `Factura`, - `T`.`warehouse_id` AS `warehouse_id`, - `M`.`Id_Movimiento` AS `Id_Movimiento`, - `M`.`Id_Article` AS `Id_Article`, - `TP`.`Id_Tipo` AS `Familia`, - `M`.`Id_Ticket` AS `Id_Ticket`, - `M`.`Concepte` AS `Concepte`, - `M`.`Cantidad` AS `Cantidad`, - `M`.`quantity` AS `quantity`, - `M`.`Preu` AS `Preu`, - `M`.`Descuento` AS `Descuento`, - IF( - `T`.`Fecha` >= '2015-10-01', - `M`.`CostFixat`, - `M`.`Preu` * (100 - `M`.`Descuento`) / 100 - ) AS `CostFixat`, - `M`.`Reservado` AS `Reservado`, - `M`.`OK` AS `OK`, - `M`.`PrecioFijado` AS `PrecioFijado`, - `M`.`odbc_date` AS `odbc_date`, - cast(`T`.`Fecha` AS date) AS `Fecha`, - `T`.`Fecha` AS `FechaCompleta`, - `CS`.`consignatario` AS `Alias`, - `T`.`Id_Consigna` AS `Id_Consigna`, - `M`.`Cantidad` * `M`.`Preu` * (100 - `M`.`Descuento`) / 100 AS `Importe`, - `O`.`Origen` AS `Origen`, - `TP`.`reino_id` AS `reino_id`, - `C`.`invoice` AS `invoice`, - `A`.`producer_id` AS `producer_id` -FROM ( - ( - ( - ( - ( - ( - ( - ( - `vn2008`.`Movimientos` `M` - JOIN `vn2008`.`Tickets` `T` ON(`M`.`Id_Ticket` = `T`.`Id_Ticket`) - ) - JOIN `vn2008`.`Consignatarios` `CS` ON(`CS`.`id_consigna` = `T`.`Id_Consigna`) - ) - JOIN `vn2008`.`Clientes` `C` ON(`CS`.`Id_cliente` = `C`.`id_cliente`) - ) - JOIN `vn2008`.`Articles` `A` ON(`M`.`Id_Article` = `A`.`Id_Article`) - ) - JOIN `vn2008`.`Origen` `O` ON(`O`.`id` = `A`.`id_origen`) - ) - JOIN `vn2008`.`Tipos` `TP` ON(`A`.`tipo_id` = `TP`.`tipo_id`) - ) - JOIN `vn2008`.`reinos` `r` ON(`TP`.`reino_id` = `r`.`id`) - ) - JOIN `vn2008`.`Agencias` ON(`Agencias`.`Id_Agencia` = `T`.`Id_Agencia`) - ) -WHERE `T`.`Fecha` >= '2013-01-01' - AND `C`.`real` > 0 - AND `r`.`id` <> 6 diff --git a/db/routines/vn2008/views/v_xsubcuentas.sql b/db/routines/vn2008/views/v_xsubcuentas.sql deleted file mode 100644 index a200e4ad9..000000000 --- a/db/routines/vn2008/views/v_xsubcuentas.sql +++ /dev/null @@ -1,207 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`v_xsubcuentas` -AS SELECT `Clientes`.`Cuenta` AS `COD`, - `Clientes`.`razonSocial` AS `TITULO`, - concat( - IF( - `p`.`CEE` = 1 - AND ascii(left(`Clientes`.`if`, 1)) < 58, - `p`.`Codigo`, - '' - ), - `Clientes`.`if` - ) AS `NIF`, - `Clientes`.`domicilio` AS `DOMICILIO`, - `Clientes`.`poblacion` AS `POBLACION`, - `province`.`name` AS `PROVINCIA`, - `Clientes`.`codPostal` AS `CODPOSTAL`, - `p`.`Codigo` AS `country_code`, - sub.`empresa_id` AS `empresa_id`, - substr( - `Clientes`.`e-mail`, - 1, - coalesce(nullif(locate(',', `Clientes`.`e-mail`), 0), 99) - 1 - ) AS `EMAIL`, - IF( - `p`.`CEE` = 0 - OR `p`.`CEE` = 1 - AND `Clientes`.`vies` = 0, - 1, - IF( - `p`.`CEE` = 1 - AND `Clientes`.`vies` <> 0, - 2, - 4 - ) - ) AS `IDNIF` -FROM ( - ( - ( - `vn2008`.`Clientes` - JOIN ( - 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`) - ) - JOIN `vn2008`.`province` ON( - `Clientes`.`province_id` = `province`.`province_id` - ) - ) -GROUP BY `Clientes`.`id_cliente`, - sub.`empresa_id` -UNION ALL -SELECT `Proveedores`.`cuenta` AS `Cuenta`, - `Proveedores`.`Proveedor` AS `Proveedor`, - concat( - IF( - `p`.`CEE` = 1 - AND ascii(left(`Proveedores`.`NIF`, 1)) < 58, - `p`.`Codigo`, - '' - ), - `Proveedores`.`NIF` - ) AS `NIF`, - `Proveedores`.`Domicilio` AS `Domicilio`, - `Proveedores`.`Localidad` AS `Localidad`, - `prov`.`name` AS `Provincia`, - `Proveedores`.`codpos` AS `CP`, - `p`.`Codigo` AS `country_code`, - sub.`empresa_id` AS `empresa_id`, - substr( - `c`.`email`, - 1, - coalesce(nullif(locate(',', `c`.`email`), 0), 99) - 1 - ) AS `EMAIL`, - IF(`p`.`CEE` = 0, 1, IF(`p`.`CEE` = 1, 2, 4)) AS `IDNIF` -FROM ( - ( - ( - ( - `vn2008`.`Proveedores` - JOIN ( - 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`.`province` `prov` ON( - `prov`.`province_id` = `Proveedores`.`province_id` - ) - ) - LEFT JOIN `vn`.`supplierContact` `c` ON(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`) - ) -WHERE `Proveedores`.`oficial` <> 0 -GROUP BY sub.`proveedor_id`, - sub.`empresa_id` -UNION ALL -SELECT `Gastos`.`Id_Gasto` COLLATE utf8mb3_unicode_ci AS `Id_Gasto`, - `Gastos`.`Gasto` COLLATE utf8mb3_unicode_ci AS `Gasto`, - NULL AS `NULL`, - NULL AS `My_exp_NULL`, - NULL AS `My_exp_1_NULL`, - NULL AS `My_exp_2_NULL`, - NULL AS `My_exp_3_NULL`, - NULL AS `country_code`, - `e`.`id` AS `id`, - NULL AS `EMAIL`, - 1 AS `IDNIF` -FROM ( - `vn2008`.`Gastos` - JOIN `vn2008`.`empresa` `e` ON(`e`.`id` = 442) - ) -UNION ALL -SELECT `Bancos`.`Cuenta` AS `Cuenta`, - `Bancos`.`Banco` AS `Banco`, - NULL AS `NULL`, - NULL AS `My_exp_NULL`, - NULL AS `My_exp_1_NULL`, - NULL AS `My_exp_2_NULL`, - NULL AS `My_exp_3_NULL`, - NULL AS `country_code`, - `e`.`id` AS `id`, - NULL AS `EMAIL`, - 1 AS `IDNIF` -FROM ( - `vn2008`.`Bancos` - JOIN `vn2008`.`empresa` `e` ON(`e`.`id` = 442) - ) -UNION ALL -SELECT lpad(right(`Proveedores`.`cuenta`, 5), 10, '47510000') AS `Cuenta`, - `Proveedores`.`Proveedor` AS `Proveedor`, - `Proveedores`.`NIF` AS `NIF`, - `Proveedores`.`Domicilio` AS `Domicilio`, - `Proveedores`.`Localidad` AS `Localidad`, - `prov`.`name` AS `Provincia`, - `Proveedores`.`codpos` AS `CP`, - `p`.`Codigo` AS `country_code`, - sub.`empresa_id` AS `empresa_id`, - substr( - `c`.`email`, - 1, - coalesce(nullif(locate(',', `c`.`email`), 0), 99) - 1 - ) AS `EMAIL`, - IF(`p`.`CEE` = 0, 1, IF(`p`.`CEE` = 1, 2, 4)) AS `IDNIF` -FROM ( - ( - ( - ( - `vn2008`.`Proveedores` - JOIN ( - 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`.`province` `prov` ON( - `prov`.`province_id` = `Proveedores`.`province_id` - ) - ) - LEFT JOIN `vn`.`supplierContact` `c` ON(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`) - ) -WHERE ( - `Proveedores`.`cuenta` LIKE '_____3____' - OR `Proveedores`.`cuenta` LIKE '_____2____' - ) - AND `Proveedores`.`oficial` = 1 -GROUP BY sub.`proveedor_id`, - sub.`empresa_id` diff --git a/db/routines/vn2008/views/versiones.sql b/db/routines/vn2008/views/versiones.sql deleted file mode 100644 index 04e63dbb4..000000000 --- a/db/routines/vn2008/views/versiones.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`versiones` -AS SELECT `m`.`app` AS `programa`, - `m`.`version` AS `version`, - 0 AS `critical` -FROM `vn`.`mdbVersion` `m` -WHERE `m`.`branchFk` = 'master' diff --git a/db/routines/vn2008/views/warehouse.sql b/db/routines/vn2008/views/warehouse.sql deleted file mode 100644 index 5199d5c8e..000000000 --- a/db/routines/vn2008/views/warehouse.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`warehouse` -AS SELECT `w`.`id` AS `id`, - `w`.`name` AS `name`, - `w`.`isInventory` AS `inventario`, - `w`.`isFeedStock` AS `fuente`, - `w`.`isComparative` AS `is_comparative`, - `w`.`hasComission` AS `comisionantes`, - `w`.`hasAvailable` AS `reserve`, - `w`.`isManaged` AS `isManaged`, - `w`.`isForTicket` AS `tpv`, - `w`.`hasStowaway` AS `hasStowaway`, - `w`.`hasDms` AS `hasDms`, - `w`.`addressName` AS `address_name`, - `w`.`delay` AS `delay`, - `w`.`countryFk` AS `Id_Paises`, - `w`.`labelZone` AS `zone_label`, - `w`.`valuatedInventory` AS `valuatedInventory`, - `w`.`hasConfectionTeam` AS `hasConfectionTeam` -FROM `vn`.`warehouse` `w` diff --git a/db/routines/vn2008/views/workerDocument.sql b/db/routines/vn2008/views/workerDocument.sql deleted file mode 100644 index 7aca7497f..000000000 --- a/db/routines/vn2008/views/workerDocument.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`workerDocument` -AS SELECT `vn`.`workerDocument`.`id` AS `id`, - `vn`.`workerDocument`.`worker` AS `worker`, - `vn`.`workerDocument`.`document` AS `document`, - `vn`.`workerDocument`.`isReadableByWorker` AS `isReadableByWorker` -FROM `vn`.`workerDocument` diff --git a/db/routines/vn2008/views/workerTeam.sql b/db/routines/vn2008/views/workerTeam.sql deleted file mode 100644 index 6db6c094a..000000000 --- a/db/routines/vn2008/views/workerTeam.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`workerTeam` -AS SELECT `wt`.`team` AS `team`, - `wt`.`id` AS `id`, - `wt`.`workerFk` AS `user` -FROM `vn`.`workerTeam` `wt` diff --git a/db/versions/10865-goldenGalax/00-firstScript.sql b/db/versions/10865-goldenGalax/00-firstScript.sql new file mode 100644 index 000000000..889477b5c --- /dev/null +++ b/db/versions/10865-goldenGalax/00-firstScript.sql @@ -0,0 +1,15 @@ +REVOKE UPDATE ON TABLE vn2008.Vehiculos FROM officeBoss; +REVOKE SELECT ON TABLE vn2008.Vehiculos FROM claimManager; +REVOKE SELECT, INSERT, UPDATE ON TABLE vn2008.Vehiculos FROM deliveryAssistant; +REVOKE SELECT ON TABLE vn2008.versiones FROM employee; +REVOKE INSERT ON TABLE vn2008.XDiario FROM financial; +REVOKE SELECT, INSERT, UPDATE ON TABLE vn2008.XDiario FROM buyer; +REVOKE SELECT, INSERT, UPDATE, DELETE ON TABLE vn2008.XDiario FROM administrative; +REVOKE SELECT, INSERT, UPDATE, DELETE ON TABLE vn2008.XDiario FROM hr; +REVOKE SELECT, INSERT, UPDATE, DELETE ON TABLE vn2008.XDiario FROM buyerBoss; +REVOKE SELECT, INSERT ON TABLE vn2008.workerDocument FROM hr; +REVOKE SELECT ON TABLE vn2008.warehouse FROM guest; +REVOKE SELECT ON TABLE vn2008.warehouse FROM employee; +REVOKE SELECT, INSERT, UPDATE ON TABLE vn2008.workerTeam FROM salesAssistant; +REVOKE DELETE ON TABLE vn2008.workerTeam FROM salesBoss; +REVOKE SELECT ON TABLE vn2008.v_compres FROM administrative; \ No newline at end of file