To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / app / views / timelog / report.html.erb @ 1591:63650ae64bf2
History | View | Annotate | Download (3.43 KB)
| 1 |
<div class="contextual"> |
|---|---|
| 2 |
<%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'new', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time-add' %>
|
| 3 |
</div>
|
| 4 |
|
| 5 |
<%= render_timelog_breadcrumb %>
|
| 6 |
|
| 7 |
<h2><%= l(:label_spent_time) %></h2> |
| 8 |
|
| 9 |
<%= form_tag({:controller => 'timelog', :action => 'report',
|
| 10 |
:project_id => @project, :issue_id => @issue},
|
| 11 |
:method => :get, :id => 'query_form') do %>
|
| 12 |
<% @report.criteria.each do |criterion| %>
|
| 13 |
<%= hidden_field_tag 'criteria[]', criterion, :id => nil %>
|
| 14 |
<% end %>
|
| 15 |
<%= render :partial => 'timelog/date_range' %>
|
| 16 |
|
| 17 |
<p><label for='columns'><%= l(:label_details) %></label>: <%= select_tag 'columns', options_for_select([[l(:label_year), 'year'], |
| 18 |
[l(:label_month), 'month'],
|
| 19 |
[l(:label_week), 'week'],
|
| 20 |
[l(:label_day_plural).titleize, 'day']], @report.columns),
|
| 21 |
:onchange => "this.form.submit();" %>
|
| 22 |
|
| 23 |
<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]}), |
| 24 |
:onchange => "this.form.submit();",
|
| 25 |
:style => 'width: 200px',
|
| 26 |
:id => nil,
|
| 27 |
:disabled => (@report.criteria.length >= 3), :id => "criterias") %>
|
| 28 |
<%= 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> |
| 29 |
<% end %>
|
| 30 |
|
| 31 |
<% unless @report.criteria.empty? %>
|
| 32 |
<div class="total-hours"> |
| 33 |
<p><%= l(:label_total_time) %>: <%= html_hours(l_hours(@report.total_hours)) %></p> |
| 34 |
</div>
|
| 35 |
|
| 36 |
<% unless @report.hours.empty? %>
|
| 37 |
<div class="autoscroll"> |
| 38 |
<table class="list" id="time-report"> |
| 39 |
<thead>
|
| 40 |
<tr>
|
| 41 |
<% @report.criteria.each do |criteria| %>
|
| 42 |
<th><%= l_or_humanize(@report.available_criteria[criteria][:label]) %></th> |
| 43 |
<% end %>
|
| 44 |
<% columns_width = (40 / (@report.periods.length+1)).to_i %>
|
| 45 |
<% @report.periods.each do |period| %>
|
| 46 |
<th class="period" style="width:<%= columns_width %>%;"><%= period %></th> |
| 47 |
<% end %>
|
| 48 |
<th class="total" style="width:<%= columns_width %>%;"><%= l(:label_total_time) %></th> |
| 49 |
</tr>
|
| 50 |
</thead>
|
| 51 |
<tbody>
|
| 52 |
<%= render :partial => 'report_criteria', :locals => {:criterias => @report.criteria, :hours => @report.hours, :level => 0} %>
|
| 53 |
<tr class="total"> |
| 54 |
<td><%= l(:label_total_time) %></td> |
| 55 |
<%= ('<td></td>' * (@report.criteria.size - 1)).html_safe %>
|
| 56 |
<% total = 0 -%>
|
| 57 |
<% @report.periods.each do |period| -%>
|
| 58 |
<% sum = sum_hours(select_hours(@report.hours, @report.columns, period.to_s)); total += sum -%>
|
| 59 |
<td class="hours"><%= html_hours("%.2f" % sum) if sum > 0 %></td> |
| 60 |
<% end -%>
|
| 61 |
<td class="hours"><%= html_hours("%.2f" % total) if total > 0 %></td> |
| 62 |
</tr>
|
| 63 |
</tbody>
|
| 64 |
</table>
|
| 65 |
</div>
|
| 66 |
|
| 67 |
<% other_formats_links do |f| %>
|
| 68 |
<%= f.link_to 'CSV', :url => params %>
|
| 69 |
<% end %>
|
| 70 |
<% end %>
|
| 71 |
<% end %>
|
| 72 |
|
| 73 |
<% html_title l(:label_spent_time), l(:label_report) %>
|
| 74 |
|