Tuesday, August 27, 2013

pa pending records in r12

--begin
--mo_global.set_policy_context('S',87);
--end;

select * from (
select
(select name from apps.hr_operating_units  where organization_id=a.org_id) Organization,'Invoice' Type,
customer_number,customer_name,segment1 project_number,draft_Invoice_num
,decode(a.transfer_status_code,'P','Pending','T','Transfer to Receivable, Run Tie Back','R','Rejected','X','Rejected')transfer_status_code,a.transfer_rejection_reason
,gL_date
from apps.pa_draft_invoices_all  a,apps.pa_projects_all b,apps.pa_project_customers_v c
where a.project_id=b.project_id
and b.project_id= c.project_id
and a.transfer_status_code not in ('A','T')
and segment1 not like 'BRI%'
union all
select
(select name from apps.hr_operating_units  where organization_id=a.org_id) Organization,'Revenue' Type,
customer_number,customer_name,segment1 project_number,draft_revenue_num
,decode(a.transfer_status_code,'P','Pending','R','Rejected','X','Rejected')transfer_status_code,a.transfer_rejection_reason,gL_date
from apps.pa_draft_revenues_all  a,apps.pa_projects_all b,apps.pa_project_customers_v c
where a.project_id=b.project_id
and b.project_id= c.project_id
and a.transfer_status_code!='A'
and segment1 not like 'BRI%' ) order by Organization,Type

No comments:

Post a Comment