#7709 -supplierPackaging_ReportSource_2 #3107
|
@ -5,14 +5,14 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`supplierPackaging_Rep
|
|||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Create a report with packaging balance
|
||||
*
|
||||
* @param vFromDated Starting date
|
||||
* @param vSupplierFk Supplier ID
|
||||
*/
|
||||
DECLARE vUser INT;
|
||||
* Create a report with packaging balance
|
||||
*
|
||||
* @param vFromDated Starting date
|
||||
robert marked this conversation as resolved
Outdated
|
||||
* @param vSupplierFk Supplier ID
|
||||
*/
|
||||
DECLARE vPerson INT;
|
||||
robert marked this conversation as resolved
Outdated
carlosap
commented
vPerson no és correcte, les empreses no son persones vClientOrSupplierId vPerson no és correcte, les empreses no son persones
vClientOrSupplierId
vEntityId
|
||||
|
||||
SELECT id INTO vUser
|
||||
SELECT id INTO vPerson
|
||||
robert marked this conversation as resolved
Outdated
carlosap
commented
los supplier no son users los supplier no son users
|
||||
FROM supplier
|
||||
WHERE nif = vNif;
|
||||
|
||||
|
@ -104,11 +104,11 @@ BEGIN
|
|||
GROUP BY p.itemFk
|
||||
ORDER BY itemFk , landed, entryFk
|
||||
)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
|
||||
WHERE fi = vNif;
|
||||
|
||||
|
@ -154,11 +154,11 @@ BEGIN
|
|||
GROUP BY itemFk
|
||||
ORDER BY itemFk , landed, entryFk
|
||||
) sub
|
||||
WHERE (`out` OR `in`);
|
||||
WHERE `out` OR `in`;
|
||||
robert marked this conversation as resolved
Outdated
carlosap
commented
paréntesis innecesarios paréntesis innecesarios
|
||||
|
||||
END IF;
|
||||
|
||||
SELECT vUser,
|
||||
SELECT vPerson,
|
||||
itemFk,
|
||||
longName,
|
||||
name,
|
||||
|
@ -170,7 +170,7 @@ BEGIN
|
|||
buyingValue,
|
||||
CAST(SUM(IF(`in`=0, -`out`, `in`)) OVER (PARTITION BY itemFk ORDER BY itemFk , landed, entryFk) AS DECIMAL(10,2)) balance
|
||||
FROM tSupplierPackaging
|
||||
WHERE NOT (landed < CURDATE() - INTERVAL 1 YEAR)
|
||||
WHERE NOT (landed < util.VN_CURDATE() - INTERVAL 1 YEAR)
|
||||
robert marked this conversation as resolved
Outdated
carlosap
commented
no hacer uso de curdate no hacer uso de curdate
|
||||
ORDER BY itemFk, landed, entryFk;
|
||||
|
||||
DROP TEMPORARY TABLE tSupplierPackaging;
|
||||
|
|
Loading…
Reference in New Issue
espacios en los comentarios *