Warehouse name #2610
|
@ -22,7 +22,7 @@ BEGIN
|
|||
landed,
|
||||
`in`,
|
||||
`out`,
|
||||
warehouse,
|
||||
sref,
|
||||
buyingValue,
|
||||
IF (
|
||||
NOT (@vItemFk <=> sub.itemFk),
|
||||
|
@ -31,19 +31,20 @@ BEGIN
|
|||
) balance,
|
||||
@vItemFk := sub.itemFk previousItemFk
|
||||
FROM (
|
||||
SELECT supplierFk,
|
||||
itemFk,
|
||||
longName,
|
||||
supplier,
|
||||
CONCAT('E',entryFk) entryFk,
|
||||
landed,
|
||||
`in`,
|
||||
`out`,
|
||||
warehouse,
|
||||
buyingValue
|
||||
FROM supplierPackaging
|
||||
WHERE supplierFk = vSupplierFk
|
||||
AND landed >= vFromDated
|
||||
SELECT sp.supplierFk,
|
||||
sp.itemFk,
|
||||
sp.longName,
|
||||
sp.supplier,
|
||||
CONCAT('E',sp.entryFk) entryFk,
|
||||
sp.landed,
|
||||
sp.`in`,
|
||||
sp.`out`,
|
||||
e.invoiceNumber sref,
|
||||
sp.buyingValue
|
||||
FROM supplierPackaging sp
|
||||
JOIN entry e ON e.id = sp.entryFk
|
||||
WHERE sp.supplierFk = vSupplierFk
|
||||
AND sp.landed >= vFromDated
|
||||
UNION ALL
|
||||
SELECT vSupplierFk,
|
||||
itemFk,
|
||||
|
@ -68,7 +69,7 @@ BEGIN
|
|||
DATE(t.shipped),
|
||||
-LEAST(s.quantity,0) `in`,
|
||||
GREATEST(s.quantity,0) `out`,
|
||||
t.warehouseFk,
|
||||
t.cmrFk,
|
||||
s.price * (100 - s.discount) / 100
|
||||
FROM sale s
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
|
@ -110,7 +111,7 @@ BEGIN
|
|||
DATE(t.shipped),
|
||||
-LEAST(tp.quantity,0) `in`,
|
||||
GREATEST(tp.quantity,0) `out`,
|
||||
t.warehouseFk,
|
||||
t.cmrFk,
|
||||
0
|
||||
FROM ticketPackaging tp
|
||||
JOIN packaging p ON p.id = tp.packagingFk
|
||||
|
@ -155,7 +156,7 @@ BEGIN
|
|||
landed,
|
||||
CAST(`in` AS DECIMAL(10,0)) `in`,
|
||||
CAST(`out` AS DECIMAL(10,0)) `out`,
|
||||
warehouse,
|
||||
sref,
|
||||
buyingValue,
|
||||
balance
|
||||
FROM tSupplierPackaging
|
||||
|
|
Loading…
Reference in New Issue