Вы находитесь на странице: 1из 2

SELECT DISTINCT DECODE (acost.organization_id , aparm.cost_organization_id, DECODE (acost.cost_type_id , ctype.cost_type_id, NVL (acost.material_cost , 0 ) , ctype.default_cost_type_id, N VL (acost.material_cost , 0 ) , 0 ) , 0 ) assembly_material_cost , DECODE (acost.

organization_id , aparm.cost_organization_id, DECODE (acost.cost_type_id , ctype.cost_type_id, NVL (acost.material_overhead_cost , 0 ) , ctype.default_cost_type_id, NVL (acost.material_overhead_cost , 0 ) , 0 ) , 0 ) assembly_material_overhead , DECODE (acost.organization_id , aparm.cost_organization_id, DECODE (acost.cost_type_id , ctype.cost_type_id, NVL (acost.overhead_cost , 0 ) , ctype.default_cost_type_id, N VL (acost.overhead_cost , 0 ) , 0 ) , 0 ) assembly_overhead_cost , DECODE (acost.organization_id , aparm.cost_organization_id, DECODE (acost.cost_type_id , ctype.cost_type_id, NVL (acost.resource_cost , 0 ) , ctype.default_cost_type_id, N VL (acost.resource_cost , 0 ) , 0 ) , 0

) assembly_resource_cost , comv.segment1 comp$item_number , ctype.cost_type cost_type , DECODE (bom.assembly_type, 1, 'N', 2, 'Y', 'N') engineering_bill_flag , cat.segment1 a$cat$commodity_code , base.segment1 item$item_number , itmcl.segment1 cat$item_class FROM inv.mtl_system_items_b base , bom.cst_item_costs acost , bom.cst_cost_types ctype , bom.bom_structures_b bom , inv.mtl_parameters aparm , inv.mtl_categories_b cat , inv.mtl_item_categories icat ,(select bic.component_item_id,msi.segment1,bbm.assembly_item_id,bbm.organi zation_id from Bom_structures_b bbm , Bom_components_b bic , mtl_system_items msi where bbm.bill_Sequence_id = bic.bill_sequence_id and msi.inventory_item_id = bic.component_item_id and msi.organization_id = bbm.organization_id AND msi.item_type='CORE' )comv, (SELECT cat.SEGMENT1,item.inventory_item_id,icat.organization_id FROM inv.mtl_item_categories icat , inv.mtl_categories_b cat , inv.mtl_system_items_b item WHERE item.organization_id =icat.organization_id AND icat.inventory_item_id = item.inventory_item_id AND icat.category_set_id = 1100000037 AND cat.category_id = icat.category_id AND cat.enabled_flag = 'Y' AND NVL (cat.start_date_active, SYSDATE - 1) <= SYSDATE AND NVL (cat.end_date_active, SYSDATE + 1) >= SYSDATE ) itmcl WHERE bom.obj_name IS NULL AND base.inventory_item_id = bom.assembly_item_id AND base.organization_id = bom.organization_id AND NVL (ctype.organization_id, aparm.cost_organization_id) =aparm.cost_organ ization_id AND base.organization_id = aparm.organization_id AND base.organization_id = 114 AND acost.inventory_item_id = base.inventory_item_id AND acost.organization_id = aparm.cost_organization_id AND acost.cost_type_id = ctype.cost_type_id AND acost.organization_id = aparm.cost_organization_id AND icat.inventory_item_id = base.inventory_item_id AND icat.organization_id = aparm.organization_id AND icat.category_set_id = 1100000025 AND cat.category_id = icat.category_id AND cat.enabled_flag = 'Y' AND acost.organization_id = aparm.cost_organization_id AND comv.assembly_item_id = base.inventory_item_id AND comv.organization_id = 114 AND icat.inventory_item_id=comv.assembly_item_id AND bom.assembly_type =1 AND ctype.cost_type IN ('Frozen', 'SIMULATED') AND itmcl.inventory_item_id=base.inventory_item_id AND itmcl.organization_id=aparm.organization_id

Вам также может понравиться