Solved 6 Years ago through Puzzles
Few Steps to achieve, but achieved :)
1. Created CTE to get the distinct empid,weekid,earningcode and hours.
2. Created another CTE to get the weekstart and weekend for the header and recursive with above created CTE to get the earningcode and hours.