Friday, 2 May 2014

Retreving HRMS / PAYROLL Element Entry Values

 SELECT DISTINCT
         PET.ELEMENT_TYPE_ID,
         PET.ELEMENT_NAME,
         PEEV.EFFECTIVE_START_DATE ELE_ENTR_EFF_STDT,
         PEEV.EFFECTIVE_END_DATE ELE_ENTR_EFF_ENDT,
         SUM (TO_NUMBER (NVL (PEEV.SCREEN_ENTRY_VALUE, 0))) SCRN_ENTRY_VALUE,
         PEE.ELEMENT_ENTRY_ID,
         PIV.NAME,
         PEL.PAYROLL_ID,
         PRF.PAYROLL_NAME,
         PEE.ASSIGNMENT_ID,
         PAPF.EMPLOYEE_NUMBER,
         PAPF.FULL_NAME
    FROM PAY_ELEMENT_TYPES_F PET,
         PAY_INPUT_VALUES_F PIV,
         PAY_ELEMENT_LINKS_F PEL,
         PAY_ELEMENT_ENTRIES_F PEE,
         PER_ALL_ASSIGNMENTS_F PAAF,
         PER_ALL_PEOPLE_F PAPF,
         PAY_ELEMENT_ENTRY_VALUES_F PEEV,
         PAY_ALL_PAYROLLS_F PRF
   WHERE     PET.ELEMENT_TYPE_ID = PEL.ELEMENT_TYPE_ID
         AND PET.ELEMENT_TYPE_ID = PIV.ELEMENT_TYPE_ID
         AND PIV.INPUT_VALUE_ID = PEEV.INPUT_VALUE_ID
         AND PEL.ELEMENT_LINK_ID = PEE.ELEMENT_LINK_ID
         AND PEE.ELEMENT_ENTRY_ID = PEEV.ELEMENT_ENTRY_ID
         AND TRUNC (SYSDATE) BETWEEN TRUNC (PEE.EFFECTIVE_START_DATE)
                                 AND TRUNC (PEE.EFFECTIVE_END_DATE)
         AND PAAF.ASSIGNMENT_ID = PEE.ASSIGNMENT_ID
         AND TRUNC (SYSDATE) BETWEEN TRUNC (PAAF.EFFECTIVE_START_DATE)
                                 AND TRUNC (PAAF.EFFECTIVE_END_DATE)
         AND PAPF.PERSON_ID = PAAF.PERSON_ID
         AND PAPF.CURRENT_EMP_OR_APL_FLAG = 'Y'
         AND TRUNC (SYSDATE) BETWEEN TRUNC (PAPF.EFFECTIVE_START_DATE)
                                 AND TRUNC (PAPF.EFFECTIVE_END_DATE)
         AND PEL.PAYROLL_ID = PRF.PAYROLL_ID
         AND :PAY_START_DATE BETWEEN PET.EFFECTIVE_START_DATE
                                 AND PET.EFFECTIVE_END_DATE
         AND :PAY_START_DATE BETWEEN PIV.EFFECTIVE_START_DATE
                                 AND PIV.EFFECTIVE_END_DATE
         AND :PAY_START_DATE BETWEEN PEL.EFFECTIVE_START_DATE
                                 AND PEL.EFFECTIVE_END_DATE
         AND :PAY_START_DATE BETWEEN PEE.EFFECTIVE_START_DATE
                                 AND PEE.EFFECTIVE_END_DATE
         AND :PAY_START_DATE BETWEEN PEEV.EFFECTIVE_START_DATE
                                 AND PEEV.EFFECTIVE_END_DATE
         AND PEE.ASSIGNMENT_ID = :ASSIGN_ID
         AND PET.ELEMENT_NAME LIKE :ELE_NAME
         --and piv.name='Pay Value'
         AND PIV.NAME = 'Amount'
GROUP BY PET.ELEMENT_TYPE_ID,
         PET.ELEMENT_NAME,                                      
         PEEV.EFFECTIVE_START_DATE,
         PEEV.EFFECTIVE_END_DATE,
         PEE.ELEMENT_ENTRY_ID,
         PEEV.SCREEN_ENTRY_VALUE,
         PIV.NAME,
         PEE.ASSIGNMENT_ID,
         PEL.PAYROLL_ID,
         PRF.PAYROLL_NAME,
         PAPF.EMPLOYEE_NUMBER,
         PAPF.FULL_NAME
ORDER BY PEE.ASSIGNMENT_ID, PEEV.EFFECTIVE_START_DATE DESC;

No comments:

Post a Comment