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
|
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
||||||
(INDEX (itemFk,warehouseFk))
|
(INDEX (itemFk,warehouseFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT i.item_id itemFk, vWarehouseLanding warehouseFk, i.dat dated, i.amount quantity
|
SELECT i.itemFk, vWarehouseLanding warehouseFk, i.shipped dated, i.quantity
|
||||||
FROM vn2008.item_out i
|
FROM vn.itemTicketOut i
|
||||||
JOIN tItemRangeLive ir ON ir.itemFK = i.item_id
|
JOIN tItemRangeLive ir ON ir.itemFK = i.item_id
|
||||||
WHERE i.dat >= vDatedFrom
|
WHERE i.shipped >= vDatedFrom
|
||||||
AND (ir.dated IS NULL OR i.dat <= ir.dated)
|
AND (ir.dated IS NULL OR i.shipped <= ir.dated)
|
||||||
AND i.warehouse_id = vWarehouseLanding
|
AND i.warehouseFk = vWarehouseLanding
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT b.itemFk, vWarehouseLanding, t.landed, b.quantity
|
SELECT b.itemFk, vWarehouseLanding, t.landed, b.quantity
|
||||||
FROM buy b
|
FROM buy b
|
||||||
|
@ -91,12 +91,12 @@ proc: BEGIN
|
||||||
AND t.landed >= vDatedFrom
|
AND t.landed >= vDatedFrom
|
||||||
AND (ir.dated IS NULL OR t.landed <= ir.dated)
|
AND (ir.dated IS NULL OR t.landed <= ir.dated)
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT i.item_id, vWarehouseLanding, i.dat, i.amount
|
SELECT i.itemFk, vWarehouseLanding, i.shipped, i.quantity
|
||||||
FROM vn2008.item_entry_out i
|
FROM vn.itemEntryOut i
|
||||||
JOIN tItemRangeLive ir ON ir.itemFk = i.item_id
|
JOIN tItemRangeLive ir ON ir.itemFk = i.itemFk
|
||||||
WHERE i.dat >= vDatedFrom
|
WHERE i.shipped >= vDatedFrom
|
||||||
AND (ir.dated IS NULL OR i.dat <= ir.dated)
|
AND (ir.dated IS NULL OR i.shipped <= ir.dated)
|
||||||
AND i.warehouse_id = vWarehouseLanding
|
AND i.warehouseOutFk = vWarehouseLanding
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT r.item_id, vWarehouseLanding, r.shipment, -r.amount
|
SELECT r.item_id, vWarehouseLanding, r.shipment, -r.amount
|
||||||
FROM hedera.order_row r
|
FROM hedera.order_row r
|
||||||
|
|
Loading…
Reference in New Issue