You are on page 1of 1

-- SO Line Query 14 Line for SO# 10046628

SELECT /*+ leading (sol) */


soh.order_number sales_order,
sol.line_id,
sol.line_number,
sol.fulfilled_quantity * sol.unit_selling_price *
NVL((SELECT MIN(gdr.conversion_rate)
FROM gl_daily_rates gdr
WHERE from_currency = soh.transactional_curr_code
AND to_currency =
(SELECT gsb.currency_code
FROM hr_operating_units hr, gl_sets_of_books gsb
WHERE hr.set_of_books_id = gsb.set_of_books_id
AND hr.organization_id = soh.org_id)
AND conversion_type = 'Spot'
AND trunc(gdr.conversion_date) = trunc(soh.ordered_date)),
1) sol_amount,
ter.eb entering_branch,
ter.sd sales_division,
ter.ou operating_unit,
sol.salesrep_id,
soh.ship_to_org_id
FROM oe_order_lines_all sol,
oe_order_headers_all soh,
xxcrm_gbl_terr_mgmt_v ter
WHERE sol.header_id = soh.header_id
AND TO_CHAR(ter.eb_id) = soh.attribute1
and soh.order_number='10046628'
AND sol.line_category_code = 'ORDER'
AND (sol.flow_status_code = 'INVOICED' OR
sol.flow_status_code = 'CLOSED' OR
sol.flow_status_code = 'FULFILLED' OR
sol.flow_status_code = 'SHIPPED')
-- Star/Standard Items
AND NVL(sol.top_model_line_id, sol.line_id) = sol.line_id
AND sol.actual_shipment_date BETWEEN
to_date(:p_in_chr_from_date,'DD-MON-YYYY')
AND
to_date(:p_in_chr_to_date,'DD-MON-YYYY')

You might also like