7167-testToMaster_2414 #2244

Merged
alexm merged 643 commits from 7167-testToMaster_2414 into master 2024-04-04 05:32:41 +00:00
11 changed files with 10 additions and 137 deletions
Showing only changes of commit 76c5595a58 - Show all commits

View File

@ -1,21 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `bi`.`v_clientes_jerarquia`
AS SELECT `c`.`id_cliente` AS `Id_Cliente`,
`c`.`cliente` AS `Cliente`,
`t`.`CodigoTrabajador` AS `Comercial`,
`tj`.`CodigoTrabajador` AS `Jefe`
FROM (
(
(
`vn2008`.`Clientes` `c`
JOIN `vn2008`.`Trabajadores` `t` ON(`t`.`Id_Trabajador` = `c`.`Id_Trabajador`)
)
JOIN `vn2008`.`jerarquia` ON(
`vn2008`.`jerarquia`.`worker_id` = `c`.`Id_Trabajador`
)
)
JOIN `vn2008`.`Trabajadores` `tj` ON(
`tj`.`Id_Trabajador` = `vn2008`.`jerarquia`.`boss_id`
)
)

View File

@ -197,6 +197,12 @@ BEGIN
FROM ticket t
JOIN tTicketDelete tmp ON tmp.ticketFk = t.id;
DELETE sl
FROM saleLabel sl
JOIN sale s ON s.id = sl.saleFk
JOIN ticket t ON t.id = s.ticketFk
WHERE t.shipped < v2Months;
-- Tickets Nulos PAK 11/10/2016
SELECT id INTO vCompanyBlk FROM company WHERE code = 'BLK';
UPDATE ticket

View File

@ -1,6 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`unary`
AS SELECT `a`.`id` AS `id`,
`a`.`parent` AS `parent`
FROM `vn2008`.`unary` `a`

View File

@ -1,8 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`unaryScan`
AS SELECT `u`.`unary_id` AS `unaryFk`,
`u`.`name` AS `name`,
`u`.`odbc_date` AS `created`,
`u`.`type` AS `type`
FROM `vn2008`.`unary_scan` `u`

View File

@ -1,8 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`unaryScanLine`
AS SELECT `u`.`id` AS `id`,
`u`.`code` AS `code`,
`u`.`odbc_date` AS `created`,
`u`.`unary_id` AS `unaryScanFk`
FROM `vn2008`.`unary_scan_line` `u`

View File

@ -1,58 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`unary_leaves`(v_top INT)
BEGIN
/**
* A partir de un nodo devuelve todos sus descendientes.
*
* @table tmp.tree Tabla con los ids de los nodos descendientes;
**/
DECLARE v_count INT;
DECLARE v_parent INT;
DECLARE v_depth INT DEFAULT 0;
DROP TEMPORARY TABLE IF EXISTS tmp.tree;
CREATE TEMPORARY TABLE tmp.tree
(INDEX (id))
ENGINE = MEMORY
SELECT v_top id, v_parent parent, v_depth depth;
DROP TEMPORARY TABLE IF EXISTS tmp.parent;
CREATE TEMPORARY TABLE tmp.parent
ENGINE = MEMORY
SELECT v_top id;
l: LOOP
SET v_depth = v_depth + 1;
DROP TEMPORARY TABLE IF EXISTS tmp.child;
CREATE TEMPORARY TABLE tmp.child
ENGINE = MEMORY
SELECT c.`id`, c.parent
FROM `unary` c
JOIN tmp.parent p ON c.`parent` = p.id;
DROP TEMPORARY TABLE tmp.parent;
CREATE TEMPORARY TABLE tmp.parent
ENGINE = MEMORY
SELECT c.id, c.parent
FROM tmp.child c
LEFT JOIN tmp.tree t ON t.id = c.id
WHERE t.id IS NULL;
INSERT INTO tmp.tree
SELECT id, parent, v_depth FROM tmp.parent;
SELECT COUNT(*) INTO v_count
FROM tmp.parent;
IF v_count = 0 THEN
LEAVE l;
END IF;
END LOOP;
DROP TEMPORARY TABLE
tmp.parent,
tmp.child;
END$$
DELIMITER ;

View File

@ -1,19 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`unary_tops`()
BEGIN
/**
* Devuelve todos los nodos que no tienen padre.
*
* @table tmp.tree Tabla con los ids de los nodos que no tienen padre;
**/
DROP TEMPORARY TABLE IF EXISTS tmp.tree;
CREATE TEMPORARY TABLE tmp.tree
ENGINE = MEMORY
SELECT s.`unary_id` AS id, s.name, s.odbc_date, s.type
FROM `unary_scan` s
INNER JOIN `unary` u ON s.unary_id = u.id
WHERE u.parent IS NULL;
END$$
DELIMITER ;

View File

@ -1,10 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_jerarquia`
AS SELECT `vn2008`.`jerarquia`.`worker_id` AS `Id_Trabajador`,
`vn2008`.`jerarquia`.`boss_id` AS `boss_id`
FROM `vn2008`.`jerarquia`
UNION ALL
SELECT DISTINCT `vn2008`.`jerarquia`.`boss_id` AS `Id_Trabajador`,
`vn2008`.`jerarquia`.`boss_id` AS `boss_id`
FROM `vn2008`.`jerarquia`

View File

@ -1,3 +0,0 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS vn2008.unary__ RENAME vn2008.unary;
ALTER TABLE IF EXISTS vn2008.unary_scan__ RENAME vn2008.unary_scan;

View File

@ -1,4 +0,0 @@
ALTER TABLE IF EXISTS vn2008.unary_scan__ RENAME vn2008.unary_scan;
ALTER TABLE IF EXISTS vn2008.unary_scan_line__ RENAME vn2008.unary_scan_line;
ALTER TABLE IF EXISTS vn2008.unary_scan_line_buy__ RENAME vn2008.unary_scan_line_buy;
ALTER TABLE IF EXISTS vn2008.unary_scan_line_expedition__ RENAME vn2008.unary_scan_line_expedition;

View File

@ -0,0 +1,4 @@
ALTER TABLE IF EXISTS vn2008.unary_scan RENAME vn2008.unary_scan__;
ALTER TABLE IF EXISTS vn2008.unary_scan_line RENAME vn2008.unary_scan_line__;
ALTER TABLE IF EXISTS vn2008.unary_scan_line_buy RENAME vn2008.unary_scan_line_buy__;
ALTER TABLE IF EXISTS vn2008.unary_scan_line_expedition RENAME vn2008.unary_scan_line_expedition__;