Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

select l.

item_identifier_type,
l.inventory_item_id,
l.ordered_item_id,
l.ordered_item,
si.description,
l.cancelled_quantity,
l.ordered_quantity,
l.fulfilled_quantity,
l.shipped_quantity,
l.order_quantity_uom,
l.request_date,
l.promise_date,
l.schedule_ship_date,
trx.trx_number Invoice_Number,
trx.trx_date Invoice_Date,
trxl.unit_selling_price,
trxl.sales_order,
decode(nvl(trxl.interface_line_attribute11,'0'),'0',decode(l.line_category_code,'RE
TURN',trxl.quantity_credited,trxl.quantity_invoiced) ,null) Quantity,
decode(l.line_category_code,'RETURN',
(trxl.quantity_credited*trxl.unit_selling_price),(trxl.quantity_invoiced *
trxl.unit_selling_price)) Amount,
hri.name,
l.line_category_code
--hr2.name,
--hr3.name
FROM oe_order_lines_all l,
ra_customer_trx_all trx,
ra_customer_trx_lines_all trxl,
HR.hr_all_organization_units_tl hri,
inv.mtl_system_items_b si
-- HR.hr_all_organization_units_tl hr2,
--HR.hr_all_organization_units_tl hr3
WHERE to_char(l.line_id) = trxl.interface_line_attribute6
AND l.invoice_interface_status_code = 'YES'
--and l.line_category_code NOT LIKE 'RETURN'
AND l.service_reference_line_id is null
AND trx.customer_trx_id = trxl.customer_trx_id
and hri.organization_id = l.ship_from_org_id
and l.ship_from_org_id = si.organization_id
and l.ordered_item_id = si.inventory_item_id
--and hr2.organization_id = l.ship_to_org_id
--and hr3.organization_id = l.invoice_to_org_id
and trx.trx_date between '01-JAN-20' and '31-JAN-20'
ORDER BY trx.trx_number, trxl.line_number

from oe.order_lines_all l,
ra.ra_customer_trx_all trx,
ra.ra_customer_trx_lines_all trx1,
hr.hr_all_organization_units_tl hri
where to_char(l.line_id) = trx1.interface_line_attribute6
and l.invoice_interface_status_code = 'YES'
and l.service_reference_line_id is null
and trx.customer_trx_id = trx1.customer_trx_id
and hri.organization_id = l.ship_from_org_id
and trx.trx_date between '01-JAN-20' and '31-JAN-20'

You might also like