/*Other trans (return)*/
SELECT DISTINCT mmt.organization_id org_id,
(mmt.transaction_date) trans_date,
(SUBSTR (msib.segment1, 1, 1)) AS item_code_series,
gcc.segment2, gcc.segment3, gcc.segment4,
msib.segment1 AS item_code, mtt.transaction_type_name,
mta.base_transaction_value AS VALUE,
mta.primary_quantity AS quantity,
(mta.base_transaction_value / mta.primary_quantity
) AS unit_rate,
TO_CHAR (mmt.transaction_id) AS reference_number,
REGEXP_REPLACE (msib.description,
'([^[:alnum:]])',
' '
) AS item_description,
msib.primary_uom_code AS uom, ood.organization_id,
ood.organization_code, ood.organization_name,
gcc.segment1, gcc.segment5, gcc.segment6,
ppa.segment1 AS project, pt.task_number AS task
FROM apps.gl_code_combinations gcc,
apps.xla_ae_lines xal,
apps.xla_ae_headers xah,
apps.xla_transaction_entities_upg xteu,
apps.mtl_material_transactions mmt,
apps.mtl_transaction_accounts mta,
apps.mtl_transaction_types mtt,
apps.mtl_system_items_b msib,
apps.pa_projects_all ppa,
apps.pa_tasks pt,
apps.org_organization_definitions ood
WHERE 1 = 1
AND mtt.transaction_type_id NOT IN
('35', '63', '34', '95', '36', '100', '43', '48','27',
'17', '37', '13', '14', '23', '39', '100', '1003')
--
AND mta.primary_quantity >= 0
AND gcc.segment4 IN
('3021000', '3021100', '3021200', '3021300',
'3021400', '3021500', '3021600', '3021610',
'3021700')
AND gcc.code_combination_id = xal.code_combination_id
AND xal.ae_header_id = xah.ae_header_id
AND xah.entity_id = xteu.entity_id
AND xteu.source_id_int_1 = mmt.transaction_id
AND mta.transaction_id = mmt.transaction_id
AND mta.organization_id = mmt.organization_id
AND ood.organization_id = mmt.organization_id
AND mta.organization_id = ood.organization_id
AND mmt.transaction_type_id = mtt.transaction_type_id
AND mmt.inventory_item_id = msib.inventory_item_id
AND mmt.organization_id = msib.organization_id
AND SUBSTR (msib.segment1, 1, 1) IN
('1', '2', '3', '4', '5', '6', '7', '8', '9')
AND mmt.project_id = ppa.project_id(+)
AND mmt.task_id = pt.task_id(+)
AND ood.organization_id not in (102)
AND trunc(mmt.transaction_date) BETWEEN :p_f_date AND :p_t_date
AND ood.organization_id =
NVL (:p_organization_id, ood.organization_id)
AND gcc.segment2 = NVL (:p_cost_center, gcc.segment2)
AND gcc.segment3 BETWEEN NVL (:p_from_department,
gcc.segment3
)
AND NVL (:p_to_department,
gcc.segment3
)
AND gcc.segment4 = NVL (:p_account_code, gcc.segment4)
AND SUBSTR (msib.segment1, 1, 1) =
NVL (:p_item_series, SUBSTR (msib.segment1, 1, 1))
ORDER BY msib.segment1
SELECT DISTINCT mmt.organization_id org_id,
(mmt.transaction_date) trans_date,
(SUBSTR (msib.segment1, 1, 1)) AS item_code_series,
gcc.segment2, gcc.segment3, gcc.segment4,
msib.segment1 AS item_code, mtt.transaction_type_name,
mta.base_transaction_value AS VALUE,
mta.primary_quantity AS quantity,
(mta.base_transaction_value / mta.primary_quantity
) AS unit_rate,
TO_CHAR (mmt.transaction_id) AS reference_number,
REGEXP_REPLACE (msib.description,
'([^[:alnum:]])',
' '
) AS item_description,
msib.primary_uom_code AS uom, ood.organization_id,
ood.organization_code, ood.organization_name,
gcc.segment1, gcc.segment5, gcc.segment6,
ppa.segment1 AS project, pt.task_number AS task
FROM apps.gl_code_combinations gcc,
apps.xla_ae_lines xal,
apps.xla_ae_headers xah,
apps.xla_transaction_entities_upg xteu,
apps.mtl_material_transactions mmt,
apps.mtl_transaction_accounts mta,
apps.mtl_transaction_types mtt,
apps.mtl_system_items_b msib,
apps.pa_projects_all ppa,
apps.pa_tasks pt,
apps.org_organization_definitions ood
WHERE 1 = 1
AND mtt.transaction_type_id NOT IN
('35', '63', '34', '95', '36', '100', '43', '48','27',
'17', '37', '13', '14', '23', '39', '100', '1003')
--
AND mta.primary_quantity >= 0
AND gcc.segment4 IN
('3021000', '3021100', '3021200', '3021300',
'3021400', '3021500', '3021600', '3021610',
'3021700')
AND gcc.code_combination_id = xal.code_combination_id
AND xal.ae_header_id = xah.ae_header_id
AND xah.entity_id = xteu.entity_id
AND xteu.source_id_int_1 = mmt.transaction_id
AND mta.transaction_id = mmt.transaction_id
AND mta.organization_id = mmt.organization_id
AND ood.organization_id = mmt.organization_id
AND mta.organization_id = ood.organization_id
AND mmt.transaction_type_id = mtt.transaction_type_id
AND mmt.inventory_item_id = msib.inventory_item_id
AND mmt.organization_id = msib.organization_id
AND SUBSTR (msib.segment1, 1, 1) IN
('1', '2', '3', '4', '5', '6', '7', '8', '9')
AND mmt.project_id = ppa.project_id(+)
AND mmt.task_id = pt.task_id(+)
AND ood.organization_id not in (102)
AND trunc(mmt.transaction_date) BETWEEN :p_f_date AND :p_t_date
AND ood.organization_id =
NVL (:p_organization_id, ood.organization_id)
AND gcc.segment2 = NVL (:p_cost_center, gcc.segment2)
AND gcc.segment3 BETWEEN NVL (:p_from_department,
gcc.segment3
)
AND NVL (:p_to_department,
gcc.segment3
)
AND gcc.segment4 = NVL (:p_account_code, gcc.segment4)
AND SUBSTR (msib.segment1, 1, 1) =
NVL (:p_item_series, SUBSTR (msib.segment1, 1, 1))
ORDER BY msib.segment1
No comments:
Post a Comment