<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>TimeWorked report by queue</title>
</head>
<body>
<h1>TimeWorked report by queue</h1>
<TABLE cellspacing=0 cellpadding=3 border=0 width=100%>
<TR>
% foreach my $attr (@attrs) {
% my $hattr= $attr; $hattr =~ s/Obj->(AsString|Name)$//;
<TD><b><%$hattr%></b></TD>
% }
</TR>
% while( my $Ticket = $Tickets->Next()) {
% $i++;
% $TimeWorked += $Ticket->TimeWorked;
<TR
<%($i % 2) && 'BGCOLOR="#eeeeee"'|n%>
>
% foreach my $attr (@attrs) {
<TD><% eval "\$Ticket->$attr()"%> </TD>
% }
</TR>
% }
% if ($i > 0) {
<TR <%(++$i % 2) && 'BGCOLOR="#eeeeee"'|n%>>
<TD COLSPAN="<% $#attrs %>"> </TD>
% my $worked_total = new RT::Date($session{'CurrentUser'});
% $TotalTimeAsString = $worked_total->DurationAsString($TimeWorked*60);
<TD><% $TotalTimeAsString %> (<% $TimeWorked %> min)</TD>
</TR>
% }
</TABLE>
<hr>
<form method=post action="timeworked.html">
Queue: <& /Elements/SelectQueue, Name => 'Queue', Default => $Queue->Id &>
StartDate: <& /Elements/SelectDate, Name => 'StartDate', Default => $ARGS{'StartDate'} &>
EndDate: <& /Elements/SelectDate, Name => 'EndDate', Default => $ARGS{'EndDate'} &>
<input type=submit value="Go">
</form>
</body>
</html>
<%INIT>
my ($i, $TimeWorked, $TotalTimeAsString);
my @attrs = qw( QueueObj->Name Id Priority Subject OwnerObj->Name
RequestorsAsString DueAsString ToldObj->AsString
CreatedObj->AsString ResolvedObj->AsString TimeWorkedAsString);
my $StartDate = new RT::Date($session{'CurrentUser'});
$StartDate->Set( Format => 'unknown',
Value => $ARGS{'StartDate'});
my $EndDate = new RT::Date($session{'CurrentUser'});
$EndDate->Set( Format => 'unknown',
Value => $ARGS{'EndDate'});
my $Queue = new RT::Queue($session{'CurrentUser'});
$Queue->Load($ARGS{'Queue'});
my $Tickets = new RT::Tickets($session{'CurrentUser'});
$Tickets->LimitQueue(VALUE=>$Queue->Id) if ($Queue->Id);
$Tickets->LimitDate(FIELD => 'Resolved',
OPERATOR => '>=', VALUE => $StartDate->ISO);
$Tickets->LimitDate(FIELD => 'Resolved',
OPERATOR => '<=', VALUE => $EndDate->ISO);
</%INIT>