AnsweredAssumed Answered

Actual hours on project

Question asked by branko.ogorelec on Oct 28, 2013
Latest reply on Oct 31, 2013 by branko.ogorelec

I need to get actual hours on a specified project, summed for each employee. Out-of-the-box, these values are displayed on Team tab. I have created a query that gets this data from timentry table, for all timesheets that are posted. Query looks like this:

select  (rs.FIRST_NAME + ' ' + rs.LAST_NAME) as pEmployee, sum(te.PRACTSUM/3600) as pTime
from niku.PRTIMESHEET ts
                inner join PRTIMEENTRY te on te.PRTIMESHEETID =ts.PRID
                inner join SRM_RESOURCES rs on ts.PRRESOURCEID=rs.ID
                inner join PRASSIGNMENT asg on te.PRASSIGNMENTID=asg.PRID
                inner join PRTASK tsk on asg.PRTASKID=tsk.PRID
                inner join INV_INVESTMENTS inv on tsk.PRPROJECTID= inv.ID
where
                te.PRACTSUM>0
                and ts.PRSTATUS=4
                and inv.id=@inv_id
group by rs.ID, (rs.FIRST_NAME + ' ' + rs.LAST_NAME)
 

This is satisfactory for us and we are getting what we need – the same values as on Team tab. However, I'm wondering if I am missing something. Maybe some job is calculating actual hours and storing those values somewhere, so my query could be simpler and more efficient. Any suggestions?

Outcomes