diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb
index 1756758..66507fa 100644
--- a/app/controllers/timelog_controller.rb
+++ b/app/controllers/timelog_controller.rb
@@ -49,6 +49,14 @@ class TimelogController < ApplicationController
     retrieve_date_range
 
     scope = TimeEntry.visible.spent_between(@from, @to)
+    scope = scope.on_user(params[:member]) unless params[:member].nil?
+    scope = scope.on_activity(params[:activity]) unless params[:activity].nil?
+    scope = scope.on_tracker(params[:tracker]) unless params[:tracker].nil?
+    scope = scope.on_version(params[:version]) unless params[:version].nil?
+    scope = scope.on_category(params[:category]) unless params[:category].nil?
+    scope = scope.on_project(Project.find(params[:project].to_i), false) unless params[:project].nil?
+    scope = scope.on_project(Project.find(params[:toplevel_project].to_i), true) unless params[:toplevel_project].nil?
+    @issue = Issue.find(params[:issue]) unless params[:issue].nil?
     if @issue
       scope = scope.on_issue(@issue)
     elsif @project
diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb
index ef085d8..08cef4a 100644
--- a/app/models/time_entry.rb
+++ b/app/models/time_entry.rb
@@ -65,7 +65,25 @@ class TimeEntry < ActiveRecord::Base
      {}
     end
   }
-
+  scope :on_user, lambda {|user| {
+    :conditions => ["#{TimeEntry.table_name}.user_id = ?", user]
+  }}
+  scope :on_activity, lambda {|activity| {
+    :conditions => ["#{TimeEntry.table_name}.activity_id = ?", activity]
+  }}
+  scope :on_tracker, lambda {|tracker| {
+    :include => :issue,
+    :conditions => ["#{Issue.table_name}.tracker_id = ?", tracker]
+  }}
+  scope :on_version, lambda {|version| {
+    :include => :issue,
+    :conditions => ["#{Issue.table_name}.fixed_version_id = ?", version]
+  }}
+  scope :on_category, lambda {|category| {
+    :include => :issue,
+    :conditions => ["#{Issue.table_name}.category_id = ?", category]
+  }}
+  
   safe_attributes 'hours', 'comments', 'issue_id', 'activity_id', 'spent_on', 'custom_field_values', 'custom_fields'
 
   def initialize(attributes=nil, *args)
diff --git a/app/views/timelog/_report_criteria.html.erb b/app/views/timelog/_report_criteria.html.erb
index 9a5d142..5b0997c 100644
--- a/app/views/timelog/_report_criteria.html.erb
+++ b/app/views/timelog/_report_criteria.html.erb
@@ -1,19 +1,48 @@
-<% @report.hours.collect {|h| h[criterias[level]].to_s}.uniq.each do |value| %>
-<% hours_for_value = select_hours(hours, criterias[level], value) -%>
-<% next if hours_for_value.empty? -%>
-<tr class="<%= cycle('odd', 'even') %> <%= criterias.length > level+1 ? 'subtotal' : 'last-level' %>">
-<%= ("<td></td>" * level).html_safe %>
-<td><%= h(format_criteria_value(@report.available_criteria[criterias[level]], value)) %></td>
-<%= ("<td></td>" * (criterias.length - level - 1)).html_safe -%>
-  <% total = 0 -%>
-  <% @report.periods.each do |period| -%>
-    <% sum = sum_hours(select_hours(hours_for_value, @report.columns, period.to_s)); total += sum -%>
-    <td class="hours"><%= html_hours("%.2f" % sum) if sum > 0 %></td>
+<% @report.hours.collect {|h| h[criteria[level]].to_s}.uniq.each do |value| %>
+  <% hours_for_value = grand_total ? hours: select_hours(hours, criteria[level], value) -%>
+  <% next if hours_for_value.empty? -%>
+  <tr class="<%= cycle('odd', 'even') %> <%= grand_total ? 'total' : criteria.length > level+1 ? 'subtotal' : 'last-level' %>  <%= 'current-users-row' if criteria[level] == 'member' && User.current.try(:id) == value.to_i %>">
+    <%= ("<td></td>" * level).html_safe %>
+    <td>
+      <% if grand_total %>
+        <%= l(:label_total) %>
+      <% elsif !value.empty? %>
+        <%=  case criteria[level] 
+         when 'issue': link_to_issue Issue.find(value), :project => true 
+         when 'project': link_to_project Project.find(value) 
+         when 'member': link_to_user User.find(value) 
+         else h(format_criteria_value(@report.available_criteria[criteria[level]], value))
+         end %>
+      <% end %>
+    </td>
+    <%= ("<td></td>" * (criteria.length - level - 1)).html_safe -%>
+    <% total = 0 -%>
+    <% criteria_set = {} -%>
+    <% @report.periods.each do |period| -%>
+      <td class="hours">
+        <% data = select_hours(hours_for_value, @report.columns, period.to_s) %>
+        <% sum = sum_hours(data); total += sum -%>
+        <% if sum > 0 %>
+          <% period_from, period_to = nil, nil -%>
+          <% case when @report.columns.to_s == 'day'; period_from = period_to = period -%>
+          <% when @report.columns.to_s == 'week'; period_from = Date.commercial(data[0]['tyear'].to_f, data[0]['tweek'].to_f, 1); period_to = period_from + 6 -%>
+          <% when @report.columns.to_s == 'month'; period_from = Date.civil(data[0]['tyear'].to_f, data[0]['tmonth'].to_f, 1); period_to = (period_from >> 1) - 1 -%>
+          <% when @report.columns.to_s == 'year'; period_from = Date.civil(data[0]['tyear'].to_f, 1, 1); period_to = Date.civil(data[0]['tyear'].to_f, 12, 31) -%>
+          <% end -%>
+          <% period_from = params[:from].to_s.to_date if !params[:from].blank? && params[:from].to_s.to_date > period_from.to_date %>
+          <% period_to = params[:to].to_s.to_date if !params[:to].blank? && params[:to].to_s.to_date < period_to.to_date %>
+          <% (level+1).times do |i|  -%>
+            <%  criteria_set[criteria[i].to_sym] = data[0][criteria[i]].to_s -%>
+          <% end unless grand_total %>
+          <%= link_to html_hours("%.2f" % sum), {:controller => 'timelog', :action => 'index', :from => period_from, :to => period_to}.merge(criteria_set) %>
+        <% end -%>
+      </td>
+    <% end -%>
+    <td class="hours"><%= (link_to html_hours("%.2f" % total), {:controller => 'timelog', :action => 'index', :period => params[:period], :from => @from, :to => @to}.merge(criteria_set)) if total > 0 %></td>
+  </tr>
+  <% break if grand_total  %>
+  <% if criteria.length > level+1 -%>
+    <%= render(:partial => 'report_criteria', :locals => {:criteria => criteria, :hours => hours_for_value, :level => (level + 1), :grand_total => false}) %>
   <% end -%>
-  <td class="hours"><%= html_hours("%.2f" % total) if total > 0 %></td>
-</tr>
-<% if criterias.length > level+1 -%>
-  <%= render(:partial => 'report_criteria', :locals => {:criterias => criterias, :hours => hours_for_value, :level => (level + 1)}) %>
-<% end -%>
 
 <% end %>
diff --git a/app/views/timelog/report.html.erb b/app/views/timelog/report.html.erb
index 4b9f0be..225a0b2 100644
--- a/app/views/timelog/report.html.erb
+++ b/app/views/timelog/report.html.erb
@@ -49,17 +49,8 @@
 </tr>
 </thead>
 <tbody>
-<%= render :partial => 'report_criteria', :locals => {:criterias => @report.criteria, :hours => @report.hours, :level => 0} %>
-  <tr class="total">
-  <td><%= l(:label_total) %></td>
-  <%= ('<td></td>' * (@report.criteria.size - 1)).html_safe %>
-  <% total = 0 -%>
-  <% @report.periods.each do |period| -%>
-    <% sum = sum_hours(select_hours(@report.hours, @report.columns, period.to_s)); total += sum -%>
-    <td class="hours"><%= html_hours("%.2f" % sum) if sum > 0 %></td>
-  <% end -%>
-  <td class="hours"><%= html_hours("%.2f" % total) if total > 0 %></td>
-  </tr>
+<%= render :partial => 'report_criteria', :locals => {:criteria => @report.criteria, :hours => @report.hours, :level => 0, :grand_total => false} %>
+<%= render :partial => 'report_criteria', :locals => {:criteria => @report.criteria, :hours => @report.hours, :level => 0, :grand_total => true} %>
 </tbody>
 </table>
 </div>
