SELECT GSOB.NAME "SOB Name",
AEH.INVOICE_NUM "Report Number",
AEH.TOTAL,
AEH.DESCRIPTION,
PPX.FULL_NAME,
PPX.EMPLOYEE_NUMBER,
decode(AEH.WORKFLOW_APPROVED_FLAG,'S','SAVED','I','IMPLICIT SAVE','R','MANAGER REJECTED','M','MANAGER APPROVED','P','PAYABLES APPROVED','A','AUTO APPROVED','W','WITHDRAWN','Y','APPROVED','IN PROGRESS') Status,
(SELECT APPS.AP_WEB_POLICY_UTILS.GET_LOOKUP_MEANING('EXPENSE REPORT STATUS',
DECODE(AI.CANCELLED_DATE,
NULL,
AEH.EXPENSE_STATUS_CODE,
'CANCELLED'))
FROM APPS.AP_INVOICES_ALL AI
WHERE AI.INVOICE_ID(+) = AEH.VOUCHNO) "Report status",
NVL(AEH.REPORT_SUBMITTED_DATE, AEH.CREATION_DATE) "Report submitted on",
CASE
WHEN NVL2(AAP.ENTERED_DATE, 'Y', 'N') = 'Y' THEN
AAP.ENTERED_DATE
END "Manager Approved on",
AEH.EXPENSE_STATUS_CODE,
TRUNC(AEH.WEEK_END_DATE) "Report entered date",
ACA.EMPLOYEE_NUMBER "Auditor Emp Num",
ACA.FULL_NAME "Auditor Name",
ACA.ENTERED_DATE "Audited on"
FROM APPS.GL_SETS_OF_BOOKS GSOB,
APPS.AP_EXPENSE_REPORT_HEADERS_ALL AEH,
APPS.PER_PEOPLE_X PPX,
(SELECT ROW_NUMBER() OVER(PARTITION BY SOURCE_OBJECT_ID ORDER BY NOTE_ID DESC) SRL,
AN.NOTE_ID,
AN.SOURCE_OBJECT_ID,
AN.ENTERED_BY,
AN.ENTERED_DATE,
PPX.EMPLOYEE_NUMBER,
PPX.FULL_NAME
FROM APPS.AP_NOTES AN, APPS.FND_USER FU, APPS.PER_PEOPLE_X PPX
WHERE AN.ENTERED_BY = FU.USER_ID
AND FU.EMPLOYEE_ID = PPX.PERSON_ID
AND AN.SOURCE_OBJECT_CODE = 'OIE_EXPENSE_REPORT'
AND TO_CHAR(SUBSTR(AN.NOTES_DETAIL, 1, 24)) =
'Approver Action: Approve') AAP,
(SELECT ROW_NUMBER() OVER(PARTITION BY SOURCE_OBJECT_ID ORDER BY NOTE_ID DESC) SRL,
ANS.NOTE_ID,
ANS.SOURCE_OBJECT_ID,
ANS.ENTERED_BY,
ANS.ENTERED_DATE,
PPLX.EMPLOYEE_NUMBER,
PPLX.FULL_NAME
FROM APPS.AP_NOTES ANS, APPS.FND_USER FUR, APPS.PER_PEOPLE_X PPLX
WHERE ANS.ENTERED_BY = FUR.USER_ID
AND FUR.EMPLOYEE_ID = PPLX.PERSON_ID
AND ANS.SOURCE_OBJECT_CODE = 'OIE_EXPENSE_REPORT'
AND TO_CHAR(SUBSTR(ANS.NOTES_DETAIL, 1, 15)) = 'Complete Audit.') ACA
WHERE 1 = 1
AND AEH.REPORT_HEADER_ID = ACA.SOURCE_OBJECT_ID(+)
AND AEH.REPORT_HEADER_ID = AAP.SOURCE_OBJECT_ID(+)
AND AEH.EMPLOYEE_ID = PPX.PERSON_ID
AND GSOB.SET_OF_BOOKS_ID = AEH.SET_OF_BOOKS_ID
AND AEH.EXPENSE_STATUS_CODE NOT IN ('INVOICED', 'PAID', 'WITHDRAWN', 'REJECTED')
AND NVL (AAP.SRL, 1) = 1
AND NVL (ACA.SRL, 1) = 1
-- AND AEH.CREATION_DATE BETWEEN TO_DATE (:DATE_FROM_DDMONYYYY, 'DD-MON-YYYY') AND TO_DATE (:DATE_TO_DDMONYYYY, 'DD-MON-YYYY')
AND TRUNC (SYSDATE) BETWEEN TRUNC (PPX.EFFECTIVE_START_DATE) AND TRUNC (PPX.EFFECTIVE_END_DATE);
AND AEH.REPORT_HEADER_ID=66989
AND AEH.INVOICE_NUM ='EX66989';
AEH.INVOICE_NUM "Report Number",
AEH.TOTAL,
AEH.DESCRIPTION,
PPX.FULL_NAME,
PPX.EMPLOYEE_NUMBER,
decode(AEH.WORKFLOW_APPROVED_FLAG,'S','SAVED','I','IMPLICIT SAVE','R','MANAGER REJECTED','M','MANAGER APPROVED','P','PAYABLES APPROVED','A','AUTO APPROVED','W','WITHDRAWN','Y','APPROVED','IN PROGRESS') Status,
(SELECT APPS.AP_WEB_POLICY_UTILS.GET_LOOKUP_MEANING('EXPENSE REPORT STATUS',
DECODE(AI.CANCELLED_DATE,
NULL,
AEH.EXPENSE_STATUS_CODE,
'CANCELLED'))
FROM APPS.AP_INVOICES_ALL AI
WHERE AI.INVOICE_ID(+) = AEH.VOUCHNO) "Report status",
NVL(AEH.REPORT_SUBMITTED_DATE, AEH.CREATION_DATE) "Report submitted on",
CASE
WHEN NVL2(AAP.ENTERED_DATE, 'Y', 'N') = 'Y' THEN
AAP.ENTERED_DATE
END "Manager Approved on",
AEH.EXPENSE_STATUS_CODE,
TRUNC(AEH.WEEK_END_DATE) "Report entered date",
ACA.EMPLOYEE_NUMBER "Auditor Emp Num",
ACA.FULL_NAME "Auditor Name",
ACA.ENTERED_DATE "Audited on"
FROM APPS.GL_SETS_OF_BOOKS GSOB,
APPS.AP_EXPENSE_REPORT_HEADERS_ALL AEH,
APPS.PER_PEOPLE_X PPX,
(SELECT ROW_NUMBER() OVER(PARTITION BY SOURCE_OBJECT_ID ORDER BY NOTE_ID DESC) SRL,
AN.NOTE_ID,
AN.SOURCE_OBJECT_ID,
AN.ENTERED_BY,
AN.ENTERED_DATE,
PPX.EMPLOYEE_NUMBER,
PPX.FULL_NAME
FROM APPS.AP_NOTES AN, APPS.FND_USER FU, APPS.PER_PEOPLE_X PPX
WHERE AN.ENTERED_BY = FU.USER_ID
AND FU.EMPLOYEE_ID = PPX.PERSON_ID
AND AN.SOURCE_OBJECT_CODE = 'OIE_EXPENSE_REPORT'
AND TO_CHAR(SUBSTR(AN.NOTES_DETAIL, 1, 24)) =
'Approver Action: Approve') AAP,
(SELECT ROW_NUMBER() OVER(PARTITION BY SOURCE_OBJECT_ID ORDER BY NOTE_ID DESC) SRL,
ANS.NOTE_ID,
ANS.SOURCE_OBJECT_ID,
ANS.ENTERED_BY,
ANS.ENTERED_DATE,
PPLX.EMPLOYEE_NUMBER,
PPLX.FULL_NAME
FROM APPS.AP_NOTES ANS, APPS.FND_USER FUR, APPS.PER_PEOPLE_X PPLX
WHERE ANS.ENTERED_BY = FUR.USER_ID
AND FUR.EMPLOYEE_ID = PPLX.PERSON_ID
AND ANS.SOURCE_OBJECT_CODE = 'OIE_EXPENSE_REPORT'
AND TO_CHAR(SUBSTR(ANS.NOTES_DETAIL, 1, 15)) = 'Complete Audit.') ACA
WHERE 1 = 1
AND AEH.REPORT_HEADER_ID = ACA.SOURCE_OBJECT_ID(+)
AND AEH.REPORT_HEADER_ID = AAP.SOURCE_OBJECT_ID(+)
AND AEH.EMPLOYEE_ID = PPX.PERSON_ID
AND GSOB.SET_OF_BOOKS_ID = AEH.SET_OF_BOOKS_ID
AND AEH.EXPENSE_STATUS_CODE NOT IN ('INVOICED', 'PAID', 'WITHDRAWN', 'REJECTED')
AND NVL (AAP.SRL, 1) = 1
AND NVL (ACA.SRL, 1) = 1
-- AND AEH.CREATION_DATE BETWEEN TO_DATE (:DATE_FROM_DDMONYYYY, 'DD-MON-YYYY') AND TO_DATE (:DATE_TO_DDMONYYYY, 'DD-MON-YYYY')
AND TRUNC (SYSDATE) BETWEEN TRUNC (PPX.EFFECTIVE_START_DATE) AND TRUNC (PPX.EFFECTIVE_END_DATE);
AND AEH.REPORT_HEADER_ID=66989
AND AEH.INVOICE_NUM ='EX66989';
No comments:
Post a Comment