<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Verdana","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-GB link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:#1F497D'>I had a bit of a go at doing this myself. It needs some more
work as it doesnt take into account if time has been removed from a ticket. It
happens sometimes because of typos etc.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:#1F497D'>If you get anywhere with this please share it, as I havent had
the time to work on it further.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:#1F497D'>PRNumber is an internal reference number that we book client
work too, so you wont need that, or you can change it for something else.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>SELECT
distinct SUM(Transactions.TimeTaken) AS 'Time Taken (Mins)',
Transactions.Created, Users.RealName, Tickets.Subject, Queues.Name AS 'Queue
Name', Transactions.ObjectId AS 'Ticket ID',<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>(select
ObjectCustomFieldValues.Content from ObjectCustomFieldValues where
ObjectCustomFieldValues.CustomField = '11' and Transactions.ObjectId =
ObjectCustomFieldValues.ObjectId order by ObjectCustomFieldValues.id desc LIMIT
1) AS PRNumber<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>FROM
Transactions<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>LEFT
JOIN Users<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>ON
Transactions.Creator = Users.Id<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>LEFT
JOIN Tickets<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>ON
Transactions.ObjectId = Tickets.id<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>LEFT
JOIN Queues<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>ON
Tickets.Queue = Queues.Id<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>WHERE
Transactions.TimeTaken !=0<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>AND
DATE_SUB(CURDATE(),INTERVAL 15 DAY) <= Transactions.Created<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>GROUP BY
Subject;<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] <b>On Behalf Of </b>Stephen
Cochran<br>
<b>Sent:</b> 03 March 2009 05:01<br>
<b>To:</b> rt Users<br>
<b>Subject:</b> [rt-users] Time Worked Report<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><br>
I've written a sql query to pull out the time worked for all tickets resolved
in the last week among other things. The problem with this is that it doesn't
give a complete picture of time worked for any given week since a ticket could
have had time worked put in as part of a transaction but the ticket might still
be open. I could query the Transactions table for the TimeTaken field, but that
could lead to double-counting if any of those transactions are part of a
resolved ticket. <br>
<br>
I know I could work through the db/sql and find the right query to pull out the
time worked in the last week, but I'm wondering if someone else has already
done it so I can save myself the trouble.<br>
<br>
Thanks, <br>
Steve<o:p></o:p></p>
</div>
</body>
</html>