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