[Home] [Help]
MATERIALIZED VIEW: APPS.POA_POD_BS_J_MV
Source
select /* 12.0: bug#4526784 */
f.rowid frid,
cal.rowid crid,
com.rowid comrid,
map.rowid mrid,
f.creation_operating_unit_id org_id,
nvl(com.commodity_id,-1) commodity_id,
f.base_uom base_uom,
f.supplier_id,
f.supplier_site_id,
f.category_id,
f.po_item_id,
f.buyer_id,
f.shipment_type,
map.parent_company_dim_id company_id,
map.parent_cost_center_dim_id cost_center_id,
cal.ent_year_id,
cal.ent_qtr_id,
cal.ent_period_id,
cal.week_id,
cal.report_date_julian day_id,
f.quantity quantity,
f.purchase_amount_b * f.func_cur_conv_rate purchase_amt_b,
decode(
f.global_cur_conv_rate,0,
f.purchase_amount_b,
f.purchase_amount_b * f.func_cur_conv_rate * f.global_cur_conv_rate
) purchase_amt_g,
decode(
f.sglobal_cur_conv_rate,0,
f.purchase_amount_b,
f.purchase_amount_b * f.func_cur_conv_rate * f.sglobal_cur_conv_rate
) purchase_amt_sg,
f.pot_contract_amount_b * f.func_cur_conv_rate p_contract_amt_b,
decode(
f.global_cur_conv_rate,0,
f.pot_contract_amount_b,
f.pot_contract_amount_b * f.func_cur_conv_rate * f.global_cur_conv_rate
) p_contract_amt_g,
decode(
f.sglobal_cur_conv_rate,0,
f.pot_contract_amount_b,
f.pot_contract_amount_b * f.func_cur_conv_rate * f.sglobal_cur_conv_rate
) p_contract_amt_sg,
f.non_contract_amount_b * f.func_cur_conv_rate n_contract_amt_b,
decode(
f.global_cur_conv_rate,0,
f.non_contract_amount_b,
f.non_contract_amount_b * f.func_cur_conv_rate * f.global_cur_conv_rate
) n_contract_amt_g,
decode(
f.sglobal_cur_conv_rate,0,
f.non_contract_amount_b,
f.non_contract_amount_b * f.func_cur_conv_rate * f.sglobal_cur_conv_rate
) n_contract_amt_sg,
f.pot_savings_amount_b * f.func_cur_conv_rate p_savings_amt_b,
decode(
f.global_cur_conv_rate,0,
f.pot_savings_amount_b,
f.pot_savings_amount_b * f.func_cur_conv_rate * f.global_cur_conv_rate
) p_savings_amt_g,
decode(
f.sglobal_cur_conv_rate,0,
f.pot_savings_amount_b,
f.pot_savings_amount_b * f.func_cur_conv_rate * f.sglobal_cur_conv_rate
) p_savings_amt_sg,
f.contract_amount_b * f.func_cur_conv_rate contract_amt_b,
decode(
f.global_cur_conv_rate,0,
f.contract_amount_b,
f.contract_amount_b * f.func_cur_conv_rate * f.global_cur_conv_rate
) contract_amt_g,
decode(
f.sglobal_cur_conv_rate,0,
f.contract_amount_b,
f.contract_amount_b * f.func_cur_conv_rate * f.sglobal_cur_conv_rate
) contract_amt_sg,
least(f.pot_savings_amount_b*f.func_cur_conv_rate, 0) below_contract_amt_b,
least(
decode(
f.global_cur_conv_rate,0,
f.pot_savings_amount_b,
f.pot_savings_amount_b * f.func_cur_conv_rate * f.global_cur_conv_rate
),
0
) below_contract_amt_g,
least(
decode(
f.sglobal_cur_conv_rate,0,
f.pot_savings_amount_b,
f.pot_savings_amount_b * f.func_cur_conv_rate * f.sglobal_cur_conv_rate
),
0
) below_contract_amt_sg,
greatest(f.pot_savings_amount_b * f.func_cur_conv_rate, 0) above_contract_amt_b,
greatest(
decode(
f.global_cur_conv_rate,0,
f.pot_savings_amount_b,
f.pot_savings_amount_b * f.func_cur_conv_rate * f.global_cur_conv_rate
),
0
) above_contract_amt_g,
greatest(
decode(
f.sglobal_cur_conv_rate,0,
f.pot_savings_amount_b,
f.pot_savings_amount_b * f.func_cur_conv_rate * f.sglobal_cur_conv_rate
),
0
) above_contract_amt_sg,
f.consigned_code,
f.non_zero_quantity nz_quantity,
f.auction_header_id,
f.auction_line_number,
f.bid_number,
f.bid_line_number,
f.po_release_id,
f.po_header_id,
f.negotiation_creator_id,
f.doctype_id,
(f.neg_current_price * nvl(f.quantity,1) * f.neg_func_cur_conv_rate) current_amt_b,
decode(
f.neg_global_cur_conv_rate,0,
f.neg_current_price * nvl(f.quantity,1),
f.neg_current_price * nvl(f.quantity,1) * f.neg_func_cur_conv_rate * f.neg_global_cur_conv_rate
) current_amt_g,
decode(
f.neg_sglobal_cur_conv_rate,0,
f.neg_current_price * nvl(f.quantity,1),
f.neg_current_price * nvl(f.quantity,1) * f.neg_func_cur_conv_rate * f.neg_sglobal_cur_conv_rate
) current_amt_sg,
decode(f.negotiated_by_preparer_flag,'N', to_number(null), decode(f.shipment_type, 'BLANKET', 1, 'SCHEDULED', 2, decode(f.from_document_type, 'BLANKET', 3, decode(greatest(f.contract_amount_b, 0), 0, null, 4)))) contract_type
FROM POA.POA_DBI_POD_F f,
FII.FII_TIME_DAY cal,
PO.PO_COMMODITY_CATEGORIES com,
FII.FII_COM_CC_DIM_MAPS map
WHERE f.category_id = com.category_id(+)
and f.approved_date = cal.report_date
and f.company_id = map.child_company_id(+)
and f.cost_center_id = map.child_cost_center_id(+)