7658-devToTest_2428 #2663
|
@ -68,7 +68,7 @@ BEGIN
|
||||||
DATE(t.shipped),
|
DATE(t.shipped),
|
||||||
-LEAST(s.quantity,0) `in`,
|
-LEAST(s.quantity,0) `in`,
|
||||||
GREATEST(s.quantity,0) `out`,
|
GREATEST(s.quantity,0) `out`,
|
||||||
t.warehouseFk,
|
w.name,
|
||||||
s.price * (100 - s.discount) / 100
|
s.price * (100 - s.discount) / 100
|
||||||
FROM sale s
|
FROM sale s
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
|
@ -76,6 +76,7 @@ BEGIN
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
JOIN supplier su ON su.nif = c.fi
|
JOIN supplier su ON su.nif = c.fi
|
||||||
|
JOIN warehouse w ON w.id = t.warehouseFk
|
||||||
WHERE su.id = vSupplierFk
|
WHERE su.id = vSupplierFk
|
||||||
AND t.shipped >= vFromDated
|
AND t.shipped >= vFromDated
|
||||||
AND p.isPackageReturnable
|
AND p.isPackageReturnable
|
||||||
|
@ -110,7 +111,7 @@ BEGIN
|
||||||
DATE(t.shipped),
|
DATE(t.shipped),
|
||||||
-LEAST(tp.quantity,0) `in`,
|
-LEAST(tp.quantity,0) `in`,
|
||||||
GREATEST(tp.quantity,0) `out`,
|
GREATEST(tp.quantity,0) `out`,
|
||||||
t.warehouseFk,
|
w.name,
|
||||||
0
|
0
|
||||||
FROM ticketPackaging tp
|
FROM ticketPackaging tp
|
||||||
JOIN packaging p ON p.id = tp.packagingFk
|
JOIN packaging p ON p.id = tp.packagingFk
|
||||||
|
@ -118,6 +119,7 @@ BEGIN
|
||||||
JOIN ticket t ON t.id = tp.ticketFk
|
JOIN ticket t ON t.id = tp.ticketFk
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
JOIN supplier su ON su.nif = c.fi
|
JOIN supplier su ON su.nif = c.fi
|
||||||
|
JOIN warehouse w ON w.id = t.warehouseFk
|
||||||
WHERE su.id = vSupplierFk
|
WHERE su.id = vSupplierFk
|
||||||
AND t.shipped >= vFromDated
|
AND t.shipped >= vFromDated
|
||||||
AND p.isPackageReturnable
|
AND p.isPackageReturnable
|
||||||
|
|
Loading…
Reference in New Issue