Tuesday, August 2, 2011

Payroll GL Account wise Break Up - All Accounts

/* Payroll - Break Up for Different Accounts can be generated from following SQL */


SELECT FULL_NAME,
EMPLOYEE_NUMBER,
RESULT_VALUE,
REPORTING_NAME,
NAME,
COST_SEGMENTS,
COSTED_VALUE,
DEBIT_OR_CREDIT
FROM (SELECT PAP.FULL_NAME,
PAP.EMPLOYEE_NUMBER,
V.RESULT_VALUE,
E.REPORTING_NAME,
HORG.NAME,
PCAK.CONCATENATED_SEGMENTS COST_SEGMENTS,
PC.COSTED_VALUE,
PC.BALANCE_OR_COST,
PC.DEBIT_OR_CREDIT
FROM APPS.PAY_RUN_RESULT_VALUES V,
APPS.PAY_RUN_RESULTS R,
APPS.PAY_ELEMENT_TYPES_F E,
APPS.PAY_ASSIGNMENT_ACTIONS A,
APPS.pay_payroll_actions P,
APPS.HR_ALL_ORGANIZATION_UNITS HORG,
APPS.per_all_assignments_f PAA,
APPS.PAY_COST_ALLOCATION_KEYFLEX PCAK,
APPS.PAY_COSTS PC,
APPS.per_all_people_f PAP,
APPS.PAY_INPUT_VALUES_F PIV
WHERE R.ELEMENT_TYPE_ID = E.ELEMENT_TYPE_ID
AND V.RUN_RESULT_ID = R.RUN_RESULT_ID
--AND R.SOURCE_TYPE<>'E'
AND R.ASSIGNMENT_ACTION_ID = A.ASSIGNMENT_ACTION_ID
AND A.PAYROLL_ACTION_ID = P.PAYROLL_ACTION_ID
AND A.ASSIGNMENT_ID = PAA.ASSIGNMENT_ID
AND ('31-JUL-11' BETWEEN PAA.EFFECTIVE_START_DATE
AND PAA.EFFECTIVE_END_DATE)
AND PAA.PERSON_ID = PAP.PERSON_ID
AND ('31-JUL-11' BETWEEN PAP.EFFECTIVE_START_DATE
AND PAP.EFFECTIVE_END_DATE)
AND PAA.ORGANIZATION_ID = HORG.ORGANIZATION_ID
AND P.EFFECTIVE_DATE = '31-JUL-11'
AND PCAK.SEGMENT5 = :Account_code --51203
AND PC.COST_ALLOCATION_KEYFLEX_ID =
PCAK.COST_ALLOCATION_KEYFLEX_ID
AND R.RUN_RESULT_ID = PC.RUN_RESULT_ID
AND V.INPUT_VALUE_ID = PIV.INPUT_VALUE_ID
AND PIV.UOM = 'M'
AND P.PAYROLL_ID IN (01, 02, 03)) -- will change as per payroll id
WHERE RESULT_VALUE IS NOT NULL
--AND EMPLOYEE_NUMBER LIKE '5%'
GROUP BY FULL_NAME,
EMPLOYEE_NUMBER,
RESULT_VALUE,
REPORTING_NAME,
NAME,
COST_SEGMENTS,
COSTED_VALUE,
DEBIT_OR_CREDIT

No comments:

Post a Comment