Same Item Produced in Multiple Organizations
/* Formatted on 2017/04/30 12:11 (Formatter Plus v4.8.8) */
SELECT subinventory_code, t.transaction_type_id, org.organization_code,
org.organization_name, h.batch_no, SUM (t.transaction_quantity) qty,
c.acctg_cost, SUM (t.transaction_quantity * c.acctg_cost) total
FROM mtl_material_transactions t,
gl_item_cst c,
org_organization_definitions org,
gme_batch_header h
WHERE t.transaction_type_id IN (33, 37, 43, 44)
AND t.inventory_item_id =
(SELECT inventory_item_id
FROM mtl_system_items_b i
WHERE i.segment1 = :item_code AND i.organization_id = 102)
AND TRUNC (t.transaction_date) >= c.start_date
AND TRUNC (t.transaction_date) <= c.end_date
AND t.inventory_item_id = c.inventory_item_id
AND t.organization_id = c.organization_id
AND c.period_id = :period_id
AND t.organization_id = org.organization_id
AND t.transaction_source_id = h.batch_id
AND t.organization_id = h.organization_id
GROUP BY subinventory_code,
t.transaction_type_id,
org.organization_name,
org.organization_code,
h.batch_no,
c.acctg_cost
ORDER BY organization_code ASC
/* Formatted on 2017/04/30 12:11 (Formatter Plus v4.8.8) */
SELECT subinventory_code, t.transaction_type_id, org.organization_code,
org.organization_name, h.batch_no, SUM (t.transaction_quantity) qty,
c.acctg_cost, SUM (t.transaction_quantity * c.acctg_cost) total
FROM mtl_material_transactions t,
gl_item_cst c,
org_organization_definitions org,
gme_batch_header h
WHERE t.transaction_type_id IN (33, 37, 43, 44)
AND t.inventory_item_id =
(SELECT inventory_item_id
FROM mtl_system_items_b i
WHERE i.segment1 = :item_code AND i.organization_id = 102)
AND TRUNC (t.transaction_date) >= c.start_date
AND TRUNC (t.transaction_date) <= c.end_date
AND t.inventory_item_id = c.inventory_item_id
AND t.organization_id = c.organization_id
AND c.period_id = :period_id
AND t.organization_id = org.organization_id
AND t.transaction_source_id = h.batch_id
AND t.organization_id = h.organization_id
GROUP BY subinventory_code,
t.transaction_type_id,
org.organization_name,
org.organization_code,
h.batch_no,
c.acctg_cost
ORDER BY organization_code ASC
No comments:
Post a Comment