Merge branch 'master' into test
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
e33b8893f6
|
@ -36,9 +36,12 @@ proc: BEGIN
|
||||||
ADD `life` TINYINT NOT NULL DEFAULT '0';
|
ADD `life` TINYINT NOT NULL DEFAULT '0';
|
||||||
|
|
||||||
-- Calculo del inventario
|
-- Calculo del inventario
|
||||||
UPDATE tmp.itemInventory ai
|
CREATE OR REPLACE TEMPORARY TABLE tItemInventoryCalc
|
||||||
JOIN (
|
(PRIMARY KEY (itemFk))
|
||||||
SELECT itemFk Id_Article, SUM(quantity) Subtotal
|
ENGINE = MEMORY
|
||||||
|
SELECT itemFk,
|
||||||
|
SUM(quantity) quantity,
|
||||||
|
SUM(quantity) visible
|
||||||
FROM (
|
FROM (
|
||||||
SELECT s.itemFk, - s.quantity quantity
|
SELECT s.itemFk, - s.quantity quantity
|
||||||
FROM sale s
|
FROM sale s
|
||||||
|
@ -69,18 +72,13 @@ proc: BEGIN
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT e.isRaid
|
||||||
) sub2
|
) sub
|
||||||
GROUP BY itemFk
|
GROUP BY itemFk;
|
||||||
) sub ON ai.id = sub.Id_Article
|
|
||||||
SET ai.inventory = sub.Subtotal,
|
|
||||||
ai.visible = sub.Subtotal,
|
|
||||||
ai.avalaible = sub.Subtotal,
|
|
||||||
ai.sd = sub.Subtotal;
|
|
||||||
|
|
||||||
-- Cálculo del visible
|
-- Cálculo del visible
|
||||||
UPDATE tmp.itemInventory ai
|
UPDATE tItemInventoryCalc iic
|
||||||
JOIN (
|
JOIN (
|
||||||
SELECT itemFk Id_Article, SUM(quantity) Subtotal
|
SELECT itemFk, SUM(quantity) visible
|
||||||
FROM (
|
FROM (
|
||||||
SELECT s.itemFk, s.quantity
|
SELECT s.itemFk, s.quantity
|
||||||
FROM sale s
|
FROM sale s
|
||||||
|
@ -117,8 +115,15 @@ proc: BEGIN
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
) sub2
|
) sub2
|
||||||
GROUP BY itemFk
|
GROUP BY itemFk
|
||||||
) sub ON ai.id = sub.Id_Article
|
) sub ON sub.itemFk = iic.itemFk
|
||||||
SET ai.visible = ai.visible + sub.Subtotal;
|
SET iic.visible = iic.visible + sub.visible;
|
||||||
|
|
||||||
|
UPDATE tmp.itemInventory ai
|
||||||
|
JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id
|
||||||
|
SET ai.inventory = iic.quantity,
|
||||||
|
ai.visible = iic.visible,
|
||||||
|
ai.avalaible = iic.quantity,
|
||||||
|
ai.sd = iic.quantity;
|
||||||
|
|
||||||
-- Calculo del disponible
|
-- Calculo del disponible
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
||||||
|
@ -189,6 +194,7 @@ proc: BEGIN
|
||||||
DROP TEMPORARY TABLE
|
DROP TEMPORARY TABLE
|
||||||
tmp.itemTravel,
|
tmp.itemTravel,
|
||||||
tmp.itemCalc,
|
tmp.itemCalc,
|
||||||
|
tItemInventoryCalc,
|
||||||
tmp.itemAtp;
|
tmp.itemAtp;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
Loading…
Reference in New Issue