[Home] [Help]
MATERIALIZED VIEW: APPS.OZF_ORDER_SALES_SUMRY_MV
Source
select b.report_date_julian time_id,
1 period_type_id,
a.sold_to_cust_account_id,
a.ship_to_site_use_id ,
a.bill_to_site_use_id ,
a.inventory_item_id,
SUM( DECODE(a.transfer_type, 'IN', a.common_quantity ,-a.common_quantity) ) sales_qty,
SUM( DECODE(a.transfer_type, 'IN', a.common_amount ,-a.common_amount) ) sales_amt
from ozf_sales_transactions_all a,
ozf_time_day b
where a.transaction_date = b.report_date
and a.error_flag = 'N'
and a.source_code = 'OM'
group by
b.report_date_julian,
1,
a.sold_to_cust_account_id,
a.ship_to_site_use_id,
a.bill_to_site_use_id,
a.inventory_item_id
union all
select b.week_id time_id,
16 period_type_id,
a.sold_to_cust_account_id,
a.ship_to_site_use_id,
a.bill_to_site_use_id,
a.inventory_item_id,
SUM( DECODE(a.transfer_type, 'IN', a.common_quantity , -a.common_quantity) ) sales_qty,
SUM( DECODE(a.transfer_type, 'IN', a.common_amount, -a.common_amount) ) sales_amt
from ozf_sales_transactions_all a,
ozf_time_day b
where a.transaction_date = b.report_date
and a.error_flag = 'N'
and a.source_code = 'OM'
group by
b.week_id,
16,
a.sold_to_cust_account_id,
a.ship_to_site_use_id,
a.bill_to_site_use_id,
a.inventory_item_id
union all
select b.ent_period_id time_id,
32 period_type_id,
a.sold_to_cust_account_id,
a.ship_to_site_use_id,
a.bill_to_site_use_id,
a.inventory_item_id,
SUM( DECODE(a.transfer_type, 'IN', a.common_quantity, -a.common_quantity) ) sales_qty,
SUM( DECODE(a.transfer_type, 'IN', a.common_amount, -a.common_amount) ) sales_amt
from ozf_sales_transactions_all a,
ozf_time_day b
where a.transaction_date = b.report_date
and a.error_flag = 'N'
and a.source_code = 'OM'
group by
b.ent_period_id,
32,
a.sold_to_cust_account_id,
a.ship_to_site_use_id,
a.bill_to_site_use_id,
a.inventory_item_id
union all
select b.ent_qtr_id time_id,
64 period_type_id,
a.sold_to_cust_account_id,
a.ship_to_site_use_id,
a.bill_to_site_use_id,
a.inventory_item_id,
SUM( DECODE(a.transfer_type, 'IN',a.common_quantity,-a.common_quantity) ) sales_qty,
SUM( DECODE(a.transfer_type, 'IN',a.common_amount, -a.common_amount) ) sales_amt
from ozf_sales_transactions_all a,
ozf_time_day b
where a.transaction_date = b.report_date
and a.error_flag = 'N'
and a.source_code = 'OM'
group by
b.ent_qtr_id,
64,
a.sold_to_cust_account_id,
a.ship_to_site_use_id,
a.bill_to_site_use_id,
a.inventory_item_id
union all
select b.ent_year_id time_id,
128 period_type_id,
a.sold_to_cust_account_id,
a.ship_to_site_use_id,
a.bill_to_site_use_id,
a.inventory_item_id,
SUM( DECODE(a.transfer_type, 'IN', a.common_quantity, -a.common_quantity) ) sales_qty,
SUM( DECODE(a.transfer_type, 'IN', a.common_amount , -a.common_amount) ) sales_amt
from ozf_sales_transactions_all a,
ozf_time_day b
where a.transaction_date = b.report_date
and a.error_flag = 'N'
and a.source_code = 'OM'
group by
b.ent_year_id,
128,
a.sold_to_cust_account_id,
a.ship_to_site_use_id,
a.bill_to_site_use_id,
a.inventory_item_id