refs #6493 refactorizar-procedimientos-vn2008-parte_2 #2235

Merged
jbreso merged 39 commits from 6493-refactorizar-procedimientos-vn2008-parte_2 into dev 2024-04-24 05:18:59 +00:00
2 changed files with 8 additions and 7 deletions
Showing only changes of commit 1534402640 - Show all commits

View File

@ -75,9 +75,9 @@ proc: BEGIN
(INDEX (itemFk,warehouseFk)) (INDEX (itemFk,warehouseFk))
ENGINE = MEMORY ENGINE = MEMORY
SELECT i.itemFk, SELECT i.itemFk,
vWarehouseLanding warehouseFk, vWarehouseLanding warehouseFk,
i.shipped dated, i.shipped dated,
i.quantity i.quantity
FROM itemTicketOut i FROM itemTicketOut i
JOIN tItemRangeLive ir ON ir.itemFK = i.itemFk JOIN tItemRangeLive ir ON ir.itemFK = i.itemFk
WHERE i.shipped >= vDatedFrom WHERE i.shipped >= vDatedFrom
@ -85,9 +85,9 @@ proc: BEGIN
AND i.warehouseFk = vWarehouseLanding AND i.warehouseFk = vWarehouseLanding
UNION ALL UNION ALL
SELECT b.itemFk, SELECT b.itemFk,
vWarehouseLanding, vWarehouseLanding,
t.landed, t.landed,
b.quantity b.quantity
FROM buy b FROM buy b
JOIN entry e ON b.entryFk = e.id JOIN entry e ON b.entryFk = e.id
JOIN travel t ON t.id = e.travelFk JOIN travel t ON t.id = e.travelFk

View File

@ -206,7 +206,8 @@ BEGIN
SUM(b2.', vTwoYearsAgo,') twoYearsAgo SUM(b2.', vTwoYearsAgo,') twoYearsAgo
FROM tmp.nest b1 FROM tmp.nest b1
JOIN tmp.balance_aux b2 on b2.lft BETWEEN b1.lft and b1.rgt JOIN tmp.balance_aux b2 on b2.lft BETWEEN b1.lft and b1.rgt
GROUP BY b1.id)sub ON sub.id = b.id GROUP BY b1.id
)sub ON sub.id = b.id
SET b.', vYear, ' = thisYear, SET b.', vYear, ' = thisYear,
b.', vOneYearAgo, ' = oneYearAgo, b.', vOneYearAgo, ' = oneYearAgo,
b.', vTwoYearsAgo, ' = twoYearsAgo'); b.', vTwoYearsAgo, ' = twoYearsAgo');