Log Summary

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

select

acc.name account_name,
acc.HQ_THEATRE_REGION__C hq_theater_region,
psd.name psd,
pm.NAME project_manager,
region.name region_name,
owner.name project_owner,
master.id master_project_id,
master.NAME Master_Project,
master.PSE__PROJECT_STATUS__C master_project_status,
master.project_closure_date__C master_project_closure_date,
master.PSE__IS_ACTIVE__C master_is_Active,
(select name from xxsfdc.user2 where id = master.createdbyid) Master_Created_By,
parent.BUSINESS_UNIT__C business_unit,
master.business_group__c master_business_group,
--parent.business_group__c business_group,
site.business_group__c site_business_group,
mile.BUSINESS_GROUP__C Milestone_business_group,
dbms_lob.substr(mile.business_line__c) Milestone_business_line,
dbms_lob.substr(nvl(nvl(nvl(mile.business_line__c,site.BUSINESS_UNIT__C),parent.BUS
INESS_UNIT__C), master.BUSINESS_UNIT__C)) business_line,
nvl(nvl(nvl(mile.business_group__c,
site.business_group__c),parent.business_group__c), master.business_group__c)
business_group,
parent.ORACLE_COMPANY_CODE__C oracle_company,
parent.oracle_so_number__c oracle_so_number,
parent.ORACLE_QUOTE_NUMBER__C oracle_quote_number,
parent.PO_NUMBER__C PO_Number,
dbms_lob.substr(parent.CUSTOMER_PO_NUMBER__C,4000,1) Cust_PO_Number,
parent.order_type__c parent_order_type,
parent.id parent_project_id,
parent.NAME parent_project,
parent.PROJECT_NICKNAME__C parent_project_nickname,
dbms_lob.substr(parent.theater__c,4000,1) parent_project_theater,
parent.PSE__START_DATE__C parent_project_start_date,
parent.PSE__PROJECT_STATUS__C parent_project_status,
parent.PSE__STAGE__C parent_project_stage,
parent.PSE__IS_ACTIVE__C Parent_is_Active,
parent.PSE__PROJECT_STATUS_NOTES__C Parent_Project_Status_Notes,
parent.project_variance_reason__c Parent_project_variance_reason,
parent.PSE__IS_ACTIVE__C Parent_Project_Active,
parent.PSE__BOOKINGS__C Parent_project_bookings,
parent.project_closure_reason__C Parent_project_closure_reason,
parent.project_closure_date__C Parent_project_closure_date,
parent.pse__end_date__c parent_project_end_date,
site.id project_id,
site.name project_name,
site.revenue_region_code__c revenue_region,
site.ORACLE_SITE_NAME__C oracle_site_name,
dbms_lob.substr(site.FIXED_FEE_BILL_UPON__C,4000,1) fixed_fee_bill_upon,
site.PSE__IS_ACTIVE__C Project_Active,
biller.name OBT_Biller,
mile.id milestone_id,
mile.PSE__INCLUDE_IN_FINANCIALS__C include_in_financials,
mile.name milestone_name,
substr(mile.PSE__BILLING_EVENT__C,instr(mile.PSE__BILLING_EVENT__C,'>')+1,

length(substr(mile.PSE__BILLING_EVENT__C,instr(mile.PSE__BILLING_EVENT__C,'>')+1))-
4 ) be_name,
mile.PSE__ACTUAL_DATE__C milestone_actual_billing_date,
mile.Order_Type__c milestone_order_type,
mile.milestone_service_category__c milestone_service_category,
mile.currencyisocode milestone_currency,
mile.PSE__STATUS__C milestone_status,
mile.PSE__REQUIRES_CUSTOMER_SIGN_OF CustomerSign_Off,
mile.PSE__PLANNED_HOURS__C Milestone_Planned_Hrs,
mile.PSE__BILLABLE_HOURS_IN_FINANCI Milestone_Hrs_in_Financials,
mile.PSE__BILLABLE_HOURS_SUBMITTED_ Milestone_Hrs_Submitted,
(select sum(tc.billable_hrs__c)
from xxsfdc.PSE__TIMECARD_HEADER__C tch,
xxsfdc.pse__timecard__c tc
where tch.id = tc.PSE__TIMECARD_HEADER__C
and tch.PSE__APPROVED__C = 1
and tch.pse__milestone__C = mile.id
--and tch.parent_project_so_number__c = parent.oracle_so_number__c
) Milestone_Billable_Hrs,
(select sum(tc.non_billable_hrs__c)
from xxsfdc.PSE__TIMECARD_HEADER__C tch,
xxsfdc.pse__timecard__c tc
where tch.id = tc.PSE__TIMECARD_HEADER__C
and tch.PSE__APPROVED__C = 1
and tch.pse__milestone__C = mile.id
--and tch.parent_project_so_number__c = parent.oracle_so_number__c
) Milestone_non_Billable_Hrs,
parent.PSE__IS_BILLABLE__C Parent_Is_Billable,
nvl(mile.practice__C,parent.PSE__PRACTICE__C) Practice,
parent.PSE__PROJECT_TYPE__C PArent_project_type,
dbms_lob.substr(parent.product__c,4000,1) Parent_Product,
parent.READY_FOR_REVPRO__C Ready_for_revPro,
dbms_lob.substr(mile.PSE__ELIGIBLE_FOR_BILLING__C) Milestone_Is_Billable,
mile.PMO_Approved__c PMO_Approved,
mile.Revenue_Approved__c Revenue_approved,
mile.PSE__INVOICED__C invoiced,
mile.PSE__EXCLUDE_FROM_BILLING__C Exclude_from_Billing,
mile.PSE__TARGET_DATE__C Milestone_setup_date,
mile.EXPECTED_DATE__C Milestone_Expected_Date,
mile.COMPLETED_DATE__C milestone_completed_date,
dbms_lob.substr(mile.REVENUE_NUMBER__C,4000,1) revenue_number,
mile.pse__Invoice_Number__c Invoice_Number,
mile.pse__Invoice_Date__c Invoice_Date,
mile.MS_Amount_if_FF__c Milestone_Amt_FF,
mile.MS_Amount_if_T_M__c Milestone_Amt_TM,
mile.PSE__MILESTONE_AMOUNT__C Milestone_Amt,
--mile.PSE__BILLABLE_AMOUNT_IN_FINANC Milestone_Billable_Amt, --Get amt from
timecards as its not updated at milestone level for some.
(select sum(tc.PSE__TOTAL_BILLABLE_AMOUNT__C)
from xxsfdc.PSE__TIMECARD_HEADER__C tch,
xxsfdc.pse__timecard__c tc
where tc.PSE__TIMECARD_HEADER__C =tch.id(+)
and tc.PSE__APPROVED__C = 1
and tc.PSE__BILLABLE__C = 1
and tch.pse__milestone__C = mile.id
and tc.PSE__START_DATE__C <= SYSDATE) Milestone_Billable_Amt,
mile.PSE__BILLABLE_AMOUNT_SUBMITTED Milestone_Submitted_Amt,
mile.PERFORMANCE_OBLIGATION__C pob_id,
pob.name POB_name,
curr.conversionrate
from xxsfdc.pse__proj__C master,
xxsfdc.pse__proj__C parent,
xxsfdc.pse__proj__C site,
xxsfdc.PSE__MILESTONE__C mile,
xxsfdc.account acc,
xxsfdc.contact psd,
xxsfdc.contact pm,
xxsfdc.contact biller,
xxsfdc.user2 owner,
xxsfdc.pse__region__c region,
xxsfdc.currencyType curr,
xxsfdc.PERFORMANCE_OBLIGATION__C pob
where 1=1
AND master.id = parent.PSE__MASTER_PROJECT__C
AND parent.id = site.PSE__PARENT_PROJECT__C
and site.id = mile.pse__project__c
and parent.pse__account__c = acc.id
and parent.ownerid = owner.id
AND parent.PSE__PROJECT_MANAGER__C = pm.id(+)
and parent.PRACTICE_DIRECTOR__C = psd.id(+)
AND site.OBT_Biller__c = biller.id(+)
and parent.pse__Region__c = region.id
and mile.currencyisocode = curr.isocode
and mile.PERFORMANCE_OBLIGATION__C = pob.id(+)

--AND nvl(parent.ORACLE_COMPANY_CODE__C,'ZZ') LIKE '%AMER%'


--AND nvl(parent.business_group__c,'ZZ') IN ('KANA','Verint','Major Oak','ZZ')
--AND nvl( mile.PSE__STATUS__C,'ZZ') NOT IN ('Cancelled','Complete')
--AND nvl(parent.PSE__STAGE__C,'ZZ') NOT IN ('Canceled','Debooked','Inactive /
Completed')

You might also like