/build/static/layout/Breadcrumb_cap_w.png

Work Report last 31 days by person - Sum Hours

Hello!


We have recently started using the kbox for ticketing.  My bosses really like this report, Work Report last 31 days by person, but they want it to sum the hours for each user.


I have created a different report, but they would like it all in one.


Advice?


select W.STOP as DATE, CONCAT(CAST(T.ID AS CHAR), " - ", T.TITLE) as TICKET, U.FULL_NAME, substring(W.NOTE,1,1200) as NOTE,

format((time_to_sec(timediff(stop, start)))/3600.0 + ADJUSTMENT_HOURS,2) as HOURS_WORKED

from (HD_WORK W, HD_TICKET T, USER U)

where W.HD_TICKET_ID = T.ID

  and isnull(W.VOIDED_BY)

  and W.USER_ID = U.ID

  and W.STOP > DATE_SUB(NOW(), INTERVAL 31 DAY)

order by U.FULL_NAME, TICKET, W.STOP


0 Comments   [ + ] Show comments

Answers (2)

Posted by: Hobbsy 8 months ago
Red Belt
0

Try this and see if it works

SELECT 

    U.ID AS USER_ID,

    U.FULL_NAME,

    COUNT(*) AS TOTAL_TICKETS,

    SUM(FORMAT((TIME_TO_SEC(TIMEDIFF(W.STOP, W.START)))/3600.0 + W.ADJUSTMENT_HOURS, 2)) AS TOTAL_HOURS_WORKED

FROM 

    HD_WORK W

INNER JOIN 

    HD_TICKET T ON W.HD_TICKET_ID = T.ID

INNER JOIN 

    USER U ON W.USER_ID = U.ID

WHERE 

    ISNULL(W.VOIDED_BY)

    AND W.STOP > DATE_SUB(NOW(), INTERVAL 31 DAY)

GROUP BY 

    U.ID, U.FULL_NAME

ORDER BY 

    U.ID


Posted by: amwoods 8 months ago
Yellow Belt
0

Thank you this is very nice!  Is there a way to add in the the ticket break down as well by hour?


This is outside my skill level, and I really appreciate the help!

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ