SELECT DISTINCT c.po_header_id,
b.po_line_id,
c.segment1,
b.line_location_id,
b.po_distribution_id,
b.distribution_num,
a.unit_price,
(a.quantity - b.quantity_billed),
NULL,
a.item_id,
g.SEGMENT1 "Project Number",
h.TASK_NAME,
h.TASK_ID,
b.EXPENDITURE_TYPE,
b.EXPENDITURE_ITEM_DATE,
b.PROJECT_ACCOUNTING_CONTEXT,
b.EXPENDITURE_ORGANIZATION_ID,
j.SHIPMENT_NUM
FROM po_lines_all a,
po_distributions_all b,
po_headers_all c,
pa_projects_all g,
pa_tasks h,
pa_project_statuses i,
po_line_locations_all j
WHERE 1 = 1
AND c.segment1 = 'PO_NUMBER'
AND a.line_num = 'PO_LINE_NUMBER'
AND c.po_header_id = a.po_header_id
AND a.po_header_id = b.po_header_id
AND a.po_line_id = b.po_line_id
AND b.PROJECT_ID = g.PROJECT_ID
AND b.TASK_ID = h.TASK_ID
AND g.project_status_code = i.project_status_code
AND j.po_line_id = a.po_line_id
AND j.line_location_id = b.line_location_id
AND (a.quantity - b.quantity_billed) > 0
AND NVL (a.cancel_flag, 'N') <> 'Y'
and i.project_system_status_code = ('APPROVED');
b.po_line_id,
c.segment1,
b.line_location_id,
b.po_distribution_id,
b.distribution_num,
a.unit_price,
(a.quantity - b.quantity_billed),
NULL,
a.item_id,
g.SEGMENT1 "Project Number",
h.TASK_NAME,
h.TASK_ID,
b.EXPENDITURE_TYPE,
b.EXPENDITURE_ITEM_DATE,
b.PROJECT_ACCOUNTING_CONTEXT,
b.EXPENDITURE_ORGANIZATION_ID,
j.SHIPMENT_NUM
FROM po_lines_all a,
po_distributions_all b,
po_headers_all c,
pa_projects_all g,
pa_tasks h,
pa_project_statuses i,
po_line_locations_all j
WHERE 1 = 1
AND c.segment1 = 'PO_NUMBER'
AND a.line_num = 'PO_LINE_NUMBER'
AND c.po_header_id = a.po_header_id
AND a.po_header_id = b.po_header_id
AND a.po_line_id = b.po_line_id
AND b.PROJECT_ID = g.PROJECT_ID
AND b.TASK_ID = h.TASK_ID
AND g.project_status_code = i.project_status_code
AND j.po_line_id = a.po_line_id
AND j.line_location_id = b.line_location_id
AND (a.quantity - b.quantity_billed) > 0
AND NVL (a.cancel_flag, 'N') <> 'Y'
and i.project_system_status_code = ('APPROVED');
No comments:
Post a Comment