0% found this document useful (0 votes)
2 views

Incomplete order

The document contains a SQL query that retrieves data related to sales orders from various tables, including order headers and lines. It filters the results based on specific criteria such as order date, flow status, and selling price, while excluding certain order types and categories. The query aims to calculate total sales by summing unit selling prices and tax values for valid orders.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Incomplete order

The document contains a SQL query that retrieves data related to sales orders from various tables, including order headers and lines. It filters the results based on specific criteria such as order date, flow status, and selling price, while excluding certain order types and categories. The query aims to calculate total sales by summing unit selling prices and tax values for valid orders.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

"---------------------------------------------------------------------------------

/*begin
mo_global.init('M');
end;*/

select hou.name operating_unit


,oohv.org_id
,oohv.order_number
,to_char(oohv.ordered_date,'DD-MON-RRRR') ordered_date
,oolv.UNIT_SELLING_PRICE
,oolv.ORDERED_QUANTITY
,oolv.TAX_VALUE
,(oolv.UNIT_SELLING_PRICE*oolv.ORDERED_QUANTITY) +oolv.TAX_VALUE total_sale
-- sum(oolv.UNIT_SELLING_PRICE * oolv.ORDERED_QUANTITY) + sum(oolv.TAX_VALUE)
,oohv.sold_to
,oohv.order_type
,oohv.flow_status_code
,oolv.flow_status_code line_status
,oolv.LINE_NUMBER
,oolv.line_id
/*into --v_org_id,
--v_header_id,
--v_order_number,
v_order_type,
v_subtotal,
v_tax,
v_total*/
from oe_order_headers_v oohv,
oe_order_lines_v oolv,
hr_operating_units hou
where 1=1
--and oohv.order_number = '23100129'
and oohv.ordered_date > to_date('31-DEC-2011')
and oohv.org_id = hou.organization_id
and oohv.header_id = oolv.header_id
and oohv.org_id = oolv.org_id
and oohv.flow_status_code in ('BOOKED','CLOSED','INVOICE INTERFACE -
COMPLETE')
and oolv.line_category_code <> 'RETURN'
--and upper(oohv.terms) <> upper('IMMEDIATE') --
and oohv.order_type not like '%Branch Tran%'
and oolv.flow_status_code <> 'CANCELLED'
and oolv.UNIT_SELLING_PRICE > 0
and (select rctla.interface_line_attribute1 order_number
from ra_customer_trx_lines_all rctla
where 1=1
and nvl(rctla.interface_line_context,'ORDER ENTRY') = 'ORDER ENTRY'
and nvl(rctla.LINE_TYPE,'LINE') = 'LINE'
and rctla.interface_line_attribute6 =
to_char(oolv.line_id)
and rctla.interface_line_attribute1 =
to_char(oohv.order_number) ) /*ar_order_number*/ is null
order by oohv.ordered_date,oohv.order_number,oohv.org_id"

You might also like