2008-02-27 23:50:19 +03:00
|
|
|
<div class="contextual">
|
2010-10-07 19:51:09 +04:00
|
|
|
<%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'new', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time-add' %>
|
2008-02-27 23:50:19 +03:00
|
|
|
</div>
|
|
|
|
|
2008-08-31 20:34:54 +04:00
|
|
|
<%= render_timelog_breadcrumb %>
|
|
|
|
|
2007-06-24 20:07:06 +04:00
|
|
|
<h2><%= l(:label_spent_time) %></h2>
|
|
|
|
|
2011-12-02 23:33:05 +04:00
|
|
|
<% form_tag({:controller => 'timelog', :action => 'report', :project_id => @project, :issue_id => @issue}, :method => :get, :id => 'query_form') do %>
|
2011-12-02 22:46:43 +04:00
|
|
|
<% @report.criteria.each do |criterion| %>
|
|
|
|
<%= hidden_field_tag 'criteria[]', criterion, :id => nil %>
|
2007-06-24 20:07:06 +04:00
|
|
|
<% end %>
|
2010-10-05 20:07:17 +04:00
|
|
|
<%= render :partial => 'timelog/date_range' %>
|
2008-04-02 02:42:10 +04:00
|
|
|
|
2011-10-29 05:22:02 +04:00
|
|
|
<p><label for='columns'><%= l(:label_details) %></label>: <%= select_tag 'columns', options_for_select([[l(:label_year), 'year'],
|
2008-04-01 23:40:40 +04:00
|
|
|
[l(:label_month), 'month'],
|
2008-04-05 20:40:26 +04:00
|
|
|
[l(:label_week), 'week'],
|
2011-12-02 22:46:43 +04:00
|
|
|
[l(:label_day_plural).titleize, 'day']], @report.columns),
|
2012-01-25 01:01:49 +04:00
|
|
|
:onchange => "this.form.submit();" %>
|
2007-06-24 20:07:06 +04:00
|
|
|
|
2011-12-02 22:46:43 +04:00
|
|
|
<label for='criterias'><%= l(:button_add) %></label>: <%= select_tag('criteria[]', options_for_select([[]] + (@report.available_criteria.keys - @report.criteria).collect{|k| [l_or_humanize(@report.available_criteria[k][:label]), k]}),
|
2011-04-03 15:55:24 +04:00
|
|
|
:onchange => "this.form.submit();",
|
2008-02-27 23:50:19 +03:00
|
|
|
:style => 'width: 200px',
|
2008-04-02 02:42:10 +04:00
|
|
|
:id => nil,
|
2011-12-02 22:46:43 +04:00
|
|
|
:disabled => (@report.criteria.length >= 3), :id => "criterias") %>
|
|
|
|
<%= link_to l(:button_clear), {:project_id => @project, :issue_id => @issue, :period_type => params[:period_type], :period => params[:period], :from => @from, :to => @to, :columns => @report.columns}, :class => 'icon icon-reload' %></p>
|
2008-04-01 23:40:40 +04:00
|
|
|
<% end %>
|
|
|
|
|
2011-12-02 22:46:43 +04:00
|
|
|
<% unless @report.criteria.empty? %>
|
2008-02-27 23:50:19 +03:00
|
|
|
<div class="total-hours">
|
2011-12-02 22:46:43 +04:00
|
|
|
<p><%= l(:label_total) %>: <%= html_hours(l_hours(@report.total_hours)) %></p>
|
2008-02-27 23:50:19 +03:00
|
|
|
</div>
|
2007-06-24 20:07:06 +04:00
|
|
|
|
2011-12-02 22:46:43 +04:00
|
|
|
<% unless @report.hours.empty? %>
|
2011-11-29 22:32:28 +04:00
|
|
|
<div class="autoscroll">
|
2008-02-27 23:50:19 +03:00
|
|
|
<table class="list" id="time-report">
|
2007-06-24 20:07:06 +04:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2011-12-02 22:46:43 +04:00
|
|
|
<% @report.criteria.each do |criteria| %>
|
|
|
|
<th><%= l_or_humanize(@report.available_criteria[criteria][:label]) %></th>
|
2007-06-24 20:07:06 +04:00
|
|
|
<% end %>
|
2011-12-02 22:46:43 +04:00
|
|
|
<% columns_width = (40 / (@report.periods.length+1)).to_i %>
|
|
|
|
<% @report.periods.each do |period| %>
|
2008-04-05 20:40:26 +04:00
|
|
|
<th class="period" width="<%= columns_width %>%"><%= period %></th>
|
2007-06-24 20:07:06 +04:00
|
|
|
<% end %>
|
2008-04-05 20:40:26 +04:00
|
|
|
<th class="total" width="<%= columns_width %>%"><%= l(:label_total) %></th>
|
2007-06-24 20:07:06 +04:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2011-12-02 22:46:43 +04:00
|
|
|
<%= render :partial => 'report_criteria', :locals => {:criterias => @report.criteria, :hours => @report.hours, :level => 0} %>
|
2008-02-27 23:50:19 +03:00
|
|
|
<tr class="total">
|
|
|
|
<td><%= l(:label_total) %></td>
|
2012-01-01 10:11:46 +04:00
|
|
|
<%= ('<td></td>' * (@report.criteria.size - 1)).html_safe %>
|
2008-04-05 20:40:26 +04:00
|
|
|
<% total = 0 -%>
|
2011-12-02 22:46:43 +04:00
|
|
|
<% @report.periods.each do |period| -%>
|
|
|
|
<% sum = sum_hours(select_hours(@report.hours, @report.columns, period.to_s)); total += sum -%>
|
2008-02-27 23:50:19 +03:00
|
|
|
<td class="hours"><%= html_hours("%.2f" % sum) if sum > 0 %></td>
|
|
|
|
<% end -%>
|
2008-04-05 20:40:26 +04:00
|
|
|
<td class="hours"><%= html_hours("%.2f" % total) if total > 0 %></td>
|
2008-02-27 23:50:19 +03:00
|
|
|
</tr>
|
2007-06-24 20:07:06 +04:00
|
|
|
</tbody>
|
|
|
|
</table>
|
2011-11-29 22:32:28 +04:00
|
|
|
</div>
|
2008-04-07 21:18:09 +04:00
|
|
|
|
2009-01-29 16:53:17 +03:00
|
|
|
<% other_formats_links do |f| %>
|
2011-09-18 05:11:05 +04:00
|
|
|
<%= f.link_to 'CSV', :url => params %>
|
2009-01-29 16:53:17 +03:00
|
|
|
<% end %>
|
2007-06-24 20:07:06 +04:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|
2008-04-02 02:42:10 +04:00
|
|
|
|
|
|
|
<% html_title l(:label_spent_time), l(:label_report) %>
|
|
|
|
|