Compare commits
2 Commits
81b2e89fd8
...
97c0db62ac
Author | SHA1 | Date |
---|---|---|
Juanjo Breso | 97c0db62ac | |
Juanjo Breso | 187c918a21 |
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue