feat: refs#6493 modificar procedimiento available_traslate
This commit is contained in:
parent
a911d7fc88
commit
4389cd5d74
|
@ -72,12 +72,12 @@ proc: BEGIN
|
|||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
||||
(INDEX (itemFk,warehouseFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT i.item_id itemFk, vWarehouseLanding warehouseFk, i.dat dated, i.amount quantity
|
||||
FROM vn2008.item_out i
|
||||
SELECT i.itemFk, vWarehouseLanding warehouseFk, i.shipped dated, i.quantity
|
||||
FROM vn.itemTicketOut i
|
||||
JOIN tItemRangeLive ir ON ir.itemFK = i.item_id
|
||||
WHERE i.dat >= vDatedFrom
|
||||
AND (ir.dated IS NULL OR i.dat <= ir.dated)
|
||||
AND i.warehouse_id = vWarehouseLanding
|
||||
WHERE i.shipped >= vDatedFrom
|
||||
AND (ir.dated IS NULL OR i.shipped <= ir.dated)
|
||||
AND i.warehouseFk = vWarehouseLanding
|
||||
UNION ALL
|
||||
SELECT b.itemFk, vWarehouseLanding, t.landed, b.quantity
|
||||
FROM buy b
|
||||
|
@ -91,12 +91,12 @@ proc: BEGIN
|
|||
AND t.landed >= vDatedFrom
|
||||
AND (ir.dated IS NULL OR t.landed <= ir.dated)
|
||||
UNION ALL
|
||||
SELECT i.item_id, vWarehouseLanding, i.dat, i.amount
|
||||
FROM vn2008.item_entry_out i
|
||||
JOIN tItemRangeLive ir ON ir.itemFk = i.item_id
|
||||
WHERE i.dat >= vDatedFrom
|
||||
AND (ir.dated IS NULL OR i.dat <= ir.dated)
|
||||
AND i.warehouse_id = vWarehouseLanding
|
||||
SELECT i.itemFk, vWarehouseLanding, i.shipped, i.quantity
|
||||
FROM vn.itemEntryOut i
|
||||
JOIN tItemRangeLive ir ON ir.itemFk = i.itemFk
|
||||
WHERE i.shipped >= vDatedFrom
|
||||
AND (ir.dated IS NULL OR i.shipped <= ir.dated)
|
||||
AND i.warehouseOutFk = vWarehouseLanding
|
||||
UNION ALL
|
||||
SELECT r.item_id, vWarehouseLanding, r.shipment, -r.amount
|
||||
FROM hedera.order_row r
|
||||
|
|
Loading…
Reference in New Issue