--- Project Detail Export Report v5.0 ---- Changes made based on v8 905 doc ---- added few columns along with PO line number ---- Added union for Transaction source with Fusion Payables and other sources and PO line number ---- v4 changes made on Award entity column ---- v5 Added accounting date parameter SELECT * FROM ( WITH SPONSOR AS ( SELECT HZP.PARTY_NAME ,HZP.PARTY_NUMBER ,GSB.SPONSOR_ID FROM HZ_PARTIES HZP ,GMS_SPONSORS_B GSB WHERE HZP.PARTY_ID = GSB.PARTY_ID ) -- ,AWARD_ENTITY AS ( -- SELECT pccb.CLASS_CODE -- ,ppc.PROJECT_ID -- FROM PJF_PROJECT_CLASSES ppc -- ,PJF_CLASS_CATEGORIES_VL pcca -- ,PJF_CLASS_CODES_VL pccb -- WHERE ppc.CLASS_CATEGORY_ID = pcca.CLASS_CATEGORY_ID -- AND pcca.CLASS_CATEGORY_ID = pccb.CLASS_CATEGORY_ID -- AND ppc.CLASS_CODE_ID = pccb.CLASS_CODE_ID -- AND pcca.CLASS_CATEGORY = 'Awarded Entity' -- -- AND pccb.CLASS_CODE= NVL(:P_AWARDED_ENTITY, pccb.class_code) -- ) ,Dept AS ( SELECT PPC.PROJECT_ID ,PCCT.CLASS_CODE FROM PJF_PROJECT_CLASSES PPC ,PJF_CLASS_CODES_B PCCB ,PJF_CLASS_CODES_TL PCCT WHERE 1 = 1 -- AND PPC.PROJECT_ID = 300000047079834 -- AND PPC.PROJECT_ID = PPAB.PROJECT_ID AND PPC.CLASS_CODE_ID = PCCB.CLASS_CODE_ID AND PPC.CLASS_CATEGORY_ID = ( SELECT CLASS_CATEGORY_ID FROM PJF_CLASS_CATEGORIES_TL WHERE CLASS_CATEGORY = 'Departments' ) AND PCCB.CLASS_CODE_ID = PCCT.CLASS_CODE_ID -- AND PCCT.CLASS_CODE = NVL(:P_DEPT,PCCT.CLASS_CODE) ) ,CC_HRY_COST AS ( SELECT SYS_CONNECT_BY_PATH(ftn.pk1_start_value, '|') || '|' hrcy ,ftvv.tree_version_name FROM fnd_tree_node ftn ,fnd_tree_version_vl ftvv WHERE 1 = 1 -- FTN AND ftn.tree_code = 'Cost Center CCHS Enterprise' AND ftvv.tree_structure_code = ftn.tree_structure_code -- FTVV AND ftvv.tree_code = ftn.tree_code AND ftvv.tree_version_id = ftn.tree_version_id -- AND ftvv.tree_version_name = 'Cost Center CCHS Enterprise Base' AND TRUNC(SYSDATE) BETWEEN TRUNC(ftvv.effective_start_date) AND TRUNC(ftvv.effective_end_date) START WITH ftn.parent_pk1_value IS NULL CONNECT BY NOCYCLE PRIOR ftn.tree_node_id = ftn.parent_tree_node_id ) ,CC_HRY_COST_EN AS ( SELECT RTRIM(SUBSTR(chs.hrcy, INSTR(chs.hrcy, '|', - 1, 2) + 1), '|') child , -- ( -- SUBSTR(chs.hrcy, INSTR(chs.hrcy, '|', 1, 3) +1, INSTR(chs.hrcy, '|', 1, 3) - INSTR(chs.hrcy, '|', 1, 2) -1) -- ) parent3, -- Institute DECODE(SUBSTR(chs.hrcy, INSTR(chs.hrcy, '|', - 1, 4) + 1, INSTR(chs.hrcy, '|', - 1, 1) - INSTR(chs.hrcy, '|', - 1, 2) - 1), RTRIM(SUBSTR(chs.hrcy, INSTR(chs.hrcy, '|', - 1, 2) + 1), '|'), NULL, ( CASE WHEN INSTR(chs.hrcy, '|', - 1, 4) = 0 THEN NULL ELSE SUBSTR(chs.hrcy, INSTR(chs.hrcy, '|', - 1, 4) + 1, INSTR(chs.hrcy, '|', - 1, 1) - INSTR(chs.hrcy, '|', - 1, 2) - 1) END )) parent2 -- Department FROM CC_HRY_COST chs ) ,Grants AS ( SELECT PJB.SEGMENT1 PROJECT_NUMBER ,PJB.NAME PROJECT_NAME ,PJB.PROJECT_ID PROJECT_ID ,PJB.CARRYING_OUT_ORGANIZATION_ID Org_id ,HOU.NAME ORG_NAME ,FAB.BU_NAME ,FAB.BU_ID FROM PJF_PROJECTS_ALL_VL PJB ,HR_ORGANIZATION_UNITS HOU ,FUN_ALL_BUSINESS_UNITS_V FAB WHERE 1 = 1 AND PJB.CARRYING_OUT_ORGANIZATION_ID = HOU.ORGANIZATION_ID AND PJB.ORG_ID = FAB.BU_ID AND ( ( ( EXISTS ( SELECT NULL FROM fnd_grants gnt WHERE EXISTS ( SELECT NULL FROM fnd_session_role_sets WHERE session_role_set_key = fnd_global.session_role_set_key AND role_guid = gnt.grantee_key UNION ALL SELECT fnd_global.user_guid AS PATH FROM dual WHERE fnd_global.user_guid = gnt.grantee_key ) AND EXISTS ( SELECT NULL FROM fnd_compiled_menu_functions cmf WHERE cmf.function_id = 300000000015061 AND cmf.menu_id = gnt.menu_id ) AND gnt.object_id = 300000000007517 AND gnt.grant_type = 'ALLOW' AND gnt.instance_type = 'SET' AND gnt.start_date <= SYSDATE AND ( gnt.end_date IS NULL OR gnt.end_date >= sysdate ) AND ( (gnt.CONTEXT_NAME IS NULL) OR ( gnt.context_name IS NOT NULL AND gnt.context_value LIKE fnd_global.get_conn_ds_attribute(gnt.context_name) ) ) AND ( gnt.instance_set_id = 300000000007518 AND PJB.PROJECT_ID IN ( SELECT PROJECT_ID FROM ( SELECT PROJECT_ID ,PROJECT_ROLE_ID ,RESOURCE_SOURCE_ID AS PERSON_ID FROM PJF_PROJECT_PARTIES WHERE PROJECT_ID = PJB.PROJECT_ID AND PROJECT_PARTY_TYPE = 'IN' AND SYSDATE BETWEEN START_DATE_ACTIVE AND NVL(END_DATE_ACTIVE, SYSDATE + 1) AND PROJ_RESOURCE_ID IS NULL UNION ALL SELECT prs.PROJECT_ID ,prs.PROJECT_ROLE_ID ,per.PERSON_ID FROM PJT_PROJECT_RESOURCE prs ,PJT_PRJ_ENTERPRISE_RESOURCE_B per ,( SELECT 'Y' AS opt_in FROM PJF_PROJECT_PARTIES WHERE PROJ_RESOURCE_ID IS NOT NULL AND PROJECT_ID = PJB.PROJECT_ID AND ROWNUM = 1 ) opt_in_check WHERE prs.PROJECT_ID = PJB.PROJECT_ID AND prs.RESOURCE_ID = per.RESOURCE_ID AND TRUNC(SYSDATE) BETWEEN TRUNC(NVL(PRS.START_DATE_ACTIVE, SYSDATE)) AND TRUNC(NVL(PRS.END_DATE_ACTIVE, SYSDATE)) AND PRS.ASSIGNMENT_STATUS_CODE != 'CANCELED' AND opt_in_check.opt_in = 'Y' ) PPP ,( SELECT PROJECT_ROLE_ID ,ROLE_ID FROM PJF_PROJ_ROLE_TYPES_B UNION ALL SELECT 1 PROJECT_ROLE_ID ,b.ROLE_ID FROM PER_ROLES_DN b WHERE b.ROLE_COMMON_NAME = 'ORA_PJF_PROJECT_MANAGEMENT_DUTY_ABSTRACT' ) PRT ,PER_ROLES_DN PRD ,FND_SESSION_ROLES SROLE WHERE PPP.PROJECT_ID = PJB.PROJECT_ID AND PPP.PROJECT_ROLE_ID = PRT.PROJECT_ROLE_ID AND PRT.ROLE_ID = PRD.ROLE_ID AND SROLE.SESSION_ID = fnd_global.session_id AND SROLE.ROLE_NAME = PRD.ROLE_COMMON_NAME AND SROLE.ROLE_GUID = GNT.GRANTEE_KEY AND hrc_session_util.get_user_personid = PPP.PERSON_ID ) ) ) OR EXISTS ( SELECT NULL FROM fnd_grants gnt WHERE EXISTS ( SELECT NULL FROM fnd_session_role_sets WHERE session_role_set_key = fnd_global.session_role_set_key AND role_guid = gnt.grantee_key UNION ALL SELECT fnd_global.user_guid AS PATH FROM dual WHERE fnd_global.user_guid = gnt.grantee_key ) AND EXISTS ( SELECT NULL FROM fnd_compiled_menu_functions cmf WHERE cmf.function_id = 300000000015061 AND cmf.menu_id = gnt.menu_id ) AND gnt.object_id = 300000000007517 AND gnt.grant_type = 'ALLOW' AND gnt.instance_type = 'SET' AND gnt.start_date <= SYSDATE AND ( gnt.end_date IS NULL OR gnt.end_date >= sysdate ) AND ( (gnt.CONTEXT_NAME IS NULL) OR ( gnt.context_name IS NOT NULL AND gnt.context_value LIKE fnd_global.get_conn_ds_attribute(gnt.context_name) ) ) AND ( gnt.instance_set_id = 300000000007524 AND PJB.ORG_ID IN ( SELECT ORG_ID FROM FUN_USER_ROLE_DATA_ASGNMNTS WHERE USER_GUID = FND_GLOBAL.USER_GUID AND NVL(ACTIVE_FLAG, 'N') != 'N' AND ROLE_NAME = GNT.ROLE_NAME ) ) ) OR EXISTS ( SELECT NULL FROM fnd_grants gnt WHERE EXISTS ( SELECT NULL FROM fnd_session_role_sets WHERE session_role_set_key = fnd_global.session_role_set_key AND role_guid = gnt.grantee_key UNION ALL SELECT fnd_global.user_guid AS PATH FROM dual WHERE fnd_global.user_guid = gnt.grantee_key ) AND EXISTS ( SELECT NULL FROM fnd_compiled_menu_functions cmf WHERE cmf.function_id = 300000000015061 AND cmf.menu_id = gnt.menu_id ) AND gnt.object_id = 300000000007517 AND gnt.grant_type = 'ALLOW' AND gnt.instance_type = 'SET' AND gnt.start_date <= SYSDATE AND ( gnt.end_date IS NULL OR gnt.end_date >= sysdate ) AND ( (gnt.CONTEXT_NAME IS NULL) OR ( gnt.context_name IS NOT NULL AND gnt.context_value LIKE fnd_global.get_conn_ds_attribute(gnt.context_name) ) ) AND ( gnt.instance_set_id = 300000001190003 AND PJB.PROJECT_ID IN ( SELECT project_id FROM pjf_projects_all_B projpeo ,fun_user_role_data_asgnmnts a WHERE projpeo.org_id = a.org_id AND user_guid = fnd_global.user_guid AND NVL(active_flag, 'N') != 'N' AND a.role_name = GNT.role_name AND projpeo.PROJECT_ID = PJB.PROJECT_ID UNION ALL SELECT project_id FROM pjf_projects_all_B projpeo ,fun_user_role_data_asgnmnts a WHERE projpeo.CARRYING_OUT_ORGANIZATION_ID = a.PRJ_ORGANIZATION_ID AND user_guid = fnd_global.user_guid AND NVL(active_flag, 'N') != 'N' AND a.role_name = GNT.role_name AND projpeo.PROJECT_ID = PJB.PROJECT_ID UNION ALL SELECT PPP.PROJECT_ID FROM PJF_PROJECT_PARTIES PPP ,( SELECT PROJECT_ROLE_ID ,ROLE_ID FROM PJF_PROJ_ROLE_TYPES_B UNION ALL SELECT 1 PROJECT_ROLE_ID ,b.ROLE_ID FROM PER_ROLES_DN b WHERE b.ROLE_COMMON_NAME = 'ORA_PJF_PROJECT_MANAGEMENT_DUTY_ABSTRACT' ) PRT ,PER_ROLES_DN PRD ,FND_SESSION_ROLES SROLE WHERE PPP.PROJECT_ID = PJB.PROJECT_ID AND PPP.PROJECT_ROLE_ID = PRT.PROJECT_ROLE_ID AND PRT.ROLE_ID = PRD.ROLE_ID AND SYSDATE BETWEEN PPP.START_DATE_ACTIVE AND NVL(PPP.END_DATE_ACTIVE, SYSDATE + 1) AND SROLE.SESSION_ID = fnd_global.session_id AND SROLE.ROLE_NAME = PRD.ROLE_COMMON_NAME AND SROLE.ROLE_GUID = GNT.GRANTEE_KEY AND hrc_session_util.get_user_personid = PPP.RESOURCE_SOURCE_ID AND PPP.PROJECT_PARTY_TYPE = 'IN' ) ) ) OR EXISTS ( SELECT NULL FROM fnd_grants gnt WHERE EXISTS ( SELECT NULL FROM fnd_session_role_sets WHERE session_role_set_key = fnd_global.session_role_set_key AND role_guid = gnt.grantee_key UNION ALL SELECT fnd_global.user_guid AS path FROM dual WHERE fnd_global.user_guid = gnt.grantee_key ) AND EXISTS ( SELECT NULL FROM fnd_compiled_menu_functions cmf WHERE cmf.function_id = 300000000015061 AND cmf.menu_id = gnt.menu_id ) AND gnt.object_id = 300000000007517 AND gnt.grant_type = 'ALLOW' AND gnt.instance_type = 'SET' AND gnt.start_date <= SYSDATE AND ( gnt.end_date IS NULL OR gnt.end_date >= sysdate ) AND ( (gnt.CONTEXT_NAME IS NULL) OR ( gnt.context_name IS NOT NULL AND gnt.context_value LIKE fnd_global.get_conn_ds_attribute(gnt.context_name) ) ) AND ( gnt.instance_set_id = 300000001581029 AND PJB.carrying_out_organization_id IN ( SELECT orgd.child_organization_id FROM fun_user_role_data_asgnmnts furd ,pjf_org_hierarchy_denorm orgd WHERE furd.user_guid = fnd_global.user_guid AND FURD.ROLE_NAME = GNT.ROLE_NAME AND NVL(furd.active_flag, 'N') != 'N' AND furd.DATASEC_CONTEXT_TYPE_CODE = 'ORA_PRJ_AWARD_ORG_HIER_ID' AND furd.DATASEC_CONTEXT_VALUE1 = orgd.tree_structure_code AND furd.DATASEC_CONTEXT_VALUE2 = orgd.tree_version_id AND furd.DATASEC_CONTEXT_VALUE3 = orgd.parent_organization_id AND furd.DATASEC_CONTEXT_VALUE4 = orgd.tree_code ) ) ) ) ) OR ((1 = 2)) ) ) SELECT P.SEGMENT1 PROJ_NUMB ,P.DESCRIPTION PROJ_DESC ,ORG.NAME ACC_UNIT ,P.PROJECT_STATUS_CODE PROJ_STATUS ,TO_CHAR(P.START_DATE, 'MM/DD/YYYY') PROJ_START_DATE ,TO_CHAR(P.COMPLETION_DATE, 'MM/DD/YYYY') PROJ_END_DATE ,GAHIV.CONTRACT_NUMBER AWARD_NUMBER ,GAHIV.SPONSOR_AWARD_NUMBER DIR_SPR_AWD_NUMB ,PPN.FULL_NAME PRIN_INV ,SPN.PARTY_NAME DIRECT_SPONSOR ,GAHIV.AWARD_TYPE AWARD_TYPE ,TO_CHAR(GAHIV.START_DATE, 'MM/DD/YYYY') || '-' || TO_CHAR(GAHIV.END_DATE, 'MM/DD/YYYY') FUNDING_PERIOD ,PEIA.EXPENDITURE_ITEM_ID TXN_NUMBER ,( SELECT pet.EXPENDITURE_TYPE_NAME FROM PJF_EXP_TYPES_TL pet WHERE pet.expenditure_type_id = peia.expenditure_type_id ) EXP_TYPE ,( SELECT decode(PECT.EXPENDITURE_CATEGORY_NAME, 'Personnel', '01', 'Fringe Benefits', '02', 'Animal Care Costs', '03', 'Contracted Services', '04', 'CT Clinical Trials Margin', '05', 'Equipment SP', '06', 'Facility & Administrative Cost', '07', 'Fellowships', '08', 'Inter Institutional CWRU', '09', 'Patient Care', '10', 'Patient Recruitment Expense', '11', 'Research Deficit Cost Share', '12', 'Scholarships', '13', 'Site Payments', '14', 'Space Rental', '15', 'Stipends', '16', 'Subcontracts', '17', 'Supplies', '18', 'Travel', '19', 'Tuition', '20', 'Other Expenses', '21', 'Artwork', '22', 'Construction', '23', 'Equipment', '24', 'Expense', '25', 'ITD', '26', 'Routine Capital', '27', 'Security', '28', 'Not a Category') ORDER_CODE FROM PJF_EXP_CATEGORIES_TL PECT ,PJF_EXP_TYPES_B PETB WHERE PEIA.EXPENDITURE_TYPE_ID = PETB.EXPENDITURE_TYPE_ID AND PETB.EXPENDITURE_CATEGORY_ID = PECT.EXPENDITURE_CATEGORY_ID AND PECT.LANGUAGE = 'US' ) ORDER_CODE ,( SELECT PECT.EXPENDITURE_CATEGORY_NAME FROM PJF_EXP_CATEGORIES_TL PECT ,PJF_EXP_TYPES_B PETB WHERE PEIA.EXPENDITURE_TYPE_ID = PETB.EXPENDITURE_TYPE_ID AND PETB.EXPENDITURE_CATEGORY_ID = PECT.EXPENDITURE_CATEGORY_ID AND PECT.LANGUAGE = 'US' ) EXP_CATEGORY -- ,(select PES.USER_TRANSACTION_SOURCE -- from PJF_TXN_SOURCES_TL PES -- where PES.TRANSACTION_SOURCE_ID = PEIA.TRANSACTION_SOURCE_ID -- AND PES.LANGUAGE = 'US' -- ) ,PSOURCE.USER_TRANSACTION_SOURCE Txn_Source ,PEIA.EXPENDITURE_ITEM_DATE Exp_Item_Date -- ,PEIA.PROJECT_BURDENED_COSTAMOUNT ,NVL(( CASE WHEN aia.PAYMENT_STATUS_FLAG = 'Y' THEN NVL(PEIA.PROJECT_BURDENED_COST, 0) ELSE NULL END ), 0) AMOUNT ,NVL(( CASE WHEN aia.PAYMENT_STATUS_FLAG = 'N' THEN NVL(PEIA.PROJECT_BURDENED_COST, 0) ELSE NULL END ), 0) UNPOSTED_TXN ,AIA.INVOICE_NUM INVOICE_NUMBER ,PHA.SEGMENT1 PO_NUMBER ,TO_CHAR(PHA.CREATION_DATE, 'MM/DD/YYYY') PO_DATE -- ,PHA.CREATION_DATEPO_DATE ,P.ATTRIBUTE6 Entity ,P.ATTRIBUTE8 Site -- ,AE.class_code Awarded_Entity ,GAHIV.ATTRIBUTE1 Awarded_Entity ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE12 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE12 END ) PROG_CODE ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE_NUMBER2 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE2_NUMBER END ) FAC_RATE ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE19 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE19 END ) IRB ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE20 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE20 END ) IACUC ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE7 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE7 END ) GPID ,ACA.CHECK_NUMBER CHECK_NUMBER ,GAP.ATTRIBUTE13 SA_NUMBER ,PSV.VENDOR_NAME SUPLLIER_NAME ,PSV.segment1 SUPPLIER_NUMBER ,TO_CHAR(PLA.LINE_NUM) PO_LINE_NUM ,TO_CHAR(PRD.PA_DATE, 'MM/DD/YYYY') Accounting_Date ,( CASE WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Oracle Fusion Payables' ,'Oracle Fusion Purchasing' ) THEN PLA.ITEM_DESCRIPTION WHEN PSOURCE.USER_TRANSACTION_SOURCE = 'Oracle Fusion Projects' THEN ( SELECT PBATCH.USER_BATCH_NAME FROM PJC_EXP_GROUPS_ALL PBATCH WHERE PBATCH.EXP_GROUP_ID = PEIA.EXP_GROUP_ID ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Cost Transfers' ,'Wells Fargo' ,'Lawson' ,'SPA Only' ,'EPIC' ) THEN PEIA.ORIG_TRANSACTION_REFERENCE WHEN PSOURCE.USER_TRANSACTION_SOURCE = 'iLab' THEN ( SELECT PEC.EXPENDITURE_COMMENT FROM PJC_EXP_COMMENTS PEC WHERE PEIA.EXPENDITURE_ITEM_ID = PEC.EXPENDITURE_ITEM_ID ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Workday Payroll' ,'Concur' ) THEN ( SELECT PPNF.FULL_NAME FROM PER_PERSON_NAMES_F PPNF WHERE 1 = 1 AND PEIA.INCURRED_BY_PERSON_ID = PPNF.PERSON_ID AND PPNF.NAME_TYPE = 'US' ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ('eSirius') THEN ( SELECT PEC.EXPENDITURE_COMMENT FROM PJC_EXP_COMMENTS PEC WHERE PEIA.EXPENDITURE_ITEM_ID = PEC.EXPENDITURE_ITEM_ID ) END ) Description ,( CASE WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Oracle Fusion Projects' ,'Wells Fargo' ) THEN ( SELECT PBATCH.USER_BATCH_NAME FROM PJC_EXP_GROUPS_ALL PBATCH WHERE PBATCH.EXP_GROUP_ID = PEIA.EXP_GROUP_ID ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Oracle Fusion Payables' ,'Oracle Fusion Purchasing' ,'Workday Payroll' ,'Concur' ,'eSirius' ,'EPIC' ) THEN PEIA.ORIG_TRANSACTION_REFERENCE WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Cost Transfers' ,'SPA Only' ,'iLab' ) THEN ( SELECT PEC.EXPENDITURE_COMMENT FROM PJC_EXP_COMMENTS PEC WHERE PEIA.EXPENDITURE_ITEM_ID = PEC.EXPENDITURE_ITEM_ID ) END ) REFERENCE ,PPNF.LAST_NAME || ',' || PPNF.FIRST_NAME REQUESTER ,P.PROJECT_CURRENCY_CODE PROJECT_CURRENCY_CODE --,PRD.REVENUE_CURR_AMT REVENUE --,PRD.REVENUE_CURRENCY_CODE REVENUE_CURRENCY_CODE FROM PJF_PROJECTS_ALL_VL P ,HR_ALL_ORGANIZATION_UNITS_F_VL ORG ,GMS_AWARD_PROJECTS GAP ,GMS_AWARD_HEADERS_INFO_V GAHIV ,PER_PERSON_NAMES_F PPN -- ,GMS_AWARD_HEADERS_B GAHB ,SPONSOR SPN ,PJC_EXP_ITEMS_ALL PEIA ,AP_INVOICES_ALL AIA ,AP_INVOICE_LINES_ALL AILA ,AP_INVOICE_DISTRIBUTIONS_ALL ADA ,PO_DISTRIBUTIONS_ALL PDA ,PO_LINES_ALL PLA ,PO_HEADERS_ALL PHA -- ,AWARD_ENTITY AE ,FUN_ALL_BUSINESS_UNITS_V FAB ,PJC_TXN_XFACE_ALL INTERF ,PJF_PROJECT_TYPES_TL PTYPE ,DEPT Dept ,HR_ALL_ORGANIZATION_UNITS_TL HAOUT ,CC_HRY_COST_EN COSTCENTRE_PARENTS ,AP_INVOICE_PAYMENTS_ALL AIPA ,AP_CHECKS_ALL ACA ,POZ_SUPPLIERS_V PSV ,PJF_TXN_SOURCES_TL PSOURCE --,PJC_COST_DIST_LINES_ALL PCDLA ,POR_REQUISITION_HEADERS_ALL PRHA ,POR_REQUISITION_LINES_ALL PRLA ,POR_REQ_DISTRIBUTIONS_ALL PRDA ,PER_PERSON_NAMES_F PPNF ,Grants Grants ,PJB_REV_DISTRIBUTIONS PRD WHERE 1 = 1 -- ANDP.SEGMENT1 IN ('C0015312BD') -- and peia.PROJECT_ID IN ('300000083447541','300000083733849') -- and PEIA.EXPENDITURE_ITEM_ID IN ('1138167','1121471') -- and PEIA.EXPENDITURE_ITEM_ID IN ('683785') AND ORG.ORGANIZATION_ID = P.CARRYING_OUT_ORGANIZATION_ID AND SYSDATE BETWEEN ORG.EFFECTIVE_START_DATE AND ORG.EFFECTIVE_END_DATE AND P.PROJECT_ID = GAP.PROJECT_ID(+) AND GAP.AWARD_ID = GAHIV.ID(+) AND GAHIV.SPONSOR_ID = SPN.SPONSOR_ID(+) AND PEIA.PROJECT_ID = P.PROJECT_ID -- AND AIA.INVOICE_ID(+) = PEIA.ORIGINAL_HEADER_ID AND PEIA.PROJECT_BURDENED_COST != 0 AND AIA.INVOICE_ID(+) = PEIA.ORIGINAL_HEADER_ID AND AIA.INVOICE_ID = AILA.INVOICE_ID(+) AND PEIA.ORIGINAL_LINE_NUMBER = AILA.LINE_NUMBER(+) AND AIA.INVOICE_ID = ADA.INVOICE_ID(+) AND ADA.INVOICE_LINE_NUMBER(+) = AILA.LINE_NUMBER AND ADA.INVOICE_DISTRIBUTION_ID(+) = PEIA.ORIGINAL_DIST_ID AND ADA.PO_DISTRIBUTION_ID = PDA.PO_DISTRIBUTION_ID(+) AND PDA.PO_LINE_ID = PLA.PO_LINE_ID(+) AND PDA.PO_HEADER_ID = PLA.PO_HEADER_ID(+) AND PLA.PO_HEADER_ID = PHA.PO_HEADER_ID(+) AND PHA.PO_HEADER_ID(+) = AIA.PO_HEADER_ID -- AND P.PROJECT_ID = AE.PROJECT_ID(+) AND FAB.BU_ID(+) = P.ORG_ID AND P.PROJECT_ID = INTERF.PROJECT_ID(+) AND PEIA.EXPENDITURE_ITEM_ID = INTERF.EXPENDITURE_ITEM_ID(+) AND PTYPE.PROJECT_TYPE_ID(+) = P.PROJECT_TYPE_ID AND DEPT.PROJECT_ID(+) = P.PROJECT_ID AND AIPA.INVOICE_ID(+) = AIA.INVOICE_ID AND AIPA.CHECK_ID = ACA.CHECK_ID(+) AND P.CARRYING_OUT_ORGANIZATION_ID = HAOUT.ORGANIZATION_ID AND HAOUT.NAME = COSTCENTRE_PARENTS.CHILD AND PPN.PERSON_ID(+) = GAHIV.ACTIVE_PI_ID AND PPN.NAME_TYPE(+) = 'GLOBAL' AND PSV.VENDOR_ID(+) = PEIA.VENDOR_ID AND PSOURCE.TRANSACTION_SOURCE_ID(+) = PEIA.TRANSACTION_SOURCE_ID AND PSOURCE.LANGUAGE = 'US' AND PDA.REQ_DISTRIBUTION_ID = PRDA.DISTRIBUTION_ID(+) AND PRDA.REQUISITION_LINE_ID = PRLA.REQUISITION_LINE_ID(+) AND PRLA.REQUISITION_HEADER_ID = PRHA.REQUISITION_HEADER_ID(+) AND PPNF.PERSON_ID(+) = PRHA.PREPARER_ID --AND PCDLA.EXPENDITURE_ITEM_ID(+) = PEIA.EXPENDITURE_ITEM_ID AND EXISTS ( SELECT 1 FROM pjf_txn_sources_tl ptxntl WHERE peiA.TRANSACTION_SOURCE_ID = ptxntl.TRANSACTION_SOURCE_ID AND ptxntl.USER_TRANSACTION_SOURCE IN ('Oracle Fusion Payables') ) AND grants.project_id = p.project_id AND grants.org_id = P.CARRYING_OUT_ORGANIZATION_ID AND ( (coalesce(:P_Entity, NULL) IS NULL) OR (P.ATTRIBUTE6 IN (:P_Entity)) ) AND ( (coalesce(:P_PRGRM_TYPE, NULL) IS NULL) OR (GAP.ATTRIBUTE18 IN (:P_PRGRM_TYPE)) ) AND ( (coalesce(:P_DEPT, NULL) IS NULL) OR (dept.CLASS_CODE IN (:P_DEPT)) ) AND ( (coalesce(:P_AWARD_TYPE, NULL) IS NULL) OR (GAHIV.AWARD_TYPE IN (:P_AWARD_TYPE)) ) AND PTYPE.PROJECT_TYPE(+) = :P_PRJ_TYPE AND P.PROJECT_STATUS_CODE = NVL(:P_PRJ_STATUS, P.PROJECT_STATUS_CODE) AND ( (coalesce(:PI_NAME, NULL) IS NULL) OR (PPN.FULL_NAME IN (:PI_NAME)) ) AND P.SEGMENT1 = NVL(:P_PROJ_NUM, P.SEGMENT1) AND ( (coalesce(:p_exp_cat, NULL) IS NULL) OR ( peia.expenditure_type_id IN ( SELECT PETB.EXPENDITURE_TYPE_ID FROM PJF_EXP_CATEGORIES_TL PECT ,PJF_EXP_TYPES_B PETB WHERE PETB.EXPENDITURE_CATEGORY_ID = PECT.EXPENDITURE_CATEGORY_ID AND PECT.LANGUAGE = 'US' AND PECT.EXPENDITURE_CATEGORY_NAME = :P_Exp_Cat ) ) ) AND ( (coalesce(:P_INSTITUTE, NULL) IS NULL) OR (COSTCENTRE_PARENTS.PARENT2 IN (:P_INSTITUTE)) ) AND ( (coalesce(:P_AWARD_NUM, NULL) IS NULL) OR (GAHIV.CONTRACT_NUMBER IN (:P_AWARD_NUM)) ) AND ( (coalesce(:P_TXN_SOURCE, NULL) IS NULL) OR (PSOURCE.USER_TRANSACTION_SOURCE IN (:P_TXN_SOURCE)) ) -- and COSTCENTRE_PARENTS.PARENT2 = NVL(:P_INSTITUTE , COSTCENTRE_PARENTS.PARENT2) -- AND GAHIV.CONTRACT_NUMBER = NVL(:P_AWARD_NUM , GAHIV.CONTRACT_NUMBER) AND ( TO_CHAR(PEIA.PRVDR_ACCRUAL_DATE, 'YYYY-MM-DD') BETWEEN TO_CHAR(TO_DATE(:P_FROM_FISCAL_PERIOD, 'MON-YY', 'NLS_DATE_LANGUAGE=AMERICAN'), 'YYYY-MM-DD') AND TO_CHAR(LAST_DAY(TO_DATE(:P_TO_FISCAL_PERIOD, 'MON-YY', 'NLS_DATE_LANGUAGE=AMERICAN')), 'YYYY-MM-DD') ) AND TO_CHAR(PRD.PA_DATE, 'YYYY-MM-DD') BETWEEN NVL(TO_CHAR(:P_From_Acc_Date, 'YYYY-MM-DD'),PRD.PA_DATE) and NVL(TO_CHAR(:P_To_Acc_Date, 'YYYY-MM-DD'), PRD.PA_DATE) AND PRD.TRANSACTION_ID(+) = PEIA.EXPENDITURE_ITEM_ID AND PRD.LINKED_PROJECT_ID(+) = PEIA.PROJECT_ID UNION ALL SELECT P.SEGMENT1 PROJ_NUMB ,P.DESCRIPTION PROJ_DESC ,ORG.NAME ACC_UNIT ,P.PROJECT_STATUS_CODE PROJ_STATUS ,TO_CHAR(P.START_DATE, 'MM/DD/YYYY') PROJ_START_DATE ,TO_CHAR(P.COMPLETION_DATE, 'MM/DD/YYYY') PROJ_END_DATE ,GAHIV.CONTRACT_NUMBER AWARD_NUMBER ,GAHIV.SPONSOR_AWARD_NUMBER DIR_SPR_AWD_NUMB ,PPN.FULL_NAME PRIN_INV ,SPN.PARTY_NAME DIRECT_SPONSOR ,GAHIV.AWARD_TYPE AWARD_TYPE ,TO_CHAR(GAHIV.START_DATE, 'MM/DD/YYYY') || '-' || TO_CHAR(GAHIV.END_DATE, 'MM/DD/YYYY') FUNDING_PERIOD ,(PRD.TRANSACTION_ID) TXN_NUMBER ,( SELECT pet.EXPENDITURE_TYPE_NAME FROM PJF_EXP_TYPES_TL pet WHERE pet.expenditure_type_id = peia.expenditure_type_id ) EXP_TYPE ,'00' ORDER_CODE ,'Revenue' EXP_CATEGORY ,PSOURCE.USER_TRANSACTION_SOURCE Txn_Source ,PRD.TRANSACTION_DATE Exp_Item_Date -- ,PEIA.EXPENDITURE_ITEM_DATEPOSTING_DATE --,NVL(PEIA.PROJECT_BURDENED_COST, 0) AMOUNT ,NVL(PRD.REVENUE_CURR_AMT, 0) AMOUNT ,NVL(INTERF.DENOM_RAW_COST, 0) UNPOSTED_TXN ,AIA.INVOICE_NUM INVOICE_NUMBER ,PHA.SEGMENT1 PO_NUMBER ,TO_CHAR(PHA.CREATION_DATE, 'MM/DD/YYYY') PO_DATE -- ,PHA.CREATION_DATEPO_DATE ,P.ATTRIBUTE6 Entity ,P.ATTRIBUTE8 Site -- ,AE.class_code Awarded_Entity ,GAHIV.ATTRIBUTE1 Awarded_Entity ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE12 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE12 END ) PROG_CODE ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE_NUMBER2 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE2_NUMBER END ) FAC_RATE ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE19 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE19 END ) IRB ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE20 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE20 END ) IACUC ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE7 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE7 END ) GPID ,aca.CHECK_NUMBER CHECK_NUMBER ,GAP.ATTRIBUTE13 SA_NUMBER ,PSV.VENDOR_NAME SUPLLIER_NAME ,PSV.segment1 SUPPLIER_NUMBER ,'' PO_LINE_NUM ,TO_CHAR(PRD.PA_DATE, 'MM/DD/YYYY') Accounting_Date ,( CASE WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Oracle Fusion Payables' ,'Oracle Fusion Purchasing' ) THEN AIA.DESCRIPTION WHEN PSOURCE.USER_TRANSACTION_SOURCE = 'Oracle Fusion Projects' THEN ( SELECT PBATCH.USER_BATCH_NAME FROM PJC_EXP_GROUPS_ALL PBATCH WHERE PBATCH.EXP_GROUP_ID = PEIA.EXP_GROUP_ID ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Cost Transfers' ,'Wells Fargo' ,'Lawson' ,'SPA Only' ,'EPIC' ) THEN PEIA.ORIG_TRANSACTION_REFERENCE WHEN PSOURCE.USER_TRANSACTION_SOURCE = 'iLab' THEN ( SELECT PEC.EXPENDITURE_COMMENT FROM PJC_EXP_COMMENTS PEC WHERE PEIA.EXPENDITURE_ITEM_ID = PEC.EXPENDITURE_ITEM_ID ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Workday Payroll' ,'Concur' ) THEN ( SELECT PPNF.FULL_NAME FROM PER_PERSON_NAMES_F PPNF WHERE 1 = 1 AND PEIA.INCURRED_BY_PERSON_ID = PPNF.PERSON_ID AND PPNF.NAME_TYPE = 'US' ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ('eSirius') THEN ( SELECT PEC.EXPENDITURE_COMMENT FROM PJC_EXP_COMMENTS PEC WHERE PEIA.EXPENDITURE_ITEM_ID = PEC.EXPENDITURE_ITEM_ID ) END ) Description ,( CASE WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Oracle Fusion Projects' ,'Wells Fargo' ) THEN ( SELECT PBATCH.USER_BATCH_NAME FROM PJC_EXP_GROUPS_ALL PBATCH WHERE PBATCH.EXP_GROUP_ID = PEIA.EXP_GROUP_ID ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Oracle Fusion Payables' ,'Oracle Fusion Purchasing' ,'Workday Payroll' ,'Concur' ,'eSirius' ,'EPIC' ) THEN PEIA.ORIG_TRANSACTION_REFERENCE WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Cost Transfers' ,'SPA Only' ,'iLab' ) THEN ( SELECT PEC.EXPENDITURE_COMMENT FROM PJC_EXP_COMMENTS PEC WHERE PEIA.EXPENDITURE_ITEM_ID = PEC.EXPENDITURE_ITEM_ID ) END ) REFERENCE ,NULL REQUESTER ,P.PROJECT_CURRENCY_CODE PROJECT_CURRENCY_CODE --,PRD.REVENUE_CURR_AMT REVENUE --,PRD.REVENUE_CURRENCY_CODE REVENUE_CURRENCY_CODE FROM PJF_PROJECTS_ALL_VL P ,HR_ALL_ORGANIZATION_UNITS_F_VL ORG -- ,GMS_AWARD_HEADERS_B GAHB ,SPONSOR SPN ,PJC_EXP_ITEMS_ALL PEIA ,AP_INVOICES_ALL AIA ,PO_HEADERS_ALL PHA -- ,AWARD_ENTITY AE ,FUN_ALL_BUSINESS_UNITS_V FAB ,PJC_TXN_XFACE_ALL INTERF ,PJF_PROJECT_TYPES_TL PTYPE ,DEPT Dept ,HR_ALL_ORGANIZATION_UNITS_TL HAOUT ,CC_HRY_COST_EN COSTCENTRE_PARENTS ,AP_INVOICE_PAYMENTS_ALL AIPA ,AP_CHECKS_ALL ACA ,POZ_SUPPLIERS_V PSV ,PJF_TXN_SOURCES_TL PSOURCE --,PJC_COST_DIST_LINES_ALL PCDLA ,Grants Grants ,GMS_AWARD_PROJECTS GAP ,GMS_AWARD_HEADERS_INFO_V GAHIV ,PER_PERSON_NAMES_F PPN ,PJB_REV_DISTRIBUTIONS PRD WHERE 1 = 1 AND PRD.TRANSACTION_ID IS NOT NULL AND PEIA.PROJECT_ID(+) = PRD.LINKED_PROJECT_ID AND PEIA.EXPENDITURE_TYPE_ID(+) = PRD.TRANSACTION_TYPE_ID AND PEIA.TXN_ACCUM_HEADER_ID(+) = PRD.TXN_ACCUM_HEADER_ID AND PEIA.EXPENDITURE_ITEM_ID(+) = PRD.TRANSACTION_ID AND PSOURCE.TRANSACTION_SOURCE_ID(+) = PEIA.TRANSACTION_SOURCE_ID AND PSOURCE.LANGUAGE = 'US' AND P.PROJECT_ID = INTERF.PROJECT_ID(+) AND PEIA.EXPENDITURE_ITEM_ID = INTERF.EXPENDITURE_ITEM_ID(+) AND AIA.INVOICE_ID(+) = PEIA.ORIGINAL_HEADER_ID AND PHA.PO_HEADER_ID(+) = AIA.PO_HEADER_ID AND AIPA.INVOICE_ID(+) = AIA.INVOICE_ID AND AIPA.CHECK_ID = ACA.CHECK_ID(+) AND PSV.VENDOR_ID(+) = PEIA.VENDOR_ID --AND PRD.TRANSACTION_ID = 1413261 AND GAHIV.ID = PRD.CONTRACT_ID(+) --ANDGAHIV.CONTRACT_NUMBER = '9844' --ANDP.SEGMENT1 = 'SP003614' AND PRD.LINKED_PROJECT_ID(+) = P.PROJECT_ID AND P.PROJECT_ID = GAP.PROJECT_ID(+) AND GAP.AWARD_ID = GAHIV.ID(+) AND ORG.ORGANIZATION_ID = P.CARRYING_OUT_ORGANIZATION_ID AND SYSDATE BETWEEN ORG.EFFECTIVE_START_DATE AND ORG.EFFECTIVE_END_DATE AND GAHIV.SPONSOR_ID = SPN.SPONSOR_ID(+) AND FAB.BU_ID(+) = P.ORG_ID AND PTYPE.PROJECT_TYPE_ID(+) = P.PROJECT_TYPE_ID AND DEPT.PROJECT_ID(+) = P.PROJECT_ID AND P.CARRYING_OUT_ORGANIZATION_ID = HAOUT.ORGANIZATION_ID AND HAOUT.NAME = COSTCENTRE_PARENTS.CHILD AND PPN.PERSON_ID(+) = GAHIV.ACTIVE_PI_ID AND PPN.NAME_TYPE(+) = 'GLOBAL' -- AND P.PROJECT_ID = AE.PROJECT_ID(+) AND grants.project_id = p.project_id AND grants.org_id = P.CARRYING_OUT_ORGANIZATION_ID AND ( (coalesce(:P_Entity, NULL) IS NULL) OR (P.ATTRIBUTE6 IN (:P_Entity)) ) AND ( (coalesce(:P_PRGRM_TYPE, NULL) IS NULL) OR (GAP.ATTRIBUTE18 IN (:P_PRGRM_TYPE)) ) AND ( (coalesce(:P_DEPT, NULL) IS NULL) OR (dept.CLASS_CODE IN (:P_DEPT)) ) AND ( (coalesce(:P_AWARD_TYPE, NULL) IS NULL) OR (GAHIV.AWARD_TYPE IN (:P_AWARD_TYPE)) ) AND PTYPE.PROJECT_TYPE = NVL(:P_PRJ_TYPE, PTYPE.PROJECT_TYPE) AND P.PROJECT_STATUS_CODE = NVL(:P_PRJ_STATUS, P.PROJECT_STATUS_CODE) AND ( (coalesce(:PI_NAME, NULL) IS NULL) OR (PPN.FULL_NAME IN (:PI_NAME)) ) AND ( (coalesce(:P_INSTITUTE, NULL) IS NULL) OR (COSTCENTRE_PARENTS.PARENT2 IN (:P_INSTITUTE)) ) AND ( (coalesce(:P_AWARD_NUM, NULL) IS NULL) OR (GAHIV.CONTRACT_NUMBER IN (:P_AWARD_NUM)) ) AND P.SEGMENT1 = NVL(:P_PROJ_NUM, P.SEGMENT1) AND ( TO_CHAR(PRD.PA_DATE, 'YYYY-MM-DD') BETWEEN TO_CHAR(TO_DATE(:P_FROM_FISCAL_PERIOD, 'MON-YY', 'NLS_DATE_LANGUAGE=AMERICAN'), 'YYYY-MM-DD') AND TO_CHAR(LAST_DAY(TO_DATE(:P_TO_FISCAL_PERIOD, 'MON-YY', 'NLS_DATE_LANGUAGE=AMERICAN')), 'YYYY-MM-DD') ) AND TO_CHAR(PRD.PA_DATE, 'YYYY-MM-DD') BETWEEN NVL(TO_CHAR(:P_From_Acc_Date, 'YYYY-MM-DD'),PRD.PA_DATE) and NVL(TO_CHAR(:P_To_Acc_Date, 'YYYY-MM-DD'), PRD.PA_DATE) UNION SELECT P.SEGMENT1 PROJ_NUMB ,P.DESCRIPTION PROJ_DESC ,ORG.NAME ACC_UNIT ,P.PROJECT_STATUS_CODE PROJ_STATUS ,TO_CHAR(P.START_DATE, 'MM/DD/YYYY') PROJ_START_DATE ,TO_CHAR(P.COMPLETION_DATE, 'MM/DD/YYYY') PROJ_END_DATE ,GAHIV.CONTRACT_NUMBER AWARD_NUMBER ,GAHIV.SPONSOR_AWARD_NUMBER DIR_SPR_AWD_NUMB ,PPN.FULL_NAME PRIN_INV ,SPN.PARTY_NAME DIRECT_SPONSOR ,GAHIV.AWARD_TYPE AWARD_TYPE ,TO_CHAR(GAHIV.START_DATE, 'MM/DD/YYYY') || '-' || TO_CHAR(GAHIV.END_DATE, 'MM/DD/YYYY') FUNDING_PERIOD ,(PRD.EVENT_NUM) TXN_NUMBER ,(NULL) EXP_TYPE ,'00' ORDER_CODE ,'Revenue' EXP_CATEGORY ,NULL Txn_Source ,PRD.TRANSACTION_DATE Exp_Item_Date -- ,PEIA.EXPENDITURE_ITEM_DATEPOSTING_DATE --,NVL(PEIA.PROJECT_BURDENED_COST, 0) AMOUNT ,NVL(PRD.REVENUE_CURR_AMT, 0) AMOUNT ,NULL UNPOSTED_TXN ,NULL INVOICE_NUMBER ,NULL PO_NUMBER ,NULL PO_DATE -- ,PHA.CREATION_DATEPO_DATE ,P.ATTRIBUTE6 Entity ,P.ATTRIBUTE8 Site -- ,AE.class_code Awarded_Entity ,GAHIV.ATTRIBUTE1 Awarded_Entity ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE12 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE12 END ) PROG_CODE ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE_NUMBER2 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE2_NUMBER END ) FAC_RATE ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE19 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE19 END ) IRB ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE20 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE20 END ) IACUC ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE7 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE7 END ) GPID ,NULL CHECK_NUMBER ,GAP.ATTRIBUTE13 SA_NUMBER ,NULL SUPLLIER_NAME ,NULL SUPPLIER_NUMBER ,NULL PO_LINE_NUM ,TO_CHAR(PRD.PA_DATE, 'MM/DD/YYYY') Accounting_Date ,(PBE.EVENT_DESC) Description ,(NULL) REFERENCE ,NULL REQUESTER ,P.PROJECT_CURRENCY_CODE PROJECT_CURRENCY_CODE --,PRD.REVENUE_CURR_AMT REVENUE --,PRD.REVENUE_CURRENCY_CODE REVENUE_CURRENCY_CODE FROM PJF_PROJECTS_ALL_VL P ,HR_ALL_ORGANIZATION_UNITS_F_VL ORG -- ,GMS_AWARD_HEADERS_B GAHB ,SPONSOR SPN --,PJC_EXP_ITEMS_ALL PEIA --,AP_INVOICES_ALL AIA --,PO_HEADERS_ALL PHA -- ,AWARD_ENTITY AE ,FUN_ALL_BUSINESS_UNITS_V FAB --,PJC_TXN_XFACE_ALL INTERF ,PJF_PROJECT_TYPES_TL PTYPE ,DEPT Dept ,HR_ALL_ORGANIZATION_UNITS_TL HAOUT ,CC_HRY_COST_EN COSTCENTRE_PARENTS --,AP_INVOICE_PAYMENTS_ALL AIPA --,AP_CHECKS_ALL ACA --,POZ_SUPPLIERS_V PSV --,PJF_TXN_SOURCES_TL PSOURCE --,PJC_COST_DIST_LINES_ALL PCDLA ,Grants Grants ,GMS_AWARD_PROJECTS GAP ,GMS_AWARD_HEADERS_INFO_V GAHIV ,PER_PERSON_NAMES_F PPN ,PJB_REV_DISTRIBUTIONS PRD ,PJB_BILLING_EVENTS PBE WHERE 1 = 1 AND PRD.EVENT_NUM IS NOT NULL AND PRD.TRANSACTION_ID(+) = PBE.EVENT_ID AND PBE.PROJECT_ID(+) = P.PROJECT_ID AND PBE.CONTRACT_ID = PRD.CONTRACT_ID(+) --ANDPRD.TRANSACTION_ID = 1372021 AND GAHIV.ID = PRD.CONTRACT_ID(+) --ANDGAHIV.CONTRACT_NUMBER = '9844' --ANDP.SEGMENT1 = 'SP003614' AND PRD.LINKED_PROJECT_ID(+) = P.PROJECT_ID AND P.PROJECT_ID = GAP.PROJECT_ID(+) AND GAP.AWARD_ID = GAHIV.ID(+) AND ORG.ORGANIZATION_ID = P.CARRYING_OUT_ORGANIZATION_ID AND SYSDATE BETWEEN ORG.EFFECTIVE_START_DATE AND ORG.EFFECTIVE_END_DATE AND GAHIV.SPONSOR_ID = SPN.SPONSOR_ID(+) AND FAB.BU_ID(+) = P.ORG_ID AND PTYPE.PROJECT_TYPE_ID(+) = P.PROJECT_TYPE_ID AND DEPT.PROJECT_ID(+) = P.PROJECT_ID AND P.CARRYING_OUT_ORGANIZATION_ID = HAOUT.ORGANIZATION_ID AND HAOUT.NAME = COSTCENTRE_PARENTS.CHILD AND PPN.PERSON_ID(+) = GAHIV.ACTIVE_PI_ID AND PPN.NAME_TYPE(+) = 'GLOBAL' -- AND P.PROJECT_ID = AE.PROJECT_ID(+) AND grants.project_id = p.project_id AND grants.org_id = P.CARRYING_OUT_ORGANIZATION_ID AND ( (coalesce(:P_Entity, NULL) IS NULL) OR (P.ATTRIBUTE6 IN (:P_Entity)) ) AND ( (coalesce(:P_PRGRM_TYPE, NULL) IS NULL) OR (GAP.ATTRIBUTE18 IN (:P_PRGRM_TYPE)) ) AND ( (coalesce(:P_DEPT, NULL) IS NULL) OR (dept.CLASS_CODE IN (:P_DEPT)) ) AND ( (coalesce(:P_AWARD_TYPE, NULL) IS NULL) OR (GAHIV.AWARD_TYPE IN (:P_AWARD_TYPE)) ) AND PTYPE.PROJECT_TYPE = NVL(:P_PRJ_TYPE, PTYPE.PROJECT_TYPE) AND P.PROJECT_STATUS_CODE = NVL(:P_PRJ_STATUS, P.PROJECT_STATUS_CODE) AND ( (coalesce(:PI_NAME, NULL) IS NULL) OR (PPN.FULL_NAME IN (:PI_NAME)) ) AND ( (coalesce(:P_INSTITUTE, NULL) IS NULL) OR (COSTCENTRE_PARENTS.PARENT2 IN (:P_INSTITUTE)) ) AND ( (coalesce(:P_AWARD_NUM, NULL) IS NULL) OR (GAHIV.CONTRACT_NUMBER IN (:P_AWARD_NUM)) ) AND P.SEGMENT1 = NVL(:P_PROJ_NUM, P.SEGMENT1) AND ( TO_CHAR(PRD.PA_DATE, 'YYYY-MM-DD') BETWEEN TO_CHAR(TO_DATE(:P_FROM_FISCAL_PERIOD, 'MON-YY', 'NLS_DATE_LANGUAGE=AMERICAN'), 'YYYY-MM-DD') AND TO_CHAR(LAST_DAY(TO_DATE(:P_TO_FISCAL_PERIOD, 'MON-YY', 'NLS_DATE_LANGUAGE=AMERICAN')), 'YYYY-MM-DD') ) AND TO_CHAR(PRD.PA_DATE, 'YYYY-MM-DD') BETWEEN NVL(TO_CHAR(:P_From_Acc_Date, 'YYYY-MM-DD'),PRD.PA_DATE) and NVL(TO_CHAR(:P_To_Acc_Date, 'YYYY-MM-DD'), PRD.PA_DATE) UNION ALL SELECT P.SEGMENT1 PROJ_NUMB ,P.DESCRIPTION PROJ_DESC ,ORG.NAME ACC_UNIT ,P.PROJECT_STATUS_CODE PROJ_STATUS ,TO_CHAR(P.START_DATE, 'MM/DD/YYYY') PROJ_START_DATE ,TO_CHAR(P.COMPLETION_DATE, 'MM/DD/YYYY') PROJ_END_DATE ,GAHIV.CONTRACT_NUMBER AWARD_NUMBER ,GAHIV.SPONSOR_AWARD_NUMBER DIR_SPR_AWD_NUMB ,PPN.FULL_NAME PRIN_INV ,SPN.PARTY_NAME DIRECT_SPONSOR ,GAHIV.AWARD_TYPE AWARD_TYPE ,TO_CHAR(GAHIV.START_DATE, 'MM/DD/YYYY') || '-' || TO_CHAR(GAHIV.END_DATE, 'MM/DD/YYYY') FUNDING_PERIOD ,PEIA.EXPENDITURE_ITEM_ID TXN_NUMBER ,( SELECT pet.EXPENDITURE_TYPE_NAME FROM PJF_EXP_TYPES_TL pet WHERE pet.expenditure_type_id = peia.expenditure_type_id ) EXP_TYPE ,( SELECT decode(PECT.EXPENDITURE_CATEGORY_NAME, 'Personnel', '01', 'Fringe Benefits', '02', 'Animal Care Costs', '03', 'Contracted Services', '04', 'CT Clinical Trials Margin', '05', 'Equipment SP', '06', 'Facility & Administrative Cost', '07', 'Fellowships', '08', 'Inter Institutional CWRU', '09', 'Patient Care', '10', 'Patient Recruitment Expense', '11', 'Research Deficit Cost Share', '12', 'Scholarships', '13', 'Site Payments', '14', 'Space Rental', '15', 'Stipends', '16', 'Subcontracts', '17', 'Supplies', '18', 'Travel', '19', 'Tuition', '20', 'Other Expenses', '21', 'Artwork', '22', 'Construction', '23', 'Equipment', '24', 'Expense', '25', 'ITD', '26', 'Routine Capital', '27', 'Security', '28', 'Not a Category') ORDER_CODE FROM PJF_EXP_CATEGORIES_TL PECT ,PJF_EXP_TYPES_B PETB WHERE PEIA.EXPENDITURE_TYPE_ID = PETB.EXPENDITURE_TYPE_ID AND PETB.EXPENDITURE_CATEGORY_ID = PECT.EXPENDITURE_CATEGORY_ID AND PECT.LANGUAGE = 'US' ) ORDER_CODE ,( SELECT PECT.EXPENDITURE_CATEGORY_NAME FROM PJF_EXP_CATEGORIES_TL PECT ,PJF_EXP_TYPES_B PETB WHERE PEIA.EXPENDITURE_TYPE_ID = PETB.EXPENDITURE_TYPE_ID AND PETB.EXPENDITURE_CATEGORY_ID = PECT.EXPENDITURE_CATEGORY_ID AND PECT.LANGUAGE = 'US' ) EXP_CATEGORY -- -- ,(select PES.USER_TRANSACTION_SOURCE -- -- from PJF_TXN_SOURCES_TL PES -- -- where PES.TRANSACTION_SOURCE_ID = PEIA.TRANSACTION_SOURCE_ID -- -- AND PES.LANGUAGE = 'US' -- -- ) Txn_Source ,PSOURCE.USER_TRANSACTION_SOURCE Txn_Source ,PEIA.EXPENDITURE_ITEM_DATE Exp_Item_Date -- ,PEIA.EXPENDITURE_ITEM_DATEPOSTING_DATE ,NVL(PEIA.PROJECT_BURDENED_COST, 0) AMOUNT ,NVL(INTERF.DENOM_RAW_COST, 0) UNPOSTED_TXN ,AIA.INVOICE_NUM INVOICE_NUMBER ,PHA.SEGMENT1 PO_NUMBER ,TO_CHAR(PHA.CREATION_DATE, 'MM/DD/YYYY') PO_DATE -- ,PHA.CREATION_DATEPO_DATE ,P.ATTRIBUTE6 Entity ,P.ATTRIBUTE8 Site -- ,AE.class_code Awarded_Entity ,GAHIV.ATTRIBUTE1 Awarded_Entity ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE12 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE12 END ) PROG_CODE ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE_NUMBER2 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE2_NUMBER END ) FAC_RATE ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE19 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE19 END ) IRB ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE20 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE20 END ) IACUC ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE7 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE7 END ) GPID ,aca.CHECK_NUMBER CHECK_NUMBER ,GAP.ATTRIBUTE13 SA_NUMBER ,PSV.VENDOR_NAME SUPLLIER_NAME ,PSV.segment1 SUPPLIER_NUMBER ,NULL PO_LINE_NUM ,TO_CHAR(PCDLA.PRVDR_GL_DATE, 'MM/DD/YYYY') Accounting_Date ,( CASE WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Oracle Fusion Payables' ,'Oracle Fusion Purchasing' ) THEN AIA.DESCRIPTION WHEN PSOURCE.USER_TRANSACTION_SOURCE = 'Oracle Fusion Projects' THEN ( SELECT PBATCH.USER_BATCH_NAME FROM PJC_EXP_GROUPS_ALL PBATCH WHERE PBATCH.EXP_GROUP_ID = PEIA.EXP_GROUP_ID ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Cost Transfers' ,'Wells Fargo' ,'Lawson' ,'SPA Only' ,'EPIC' ) THEN PEIA.ORIG_TRANSACTION_REFERENCE WHEN PSOURCE.USER_TRANSACTION_SOURCE = 'iLab' THEN ( SELECT PEC.EXPENDITURE_COMMENT FROM PJC_EXP_COMMENTS PEC WHERE PEIA.EXPENDITURE_ITEM_ID = PEC.EXPENDITURE_ITEM_ID ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Workday Payroll' ,'Concur' ) THEN ( SELECT PPNF.FULL_NAME FROM PER_PERSON_NAMES_F PPNF WHERE 1 = 1 AND PEIA.INCURRED_BY_PERSON_ID = PPNF.PERSON_ID AND PPNF.NAME_TYPE = 'US' ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ('eSirius') THEN ( SELECT PEC.EXPENDITURE_COMMENT FROM PJC_EXP_COMMENTS PEC WHERE PEIA.EXPENDITURE_ITEM_ID = PEC.EXPENDITURE_ITEM_ID ) END ) Description ,( CASE WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Oracle Fusion Projects' ,'Wells Fargo' ) THEN ( SELECT PBATCH.USER_BATCH_NAME FROM PJC_EXP_GROUPS_ALL PBATCH WHERE PBATCH.EXP_GROUP_ID = PEIA.EXP_GROUP_ID ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Oracle Fusion Payables' ,'Oracle Fusion Purchasing' ,'Workday Payroll' ,'Concur' ,'eSirius' ,'EPIC' ) THEN PEIA.ORIG_TRANSACTION_REFERENCE WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Cost Transfers' ,'SPA Only' ,'iLab' ) THEN ( SELECT PEC.EXPENDITURE_COMMENT FROM PJC_EXP_COMMENTS PEC WHERE PEIA.EXPENDITURE_ITEM_ID = PEC.EXPENDITURE_ITEM_ID ) END ) REFERENCE ,NULL REQUESTER ,P.PROJECT_CURRENCY_CODE PROJECT_CURRENCY_CODE FROM PJF_PROJECTS_ALL_VL P ,HR_ALL_ORGANIZATION_UNITS_F_VL ORG ,GMS_AWARD_PROJECTS GAP ,GMS_AWARD_HEADERS_INFO_V GAHIV ,PER_PERSON_NAMES_F PPN -- ,GMS_AWARD_HEADERS_B GAHB ,SPONSOR SPN ,PJC_EXP_ITEMS_ALL PEIA ,AP_INVOICES_ALL AIA ,PO_HEADERS_ALL PHA -- ,AWARD_ENTITY AE ,FUN_ALL_BUSINESS_UNITS_V FAB ,PJC_TXN_XFACE_ALL INTERF ,PJF_PROJECT_TYPES_TL PTYPE ,DEPT Dept ,HR_ALL_ORGANIZATION_UNITS_TL HAOUT ,CC_HRY_COST_EN COSTCENTRE_PARENTS ,AP_INVOICE_PAYMENTS_ALL AIPA ,AP_CHECKS_ALL ACA ,POZ_SUPPLIERS_V PSV ,PJF_TXN_SOURCES_TL PSOURCE ,PJC_COST_DIST_LINES_ALL PCDLA ,Grants Grants WHERE 1 = 1 -- ANDP.SEGMENT1 IN ('SP001118') -- ANDP.SEGMENT1 IN ('IF100006','Advance 01 Project') -- AND PEIA.EXPENDITURE_ITEM_ID = '164067' -- ANDP.SEGMENT1 IN ('ORACLE0072') -- ANDP.SEGMENT1 IN ('Advance 01 Project') --and PEIA.EXPENDITURE_ITEM_ID IN ('683785') AND ORG.ORGANIZATION_ID = P.CARRYING_OUT_ORGANIZATION_ID AND SYSDATE BETWEEN ORG.EFFECTIVE_START_DATE AND ORG.EFFECTIVE_END_DATE AND P.PROJECT_ID = GAP.PROJECT_ID(+) AND GAP.AWARD_ID = GAHIV.ID(+) AND GAHIV.SPONSOR_ID = SPN.SPONSOR_ID(+) AND PEIA.PROJECT_ID = P.PROJECT_ID AND AIA.INVOICE_ID(+) = PEIA.ORIGINAL_HEADER_ID AND PEIA.PROJECT_BURDENED_COST != 0 AND PHA.PO_HEADER_ID(+) = AIA.PO_HEADER_ID -- AND P.PROJECT_ID = AE.PROJECT_ID(+) AND FAB.BU_ID(+) = P.ORG_ID AND P.PROJECT_ID = INTERF.PROJECT_ID(+) AND PEIA.EXPENDITURE_ITEM_ID = INTERF.EXPENDITURE_ITEM_ID(+) AND PTYPE.PROJECT_TYPE_ID(+) = P.PROJECT_TYPE_ID AND DEPT.PROJECT_ID(+) = P.PROJECT_ID -- AND INS.ORGANIZATION_ID= P.CARRYING_OUT_ORGANIZATION_ID AND AIPA.INVOICE_ID(+) = AIA.INVOICE_ID AND AIPA.CHECK_ID = ACA.CHECK_ID(+) AND P.CARRYING_OUT_ORGANIZATION_ID = HAOUT.ORGANIZATION_ID AND HAOUT.NAME = COSTCENTRE_PARENTS.CHILD AND PPN.PERSON_ID(+) = GAHIV.ACTIVE_PI_ID AND PPN.NAME_TYPE(+) = 'GLOBAL' AND PSV.VENDOR_ID(+) = PEIA.VENDOR_ID AND PSOURCE.TRANSACTION_SOURCE_ID(+) = PEIA.TRANSACTION_SOURCE_ID AND PSOURCE.LANGUAGE = 'US' AND PCDLA.EXPENDITURE_ITEM_ID = PEIA.EXPENDITURE_ITEM_ID AND grants.project_id = p.project_id AND grants.org_id = P.CARRYING_OUT_ORGANIZATION_ID AND ( (coalesce(:P_Entity, NULL) IS NULL) OR (P.ATTRIBUTE6 IN (:P_Entity)) ) AND ( (coalesce(:P_PRGRM_TYPE, NULL) IS NULL) OR (GAP.ATTRIBUTE18 IN (:P_PRGRM_TYPE)) ) AND ( (coalesce(:P_DEPT, NULL) IS NULL) OR (dept.CLASS_CODE IN (:P_DEPT)) ) AND ( (coalesce(:P_AWARD_TYPE, NULL) IS NULL) OR (GAHIV.AWARD_TYPE IN (:P_AWARD_TYPE)) ) AND PTYPE.PROJECT_TYPE(+) = :P_PRJ_TYPE AND P.PROJECT_STATUS_CODE = NVL(:P_PRJ_STATUS, P.PROJECT_STATUS_CODE) AND ( (coalesce(:PI_NAME, NULL) IS NULL) OR (PPN.FULL_NAME IN (:PI_NAME)) ) AND P.SEGMENT1 = NVL(:P_PROJ_NUM, P.SEGMENT1) AND ( (coalesce(:p_exp_cat, NULL) IS NULL) OR ( peia.expenditure_type_id IN ( SELECT PETB.EXPENDITURE_TYPE_ID FROM PJF_EXP_CATEGORIES_TL PECT ,PJF_EXP_TYPES_B PETB WHERE PETB.EXPENDITURE_CATEGORY_ID = PECT.EXPENDITURE_CATEGORY_ID AND PECT.LANGUAGE = 'US' AND PECT.EXPENDITURE_CATEGORY_NAME = :P_Exp_Cat ) ) ) AND ( (coalesce(:P_INSTITUTE, NULL) IS NULL) OR (COSTCENTRE_PARENTS.PARENT2 IN (:P_INSTITUTE)) ) AND ( (coalesce(:P_AWARD_NUM, NULL) IS NULL) OR (GAHIV.CONTRACT_NUMBER IN (:P_AWARD_NUM)) ) AND ( (coalesce(:P_TXN_SOURCE, NULL) IS NULL) OR (PSOURCE.USER_TRANSACTION_SOURCE IN (:P_TXN_SOURCE)) ) -- and COSTCENTRE_PARENTS.PARENT2 = NVL(:P_INSTITUTE , COSTCENTRE_PARENTS.PARENT2) AND ( TO_CHAR(PCDLA.PRVDR_GL_DATE, 'YYYY-MM-DD') BETWEEN TO_CHAR(TO_DATE(:P_FROM_FISCAL_PERIOD, 'MON-YY', 'NLS_DATE_LANGUAGE=AMERICAN'), 'YYYY-MM-DD') AND TO_CHAR(LAST_DAY(TO_DATE(:P_TO_FISCAL_PERIOD, 'MON-YY', 'NLS_DATE_LANGUAGE=AMERICAN')), 'YYYY-MM-DD') ) AND TO_CHAR(PCDLA.PRVDR_GL_DATE, 'YYYY-MM-DD') BETWEEN NVL(TO_CHAR(:P_From_Acc_Date, 'YYYY-MM-DD'),PCDLA.PRVDR_GL_DATE) and NVL(TO_CHAR(:P_To_Acc_Date, 'YYYY-MM-DD'), PCDLA.PRVDR_GL_DATE) AND EXISTS ( SELECT 1 FROM pjf_txn_sources_tl ptxntl WHERE peiA.TRANSACTION_SOURCE_ID = ptxntl.TRANSACTION_SOURCE_ID AND ptxntl.USER_TRANSACTION_SOURCE != 'Oracle Fusion Payables' ) UNION ALL SELECT P.SEGMENT1 PROJ_NUMB ,P.DESCRIPTION PROJ_DESC ,ORG.NAME ACC_UNIT ,P.PROJECT_STATUS_CODE PROJ_STATUS ,TO_CHAR(P.START_DATE, 'MM/DD/YYYY') PROJ_START_DATE ,TO_CHAR(P.COMPLETION_DATE, 'MM/DD/YYYY') PROJ_END_DATE ,GAHIV.CONTRACT_NUMBER AWARD_NUMBER ,GAHIV.SPONSOR_AWARD_NUMBER DIR_SPR_AWD_NUMB ,PPN.FULL_NAME PRIN_INV ,SPN.PARTY_NAME DIRECT_SPONSOR ,GAHIV.AWARD_TYPE AWARD_TYPE ,TO_CHAR(GAHIV.START_DATE, 'MM/DD/YYYY') || '-' || TO_CHAR(GAHIV.END_DATE, 'MM/DD/YYYY') FUNDING_PERIOD ,PEIA.EXPENDITURE_ITEM_ID TXN_NUMBER ,( SELECT pet.EXPENDITURE_TYPE_NAME FROM PJF_EXP_TYPES_TL pet WHERE pet.expenditure_type_id = peia.expenditure_type_id ) EXP_TYPE ,( SELECT decode(PECT.EXPENDITURE_CATEGORY_NAME, 'Personnel', '01', 'Fringe Benefits', '02', 'Animal Care Costs', '03', 'Contracted Services', '04', 'CT Clinical Trials Margin', '05', 'Equipment SP', '06', 'Facility & Administrative Cost', '07', 'Fellowships', '08', 'Inter Institutional CWRU', '09', 'Patient Care', '10', 'Patient Recruitment Expense', '11', 'Research Deficit Cost Share', '12', 'Scholarships', '13', 'Site Payments', '14', 'Space Rental', '15', 'Stipends', '16', 'Subcontracts', '17', 'Supplies', '18', 'Travel', '19', 'Tuition', '20', 'Other Expenses', '21', 'Artwork', '22', 'Construction', '23', 'Equipment', '24', 'Expense', '25', 'ITD', '26', 'Routine Capital', '27', 'Security', '28', 'Not a Category') ORDER_CODE FROM PJF_EXP_CATEGORIES_TL PECT ,PJF_EXP_TYPES_B PETB WHERE PEIA.EXPENDITURE_TYPE_ID = PETB.EXPENDITURE_TYPE_ID AND PETB.EXPENDITURE_CATEGORY_ID = PECT.EXPENDITURE_CATEGORY_ID AND PECT.LANGUAGE = 'US' ) ORDER_CODE ,( SELECT PECT.EXPENDITURE_CATEGORY_NAME FROM PJF_EXP_CATEGORIES_TL PECT ,PJF_EXP_TYPES_B PETB WHERE PEIA.EXPENDITURE_TYPE_ID = PETB.EXPENDITURE_TYPE_ID AND PETB.EXPENDITURE_CATEGORY_ID = PECT.EXPENDITURE_CATEGORY_ID AND PECT.LANGUAGE = 'US' ) EXP_CATEGORY -- ,(select PES.USER_TRANSACTION_SOURCE -- from PJF_TXN_SOURCES_TL PES -- where PES.TRANSACTION_SOURCE_ID = PEIA.TRANSACTION_SOURCE_ID -- AND PES.LANGUAGE = 'US' -- ) ,PSOURCE.USER_TRANSACTION_SOURCE Txn_Source ,PEIA.EXPENDITURE_ITEM_DATE Exp_Item_Date -- ,PEIA.PROJECT_BURDENED_COSTAMOUNT ,NVL(( CASE WHEN aia.PAYMENT_STATUS_FLAG = 'Y' THEN NVL(PEIA.PROJECT_BURDENED_COST, 0) ELSE NULL END ), 0) AMOUNT ,NVL(( CASE WHEN aia.PAYMENT_STATUS_FLAG = 'N' THEN NVL(PEIA.PROJECT_BURDENED_COST, 0) ELSE NULL END ), 0) UNPOSTED_TXN ,AIA.INVOICE_NUM INVOICE_NUMBER ,PHA.SEGMENT1 PO_NUMBER ,TO_CHAR(PHA.CREATION_DATE, 'MM/DD/YYYY') PO_DATE -- ,PHA.CREATION_DATEPO_DATE ,P.ATTRIBUTE6 Entity ,P.ATTRIBUTE8 Site -- ,AE.class_code Awarded_Entity ,GAHIV.ATTRIBUTE1 Awarded_Entity ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE12 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE12 END ) PROG_CODE ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE_NUMBER2 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE2_NUMBER END ) FAC_RATE ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE19 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE19 END ) IRB ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE20 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE20 END ) IACUC ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE7 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE7 END ) GPID ,ACA.CHECK_NUMBER CHECK_NUMBER ,GAP.ATTRIBUTE13 SA_NUMBER ,PSV.VENDOR_NAME SUPLLIER_NAME ,PSV.segment1 SUPPLIER_NUMBER ,TO_CHAR(PLA.LINE_NUM) PO_LINE_NUM ,TO_CHAR(PCDLA.PRVDR_GL_DATE, 'MM/DD/YYYY') Accounting_Date ,( CASE WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Oracle Fusion Payables' ,'Oracle Fusion Purchasing' ) THEN PLA.ITEM_DESCRIPTION WHEN PSOURCE.USER_TRANSACTION_SOURCE = 'Oracle Fusion Projects' THEN ( SELECT PBATCH.USER_BATCH_NAME FROM PJC_EXP_GROUPS_ALL PBATCH WHERE PBATCH.EXP_GROUP_ID = PEIA.EXP_GROUP_ID ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Cost Transfers' ,'Wells Fargo' ,'Lawson' ,'SPA Only' ,'EPIC' ) THEN PEIA.ORIG_TRANSACTION_REFERENCE WHEN PSOURCE.USER_TRANSACTION_SOURCE = 'iLab' THEN ( SELECT PEC.EXPENDITURE_COMMENT FROM PJC_EXP_COMMENTS PEC WHERE PEIA.EXPENDITURE_ITEM_ID = PEC.EXPENDITURE_ITEM_ID ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Workday Payroll' ,'Concur' ) THEN ( SELECT PPNF.FULL_NAME FROM PER_PERSON_NAMES_F PPNF WHERE 1 = 1 AND PEIA.INCURRED_BY_PERSON_ID = PPNF.PERSON_ID AND PPNF.NAME_TYPE = 'US' ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ('eSirius') THEN ( SELECT PEC.EXPENDITURE_COMMENT FROM PJC_EXP_COMMENTS PEC WHERE PEIA.EXPENDITURE_ITEM_ID = PEC.EXPENDITURE_ITEM_ID ) END ) Description ,( CASE WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Oracle Fusion Projects' ,'Wells Fargo' ) THEN ( SELECT PBATCH.USER_BATCH_NAME FROM PJC_EXP_GROUPS_ALL PBATCH WHERE PBATCH.EXP_GROUP_ID = PEIA.EXP_GROUP_ID ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Oracle Fusion Payables' ,'Oracle Fusion Purchasing' ,'Workday Payroll' ,'Concur' ,'eSirius' ,'EPIC' ) THEN PEIA.ORIG_TRANSACTION_REFERENCE WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Cost Transfers' ,'SPA Only' ,'iLab' ) THEN ( SELECT PEC.EXPENDITURE_COMMENT FROM PJC_EXP_COMMENTS PEC WHERE PEIA.EXPENDITURE_ITEM_ID = PEC.EXPENDITURE_ITEM_ID ) END ) REFERENCE ,PPNF.LAST_NAME || ',' || PPNF.FIRST_NAME REQUESTER ,P.PROJECT_CURRENCY_CODE PROJECT_CURRENCY_CODE FROM PJF_PROJECTS_ALL_VL P ,HR_ALL_ORGANIZATION_UNITS_F_VL ORG ,GMS_AWARD_PROJECTS GAP ,GMS_AWARD_HEADERS_INFO_V GAHIV ,PER_PERSON_NAMES_F PPN -- ,GMS_AWARD_HEADERS_B GAHB ,SPONSOR SPN ,PJC_EXP_ITEMS_ALL PEIA ,AP_INVOICES_ALL AIA ,AP_INVOICE_LINES_ALL AILA ,AP_INVOICE_DISTRIBUTIONS_ALL ADA ,PO_DISTRIBUTIONS_ALL PDA ,PO_LINES_ALL PLA ,PO_HEADERS_ALL PHA -- ,AWARD_ENTITY AE ,FUN_ALL_BUSINESS_UNITS_V FAB ,PJC_TXN_XFACE_ALL INTERF ,PJF_PROJECT_TYPES_TL PTYPE ,DEPT Dept ,HR_ALL_ORGANIZATION_UNITS_TL HAOUT ,CC_HRY_COST_EN COSTCENTRE_PARENTS ,AP_INVOICE_PAYMENTS_ALL AIPA ,AP_CHECKS_ALL ACA ,POZ_SUPPLIERS_V PSV ,PJF_TXN_SOURCES_TL PSOURCE ,PJC_COST_DIST_LINES_ALL PCDLA --,POR_REQUISITION_HEADERS_ALL PRHA --,POR_REQUISITION_LINES_ALL PRLA --,POR_REQ_DISTRIBUTIONS_ALL PRDA ,PER_PERSON_NAMES_F PPNF ,Grants Grants WHERE 1 = 1 -- ANDP.SEGMENT1 IN ('C0015312BD') -- and peia.PROJECT_ID IN ('300000083447541','300000083733849') -- and PEIA.EXPENDITURE_ITEM_ID IN ('1138167','1121471') -- and PEIA.EXPENDITURE_ITEM_ID IN ('683785') AND ORG.ORGANIZATION_ID = P.CARRYING_OUT_ORGANIZATION_ID AND SYSDATE BETWEEN ORG.EFFECTIVE_START_DATE AND ORG.EFFECTIVE_END_DATE AND P.PROJECT_ID = GAP.PROJECT_ID(+) AND GAP.AWARD_ID = GAHIV.ID(+) AND GAHIV.SPONSOR_ID = SPN.SPONSOR_ID(+) AND PEIA.PROJECT_ID = P.PROJECT_ID -- AND AIA.INVOICE_ID(+) = PEIA.ORIGINAL_HEADER_ID AND PEIA.PROJECT_BURDENED_COST != 0 AND AIA.INVOICE_ID(+) = PEIA.ORIGINAL_HEADER_ID AND AIA.INVOICE_ID = AILA.INVOICE_ID(+) AND PEIA.ORIGINAL_LINE_NUMBER = AILA.LINE_NUMBER(+) AND AIA.INVOICE_ID = ADA.INVOICE_ID(+) AND ADA.INVOICE_LINE_NUMBER(+) = AILA.LINE_NUMBER AND ADA.INVOICE_DISTRIBUTION_ID(+) = PEIA.ORIGINAL_DIST_ID AND ADA.PO_DISTRIBUTION_ID = PDA.PO_DISTRIBUTION_ID(+) AND PDA.PO_LINE_ID = PLA.PO_LINE_ID(+) AND PDA.PO_HEADER_ID = PLA.PO_HEADER_ID(+) AND PLA.PO_HEADER_ID = PHA.PO_HEADER_ID(+) AND PHA.PO_HEADER_ID(+) = AIA.PO_HEADER_ID -- AND P.PROJECT_ID = AE.PROJECT_ID(+) AND FAB.BU_ID(+) = P.ORG_ID AND P.PROJECT_ID = INTERF.PROJECT_ID(+) AND PEIA.EXPENDITURE_ITEM_ID = INTERF.EXPENDITURE_ITEM_ID(+) AND PTYPE.PROJECT_TYPE_ID(+) = P.PROJECT_TYPE_ID AND DEPT.PROJECT_ID(+) = P.PROJECT_ID AND AIPA.INVOICE_ID(+) = AIA.INVOICE_ID AND AIPA.CHECK_ID = ACA.CHECK_ID(+) AND P.CARRYING_OUT_ORGANIZATION_ID = HAOUT.ORGANIZATION_ID AND HAOUT.NAME = COSTCENTRE_PARENTS.CHILD AND PPN.PERSON_ID(+) = GAHIV.ACTIVE_PI_ID AND PPN.NAME_TYPE(+) = 'GLOBAL' AND PSV.VENDOR_ID(+) = PEIA.VENDOR_ID AND PSOURCE.TRANSACTION_SOURCE_ID(+) = PEIA.TRANSACTION_SOURCE_ID AND PSOURCE.LANGUAGE = 'US' --AND PDA.REQ_DISTRIBUTION_ID = PRDA.DISTRIBUTION_ID(+) --AND PRDA.REQUISITION_LINE_ID = PRLA.REQUISITION_LINE_ID(+) --AND PRLA.REQUISITION_HEADER_ID = PRHA.REQUISITION_HEADER_ID(+) --AND PPNF.PERSON_ID(+) = PRHA.PREPARER_ID AND PPNF.PERSON_ID(+) = PHA.AGENT_ID AND PPNF.NAME_TYPE(+) = ('US') AND PCDLA.EXPENDITURE_ITEM_ID(+) = PEIA.EXPENDITURE_ITEM_ID AND EXISTS ( SELECT 1 FROM pjf_txn_sources_tl ptxntl WHERE peiA.TRANSACTION_SOURCE_ID = ptxntl.TRANSACTION_SOURCE_ID AND ptxntl.USER_TRANSACTION_SOURCE = 'Oracle Fusion Payables' ) AND grants.project_id = p.project_id AND grants.org_id = P.CARRYING_OUT_ORGANIZATION_ID AND ( (coalesce(:P_Entity, NULL) IS NULL) OR (P.ATTRIBUTE6 IN (:P_Entity)) ) AND ( (coalesce(:P_PRGRM_TYPE, NULL) IS NULL) OR (GAP.ATTRIBUTE18 IN (:P_PRGRM_TYPE)) ) AND ( (coalesce(:P_DEPT, NULL) IS NULL) OR (dept.CLASS_CODE IN (:P_DEPT)) ) AND ( (coalesce(:P_AWARD_TYPE, NULL) IS NULL) OR (GAHIV.AWARD_TYPE IN (:P_AWARD_TYPE)) ) AND PTYPE.PROJECT_TYPE(+) = :P_PRJ_TYPE AND P.PROJECT_STATUS_CODE = NVL(:P_PRJ_STATUS, P.PROJECT_STATUS_CODE) AND ( (coalesce(:PI_NAME, NULL) IS NULL) OR (PPN.FULL_NAME IN (:PI_NAME)) ) AND P.SEGMENT1 = NVL(:P_PROJ_NUM, P.SEGMENT1) AND ( (coalesce(:p_exp_cat, NULL) IS NULL) OR ( peia.expenditure_type_id IN ( SELECT PETB.EXPENDITURE_TYPE_ID FROM PJF_EXP_CATEGORIES_TL PECT ,PJF_EXP_TYPES_B PETB WHERE PETB.EXPENDITURE_CATEGORY_ID = PECT.EXPENDITURE_CATEGORY_ID AND PECT.LANGUAGE = 'US' AND PECT.EXPENDITURE_CATEGORY_NAME = :P_Exp_Cat ) ) ) AND ( (coalesce(:P_INSTITUTE, NULL) IS NULL) OR (COSTCENTRE_PARENTS.PARENT2 IN (:P_INSTITUTE)) ) AND ( (coalesce(:P_AWARD_NUM, NULL) IS NULL) OR (GAHIV.CONTRACT_NUMBER IN (:P_AWARD_NUM)) ) AND ( (coalesce(:P_TXN_SOURCE, NULL) IS NULL) OR (PSOURCE.USER_TRANSACTION_SOURCE IN (:P_TXN_SOURCE)) ) -- and COSTCENTRE_PARENTS.PARENT2 = NVL(:P_INSTITUTE , COSTCENTRE_PARENTS.PARENT2) -- AND GAHIV.CONTRACT_NUMBER = NVL(:P_AWARD_NUM , GAHIV.CONTRACT_NUMBER) AND ( TO_CHAR(PCDLA.PRVDR_GL_DATE, 'YYYY-MM-DD') BETWEEN TO_CHAR(TO_DATE(:P_FROM_FISCAL_PERIOD, 'MON-YY', 'NLS_DATE_LANGUAGE=AMERICAN'), 'YYYY-MM-DD') AND TO_CHAR(LAST_DAY(TO_DATE(:P_TO_FISCAL_PERIOD, 'MON-YY', 'NLS_DATE_LANGUAGE=AMERICAN')), 'YYYY-MM-DD') ) AND TO_CHAR(PCDLA.PRVDR_GL_DATE, 'YYYY-MM-DD') BETWEEN NVL(TO_CHAR(:P_From_Acc_Date, 'YYYY-MM-DD'),PCDLA.PRVDR_GL_DATE) and NVL(TO_CHAR(:P_To_Acc_Date, 'YYYY-MM-DD'), PCDLA.PRVDR_GL_DATE) UNION SELECT P.SEGMENT1 PROJ_NUMB ,P.DESCRIPTION PROJ_DESC ,ORG.NAME ACC_UNIT ,P.PROJECT_STATUS_CODE PROJ_STATUS ,TO_CHAR(P.START_DATE, 'MM/DD/YYYY') PROJ_START_DATE ,TO_CHAR(P.COMPLETION_DATE, 'MM/DD/YYYY') PROJ_END_DATE ,GAHIV.CONTRACT_NUMBER AWARD_NUMBER ,GAHIV.SPONSOR_AWARD_NUMBER DIR_SPR_AWD_NUMB ,PPN.FULL_NAME PRIN_INV ,SPN.PARTY_NAME DIRECT_SPONSOR ,GAHIV.AWARD_TYPE AWARD_TYPE ,TO_CHAR(GAHIV.START_DATE, 'MM/DD/YYYY') || '-' || TO_CHAR(GAHIV.END_DATE, 'MM/DD/YYYY') FUNDING_PERIOD ,PEIA.EXPENDITURE_ITEM_ID TXN_NUMBER ,( SELECT pet.EXPENDITURE_TYPE_NAME FROM PJF_EXP_TYPES_TL pet WHERE pet.expenditure_type_id = peia.expenditure_type_id ) EXP_TYPE ,( SELECT decode(PECT.EXPENDITURE_CATEGORY_NAME, 'Personnel', '01', 'Fringe Benefits', '02', 'Animal Care Costs', '03', 'Contracted Services', '04', 'CT Clinical Trials Margin', '05', 'Equipment SP', '06', 'Facility & Administrative Cost', '07', 'Fellowships', '08', 'Inter Institutional CWRU', '09', 'Patient Care', '10', 'Patient Recruitment Expense', '11', 'Research Deficit Cost Share', '12', 'Scholarships', '13', 'Site Payments', '14', 'Space Rental', '15', 'Stipends', '16', 'Subcontracts', '17', 'Supplies', '18', 'Travel', '19', 'Tuition', '20', 'Other Expenses', '21', 'Artwork', '22', 'Construction', '23', 'Equipment', '24', 'Expense', '25', 'ITD', '26', 'Routine Capital', '27', 'Security', '28', 'Not a Category') ORDER_CODE FROM PJF_EXP_CATEGORIES_TL PECT ,PJF_EXP_TYPES_B PETB WHERE PEIA.EXPENDITURE_TYPE_ID = PETB.EXPENDITURE_TYPE_ID AND PETB.EXPENDITURE_CATEGORY_ID = PECT.EXPENDITURE_CATEGORY_ID AND PECT.LANGUAGE = 'US' ) ORDER_CODE ,( SELECT PECT.EXPENDITURE_CATEGORY_NAME FROM PJF_EXP_CATEGORIES_TL PECT ,PJF_EXP_TYPES_B PETB WHERE PEIA.EXPENDITURE_TYPE_ID = PETB.EXPENDITURE_TYPE_ID AND PETB.EXPENDITURE_CATEGORY_ID = PECT.EXPENDITURE_CATEGORY_ID AND PECT.LANGUAGE = 'US' ) EXP_CATEGORY -- ,(select PES.USER_TRANSACTION_SOURCE -- from PJF_TXN_SOURCES_TL PES -- where PES.TRANSACTION_SOURCE_ID = PEIA.TRANSACTION_SOURCE_ID -- AND PES.LANGUAGE = 'US' -- ) ,PSOURCE.USER_TRANSACTION_SOURCE Txn_Source ,PEIA.EXPENDITURE_ITEM_DATE Exp_Item_Date -- ,PEIA.PROJECT_BURDENED_COSTAMOUNT ,NVL(( CASE WHEN aia.PAYMENT_STATUS_FLAG = 'Y' THEN NVL(PEIA.PROJECT_BURDENED_COST, 0) ELSE NULL END ), 0) AMOUNT ,NVL(( CASE WHEN aia.PAYMENT_STATUS_FLAG = 'N' THEN NVL(PEIA.PROJECT_BURDENED_COST, 0) ELSE NULL END ), 0) UNPOSTED_TXN ,AIA.INVOICE_NUM INVOICE_NUMBER ,PHA.SEGMENT1 PO_NUMBER ,TO_CHAR(PHA.CREATION_DATE, 'MM/DD/YYYY') PO_DATE -- ,PHA.CREATION_DATEPO_DATE ,P.ATTRIBUTE6 Entity ,P.ATTRIBUTE8 Site -- ,AE.class_code Awarded_Entity ,GAHIV.ATTRIBUTE1 Awarded_Entity ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE12 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE12 END ) PROG_CODE ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE_NUMBER2 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE2_NUMBER END ) FAC_RATE ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE19 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE19 END ) IRB ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE20 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE20 END ) IACUC ,( CASE WHEN FAB.BU_NAME = 'SPONSORED PROGRAMS' THEN GAP.ATTRIBUTE7 WHEN FAB.BU_NAME = 'INTERNALLY FUNDED' THEN P.ATTRIBUTE7 END ) GPID ,ACA.CHECK_NUMBER CHECK_NUMBER ,GAP.ATTRIBUTE13 SA_NUMBER ,PSV.VENDOR_NAME SUPLLIER_NAME ,PSV.segment1 SUPPLIER_NUMBER ,TO_CHAR(PLA.LINE_NUM) PO_LINE_NUM ,TO_CHAR(PCDLA.PRVDR_GL_DATE, 'MM/DD/YYYY') Accounting_Date ,( CASE WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Oracle Fusion Payables' ,'Oracle Fusion Purchasing' ) THEN PLA.ITEM_DESCRIPTION WHEN PSOURCE.USER_TRANSACTION_SOURCE = 'Oracle Fusion Projects' THEN ( SELECT PBATCH.USER_BATCH_NAME FROM PJC_EXP_GROUPS_ALL PBATCH WHERE PBATCH.EXP_GROUP_ID = PEIA.EXP_GROUP_ID ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Cost Transfers' ,'Wells Fargo' ,'Lawson' ,'SPA Only' ,'EPIC' ) THEN PEIA.ORIG_TRANSACTION_REFERENCE WHEN PSOURCE.USER_TRANSACTION_SOURCE = 'iLab' THEN ( SELECT PEC.EXPENDITURE_COMMENT FROM PJC_EXP_COMMENTS PEC WHERE PEIA.EXPENDITURE_ITEM_ID = PEC.EXPENDITURE_ITEM_ID ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Workday Payroll' ,'Concur' ) THEN ( SELECT PPNF.FULL_NAME FROM PER_PERSON_NAMES_F PPNF WHERE 1 = 1 AND PEIA.INCURRED_BY_PERSON_ID = PPNF.PERSON_ID AND PPNF.NAME_TYPE = 'US' ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ('eSirius') THEN ( SELECT PEC.EXPENDITURE_COMMENT FROM PJC_EXP_COMMENTS PEC WHERE PEIA.EXPENDITURE_ITEM_ID = PEC.EXPENDITURE_ITEM_ID ) END ) Description ,( CASE WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Oracle Fusion Projects' ,'Wells Fargo' ) THEN ( SELECT PBATCH.USER_BATCH_NAME FROM PJC_EXP_GROUPS_ALL PBATCH WHERE PBATCH.EXP_GROUP_ID = PEIA.EXP_GROUP_ID ) WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Oracle Fusion Payables' ,'Oracle Fusion Purchasing' ,'Workday Payroll' ,'Concur' ,'eSirius' ,'EPIC' ) THEN PEIA.ORIG_TRANSACTION_REFERENCE WHEN PSOURCE.USER_TRANSACTION_SOURCE IN ( 'Cost Transfers' ,'SPA Only' ,'iLab' ) THEN ( SELECT PEC.EXPENDITURE_COMMENT FROM PJC_EXP_COMMENTS PEC WHERE PEIA.EXPENDITURE_ITEM_ID = PEC.EXPENDITURE_ITEM_ID ) END ) REFERENCE ,PPNF.LAST_NAME || ',' || PPNF.FIRST_NAME REQUESTER ,P.PROJECT_CURRENCY_CODE PROJECT_CURRENCY_CODE FROM PJF_PROJECTS_ALL_VL P ,HR_ALL_ORGANIZATION_UNITS_F_VL ORG ,GMS_AWARD_PROJECTS GAP ,GMS_AWARD_HEADERS_INFO_V GAHIV ,PER_PERSON_NAMES_F PPN -- ,GMS_AWARD_HEADERS_B GAHB ,SPONSOR SPN ,PJC_EXP_ITEMS_ALL PEIA ,AP_INVOICES_ALL AIA ,AP_INVOICE_LINES_ALL AILA ,AP_INVOICE_DISTRIBUTIONS_ALL ADA ,PO_DISTRIBUTIONS_ALL PDA ,PO_LINES_ALL PLA ,PO_HEADERS_ALL PHA -- ,AWARD_ENTITY AE ,FUN_ALL_BUSINESS_UNITS_V FAB ,PJC_TXN_XFACE_ALL INTERF ,PJF_PROJECT_TYPES_TL PTYPE ,DEPT Dept ,HR_ALL_ORGANIZATION_UNITS_TL HAOUT ,CC_HRY_COST_EN COSTCENTRE_PARENTS ,AP_INVOICE_PAYMENTS_ALL AIPA ,AP_CHECKS_ALL ACA ,POZ_SUPPLIERS_V PSV ,PJF_TXN_SOURCES_TL PSOURCE ,PJC_COST_DIST_LINES_ALL PCDLA ,POR_REQUISITION_HEADERS_ALL PRHA ,POR_REQUISITION_LINES_ALL PRLA ,POR_REQ_DISTRIBUTIONS_ALL PRDA ,PER_PERSON_NAMES_F PPNF ,Grants Grants WHERE 1 = 1 -- ANDP.SEGMENT1 IN ('C0015312BD') -- and peia.PROJECT_ID IN ('300000083447541','300000083733849') -- and PEIA.EXPENDITURE_ITEM_ID IN ('1138167','1121471') -- and PEIA.EXPENDITURE_ITEM_ID IN ('683785') AND ORG.ORGANIZATION_ID = P.CARRYING_OUT_ORGANIZATION_ID AND SYSDATE BETWEEN ORG.EFFECTIVE_START_DATE AND ORG.EFFECTIVE_END_DATE AND P.PROJECT_ID = GAP.PROJECT_ID(+) AND GAP.AWARD_ID = GAHIV.ID(+) AND GAHIV.SPONSOR_ID = SPN.SPONSOR_ID(+) AND PEIA.PROJECT_ID = P.PROJECT_ID -- AND AIA.INVOICE_ID(+) = PEIA.ORIGINAL_HEADER_ID AND PEIA.PROJECT_BURDENED_COST != 0 AND AIA.INVOICE_ID(+) = PEIA.ORIGINAL_HEADER_ID AND AIA.INVOICE_ID = AILA.INVOICE_ID(+) AND PEIA.ORIGINAL_LINE_NUMBER = AILA.LINE_NUMBER(+) AND AIA.INVOICE_ID = ADA.INVOICE_ID(+) AND ADA.INVOICE_LINE_NUMBER(+) = AILA.LINE_NUMBER AND ADA.INVOICE_DISTRIBUTION_ID(+) = PEIA.ORIGINAL_DIST_ID AND ADA.PO_DISTRIBUTION_ID = PDA.PO_DISTRIBUTION_ID(+) AND PDA.PO_LINE_ID = PLA.PO_LINE_ID(+) AND PDA.PO_HEADER_ID = PLA.PO_HEADER_ID(+) AND PLA.PO_HEADER_ID = PHA.PO_HEADER_ID(+) AND PHA.PO_HEADER_ID(+) = AIA.PO_HEADER_ID -- AND P.PROJECT_ID = AE.PROJECT_ID(+) AND FAB.BU_ID(+) = P.ORG_ID AND P.PROJECT_ID = INTERF.PROJECT_ID(+) AND PEIA.EXPENDITURE_ITEM_ID = INTERF.EXPENDITURE_ITEM_ID(+) AND PTYPE.PROJECT_TYPE_ID(+) = P.PROJECT_TYPE_ID AND DEPT.PROJECT_ID(+) = P.PROJECT_ID AND AIPA.INVOICE_ID(+) = AIA.INVOICE_ID AND AIPA.CHECK_ID = ACA.CHECK_ID(+) AND P.CARRYING_OUT_ORGANIZATION_ID = HAOUT.ORGANIZATION_ID AND HAOUT.NAME = COSTCENTRE_PARENTS.CHILD AND PPN.PERSON_ID(+) = GAHIV.ACTIVE_PI_ID AND PPN.NAME_TYPE(+) = 'GLOBAL' AND PSV.VENDOR_ID(+) = PEIA.VENDOR_ID AND PSOURCE.TRANSACTION_SOURCE_ID(+) = PEIA.TRANSACTION_SOURCE_ID AND PSOURCE.LANGUAGE = 'US' AND PDA.REQ_DISTRIBUTION_ID = PRDA.DISTRIBUTION_ID(+) AND PRDA.REQUISITION_LINE_ID = PRLA.REQUISITION_LINE_ID(+) AND PRLA.REQUISITION_HEADER_ID = PRHA.REQUISITION_HEADER_ID(+) AND PPNF.PERSON_ID(+) = PRHA.PREPARER_ID --AND PPNF.PERSON_ID(+) = PHA.AGENT_ID AND PPNF.NAME_TYPE(+) = ('US') AND PCDLA.EXPENDITURE_ITEM_ID(+) = PEIA.EXPENDITURE_ITEM_ID AND EXISTS ( SELECT 1 FROM pjf_txn_sources_tl ptxntl WHERE peiA.TRANSACTION_SOURCE_ID = ptxntl.TRANSACTION_SOURCE_ID AND ptxntl.USER_TRANSACTION_SOURCE = 'Oracle Fusion Purchasing' ) AND grants.project_id = p.project_id AND grants.org_id = P.CARRYING_OUT_ORGANIZATION_ID AND ( (coalesce(:P_Entity, NULL) IS NULL) OR (P.ATTRIBUTE6 IN (:P_Entity)) ) AND ( (coalesce(:P_PRGRM_TYPE, NULL) IS NULL) OR (GAP.ATTRIBUTE18 IN (:P_PRGRM_TYPE)) ) AND ( (coalesce(:P_DEPT, NULL) IS NULL) OR (dept.CLASS_CODE IN (:P_DEPT)) ) AND ( (coalesce(:P_AWARD_TYPE, NULL) IS NULL) OR (GAHIV.AWARD_TYPE IN (:P_AWARD_TYPE)) ) AND PTYPE.PROJECT_TYPE(+) = :P_PRJ_TYPE AND P.PROJECT_STATUS_CODE = NVL(:P_PRJ_STATUS, P.PROJECT_STATUS_CODE) AND ( (coalesce(:PI_NAME, NULL) IS NULL) OR (PPN.FULL_NAME IN (:PI_NAME)) ) AND P.SEGMENT1 = NVL(:P_PROJ_NUM, P.SEGMENT1) AND ( (coalesce(:p_exp_cat, NULL) IS NULL) OR ( peia.expenditure_type_id IN ( SELECT PETB.EXPENDITURE_TYPE_ID FROM PJF_EXP_CATEGORIES_TL PECT ,PJF_EXP_TYPES_B PETB WHERE PETB.EXPENDITURE_CATEGORY_ID = PECT.EXPENDITURE_CATEGORY_ID AND PECT.LANGUAGE = 'US' AND PECT.EXPENDITURE_CATEGORY_NAME = :P_Exp_Cat ) ) ) AND ( (coalesce(:P_INSTITUTE, NULL) IS NULL) OR (COSTCENTRE_PARENTS.PARENT2 IN (:P_INSTITUTE)) ) AND ( (coalesce(:P_AWARD_NUM, NULL) IS NULL) OR (GAHIV.CONTRACT_NUMBER IN (:P_AWARD_NUM)) ) AND ( (coalesce(:P_TXN_SOURCE, NULL) IS NULL) OR (PSOURCE.USER_TRANSACTION_SOURCE IN (:P_TXN_SOURCE)) ) -- and COSTCENTRE_PARENTS.PARENT2 = NVL(:P_INSTITUTE , COSTCENTRE_PARENTS.PARENT2) -- AND GAHIV.CONTRACT_NUMBER = NVL(:P_AWARD_NUM , GAHIV.CONTRACT_NUMBER) AND ( TO_CHAR(PCDLA.PRVDR_GL_DATE, 'YYYY-MM-DD') BETWEEN TO_CHAR(TO_DATE(:P_FROM_FISCAL_PERIOD, 'MON-YY', 'NLS_DATE_LANGUAGE=AMERICAN'), 'YYYY-MM-DD') AND TO_CHAR(LAST_DAY(TO_DATE(:P_TO_FISCAL_PERIOD, 'MON-YY', 'NLS_DATE_LANGUAGE=AMERICAN')), 'YYYY-MM-DD') ) AND TO_CHAR(PCDLA.PRVDR_GL_DATE, 'YYYY-MM-DD') BETWEEN NVL(TO_CHAR(:P_From_Acc_Date, 'YYYY-MM-DD'),PCDLA.PRVDR_GL_DATE) and NVL(TO_CHAR(:P_To_Acc_Date, 'YYYY-MM-DD'), PCDLA.PRVDR_GL_DATE) ) ORDER BY ORDER_CODE ,Exp_Item_Date