feat: refs #7709 cambios solicitados
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
20a5990535
commit
980b7aa2cc
|
@ -5,14 +5,14 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`supplierPackaging_Rep
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Create a report with packaging balance
|
* Create a report with packaging balance
|
||||||
*
|
*
|
||||||
* @param vFromDated Starting date
|
* @param vFromDated Starting date
|
||||||
* @param vSupplierFk Supplier ID
|
* @param vSupplierFk Supplier ID
|
||||||
*/
|
*/
|
||||||
DECLARE vUser INT;
|
DECLARE vPerson INT;
|
||||||
|
|
||||||
SELECT id INTO vUser
|
SELECT id INTO vPerson
|
||||||
FROM supplier
|
FROM supplier
|
||||||
WHERE nif = vNif;
|
WHERE nif = vNif;
|
||||||
|
|
||||||
|
@ -104,11 +104,11 @@ BEGIN
|
||||||
GROUP BY p.itemFk
|
GROUP BY p.itemFk
|
||||||
ORDER BY itemFk , landed, entryFk
|
ORDER BY itemFk , landed, entryFk
|
||||||
)sub
|
)sub
|
||||||
WHERE (`out` OR `in`);
|
WHERE `out` OR `in`;
|
||||||
|
|
||||||
IF vUser IS NULL THEN
|
IF vPerson IS NULL THEN
|
||||||
|
|
||||||
SELECT id INTO vUser
|
SELECT id INTO vPerson
|
||||||
FROM client
|
FROM client
|
||||||
WHERE fi = vNif;
|
WHERE fi = vNif;
|
||||||
|
|
||||||
|
@ -154,11 +154,11 @@ BEGIN
|
||||||
GROUP BY itemFk
|
GROUP BY itemFk
|
||||||
ORDER BY itemFk , landed, entryFk
|
ORDER BY itemFk , landed, entryFk
|
||||||
) sub
|
) sub
|
||||||
WHERE (`out` OR `in`);
|
WHERE `out` OR `in`;
|
||||||
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT vUser,
|
SELECT vPerson,
|
||||||
itemFk,
|
itemFk,
|
||||||
longName,
|
longName,
|
||||||
name,
|
name,
|
||||||
|
@ -170,7 +170,7 @@ BEGIN
|
||||||
buyingValue,
|
buyingValue,
|
||||||
CAST(SUM(IF(`in`=0, -`out`, `in`)) OVER (PARTITION BY itemFk ORDER BY itemFk , landed, entryFk) AS DECIMAL(10,2)) balance
|
CAST(SUM(IF(`in`=0, -`out`, `in`)) OVER (PARTITION BY itemFk ORDER BY itemFk , landed, entryFk) AS DECIMAL(10,2)) balance
|
||||||
FROM tSupplierPackaging
|
FROM tSupplierPackaging
|
||||||
WHERE NOT (landed < CURDATE() - INTERVAL 1 YEAR)
|
WHERE NOT (landed < util.VN_CURDATE() - INTERVAL 1 YEAR)
|
||||||
ORDER BY itemFk, landed, entryFk;
|
ORDER BY itemFk, landed, entryFk;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tSupplierPackaging;
|
DROP TEMPORARY TABLE tSupplierPackaging;
|
||||||
|
|
Loading…
Reference in New Issue