Sie sind auf Seite 1von 3

select distinct 'PO' TYPE,currency_code,poh.segment1 po_number ,(pol.UNIT_PRICE* nvl(poh.rate,1)) rate,pol.quantity, 0 PO,AUTHORIZATION_STATUS, msi.segment1,msi.description ,pol.

po_line_id from po_headers_all poh, po_lines_all pol, po_distributions_all pod , mtl_system_items msi where pod.project_id in (select project_id From pa_projects_all where segment1=:porjec t_no) and poh.po_header_id = pol.po_header_id and pol.po_line_id = pod.po_line_id AND AUTHORIZATION_STATUS !='REJECTED' and msi.inventory_item_id = pol.item_id and pol.cancelled_by is null AND msi.organization_id = 88 UNION ALL select distinct 'PRS' TYPE,null, prh.segment1 req_no,prl.UNIT_PRICE,prl.quantit y,prl.line_location_id,AUTHORIZATION_STATUS, msi.segment1,msi.description ,prl.requisition_line_id from po_req_distributions_all prd, po_requisition_lines_all prl, po_requisition_headers_all prh, mtl_system_items msi where prd.project_id in (select project_id From pa_projects_all where segment1=: porject_no) and prh.requisition_header_id = prl.requisition_header_id and prl.requisition_line_id = prd.requisition_line_id and prl.line_location_id is null AND AUTHORIZATION_STATUS NOT IN ('RETURNED','REJECTED') and (prl.MODIFIED_BY_AGENT_FLAG is null or prl.MODIFIED_BY_AGENT_FLAG='N') AND msi.inventory_item_id = prl.item_id and msi.organization_id = 88 -----------------------------------------------------------

SELECT SUM(RATE*QUANTITY) FROM( select 'PO' TYPE,currency_code,poh.segment1 po_number ,(pol.UNIT_PRICE*nvl(poh.r ate,1)) rate,pol.quantity, 0 PO,AUTHORIZATION_STATUS from po_headers_all poh, po_lines_all pol, po_distributions_all pod where pod.project_id in (select project_id From pa_projects_all where segment1=:porjec t_no) and poh.po_header_id = pol.po_header_id and pol.po_line_id = pod.po_line_id AND AUTHORIZATION_STATUS !='REJECTED' UNION ALL select 'PRS' TYPE,null, prh.segment1 req_no,prl.UNIT_PRICE,prl.quantity,prl.lin e_location_id,AUTHORIZATION_STATUS from po_req_distributions_all prd, po_requisition_lines_all prl, po_requisition_headers_all prh where prd.project_id in (select project_id From pa_projects_all where segment1=:

porject_no) and prh.requisition_header_id = prl.requisition_header_id prl.requisition_line_id = prd.requisition_line_id and prl.line_location_id is null AND AUTHORIZATION_STATUS NOT IN ('RETURNED','REJECTED') ) A

and

----------------------------MULTIPLE PROJECTS ----------------------------select 'PO' TYPE,currency_code,poh.segment1 po_number ,(pol.UNIT_PRICE*nvl(poh.r ate,1)) rate,pol.quantity, 0 PO,AUTHORIZATION_STATUS,ppa.segment1 project_no fro m po_headers_all poh, po_lines_all pol, po_distributions_all pod , pa_projects_all ppa where pod.project_id =ppa.project_id and ppa.segment1 in('10828','11347') an d poh.po_header_id = pol.po_header_id and pol.po_line_id = pod.po_line_id AND AUTHORIZATION_STATUS !='REJECTED' UNION ALL select 'PRS' TYPE,null, prh.segment1 req_no,prl.UNIT_PRICE,prl.quantity,prl.lin e_location_id,AUTHORIZATION_STATUS,ppa.segment1 project_no from po_req_distributions_all prd, po_requisition_lines_all prl, po_requisition_headers_all prh, pa_projects_all ppa where prd.project_id =ppa.project_id and ppa.segment1 in('10828','11347') an d prh.requisition_header_id = prl.requisition_header_id and prl.requisition_line_id = prd.requisition_line_id and prl.line_location_id is null AND AUTHORIZATION_STATUS NOT IN ('RETURNED','REJECTED') ---------------------------------------

select currency_code,poh.segment1 po_number ,(pol.UNIT_PRICE*nvl(poh.rate,1)) ra te,pol.quantity, 0 PO,AUTHORIZATION_STATUS from po_headers_all poh, po_lines_all pol, po_distributions_all pod where pod.project_id in (select project_id From pa_projects_all where segment1=:porjec t_no) and poh.po_header_id = pol.po_header_id and pol.po_line_id = pod.po_line_id UNION ALL select null, prh.segment1 req_no,prl.UNIT_PRICE,prl.quantity,prl.line_location_i d,AUTHORIZATION_STATUS from po_req_distributions_all prd,

po_requisition_lines_all prl, po_requisition_headers_all prh where prd.project_id in (select project_id From pa_projects_all where segment1=: porject_no) and prh.requisition_header_id = prl.requisition_header_id and prl.requisition_line_id = prd.requisition_line_id and prl.line_location_id is null

Das könnte Ihnen auch gefallen