feat: refs#6493 Cambios solicitados procedimientos

This commit is contained in:
Juanjo Breso 2024-04-17 07:33:08 +02:00
parent 2d4524a34c
commit 187c918a21
1 changed files with 7 additions and 11 deletions

View File

@ -69,9 +69,9 @@ BEGIN
SELECT id companyFk
FROM supplier p;
IF vInterGroupSalesIncluded = FALSE THEN
IF NOT vInterGroupSalesIncluded THEN
DELETE ci.*
DELETE ci.
FROM tCompanyIssuing ci
JOIN company e on e.id = ci.companyFk
WHERE e.companyGroupFk = vConsolidatedGroup;
@ -130,13 +130,9 @@ BEGIN
-- Añadimos los gastos, para facilitar el formulario
UPDATE tmp.balance b
JOIN balanceNestTree bnt on bnt.id = b.id
JOIN (
SELECT id, name
FROM expense
GROUP BY id
) g ON g.id = bnt.expenseFk COLLATE utf8_general_ci
SET b.expenseFk = g.id COLLATE utf8_general_ci,
b.expenseName = g.name COLLATE utf8_general_ci ;
JOIN expense e ON e.id = bnt.expenseFk COLLATE utf8_general_ci
SET b.expenseFk = e.id COLLATE utf8_general_ci,
b.expenseName = e.name COLLATE utf8_general_ci ;
-- Rellenamos los valores de primer nivel, los que corresponden
-- a los gastos simples.
@ -182,13 +178,13 @@ BEGIN
-- Ventas intra grupo.
IF NOT vInterGroupSalesIncluded THEN
SELECT lft, rgt INTO @grupoLft, @grupoRgt
SELECT lft, rgt INTO @groupLft, @groupRgt
FROM tmp.balance b
WHERE TRIM(b.`name`) = 'Grupo';
DELETE
FROM tmp.balance
WHERE lft BETWEEN @grupoLft AND @grupoRgt;
WHERE lft BETWEEN @groupLft AND @groupRgt;
END IF;