SELECT
a.segment1 po_num,
b.LINE_NUM,
a.creation_date,
e.vendor_name,
b.quantity,
b.unit_price,
c.ACTION_CODE,
c.EMPLOYEE_NAME APPROVER,
(b.unit_price * b.quantity) po_price
FROM po_headers_all a,
po_lines_all b,
po_action_history_v c,
ap_suppliers e
WHERE a.org_id = 204
AND e.vendor_id = a.vendor_id
AND a.creation_date BETWEEN '01-Apr-2014' AND '31-Dec-2015'
AND a.approved_flag = 'Y'
AND a.po_header_id = b.po_header_id
AND a.po_header_id = c.object_id
AND C.ACTION_CODE='APPROVE'
AND a.AUTHORIZATION_STATUS='APPROVED'--c.action_code ='APPROVE'
AND c.SEQUENCE_NUM = (SELECT MAX (sequence_num) FROM po_action_history_v WHERE object_id = a.po_header_id)
AND a.po_header_id NOT IN (SELECT object_id FROM po_action_history_v WHERE employee_id in (1318))
GROUP BY
a.segment1,
b.LINE_NUM,
a.creation_date,
e.vendor_name,
b.quantity,
b.unit_price,
c.ACTION_CODE,
c.EMPLOYEE_NAME
No comments:
Post a Comment