Open PO's to display the information regarding the PO like Amount Billed,Amount Ordered in Shipment Level.
select
(l.quantity*l.unit_price) "Amount Ordered",
(select sum(aid.amount)
from ap_invoices_all aia,
ap_invoice_distributions_all aid
where aia.invoice_id = aid.invoice_id
and aid.po_distribution_id = d.po_distribution_id)"Amount Billed",
(select sum(aip.amount )
from AP_INVOICE_PAYMENTS_all aip ,
ap_invoice_distributions_all adi
where aip.invoice_id=adi.invoice_id
and adi.po_distribution_id= d.po_distribution_id)"Amount Received",
gcc.segment1||'-'||gcc.segment2||'-'||gcc.segment3||'-'||gcc.segment4||'-'||gcc.segment5 "Charge account",
ll.ship_to_location_id "Ship to Location",
l.quantity "quantity",
ll.quantity "Ordered Quantity",
ll.quantity_Billed "Billed Quantity",
ll.quantity_received "Received Quantity",
h.segment1,
d.po_distribution_id
from
po.po_headers_all h,
po.po_lines_all l,
po.po_line_locations_all ll,
po.po_distributions_all d,
gl_code_combinations gcc
where h.po_header_id = l.po_header_id
and gcc.code_combination_id=d.code_combination_id
and ll.po_line_id = l.po_Line_id
and ll.line_location_id = d.line_location_id
and h.segment1='1505'
and h.closed_date is null ;
select
(l.quantity*l.unit_price) "Amount Ordered",
(select sum(aid.amount)
from ap_invoices_all aia,
ap_invoice_distributions_all aid
where aia.invoice_id = aid.invoice_id
and aid.po_distribution_id = d.po_distribution_id)"Amount Billed",
(select sum(aip.amount )
from AP_INVOICE_PAYMENTS_all aip ,
ap_invoice_distributions_all adi
where aip.invoice_id=adi.invoice_id
and adi.po_distribution_id= d.po_distribution_id)"Amount Received",
gcc.segment1||'-'||gcc.segment2||'-'||gcc.segment3||'-'||gcc.segment4||'-'||gcc.segment5 "Charge account",
ll.ship_to_location_id "Ship to Location",
l.quantity "quantity",
ll.quantity "Ordered Quantity",
ll.quantity_Billed "Billed Quantity",
ll.quantity_received "Received Quantity",
h.segment1,
d.po_distribution_id
from
po.po_headers_all h,
po.po_lines_all l,
po.po_line_locations_all ll,
po.po_distributions_all d,
gl_code_combinations gcc
where h.po_header_id = l.po_header_id
and gcc.code_combination_id=d.code_combination_id
and ll.po_line_id = l.po_Line_id
and ll.line_location_id = d.line_location_id
and h.segment1='1505'
and h.closed_date is null ;
No comments:
Post a Comment