SELECT DMG.BUDGET_ID , DMG.BUDGET_START_DT , DMG.TREE_NODE_NUM , STS.TREE_NODE_NUM_END , dmg.emplid , dmg.empl_rcd , SUM(SAL.WCS_P_AMT ) , CASE WHEN SUM(%DecMult(%DecDiv(%Coalesce(SAL.WCS_P_AMT, SAL.WCS_A_AMT), dmg.wcs_annual_rt), 100)) > 999.99 THEN 999.99 ELSE %Round(SUM(%DecMult(%DecDiv(%Coalesce(SAL.WCS_P_AMT, SAL.WCS_A_AMT), dmg.wcs_annual_rt), 100)),2) END , SAL.SEQNUM , MAX(SAL.WCS_MIN_PCT ) , MAX(SAL.WCS_MAX_PCT ) FROM PS_WCS_ECM_EE_DMG DMG , PS_WCS_ECM_NOD_STS STS , PS_WCS_ECM_EE_SAL SAL WHERE DMG.BUDGET_ID = STS.BUDGET_ID AND DMG.BUDGET_START_DT = STS.BUDGET_START_DT AND DMG.TREE_NODE_NUM = STS.TREE_NODE_NUM AND DMG.BUDGET_ID = SAL.BUDGET_ID AND DMG.BUDGET_START_DT = SAL.BUDGET_START_DT AND DMG.TREE_NODE_NUM = SAL.TREE_NODE_NUM AND DMG.EMPLID = SAL.EMPLID AND DMG.EMPL_RCD = SAL.EMPL_RCD GROUP BY DMG.BUDGET_ID , DMG.BUDGET_START_DT , DMG.TREE_NODE_NUM , STS.TREE_NODE_NUM_END , dmg.emplid ,dmg.empl_rcd, SAL.SEQNUM
|